Browse Source

短信登录优化

shish 1 month ago
parent
commit
df5a24f95e
2 changed files with 62 additions and 18 deletions
  1. 24 8
      ghsApp/src/admin/home/login.vue
  2. 38 10
      hdApp/src/admin/home/login.vue

+ 24 - 8
ghsApp/src/admin/home/login.vue

@@ -563,9 +563,17 @@ export default {
 							})
 						},
 						fail(res){
-							uni.showToast({title:'已取消', duration: 3000, icon:'none'})
 							//关闭一键登录弹出窗口
 							uni.closeAuthView()
+							uni.showModal({
+								title: '登录失败',
+								content: '一键登录失败或已取消,是否使用短信验证码登录?',
+								success: (confirmRes) => {
+									if (confirmRes.confirm) {
+										that.useSms()
+									}
+								}
+							})
 							console.log(res)
 						},
 						complete: (res) => {
@@ -576,17 +584,25 @@ export default {
 				},
 				fail(res){  
 					//如果手机没有插入有效的sim卡,或者手机蜂窝数据网络关闭,都有可能造成预登录校验失败
+					let msg = '登录失败...'
 					if (res.code == 30005) {
-						uni.showToast({title: '请关闭WIFI,打开移动流量', duration: 3000, icon:'none'})
+						msg = '请关闭WIFI,打开移动流量'
 					} else if(res.code == 1000) {
-						uni.showToast({title: '即将开通', duration: 3000, icon:'none'})
+						msg = '即将开通'
 					} else if(res.code == 40004) {
-						uni.showToast({title: '即将开通...', duration: 3000, icon:'none'})
-					} else {
-						uni.showToast({title: '登录失败...', duration: 3000, icon:'none'})
+						msg = '即将开通...'
 					}
-				console.log(res)
-			}
+					uni.showModal({
+						title: '一键登录失败',
+						content: msg + ',是否使用短信验证码登录?',
+						success: (confirmRes) => {
+							if (confirmRes.confirm) {
+								that.useSms()
+							}
+						}
+					})
+					console.log(res)
+				}
 		})
 			})
 	},

+ 38 - 10
hdApp/src/admin/home/login.vue

@@ -478,9 +478,17 @@ export default {
 								})
 							},
 							fail(res){
-								uni.showToast({title:'已取消', duration: 3000, icon:'none'})
 								//关闭一键登录弹出窗口
 								uni.closeAuthView()
+								uni.showModal({
+									title: '登录失败',
+									content: '一键登录失败或已取消,是否使用短信验证码登录?',
+									success: (confirmRes) => {
+										if (confirmRes.confirm) {
+											that.useSms()
+										}
+									}
+								})
 								console.log(res)
 							},
 							complete: (res) => {
@@ -493,18 +501,38 @@ export default {
 						//如果手机没有插入有效的sim卡,或者手机蜂窝数据网络关闭,都有可能造成预登录校验失败
 						if (res.code == 30005) {
 							uni.hideLoading()
-							that.$util.confirmModal({content:'登录失败,请看视频操作后再试'},() => {
-								that.pageTo({url: '/admin/home/appLoginRemind'})
+							uni.showModal({
+								title: '一键登录失败',
+								content: '无法获取本机号码,是否使用短信验证码登录?',
+								success: (confirmRes) => {
+									if (confirmRes.confirm) {
+										that.useSms()
+									} else {
+										that.$util.confirmModal({content:'请看视频操作后再试'},() => {
+											that.pageTo({url: '/admin/home/appLoginRemind'})
+										})
+									}
+								}
 							})
-						} else if(res.code == 1000) {
-							uni.showToast({title: '即将开通', duration: 3000, icon:'none'})
+							return
+						}
+						let msg = '登录失败...'
+						if(res.code == 1000) {
+							msg = '即将开通'
 						} else if(res.code == 40004) {
-							uni.showToast({title: '即将开通...', duration: 3000, icon:'none'})
-						} else {
-							uni.showToast({title: '登录失败...', duration: 3000, icon:'none'})
+							msg = '即将开通...'
 						}
-				console.log(res)
-			}
+						uni.showModal({
+							title: '一键登录失败',
+							content: msg + ',是否使用短信验证码登录?',
+							success: (confirmRes) => {
+								if (confirmRes.confirm) {
+									that.useSms()
+								}
+							}
+						})
+						console.log(res)
+					}
 		})
 		})
 	},