1、平台课程的收藏功能
2、个人中心的收藏列表样式调整+收藏按钮逻辑
This commit is contained in:
parent
229adacd44
commit
0e8fc589f7
@ -240,7 +240,10 @@
|
||||
icon:'none',
|
||||
duration: 2000
|
||||
})
|
||||
setTimeout(() =>{
|
||||
getDetail()
|
||||
},1000)
|
||||
// getDetail()
|
||||
}
|
||||
})
|
||||
|
||||
@ -258,7 +261,10 @@
|
||||
icon:'none',
|
||||
duration: 2000
|
||||
})
|
||||
setTimeout(() =>{
|
||||
getDetail()
|
||||
},1000)
|
||||
// getDetail()
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -25,35 +25,34 @@
|
||||
<!-- 右侧内容 -->
|
||||
<view class="listItem-contents">
|
||||
<view class="title2" style="margin-bottom: 20rpx;">{{item.platform_title}}</view>
|
||||
<scroll-view class="score-box">
|
||||
<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 class="status-tag " style="margin-right: 20rpx;">{{e}}
|
||||
</view>
|
||||
</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;">
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 右侧收藏 -->
|
||||
<view>
|
||||
<image style="width: 44rpx;height: 44rpx;"
|
||||
src="https://jiangxiaoxian.0rui.cn/collected.png"></image>
|
||||
<!-- <image style="width: 44rpx;height: 44rpx;" src="https://jiangxiaoxian.0rui.cn/unCollect.png"></image> -->
|
||||
<view class="fs24 Regular c3">取消收藏</view>
|
||||
<!-- <view class="fs24 Regular c9">收藏</view> -->
|
||||
<view
|
||||
style="display: grid;justify-content: center;align-items: center;margin-left: 10rpx;width: 100rpx;"
|
||||
@click="rentColect(item,index)">
|
||||
<image v-if="item.is_collect == 1" src="https://jiangxiaoxian.0rui.cn/collected.png"
|
||||
style="width: 44rpx;height: 44rpx;margin: 0 auto;"></image>
|
||||
<image v-if="item.is_collect == 0" style="width: 44rpx;height: 44rpx;margin: 0 auto;"
|
||||
src="https://jiangxiaoxian.0rui.cn/unCollect.png"></image>
|
||||
|
||||
<view v-if="item.is_collect == 1" class="fs24 Regular c3" style="margin-top: 15rpx;">
|
||||
取消收藏</view>
|
||||
<view class="fs24 Regular c9" v-if="item.is_collect == 0" style="margin-top: 15rpx;">收藏
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -62,29 +61,22 @@
|
||||
|
||||
<!-- 平台课程 -->
|
||||
<view class="exChangeBox" v-if="currentTab == 1">
|
||||
<view class="couponsList" v-for="(item,index) in collectSchoolList" :key="index">
|
||||
<view class="list-item">
|
||||
<image style="width: 330rpx;height: 200rpx;" :src="item.image">
|
||||
<view class="couponsList">
|
||||
<view class="list-item" v-for="(item,index) in collectSchoolList" :key="index">
|
||||
<image style="width: 330rpx;height: 200rpx;border-radius: 18rpx 18rpx 0 0;"
|
||||
:src="item.image">
|
||||
</image>
|
||||
<view class="item-text">
|
||||
<view class="fs30 c3" style="margin: 0 auto;">{{item.title}}</view>
|
||||
<view class="exchangeBtn">
|
||||
<view class="exchangeBtn" v-if="item.is_collect == 1" @click="classCollect(item,index)">
|
||||
取消收藏
|
||||
</view>
|
||||
<view class="exchangeBtn1" v-if="item.is_collect == 0" @click="classCollect(item,index)">
|
||||
收藏
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- <view class="list-item">
|
||||
<image style="width: 330rpx;height: 200rpx;" src="https://jiangxiaoxian.0rui.cn/fullCoupon.png">
|
||||
</image>
|
||||
<view class="item-text">
|
||||
<view class="fs30 c3" style="margin: 0 auto;">优惠券满100减50</view>
|
||||
<view class="exchangeBtn">
|
||||
取消收藏
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@ -166,8 +158,10 @@
|
||||
currentTab.value = e.index
|
||||
console.log('切换tabs', currentTab.value);
|
||||
if (currentTab.value == 0) {
|
||||
collectRentList.value = [];
|
||||
getRentList();
|
||||
} else {
|
||||
collectSchoolList.value = [];
|
||||
getSchoolList();
|
||||
}
|
||||
}
|
||||
@ -180,7 +174,6 @@
|
||||
limit: listQuery.value.limit,
|
||||
order: 'normal',
|
||||
status: 1,
|
||||
recommend: 1,
|
||||
collect: 1,
|
||||
|
||||
});
|
||||
@ -206,7 +199,6 @@
|
||||
page: listQuery.value.schoolPage,
|
||||
limit: listQuery.value.limit,
|
||||
order: 'normal',
|
||||
recommend: 1,
|
||||
collect: 1,
|
||||
|
||||
});
|
||||
@ -272,6 +264,78 @@
|
||||
}
|
||||
}
|
||||
|
||||
//招租收藏
|
||||
function rentColect(item, index) {
|
||||
console.log('收藏', item.is_collect);
|
||||
if (item.is_collect == 1) {
|
||||
collectRentList.value[index].is_collect = 0
|
||||
const data = {
|
||||
id: item.id,
|
||||
is_collect: item.is_collect
|
||||
}
|
||||
sheep.$api.rent.rentCollect(data).then((res) => {
|
||||
if (res.code == 1) {
|
||||
uni.showToast({
|
||||
title: '已取消收藏',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
collectRentList.value[index].is_collect = 1
|
||||
const data1 = {
|
||||
id: item.id,
|
||||
is_collect: item.is_collect
|
||||
}
|
||||
sheep.$api.rent.rentCollect(data1).then((res) => {
|
||||
if (res.code == 1) {
|
||||
uni.showToast({
|
||||
title: '已收藏',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//课程收藏
|
||||
function classCollect(item,index) {
|
||||
console.log('收藏', item.is_collect);
|
||||
if (item.is_collect == 1) {
|
||||
collectSchoolList.value[index].is_collect = 0
|
||||
const data = {
|
||||
id: item.id,
|
||||
is_collect: item.is_collect
|
||||
}
|
||||
sheep.$api.school.classesCollect(data).then((res) => {
|
||||
if(res.code == 1) {
|
||||
uni.showToast({
|
||||
title:'已取消收藏',
|
||||
icon:'none',
|
||||
duration: 2000,
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
collectSchoolList.value[index].is_collect = 1
|
||||
const data1 = {
|
||||
id: item.id,
|
||||
is_collect: item.is_collect
|
||||
}
|
||||
sheep.$api.school.classesCollect(data1).then((res) => {
|
||||
if(res.code == 1) {
|
||||
uni.showToast({
|
||||
title:'已收藏',
|
||||
icon:'none',
|
||||
duration: 2000,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onReachBottom(() => {});
|
||||
onLoad(() => {
|
||||
getRentList();
|
||||
@ -319,17 +383,15 @@
|
||||
// background-color: #ffffff;
|
||||
|
||||
.recommend-box {
|
||||
margin-top: 30rpx;
|
||||
padding: 20rpx 30rpx;
|
||||
padding: 0rpx 30rpx;
|
||||
|
||||
.rrecommList {
|
||||
margin-top: 30rpx;
|
||||
// padding: 30rpx;
|
||||
|
||||
.reListItem {
|
||||
background-color: #ffffff;
|
||||
width: 640rpx;
|
||||
height: 190rpx;
|
||||
// height: 190rpx auto;
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
@ -352,15 +414,24 @@
|
||||
}
|
||||
|
||||
.listItem-contents {
|
||||
width: 300rpx;
|
||||
height: auto;
|
||||
margin-left: 20rpx;
|
||||
|
||||
.score-box {
|
||||
// width: 300rpx;
|
||||
display: flex;
|
||||
|
||||
.cate {
|
||||
width: 300rpx;
|
||||
height: 190rpx auto;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
/* 禁止换行 */
|
||||
overflow: hidden;
|
||||
/* 超出部分隐藏 */
|
||||
|
||||
.cate-e {
|
||||
|
||||
@ -371,15 +442,41 @@
|
||||
font-weight: 400;
|
||||
line-height: 22rpx;
|
||||
background-color: rgba(247, 97, 0, 0.2);
|
||||
|
||||
// opacity: 0.2;
|
||||
width: 107rpx;
|
||||
height: 36rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #F76100;
|
||||
//flex-shrink: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cate-e {
|
||||
width: 300rpx;
|
||||
height: 190rpx auto;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
overflow-wrap: break-word;
|
||||
word-break: break-word;
|
||||
white-space: normal;
|
||||
|
||||
.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);
|
||||
width: 107rpx;
|
||||
height: 36rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #F76100;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -387,7 +484,7 @@
|
||||
.cons-third {
|
||||
margin-top: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
@ -399,24 +496,34 @@
|
||||
|
||||
|
||||
.exChangeBox {
|
||||
background-color: #ffffff;
|
||||
// background-color: #ffffff;
|
||||
width: 690rpx;
|
||||
margin: 0 auto;
|
||||
|
||||
.couponsList {
|
||||
width: 100%;
|
||||
padding: 0 30rpx;
|
||||
// padding: 0 30rpx;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-gap: 20rpx;
|
||||
box-sizing: border-box;
|
||||
margin-top: 30rpx;
|
||||
|
||||
|
||||
.list-item {
|
||||
width: 330rpx;
|
||||
border-radius: 18rpx;
|
||||
box-shadow: 4rpx 4rpx 4rpx 4rpx rgba(153, 153, 153, 0.1);
|
||||
background-color: #ffffff;
|
||||
|
||||
.item-text {
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 212rpx;
|
||||
/* 确保 item-text 填满父容器的高度 */
|
||||
justify-content: space-between;
|
||||
/* 将内容分散对齐,顶部和底部 */
|
||||
|
||||
.exchangeBtn {
|
||||
margin-top: 30rpx;
|
||||
@ -433,6 +540,23 @@
|
||||
line-height: 30rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.exchangeBtn1 {
|
||||
margin-top: 30rpx;
|
||||
background-color: #fcc74e;
|
||||
// border: 2rpx solid #999999;
|
||||
height: 70rpx;
|
||||
width: 270rpx;
|
||||
border-radius: 223rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
color: #333333;
|
||||
font-size: 28rpx;
|
||||
line-height: 30rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user