diff --git a/App.vue b/App.vue
index 1cdc5c0..262edcc 100644
--- a/App.vue
+++ b/App.vue
@@ -1,14 +1,17 @@
diff --git a/framework/0-conf.js b/framework/0-conf.js
index ab5aecc..a9b4c7d 100644
--- a/framework/0-conf.js
+++ b/framework/0-conf.js
@@ -16,11 +16,11 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
// #endif
// #ifdef APP || MP-WEIXIN
-// const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上
-// const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
+const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上
+const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
-const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
-const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
+// const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
+// const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
// #endif
// import VConsole from "./vConsole.js"
diff --git a/main.js b/main.js
index 1774450..2b0ca78 100644
--- a/main.js
+++ b/main.js
@@ -23,6 +23,10 @@ uni.$u.config.unit = 'rpx'
Vue.prototype.useStorage = useStorage
Vue.prototype.api = Api;
Vue.prototype.shop = Shop;
+Vue.prototype.$onLaunched = new Promise(resolve => {
+ Vue.prototype.$isResolve = resolve
+})
+
// #ifdef VUE3
import {
createSSRApp
diff --git a/pages/member/index.vue b/pages/member/index.vue
index 8911881..329b6cc 100644
--- a/pages/member/index.vue
+++ b/pages/member/index.vue
@@ -46,44 +46,23 @@
usershopUserinfo: null,
}
},
- onLoad(e) {
+ async onLoad(e) {
console.log(e)
- if ( e.type == 'list' || e.type == 'index') {
- this.shopId = e.shopId;
- this.init();
- }
+ // if ( e.type == 'list' || e.type == 'index') {
+ // this.shopId = e.shopId;
+ // this.init();
+ // }
if (e.q) {
this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId')
+ this.tokenShow = false;
+ // 等待登录结果返回
if (!uni.cache.get('token')) {
- uni.login({
- provider: 'weixin',
- success: async (data) => {
- try {
- uni.getUserInfo({
- provider: 'weixin',
- success: async (infoRes) => {
- uni.cache.set('weixincode', data.code);
- let res = await this.api.userwxlogin({
- code: uni.cache.get('weixincode'), //临时登录凭证
- rawData: infoRes.rawData
- })
- if (res.code == 0) {
- uni.cache.set('token', res.data.token);
- uni.cache.set('miniAppOpenId', res.data.userInfo
- .miniAppOpenId)
- uni.cache.set('userInfo', res.data.userInfo);
- this.tokenShow = false;
- this.init();
- }
- },
- fail: (err) => {}
- });
- } catch (e) {}
- }
- });
- } else {
- this.init();
+ await this.$onLaunched;
}
+ this.init();
+ } else{
+ this.shopId = e.shopId;
+ this.init();
}
console.log(this.shopId)
},
diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue
index 6766b67..614616f 100644
--- a/pages/order_food/order_food.vue
+++ b/pages/order_food/order_food.vue
@@ -409,40 +409,18 @@
uni.$off('message')
this.fixedtrue = true
},
- onShow() {
+ async onShow() {
let _this = this;
this.orderdetailFlag = true;
uni.pageScrollTo({
scrollTop: 0,
duration: 0
});
- uni.login({
- provider: 'weixin',
- success: async (data) => {
- try {
- uni.getUserInfo({
- provider: 'weixin',
- success: async (infoRes) => {
- uni.cache.set('weixincode', data.code);
- let res = await this.api.userwxlogin({
- code: uni.cache.get('weixincode'), //临时登录凭证
- rawData: infoRes.rawData
- })
- if (res.code == 0) {
- uni.cache.set('token', res.data.token);
- uni.cache.set('miniAppOpenId', res.data.userInfo
- .miniAppOpenId)
- uni.cache.set('userInfo', res.data.userInfo);
- uni.$on('message', this.getMessage)
-
- _this.getLocation()
- }
- },
- fail: (err) => {}
- });
- } catch (e) {}
- }
- });
+ if (!uni.cache.get('token')) {
+ await this.$onLaunched;
+ }
+ uni.$on('message', this.getMessage)
+ _this.getLocation()
},
methods: {
navigateBacknav() {
diff --git a/store/index.js b/store/index.js
index d61ce3f..8277552 100644
--- a/store/index.js
+++ b/store/index.js
@@ -78,6 +78,7 @@ const store = new Vuex.Store({
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
+ this.$isResolve()
}
},
fail: (err) => {}