shish il y a 6 mois
Parent
commit
19face894d

+ 222 - 180
ghsApp/src/admin/home/login.vue

@@ -20,36 +20,41 @@
 					</view>
 					</view>
 				</template>
 				</template>
 
 
-				<!-- #ifdef MP-WEIXIN -->
-				<view style="margin-top:35upx;">
-					<view style="color:black;font-size:30upx;margin-top:20upx;">这是门店的管理后台,需获取你的手机号登录后</view>
-					<view style="color:black;font-size:30upx;margin-top:15upx;">才能使用相应功能,请谅解</view>
-					<view style="color:black;font-size:30upx;margin-top:15upx;margin-bottom:30upx;">如不需要,可以点击<text style="color:#3385FF;font-size:36upx;font-weight:bold;margin-left:8upx;" @click="goBack()">拒绝使用</text></view>
-				<button class="admin-button-com small buttonText" open-type="getPhoneNumber" @getphonenumber="wxPhoneLogin"
-				style="background-color:#2BA245;border-color:#2BA245;color:white;height:120upx;line-height:120upx;">手机号一键登录</button>
-				</view>
-				<!-- #endif -->
-				<!-- #ifdef APP-PLUS -->
-				<view style="margin-top:50upx;">
-				<button class="admin-button-com small blue buttonText" @click="mobileLogin()">本机号码一键登录</button>
-				</view>
-				<!-- #endif -->
-				<view style="color:#999999;font-size:25upx;margin-top:55upx;">
-					<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" />
-							<text>
-								我已阅读并同意
-								<text style="font-weight:bold;color:#666666;" @click.stop="goToService">《服务协议》</text>
-								和
-								<text style="font-weight:bold;color:#666666;" @click.stop="goToPrivacy">《隐私政策》</text>
-							</text>
-						</label>
-					</checkbox-group>
-				</view>
-				<view style="margin-top:30upx;color:#999999;width:86vw;font-size:35upx;" v-if="showAccountLogin==false">
-					<text style="float:right;margin-right:35upx;" @click="useAccount()">使用账号密码登录</text>
-				</view>
+			<!-- #ifdef MP-WEIXIN -->
+			<view style="margin-top:35upx;" v-if="showAccountLogin==false">
+				<view style="color:black;font-size:30upx;margin-top:20upx;">这是门店的管理后台,需获取你的手机号登录后</view>
+				<view style="color:black;font-size:30upx;margin-top:15upx;">才能使用相应功能,请谅解</view>
+				<view style="color:black;font-size:30upx;margin-top:15upx;margin-bottom:30upx;">如不需要,可以点击<text style="color:#3385FF;font-size:36upx;font-weight:bold;margin-left:8upx;" @click="goBack()">拒绝使用</text></view>
+			<button class="admin-button-com small buttonText" open-type="getPhoneNumber" @getphonenumber="wxPhoneLogin"
+			style="background-color:#2BA245;border-color:#2BA245;color:white;height:120upx;line-height:120upx;">手机号一键登录</button>
+			</view>
+			<!-- #endif -->
+			<!-- #ifdef APP-PLUS -->
+			<view style="margin-top:50upx;" v-if="showAccountLogin==false">
+			<button class="admin-button-com small blue buttonText" @click="mobileLogin()">本机号码一键登录</button>
+			</view>
+			<!-- #endif -->
+			<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" />
+						<text>
+							我已阅读并同意
+							<text style="font-weight:bold;color:#666666;" @click.stop="goToService">《服务协议》</text>
+							和
+							<text style="font-weight:bold;color:#666666;" @click.stop="goToPrivacy">《隐私政策》</text>
+						</text>
+					</label>
+				</checkbox-group>
+			</view>
+			<view style="margin-top:55upx;color:#848181;font-size:38upx;width:100%;text-align:right;padding-right:70upx;" v-if="showAccountLogin==false">
+				<text style="margin-right:40upx;" @click="useAccount()">使用账号密码登录</text>
+				<text @click="register">注册账号</text>
+			</view>
+			<view style="margin-top:55upx;color:#848181;font-size:38upx;width:100%;text-align:right;padding-right:70upx;" v-else>
+				<text style="margin-right:40upx;" @click="useMoibleAccount()">使用手机号登录</text>
+				<text @click="register">注册账号</text>
+			</view>
 			</view>
 			</view>
 			</view>
 			</view>
 		</view>
 		</view>
