gjy 3 éve
szülő
commit
8d5ab9a736

+ 24 - 11
pages/public/code.vue

@@ -165,17 +165,30 @@
 						mask:true
 					})
 					this.$api.doRequest('get','/commonUser/loginVerifyCode',{phone:this.phone,verifyCode:this.inputList}).then(res => {
-					                uni.setStorageSync('userInfo', res.data)
-					                that.$store.commit('login', res.data)
-					                that.liangxinLogin()
-					                uni.switchTab({
-					                	url: '/pages/sale/information'
-					                });
-					                uni.hideLoading()
-					            })
-					            .catch(res => {
-					                console.log(res);
-					            });
+					    if(res.data.code==200){
+							uni.setStorageSync('userInfo', res.data.data)
+					        that.$store.commit('login', res.data.data)
+					        that.liangxinLogin()
+					        uni.switchTab({
+								url: '/pages/sale/information'
+								});
+							uni.hideLoading()
+						}else{
+							uni.hideLoading()
+							uni.showToast({
+								title: res.data.message,
+								icon:'none',
+								duration: 2000
+					        })
+						}
+					})
+					.catch(res => {
+						uni.showToast({
+							title: res.data.message,
+							icon:'none',
+							duration: 2000
+						})
+					});
 				}
 			}
 			

+ 16 - 34
pages/public/login_account_number.vue

@@ -97,14 +97,22 @@
 					mask:true
 				})
 				this.$api.doRequest('get','/commonUser/login',{phone:this.phone,password:this.password}).then(res => {
-				    // 获得数据
-					uni.setStorageSync('userInfo', res.data)
-					that.$store.commit('login', res.data)
-					that.liangxinLogin()
-					uni.switchTab({
-						url: '/pages/sale/information'
-					});
-					uni.hideLoading()
+					if(res.data.code==200){
+						uni.setStorageSync('userInfo', res.data.data)
+						that.$store.commit('login', res.data.data)
+						that.liangxinLogin()
+						uni.switchTab({
+							url: '/pages/sale/information'
+						});
+						uni.hideLoading()
+					}else{
+						uni.hideLoading()
+						uni.showToast({
+							title: res.data.message,
+							icon:'none',
+							duration: 2000
+						})
+					}
 				})
 				.catch(res => {
 				    console.log(res);
@@ -127,32 +135,6 @@
 					url:'/pages/public/reset'
 				})
 			},
