- 业务源码统一迁入 src/,H5 模板移到 public/index.html - 新增 @vue/cli 4.5 + @dcloudio 2.0.2-5020620260917001 全套依赖与 scripts - 保留 vue.config.js 的 ROUTES 注入(uni-simple-router 运行时依赖) - 新增 scripts/node-compat.cjs 兼容 Node 23+ 移除的 util.isRegExp 等 API - README 补充构建/运行/回退说明
59 lines
1.1 KiB
JavaScript
59 lines
1.1 KiB
JavaScript
/**
|
|
* MixinIndex v1.0.0
|
|
* @description shopro-mixin-index 1.0.0 shopro全局入口组件
|
|
* @Author lidongtony
|
|
* @Date 2021-04-18
|
|
* @Email lidongtony@qq.com
|
|
*/
|
|
|
|
import store from '@/core/store'
|
|
import http from '@/core/request'
|
|
import {
|
|
router
|
|
} from '@/core/router'
|
|
export default {
|
|
onLoad(options) {
|
|
let that = this;
|
|
if (options?.page) {
|
|
router.replace({
|
|
path: decodeURIComponent(options.page)
|
|
})
|
|
}
|
|
if (options?.custom_id) {
|
|
router.replace({
|
|
path: '/pages/index/view',
|
|
query: {
|
|
id: options.custom_id
|
|
}
|
|
})
|
|
}
|
|
if (options?.spm) {
|
|
let shareParams = share.getShareQuery(options.spm);
|
|
console.log('shareParams: ',shareParams);
|
|
// 保存推荐信息
|
|
if (shareParams.shareUserId) {
|
|
if (store.getters.isLogin) {
|
|
http('common.shareAdd', {
|
|
spm: options.spm
|
|
});
|
|
} else {
|
|
uni.setStorageSync('spm', options.spm);
|
|
}
|
|
}
|
|
// 跳转分享路径
|
|
let page = {};
|
|
if (shareParams.page) {
|
|
page.path = shareParams.page;
|
|
}
|
|
if (shareParams.pageId) {
|
|
page.query = {
|
|
id: shareParams.pageId
|
|
}
|
|
}
|
|
if (page.path) {
|
|
router.replace(page);
|
|
}
|
|
}
|
|
}
|
|
}
|