|
@@ -1,23 +1,39 @@
|
|
|
<template>
|
|
|
<view class="container">
|
|
|
- <!-- 搜索 -->
|
|
|
- <u-search @search="toSearch" :show-action="false" shape="round" placeholder="搜索您想要的内容"
|
|
|
- v-model="searchForm.keyword"></u-search>
|
|
|
- <!-- tabs -->
|
|
|
- <view class="tabs-container">
|
|
|
- <scroll-view scroll-x="true" style="width:100%;" :scroll-with-animation="true" :show-scrollbar="true">
|
|
|
- <u-tabs style="flex: 1;" :list="tabsList" :is-scroll="true" font-size="24" :bold="false"
|
|
|
- inactive-color="#000000" active-color="#000000" :bar-style="{'background-color': '#2979ff'}"
|
|
|
- :gutter="30" height="45" v-model="currentTab" @change="changeTab"></u-tabs>
|
|
|
- </scroll-view>
|
|
|
- <!-- <u-icon name="list" style="flex: 0 0 auto;padding-left: 20rpx;"></u-icon> -->
|
|
|
+ <view class="header-box">
|
|
|
+ <u-search @search="toSearch" :show-action="false" shape="round" placeholder="搜索您想要的内容"
|
|
|
+ v-model="searchForm.keyword"></u-search>
|
|
|
+ <!-- tabs -->
|
|
|
+ <view class="tabs-container">
|
|
|
+ <scroll-view scroll-x="true" style="width:100%;" :scroll-with-animation="true" :show-scrollbar="true">
|
|
|
+ <u-tabs style="flex: 1;"
|
|
|
+ :list="tabsList"
|
|
|
+ :is-scroll="true"
|
|
|
+ font-size="28"
|
|
|
+ :bold="false"
|
|
|
+ inactive-color="#000000"
|
|
|
+ active-color="#ffffff"
|
|
|
+ :bar-style="{'background-color': '#2979ff'}"
|
|
|
+ :active-item-style="{'background-color': '#2979ff', 'border-radius':'30rpx'}"
|
|
|
+ :gutter="35"
|
|
|
+ height="45"
|
|
|
+ v-model="currentTab"
|
|
|
+ :show-bar="false"
|
|
|
+ duration="0"
|
|
|
+ @change="changeTab"></u-tabs>
|
|
|
+ </scroll-view>
|
|
|
+ <!-- <u-icon name="list" style="flex: 0 0 auto;padding-left: 20rpx;"></u-icon> -->
|
|
|
+ </view>
|
|
|
</view>
|
|
|
+ <!-- 搜索 -->
|
|
|
+
|
|
|
<!-- 列表 -->
|
|
|
<view class="course-list">
|
|
|
- <view v-for="(course,index) in filterCourses" :key="course.id" >
|
|
|
+ <view v-for="(course,index) in filterCourses" :key="course.id">
|
|
|
<view class="course-item">
|
|
|
<view class="course-item-image">
|
|
|
- <image class="course-image" :src="course.thumImg ? course.thumImg : course.cover" mode="aspectFit" @click="toPage(course)"></image>
|
|
|
+ <image class="course-image" :src="course.thumImg ? course.thumImg : course.cover"
|
|
|
+ mode="aspectFit" @click="toPage(course)"></image>
|
|
|
</view>
|
|
|
<view class="course-item-content">
|
|
|
<view class="course-title">
|
|
@@ -43,16 +59,17 @@
|
|
|
</view>
|
|
|
<view v-else style="height: 30rpx;width: 100%;"></view> -->
|
|
|
<!-- 如果没结束 -->
|
|
|
- <view class="func" v-if="course.status !== '2' && course.status !== '3'" @click="toPage(course)">
|
|
|
+ <view class="func" v-if="course.status !== '2' && course.status !== '3'"
|
|
|
+ @click="toPage(course)">
|
|
|
<!-- 如果是免费,直接显示免费 -->
|
|
|
<view v-if="course.viewMode==='1'" class="func-box" style="justify-content: flex-end;">
|
|
|
<view class="button free">免费</view>
|
|
|
</view>
|
|
|
- <view v-else-if="course.viewMode==='2' && isMember" class="func-box" >
|
|
|
+ <view v-else-if="course.viewMode==='2' && isMember" class="func-box">
|
|
|
<view class="price">¥{{ course.price }}元</view>
|
|
|
<view class="button member-free">会员免费</view>
|
|
|
</view>
|
|
|
- <view v-else-if="course.viewMode==='2' && !isMember" class="func-box" >
|
|
|
+ <view v-else-if="course.viewMode==='2' && !isMember" class="func-box">
|
|
|
<view style="flex: 0 0 auto;display: flex;align-items: center;">
|
|
|
<view class="member-free">
|
|
|
会员免费
|
|
@@ -91,13 +108,16 @@
|
|
|
<!-- 如果课程结束了 -->
|
|
|
<view class="func" v-else>
|
|
|
<!-- regType: 0 线下 ;1 线上 -->
|
|
|
- <view v-if="course.regType==='0' && course.status === '2'" class="func-box" style="justify-content: flex-end;">
|
|
|
+ <view v-if="course.regType==='0' && course.status === '2'" class="func-box"
|
|
|
+ style="justify-content: flex-end;">
|
|
|
<view class="button over" @click="toPage(course)">已结束</view>
|
|
|
</view>
|
|
|
- <view v-if="course.regType==='0' && course.status === '3' && !course.actId" class="func-box" style="justify-content: flex-end;">
|
|
|
+ <view v-if="course.regType==='0' && course.status === '3' && !course.actId" class="func-box"
|
|
|
+ style="justify-content: flex-end;">
|
|
|
<view class="button over" @click="toPage(course)">已结束</view>
|
|
|
</view>
|
|
|
- <view v-if="course.regType==='0' && course.status === '3' && course.actId" class="func-box" style="justify-content: flex-end;">
|
|
|
+ <view v-if="course.regType==='0' && course.status === '3' && course.actId" class="func-box"
|
|
|
+ style="justify-content: flex-end;">
|
|
|
<view class="button-long over" @click="toAct(course.actId)">已结束,点击查看活动</view>
|
|
|
</view>
|
|
|
<view v-if="course.regType==='1'" class="func-box" style="justify-content: flex-end;">
|
|
@@ -229,23 +249,23 @@
|
|
|
// 日期格式:xxxx年xx月xx日(星期x)
|
|
|
function getDateWeek(dateStr) {
|
|
|
// 将日期字符串转换为 Date 对象
|
|
|
- const date = new Date(dateStr.replace(/-/g, '/'));
|
|
|
- // 检查日期是否有效
|
|
|
- if (isNaN(date.getTime())) {
|
|
|
- return dateStr; // 如果无效,返回原字符串
|
|
|
- }
|
|
|
- // 获取年月日
|
|
|
- const year = date.getFullYear();
|
|
|
- const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
- const day = String(date.getDate()).padStart(2, '0');
|
|
|
- // 获取星期几
|
|
|
- const weekdays = ['日', '一', '二', '三', '四', '五', '六'];
|
|
|
- const weekday = weekdays[date.getDay()];
|
|
|
- // 获取时分
|
|
|
- const hours = String(date.getHours()).padStart(2, '0');
|
|
|
- const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
|
- // 组合成新格式
|
|
|
- return `${year}-${month}-${day}(星期${weekday}) ${hours}:${minutes}`;
|
|
|
+ const date = new Date(dateStr.replace(/-/g, '/'));
|
|
|
+ // 检查日期是否有效
|
|
|
+ if (isNaN(date.getTime())) {
|
|
|
+ return dateStr; // 如果无效,返回原字符串
|
|
|
+ }
|
|
|
+ // 获取年月日
|
|
|
+ const year = date.getFullYear();
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
+ const day = String(date.getDate()).padStart(2, '0');
|
|
|
+ // 获取星期几
|
|
|
+ const weekdays = ['日', '一', '二', '三', '四', '五', '六'];
|
|
|
+ const weekday = weekdays[date.getDay()];
|
|
|
+ // 获取时分
|
|
|
+ const hours = String(date.getHours()).padStart(2, '0');
|
|
|
+ const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
|
+ // 组合成新格式
|
|
|
+ return `${year}-${month}-${day}(星期${weekday}) ${hours}:${minutes}`;
|
|
|
}
|
|
|
|
|
|
// 切换搜索框下面的tab
|
|
@@ -331,8 +351,8 @@
|
|
|
}
|
|
|
search(searchForm.value.keyword);
|
|
|
}
|
|
|
-
|
|
|
- function toAct(actId){
|
|
|
+
|
|
|
+ function toAct(actId) {
|
|
|
// console.log(actId);
|
|
|
uni.navigateTo({
|
|
|
url: `/pages/dynamic/dynamicDetail/dynamicDetail?id=${actId}`
|
|
@@ -344,30 +364,42 @@
|
|
|
init();
|
|
|
watch(currentTab, (newValue) => {
|
|
|
courseStore.setCurrentTab(newValue); // 如果需要在切换时更新 Pinia 状态
|
|
|
- });
|
|
|
+ });
|
|
|
});
|
|
|
onReachBottom(() => {
|
|
|
loadmore()
|
|
|
})
|
|
|
</script>
|
|
|
-
|
|
|
+<style>
|
|
|
+ ::v-deep(.u-tab-item){
|
|
|
+ margin-right: 40rpx;
|
|
|
+ }
|
|
|
+</style>
|
|
|
<style lang="scss" scoped>
|
|
|
.container {
|
|
|
// padding: 20px;
|
|
|
// width: 100vw;
|
|
|
// overflow: hidden;
|
|
|
+ .header-box{
|
|
|
+ @include topMagnet();
|
|
|
+ background: #ffffff;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.title {
|
|
|
font-size: 48rpx;
|
|
|
margin-bottom: 30rpx;
|
|
|
}
|
|
|
+
|
|
|
.tabs-container {
|
|
|
- padding-top: 20rpx;
|
|
|
- display: flex;
|
|
|
- width: 100%; /* 确保宽度足够 */
|
|
|
- overflow-x: auto; /* 横向滚动 */
|
|
|
- -webkit-overflow-scrolling: touch; /* 在iOS上启用流畅滚动 */
|
|
|
+ padding: 20rpx 0 10rpx;
|
|
|
+ display: flex;
|
|
|
+ width: 100%;
|
|
|
+ /* 确保宽度足够 */
|
|
|
+ overflow-x: auto;
|
|
|
+ /* 横向滚动 */
|
|
|
+ -webkit-overflow-scrolling: touch;
|
|
|
+ /* 在iOS上启用流畅滚动 */
|
|
|
}
|
|
|
|
|
|
.course-item {
|
|
@@ -423,9 +455,11 @@
|
|
|
font-size: $uni-font-size-2;
|
|
|
font-weight: bold;
|
|
|
margin-top: 10rpx;
|
|
|
+
|
|
|
view {
|
|
|
margin-bottom: 0rpx;
|
|
|
}
|
|
|
+
|
|
|
.func-box {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
@@ -437,6 +471,7 @@
|
|
|
text-align: center;
|
|
|
width: 130rpx;
|
|
|
}
|
|
|
+
|
|
|
.button-long {
|
|
|
text-align: center;
|
|
|
width: 270rpx;
|
|
@@ -466,7 +501,8 @@
|
|
|
border-radius: $uni-card-border-radius;
|
|
|
color: $uni-text-color-inverse;
|
|
|
}
|
|
|
- .over{
|
|
|
+
|
|
|
+ .over {
|
|
|
padding: 6rpx 25rpx;
|
|
|
border-radius: $uni-card-border-radius;
|
|
|
color: $uni-text-color-inverse;
|