-			phonelogin(){
-				var that=this
-				uni.showLoading({
-					title: '登录中',
-					mask:true
-				})
-				console.log("clientid",that.clientId)
-				this.$api.request('user', 'login',{
-					password:that.password,
-					phone:that.phone,
-					cid:that.clientId
-				}, failres => {
-			           that.$api.msg(failres.errmsg)
-			           uni.hideLoading()
-			    }).then(res => {
-					console.log(res.data)
-					uni.setStorageSync('userInfo', res.data)
-					// console.log(uni.getStorageSync('userInfo'))
-					that.$store.commit('login', res.data)
-					that.liangxinLogin()
-					uni.switchTab({
-						url: '/pages/sale/information'
-					});
-					uni.hideLoading()
-				})
-			},
 			appleLogin(){
 			    var that=this
 			    uni.getProvider({

+ 9 - 1
pages/public/register.vue

@@ -134,6 +134,7 @@
 				var that = this
 				if(/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.phone)){
 					this.$api.doRequest('get','/commonUser/sendVerifyCode',{phone:this.phone}).then(res => {
+						if(res.data.code==200){
 							that.sendDisabled = true
 							let sec = 60
 							let interval = setInterval(() => {
@@ -145,10 +146,17 @@
 									clearInterval(interval)
 								}
 							}, 1000)
+						}else{
+							uni.showToast({
+								title: res.data.message,
+								icon:'none',
+								duration: 2000
+							})
+						}
 					})
 					.catch(res => {
 						uni.showToast({
-							title: res.errmsg,
+							title: res.data.message,
 							icon:'none',
 							duration: 2000
 						})

+ 42 - 157
pages/public/reset.vue

@@ -136,26 +136,54 @@
 				var that = this
 				this.$api.doRequest('post','/commonUser/resetPassword',{phone:this.phone,password:this.password,verifyCode:this.verifyCode}).then(res => {
 				    // 获得数据
-				    console.log(res);
+					if(res.data.code==200){
+						var that=this
+						uni.showLoading({
+							title: '登录中',
+							mask:true
+						})
+						this.$api.doRequest('get','/commonUser/login',{phone:this.phone,password:this.password}).then(req => {
+						if(res.data.code==200){
+							uni.setStorageSync('userInfo', req.data.data)
+							that.$store.commit('login', req.data.data)
+							that.liangxinLogin()
+							uni.switchTab({
+								url: '/pages/sale/information'
+							});
+							uni.hideLoading()
+						}else{
+							uni.showToast({
+								title: res.data.message,
+								icon:'none',
+								duration: 2000
+							})
+						}
+						})
+						.catch(res => {
+						    uni.showToast({
+						    	title: res.data.message,
+						    	icon:'none',
+						    	duration: 2000
+						    })
+						});
+					}else{
+						uni.showToast({
+							title: res.data.message,
+							icon:'none',
+							duration: 2000
+						})
+					}
 					uni.showLoading({
 						title: '登录中',
 						mask:true
 					})
-					this.$api.doRequest('get','/commonUser/login',{phone:this.phone,password:this.password}).then(res => {
-					uni.setStorageSync('userInfo', res.data)
-					// that.$store.commit('login', res.data)
-					that.liangxinLogin()
-					uni.switchTab({
-						url: '/pages/sale/information'
-					});
-					uni.hideLoading()
-					})
-					.catch(res => {
-					    console.log(res);
-					});
 				})
 				.catch(res => {
-				    console.log(res);
+				    uni.showToast({
+				    	title: res.data.message,
+				    	icon:'none',
+				    	duration: 2000
+				    })
 				});
 			},
 			consent(){
@@ -182,154 +210,11 @@
 					url:'/pages/public/reset'
 				})
 			},
-			appleLogin(){
-			    var that=this
-			    uni.getProvider({
-			     service: 'oauth',
-			     success: function (res) {
-			      // console.log(res.provider)
-			      if(~res.provider.indexOf('apple')) {
-			       uni.login({
-			        provider: 'apple',
-			        success: loginRes => {
-			         uni.getUserInfo({
-			          provider: 'apple',
-			          success: userInfoRes => {
-			           
-			          that.$api.request('user', 'thirdPartLogin', {
-			           loginType: 4/*  */,
-			           raw: JSON.stringify(userInfoRes.userInfo)
-			          }, failres => {
-			           that.$api.msg(failres.errmsg)
-			           uni.hideLoading()
-			          }).then(res => {
-			           console.log("thirdPartLogin:"+res.data.phone)
-			           that.accessToken = res.data.accessToken
-			           that.logining = false
-			           uni.getUserInfo({
-			            lang: 'zh_CN',
-			            success: (e) => {
-			             uni.setStorageSync('userInfo', res.data)
-			             that.$store.commit('login', res.data)
-			             e.userInfo.nickname = e.userInfo.nickName
-						 e.userInfo.cid = uni.getStorageSync("clientId")
-			             that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
-			              //同步过后
-			              res.data.nickname = e.userInfo.nickName
-			              res.data.avatarUrl = e.userInfo.avatarUrl
-			              res.data.gender = e.userInfo.gender
-			              
-			              if(!res.data.phone){
-			               res.data.phone = e.userInfo.phone
-			              }
-			              
-			              uni.setStorageSync('userInfo', res.data)
-			              that.$store.commit('login', res.data)
-			             })
-			            },
-			            complete: (e) => {
-			             uni.hideLoading()
-			             
-			             if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
-			              that.isPhone = true//显示自定义的获取手机权限提示框
-			              that.inputStatus = 'inline'
-			              that.inputContent = ''
-			             }
-			             else{
-			              uni.switchTab({
-			               url: '/pages/sale/sale'
-			              });
-			              console.log("complete")
-			             }
-			            }
-			           })
-			           
-			           })
-			           console.log('获取用户信息成功'+JSON.stringify(userInfoRes))
-			          }
-			         })
-			        },
-			        fail: err => {
-			         console.log('apple登录失败' + JSON.stringify(err))
-			         uni.showToast({
-			          title:'登录失败',
-			          icon:'none'
-			         })
-			        }
-			       })
-			      }
-			     },
-			     fail: err => {
-			      uni.showToast({
-			       title:'登录失败',
-			       icon:'none'
-			      })
-			     }
-			    })
-			   },
 			cancel() {
 				this.inputShow = false
 				this.inputStatus = 'none'
 				this.isPhone = false
 			},
-			confirm() {
-				var that = this
-				if (!this.inputContent || this.inputContent.length != 11) {
-					uni.showToast({
-						title:'请输入正确手机号!',
-						icon:'none'
-					})
-					return
-				}
-				if (!this.verifyCode) {
-					uni.showToast({
-						title:'请输入验证码!',
-						icon:'none'
-					})
-					return
-				}
-				this.$api.request('user', 'mergeUser', {
-					phone: that.inputContent,
-					verifyCode:that.verifyCode
-				},failres => {
-					that.$api.msg(failres.errmsg)
-					uni.hideLoading()
-				}).then(res => {
-					that.accessToken = res.data.accessToken
-					that.$api.setUserInfo(res.data)
-					that.logining = false
-					uni.getUserInfo({
-						lang: 'zh_CN',
-						success: (e) => {
-							uni.setStorageSync('userInfo', res.data)
-							that.$store.commit('login', res.data)
-							e.userInfo.nickname = e.userInfo.nickName
-							e.userInfo.cid = uni.getStorageSync("clientId")
-							console.log(e.userInfo)
-							that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
-								//同步过后
-								res.data.nickname = e.userInfo.nickName
-								res.data.avatarUrl = e.userInfo.avatarUrl
-								res.data.gender = e.userInfo.gender
-								res.data.phone = e.userInfo.phone
-								uni.setStorageSync('userInfo', res.data)
-								that.$store.commit('login', res.data)
-								that.liangxinLogin()
-							})
-						},
-						complete: (e) => {
-							uni.switchTab({
-								url: '/pages/sale/information'
-							});
-							uni.hideLoading()
-							that.isPhone=false
-							
-							uni.navigateBack()
-						}
-					})
-				})
-				
-			},
 			...mapMutations(['login']),
 			inputChange(e) {
 				const key = e.currentTarget.dataset.key;