2022-04-29 17:23:40 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view>
|
2022-06-20 11:06:41 +08:00
|
|
|
|
<index v-if="curPageCode === 'indexPage'" @changeCurPageCode="changeCurPageCode"></index>
|
2022-05-24 18:03:36 +08:00
|
|
|
|
<goods-manage v-else-if="curPageCode === 'supplyChainPage'"></goods-manage>
|
|
|
|
|
|
<my-home v-else-if="curPageCode === 'myPage'"></my-home>
|
2022-05-21 23:49:53 +08:00
|
|
|
|
<msg-home v-else-if="curPageCode === 'msgPage'"></msg-home>
|
2022-07-08 23:56:55 +08:00
|
|
|
|
<module-bar ref="moduleBar" :moduleBarInfos="moduleBarInfos" @getCurPageInfo="getCurPageInfo"></module-bar>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 首页引导 -->
|
|
|
|
|
|
<vertify-worker-type ref="vertifyWorkerType"></vertify-worker-type>
|
|
|
|
|
|
<!-- 登录校验弹窗 -->
|
|
|
|
|
|
<vertify-login ref="vertifyLogin" @reload="reloadForwardPage"></vertify-login>
|
2023-03-27 01:52:25 +08:00
|
|
|
|
<!-- <vertify-phone ref="vertifyPhone" @reload="reloadForwardPage"></vertify-phone> -->
|
|
|
|
|
|
<!-- 订阅授权 -->
|
|
|
|
|
|
<vertify-subscribe ref="vertifySubscribe"></vertify-subscribe>
|
2022-04-29 17:23:40 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import moduleBar from '@/components/custom-bar/module-bar.vue';
|
2022-05-24 18:03:36 +08:00
|
|
|
|
import index from '@/pages/index/index-home.vue';
|
|
|
|
|
|
import myHome from '@/pages/index/my-home.vue';
|
2022-05-21 23:49:53 +08:00
|
|
|
|
import msgHome from '@/pages/index/msg-home.vue';
|
2022-05-24 18:03:36 +08:00
|
|
|
|
import goodsManage from '@/pages/index/goods-manage.vue';
|
2022-04-29 17:23:40 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
components: {
|
|
|
|
|
|
moduleBar,
|
2022-05-24 18:03:36 +08:00
|
|
|
|
index,
|
|
|
|
|
|
myHome,
|
|
|
|
|
|
msgHome,
|
|
|
|
|
|
goodsManage
|
2022-04-29 17:23:40 +08:00
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
moduleBarInfos: [],
|
2022-07-08 23:56:55 +08:00
|
|
|
|
curPageCode: 'indexPage',
|
|
|
|
|
|
forwardingPageCode: null
|
2022-04-29 17:23:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-06-22 17:40:50 +08:00
|
|
|
|
onLoad(options) {
|
2022-07-08 23:56:55 +08:00
|
|
|
|
this.loadData();
|
2022-06-22 17:40:50 +08:00
|
|
|
|
if (options && options.menuCode) {
|
|
|
|
|
|
this.changeCurPageCode(options.menuCode)
|
|
|
|
|
|
}
|
2022-04-29 17:23:40 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
async loadData() {
|
2022-05-24 18:03:36 +08:00
|
|
|
|
// uni.getSystemInfo({
|
|
|
|
|
|
// success: function(res) {
|
|
|
|
|
|
// console.log('DPR:' + res.pixelRatio)
|
|
|
|
|
|
// console.log('宽度:' + res.screenWidth)
|
|
|
|
|
|
// console.log('高度:' + res.screenHeight)
|
|
|
|
|
|
// }
|
|
|
|
|
|
// })
|
2023-03-27 01:52:25 +08:00
|
|
|
|
this.moduleBarInfos = await this.$api.data('moduleBarInfos');
|
|
|
|
|
|
let curUserInfo = this.$request.getCurUserInfo();
|
|
|
|
|
|
let _this = this;
|
|
|
|
|
|
if (curUserInfo && curUserInfo.phone && curUserInfo.type != null) {
|
|
|
|
|
|
wx.getSetting({
|
|
|
|
|
|
withSubscriptions: true,
|
|
|
|
|
|
success(res) {
|
|
|
|
|
|
console.log(res.subscriptionsSetting)
|
|
|
|
|
|
if (!res.subscriptionsSetting.mainSwitch
|
|
|
|
|
|
|| !res.subscriptionsSetting.itemSettings
|
|
|
|
|
|
|| res.subscriptionsSetting.itemSettings['yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE'] !== 'accept'
|
|
|
|
|
|
|| res.subscriptionsSetting.itemSettings['gFoPAYF4J6Y_O5OzzNUbvMxTrsAS7aUWffdNH42xhzM'] !== 'accept') {
|
|
|
|
|
|
// 提示授权订单进度消息提示
|
|
|
|
|
|
_this.$refs.vertifySubscribe.showModal();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-07-08 23:56:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
reloadForwardPage() {
|
|
|
|
|
|
this.getCurPageInfo({
|
|
|
|
|
|
curPageCode: this.forwardingPageCode
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
async getCurPageInfo(data) {
|
|
|
|
|
|
let pageCode = data.curPageCode;
|
|
|
|
|
|
this.forwardingPageCode = pageCode;
|
|
|
|
|
|
// 登录校验
|
|
|
|
|
|
if (['supplyChainPage', 'myPage'].indexOf(pageCode) >= 0) {
|
|
|
|
|
|
let loginRes = await this.authLogin();
|
|
|
|
|
|
if (!loginRes) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.forwardingPageCode = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (pageCode === 'publishPage') {
|
|
|
|
|
|
this.isShowPublish = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.isShowPublish = false;
|
|
|
|
|
|
this.curPageCode = pageCode;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
async authLogin() {
|
|
|
|
|
|
// 更新缓存中的userInfo
|
2022-08-10 23:01:52 +08:00
|
|
|
|
// let res = await this.$request.storageExistUser();
|
2022-07-08 23:56:55 +08:00
|
|
|
|
// 获取缓存中的userInfo
|
|
|
|
|
|
let curUserInfo = this.$request.getCurUserInfo();
|
|
|
|
|
|
// 校验提示登录
|
2022-08-10 23:01:52 +08:00
|
|
|
|
// if (!curUserInfo || !curUserInfo.openId) {
|
|
|
|
|
|
// this.$refs.vertifyLogin.showModal();
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// this.$refs.vertifyLogin.hideModal();
|
|
|
|
|
|
// }
|
|
|
|
|
|
if (!curUserInfo) {
|
|
|
|
|
|
uni.reLaunch({
|
|
|
|
|
|
url: '/pages/login/login'
|
|
|
|
|
|
})
|
2022-07-08 23:56:55 +08:00
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2022-08-09 20:11:13 +08:00
|
|
|
|
// 校验是否注册过
|
2022-07-08 23:56:55 +08:00
|
|
|
|
if (!curUserInfo.phone) {
|
2022-08-09 20:11:13 +08:00
|
|
|
|
uni.reLaunch({
|
2022-08-10 23:01:52 +08:00
|
|
|
|
url: '/pages/login/login'
|
2022-08-09 20:11:13 +08:00
|
|
|
|
})
|
2022-07-08 23:56:55 +08:00
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2022-08-09 20:11:13 +08:00
|
|
|
|
// 校验提示获取手机号码
|
|
|
|
|
|
// if (!curUserInfo.phone) {
|
|
|
|
|
|
// this.$refs.vertifyPhone.showModal();
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// this.$refs.vertifyPhone.hideModal();
|
|
|
|
|
|
// }
|
2022-07-08 23:56:55 +08:00
|
|
|
|
// 提示选择师傅类型
|
|
|
|
|
|
if (curUserInfo.type == null) {
|
|
|
|
|
|
this.$refs.vertifyWorkerType.showModal();
|
2022-08-09 20:11:13 +08:00
|
|
|
|
return false;
|
2022-07-08 23:56:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
return true;
|
2022-06-20 11:06:41 +08:00
|
|
|
|
},
|
|
|
|
|
|
changeCurPageCode(targetPageCode) {
|
2022-06-22 17:40:50 +08:00
|
|
|
|
// #ifdef MP
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.moduleBar.navChangeByCode(targetPageCode, true);
|
|
|
|
|
|
})
|
|
|
|
|
|
// #endif
|
2022-04-29 17:23:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
</style>
|