xg
This commit is contained in:
parent
99e84d6617
commit
28e6df56ab
@ -60,7 +60,6 @@
|
||||
data() {
|
||||
return {
|
||||
phonecode: undefined,
|
||||
logincode: undefined,
|
||||
timer: undefined,
|
||||
cityCode: null,
|
||||
SOCKETURL: '',
|
||||
@ -74,14 +73,6 @@
|
||||
this.getAddress()
|
||||
}
|
||||
this.phonecode = undefined
|
||||
this.logincode = undefined
|
||||
let that = this
|
||||
wx.login({
|
||||
provider: 'weixin',
|
||||
success: function(loginRes) {
|
||||
that.logincode = loginRes.code
|
||||
}
|
||||
});
|
||||
// this.scenenurseStationId = uni.getStorageSync('scenenurseStationId');
|
||||
},
|
||||
methods: {
|
||||
@ -153,51 +144,54 @@
|
||||
}
|
||||
},
|
||||
login() {
|
||||
let that = this;
|
||||
wx.login({
|
||||
provider: 'weixin',
|
||||
success: function(loginRes) {
|
||||
that.logincode = loginRes.code
|
||||
}
|
||||
});
|
||||
let that = this;
|
||||
// console.log(that.logincode, that.phonecode)
|
||||
isRegistered(that.logincode, that.phonecode).then(resp => {
|
||||
if (resp.data.openid && resp.data.phone) {
|
||||
uni.setStorageSync("openid", resp.data.openid)
|
||||
uni.setStorageSync("phone", resp.data.phone)
|
||||
}
|
||||
if (resp.data.code == '0') {
|
||||
that.$refs.uToast.show({
|
||||
title: '未注册,请先注册',
|
||||
type: 'error',
|
||||
duration: '1500',
|
||||
})
|
||||
if (that.timer) {
|
||||
learTimeout(that.timer)
|
||||
}
|
||||
that.timer = setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/register/register',
|
||||
})
|
||||
}, 1500)
|
||||
} else if (resp.data.code == '2') {
|
||||
that.$refs.uToast.show({
|
||||
title: '已被其他人注册',
|
||||
type: 'error',
|
||||
duration: '1500',
|
||||
})
|
||||
} else if (resp.data.code == '1') {
|
||||
getCurrentUser(resp.data.openid).then(res => {
|
||||
if (res.code == 200) {
|
||||
if (res.data) {
|
||||
uni.setStorageSync('patientId', res.data.id);
|
||||
uni.setStorageSync('userinfo', res.data);
|
||||
that.scoket();
|
||||
}
|
||||
isRegistered(loginRes.code, that.phonecode).then(resp => {
|
||||
if (resp.data.openid && resp.data.phone) {
|
||||
uni.setStorageSync("openid", resp.data.openid)
|
||||
uni.setStorageSync("phone", resp.data.phone)
|
||||
}
|
||||
if (resp.data.code == '0') {
|
||||
that.$refs.uToast.show({
|
||||
title: '登录成功',
|
||||
type: 'success',
|
||||
back: 1
|
||||
title: '未注册,请先注册',
|
||||
type: 'error',
|
||||
duration: '1500',
|
||||
})
|
||||
if (that.timer) {
|
||||
learTimeout(that.timer)
|
||||
}
|
||||
that.timer = setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/register/register',
|
||||
})
|
||||
}, 1500)
|
||||
} else if (resp.data.code == '2') {
|
||||
that.$refs.uToast.show({
|
||||
title: '已被其他人注册',
|
||||
type: 'error',
|
||||
duration: '1500',
|
||||
})
|
||||
} else if (resp.data.code == '1') {
|
||||
getCurrentUser(resp.data.openid).then(res => {
|
||||
if (res.code == 200) {
|
||||
if (res.data) {
|
||||
uni.setStorageSync('patientId', res.data.id);
|
||||
uni.setStorageSync('userinfo', res.data);
|
||||
that.scoket();
|
||||
}
|
||||
that.$refs.uToast.show({
|
||||
title: '登录成功',
|
||||
type: 'success',
|
||||
back: 1
|
||||
})
|
||||
} else {
|
||||
that.$refs.uToast.show({
|
||||
title: '登录失败',
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
that.$refs.uToast.show({
|
||||
@ -207,7 +201,7 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
pwdlogin() {
|
||||
var that = this
|
||||
|
||||
Loading…
Reference in New Issue
Block a user