优化代码

This commit is contained in:
wuxw 2021-11-27 13:21:45 +08:00
parent 853f8a37fb
commit 62c571eb26
4 changed files with 50 additions and 1 deletions

View File

@ -198,3 +198,35 @@ export function deleteOwnerMember(_data){
}); });
}) })
} }
/**
* 判断是否存在业主
*
*/
export function hasOwner(){
let _ownerInfo = wx.getStorageSync(mapping.OWNER_INFO);
if(_ownerInfo){
uni.showToast({
icon:'none',
title:'未查询到业主房产'
})
throw new Error('业主不存在');
}
let _memberId = _ownerInfo.memberId;
if(!_memberId){
uni.showToast({
icon:'none',
title:'未查询到业主房产'
})
throw new Error('业主不存在');
}
if(_memberId != '-1'){
uni.showToast({
icon:'none',
title:'未查询到业主房产'
})
throw new Error('业主不存在');
}
}

View File

@ -3,7 +3,7 @@
<view> <view>
<view class="padding">小区信息</view> <view class="padding">小区信息</view>
<view class="cu-list menu "> <view class="cu-list menu " v-if="communitys.length>0">
<view class="cu-item" v-for="(item,sub) in communitys" :key="sub" @tap="_doChangeCommunity(item)"> <view class="cu-item" v-for="(item,sub) in communitys" :key="sub" @tap="_doChangeCommunity(item)">
<view class="content padding-tb-sm"> <view class="content padding-tb-sm">
<view> <view>
@ -15,6 +15,18 @@
</view> </view>
</view> </view>
</view> </view>
<block v-else>
<view class="cu-list menu">
<view class="cu-item">
<view class="content">
<text class="cuIcon-notification text-grey"></text>
<text class="text-grey">暂无小区信息</text>
</view>
<view class="action">
</view>
</view>
</view>
</block>
</view> </view>
</view> </view>

View File

@ -92,6 +92,8 @@
import {getCurOwner} from '../../api/owner/ownerApi.js' import {getCurOwner} from '../../api/owner/ownerApi.js'
import {hasLogin} from '../../auth/Java110Auth.js' import {hasLogin} from '../../auth/Java110Auth.js'
import {hasOwner} from '../../api/owner/ownerApi.js'
export default { export default {
data() { data() {
return { return {
@ -304,6 +306,7 @@
this._loadActivites(); this._loadActivites();
}, },
toPage: function(pageUrl) { toPage: function(pageUrl) {
hasOwner();
this.vc.navigateTo({ this.vc.navigateTo({
url: pageUrl url: pageUrl
}); });

View File

@ -130,6 +130,7 @@
_that.login = true; _that.login = true;
_that.loadOwenrInfo(); _that.loadOwenrInfo();
_that.userInfo = context.getUserInfo(); _that.userInfo = context.getUserInfo();
console.log('用户信息',_that.userInfo)
this.loadOwnerHeaderImg(); this.loadOwnerHeaderImg();
}, },
bindingOwner: function() { bindingOwner: function() {
@ -151,6 +152,7 @@
loadOwnerHeaderImg: function() { loadOwnerHeaderImg: function() {
let _that = this; let _that = this;
context.getOwner(function(_owner) { context.getOwner(function(_owner) {
let _headerImg = constant.url.getOwnerPhotoPath + "?objId=" + _owner.memberId + let _headerImg = constant.url.getOwnerPhotoPath + "?objId=" + _owner.memberId +
"&communityId=" + _owner.communityId + "&communityId=" + _owner.communityId +
"&fileTypeCd=10000"; "&fileTypeCd=10000";