Browse Source

优化

release
ZhaoTongYao 3 years ago
parent
commit
9ea589fe85
  1. 65
      epdc-resident-mp-yushan/subpages/family/pages/bindFamily/bindFamily.js
  2. 1
      epdc-resident-mp-yushan/subpages/family/pages/familyInfo/familyInfo.json
  3. 1
      epdc-resident-mp-yushan/subpages/family/pages/index/index.json
  4. 1
      epdc-resident-mp-yushan/subpages/family/pages/noAccess/noAccess.json

65
epdc-resident-mp-yushan/subpages/family/pages/bindFamily/bindFamily.js

@ -44,6 +44,7 @@ Page({
houseInfo: {}, // 通过roomCode获取的房屋信息 houseInfo: {}, // 通过roomCode获取的房屋信息
inputDisabled: false, // 输入身份证号,查询到信息的话,禁止修改 inputDisabled: false, // 输入身份证号,查询到信息的话,禁止修改
selectBuildingId: '', // 选择的楼栋id selectBuildingId: '', // 选择的楼栋id
userState: ''
}, },
/** /**
@ -58,14 +59,6 @@ Page({
}) })
} }
this.getUserState() this.getUserState()
this.checkWxUnionId()
this.getWxCode()
wx.hideToast()
if (!this.data.roomCode) {
this.getPersonalInfo().then(res => {
this.getVillageList()
})
}
}, },
getVillageList () { getVillageList () {
const params = { const params = {
@ -187,11 +180,22 @@ Page({
if (res.code) { if (res.code) {
let code = res.code let code = res.code
api.getToken(code).then(res => { api.getToken(code).then(res => {
const state = res.data.userState _this.data.userState = res.data.userState
app.globalData.infoCompleted = state if (_this.data.userState == '4') {
wx.setStorageSync('topGridName', res.data.grid) _this.getHouseInfo()
wx.setStorageSync('token', res.data.token) } else {
_this.getUserInfoById() 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 { } else {
console.log('登录失败' + res.errMsg) 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 () { getUserInfoById () {
api.getUserInfo().then(res => { api.getUserInfo().then(res => {
@ -222,11 +249,14 @@ Page({
roomCode: this.data.roomCode roomCode: this.data.roomCode
} }
api.getHouseInfo(params).then(res => { api.getHouseInfo(params).then(res => {
console.log(res.data) console.log('getHouseInfo: ', res.data)
if (res.code == 0) { if (res.code == 0) {
this.setData({ this.setData({
houseInfo: res.data houseInfo: res.data
}) })
if (this.data.userState == '4') {
this.getTokenByGridId()
}
} }
}) })
}, },
@ -493,7 +523,7 @@ Page({
return false return false
} }
if (!this.data.fmData.road) { if (!this.data.fmData.road) {
this.showToast('请填写所在街道') this.showToast('请填写路牌号')
return false return false
} }
// if (!this.data.fmData.smsCode) { // if (!this.data.fmData.smsCode) {
@ -545,7 +575,7 @@ Page({
return false return false
} }
if (!this.data.fmData.road) { if (!this.data.fmData.road) {
this.showToast('请填写所在街道') this.showToast('请填写路牌号')
return false return false
} }
const para = { const para = {
@ -584,7 +614,7 @@ Page({
return return
} }
if (!this.data.fmData.road) { if (!this.data.fmData.road) {
this.showToast('请填写所在街道') this.showToast('请填写路牌号')
return false return false
} }
const houseAddress = this.data.houseInfo.gridName + '-' const houseAddress = this.data.houseInfo.gridName + '-'
@ -597,6 +627,7 @@ Page({
unitId: this.data.houseInfo.id, unitId: this.data.houseInfo.id,
userName: this.data.fmData.realName, userName: this.data.fmData.realName,
idCard: this.data.fmData.identityNo, idCard: this.data.fmData.identityNo,
gender: this.data.fmData.sex,
mobile: this.data.fmData.mobile, mobile: this.data.fmData.mobile,
houseAddress: houseAddress, houseAddress: houseAddress,
community: this.data.houseInfo.communityName, community: this.data.houseInfo.communityName,

1
epdc-resident-mp-yushan/subpages/family/pages/familyInfo/familyInfo.json

@ -1,3 +1,4 @@
{ {
"navigationBarTitleText": "详细信息",
"usingComponents": {} "usingComponents": {}
} }

1
epdc-resident-mp-yushan/subpages/family/pages/index/index.json

@ -1,3 +1,4 @@
{ {
"navigationBarTitleText": "我的家庭",
"usingComponents": {} "usingComponents": {}
} }

1
epdc-resident-mp-yushan/subpages/family/pages/noAccess/noAccess.json

@ -1,3 +1,4 @@
{ {
"navigationBarTitleText": "我的家庭",
"usingComponents": {} "usingComponents": {}
} }
Loading…
Cancel
Save