@@ -115,9 +120,17 @@ export default {
 	},
 	},
 	methods: {
 	methods: {
 		...mapActions(['setUserShopAll']),
 		...mapActions(['setUserShopAll']),
+		register(){
+			this.pageTo({url:'/pagesClient/official/apply',type:2})
+		},
 		goBack(){
 		goBack(){
 			uni.navigateBack({})
 			uni.navigateBack({})
 		},
 		},
+		useMoibleAccount(){
+			this.showAccountLogin = false
+			this.agree = 0
+			this.$forceUpdate()
+		},
 		useAccount(){
 		useAccount(){
 			this.showAccountLogin = true
 			this.showAccountLogin = true
 			this.agree = 0
 			this.agree = 0
@@ -137,6 +150,38 @@ export default {
 				this.agree = 1
 				this.agree = 1
 			}
 			}
 		},
 		},
+		// 检查并提示用户阅读协议
+		checkAgreement(callback){
+			let that = this
+			if(this.agree == 0){
+				uni.showModal({
+					title: '提示',
+					content: '请阅读并同意服务协议和隐私政策',
+					confirmText: '同意',
+					cancelText: '不同意',
+					success(res) {
+						if (res.confirm) {
+							// 用户选择同意
+							that.agree = 1
+							that.$forceUpdate()
+							if(callback && typeof callback === 'function'){
+								callback()
+							}
+						} else if (res.cancel) {
+							// 用户选择不同意,不执行任何操作
+							console.log('用户选择不同意')
+						}
+					}
+				})
+				return false
+			}else{
+				// 已勾选协议,直接执行回调
+				if(callback && typeof callback === 'function'){
+					callback()
+				}
+				return true
+			}
+		},
 		dealLogin(res){
 		dealLogin(res){
 			let that = this
 			let that = this
 			console.log(res)
 			console.log(res)
@@ -161,49 +206,52 @@ export default {
 			let that = this
 			let that = this
 			let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
 			let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
 			if (e.detail.errMsg === "getPhoneNumber:ok") {
 			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:'网络异常,请重新操作'},() => {
-							// #ifdef MP-WEIXIN
-							uni.clearStorage()
-							that.$store.commit("setLoginInfo", {})
-							that.$util.pageTo({url: "/admin/home/workbench",type: 3})
-							// #endif
-							// #ifdef APP-PLUS
-							uni.clearStorage()
-							that.$store.commit("setLoginInfo", {})
-							plus.runtime.restart()
-							// #endif
-						})
-						return false
-					}
-					let token = subRes.data.token || ''
-					if (that.$util.isEmpty(token)) {
-						that.$msg('请先注册')
-						return false
-					}
-					//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
-					if(subRes.code == 1){
-						if (that.$util.isEmpty(subRes)) {
+				// 检查是否勾选协议
+				this.checkAgreement(function(){
+					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:'网络异常,请重新操作'},() => {
+								// #ifdef MP-WEIXIN
+								uni.clearStorage()
+								that.$store.commit("setLoginInfo", {})
+								that.$util.pageTo({url: "/admin/home/workbench",type: 3})
+								// #endif
+								// #ifdef APP-PLUS
+								uni.clearStorage()
+								that.$store.commit("setLoginInfo", {})
+								plus.runtime.restart()
+								// #endif
+							})
 							return false
 							return false
 						}
 						}
-						uni.setStorageSync('token', subRes.data.token)
-						uni.setStorageSync('shopId', subRes.data.admin.currentGhsShopId)
-						getDictionaries({ token: subRes.data.token }).then(res => {
-							if (that.$util.isEmpty(res)) {
+						let token = subRes.data.token || ''
+						if (that.$util.isEmpty(token)) {
+							that.$msg('请先注册')
+							return false
+						}
+						//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
+						if(subRes.code == 1){
+							if (that.$util.isEmpty(subRes)) {
 								return false
 								return false
 							}
 							}
-							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()
+							uni.setStorageSync('token', subRes.data.token)
+							uni.setStorageSync('shopId', subRes.data.admin.currentGhsShopId)
+							getDictionaries({ token: subRes.data.token }).then(res => {
+								if (that.$util.isEmpty(res)) {
+									return false
+								}
+								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()
 
 
-						uni.navigateBack()
-					}
-				});
+							uni.navigateBack()
+						}
+					});
+				})
 			} else {
 			} else {
 				this.$msg("登录失败");
 				this.$msg("登录失败");
 			}
 			}
