acdr-ui/dist/dev/mp-weixin/modules/mall/index/index.js
2024-10-01 09:15:35 +08:00

96 lines
3.5 KiB
JavaScript

"use strict";
const common_vendor = require("../../../common/vendor.js");
const modules_mall_sheep_index = require("../sheep/index.js");
const modules_mall_sheep_platform_share = require("../sheep/platform/share.js");
const modules_mall_sheep_api_member_auth = require("../sheep/api/member/auth.js");
const store_index = require("../../../store/index.js");
const modules_mall_sheep_store_index = require("../sheep/store/index.js");
const store_user = require("../../../store/user.js");
if (!Array) {
const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni");
_component_layout_default_uni();
}
if (!Math) {
(SBlockItem + SBlock + SLayout)();
}
const SBlockItem = () => "../sheep/components/s-block-item/s-block-item.js";
const SBlock = () => "../sheep/components/s-block/s-block.js";
const SLayout = () => "../sheep/components/s-layout/s-layout.js";
const _sfc_main = {
__name: "index",
setup(__props) {
modules_mall_sheep_store_index.setupPinia(store_index.store);
const userData = store_user.useUserStore();
if (userData.userInfo && userData.userInfo.token) {
console.log(userData.userInfo.accessToken);
modules_mall_sheep_index.sheep.$store("user").setToken(userData.userInfo.token, userData.userInfo.refreshToken);
console.log(userData.userInfo);
}
common_vendor.onLaunch(() => {
modules_mall_sheep_index.ShoproInit();
});
const template = common_vendor.computed(() => {
var _a;
return (_a = modules_mall_sheep_index.sheep.$store("app").template) == null ? void 0 : _a.home;
});
common_vendor.onLoad((options) => {
if (options.token && options["refresh-token"]) {
modules_mall_sheep_api_member_auth.AuthUtil.refreshToken(options["refresh-token"]);
}
if (options.scene) {
const sceneParams = decodeURIComponent(options.scene).split("=");
console.log("sceneParams=>", sceneParams);
options[sceneParams[0]] = sceneParams[1];
}
if (options.templateId) {
modules_mall_sheep_index.sheep.$store("app").init(options.templateId);
}
if (options.spm) {
modules_mall_sheep_platform_share.$share.decryptSpm(options.spm);
}
if (options.page) {
modules_mall_sheep_index.sheep.$router.go(decodeURIComponent(options.page));
}
});
common_vendor.onPullDownRefresh(() => {
modules_mall_sheep_index.sheep.$store("app").init();
setTimeout(function() {
common_vendor.index.stopPullDownRefresh();
}, 800);
});
common_vendor.onPageScroll(() => {
});
return (_ctx, _cache) => {
return common_vendor.e({
a: template.value
}, template.value ? {
b: common_vendor.f(template.value.components, (item, index, i0) => {
return {
a: "f48bccd8-3-" + i0 + "," + ("f48bccd8-2-" + i0),
b: common_vendor.p({
data: item.property,
styles: item.property.style,
type: item.id
}),
c: index,
d: "f48bccd8-2-" + i0 + ",f48bccd8-1",
e: common_vendor.p({
styles: item.property.style
})
};
}),
c: common_vendor.p({
bgStyle: template.value.page,
navbarStyle: template.value.navigationBar,
navbar: "custom",
onShareAppMessage: true,
tabbar: "/modules/mall/index/index",
title: "首页"
})
} : {});
};
}
};
_sfc_main.__runtimeHooks = 3;
wx.createPage(_sfc_main);