Przeglądaj źródła

解决登录多次弹窗

gcz 3 lat temu
rodzic
commit
5271d7b3b5

+ 17 - 12
common/http.interceptor.js

@@ -53,18 +53,23 @@ const install = (Vue, vm) => {
 			// const currentPage = pages[pages.length - 1]; //获取当前页面的对象
 			// const url = currentPage.route;
 			// console.log('currentPage',currentPage);
-			uni.showModal({
-			  title: '温馨提示',  
-			  content: '登录失效,请重新登录', 
-			  showCancel: false,
-			  success: (res) => {
-				  if(res.confirm){
-					  uni.reLaunch({
-					      url: '/pages/login/login'
-					  });
-				  }
-			  } 
-			});
+			const value = uni.getStorageSync('session_login_out');
+			if (!value){
+				uni.setStorageSync('session_login_out', 'test');
+				uni.showModal({
+				  title: '温馨提示',  
+				  content: '登录失效,请重新登录', 
+				  showCancel: false,
+				  success: (res) => {
+					  if(res.confirm){
+						  uni.reLaunch({
+							  url: '/pages/login/login'
+						  });
+						  uni.removeStorageSync('session_login_out');
+					  }
+				  } 
+				});
+			}
 			//#endif
 			
 			//#ifdef H5

+ 8 - 3
pages/login/login.vue

@@ -63,11 +63,14 @@ export default {
 			// });
 			this.$refs.uForm.validate(valid => {
 				if (valid) {
-					// this.form.loginPwd = crypto.Encrypt(this.form.loginPwd)
-					this.$u.api.getLogin(this.form).then(res=>{
+					// this.form.password = crypto.Encrypt(this.form.password)
+					let askParms = Object.assign({}, this.form);
+					askParms.password = crypto.Encrypt(askParms.password);
+					this.$u.api.getLogin(askParms).then(res=>{
 						if(res.code==200){
 							this.$u.vuex('vuex_user', res.data);
 							this.jumpIndex();
+							uni.setStorageSync('session_login_info', JSON.stringify(this.form));
 						}else{
 							uni.showToast({
 								icon:'none',
@@ -140,6 +143,7 @@ export default {
 	background: linear-gradient(99deg, #7A4398 0%, #5A5DB9 100%);
 	background-size: 100% auto;
 	min-height: 100vh;
+	overflow: hidden;
 }
 .top{
 	text-align: center;
@@ -147,7 +151,8 @@ export default {
 	color: #fff;
 	line-height: 98rpx;
 	font-weight: 800;
-	padding: 180rpx 0 68rpx;
+	padding: 0 0 68rpx;
+	margin-top: 15vh;
 	.til{
 		
 	}

+ 1 - 1
pages/ownersQuery/queryList/queryList.vue

@@ -10,7 +10,7 @@
 		 :background="{background: 'linear-gradient(99deg, #7A4398 0%, #5A5DB9 100%)' }"></u-navbar>
 		<!-- <u-tabs :list="tabList" :is-scroll="false" height="108" bar-width="100" :current="tabIndex" @change="tabChange"></u-tabs>
 		<u-gap height="20" bg-color="#F6F6F6"></u-gap> -->
-		<mescroll-uni ref="mescrollRef" @init="mescrollInit" :top="60" @down="downCallback" :up="upOption" @up="upCallback" @emptyclick="emptyClick">
+		<mescroll-uni ref="mescrollRef" @init="mescrollInit" :top="config.platform=='h5'?60:120" @down="downCallback" :up="upOption" @up="upCallback" @emptyclick="emptyClick">
 			<view class="owelist">
 				<view class="owelist-item" v-for="(item,index) in dataList" :key="item.id">
 					<view class="item-header u-flex u-row-between">