|
@@ -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;
|