diff --git a/pages/homepage/homepage.vue b/pages/homepage/homepage.vue index 0d0d32d..057d90c 100644 --- a/pages/homepage/homepage.vue +++ b/pages/homepage/homepage.vue @@ -4,7 +4,7 @@ - {{patientName}} + {{patientName}},你好 你好,请登录 @@ -75,7 +75,7 @@ data() { return { patientName: '', - userinfo: {}, + userinfo: null, region: '', checkSign: null, } @@ -88,7 +88,7 @@ this.userinfo = uni.getStorageSync('userinfo'); this.patientName = this.userinfo.patientName if (this.userinfo) { - checkSignApply(this.userinfo.cardNo, '1').then(res => { + checkSignApply(this.userinfo.cardNo).then(res => { if (res.code != 0) { this.checkSign = true } else { @@ -114,6 +114,7 @@ }, // 家医签约 goonline() { + console.log(!this.userinfo) if (!this.userinfo) { this.gologin(); } else { @@ -133,25 +134,22 @@ }, // 积分兑换 count() { - uni.navigateTo({ - url: '/pagesB/Behaviorpoints/Behaviorpoints' - }) - // if (!this.userinfo) { - // this.gologin(); - // } else { - // if (!this.checkSign) { - // this.$refs.uToast.show({ - // title: '未签约,请先签约', - // type: 'error', - // duration: '1000', - // url: "/pagesC/Onlinesigning/Onlinesigning" - // }) - // } else { - // uni.navigateTo({ - // url: "/pagesB/PointsMall/PointsMall" - // }) - // } - // } + if (!this.userinfo) { + this.gologin(); + } else { + if (!this.checkSign) { + this.$refs.uToast.show({ + title: '未签约,请先签约', + type: 'error', + duration: '1000', + url: "/pagesC/Onlinesigning/Onlinesigning" + }) + } else { + uni.navigateTo({ + url: '/pagesB/Behaviorpoints/Behaviorpoints' + }) + } + } }, // 健康档案 goHealthrecords() { diff --git a/pages/login/login.vue b/pages/login/login.vue index 8e28e81..abe5a53 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -28,17 +28,50 @@ code: undefined, timer: undefined, cityCode: '1', - openid:'', + openid: '', // scenenurseStationId: undefined, }; }, onShow() { + this.getAddress(); this.phonecode = undefined this.logincode = undefined this.code = undefined // this.scenenurseStationId = uni.getStorageSync('scenenurseStationId'); }, 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: '获取地址失败,请打开定位', + }) + } + }) + }, getPhoneNumberp(val) { let that = this; if (val.detail.code) { @@ -58,8 +91,8 @@ // 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 + uni.setStorageSync("openid", resp.data.openid) + that.openid = resp.data.openid if (resp.data.code == '0') { that.$refs.uToast.show({ title: '未注册,请先注册', @@ -87,8 +120,7 @@ delta: 1 }) }, 500) - } - else { + } else { that.$refs.uToast.show({ title: '登录失败', type: 'error', diff --git a/pages/medicalservice/medicalservice.vue b/pages/medicalservice/medicalservice.vue index 47d00fd..e709567 100644 --- a/pages/medicalservice/medicalservice.vue +++ b/pages/medicalservice/medicalservice.vue @@ -3,7 +3,7 @@ - 济南市 + {{location?location:''}} @@ -61,12 +61,14 @@ informationCategoryVOList: [], //咨询信息 patientId: '', userInfo: null, + location: null, }; }, onShow() { this.pageNum = 1 this.patientId = uni.getStorageSync('patientId'); this.userInfo = uni.getStorageSync('userinfo') + this.location = uni.getStorageSync('location') this.getHeathHousing(); }, methods: { @@ -92,7 +94,7 @@ getScreening(this.patientId).then(res => { if (res.code == 200) { let userinfo = JSON.stringify(this.userInfo) - if (!res.data||res.data==null) { + if (!res.data || res.data == null) { uni.navigateTo({ url: `/pagesB/screenorder/screenorder?userinfo=${userinfo}` }) @@ -122,7 +124,7 @@ getHeathHousingList(this.pageNum, this.pageSize).then(res => { if (res.rows) { res.rows.forEach(e => { - e.leadThumbnailUrl = baseurl+ e.leadThumbnailUrl + e.leadThumbnailUrl = baseurl + e.leadThumbnailUrl }) } this.informationCategoryVOList = res.rows @@ -203,4 +205,4 @@ + \ No newline at end of file