下拉刷新即重置:收藏和足迹页面

This commit is contained in:
wangzimeng 2025-07-24 18:26:59 +08:00
parent 56d82c1b8b
commit 1cacadcfe4
2 changed files with 142 additions and 149 deletions

View File

@ -159,6 +159,7 @@
const collectSchoolList = ref([])
const schoolCount = ref(0)
const homrS = ref(false)
const loadStatus = ref('')
//tabs
function onChange(e) {
console.log('onChange', e);
@ -186,7 +187,7 @@
console.log('招租收藏列表', res);
if (res.code == 1) {
collectRentList.value =[...collectRentList.value,...res.data.list];
collectRentList.value = [...collectRentList.value, ...res.data.list];
rentCount.value = res.data.count
} else {
// Handle case where data is not in expected format
@ -212,7 +213,7 @@
console.log('平台课程收藏列表', res);
if (res.code == 1) {
collectSchoolList.value =[...collectSchoolList.value,...res.data.list];
collectSchoolList.value = [...collectSchoolList.value, ...res.data.list];
schoolCount.value = res.data.count
} else {
// Handle case where data is not in expected format
@ -229,20 +230,46 @@
function onScrolltolower() {
if (currentTab.value == 0) {
if (collectRentList.value.length < rentCount.value) {
listQuery.value.rentPage+=1;
listQuery.value.rentPage += 1;
getRentList();
}
} else {
if (collectSchoolList.value.length < schoolCount.value) {
listQuery.value.schoolPage+=1;
listQuery.value.schoolPage += 1;
getSchoolList();
}
}
}
//
function onS() {
homrS.value = true
uni.showLoading({
title: '加载中...'
});
resetLists();
if(currentTab.value == 0){
getRentList();
}else {
getSchoolList();
}
setTimeout(() => {
homrS.value = false;
uni.hideLoading();
uni.stopPullDownRefresh();
}, 2000)
}
//
function resetLists() {
if (currentTab.value == 0) {
listQuery.value.rentPage = 1;
collectRentList.value = [];
loadStatus.value = "loading";
} else {
listQuery.value.schoolPage = 1;
collectSchoolList.value = [];
loadStatus.value = "loading";
}
}
onReachBottom(() => {});

View File

@ -1,83 +1,66 @@
<template>
<s-layout title="我的足迹" :bgStyle="{ color: '#f2f2f2' }">
<view class="cart-box ss-flex ss-flex-col ss-row-between">
<!-- 头部 -->
<!-- <view class="cart-header ss-flex ss-col-center ss-row-between ss-p-x-30">
<view class="header-left ss-flex ss-col-center ss-font-26">
<text class="goods-number ui-TC-Main ss-flex">
{{ state.pagination.total }}
</text>
件商品
</view>
<view class="header-right">
<button
v-if="state.editMode && state.pagination.total"
class="ss-reset-button"
@tap="state.editMode = false"
>
取消
</button>
<button
v-if="!state.editMode && state.pagination.total"
class="ss-reset-button ui-TC-Main"
@tap="state.editMode = true"
>
编辑
</button>
</view>
</view>-->
<!-- 内容 -->
<view class="cart-content">
<view class="goods-box ss-r-10 ss-m-b-14" v-for="(item, index) in feetHisList" :key="index">
<view class="dataBox">{{item.date_text}}</view>
<view class="rrecommList" v-for="(e,i) in item.log" :key="i">
<view class="reListItem">
<!-- 左侧图片 -->
<view class="listItem-images">
<image v-if="e.information.recommend == 1"
style="width: 77rpx;height: 36rpx;z-index: 100;position: relative;top: 34rpx;left: 0rpx;"
src="https://jiangxiaoxian.0rui.cn/hot.png"></image>
<image class="iamges-mainImg" :src="e.information.images[0]"></image>
</view>
<!-- 右侧内容 -->
<view class="listItem-contents">
<view class="title2" style="margin-bottom: 20rpx;">{{e.information.platform_title}}</view>
<scroll-view class="score-box">
<view class="fs11 flex cate">
<view class="cate-e" v-for="(w,q) in e.information.cate" :key="q">
<view v-show="w" class="status-tag " style="margin-right: 20rpx;">{{w}}
<scroll-view @scrolltolower="onScrolltolower" :refresher-enabled="true" :refresher-triggered="homrS"
@refresherrefresh="onS" scroll-y="true" class="flex align-items"
style="height: 1000rpx;box-sizing: border-box;">
<view class="cart-content">
<view class="goods-box ss-r-10 ss-m-b-14" v-for="(item, index) in feetHisList" :key="index">
<view class="dataBox">{{item.date_text}}</view>
<view class="rrecommList" v-for="(e,i) in item.log" :key="i">
<view class="reListItem">
<!-- 左侧图片 -->
<view class="listItem-images">
<image v-if="e.information.recommend == 1"
style="width: 77rpx;height: 36rpx;z-index: 100;position: relative;top: 34rpx;left: 0rpx;"
src="https://jiangxiaoxian.0rui.cn/hot.png"></image>
<image class="iamges-mainImg" :src="e.information.images[0]"></image>
</view>
<!-- 右侧内容 -->
<view class="listItem-contents">
<view class="title2" style="margin-bottom: 20rpx;">{{e.information.platform_title}}
</view>
<scroll-view class="score-box">
<view class="fs11 flex cate">
<view class="cate-e" v-for="(w,q) in e.information.cate" :key="q">
<view v-show="w" class="status-tag " style="margin-right: 20rpx;">{{w}}
</view>
</view>
</view>
</view>
</scroll-view>
<view class="cons-third">
<view style="display: flex;">
<image style="width: 24rpx;height: 24rpx;"
src="https://jiangxiaoxian.0rui.cn/locationList.png"></image>
<view class="title3" style="margin-left: 10rpx;">{{e.information.address_city_text}}
</scroll-view>
<view class="cons-third">
<view style="display: flex;">
<image style="width: 24rpx;height: 24rpx;"
src="https://jiangxiaoxian.0rui.cn/locationList.png"></image>
<view class="title3" style="margin-left: 10rpx;">
{{e.information.address_city_text}}
</view>
</view>
<view class="title3">{{e.information.release_time_text}}</view>
<view style="display: flex;">
<image style="width: 26rpx;height: 20rpx;"
src="https://jiangxiaoxian.0rui.cn/eye.png"></image>
<view class="title3" style="margin-left: 10rpx;">{{e.information.views}}
</view>
</view>
</view>
<view class="title3">{{e.information.release_time_text}}</view>
<view style="display: flex;">
<image style="width: 26rpx;height: 20rpx;"
src="https://jiangxiaoxian.0rui.cn/eye.png"></image>
<view class="title3" style="margin-left: 10rpx;">{{e.information.views}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="flex flex-column flex-start align-items"
v-if="feetHisList.length == 0" style="margin-top: 300rpx;">
<image src="https://jiangxiaoxian.0rui.cn/noneList.png" mode="" style="width: 180rpx;height: 180rpx;">
</image>
<view style="margin-top: 30rpx;font-size: 28rpx;color: #323232;">暂无数据信息</view>
</view>
<view class="flex flex-column flex-start align-items" v-if="feetHisList.length == 0"
style="margin-top: 300rpx;">
<image src="https://jiangxiaoxian.0rui.cn/noneList.png" mode=""
style="width: 180rpx;height: 180rpx;">
</image>
<view style="margin-top: 30rpx;font-size: 28rpx;color: #323232;">暂无数据信息</view>
</view>
</scroll-view>
</view>
<!-- <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多',
@ -108,6 +91,9 @@
// const today = ref('')
const feetHisList = ref([])
const homrS = ref('')
const feetCount = ref(0);
const loadStatus = ref('');
//
const listQuery = ref({
page: 1,
@ -129,7 +115,6 @@
})
onLoad(() => {
// getData();
getFeetList();
});
@ -141,63 +126,44 @@
});
console.log('足迹返值', res);
if (res.code == 1) {
feetHisList.value = res.data.list
feetHisList.value = [...feetHisList.value, ...res.data.list]
feetCount.value = res.data.count
console.log('足迹列表', feetHisList.value);
}
}
const sys_navBar = sheep.$platform.navbar;
const pagination = {
data: [],
current_page: 1,
total: 1,
last_page: 1,
};
const state = reactive({
pagination: {
data: [],
current_page: 1,
total: 1,
last_page: 1,
},
loadStatus: '',
editMode: false,
selectedCollectList: [],
selectAll: false,
});
async function getData(page = 1, list_rows = 10) {
state.loadStatus = 'loading';
let res = await sheep.$api.user.goodsLog.list({
type: 'views',
list_rows,
page,
//
function onScrolltolower() {
if (feetHisList.value.length < feetCount.value) {
listQuery.value.page += 1;
getFeetList();
}
}
//
function onS() {
homrS.value = true
uni.showLoading({
title: '加载中...'
});
if (res.code === 1) {
let orderList = _.concat(state.pagination.data, res.data.data);
state.pagination = {
...res.data,
data: orderList,
};
if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
}
resetLists();
setTimeout(() => {
homrS.value = false;
uni.hideLoading();
uni.stopPullDownRefresh();
}, 2000)
}
//
//
function loadmore() {
if (state.loadStatus !== 'noMore') {
getData(state.pagination.current_page + 1);
}
//
function resetLists() {
listQuery.value.page = 1;
feetHisList.value = [];
loadStatus.value = "loading";
getFeetList();
}
onReachBottom(() => {
loadmore();
});
const sys_navBar = sheep.$platform.navbar;
onReachBottom(() => {});
</script>
<style lang="scss" scoped>