Browse Source

Signed-off-by: xiezongxing <xx123456>

xiezongxing 2 years ago
parent
commit
4000c81db3
2 changed files with 21 additions and 26 deletions
  1. 11 3
      main.js
  2. 10 23
      pages/bindteam/index.vue

+ 11 - 3
main.js

@@ -3,8 +3,9 @@ import store from './store'
 import App from './App'
 
 // 后端api地址
-Vue.prototype.$unishow = "https://81f.dev.ytxxjs.cn/addons/unishop";
-// Vue.prototype.$unishow = "https://81fdev.dev.ytxxjs.cn/addons/unishop";
+//Vue.prototype.$unishow = "https://81f.dev.ytxxjs.cn/addons/unishop";
+//Vue.prototype.$unishow = "https://81fdev.dev.ytxxjs.cn/addons/unishop";
+Vue.prototype.$unishow = "https://81f.ytxxjs.cn/addons/unishop";
 
 // 为了方便每次上传的时候忘记修改上面的参数
 uni.getSystemInfo({
@@ -101,7 +102,7 @@ const request = async (url, method = 'GET', data = {}, showMsg = true) => {
 		'lang': Vue.prototype.$store.state.lang,
 		'platform': Vue.prototype.$platform
 	};
-	if (Vue.prototype.$store.state.userInfo.token) {
+	if (Vue.prototype.$store.state.userInfo && Vue.prototype.$store.state.userInfo.token) {
 		header.token = Vue.prototype.$store.state.userInfo.token;
 	}
 	if (Vue.prototype.$store.state.cookie) {
@@ -184,6 +185,11 @@ Vue.prototype.$api = {
 // 微信小程序
 const wechatMiniLogin = async (noMsg = false) => {
 	if (!noMsg) msg('登录中');
+	if (Vue.wechatMiniLoginLock) return;
+	Vue.wechatMiniLoginLock = true;
+	Vue.wechatMiniLoginTag = setTimeout(() => {
+		Vue.wechatMiniLoginLock = false;
+	}, 10000);
 	let [error, loginRes] = await uni.login({
 		provider: 'weixin'
 	});
@@ -206,6 +212,8 @@ const wechatMiniLogin = async (noMsg = false) => {
 		return false;
 	}
 };
+Vue.wechatMiniLoginLock = false;
+Vue.wechatMiniLoginTag = 0;
 Vue.prototype.$wechatMiniLogin = wechatMiniLogin;
 // #endif
  

+ 10 - 23
pages/bindteam/index.vue

@@ -1,12 +1,6 @@
 <template>
-
-
-	<view >
-	
-		
-	</view>
+	<view></view>
 </template>
-
 <script>
 	// pages/tabbar/index/index.js
 	import {
@@ -33,24 +27,17 @@
 			...mapMutations(['login']),
 			
 			async bind() {
-							
 				var  userInfo = await this.$wechatMiniLogin(true);
-				
-				this.login(userInfo)
-							
-				let res = await this.$api.request('/team/add', 'GET', {
-					puid: this.puid,
-				});
-				/*
-				wx.switchTab({
-					url:"/pages/index/index"
-				})*/
-				
-				
+				this.login(userInfo);				
+				setTimeout(() => {
+					let res = this.$api.request('/team/add', 'GET', {
+						puid: this.puid
+					});
+					wx.switchTab({
+						url:"/pages/index/index"
+					});
+				}, 2000);
 			}
-			
-			
-			
 		}
 	};
 </script>