mirror of
http://36.133.248.69:3088/admin/RentWeAppFront.git
synced 2026-06-07 06:22:27 +08:00
优化,完善代码
This commit is contained in:
@@ -3,9 +3,6 @@
|
||||
<!-- 顶部自定义导航栏 -->
|
||||
<customNavbar title="我的租赁资产" />
|
||||
|
||||
<!-- 筛选栏 -->
|
||||
|
||||
|
||||
<!-- 租赁资产列表组件 -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
@@ -16,6 +13,9 @@
|
||||
:list="assetList"
|
||||
@click="goDetail"
|
||||
/>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<u-loadmore :status="loadStatus" />
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -24,60 +24,57 @@
|
||||
import AssetList from '@/components/asset/assetList.vue'
|
||||
export default {
|
||||
name: 'MyLease',
|
||||
components: { AssetList},
|
||||
components: { AssetList },
|
||||
data() {
|
||||
return {
|
||||
assetList: [],
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
loadStatus: 'loadmore',
|
||||
loadStatus: 'more', // ✅ 修复为官方正确值
|
||||
cusNo: ''
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.cusNo = options.cusNo;
|
||||
this.cusNo = options.cusNo;
|
||||
this.loadAssets();
|
||||
},
|
||||
onShow() {
|
||||
this.$checkToken(this.$getToken())
|
||||
this.$checkToken(this.$getToken())
|
||||
},
|
||||
staticHost() {
|
||||
return this.$config.staticUrl
|
||||
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
||||
computed: {
|
||||
staticHost() {
|
||||
return this.$config.staticUrl
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeFilter(value) {
|
||||
if (this.currentFilter === value) return;
|
||||
this.currentFilter = value;
|
||||
this.pageNo = 1;
|
||||
this.assetList = [];
|
||||
this.loadAssets();
|
||||
},
|
||||
|
||||
loadAssets() {
|
||||
if (this.loadStatus !== 'loadmore') return;
|
||||
this.loadStatus = 'loading';
|
||||
|
||||
this.$u.post('/assets/getMyAssetsList', {
|
||||
pageNo: this.pageNo,
|
||||
pageSize: this.pageSize
|
||||
},{
|
||||
WT: this.$getToken()
|
||||
}).then(res => {
|
||||
const rows = res.data.result || [];
|
||||
|
||||
if (this.pageNo === 1) this.assetList = [];
|
||||
|
||||
this.assetList = this.assetList.concat(rows);
|
||||
|
||||
if (rows.length < this.pageSize) {
|
||||
this.loadStatus = 'nomore';
|
||||
} else {
|
||||
this.pageNo++;
|
||||
this.loadStatus = 'loadmore';
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
this.loadStatus = 'loadmore';
|
||||
});
|
||||
// ✅ 正确判断加载状态
|
||||
if (this.loadStatus !== 'more') return;
|
||||
this.loadStatus = 'loading';
|
||||
|
||||
this.$u.post('/assets/getMyAssetsList', {
|
||||
pageNo: this.pageNo,
|
||||
pageSize: this.pageSize
|
||||
}, {
|
||||
WT: this.$getToken()
|
||||
}).then(res => {
|
||||
const rows = res.data.result || [];
|
||||
if (this.pageNo === 1) this.assetList = [];
|
||||
|
||||
this.assetList = this.assetList.concat(rows);
|
||||
|
||||
// ✅ 判断是否还有更多数据
|
||||
if (rows.length < this.pageSize) {
|
||||
this.loadStatus = 'nomore';
|
||||
} else {
|
||||
this.pageNo++;
|
||||
this.loadStatus = 'more';
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
this.loadStatus = 'more'; // ✅ 异常恢复
|
||||
});
|
||||
},
|
||||
|
||||
loadMore() {
|
||||
@@ -97,33 +94,15 @@ export default {
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
min-height: 100vh;
|
||||
background: #f7f8fa;
|
||||
padding-top: 175rpx;
|
||||
}
|
||||
|
||||
.filter-bar {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
padding: 20rpx 0;
|
||||
margin-top: var(--custom-navbar-height);
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.filter-btn {
|
||||
min-width: 150rpx;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border-radius: 40rpx;
|
||||
margin: 0 8rpx;
|
||||
}
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.scroll-content {
|
||||
flex: 1;
|
||||
height: calc(100vh - 200rpx);
|
||||
height: calc(100vh - 175rpx); /* ✅ 正确高度,不超出屏幕 */
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user