458 lines
14 KiB
JavaScript
458 lines
14 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_shop_goods_index = require("../../api/shop/goods/index.js");
|
|
const api_layout_index = require("../../api/layout/index.js");
|
|
const api_shop_merchant_index = require("../../api/shop/merchant/index.js");
|
|
const api_booking_users_index = require("../../api/booking/users/index.js");
|
|
const api_booking_item_index = require("../../api/booking/item/index.js");
|
|
const api_passport_login_index = require("../../api/passport/login/index.js");
|
|
const api_shop_users_index = require("../../api/shop/users/index.js");
|
|
const store_modules_tenant = require("../../store/modules/tenant.js");
|
|
const tenantStore = store_modules_tenant.useTenantStore();
|
|
const _sfc_main = {
|
|
data() {
|
|
return {
|
|
items: ["关注", "推荐"],
|
|
// 场馆列表
|
|
merchant: [],
|
|
// 网站参数
|
|
fields: {},
|
|
// 幻灯片广告
|
|
ads: [],
|
|
// 幻灯片链接地址
|
|
pathList: [],
|
|
// 项目列表
|
|
itemList: [],
|
|
// 小程序导航图标
|
|
navigation: [],
|
|
// 小程序导航图标(双排)
|
|
doubleNavigation: [],
|
|
isLogin: false,
|
|
userInfo: {},
|
|
// 骨架屏
|
|
hideTools: true,
|
|
mp_menu_display_method: 0,
|
|
baseList: [
|
|
{
|
|
name: "photo",
|
|
title: "李白"
|
|
},
|
|
{
|
|
name: "lock",
|
|
title: "韩信"
|
|
},
|
|
{
|
|
name: "star",
|
|
title: "刘备"
|
|
},
|
|
{
|
|
name: "star",
|
|
title: "元芳"
|
|
}
|
|
]
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.reload();
|
|
},
|
|
methods: {
|
|
async reload() {
|
|
const app = this;
|
|
const info = await tenantStore.fetchTenantInfo();
|
|
if (common_vendor.index.getStorageSync("user_id") && common_vendor.index.getStorageSync("access_token")) {
|
|
app.isLogin = true;
|
|
if (!common_vendor.index.getStorageSync("openid")) {
|
|
api_booking_users_index.getByPhone({
|
|
phone: info.userInfo.phone
|
|
}).then((data) => {
|
|
if (data) {
|
|
app.userInfo.ouid = data.uid;
|
|
common_vendor.index.setStorageSync("ouid", data.uid);
|
|
app.userInfo = Object.assign({}, app.userInfo, data);
|
|
}
|
|
});
|
|
common_vendor.index.login({
|
|
success: (res) => {
|
|
api_passport_login_index.getWxOpenId({
|
|
code: res.code
|
|
}).then((response) => {
|
|
common_vendor.index.setStorageSync("openid", response.openid);
|
|
api_shop_users_index.updateUsers({
|
|
uid: app.userInfo.ouid,
|
|
openid: response.openid,
|
|
sessionKey: response.session_key,
|
|
unionid: response.unionid
|
|
});
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
if (info.fields) {
|
|
info.fields.map((d) => {
|
|
const key = d.name;
|
|
app.fields[key] = d.value;
|
|
if (d.name == "h5_url") {
|
|
common_vendor.index.setStorageSync(d.name, d.value);
|
|
}
|
|
if (d.name == "mp_menu_display_method") {
|
|
app.mp_menu_display_method = d.value;
|
|
}
|
|
});
|
|
}
|
|
if (info.ads) {
|
|
const ad = info.ads.filter((d) => d.adType == "幻灯片");
|
|
if (ad) {
|
|
const adsList = JSON.parse(ad[0].images);
|
|
adsList.map((d) => {
|
|
app.ads.push(d.url);
|
|
});
|
|
app.pathList = JSON.parse(ad[0].path);
|
|
}
|
|
app.hideTools = false;
|
|
}
|
|
if (info.websiteName) {
|
|
common_vendor.index.setNavigationBarTitle({
|
|
title: info.websiteName
|
|
});
|
|
}
|
|
if (info.websiteLogo) {
|
|
common_vendor.index.setStorageSync("app_logo", info.websiteLogo);
|
|
app.logo = info.websiteLogo;
|
|
}
|
|
if (info.mpMenus) {
|
|
const arr = info.mpMenus.filter((d) => d.type == 2 && d.rows == 0);
|
|
const arr1 = info.mpMenus.filter((d) => d.type == 2 && d.rows == 1);
|
|
info.mpMenus.filter((d) => d.type == 2 && d.rows == 2);
|
|
app.navigation = [];
|
|
app.doubleNavigation = [];
|
|
if (arr1) {
|
|
app.doubleNavigation.push(arr);
|
|
app.doubleNavigation.push(arr1);
|
|
} else {
|
|
app.doubleNavigation.push(arr);
|
|
}
|
|
if (arr) {
|
|
app.navigation = arr;
|
|
}
|
|
}
|
|
Promise.all([app.getMerchantList(), app.getItemList()]).then((res) => {
|
|
app.merchant = res[0];
|
|
app.itemList = res[1];
|
|
});
|
|
},
|
|
getSiteInfo() {
|
|
return new Promise((resolve, reject) => {
|
|
api_layout_index.getSiteInfo().then((result) => {
|
|
resolve(result);
|
|
}).catch(reject);
|
|
});
|
|
},
|
|
listAdList() {
|
|
},
|
|
pageGoods() {
|
|
return new Promise((resolve, reject) => {
|
|
api_shop_goods_index.pageGoods({}).then((result) => {
|
|
resolve(result.list);
|
|
}).catch(reject);
|
|
});
|
|
},
|
|
getMerchantList() {
|
|
return new Promise((resolve, reject) => {
|
|
api_shop_merchant_index.listMerchant({}).then((result) => {
|
|
resolve(result);
|
|
}).catch(reject);
|
|
});
|
|
},
|
|
getItemList() {
|
|
return new Promise((resolve, reject) => {
|
|
api_booking_item_index.listItem({}).then((result) => {
|
|
resolve(result);
|
|
}).catch(reject);
|
|
});
|
|
},
|
|
change(e) {
|
|
const { index } = e.detail;
|
|
const id = this.merchant[index].merchantId;
|
|
this.openUrl(`/package/booking/index?id=${id}`);
|
|
},
|
|
onNavigation(e) {
|
|
const { index } = e.detail;
|
|
this.openUrl(this.navigation[index].path);
|
|
},
|
|
onItem(e) {
|
|
const { index } = e.detail;
|
|
this.openUrl(`/package/booking/merchant?type=` + this.itemList[index].id);
|
|
},
|
|
onAds(index) {
|
|
const { pathList } = this;
|
|
this.openUrl(pathList[index]);
|
|
},
|
|
openUrl(url) {
|
|
if (!this.isLogin) {
|
|
this.$refs.login.open("bottom");
|
|
return false;
|
|
} else {
|
|
common_vendor.index.navigateTo({
|
|
url
|
|
});
|
|
}
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uv_gap2 = common_vendor.resolveComponent("uv-gap");
|
|
const _easycom_uv_swiper2 = common_vendor.resolveComponent("uv-swiper");
|
|
const _easycom_uv_skeleton2 = common_vendor.resolveComponent("uv-skeleton");
|
|
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
|
|
const _easycom_uv_avatar2 = common_vendor.resolveComponent("uv-avatar");
|
|
const _easycom_uni_grid_item2 = common_vendor.resolveComponent("uni-grid-item");
|
|
const _easycom_uni_grid2 = common_vendor.resolveComponent("uni-grid");
|
|
const _easycom_uv_scroll_list2 = common_vendor.resolveComponent("uv-scroll-list");
|
|
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
|
|
(_easycom_uv_gap2 + _easycom_uv_swiper2 + _easycom_uv_skeleton2 + _easycom_uni_card2 + _easycom_uv_avatar2 + _easycom_uni_grid_item2 + _easycom_uni_grid2 + _easycom_uv_scroll_list2 + _easycom_ws_login2)();
|
|
}
|
|
const _easycom_uv_gap = () => "../../uni_modules/uv-gap/components/uv-gap/uv-gap.js";
|
|
const _easycom_uv_swiper = () => "../../uni_modules/uv-swiper/components/uv-swiper/uv-swiper.js";
|
|
const _easycom_uv_skeleton = () => "../../uni_modules/uv-skeleton/components/uv-skeleton/uv-skeleton.js";
|
|
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
|
|
const _easycom_uv_avatar = () => "../../uni_modules/uv-avatar/components/uv-avatar/uv-avatar.js";
|
|
const _easycom_uni_grid_item = () => "../../uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.js";
|
|
const _easycom_uni_grid = () => "../../uni_modules/uni-grid/components/uni-grid/uni-grid.js";
|
|
const _easycom_uv_scroll_list = () => "../../uni_modules/uv-scroll-list/components/uv-scroll-list/uv-scroll-list.js";
|
|
const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js";
|
|
if (!Math) {
|
|
(_easycom_uv_gap + _easycom_uv_swiper + _easycom_uv_skeleton + _easycom_uni_card + _easycom_uv_avatar + _easycom_uni_grid_item + _easycom_uni_grid + _easycom_uv_scroll_list + _easycom_ws_login)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: $data.ads.length > 0
|
|
}, $data.ads.length > 0 ? {
|
|
b: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
c: common_vendor.o($options.onAds),
|
|
d: common_vendor.p({
|
|
list: $data.ads,
|
|
bgColor: "transparent",
|
|
indicatorMode: "dot",
|
|
indicator: true,
|
|
circular: true,
|
|
autoplay: false,
|
|
radius: "5"
|
|
})
|
|
} : {
|
|
e: common_vendor.p({
|
|
rows: "3",
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
f: common_vendor.p({
|
|
border: false,
|
|
padding: "12px 4px"
|
|
})
|
|
}, {
|
|
g: $data.mp_menu_display_method == 0
|
|
}, $data.mp_menu_display_method == 0 ? common_vendor.e({
|
|
h: $data.navigation.length > 0
|
|
}, $data.navigation.length > 0 ? {
|
|
i: common_vendor.f($data.navigation, (item, index, i0) => {
|
|
return {
|
|
a: "83a5a03c-7-" + i0 + "," + ("83a5a03c-6-" + i0),
|
|
b: common_vendor.p({
|
|
src: item.icon
|
|
}),
|
|
c: common_vendor.t(item.title),
|
|
d: index,
|
|
e: "83a5a03c-6-" + i0 + ",83a5a03c-5",
|
|
f: common_vendor.p({
|
|
index
|
|
})
|
|
};
|
|
}),
|
|
j: common_vendor.o($options.onNavigation),
|
|
k: common_vendor.p({
|
|
column: 4,
|
|
highlight: true,
|
|
showBorder: false
|
|
}),
|
|
l: common_vendor.p({
|
|
border: false,
|
|
["is-shadow"]: false,
|
|
padding: 0
|
|
})
|
|
} : {
|
|
m: common_vendor.p({
|
|
rows: "3",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
n: common_vendor.p({
|
|
border: false,
|
|
padding: "12px 4px"
|
|
})
|
|
}) : {}, {
|
|
o: $data.mp_menu_display_method == 1
|
|
}, $data.mp_menu_display_method == 1 ? common_vendor.e({
|
|
p: $data.navigation.length > 0
|
|
}, $data.navigation.length > 0 ? {
|
|
q: common_vendor.f($data.navigation, (item, index, i0) => {
|
|
return {
|
|
a: item.icon,
|
|
b: common_vendor.t(item.title),
|
|
c: common_vendor.o(($event) => $options.openUrl(item.path), index),
|
|
d: index
|
|
};
|
|
}),
|
|
r: common_vendor.p({
|
|
indicatorActiveColor: "rgb(16, 128, 1)"
|
|
}),
|
|
s: common_vendor.p({
|
|
border: false,
|
|
["is-shadow"]: false,
|
|
padding: 0
|
|
})
|
|
} : {
|
|
t: common_vendor.p({
|
|
avatar: true,
|
|
rows: "2",
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
v: common_vendor.p({
|
|
border: false,
|
|
padding: "12px 4px"
|
|
})
|
|
}) : {}, {
|
|
w: $data.mp_menu_display_method == 2 && $data.navigation.length > 0
|
|
}, $data.mp_menu_display_method == 2 && $data.navigation.length > 0 ? {
|
|
x: common_vendor.f($data.doubleNavigation, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.f(item, (item1, index1, i1) => {
|
|
return {
|
|
a: item1.icon,
|
|
b: common_vendor.t(item1.title),
|
|
c: index1,
|
|
d: common_vendor.n(index1 === item.length - 1 && "scroll-list__line__item--no-margin-right"),
|
|
e: common_vendor.o(($event) => $options.openUrl(item1.path), index1)
|
|
};
|
|
}),
|
|
b: index
|
|
};
|
|
}),
|
|
y: common_vendor.p({
|
|
border: false,
|
|
["is-shadow"]: false,
|
|
padding: 0
|
|
})
|
|
} : {}, {
|
|
z: $data.itemList.length > 0
|
|
}, $data.itemList.length > 0 ? {
|
|
A: common_vendor.f($data.itemList, (item, index, i0) => {
|
|
return {
|
|
a: "83a5a03c-18-" + i0 + "," + ("83a5a03c-17-" + i0),
|
|
b: common_vendor.p({
|
|
src: item.image,
|
|
size: 27,
|
|
shape: "square",
|
|
fontSize: "16",
|
|
randomBgColor: true
|
|
}),
|
|
c: common_vendor.t(item.name),
|
|
d: index,
|
|
e: "83a5a03c-17-" + i0 + ",83a5a03c-16",
|
|
f: common_vendor.p({
|
|
index
|
|
})
|
|
};
|
|
}),
|
|
B: common_vendor.o($options.onItem),
|
|
C: common_vendor.p({
|
|
column: 5,
|
|
highlight: true,
|
|
showBorder: false
|
|
})
|
|
} : {
|
|
D: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
E: common_vendor.p({
|
|
border: false,
|
|
padding: "12px 4px"
|
|
})
|
|
}, {
|
|
F: $data.merchant.length > 0
|
|
}, $data.merchant.length > 0 ? {
|
|
G: common_vendor.f($data.merchant, (item, index, i0) => {
|
|
return {
|
|
a: item.image,
|
|
b: common_vendor.t(item.merchantName),
|
|
c: index,
|
|
d: "83a5a03c-22-" + i0 + ",83a5a03c-21",
|
|
e: common_vendor.p({
|
|
index
|
|
})
|
|
};
|
|
}),
|
|
H: common_vendor.o($options.change),
|
|
I: common_vendor.p({
|
|
column: 3,
|
|
borderColor: "transparent",
|
|
highlight: true
|
|
})
|
|
} : {
|
|
J: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
K: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
L: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
M: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
N: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
O: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
P: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
Q: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
R: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
})
|
|
}, {
|
|
S: common_vendor.sr("login", "83a5a03c-32"),
|
|
T: common_vendor.o($options.reload),
|
|
U: common_vendor.p({
|
|
logo: _ctx.logo
|
|
})
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-83a5a03c"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/pages/index/index.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|