shish 3 năm trước cách đây
mục cha
commit
7355929af9
2 tập tin đã thay đổi với 15 bổ sung4 xóa
  1. 2 2
      mallApp/src/ext.json
  2. 13 2
      mallApp/src/mixins/globalMixins.js

+ 2 - 2
mallApp/src/ext.json

@@ -4,9 +4,9 @@
   "directCommit": false,
   "ext": {
     "account": 0,
-    "apiHost": "https://api.shop.theflorist.cn",
+    "apiHost": "http://api.shop.theflorist.cn",
     "socketApiHost": "api.shop.theflorist.cn",
-    "imgHost": "https://img.theflorist.cn",
+    "imgHost": "http://img.theflorist.cn",
     "name":"中花卉"
   }
 }

+ 13 - 2
mallApp/src/mixins/globalMixins.js

@@ -1,5 +1,6 @@
 import { pageTo, isLogin } from '@/utils/util.js'
 import { wxLoginFn } from '@/utils/auth'
+import { mapGetters } from 'vuex'
 export default {
 	data() {
 		return {
@@ -9,8 +10,12 @@ export default {
 			pageTo: pageTo
 		}
 	},
+	computed: {
+		...mapGetters({ loginInfo: "getLoginInfo" })
+	},
 	// 页面生命周期才触发
 	onLoad: function (option) {
+		let that = this
 		this.option = option || null
 		if (option.token) {
 			uni.setStorageSync('token', option.token)
@@ -56,7 +61,13 @@ export default {
 				}
 			})
 		}
-		this.init()
-		wxLoginFn()
+		if (that.$util.isEmpty(that.getLoginInfo)) {
+			wxLoginFn().then(wxRes=>{
+				that.init()
+			})
+		}else{
+			that.init()
+		}
 	}
+
 }