赵毅 f697ec362c fix(workOrderDashboard): 修复图片URL处理逻辑并优化钱包页面代码
修复社区列表图片URL处理逻辑,当pic为空时返回空字符串而非拼接无效URL。优化钱包页面代码格式,调整onLoad和onShow生命周期方法顺序,保持代码逻辑清晰。
2025-11-01 09:54:46 +08:00

89 lines
2.3 KiB
Vue

<template>
<view class="container">
<view class="empty" v-if="communityList.length == 0">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_newEmpty.png"
alt="" />
暂无数据
</view>
<div class="communityList">
<div class="communityItem" v-for="item in communityList" :key="item.community_id"
@click="choseCommunity(item)">
<div class="communityItem_left">
<div class="communityItem_left_img">
<image :src="item.pic" mode="aspectFill"></image>
</div>
<div class="communityItem_left_msg">
<div class="communityItem_left_msg_tit">{{ item.name }}</div>
<div class="communityItem_left_msg_msg">{{ item.addr }}</div>
</div>
</div>
<div class="communityItem_right">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"
v-if="item.community_id != currentCommunity.id"></image>
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png"
v-if="item.community_id == currentCommunity.id"></image>
</div>
</div>
</div>
<!-- <div class="addBtn" @click="addCommunity">添加我的房产</div> -->
</view>
</template>
<script>
import {
request,
NavgateTo,
isPhone,
picUrl
} from '../../../utils';
import {
apiArr
} from '../../../api/community';
export default {
data() {
return {
communityList: [],
page_num: 1,
page_size: 10,
currentCommunity: {}
}
},
methods: {
addCommunity() {
NavgateTo("/packages/community/addCommunity/index")
},
async getList() {
await request(apiArr.workCommunityList, "POST", {
user_id: uni.getStorageSync('userId'),
}).then(res => {
res.rows.forEach(item => {
item.pic = item.pic ? (item.pic.startsWith('http') ? item.pic : picUrl + item.pic) : ''
});
this.communityList = res.rows
})
},
choseCommunity(e) {
this.currentCommunity = e
uni.setStorageSync('changeWorkOrderData', { id: e.community_id, name: e.name });
uni.setStorageSync('currentCommunityAddr',e.addr);
NavgateTo("1")
},
},
onLoad(options) {
this.currentCommunity = uni.getStorageSync('changeWorkOrderData')
console.log(this.currentCommunity, 'currentCommunity');
this.getList();
},
onReachBottom() { },
}
</script>
<style>
@import url("./index.css");
</style>