优化代码

This commit is contained in:
java110 2021-11-26 23:38:55 +08:00
parent 3be4cabb9d
commit 783d6b0aa3
4 changed files with 106 additions and 3 deletions

View File

@ -104,3 +104,28 @@ export function recoveryCommunityInfo(_obj){
}) })
} }
/**
* 查询业主小区
* @param {Object} dataObj 对象
*/
export function getOwnerCommunitys(dataObj) {
return new Promise(
(resolve, reject) => {
request({
url: url.listCommunitys,
method: "GET",
data: dataObj,
//动态数据
success: function(res) {
if (res.statusCode == 200) {
let _communtiys = res.data.communitys;
resolve(_communitys);
}
},
fail: function(e) {
reject(e);
}
});
})
}

View File

@ -611,6 +611,15 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
} }
,{
"path" : "pages/changeOwnerCommunity/changeOwnerCommunity",
"style" :
{
"navigationBarTitleText": "切换小区",
"enablePullDownRefresh": false
}
}
], ],
"tabBar": { "tabBar": {
"color": "#272636", "color": "#272636",

View File

@ -0,0 +1,60 @@
<template>
<view>
<view>
<view class="padding">小区信息</view>
<view class="cu-list menu ">
<view class="cu-item" v-for="(item,sub) in communitys" :key="sub" @tap="_doChangeCommunity(item)">
<view class="content padding-tb-sm">
<view>
<text class="lg cuIcon-homefill text-blue margin-right-xs"></text> {{item.name}}
</view>
<view class="text-gray text-sm">
<text class="lg text-gray cuIcon-location margin-right-xs"></text> {{item.address}}
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {getOwnerCommunitys} from '../../api/community/communityApi.js'
export default {
data() {
return {
communityName: '',
communitys: []
}
},
onLoad() {
this._loadCommunitys();
},
methods: {
_loadCommunitys: function() {
let _that = this;
let _condition = {
name: this.communityName
}
getOwnerCommunitys()
.then(_communitys => {
_that.communitys = _communitys;
});
},
_doChangeCommunity: function(_community) {
uni.setStorageSync(mapping.CURRENT_COMMUNITY_INFO, JSON.stringify(_community));
uni.navigateBack({
delta: 1
})
}
}
}
</script>
<style>
</style>

View File

@ -24,10 +24,13 @@
</view> </view>
<view class="cu-list menu margin-top"> <view class="cu-list menu margin-top">
<view class="cu-item arrow" @click="myAssets()"> <view class="cu-item arrow" @tap="_changeCommunity()">
<view class="content"> <view class="content">
<text class="cuIcon-profile text-pink"></text> <text class="cuIcon-circlefill text-yellow"></text>
<text class="text-grey">我的小区</text> <text class="text-grey">切换小区</text>
</view>
<view class="action">
<text class="text-grey text-sm">{{currentCommunityName}}</text>
</view> </view>
</view> </view>
<view class="cu-item arrow" @click="myAssets()"> <view class="cu-item arrow" @click="myAssets()">
@ -237,6 +240,12 @@
url: '/pages/myAccount/myAccount', url: '/pages/myAccount/myAccount',
}); });
}, },
//
_changeCommunity:function(){
uni.navigateTo({
url:"/pages/changeOwnerCommunity/changeOwnerCommunity"
});
},
} }
}; };
</script> </script>