1、收藏两个一行展示列表的css调整

2、食堂招租列表的列表改为scroll-view的内部,新增加载更多和下来刷新的方法
3、平台学院列表改为scroll-view的内部,新增加载更多和下来刷新的方法
4、食堂详情页面:详情静态+数据对接
This commit is contained in:
wangzimeng 2025-07-25 18:05:25 +08:00
parent 1cacadcfe4
commit 984c79350a
6 changed files with 750 additions and 146 deletions

View File

@ -1,9 +1,473 @@
<template>
<s-layout title="招租详情"></s-layout>
<s-layout title="招租详情">
<view class="container">
<!-- 顶部banner -->
<view class="swiper-box">
<view class="swiper_s">
<swiper class="swiper_s" :circular="true" :autoplay="true" indicator-active-color="#0DAE11"
indicator-color="#ffffff" :indicator-dots="false" :current="currentImgIndex"
@animationfinish="swiperChange">
<!-- v-for="(item, index) in swiperList" :key="index" @click="openSwiper(item)"-->
<swiper-item style="margin: 0 auto;">
<view style="position: relative;width: 100%;height: 100%;"
v-for="(item,index) in detailRent.images" :key="index">
<image class="swiper-image" :src="item" mode="scaleToFill" />
</view>
</swiper-item>
<!-- <swiper-item style="margin: 0 auto;">
<view style="position: relative;width: 100%;height: 100%">
<image class="swiper-image" src="/static/cart-empty.png" mode="scaleToFill" />
</view>
</swiper-item> -->
</swiper>
<view class="bannerNum">
{{currentImgIndex}}/{{imagesNum}}
</view>
</view>
</view>
<!-- 招租基本信息 -->
<view class="listItem-contents">
<view class="title2" style="margin-bottom: 20rpx;">{{detailRent.platform_title}}</view>
<scroll-view class="score-box">
<view class="fs11 flex cate">
<view class="cate-e" v-for="(e,i) in detailRent.cate" :key="i">
<view v-show="e" class="status-tag " style="margin-right: 20rpx;">{{e}}
</view>
</view>
<!-- <text v-show="item.cate[1]"
class="status-tag" style="margin-right: 20rpx;">{{item.cate[1]}}</text>
<text v-show="item.cate[2]"
class="status-tag">{{item.cate[2]}}</text> -->
</view>
</scroll-view>
<view class="cons-third">
<view style="display: flex;align-items: center;justify-content: flex-start;">
<image style="width: 36rpx;height: 36rpx;" :src="detailRent.user?.avatar"></image>
<view class="title1" style="margin-left: 10rpx;">{{detailRent.user?.nickname}}
</view>
<view class="title5" style="margin-left: 30rpx;">项目类型 {{detailRent.type_text}}</view>
</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;">{{detailRent.views}}</view>
</view>
</view>
</view>
<view class="phoneNumBox">
<view style="display: flex;justify-content: flex-start;align-items: center;">
<image style="width: 32rpx;height: 32rpx;" src="https://jiangxiaoxian.0rui.cn/rentDetailTime.png">
</image>
<view class="title4" style="margin-left: 20rpx;">{{detailRent.release_time_text}}</view>
</view>
<view class="line-row" style="margin: 40rpx 0;"></view>
<view style="display: flex;justify-content: flex-start;align-items: center;">
<image style="width: 32rpx;height: 32rpx;" src="https://jiangxiaoxian.0rui.cn/rentAddress.png">
</image>
<view class="title4" style="margin-left: 20rpx;">{{detailRent.address_detail}}</view>
</view>
</view>
<view class="description">
<view class="desTi">
<view style="width: 6rpx;height: 36rpx;background-color: #fcc74e;margin-right: 20rpx;"></view>
<view class="cs bold" style="font-size: 36rpx;line-height: 38rpx;">详细介绍</view>
</view>
<view class="desCon">
{{detailRent.content}}
</view>
</view>
<view style="width: 100%;height: 180rpx;"></view>
<!-- 底部按钮 -->
<view class="footer-box">
<view class="icon-box flex ml40">
<view>
<image class="btnIcon" src="https://jiangxiaoxian.0rui.cn/backHome.png" mode=""></image>
<view class="btnText" style="margin-top: 10rpx;">首页</view>
</view>
<view style="margin-left: 40rpx;">
<image class="btnIcon" src="https://jiangxiaoxian.0rui.cn/rentShare.png" mode=""></image>
<view class="btnText" style="margin-top: 10rpx;">分享</view>
</view>
<view style="margin-left: 40rpx;">
<image v-if="detailRent.is_collect == 0" class="btnIcon"
src="https://jiangxiaoxian.0rui.cn/unCollect.png" mode=""></image>
<image v-else class="btnIcon" src="https://jiangxiaoxian.0rui.cn/collected.png" mode=""></image>
<view class="btnText" style="margin-top: 10rpx;">收藏</view>
</view>
<view style="margin-left: 40rpx;">
<image class="btnIcon" src="https://jiangxiaoxian.0rui.cn/service.png" mode=""></image>
<view class="btnText" style="margin-top: 10rpx;">客服</view>
</view>
</view>
<view class="button-box" @click="handleJuage">立即联系
</view>
</view>
</view>
<su-popup :show="showContacted == true" type="center" round="10" :isMaskClick="false">
<view class="popupContacted">
<view class="contactedBox">
<image style="width: 120rpx;height: 120rpx;"></image>
<view style="font-size: 36rpx;line-height: 50rpx;font-weight: 900;color: #3d3d3d;margin: 30rpx 0;">确认拨号</view>
<view style="font-size: 30rpx;line-height: 44rpx;font-weight: 400;color: #3d3d3d;">剩余联系次数detailRent.all_mobile_num</view>
</view>
</view>
</su-popup>
<su-popup :show="showContactNo == true" type="center" round="10" :isMaskClick="false">
<view class="popupContactNo">
</view>
</su-popup>
</s-layout>
</template>
<script setup>
import {
computed,
ref,
reactive,
} from 'vue';
import {
onLoad,
onShow,
onPageScroll,
onPullDownRefresh,
onReachBottom
} from '@dcloudio/uni-app';
import {
consignee,
mobile,
address,
region
} from '@/sheep/validate/form';
import rent from '../../sheep/api/rent';
import sheep from '@/sheep';
const rentId = ref('');
const detailRent = ref('')
const imagesNum = ref(0);
const currentImgIndex = ref(1)
const showContacted = ref(false)
const showContactNo = ref(false)
onLoad((options) => {
console.log('onload', options.id);
rentId.value = options.id
if (options.id) {
getDetail();
}
})
async function getDetail() {
const res = await sheep.$api.rent.rentInfo(rentId.value)
console.log('获取招租详情', res);
if (res.code == 1) {
detailRent.value = res.data.detail
detailRent.value.release_time_text = detailRent.value.release_time_text.substring(0, 10);
const imageList = res.data.detail.images
console.log('imageList:',imageList.length);
imagesNum.value = imageList.length
console.log('imagesNum:',imagesNum.value);
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}
//
function handleJuage() {
console.log('拨打电话次数:',detailRent.value.all_mobile_num);
if(detailRent.value.all_mobile_num > 0){
showContacted.value = true
}else {
showContactNo.value = true
}
}
</script>
<style lang="scss" scoped>
.btnIcon {
width: 40rpx;
height: 40rpx;
}
.btnText {
font-size: 20rpx;
font-weight: 400;
line-height: 20rpx;
color: #3d3d3d;
}
.title1 {
font-size: 24rpx;
font-weight: 400;
color: #9c9c9c;
line-height: 26rpx;
}
.title2 {
color: #3d3d3d;
font-size: 30rpx;
font-weight: 800;
line-height: 42rpx;
}
.title3 {
font-size: 24rpx;
font-weight: 400;
color: #999999;
line-height: 26rpx;
}
.title4 {
font-size: 26rpx;
font-weight: 400;
color: #9b9b9b;
line-height: 36rpx;
}
.title5 {
font-size: 24rpx;
font-weight: 400;
color: #333333;
line-height: 26rpx;
}
.flex {
display: flex;
}
.flex-start {
align-items: flex-start;
}
.justify-center {
justify-content: center;
}
.align-items {
align-items: center;
}
.flex-column {
flex-flow: column;
}
.fs24 {
font-size: 24rpx;
}
.Regular {
font-weight: 400;
}
.bold {
font-weight: bold;
}
.c3 {
color: #333333;
}
.c9 {
color: #999999;
}
.container {
width: 100%;
.swiper-box {
width: 100%;
// padding: 0 30rpx;
// display: grid;
// justify-content: center;
height: 750rpx;
position: relative;
.swiper_s {
width: 100%;
height: 100%;
// display: grid;
// justify-content: center;
.bannerNum {
z-index: 100;
width: 85rpx;
height: 40rpx;
background-color: rgba(0, 0, 0, 0.5);
color: #ffffff;
font-weight: 400;
font-size: 26rpx;
line-height: 20rpx;
border-radius: 30rpx;
position: relative;
left: 628rpx;
bottom: 64rpx;
display: flex;
justify-content: center;
align-items: center;
}
.swiper-image {
width: 100%;
height: 100%;
// border-radius: 36rpx;
object-fit: contain;
}
}
}
.listItem-contents {
background-color: #ffffff;
// margin-left: 20rpx;
// padding: 30rpx;
.score-box {
display: flex;
.cate {
display: flex;
justify-content: flex-start;
align-items: center;
.cate-e {
.status-tag {
padding: 5rpx 15rpx;
border-radius: 5rpx;
font-size: 22rpx;
font-weight: 400;
line-height: 22rpx;
background-color: rgba(247, 97, 0, 0.2);
// opacity: 0.2;
color: #F76100;
//flex-shrink: 0
}
}
}
}
.cons-third {
margin-top: 20rpx;
padding: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.phoneNumBox {
margin-top: 10rpx;
background-color: #ffffff;
padding: 40rpx 30rpx;
.line-row {
width: 100%;
height: 1rpx;
background: #F0F0F0;
border-radius: 0rpx 0rpx 0rpx 0rpx;
}
}
.description {
background-color: #ffffff;
padding: 40rpx 30rpx;
margin-top: 10rpx;
.desTi {
display: flex;
justify-content: flex-start;
align-items: center;
}
.desCon {
margin-top: 30rpx;
color: #3d3d3d;
font-weight: 400;
line-height: 42rpx;
font-size: 28rpx;
}
}
.footer-box {
width: 100%;
height: 98rpx;
padding-bottom: 0rpx;
box-sizing: border-box;
position: fixed;
bottom: 0;
display: flex;
align-items: center;
justify-content: space-between;
// box-shadow: 0 -4rpx 6rpx 6rpx #f6f6f6;
background-color: #fff;
// padding-left: 30rpx;
.icon-box {
width: 50%;
height: 98rpx;
display: flex;
justify-content: space-around;
align-items: center;
padding: 14rpx 30rpx;
}
.button-box {
background-color: #fcc74e;
color: #333333;
width: 50%;
height: 98rpx;
display: flex;
align-items: center;
justify-content: center;
}
}
}
.popupContacted {
width: 660rpx;
height: 477rpx;
background-color: #fff;
.contactedBox {
width: 100%;
height: 100%;
display: grid;
justify-content: center;
align-items: center;
padding-top: 40rpx;
}
}
</style>

View File

@ -25,8 +25,11 @@
</view>
<picker mode="selector" :value="tagList.id" :range="tagList" range-key="name"
@change="onChangeTag">
<view class="picker" style="width: auto; position: relative;display: flex;justify-content: flex-start;align-items: center;">
<view style="max-width: 110rpx; position: relative;font-size: 28rpx;font-weight: 400;color: #999999;line-height: 32rpx;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">{{dictLabel || '标签'}}</view>
<view class="picker"
style="width: auto; position: relative;display: flex;justify-content: flex-start;align-items: center;">
<view
style="max-width: 110rpx; position: relative;font-size: 28rpx;font-weight: 400;color: #999999;line-height: 32rpx;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
{{dictLabel || '标签'}}</view>
<image style="width: 27rpx;height: 27rpx;margin-left: 6rpx;"
src="https://jiangxiaoxian.0rui.cn/rentMore.png" mode=""></image>
</view>
@ -41,9 +44,12 @@
</view>
<!-- 推荐列表 -->
<scroll-view @scrolltolower="onScrolltolower" :refresher-enabled="true" :refresher-triggered="homrS"
@refresherrefresh="onS" scroll-y="true" class="flex align-items"
style="height: 1250rpx;box-sizing: border-box;">
<view class="recommend-box">
<view class="rrecommList" v-for="(item,index) in rentList" :key="index">
<view class="reListItem">
<view class="rrecommList" >
<view class="reListItem" v-for="(item,index) in rentList" :key="index" @click="toDetail(item)">
<!-- 左侧图片 -->
<view class="listItem-images">
<image v-if="item.recommend == 1"
@ -57,7 +63,8 @@
<scroll-view class="score-box">
<view class="fs11 flex cate">
<view class="cate-e" v-for="(e,i) in item.cate" :key="i">
<view v-show="e" class="status-tag " style="margin-right: 20rpx;">{{e}}</view>
<view v-show="e" class="status-tag " style="margin-right: 20rpx;">{{e}}
</view>
</view>
<!-- <text v-show="item.cate[1]"
@ -70,7 +77,8 @@
<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;">{{item.address_city_text}}</view>
<view class="title3" style="margin-left: 10rpx;">{{item.address_city_text}}
</view>
</view>
<view class="title3">{{item.release_time_text}}</view>
<view style="display: flex;">
@ -84,6 +92,8 @@
</view>
</view>
</scroll-view>
</view>
<!-- 省市区弹窗 -->
@ -164,7 +174,7 @@
const proCity = ref(''); //
function searchRent() {
console.log('搜索',listQuery.value.keywords);
console.log('搜索', listQuery.value.keywords);
getList()
}
@ -216,6 +226,7 @@
}
const rentList = ref([])
const rentCount = ref(0)
//
async function getList() {
const res = await sheep.$api.rent.rentlist({
@ -232,7 +243,7 @@
if (res.data && res.data.list) {
rentList.value = res.data.list;
rentCount.value = res.data.count;
// Safely process each item
rentList.value = rentList.value.map(item => {
// Create a new object with all properties from the original item
@ -256,8 +267,44 @@
// for(let i=0;i<rentList.value.length;i++){
// rentList.value[i].release_time_text = rentList.value[i].release_time_text.substring(0, 10)
// }
console.log('getList', rentList.value);
console.log('getList', rentList.value, rentCount.value);
}
//
function onScrolltolower() {
if (rentList.value.length < classCount.value) {
listQuery.value.page += 1;
getList();
}
}
//
function onS() {
homrS.value = true
listQuery.value.keywords = ''
uni.showLoading({
title: '加载中...'
});
resetLists();
getList()
setTimeout(() => {
homrS.value = false;
uni.hideLoading();
uni.stopPullDownRefresh();
}, 2000)
}
//
function resetLists() {
listQuery.value.page = 1;
rentList.value = [];
// loadStatus.value = "loading";
}
function toDetail(e){
console.log('跳转详情',e);
uni.navigateTo({
url:'/pages/canteenRent/rentDetail?id=' + e.id
})
}
</script>
<style lang="scss" scoped>
@ -361,6 +408,7 @@
height: 190rpx;
padding: 30rpx;
display: flex;
margin-top: 20rpx;
justify-content: flex-start;
align-items: center;
border-radius: 18rpx;

View File

@ -10,7 +10,7 @@
<view class="locTop-left" @click="state.showRegion = true">
<image style="width: 34rpx;height: 34rpx;"
src="https://jiangxiaoxian.0rui.cn/locationTop.png" mode=""></image>
<view style="margin-left: 10rpx;font-size: 30rpx;font-weight: 800;line-height: 26rpx;white-space: nowrap;
<view style="margin-left: 10rpx;font-size: 30rpx;font-weight: 800;line-height: 45rpx;white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;width: 270rpx;">
{{state.model.city_name ? proCity:'全国' }}

View File

@ -7,8 +7,9 @@
<view class="locTop">
<view class="locTop-right">
<uni-section style="border-radius: 192rpx;padding: 0;" type="line">
<uni-search-bar style="border-radius: 192rpx;" radius="23" placeholder="搜索您需要的信息"
bgColor="#EEEEEE" clearButton="none" cancelButton="none" @confirm="searchRent" @blur="searchRent1"/>
<uni-search-bar v-model="listQuery.keywords" style="border-radius: 192rpx;" radius="23"
placeholder="搜索您需要的信息" bgColor="#EEEEEE" clearButton="none" cancelButton="none"
@confirm="searchClass" />
</uni-section>
<!-- <uni-search-bar></uni-search-bar> @confirm="search"-->
</view>
@ -18,43 +19,133 @@
</view>
<!-- 推荐列表 -->
<view class="recommend-box">
<view class="rrecommList">
<view class="reListItem">
<!-- 左侧图片 -->
<view class="listItem-images">
<image 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="https://jiangxiaoxian.0rui.cn/model.png"></image>
</view>
<!-- 右侧内容 -->
<view class="listItem-contents">
<view class="title2" style="margin-bottom: 20rpx;">食堂餐厅外包]洛阳某本科食堂新装修</view>
<view class="">标签</view>
<!-- 课程列表 -->
<scroll-view @scrolltolower="onScrolltolower" :refresher-enabled="true" :refresher-triggered="homrS"
@refresherrefresh="onS" scroll-y="true" class="flex align-items"
style="height: 1250rpx;box-sizing: border-box;">
<view class="couponsList">
<view class="list-item" v-for="(item,index) in classesList" :key="index">
<image style="width: 100%;height: 200rpx;border-radius: 30rpx 30rpx 0 0;" :src="item.image">
</image>
<image v-if="item.status == 1" style="width: 77rpx;height: 36rpx;z-index: 100;position: relative;bottom: 190rpx;left: 20rpx;"
src="https://jiangxiaoxian.0rui.cn/schoolText.png"></image>
<image v-if="item.status == 2" style="width: 77rpx;height: 36rpx;z-index: 100;position: relative;bottom: 190rpx;left: 20rpx;"
src="https://jiangxiaoxian.0rui.cn/schoolVideo.png"></image>
<view class="item-text">
<view class="fs30 c3 classTitle" style="">{{item.title}}</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;">河南省洛阳市</view>
</view>
<view class="title3">2025-07-24</view>
<view class="title3">{{item.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;">11400</view>
</view>
src="https://jiangxiaoxian.0rui.cn/eye.png">
</image>
<view class="title3" style="margin-left: 10rpx;">{{item.views}}</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</s-layout>
</template>
<script setup>
import {
computed,
ref,
reactive,
} from 'vue';
import {
onLoad,
onShow,
onPageScroll,
onPullDownRefresh,
onReachBottom
} from '@dcloudio/uni-app';
import {
consignee,
mobile,
address,
region
} from '@/sheep/validate/form';
import rent from '../../sheep/api/rent';
import sheep from '@/sheep';
const listQuery = ref({
page: 1,
limit: 10,
keywords: null,
})
const classCount = ref(0)
const homrS = ref('')
const loadStatus = ref('')
onLoad(() => {
getList();
})
onShow(() => {})
const classesList = ref([])
//
async function getList() {
const res = await sheep.$api.school.schoolList({
keywords: listQuery.value.keywords,
page: listQuery.value.page,
limit: listQuery.value.limit,
order: 'normal',
recommend: 0,
});
console.log('getList', res);
if (res.data && res.data.list) {
classesList.value = res.data.list;
classCount.value = res.data.count
for (let i = 0; i < classesList.value.length; i++) {
classesList.value[i].release_time_text = classesList.value[i].release_time_text.substring(0, 10)
}
} else {
classesList.value = [];
}
console.log('getList', classesList.value, classCount.value);
}
//
function searchClass() {
console.log('搜索', listQuery.value.keywords);
getList()
}
//
function onScrolltolower() {
if (classesList.value.length < classCount.value) {
listQuery.value.page += 1;
getList();
}
}
//
function onS() {
homrS.value = true
listQuery.value.keywords = ''
uni.showLoading({
title: '加载中...'
});
resetLists();
getList()
setTimeout(() => {
homrS.value = false;
uni.hideLoading();
uni.stopPullDownRefresh();
}, 2000)
}
//
function resetLists() {
listQuery.value.page = 1;
classesList.value = [];
// loadStatus.value = "loading";
}
</script>
<style lang="scss" scoped>
@ -102,11 +193,12 @@
.top {
width: 100%;
height: 80rpx;
background-color: #ffffff;
// background-color: #ffffff;
// background-image: url('https://jiangxiaoxian.0rui.cn/topBack.png');
background-size: 100%;
padding: 30rpx ;
padding: 30rpx;
display: grid;
margin-bottom: 30rpx;
.locTop {
width: 96%;
@ -124,47 +216,51 @@
}
.recommend-box {
margin-top: 30rpx;
padding: 0rpx 30rpx;
.rrecommList {
// margin: 0 auto;
// margin-top: 30rpx;
// padding: 30rpx;
.couponsList {
width: 100%;
padding: 0 30rpx;
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 20rpx;
box-sizing: border-box;
.reListItem {
.list-item {
background-color: #ffffff;
width: 640rpx;
height: 190rpx;
padding: 30rpx;
display: flex;
justify-content: flex-start;
align-items: center;
border-radius: 18rpx;
width: 100%;
border-radius: 30rpx;
overflow: hidden;
.listItem-images {
width: 330rpx;
height: 200rpx;
display: grid;
justify-content: flex-start;
}
.iamges-mainImg {
width: 190rpx;
height: 190rpx;
.item-text {
padding: 0rpx 20rpx 0rpx 20rpx;
height: 120rpx;
position: relative;
right: 0rpx;
bottom: 18rpx;
z-index: 1;
bottom: 30rpx;
// text-align: center;
.classTitle {
height: 80rpx;
width: 300rpx;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
}
.listItem-contents {
margin-left: 20rpx;
.cons-third {
margin-top: 20rpx;
display: flex;
justify-content: space-around;
justify-content: space-between;
align-items: center;
}
}
@ -172,7 +268,8 @@
}
}
}
</style>

View File

@ -248,9 +248,9 @@
title: '加载中...'
});
resetLists();
if(currentTab.value == 0){
if (currentTab.value == 0) {
getRentList();
}else {
} else {
getSchoolList();
}
setTimeout(() => {
@ -407,12 +407,8 @@
padding: 0 30rpx;
display: grid;
grid-template-columns: repeat(2, 1fr);
;
grid-gap: 20px;
// display: flex;
// justify-content: center;
// align-items: center;
grid-gap: 20rpx;
box-sizing: border-box;
.list-item {
width: 330rpx;

View File

@ -21,14 +21,13 @@ export default {
showLoading: false,
},
}),
// detail: (id, user_coupon_id) =>
// request({
// url: 'coupon/detail',
// method: 'GET',
// params: {
// id: id,
// user_coupon_id,
// },
// }),
rentInfo: (id) =>
request({
url: 'meal.information/detail',
method: 'GET',
params: {
id: id,
},
}),
};