Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
闫晓茹 2023-10-16 14:19:33 +08:00
commit f4fcbdaf46
2 changed files with 44 additions and 18 deletions

View File

@ -25,18 +25,18 @@
return {
phonecode: undefined,
logincode: undefined,
code: undefined,
timer: undefined,
cityCode: '1',
openid: '',
cityCode: null,
// scenenurseStationId: undefined,
};
},
onShow() {
this.getAddress();
let location = uni.getStorageSync('location')
if (!location) {
this.getAddress()
}
this.phonecode = undefined
this.logincode = undefined
this.code = undefined
// this.scenenurseStationId = uni.getStorageSync('scenenurseStationId');
},
methods: {
@ -85,14 +85,10 @@
});
}
},
login() {
let that = this;
// getWeChatUser(that.logincode).then(res => {
// if (res.code == 200) {
isRegistered(that.logincode, that.phonecode).then(resp => {
uni.setStorageSync("openid", resp.data.openid)
that.openid = resp.data.openid
if (resp.data.code == '0') {
that.$refs.uToast.show({
title: '未注册,请先注册',
@ -101,9 +97,7 @@
url: '/pages/register/register',
})
} else if (resp.data.code == '1') {
that.cityCode = '1'
console.log(that.openid)
getCurrentUser(that.openid, that.cityCode).then(res => {
getCurrentUser(resp.data.openid, resp.data.cityCode).then(res => {
if (res.code == 200) {
that.$refs.uToast.show({
title: '登录成功',
@ -112,10 +106,10 @@
})
uni.setStorageSync('patientId', res.data.id);
uni.setStorageSync('userinfo', res.data);
if (this.timer) {
clearTimeout(this.timer)
if (that.timer) {
clearTimeout(that.timer)
}
this.timer = setTimeout(e => {
that.timer = setTimeout(e => {
uni.navigateBack({
delta: 1
})
@ -130,12 +124,10 @@
})
}
})
},
pwdlogin() {
var that = this
uni.clearStorageSync();
that.login()
// createMobileToken().then(res => {
// uni.setStorageSync("token", res.data.token)

View File

@ -42,6 +42,7 @@
},
onShow() {
var that = this
this.getAddress();
createMobileToken().then(res => {
uni.setStorageSync("token", res.data.token)
})
@ -51,7 +52,40 @@
});
}, 2000);
},
methods: {},
methods: {
//
getAddress() {
let that = this;
uni.getLocation({
type: 'wgs84',
success: (res) => {
let location = res.latitude + ',' + res.longitude
//
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=location', //
data: {
location: location,
'key': "Q4DBZ-UIMC2-B63UX-CUZ6A-S3UT7-TBF3V", //Key
},
method: "GET",
success(res) {
uni.setStorageSync('location', res.data.result.address_component.city)
},
fail: res => {
console.log(res.errMsg, '解析失败返回的错误信息');
}
})
},
//
fail: (res) => {
uni.showToast({
icon: 'none',
title: '获取地址失败,请打开定位',
})
}
})
},
},
}
</script>