@@ -211,106 +259,96 @@ export default {
 		mobileLogin(){
 		mobileLogin(){
 			let that = this
 			let that = this
 
 
-			// #ifdef APP-PLUS
-			if(this.agree == 0){
-				this.$msg('请同意并勾选服务协议和隐私政策')
-				return false				
-			}
-			// #endif
-
-			uni.showLoading({mask:true})
-			uni.preLogin({
-				provider: 'univerify',
-				success:()=>{
-					uni.hideLoading() 
-					uni.login({
-						provider: 'univerify',
-						// 自定义登录框样式
-						univerifyStyle: {
-							"fullScreen": true,
-							"privacyTerms": {  
-								"defaultCheckBoxState":false,
-								"checkBoxSize":18
-							}
-						},
-						// 登录成功
-						success:(res)=>{
-							let openid = res.authResult.openid
-							let access_token = res.authResult.access_token
-							phoneLogin({openid,access_token}).then(subRes=>{
-								let token = subRes.data.token || ''
-								if (that.$util.isEmpty(token)) {
-									that.$msg('请先注册')
-									return false
+			// 先检查协议
+			this.checkAgreement(function(){
+				uni.showLoading({mask:true})
+				uni.preLogin({
+					provider: 'univerify',
+					success:()=>{
+						uni.hideLoading() 
+						uni.login({
+							provider: 'univerify',
+							// 自定义登录框样式
+							univerifyStyle: {
+								"fullScreen": true,
+								"privacyTerms": {  
+									"defaultCheckBoxState":false,
+									"checkBoxSize":18
 								}
 								}
-								//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
-								if(subRes.code == 1){
-									if (that.$util.isEmpty(subRes)) {
+							},
+							// 登录成功
+							success:(res)=>{
+								let openid = res.authResult.openid
+								let access_token = res.authResult.access_token
+								phoneLogin({openid,access_token}).then(subRes=>{
+									let token = subRes.data.token || ''
+									if (that.$util.isEmpty(token)) {
+										that.$msg('请先注册')
 										return false
 										return false
 									}
 									}
-									uni.setStorageSync('token', subRes.data.token)
-									uni.setStorageSync('shopId', subRes.data.admin.currentGhsShopId)
-									getDictionaries({ token: subRes.data.token }).then(res => {
-										if (that.$util.isEmpty(res)) {
+									//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
+									if(subRes.code == 1){
+										if (that.$util.isEmpty(subRes)) {
 											return false
 											return false
 										}
 										}
-										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()
-									uni.navigateBack()
+										uni.setStorageSync('token', subRes.data.token)
+										uni.setStorageSync('shopId', subRes.data.admin.currentGhsShopId)
+										getDictionaries({ token: subRes.data.token }).then(res => {
+											if (that.$util.isEmpty(res)) {
+												return false
+											}
+											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()
+										uni.navigateBack()
 
 
-									// #ifdef APP-PLUS
-									//保存 clientId
-									//let hasClientId = !that.$util.isEmpty(subRes.data.admin.clientId) ? subRes.data.admin.clientId : ''
-									const clientInfo = plus.push.getClientInfo()
-									let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
-									if(currentClientId != ''){
-										replaceClientId({id:currentClientId, auto:0})
+										// #ifdef APP-PLUS
+										//保存 clientId
+										//let hasClientId = !that.$util.isEmpty(subRes.data.admin.clientId) ? subRes.data.admin.clientId : ''
+										const clientInfo = plus.push.getClientInfo()
+										let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
+										if(currentClientId != ''){
+											replaceClientId({id:currentClientId, auto:0})
+										}
+										// #endif
 									}
 									}
-									// #endif
-								}
-							})
-						},
-						fail(res){
-							uni.showToast({title:'已取消', duration: 3000, icon:'none'})
-							//关闭一键登录弹出窗口
-							uni.closeAuthView()
-							console.log(res)
-						},
-						complete: (res) => {
-							uni.hideLoading()
-							uni.closeAuthView()
+								})
+							},
+							fail(res){
+								uni.showToast({title:'已取消', duration: 3000, icon:'none'})
+								//关闭一键登录弹出窗口
+								uni.closeAuthView()
+								console.log(res)
+							},
+							complete: (res) => {
+								uni.hideLoading()
+								uni.closeAuthView()
+							}
+						})
+					},
+					fail(res){  
+						//如果手机没有插入有效的sim卡,或者手机蜂窝数据网络关闭,都有可能造成预登录校验失败
+						if (res.code == 30005) {
+							uni.showToast({title: '请关闭WIFI,打开移动流量', duration: 3000, icon:'none'})
+						} else if(res.code == 1000) {
+							uni.showToast({title: '即将开通', duration: 3000, icon:'none'})
+						} else if(res.code == 40004) {
+							uni.showToast({title: '即将开通...', duration: 3000, icon:'none'})
+						} else {
+							uni.showToast({title: '登录失败...', duration: 3000, icon:'none'})
 						}
 						}
-					})
-				},
-				fail(res){  
-					//如果手机没有插入有效的sim卡,或者手机蜂窝数据网络关闭,都有可能造成预登录校验失败
-					if (res.code == 30005) {
-						uni.showToast({title: '请关闭WIFI,打开移动流量', duration: 3000, icon:'none'})
-					} else if(res.code == 1000) {
-						uni.showToast({title: '即将开通', duration: 3000, icon:'none'})
-					} else if(res.code == 40004) {
-						uni.showToast({title: '即将开通...', duration: 3000, icon:'none'})
-					} else {
-						uni.showToast({title: '登录失败...', duration: 3000, icon:'none'})
+						console.log(res)
 					}
 					}
-					console.log(res)
-				}
+				})
 			})
 			})
 		},
 		},
 		loginFun(){
 		loginFun(){
 			let that = this
 			let that = this
 			let mobile = this.mobile
 			let mobile = this.mobile
 			let password = this.password
 			let password = this.password
-			// #ifdef APP-PLUS
-			if(that.agree == 0){
-				this.$msg('请同意并勾选服务协议和隐私政策')
-				return false				
-			}
-			// #endif
 			if (that.$util.isEmpty(mobile)) {
 			if (that.$util.isEmpty(mobile)) {
 				this.$msg('请输入手机号')
 				this.$msg('请输入手机号')
 				return false
 				return false
@@ -323,37 +361,41 @@ export default {
 				this.$msg('请输入密码')
 				this.$msg('请输入密码')
 				return false
 				return false
 			}
 			}
-			uni.showLoading({mask:true})
-			//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
-			appLogin({mobile, password}).then(subRes=>{
-				uni.hideLoading()
-				if(subRes.code == 1){
-					if (that.$util.isEmpty(subRes)) {
-						return false
-					}
-					uni.setStorageSync('token', subRes.data.token)
-					uni.setStorageSync('shopId', subRes.data.admin.currentGhsShopId)
-					getDictionaries({ token: subRes.data.token }).then(res => {
-						if (that.$util.isEmpty(res)) {
+			
+			// 检查协议
+			this.checkAgreement(function(){
+				uni.showLoading({mask:true})
+				//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
+				appLogin({mobile, password}).then(subRes=>{
+					uni.hideLoading()
+					if(subRes.code == 1){
+						if (that.$util.isEmpty(subRes)) {
 							return false
 							return false
 						}
 						}
-						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()
-					uni.navigateBack()
+						uni.setStorageSync('token', subRes.data.token)
+						uni.setStorageSync('shopId', subRes.data.admin.currentGhsShopId)
+						getDictionaries({ token: subRes.data.token }).then(res => {
+							if (that.$util.isEmpty(res)) {
+								return false
+							}
+							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()
+						uni.navigateBack()
 
 
-					// #ifdef APP-PLUS
-					//保存 clientId
-					const clientInfo = plus.push.getClientInfo()
-					let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
-					if(currentClientId != ''){
-						replaceClientId({id:currentClientId, auto:0})
+						// #ifdef APP-PLUS
+						//保存 clientId
+						const clientInfo = plus.push.getClientInfo()
+						let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
+						if(currentClientId != ''){
+							replaceClientId({id:currentClientId, auto:0})
+						}
+						// #endif
 					}
 					}
-					// #endif
-				}
+				})
 			})
 			})
 		}
 		}
 	}
 	}

+ 21 - 6
ghsApp/src/pagesClient/official/apply.vue

@@ -280,12 +280,27 @@ export default {
       let formData = this.form;
       let formData = this.form;
       let checkRes = form.validation(formData, rules);
       let checkRes = form.validation(formData, rules);
       
       
-      // #ifdef APP-PLUS
-			if(this.agree == 0){
-				this.$msg('请同意并勾选服务协议和隐私政策')
-				return false				
-			}
-      // #endif
+      // 检查是否同意服务协议和隐私政策
+      if(this.agree == 0){
+        this.$util.confirmModal({
+          content:'请阅读并同意服务协议和隐私政策',
+          okText:'同意',
+          cancelText:'不同意'
+        },() => {
+          // 点击同意时,直接执行下一步
+          this.agree = 1
+          if (!checkRes) {
+            uni.showLoading({mask:true})
+            setTimeout(() => {
+              this.confirmFn()
+            })
+            uni.hideLoading()
+          } else {
+            this.$msg(checkRes);
+          }
+        })
+        return false
+      }
 
 
       // if(this.$util.isEmpty(this.form.cover)){
       // if(this.$util.isEmpty(this.form.cover)){
       //   this.$msg('请上传照片')
       //   this.$msg('请上传照片')

+ 226 - 188
hdApp/src/admin/home/login.vue

@@ -21,7 +21,7 @@
 				</template>
 				</template>
 
 
 				<!-- #ifdef MP-WEIXIN -->
 				<!-- #ifdef MP-WEIXIN -->
-				<view style="margin-top:55upx;">
+				<view style="margin-top:55upx;" v-if="showAccountLogin==false">
 
 
 					<view style="color:black;font-size:30upx;margin-top:30upx;">这是花店管理后台,需获取你的手机号登录后</view>
 					<view style="color:black;font-size:30upx;margin-top:30upx;">这是花店管理后台,需获取你的手机号登录后</view>
 					<view style="color:black;font-size:30upx;margin-top:15upx;">才能使用相应功能,请谅解</view>
 					<view style="color:black;font-size:30upx;margin-top:15upx;">才能使用相应功能,请谅解</view>
@@ -32,11 +32,11 @@
 				</view>
 				</view>
 				<!-- #endif -->
 				<!-- #endif -->
 				<!-- #ifdef APP-PLUS -->
 				<!-- #ifdef APP-PLUS -->
-				<view style="margin-top:55upx;">
-				<button class="admin-button-com small blue buttonText" @click="mobileLogin">本机号码一键登录</button>
+				<view style="margin-top:55upx;" v-if="showAccountLogin==false">
+					<button class="admin-button-com small blue buttonText" @click="mobileLogin">本机号码一键登录</button>
 				</view>
 				</view>
 				<!-- #endif -->
 				<!-- #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">
 					<checkbox-group @change="agreeItem">
 						<label style="display:flex;align-items:center;justify-content:center;">
 						<label style="display:flex;align-items:center;justify-content:center;">
 							<checkbox value="1" style="transform:scale(0.8)" :checked="agree == 1" />
 							<checkbox value="1" style="transform:scale(0.8)" :checked="agree == 1" />
@@ -49,10 +49,14 @@
 						</label>
 						</label>
 					</checkbox-group>
 					</checkbox-group>
 				</view>
 				</view>
-				<view style="margin-top:45upx;color:#333333;font-size:38upx;width:100%;text-align:right;padding-right:70upx;">
+				<view style="margin-top:45upx;color:#333333;font-size:38upx;width:100%;text-align:right;padding-right:70upx;" v-if="showAccountLogin==false">
 					<text style="margin-right:40upx;" @click="useAccount()">使用账号密码登录</text>
 					<text style="margin-right:40upx;" @click="useAccount()">使用账号密码登录</text>
 					<text @click="register">注册账号</text>
 					<text @click="register">注册账号</text>
 				</view>
 				</view>
+				<view style="margin-top:45upx;color:#333333;font-size:38upx;width:100%;text-align:right;padding-right:70upx;" v-else>
+					<text style="margin-right:40upx;" @click="useMoibleAccount()">使用手机号登录</text>
+					<text @click="register">注册账号</text>
+				</view>
 			</view>
 			</view>
 			</view>
 			</view>
 		</view>
 		</view>
@@ -130,6 +134,11 @@ export default {
 		goBack(){
 		goBack(){
 			uni.navigateBack({})
 			uni.navigateBack({})
 		},
 		},
+		useMoibleAccount(){
+			this.showAccountLogin = false
+			this.agree = 0
+			this.$forceUpdate()
+		},
 		useAccount(){
 		useAccount(){
 			this.showAccountLogin = true
 			this.showAccountLogin = true
 			this.agree = 0
 			this.agree = 0
@@ -149,6 +158,38 @@ export default {
 				this.agree = 1
 				this.agree = 1
 			}
 			}
 		},
 		},
+		// 检查并提示用户阅读协议
+		checkAgreement(callback){
+			let that = this
+			if(this.agree == 0){
+				uni.showModal({
+					title: '提示',
+					content: '请阅读并同意服务协议和隐私政策',
+					confirmText: '同意',
+					cancelText: '不同意',
+					success(res) {
+						if (res.confirm) {
+							// 用户选择同意
+							that.agree = 1
+							that.$forceUpdate()
+							if(callback && typeof callback === 'function'){
+								callback()
+							}
+						} else if (res.cancel) {
+							// 用户选择不同意,不执行任何操作
+							console.log('用户选择不同意')
+						}
+					}
+				})
+				return false
+			}else{
+				// 已勾选协议,直接执行回调
+				if(callback && typeof callback === 'function'){
+					callback()
+				}
+				return true
+			}
+		},
 		dealLogin(res){
 		dealLogin(res){
 			let that = this
 			let that = this
 			console.log(res)
 			console.log(res)
@@ -173,73 +214,76 @@ export default {
 			let that = this
 			let that = this
 			let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
 			let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
 			if (e.detail.errMsg === "getPhoneNumber:ok") {
 			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:'网络异常,请刷新重试'},() => {
+				// 检查是否勾选协议
+				this.checkAgreement(function(){
+					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:'网络异常,请刷新重试'},() => {
 
 
-							// #ifdef MP-WEIXIN
-							uni.clearStorage()
-							that.$store.commit("setLoginInfo", {})
-							that.$util.pageTo({url: "/admin/home/workbench",type: 3})
-							// #endif
+								// #ifdef MP-WEIXIN
+								uni.clearStorage()
+								that.$store.commit("setLoginInfo", {})
+								that.$util.pageTo({url: "/admin/home/workbench",type: 3})
+								// #endif
 
 
-							// #ifdef APP-PLUS
-							uni.clearStorage()
-							that.$store.commit("setLoginInfo", {})
-							plus.runtime.restart()
-							// #endif
+								// #ifdef APP-PLUS
+								uni.clearStorage()
+								that.$store.commit("setLoginInfo", {})
+								plus.runtime.restart()
+								// #endif
 
 
-						})
-						return false
-					}
-					let token = subRes.data.token || ''
-					if (that.$util.isEmpty(token)) {
-						that.$msg('请先注册')
-						return false
-					}
-					//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
-					if(subRes.code == 1){
-						if (that.$util.isEmpty(subRes)) {
+							})
 							return false
 							return false
 						}
 						}
-						uni.setStorageSync('token', subRes.data.token)
-						uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
-						getDictionaries({ token: subRes.data.token }).then(res => {
-							if (that.$util.isEmpty(res)) {
-								return false
-							}
-							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()
-
-						if(this.option.fromType && this.option.fromType == 2){
-							//跳转失信人员页面
-							that.$util.pageTo({url: "/admin/ll/list", type:2})
+						let token = subRes.data.token || ''
+						if (that.$util.isEmpty(token)) {
+							that.$msg('请先注册')
 							return false
 							return false
 						}
 						}
-
-						if(this.option.itemId && Number(this.option.itemId)>0 && this.option.ghsShopId && Number(this.option.ghsShopId)>0){
-							ghsInfo({shopId:this.option.ghsShopId}).then(resInfo => {
-								let ghsId = resInfo.data.id
-								if(Number(ghsId)>0){
-									that.$util.pageTo({url: "/admin/ghsProduct/detail?id="+that.option.itemId+'&ghsId='+ghsId, type:2})
+						//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
+						if(subRes.code == 1){
+							if (that.$util.isEmpty(subRes)) {
+								return false
+							}
+							uni.setStorageSync('token', subRes.data.token)
+							uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
+							getDictionaries({ token: subRes.data.token }).then(res => {
+								if (that.$util.isEmpty(res)) {
+									return false
 								}
 								}
+								that.$store.commit('setDictionariesInfo', { ...res.data.dict, ...res.data })
+								that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
 							})
 							})
-						}else{
-							//返回上一页带参数
-							let pages = getCurrentPages();
-							let prevPage = pages[ pages.length - 2 ];
-							//修改上一页data里面的xjData
-							prevPage.$vm.backAction = 'login'
+							that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
+							getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
+							that.setUserShopAll()
+
+							if(this.option.fromType && this.option.fromType == 2){
+								//跳转失信人员页面
+								that.$util.pageTo({url: "/admin/ll/list", type:2})
+								return false
+							}
 
 
-							uni.navigateBack()
+							if(this.option.itemId && Number(this.option.itemId)>0 && this.option.ghsShopId && Number(this.option.ghsShopId)>0){
+								ghsInfo({shopId:this.option.ghsShopId}).then(resInfo => {
+									let ghsId = resInfo.data.id
+									if(Number(ghsId)>0){
+										that.$util.pageTo({url: "/admin/ghsProduct/detail?id="+that.option.itemId+'&ghsId='+ghsId, type:2})
+									}
+								})
+							}else{
+								//返回上一页带参数
+								let pages = getCurrentPages();
+								let prevPage = pages[ pages.length - 2 ];
+								//修改上一页data里面的xjData
+								prevPage.$vm.backAction = 'login'
+
+								uni.navigateBack()
+							}
 						}
 						}
-					}
-				});
+					});
+				})
 			} else {
 			} else {
 				this.$msg("登录失败");
 				this.$msg("登录失败");
 			}
 			}
@@ -247,117 +291,107 @@ export default {
 		mobileLogin(){
 		mobileLogin(){
 			let that = this
 			let that = this
 
 
-			// #ifdef APP-PLUS
-			if(this.agree == 0){
-				this.$msg('请同意并勾选服务协议和隐私政策')
-				return false
-			}
-			// #endif
-
-			uni.showLoading({mask:true})
-			uni.preLogin({
-				provider: 'univerify',
-				success:()=>{
-					uni.hideLoading()
-					uni.login({
-						provider: 'univerify',
-						// 自定义登录框样式
-						univerifyStyle: {
-							"fullScreen": true,
-							"privacyTerms": {
-								"defaultCheckBoxState":false,
-								"checkBoxSize":18
-							}
-						},
-						success:(res)=>{ // 登录成功
-							console.log(res)
-							let openid = res.authResult.openid
-							let access_token = res.authResult.access_token
-							phoneLogin({openid,access_token}).then(subRes=>{
-								let token = subRes.data.token || ''
-								if (that.$util.isEmpty(token)) {
-									that.$msg('请先注册')
-									return false
+			// 先检查协议
+			this.checkAgreement(function(){
+				uni.showLoading({mask:true})
+				uni.preLogin({
+					provider: 'univerify',
+					success:()=>{
+						uni.hideLoading()
+						uni.login({
+							provider: 'univerify',
+							// 自定义登录框样式
+							univerifyStyle: {
+								"fullScreen": true,
+								"privacyTerms": {
+									"defaultCheckBoxState":false,
+									"checkBoxSize":18
 								}
 								}
-								//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
-								if(subRes.code == 1){
-									if (that.$util.isEmpty(subRes)) {
-										uni.showToast({title:'subRes is empty', duration: 3000, icon:'none'})
+							},
+							success:(res)=>{ // 登录成功
+								console.log(res)
+								let openid = res.authResult.openid
+								let access_token = res.authResult.access_token
+								phoneLogin({openid,access_token}).then(subRes=>{
+									let token = subRes.data.token || ''
+									if (that.$util.isEmpty(token)) {
+										that.$msg('请先注册')
 										return false
 										return false
 									}
 									}
-									uni.setStorageSync('token', subRes.data.token)
-									uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
-									getDictionaries({ token: subRes.data.token }).then(res => {
-										if (that.$util.isEmpty(res)) {
-											uni.showToast({title:'getDictionaries get empty', duration: 3000, icon:'none'})
+									//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
+									if(subRes.code == 1){
+										if (that.$util.isEmpty(subRes)) {
+											uni.showToast({title:'subRes is empty', duration: 3000, icon:'none'})
 											return false
 											return false
 										}
 										}
-										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()
+										uni.setStorageSync('token', subRes.data.token)
+										uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
+										getDictionaries({ token: subRes.data.token }).then(res => {
+											if (that.$util.isEmpty(res)) {
+												uni.showToast({title:'getDictionaries get empty', duration: 3000, icon:'none'})
+												return false
+											}
+											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()
 
 
-									//返回上一页带参数
-									let pages = getCurrentPages();
-									let prevPage = pages[ pages.length - 2 ];
-									//修改上一页data里面的xjData
-									prevPage.$vm.backAction = 'login'
-									uni.navigateBack()
+										//返回上一页带参数
+										let pages = getCurrentPages();
+										let prevPage = pages[ pages.length - 2 ];
+										//修改上一页data里面的xjData
+										prevPage.$vm.backAction = 'login'
+										uni.navigateBack()
 
 
-									// #ifdef APP-PLUS
-									//保存安卓的clientId
-									const clientInfo = plus.push.getClientInfo()
-									let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
-									if(currentClientId != ''){
-										replaceClientId({id:currentClientId, auto:0})
-										console.log("mobileLogin - clientId ---------- ", currentClientId)
+										// #ifdef APP-PLUS
+										//保存安卓的clientId
+										const clientInfo = plus.push.getClientInfo()
+										let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
+										if(currentClientId != ''){
+											replaceClientId({id:currentClientId, auto:0})
+											console.log("mobileLogin - clientId ---------- ", currentClientId)
+										}
+										// #endif
 									}
 									}
-									// #endif
-								}
-							})
-						},
-						fail(res){
-							uni.showToast({title:'已取消', duration: 3000, icon:'none'})
-							//关闭一键登录弹出窗口
-							uni.closeAuthView()
-							console.log(res)
-						},
-						complete: (res) => {
+								})
+							},
+							fail(res){
+								uni.showToast({title:'已取消', duration: 3000, icon:'none'})
+								//关闭一键登录弹出窗口
+								uni.closeAuthView()
+								console.log(res)
+							},
+							complete: (res) => {
+								uni.hideLoading()
+								uni.closeAuthView()
+							}
+						})
+					},
+					fail(res){
+						//如果手机没有插入有效的sim卡,或者手机蜂窝数据网络关闭,都有可能造成预登录校验失败
+						if (res.code == 30005) {
 							uni.hideLoading()
 							uni.hideLoading()
-							uni.closeAuthView()
+							that.$util.confirmModal({content:'登录失败,请看视频操作后再试'},() => {
+								that.pageTo({url: '/admin/home/appLoginRemind'})
+							})
+						} else if(res.code == 1000) {
+							uni.showToast({title: '即将开通', duration: 3000, icon:'none'})
+						} else if(res.code == 40004) {
+							uni.showToast({title: '即将开通...', duration: 3000, icon:'none'})
+						} else {
+							uni.showToast({title: '登录失败...', duration: 3000, icon:'none'})
 						}
 						}
-					})
-				},
-				fail(res){
-					//如果手机没有插入有效的sim卡,或者手机蜂窝数据网络关闭,都有可能造成预登录校验失败
-					if (res.code == 30005) {
-						uni.hideLoading()
-						that.$util.confirmModal({content:'登录失败,请看视频操作后再试'},() => {
-							that.pageTo({url: '/admin/home/appLoginRemind'})
-						})
-					} else if(res.code == 1000) {
-						uni.showToast({title: '即将开通', duration: 3000, icon:'none'})
-					} else if(res.code == 40004) {
-						uni.showToast({title: '即将开通...', duration: 3000, icon:'none'})
-					} else {
-						uni.showToast({title: '登录失败...', duration: 3000, icon:'none'})
+						console.log(res)
 					}
 					}
-					console.log(res)
-				}
+				})
 			})
 			})
 		},
 		},
 		loginFun(){
 		loginFun(){
 			let that = this
 			let that = this
 			let mobile = this.mobile
 			let mobile = this.mobile
 			let password = this.password
 			let password = this.password
-			// #ifdef APP-PLUS
-			if(that.agree == 0){
-				this.$msg('请同意并勾选服务协议和隐私政策')
-				return false
-			}
-			// #endif
 			if (that.$util.isEmpty(mobile)) {
 			if (that.$util.isEmpty(mobile)) {
 				this.$msg('请输入手机号')
 				this.$msg('请输入手机号')
 				return false
 				return false
@@ -370,44 +404,48 @@ export default {
 				this.$msg('请输入密码')
 				this.$msg('请输入密码')
 				return false
 				return false
 			}
 			}
-			uni.showLoading({mask:true})
-			//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
-			appLogin({mobile,password}).then(subRes=>{
-				uni.hideLoading()
-				if(subRes.code == 1){
-					if (that.$util.isEmpty(subRes)) {
-						return false
-					}
-					uni.setStorageSync('token', subRes.data.token)
-					uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
-					getDictionaries({ token: subRes.data.token }).then(res => {
-						if (that.$util.isEmpty(res)) {
+			
+			// 检查协议
+			this.checkAgreement(function(){
+				uni.showLoading({mask:true})
+				//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
+				appLogin({mobile,password}).then(subRes=>{
+					uni.hideLoading()
+					if(subRes.code == 1){
+						if (that.$util.isEmpty(subRes)) {
 							return false
 							return false
 						}
 						}
-						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()
+						uni.setStorageSync('token', subRes.data.token)
+						uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
+						getDictionaries({ token: subRes.data.token }).then(res => {
+							if (that.$util.isEmpty(res)) {
+								return false
+							}
+							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()
 
 
-					//返回上一页带参数
-					let pages = getCurrentPages();
-					let prevPage = pages[ pages.length - 2 ];
-					//修改上一页data里面的xjData
-					prevPage.$vm.backAction = 'login'
-					uni.navigateBack()
+						//返回上一页带参数
+						let pages = getCurrentPages();
+						let prevPage = pages[ pages.length - 2 ];
+						//修改上一页data里面的xjData
+						prevPage.$vm.backAction = 'login'
+						uni.navigateBack()
 
 
-					// #ifdef APP-PLUS
-					//保存安卓的clientId
-					const clientInfo = plus.push.getClientInfo()
-					let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
-					if(currentClientId != ''){
-						replaceClientId({id:currentClientId, auto:0})
-						console.log("loginFun - clientId ---------- ", currentClientId)
+						// #ifdef APP-PLUS
+						//保存安卓的clientId
+						const clientInfo = plus.push.getClientInfo()
+						let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
+						if(currentClientId != ''){
+							replaceClientId({id:currentClientId, auto:0})
+							console.log("loginFun - clientId ---------- ", currentClientId)
+						}
+						// #endif
 					}
 					}
-					// #endif
-				}
+				})
 			})
 			})
 
 
 		}
 		}

+ 2 - 0
hdApp/src/pages.json

@@ -8,6 +8,8 @@
 		{ "path": "admin/home/member", "style": { "navigationBarTitleText": "客户", "enablePullDownRefresh": true } },
 		{ "path": "admin/home/member", "style": { "navigationBarTitleText": "客户", "enablePullDownRefresh": true } },
 		{ "path": "admin/home/apply", "style": { "navigationBarTitleText": "应用", "enablePullDownRefresh": true } },
 		{ "path": "admin/home/apply", "style": { "navigationBarTitleText": "应用", "enablePullDownRefresh": true } },
 		{ "path": "admin/home/close","style": {"navigationBarTitleText": "申请注销账号"}},
 		{ "path": "admin/home/close","style": {"navigationBarTitleText": "申请注销账号"}},
+		{"path": "admin/home/register","style": {"navigationBarTitleText": "服务协议"}},
+		{"path": "admin/home/privacy","style": {"navigationBarTitleText": "隐私政策"}},
 		{ "path": "admin/home/me", "style": { "navigationBarTitleText": "我的", "enablePullDownRefresh": true, "navigationStyle": "custom" } },
 		{ "path": "admin/home/me", "style": { "navigationBarTitleText": "我的", "enablePullDownRefresh": true, "navigationStyle": "custom" } },
 		{"path": "common/success","style": {"navigationBarBackgroundColor": "#ffffff","navigationBarTextStyle": "black"}},
 		{"path": "common/success","style": {"navigationBarBackgroundColor": "#ffffff","navigationBarTextStyle": "black"}},
 		{"path": "common/webview","style": {"navigationBarTitleText": "网页","navigationBarBackgroundColor": "#ffffff","navigationBarTextStyle": "black"}}
 		{"path": "common/webview","style": {"navigationBarTitleText": "网页","navigationBarBackgroundColor": "#ffffff","navigationBarTextStyle": "black"}}

+ 21 - 4
hdApp/src/pagesClient/official/apply.vue

@@ -348,10 +348,27 @@ export default {
       let formData = this.form;
       let formData = this.form;
       let checkRes = form.validation(formData, rules)
       let checkRes = form.validation(formData, rules)
 
 
-			if(this.agree == 0){
-				this.$msg('请同意并勾选服务协议和隐私政策')
-				return false				
-			}
+      // 检查是否同意服务协议和隐私政策
+      if(this.agree == 0){
+        this.$util.confirmModal({
+          content:'请阅读并同意服务协议和隐私政策',
+          okText:'同意',
+          cancelText:'不同意'
+        },() => {
+          // 点击同意时,直接执行下一步
+          this.agree = 1
+          if (!checkRes) {
+            uni.showLoading({mask:true})
+            setTimeout(() => {
+              this.confirmFn()
+            })
+            uni.hideLoading()
+          } else {
+            this.$msg(checkRes);
+          }
+        })
+        return false
+      }
 
 
       if (!checkRes) {
       if (!checkRes) {
         uni.showLoading({mask:true})
         uni.showLoading({mask:true})