소스 검색

新增记住密码

gcz 2 년 전
부모
커밋
0c8c709d25
1개의 변경된 파일15개의 추가작업 그리고 2개의 파일을 삭제
  1. 15 2
      pages/login/login.vue

+ 15 - 2
pages/login/login.vue

@@ -14,6 +14,9 @@
 			<u-form-item label="" prop="loginPwd" left-icon="lock-fill" :left-icon-style="{color:'#fff'}" :border-bottom="false" label-width="120">
 				<u-input :loginPwd-icon="true" type="password" v-model="form.loginPwd" placeholder="请输入密码" />
 			</u-form-item>
+			<view class="remember-pass">
+				<u-checkbox v-model="rememberPass" shape="circle" active-color="#7A4398">记住密码</u-checkbox>
+			</view>
 			<u-button class="submit-btn" type="default" @click="submit" >登录</u-button>
 		</u-form>
 		<!-- <u-bottom></u-bottom> -->
@@ -47,7 +50,8 @@ export default {
 						trigger: 'change'
 					}
 				]
-			}
+			},
+			rememberPass:false,
 		}
 	},
 	computed: {
@@ -85,7 +89,9 @@ export default {
 						if(res.code==200){
 							this.$u.vuex('vuex_user', res.data);
 							this.jumpIndex();
-							uni.setStorageSync('session_login_info', JSON.stringify(this.form));
+							if(this.rememberPass){
+								uni.setStorageSync('session_login_info', JSON.stringify(this.form));								
+							}
 						}else{
 							uni.showToast({
 								icon:'none',
@@ -202,4 +208,11 @@ export default {
 		}
 	}
 }
+.remember-pass{
+	text-align: right;
+	/deep/ .u-checkbox__label{
+		color: #fff;
+	}
+	
+}
 </style>