This commit is contained in:
2024-01-24 08:53:20 +08:00
parent 99e84d6617
commit 28e6df56ab

View File

@ -60,7 +60,6 @@
data() { data() {
return { return {
phonecode: undefined, phonecode: undefined,
logincode: undefined,
timer: undefined, timer: undefined,
cityCode: null, cityCode: null,
SOCKETURL: '', SOCKETURL: '',
@ -74,14 +73,6 @@
this.getAddress() this.getAddress()
} }
this.phonecode = undefined 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'); // this.scenenurseStationId = uni.getStorageSync('scenenurseStationId');
}, },
methods: { methods: {
@ -153,15 +144,11 @@
} }
}, },
login() { login() {
let that = this;
wx.login({ wx.login({
provider: 'weixin', provider: 'weixin',
success: function(loginRes) { success: function(loginRes) {
that.logincode = loginRes.code isRegistered(loginRes.code, that.phonecode).then(resp => {
}
});
let that = this;
// console.log(that.logincode, that.phonecode)
isRegistered(that.logincode, that.phonecode).then(resp => {
if (resp.data.openid && resp.data.phone) { if (resp.data.openid && resp.data.phone) {
uni.setStorageSync("openid", resp.data.openid) uni.setStorageSync("openid", resp.data.openid)
uni.setStorageSync("phone", resp.data.phone) uni.setStorageSync("phone", resp.data.phone)
@ -206,8 +193,15 @@
}) })
} }
}) })
} else {
that.$refs.uToast.show({
title: '登录失败',
type: 'error',
})
} }
}) })
}
});
}, },
pwdlogin() { pwdlogin() {
var that = this var that = this