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

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

@ -6,11 +6,11 @@
<su-tabs :list="tabMaps" @change="onChange" :scrollable="false" :current="currentTab"></su-tabs> <su-tabs :list="tabMaps" @change="onChange" :scrollable="false" :current="currentTab"></su-tabs>
</view> </view>
<scroll-view @scrolltolower="onScrolltolower" :refresher-enabled="true" :refresher-triggered="homrS" <scroll-view @scrolltolower="onScrolltolower" :refresher-enabled="true" :refresher-triggered="homrS"
@refresherrefresh="onS" scroll-y="true" class="flex align-items" @refresherrefresh="onS" scroll-y="true" class="flex align-items"
style="height: 1250rpx;box-sizing: border-box;"> style="height: 1250rpx;box-sizing: border-box;">
<!-- 食堂招租 --> <!-- 食堂招租 -->
<view class="recommend-box" v-if="currentTab == 0"> <view class="recommend-box" v-if="currentTab == 0">
<view class="rrecommList" v-for="(item,index) in collectRentList" :key="index"> <view class="rrecommList" v-for="(item,index) in collectRentList" :key="index">
@ -88,7 +88,7 @@
</view> </view>
</view> </view>
<!-- 无数据展示 --> <!-- 无数据展示 -->
<view class="flex flex-column flex-start align-items" style="margin-top: 400rpx;" <view class="flex flex-column flex-start align-items" style="margin-top: 400rpx;"
v-if="( currentTab == 0 && collectRentList.length == 0) || (currentTab == 1 && collectSchoolList.length == 0)"> v-if="( currentTab == 0 && collectRentList.length == 0) || (currentTab == 1 && collectSchoolList.length == 0)">
@ -98,7 +98,7 @@
<view style="margin-top: 30rpx;font-size: 28rpx;color: #323232;">暂无数据信息</view> <view style="margin-top: 30rpx;font-size: 28rpx;color: #323232;">暂无数据信息</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
@ -159,6 +159,7 @@
const collectSchoolList = ref([]) const collectSchoolList = ref([])
const schoolCount = ref(0) const schoolCount = ref(0)
const homrS = ref(false) const homrS = ref(false)
const loadStatus = ref('')
//tabs //tabs
function onChange(e) { function onChange(e) {
console.log('onChange', e); console.log('onChange', e);
@ -186,7 +187,7 @@
console.log('招租收藏列表', res); console.log('招租收藏列表', res);
if (res.code == 1) { if (res.code == 1) {
collectRentList.value =[...collectRentList.value,...res.data.list]; collectRentList.value = [...collectRentList.value, ...res.data.list];
rentCount.value = res.data.count rentCount.value = res.data.count
} else { } else {
// Handle case where data is not in expected format // Handle case where data is not in expected format
@ -212,7 +213,7 @@
console.log('平台课程收藏列表', res); console.log('平台课程收藏列表', res);
if (res.code == 1) { if (res.code == 1) {
collectSchoolList.value =[...collectSchoolList.value,...res.data.list]; collectSchoolList.value = [...collectSchoolList.value, ...res.data.list];
schoolCount.value = res.data.count schoolCount.value = res.data.count
} else { } else {
// Handle case where data is not in expected format // Handle case where data is not in expected format
@ -229,20 +230,46 @@
function onScrolltolower() { function onScrolltolower() {
if (currentTab.value == 0) { if (currentTab.value == 0) {
if (collectRentList.value.length < rentCount.value) { if (collectRentList.value.length < rentCount.value) {
listQuery.value.rentPage+=1; listQuery.value.rentPage += 1;
getRentList(); getRentList();
} }
} else { } else {
if (collectSchoolList.value.length < schoolCount.value) { if (collectSchoolList.value.length < schoolCount.value) {
listQuery.value.schoolPage+=1; listQuery.value.schoolPage += 1;
getSchoolList(); getSchoolList();
} }
} }
} }
//
function onS() { function onS() {
homrS.value = true 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(() => {}); onReachBottom(() => {});

View File

@ -1,83 +1,66 @@
<template> <template>
<s-layout title="我的足迹" :bgStyle="{ color: '#f2f2f2' }"> <s-layout title="我的足迹" :bgStyle="{ color: '#f2f2f2' }">
<view class="cart-box ss-flex ss-flex-col ss-row-between"> <view class="cart-box ss-flex ss-flex-col ss-row-between">
<!-- 头部 --> <scroll-view @scrolltolower="onScrolltolower" :refresher-enabled="true" :refresher-triggered="homrS"
<!-- <view class="cart-header ss-flex ss-col-center ss-row-between ss-p-x-30"> @refresherrefresh="onS" scroll-y="true" class="flex align-items"
<view class="header-left ss-flex ss-col-center ss-font-26"> style="height: 1000rpx;box-sizing: border-box;">
<view class="cart-content">
<text class="goods-number ui-TC-Main ss-flex"> <view class="goods-box ss-r-10 ss-m-b-14" v-for="(item, index) in feetHisList" :key="index">
{{ state.pagination.total }} <view class="dataBox">{{item.date_text}}</view>
</text> <view class="rrecommList" v-for="(e,i) in item.log" :key="i">
件商品 <view class="reListItem">
</view> <!-- 左侧图片 -->
<view class="header-right"> <view class="listItem-images">
<button <image v-if="e.information.recommend == 1"
v-if="state.editMode && state.pagination.total" style="width: 77rpx;height: 36rpx;z-index: 100;position: relative;top: 34rpx;left: 0rpx;"
class="ss-reset-button" src="https://jiangxiaoxian.0rui.cn/hot.png"></image>
@tap="state.editMode = false" <image class="iamges-mainImg" :src="e.information.images[0]"></image>
> </view>
取消 <!-- 右侧内容 -->
</button> <view class="listItem-contents">
<button <view class="title2" style="margin-bottom: 20rpx;">{{e.information.platform_title}}
v-if="!state.editMode && state.pagination.total" </view>
class="ss-reset-button ui-TC-Main" <scroll-view class="score-box">
@tap="state.editMode = true" <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}}
</button> </view>
</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}}
</view> </view>
</view> </view>
</view> </scroll-view>
</scroll-view> <view class="cons-third">
<view class="cons-third"> <view style="display: flex;">
<view style="display: flex;"> <image style="width: 24rpx;height: 24rpx;"
<image style="width: 24rpx;height: 24rpx;" src="https://jiangxiaoxian.0rui.cn/locationList.png"></image>
src="https://jiangxiaoxian.0rui.cn/locationList.png"></image> <view class="title3" style="margin-left: 10rpx;">
<view class="title3" style="margin-left: 10rpx;">{{e.information.address_city_text}} {{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>
<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>
</view> </view>
</view> </view>
</view>
<view class="flex flex-column flex-start align-items" v-if="feetHisList.length == 0"
<view class="flex flex-column flex-start align-items" style="margin-top: 300rpx;">
v-if="feetHisList.length == 0" style="margin-top: 300rpx;"> <image src="https://jiangxiaoxian.0rui.cn/noneList.png" mode=""
<image src="https://jiangxiaoxian.0rui.cn/noneList.png" mode="" style="width: 180rpx;height: 180rpx;"> style="width: 180rpx;height: 180rpx;">
</image> </image>
<view style="margin-top: 30rpx;font-size: 28rpx;color: #323232;">暂无数据信息</view> <view style="margin-top: 30rpx;font-size: 28rpx;color: #323232;">暂无数据信息</view>
</view> </view>
</scroll-view>
</view> </view>
<!-- <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{ <!-- <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多', contentdown: '上拉加载更多',
@ -108,6 +91,9 @@
// const today = ref('') // const today = ref('')
const feetHisList = ref([]) const feetHisList = ref([])
const homrS = ref('')
const feetCount = ref(0);
const loadStatus = ref('');
// //
const listQuery = ref({ const listQuery = ref({
page: 1, page: 1,
@ -129,7 +115,6 @@
}) })
onLoad(() => { onLoad(() => {
// getData();
getFeetList(); getFeetList();
}); });
@ -141,63 +126,44 @@
}); });
console.log('足迹返值', res); console.log('足迹返值', res);
if (res.code == 1) { 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); console.log('足迹列表', feetHisList.value);
} }
} }
const sys_navBar = sheep.$platform.navbar; //
const pagination = { function onScrolltolower() {
data: [], if (feetHisList.value.length < feetCount.value) {
current_page: 1, listQuery.value.page += 1;
total: 1, getFeetList();
last_page: 1, }
}; }
const state = reactive({ //
pagination: { function onS() {
data: [], homrS.value = true
current_page: 1, uni.showLoading({
total: 1, title: '加载中...'
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,
}); });
if (res.code === 1) { resetLists();
let orderList = _.concat(state.pagination.data, res.data.data); setTimeout(() => {
state.pagination = { homrS.value = false;
...res.data, uni.hideLoading();
data: orderList, uni.stopPullDownRefresh();
}; }, 2000)
if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
}
} }
//
// //
function loadmore() { function resetLists() {
if (state.loadStatus !== 'noMore') { listQuery.value.page = 1;
getData(state.pagination.current_page + 1); feetHisList.value = [];
} loadStatus.value = "loading";
getFeetList();
} }
onReachBottom(() => {
loadmore(); const sys_navBar = sheep.$platform.navbar;
}); onReachBottom(() => {});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -207,27 +173,27 @@
font-weight: 800; font-weight: 800;
line-height: 34rpx; line-height: 34rpx;
} }
.intro { .intro {
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
line-height: 24rpx; line-height: 24rpx;
} }
.title2 { .title2 {
color: #3d3d3d; color: #3d3d3d;
font-size: 30rpx; font-size: 30rpx;
font-weight: 800; font-weight: 800;
line-height: 42rpx; line-height: 42rpx;
} }
.title3 { .title3 {
font-size: 20rpx; font-size: 20rpx;
font-weight: 400; font-weight: 400;
color: #999999; color: #999999;
line-height: 22rpx; line-height: 22rpx;
} }
.cart-box { .cart-box {
.cart-header { .cart-header {
height: 70rpx; height: 70rpx;
@ -261,15 +227,15 @@
.goods-box { .goods-box {
// background-color: #fff; // background-color: #fff;
.dataBox { .dataBox {
margin: 30rpx; margin: 30rpx;
} }
.rrecommList { .rrecommList {
margin-top: 30rpx; margin-top: 30rpx;
// padding: 30rpx; // padding: 30rpx;
.reListItem { .reListItem {
background-color: #ffffff; background-color: #ffffff;
width: 640rpx; width: 640rpx;
@ -279,11 +245,11 @@
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
border-radius: 18rpx; border-radius: 18rpx;
.listItem-images { .listItem-images {
display: grid; display: grid;
justify-content: flex-start; justify-content: flex-start;
.iamges-mainImg { .iamges-mainImg {
width: 190rpx; width: 190rpx;
height: 190rpx; height: 190rpx;
@ -291,23 +257,23 @@
right: 0rpx; right: 0rpx;
bottom: 18rpx; bottom: 18rpx;
z-index: 1; z-index: 1;
} }
} }
.listItem-contents { .listItem-contents {
margin-left: 20rpx; margin-left: 20rpx;
.score-box { .score-box {
display: flex; display: flex;
.cate { .cate {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
.cate-e { .cate-e {
.status-tag { .status-tag {
padding: 5rpx 15rpx; padding: 5rpx 15rpx;
border-radius: 5rpx; border-radius: 5rpx;
@ -315,19 +281,19 @@
font-weight: 400; font-weight: 400;
line-height: 22rpx; line-height: 22rpx;
background-color: rgba(247, 97, 0, 0.2); background-color: rgba(247, 97, 0, 0.2);
// opacity: 0.2; // opacity: 0.2;
color: #F76100; color: #F76100;
//flex-shrink: 0 //flex-shrink: 0
} }
} }
} }
} }
.cons-third { .cons-third {
margin-top: 20rpx; margin-top: 20rpx;
display: flex; display: flex;
@ -336,9 +302,9 @@
} }
} }
} }
} }
&:last-child { &:last-child {
margin-bottom: 40rpx; margin-bottom: 40rpx;