|
@@ -102,6 +102,13 @@ export default {
|
|
|
this.$store.commit('SET_USER_INFO', uni.getStorageSync('member'));
|
|
|
this.$store.commit('SET_MEMBER', uni.getStorageSync('member'));
|
|
|
}
|
|
|
+
|
|
|
+ // 如果是微信小程序入口,先把 传过来的 token 和 pageId 保存下来
|
|
|
+ if (platform === 'miniprogram' && !uni.getStorageSync('pageId')) {
|
|
|
+ const { pageId, token } = query;
|
|
|
+ uni.setStorageSync('pageId', pageId);
|
|
|
+ uni.setStorageSync('token', token);
|
|
|
+ }
|
|
|
|
|
|
// 如果用户没有openid
|
|
|
const openid = uni.getStorageSync('openid');
|
|
@@ -111,12 +118,6 @@ export default {
|
|
|
this.$store.commit('SET_OPENID', openid);
|
|
|
}
|
|
|
if (!openid) {
|
|
|
- // 如果是微信小程序入口,先把 传过来的 token 和 pageId 保存下来
|
|
|
- if (platform === 'miniprogram' && !uni.getStorageSync('pageId')) {
|
|
|
- const { pageId, token } = query;
|
|
|
- uni.setStorageSync('pageId', pageId);
|
|
|
- uni.setStorageSync('token', token);
|
|
|
- }
|
|
|
// 当进入其他页面时,需要先打开路由展示
|
|
|
this.isInit = true;
|
|
|
// 前往授权页面
|
|
@@ -244,17 +245,21 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
/* 微信小程序 webview 配置 */
|
|
|
- if (!query?.pageId?.length || !query?.token?.length) {
|
|
|
+ if (
|
|
|
+ !uni.getStorageSync('pageId') ||
|
|
|
+ uni.getStorageSync('pageId') === 'undefined'
|
|
|
+ ) {
|
|
|
return;
|
|
|
}
|
|
|
- window.token = query?.token;
|
|
|
+ window.token = query?.token || uni.getStorageSync('token');
|
|
|
// this.getTicket()
|
|
|
this.wss(() => {
|
|
|
this.$store.dispatch('baseInit', {
|
|
|
- pageId: window.location.href.replace(/.*pageId=([0-9A-Z]*).*/g, '$1'),
|
|
|
+ // pageId: window.location.href.replace(/.*pageId=([0-9A-Z]*).*/g, '$1'),
|
|
|
+ pageId: query?.pageId || uni.getStorageSync('pageId'),
|
|
|
// callback: this.wss,
|
|
|
callback: () => {
|
|
|
- console.log(838383, this.isInit);
|
|
|
+ // console.log(838383, this.isInit);
|
|
|
this.isInit = true;
|
|
|
// 当所有的数据都初始化之后再次执行
|
|
|
this.getTicket();
|