瀏覽代碼

登录优化

shish 6 月之前
父節點
當前提交
de223e456c
共有 2 個文件被更改,包括 53 次插入65 次删除
  1. 28 34
      ghsApp/src/admin/home/login.vue
  2. 25 31
      hdApp/src/admin/home/login.vue

+ 28 - 34
ghsApp/src/admin/home/login.vue

@@ -34,7 +34,7 @@
 			<button class="admin-button-com small blue buttonText" @click="mobileLogin()">本机号码一键登录</button>
 			</view>
 			<!-- #endif -->
-			<view style="color:#999999;font-size:25upx;margin-top:55upx;">
+			<view style="color:#999999;font-size:25upx;margin-top:55upx;" v-if="showAccountLogin">
 				<checkbox-group @change="agreeItem">
 					<label style="display:flex;align-items:center;justify-content:center;">
 						<checkbox value="1" style="transform:scale(0.8)" :checked="agree == 1" />
@@ -202,13 +202,11 @@ export default {
 					that.hasMobileNet = false
 			}
 		},
-		wxPhoneLogin(e){
-			let that = this
-			let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
-			if (e.detail.errMsg === "getPhoneNumber:ok") {
-				// 检查是否勾选协议
-				this.checkAgreement(function(){
-					wxMobileLogin({ iv: e.detail.iv, encryptedData: e.detail.encryptedData,miniOpenId:currentMiniOpenId }).then(subRes => {
+	wxPhoneLogin(e){
+		let that = this
+		let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
+		if (e.detail.errMsg === "getPhoneNumber:ok") {
+			wxMobileLogin({ iv: e.detail.iv, encryptedData: e.detail.encryptedData,miniOpenId:currentMiniOpenId }).then(subRes => {
 						uni.hideLoading()
 						if(subRes.data && subRes.data.hasNoOpenId && subRes.data.hasNoOpenId ==1){
 							that.$util.confirmModal({content:'网络异常,请重新操作'},() => {
@@ -244,29 +242,26 @@ export default {
 								that.$store.commit('setDictionariesInfo', { ...res.data.dict, ...res.data })
 								that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
 							})
-							that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
-							getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
-							that.setUserShopAll()
+					that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
+					getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
+					that.setUserShopAll()
 
-							uni.navigateBack()
-						}
-					});
-				})
-			} else {
-				this.$msg("登录失败");
-			}
-		},
-		mobileLogin(){
-			let that = this
+					uni.navigateBack()
+				}
+			});
+		} else {
+			this.$msg("登录失败");
+		}
+	},
+	mobileLogin(){
+		let that = this
 
-			// 先检查协议
-			this.checkAgreement(function(){
-				uni.showLoading({mask:true})
-				uni.preLogin({
-					provider: 'univerify',
-					success:()=>{
-						uni.hideLoading() 
-						uni.login({
+		uni.showLoading({mask:true})
+		uni.preLogin({
+			provider: 'univerify',
+			success:()=>{
+				uni.hideLoading() 
+				uni.login({
 							provider: 'univerify',
 							// 自定义登录框样式
 							univerifyStyle: {
@@ -340,11 +335,10 @@ export default {
 						} else {
 							uni.showToast({title: '登录失败...', duration: 3000, icon:'none'})
 						}
-						console.log(res)
-					}
-				})
-			})
-		},
+				console.log(res)
+			}
+		})
+	},
 		loginFun(){
 			let that = this
 			let mobile = this.mobile

+ 25 - 31
hdApp/src/admin/home/login.vue

@@ -36,7 +36,7 @@
 					<button class="admin-button-com small blue buttonText" @click="mobileLogin">本机号码一键登录</button>
 				</view>
 				<!-- #endif -->
-				<view style="color:#999999;font-size:25upx;margin-top:60upx;">
+				<view style="color:#999999;font-size:25upx;margin-top:60upx;" v-if="showAccountLogin">
 					<checkbox-group @change="agreeItem">
 						<label style="display:flex;align-items:center;justify-content:center;">
 							<checkbox value="1" style="transform:scale(0.8)" :checked="agree == 1" />
@@ -210,13 +210,11 @@ export default {
 					that.hasMobileNet = false
 			}
 		},
-		wxPhoneLogin(e){
-			let that = this
-			let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
-			if (e.detail.errMsg === "getPhoneNumber:ok") {
-				// 检查是否勾选协议
-				this.checkAgreement(function(){
-					wxMobileLogin({ iv: e.detail.iv, encryptedData: e.detail.encryptedData,miniOpenId:currentMiniOpenId }).then(subRes => {
+	wxPhoneLogin(e){
+		let that = this
+		let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
+		if (e.detail.errMsg === "getPhoneNumber:ok") {
+			wxMobileLogin({ iv: e.detail.iv, encryptedData: e.detail.encryptedData,miniOpenId:currentMiniOpenId }).then(subRes => {
 						uni.hideLoading()
 						if(subRes.data && subRes.data.hasNoOpenId && subRes.data.hasNoOpenId == 1){
 							that.$util.confirmModal({content:'网络异常,请刷新重试'},() => {
@@ -279,26 +277,23 @@ export default {
 								//修改上一页data里面的xjData
 								prevPage.$vm.backAction = 'login'
 
-								uni.navigateBack()
-							}
+							uni.navigateBack()
 						}
-					});
-				})
-			} else {
-				this.$msg("登录失败");
-			}
-		},
-		mobileLogin(){
-			let that = this
+					}
+				});
+		} else {
+			this.$msg("登录失败");
+		}
+	},
+	mobileLogin(){
+		let that = this
 
-			// 先检查协议
-			this.checkAgreement(function(){
-				uni.showLoading({mask:true})
-				uni.preLogin({
-					provider: 'univerify',
-					success:()=>{
-						uni.hideLoading()
-						uni.login({
+		uni.showLoading({mask:true})
+		uni.preLogin({
+			provider: 'univerify',
+			success:()=>{
+				uni.hideLoading()
+				uni.login({
 							provider: 'univerify',
 							// 自定义登录框样式
 							univerifyStyle: {
@@ -383,11 +378,10 @@ export default {
 						} else {
 							uni.showToast({title: '登录失败...', duration: 3000, icon:'none'})
 						}
-						console.log(res)
-					}
-				})
-			})
-		},
+				console.log(res)
+			}
+		})
+	},
 		loginFun(){
 			let that = this
 			let mobile = this.mobile