ソースを参照

优化登录提示

gcz 1 年間 前
コミット
bc367a1552
3 ファイル変更31 行追加18 行削除
  1. 13 11
      center/memberinfo.vue
  2. 2 2
      common/request.js
  3. 16 5
      pages/login/login.vue

+ 13 - 11
center/memberinfo.vue

@@ -34,7 +34,7 @@
 				<u-cell title="会员等级" :value="memberInfo.levelName"></u-cell>
 				<u-cell title="实名制认证" @click="factorAuth" :value="memberInfo.isAuth==1?'已认证':'去认证'"></u-cell>
 			</u-cell-group>
-			<!-- <u-button text="取消登录" type="warning" @click="clearStorage" style="margin-top: 30rpx;"></u-button> -->
+			<u-button text="取消登录" type="warning" @click="logOut" style="margin-top: 30rpx;"></u-button>
 			<u-datetime-picker
 				:show="timeShow"
 				:minDate="new Date().getTime()-365*100*24*3600*1000"
@@ -103,22 +103,24 @@
 
 		},
 		methods: {
-			clearStorage(){
-				uni.clearStorage();
-				uni.showToast({
-					title:'清除完成,请手动重新进入小程序',
-					icon:'none',
-					complete() {
-					}
-				})
+			logOut(){
+				this.$u.vuex('vuex_user_info', {});
+				// uni.clearStorage();
+				this.getMemberInfo()
+				// uni.showToast({
+				// 	title:'清除完成,请手动重新进入小程序',
+				// 	icon:'none',
+				// 	complete() {
+				// 	}
+				// })
 			},
 			getMemberInfo(){
 				this.$u.api.memberInfo({id:this.vuex_user_info.userid}).then(res=>{
 					this.memberInfo = res.data;
 					this.avatar =  res.data.avatar;
-					console.log('memberInfo',this.memberInfo);
+					// console.log('memberInfo',this.memberInfo);
 					}).catch(err=>{
-					console.log('memberInfo',err.data);
+					console.log('memberInfo',err);
 				})
 			},
 			handleChangeSex(){

+ 2 - 2
common/request.js

@@ -74,14 +74,14 @@ module.exports = (vm) => {
 		// 自定义参数
 		const custom = response.config?.custom
 		if (data.code !== 200) {
-			// console.log('data====',data);
+			console.log('data====',data);
 			// 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示
 			if (custom.toast !== false) {
 				const unshowmsg = ['令牌不能为空'];
 				if (!unshowmsg.includes(data.msg)) {
 				  uni.$u.toast(data.msg)
 				}
-				uni.$u.toast(data.msg)
+				// uni.$u.toast(data.msg)
 			}
 			if(data.msg == "令牌验证失败" || data.msg == "令牌不能为空" || data.code == 401){
 				unlogin()

+ 16 - 5
pages/login/login.vue

@@ -199,6 +199,7 @@
 				this.user.avatar = e.detail.avatarUrl;
 			},
 			async authPhone(e){
+				console.log('checked',this.checked);
 				let errMsg = e.detail?.errMsg;
 				if(errMsg!='getPhoneNumber:ok'){
 					uni.showToast({
@@ -234,8 +235,8 @@
 						icon:'error',
 						duration: 2000
 					});
-					this.loginBtn = true;
 				}
+				this.loginBtn = true;
 			},
 			async login(e){
 				// console.log('e',e);
@@ -370,10 +371,20 @@
 				this.checkboxVal = e[0];
 			},
 			disabledClick(){
-				uni.showToast({
-					title:'请先同意使用条款!',
-					icon:'none'
-				})
+				// console.log('checked',this.checked?.length);
+				// console.log('loginBtn',this.loginBtn);
+				if(!this.checked||this.checked?.length<=0){
+					uni.showToast({
+						title:'请先同意使用条款!',
+						icon:'none'
+					})
+				}else if(this.loginBtn==false){
+					uni.showToast({
+						title:'请刷新重试!',
+						icon:'none'
+					})
+				}
+				
 			}
 		}
 	}