diff --git a/epdc-resident-mp-yushan/subpages/family/pages/bindFamily/bindFamily.js b/epdc-resident-mp-yushan/subpages/family/pages/bindFamily/bindFamily.js index e8c744f..8a9ce80 100644 --- a/epdc-resident-mp-yushan/subpages/family/pages/bindFamily/bindFamily.js +++ b/epdc-resident-mp-yushan/subpages/family/pages/bindFamily/bindFamily.js @@ -44,6 +44,7 @@ Page({ houseInfo: {}, // 通过roomCode获取的房屋信息 inputDisabled: false, // 输入身份证号,查询到信息的话,禁止修改 selectBuildingId: '', // 选择的楼栋id + userState: '' }, /** @@ -58,14 +59,6 @@ Page({ }) } this.getUserState() - this.checkWxUnionId() - this.getWxCode() - wx.hideToast() - if (!this.data.roomCode) { - this.getPersonalInfo().then(res => { - this.getVillageList() - }) - } }, getVillageList () { const params = { @@ -187,11 +180,22 @@ Page({ if (res.code) { let code = res.code api.getToken(code).then(res => { - const state = res.data.userState - app.globalData.infoCompleted = state - wx.setStorageSync('topGridName', res.data.grid) - wx.setStorageSync('token', res.data.token) - _this.getUserInfoById() + _this.data.userState = res.data.userState + if (_this.data.userState == '4') { + _this.getHouseInfo() + } else { + wx.setStorageSync('topGridName', res.data.grid) + wx.setStorageSync('token', res.data.token) + _this.getUserInfoById() + _this.checkWxUnionId() + _this.getWxCode() + if (!_this.data.roomCode) { + _this.getPersonalInfo().then(res => { + _this.getVillageList() + }) + } + } + wx.hideToast() }) } else { console.log('登录失败' + res.errMsg) @@ -199,6 +203,29 @@ Page({ } }) }, + getTokenByGridId () { + let that = this + wx.login({ + success(res) { + if (res.code) { + console.log('微信CODE: ' + res.code) + let wxCode = res.code + const para = { + inviteUserId: '', + gridId: that.data.houseInfo.gridId, + wxCode: wxCode + } + api.getTokenV3(para).then(function (res) { + wx.removeStorageSync('token') + wx.setStorageSync('token', res.data.token) + if (that.data.userState == '4') { + that.getUserState() + } + }) + } + } + }) + }, // 获取用户信息 getUserInfoById () { api.getUserInfo().then(res => { @@ -222,11 +249,14 @@ Page({ roomCode: this.data.roomCode } api.getHouseInfo(params).then(res => { - console.log(res.data) + console.log('getHouseInfo: ', res.data) if (res.code == 0) { this.setData({ houseInfo: res.data }) + if (this.data.userState == '4') { + this.getTokenByGridId() + } } }) }, @@ -493,7 +523,7 @@ Page({ return false } if (!this.data.fmData.road) { - this.showToast('请填写所在街道') + this.showToast('请填写路牌号') return false } // if (!this.data.fmData.smsCode) { @@ -545,7 +575,7 @@ Page({ return false } if (!this.data.fmData.road) { - this.showToast('请填写所在街道') + this.showToast('请填写路牌号') return false } const para = { @@ -584,7 +614,7 @@ Page({ return } if (!this.data.fmData.road) { - this.showToast('请填写所在街道') + this.showToast('请填写路牌号') return false } const houseAddress = this.data.houseInfo.gridName + '-' @@ -597,6 +627,7 @@ Page({ unitId: this.data.houseInfo.id, userName: this.data.fmData.realName, idCard: this.data.fmData.identityNo, + gender: this.data.fmData.sex, mobile: this.data.fmData.mobile, houseAddress: houseAddress, community: this.data.houseInfo.communityName, diff --git a/epdc-resident-mp-yushan/subpages/family/pages/familyInfo/familyInfo.json b/epdc-resident-mp-yushan/subpages/family/pages/familyInfo/familyInfo.json index 8835af0..346ad6d 100644 --- a/epdc-resident-mp-yushan/subpages/family/pages/familyInfo/familyInfo.json +++ b/epdc-resident-mp-yushan/subpages/family/pages/familyInfo/familyInfo.json @@ -1,3 +1,4 @@ { + "navigationBarTitleText": "详细信息", "usingComponents": {} } \ No newline at end of file diff --git a/epdc-resident-mp-yushan/subpages/family/pages/index/index.json b/epdc-resident-mp-yushan/subpages/family/pages/index/index.json index 8835af0..94b31bc 100644 --- a/epdc-resident-mp-yushan/subpages/family/pages/index/index.json +++ b/epdc-resident-mp-yushan/subpages/family/pages/index/index.json @@ -1,3 +1,4 @@ { + "navigationBarTitleText": "我的家庭", "usingComponents": {} } \ No newline at end of file diff --git a/epdc-resident-mp-yushan/subpages/family/pages/noAccess/noAccess.json b/epdc-resident-mp-yushan/subpages/family/pages/noAccess/noAccess.json index 8835af0..94b31bc 100644 --- a/epdc-resident-mp-yushan/subpages/family/pages/noAccess/noAccess.json +++ b/epdc-resident-mp-yushan/subpages/family/pages/noAccess/noAccess.json @@ -1,3 +1,4 @@ { + "navigationBarTitleText": "我的家庭", "usingComponents": {} } \ No newline at end of file