修复若干bug

This commit is contained in:
丁杰 2026-06-04 11:45:11 +08:00
parent fc3bd046e9
commit d8d6be6206
5 changed files with 2125 additions and 1763 deletions

View File

@ -1,212 +1,228 @@
<template> <template>
<view class="brand-card-comp" @click="onClick"> <view class="brand-card-comp" @click="onClick">
<image class="brand-bg" :src="item.bgSrc" mode="aspectFill"></image> <image class="brand-bg" :src="item.bgSrc" mode="aspectFill"></image>
<image class="mask-bg" src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/9bca353c-fa74-407e-a69e-6f5e9aa43955.png" mode="widthFix"></image> <image class="mask-bg"
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/9bca353c-fa74-407e-a69e-6f5e9aa43955.png"
mode="widthFix"></image>
<view class="card-content"> <view class="card-content">
<view class="avatar-wrapper" style="border-color: #F7E5D7;"> <view class="avatar-wrapper" style="border-color: #F7E5D7;">
<image class="avatar-img" :src="item.avatar || 'https://dummyimage.com/100x100/ccc/fff.png&text=logo'"></image> <image class="avatar-img" :src="item.avatar || 'https://dummyimage.com/100x100/ccc/fff.png&text=logo'">
</view> </image>
</view>
<text class="brand-name">{{ item.name }}</text> <text class="brand-name">{{ item.name }}</text>
<view class="tags-container"> <view class="tags-container">
<view <view class="tag-item" v-for="(tag, idx) in displayTags" :key="idx" :style="getTagStyle(tag)">
class="tag-item" <image class="tag-icon" v-if="tag.icon" :src="tag.icon"></image>
v-for="(tag, idx) in displayTags" <text class="tag-text">{{ tag.text }}</text>
:key="idx" </view>
:style="getTagStyle(tag)" </view>
> </view>
<image class="tag-icon" v-if="tag.icon" :src="tag.icon"></image> </view>
<text class="tag-text">{{ tag.text }}</text>
</view>
</view>
</view>
</view>
</template> </template>
<script> <script>
// //
const TAG_LIBRARY = { const TAG_LIBRARY = {
franchise: { // franchise: { //
text: '品牌加盟', text: '品牌加盟',
color: '#8D4C1B ', color: '#8D4C1B ',
borderColor: '#D6CAC0 ', borderColor: '#D6CAC0 ',
icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/60816ae2-92ee-4473-9eca-562e1200dbca.png' icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/60816ae2-92ee-4473-9eca-562e1200dbca.png'
}, },
recruit: { // recruit: { //
text: '学员招募', text: '学员招募',
color: '#E5505F', color: '#E5505F',
borderColor: '#EFCFD2 ', borderColor: '#EFCFD2 ',
icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/fd0699b9-9f3c-4b1e-8693-d0c9ec7eabc3.png' icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/fd0699b9-9f3c-4b1e-8693-d0c9ec7eabc3.png'
}, },
more: { // more: { //
text: '更多详情', text: '更多详情',
color: '#333333', color: '#333333',
borderColor: '#ECECEC', borderColor: '#ECECEC',
icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/cec453ce-f3fc-4881-8f2c-9ec5c61e759c.png' icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/cec453ce-f3fc-4881-8f2c-9ec5c61e759c.png'
} }
} }
export default { export default {
name: 'brand-card', name: 'brand-card',
props: { props: {
// //
item: { item: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
}, },
// key ['franchise', 'recruit'] // key ['franchise', 'recruit']
tagKeys: { tagKeys: {
type: Array, type: Array,
default: null default: null
} }
}, },
computed: { computed: {
// 使 tagKeys item.tags // 使 tagKeys item.tags
displayTags() { displayTags() {
if (this.tagKeys && this.tagKeys.length) { if (this.tagKeys && this.tagKeys.length) {
return this.tagKeys.map(key => TAG_LIBRARY[key]).filter(v => v) return this.tagKeys.map(key => TAG_LIBRARY[key]).filter(v => v)
} }
// item.tags 使 // item.tags 使
if (this.item.tags && Array.isArray(this.item.tags)) { if (this.item.tags && Array.isArray(this.item.tags)) {
return this.item.tags return this.item.tags
} }
return [] return []
}, },
tagsLength() { tagsLength() {
return this.displayTags.length return this.displayTags.length
} }
}, },
methods: { methods: {
// //
onClick() { onClick() {
// 1. emit便 // 1. emit便
this.$emit('click', this.item); this.$emit('click', this.item);
// 2. // 2.
if (this.item && this.item.id) { if (!uni.getStorageSync("accessToken")) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/jingxuan/brand-detail?id=${this.item.id}` url: '/pages/blogPopup/blogPopup'
}); });
} return;
}, }
getTagStyle(tag) {
const len = this.tagsLength // 3.
let sizeStyle = {} if (this.item && this.item.id) {
if (len === 1) { uni.navigateTo({
sizeStyle = { url: `/pages/jingxuan/brand-detail?id=${this.item.id}`
width: '288rpx', });
height: '42rpx', }
padding: '0 12rpx', },
boxSizing: 'border-box' getTagStyle(tag) {
} const len = this.tagsLength
} else if (len === 2) { let sizeStyle = {}
sizeStyle = { if (len === 1) {
width: '134rpx', sizeStyle = {
height: '42rpx', width: '288rpx',
padding: '0 12rpx', height: '42rpx',
boxSizing: 'border-box' padding: '0 12rpx',
} boxSizing: 'border-box'
} }
return { } else if (len === 2) {
...sizeStyle, sizeStyle = {
color: tag.color, width: '134rpx',
borderColor: tag.borderColor height: '42rpx',
} padding: '0 12rpx',
} boxSizing: 'border-box'
} }
}
return {
...sizeStyle,
color: tag.color,
borderColor: tag.borderColor
}
}
}
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.brand-card-comp { .brand-card-comp {
width: 328rpx; width: 328rpx;
height: 339rpx; height: 339rpx;
position: relative; position: relative;
border-radius: 21rpx; border-radius: 21rpx;
overflow: hidden; overflow: hidden;
background-color: #fff; background-color: #fff;
} }
.brand-bg { .brand-bg {
width: 100%; width: 100%;
height: 184rpx; height: 184rpx;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
z-index: 1; z-index: 1;
} }
.mask-bg { .mask-bg {
width: 100%; width: 100%;
height: 251rpx; height: 251rpx;
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
z-index: 2; z-index: 2;
display: block; display: block;
} }
.card-content { .card-content {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
z-index: 3; z-index: 3;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding-bottom: 24rpx; padding-bottom: 24rpx;
} }
.avatar-wrapper { .avatar-wrapper {
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
border-radius: 50%; border-radius: 50%;
border: 2rpx solid; border: 2rpx solid;
background-color: #fff; background-color: #fff;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
margin-top: -38rpx; margin-top: -38rpx;
margin-bottom: 12rpx; margin-bottom: 12rpx;
} }
.avatar-img { .avatar-img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.brand-name { .brand-name {
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: #333333;
line-height: 34rpx; line-height: 34rpx;
margin-bottom: 12rpx; margin-bottom: 12rpx;
} }
.tags-container { .tags-container {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
gap: 20rpx; gap: 20rpx;
flex-wrap: wrap; flex-wrap: wrap;
} }
.tag-item { .tag-item {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 21rpx; border-radius: 21rpx;
border: 1rpx solid; border: 1rpx solid;
background-color: transparent; background-color: transparent;
padding: 7rpx 12rpx; padding: 7rpx 12rpx;
} }
.tag-icon { .tag-icon {
width: 24rpx; width: 24rpx;
height: 22rpx; height: 22rpx;
margin-right: 6rpx; margin-right: 6rpx;
flex-shrink: 0; flex-shrink: 0;
} }
.tag-text { .tag-text {
font-size: 20rpx; font-size: 20rpx;
line-height: 28rpx; line-height: 28rpx;
white-space: nowrap; white-space: nowrap;
margin-top: 4rpx; margin-top: 4rpx;
padding-right: 2rpx; padding-right: 2rpx;
} }
</style> </style>

View File

@ -2,10 +2,8 @@
<view class="skill-item" @click="handleClick"> <view class="skill-item" @click="handleClick">
<view class="cover-box"> <view class="cover-box">
<image class="cover" :src="item.coverSrc" mode="aspectFill"></image> <image class="cover" :src="item.coverSrc" mode="aspectFill"></image>
<image <image v-if="item.video" class="play-icon"
class="play-icon" src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/5c1ddfef-a200-424a-a9dc-03d9395568f6.png"></image>
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/5c1ddfef-a200-424a-a9dc-03d9395568f6.png"
></image>
</view> </view>
<view class="skill-info"> <view class="skill-info">
<view class="skill-title line-2">{{ item.title }}</view> <view class="skill-title line-2">{{ item.title }}</view>
@ -14,10 +12,9 @@
<text class="type-text">{{ item.type || '平台课程' }}</text> <text class="type-text">{{ item.type || '平台课程' }}</text>
</view> </view>
<view class="skill-stats"> <view class="skill-stats">
<image <image class="view-icon"
class="view-icon" src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/2409b64a-56bb-4d9e-a4cc-5b3444fcf097.png">
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/2409b64a-56bb-4d9e-a4cc-5b3444fcf097.png" </image>
></image>
{{ formatViews(item.views) }}观看 · {{ item.time }} {{ formatViews(item.views) }}观看 · {{ item.time }}
</view> </view>
</view> </view>
@ -69,13 +66,20 @@ export default {
// 1. emit便 // 1. emit便
this.$emit('click', this.item); this.$emit('click', this.item);
// 2. // 2.
if (!uni.getStorageSync("accessToken")) {
uni.navigateTo({
url: '/pages/blogPopup/blogPopup'
});
return;
}
// 3.
if (this.item && this.item.id) { if (this.item && this.item.id) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/jingxuan/skill-detail?id=${this.item.id}` url: `/pages/jingxuan/skill-detail?id=${this.item.id}`
}); });
} }
// /
} }
} }
} }
@ -188,5 +192,4 @@ export default {
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
overflow: hidden; overflow: hidden;
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@ -17,39 +17,25 @@
<text>{{ useMockData ? '关闭模拟数据' : '开启模拟数据' }}</text> <text>{{ useMockData ? '关闭模拟数据' : '开启模拟数据' }}</text>
</view> --> </view> -->
<view class="banner-section" v-if="bannerList && bannerList.length || info.video"> <view class="banner-section" v-if="bannerList && bannerList.length">
<!-- 原生视频组件 (就地播放) --> <!-- 轮播图区域 -->
<video v-if="info.video && isVideoPlaying" id="myVideo" class="banner-video" :src="info.video" autoplay controls <swiper class="banner-swiper" circular @change="onSwiperChange" :autoplay="false" :current="currentBannerIndex">
object-fit="cover"></video> <!-- 视频作为第一项 -->
<swiper-item v-if="info.video">
<!-- 轮播图区域 (当视频播放时隐藏) --> <video id="myVideo" class="banner-video" :src="info.video" :autoplay="currentBannerIndex === 0" controls
<swiper v-else class="banner-swiper" circular @change="onSwiperChange" :autoplay="!info.video"> object-fit="cover" :show-center-play-btn="false" :show-play-btn="false" @play="onVideoPlay"
@pause="onVideoPause" @ended="onVideoEnded"></video>
</swiper-item>
<!-- 图片轮播 -->
<swiper-item v-for="(item, index) in bannerList" :key="index"> <swiper-item v-for="(item, index) in bannerList" :key="index">
<image class="banner-img" :src="item" mode="aspectFill"></image> <image class="banner-img" :src="item" mode="aspectFill"></image>
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- 居中的视频播放大图标 (当视频播放时隐藏) --> <!-- 指示器 -->
<image v-if="info.video && !isVideoPlaying" class="center-play-icon" <view class="indicator" v-if="bannerList.length > 0">
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/bb720bb0-4ada-49f6-9ce5-38abfd613d5d.png" <text>{{ currentBannerIndex + 1 }} / {{ totalSlides }}</text>
@click="playVideoInPlace"></image>
<!-- 视频/图片 相册切换组件 (当视频播放时隐藏) -->
<view class="album" v-if="(info.video || bannerList.length > 0) && !isVideoPlaying">
<view class="album-left" @click="info.video ? playVideoInPlace() : goAlbum()">
{{ info.video ? "视频" : "图片" }}
</view>
<view class="album-line"></view>
<view class="album-right" @click="goAlbum">
<view class="album-right-text">相册</view>
<image src="/static/images/icons/right7_13.png" class="album-right-img"></image>
</view>
</view>
<!-- 指示器 (当视频播放时隐藏) -->
<view class="indicator" v-if="!isVideoPlaying && bannerList.length > 0">
<text>{{ currentBannerIndex + 1 }} / {{ bannerList.length }}</text>
</view> </view>
</view> </view>
@ -164,6 +150,27 @@
</view> </view>
</view> </view>
<!-- 拨打电话选择弹窗 -->
<view class="phone-popup" :class="{ show: showPhonePopup }">
<view class="phone-popup-mask" @click="closePhonePopup"></view>
<view class="phone-popup-content">
<view class="phone-popup-header">
<text class="phone-popup-title">拨打电话</text>
</view>
<view class="phone-popup-body">
<view class="phone-option" v-if="info.contact_phone" @click="selectPhone(info.contact_phone)">
<text class="phone-number">{{ info.contact_phone }}</text>
</view>
<view class="phone-option" v-if="info.alternate_phone" @click="selectPhone(info.alternate_phone)">
<text class="phone-number">{{ info.alternate_phone }}</text>
</view>
</view>
<view class="phone-popup-cancel" @click="closePhonePopup">
<text class="cancel-text">取消</text>
</view>
</view>
</view>
<tipsPopup2 :show="tipShow" @closePopup="closePopup" sureText="确认" @okBtn="okBtn"> <tipsPopup2 :show="tipShow" @closePopup="closePopup" sureText="确认" @okBtn="okBtn">
{{ tipsText }} {{ tipsText }}
</tipsPopup2> </tipsPopup2>
@ -196,6 +203,7 @@ export default {
tipShow: false, // tipShow: false, //
tipsText: "", // tipsText: "", //
tipType: "", // tipType: "", //
showPhonePopup: false, //
isCollected: false, // isCollected: false, //
// //
@ -204,7 +212,6 @@ export default {
iconCollectOn: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/fe2011b0-a34d-46ee-911a-0ea6f099ad77.png', iconCollectOn: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/fe2011b0-a34d-46ee-911a-0ea6f099ad77.png',
// ================================== // ==================================
isVideoPlaying: false, //
phoneIconTop: 20, // Top phoneIconTop: 20, // Top
phoneIconRight: 50, // Right phoneIconRight: 50, // Right
@ -296,6 +303,10 @@ export default {
showTabSection() { showTabSection() {
return this.availableTabs.length > 0; return this.availableTabs.length > 0;
}, },
// +
totalSlides() {
return this.bannerList.length + (this.info.video ? 1 : 0);
},
canSubmit() { canSubmit() {
const d = this.formData; const d = this.formData;
const baseValid = d.contact_name && d.contact_phone && d.province_code && d.city_code && d.area_code && d.intention; const baseValid = d.contact_name && d.contact_phone && d.province_code && d.city_code && d.area_code && d.intention;
@ -439,29 +450,69 @@ export default {
// //
makeCall() { makeCall() {
// if (!this.isLogin) {
const phone = this.info.contact_phone || ''; this.tipsText = "您现在还未登录,是否确定登录?";
if (phone) { this.tipShow = true;
uni.makePhoneCall({ this.tipType = "login";
phoneNumber: String(phone), return; //
fail: (err) => { }
console.log('取消拨打或拨打失败', err);
} const contactPhone = this.info.contact_phone || '';
}); const alternatePhone = this.info.alternate_phone || '';
//
if (contactPhone && alternatePhone) {
this.showPhonePopup = true;
} else if (contactPhone) {
//
this.doMakeCall(contactPhone);
} else if (alternatePhone) {
//
this.doMakeCall(alternatePhone);
} else { } else {
uni.showToast({ title: '暂无联系电话', icon: 'none' }); uni.showToast({ title: '暂无联系电话', icon: 'none' });
} }
}, },
//
selectPhone(phone) {
this.closePhonePopup();
this.doMakeCall(phone);
},
//
closePhonePopup() {
this.showPhonePopup = false;
},
//
doMakeCall(phone) {
uni.makePhoneCall({
phoneNumber: String(phone),
fail: (err) => {
console.log('取消拨打或拨打失败', err);
}
});
},
goAlbum() { goAlbum() {
uni.navigateTo({ uni.navigateTo({
url: `/pages/album/index?id=${this.brandId}&user_type=2` url: `/pages/album/index?id=${this.brandId}&user_type=2`
}); });
}, },
// //
playVideoInPlace() { onVideoPlay() {
this.isVideoPlaying = true; console.log('视频开始播放');
},
onVideoPause() {
console.log('视频暂停');
},
onVideoEnded() {
//
if (this.bannerList.length > 0) {
this.currentBannerIndex = 1;
}
}, },
// Mock // Mock
@ -472,7 +523,6 @@ export default {
}, },
getBrandDetails() { getBrandDetails() {
this.isVideoPlaying = false; //
if (this.useMockData) { if (this.useMockData) {
this.injectMockData(); this.injectMockData();
return; return;
@ -1132,4 +1182,100 @@ export default {
.popup-btn.confirm .btn-text { .popup-btn.confirm .btn-text {
color: #FFFFFF; color: #FFFFFF;
} }
/* 拨打电话弹窗样式 */
.phone-popup {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 999;
visibility: hidden;
opacity: 0;
transition: all 0.3s ease;
}
.phone-popup.show {
visibility: visible;
opacity: 1;
}
.phone-popup-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.phone-popup-content {
position: absolute;
left: 0;
right: 0;
bottom: 0;
background-color: #F5F5F5;
border-radius: 24rpx 24rpx 0 0;
transform: translateY(100%);
transition: transform 0.3s ease;
}
.phone-popup.show .phone-popup-content {
transform: translateY(0);
}
.phone-popup-header {
padding: 30rpx;
text-align: center;
background-color: #FFFFFF;
border-radius: 24rpx 24rpx 0 0;
}
.phone-popup-title {
font-size: 32rpx;
font-weight: 500;
color: #333333;
}
.phone-popup-body {
background-color: #FFFFFF;
margin-top: 2rpx;
}
.phone-option {
display: flex;
flex-direction: column;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #EEEEEE;
}
.phone-option:last-child {
border-bottom: none;
}
.phone-label {
font-size: 26rpx;
color: #999999;
margin-bottom: 10rpx;
}
.phone-number {
font-size: 34rpx;
color: #333333;
font-weight: 500;
}
.phone-popup-cancel {
margin-top: 16rpx;
padding: 30rpx;
text-align: center;
background-color: #FFFFFF;
}
.cancel-text {
font-size: 32rpx;
color: #333333;
}
</style> </style>

View File

@ -2,7 +2,8 @@
<view class="collection-page"> <view class="collection-page">
<custom-navbar title="我的收藏" :showBack="true" backgroundColor="#FFFFFF" :show-headle="true" borderBottom="none" <custom-navbar title="我的收藏" :showBack="true" backgroundColor="#FFFFFF" :show-headle="true" borderBottom="none"
headleSrc="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/51ebca5d-95c5-4fb8-8aa3-560a79100d25.png" @onHeadleClick="goToSearch"> headleSrc="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/51ebca5d-95c5-4fb8-8aa3-560a79100d25.png"
@onHeadleClick="goToSearch">
</custom-navbar> </custom-navbar>
<view class="nav-placeholder" :style="{ height: navHeight + 'px' }"></view> <view class="nav-placeholder" :style="{ height: navHeight + 'px' }"></view>
@ -10,18 +11,10 @@
<view class="tab-bar-wrap" :style="{ top: navHeight + 'px' }"> <view class="tab-bar-wrap" :style="{ top: navHeight + 'px' }">
<view class="tab-bar"> <view class="tab-bar">
<view class="tab-items"> <view class="tab-items">
<view <view class="tab-item" :class="{ active: currentTab === 'brand' }" @tap="switchTab('brand')">
class="tab-item"
:class="{ active: currentTab === 'brand' }"
@tap="switchTab('brand')"
>
收藏的品牌 收藏的品牌
</view> </view>
<view <view class="tab-item" :class="{ active: currentTab === 'course' }" @tap="switchTab('course')">
class="tab-item"
:class="{ active: currentTab === 'course' }"
@tap="switchTab('course')"
>
收藏的课程 收藏的课程
</view> </view>
</view> </view>
@ -32,7 +25,8 @@
</view> </view>
</view> </view>
<view class="filter-panel" :class="{ 'show': filterVisible }" :style="{ top: filterTop + 'px' }" catchtouchmove="true"> <view class="filter-panel" :class="{ 'show': filterVisible }" :style="{ top: filterTop + 'px' }"
catchtouchmove="true">
<view class="filter-mask" @tap="closeFilterPanel"></view> <view class="filter-mask" @tap="closeFilterPanel"></view>
<view class="filter-container"> <view class="filter-container">
@ -40,13 +34,8 @@
<view class="filter-group" v-for="group in brandFilterData" :key="group.id"> <view class="filter-group" v-for="group in brandFilterData" :key="group.id">
<view class="group-title">{{ group.title }}</view> <view class="group-title">{{ group.title }}</view>
<view class="pill-list"> <view class="pill-list">
<view <view class="pill-item" v-for="sub in group.children" :key="sub.id"
class="pill-item" :class="{ active: selectedSecondIds.includes(sub.id) }" @tap="toggleSecondSelect(sub.id)">
v-for="sub in group.children"
:key="sub.id"
:class="{ active: selectedSecondIds.includes(sub.id) }"
@tap="toggleSecondSelect(sub.id)"
>
{{ sub.title }} {{ sub.title }}
</view> </view>
</view> </view>
@ -54,18 +43,12 @@
</scroll-view> </scroll-view>
<view v-else class="course-filter"> <view v-else class="course-filter">
<view <view class="course-type-item" :class="{ active: selectedCourseType === 'platform' }"
class="course-type-item" @tap="selectCourseType('platform')">
:class="{ active: selectedCourseType === 'platform' }"
@tap="selectCourseType('platform')"
>
平台课程 平台课程
</view> </view>
<view <view class="course-type-item" :class="{ active: selectedCourseType === 'brand' }"
class="course-type-item" @tap="selectCourseType('brand')">
:class="{ active: selectedCourseType === 'brand' }"
@tap="selectCourseType('brand')"
>
品牌课程 品牌课程
</view> </view>
</view> </view>
@ -79,30 +62,24 @@
<view class="collection-content" v-if="currentTab === 'brand'"> <view class="collection-content" v-if="currentTab === 'brand'">
<view class="brand-grid" v-if="filteredBrandList.length > 0"> <view class="brand-grid" v-if="filteredBrandList.length > 0">
<brand-card <brand-card class="brand-card-wrap" v-for="(item, index) in filteredBrandList" :key="index" :item="item"
class="brand-card-wrap" :tagKeys="item.tagKeys" @click="goToBrandDetail(item)"></brand-card>
v-for="(item, index) in filteredBrandList"
:key="index"
:item="item"
:tagKeys="item.tagKeys"
@click="goToBrandDetail(item)"
></brand-card>
</view> </view>
<view class="empty-state" v-else> <view class="empty-state" v-else>
<image class="empty-icon" src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/da814ede-1adc-4f90-8cdf-5357a12fab27.png"></image> <image class="empty-icon"
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/da814ede-1adc-4f90-8cdf-5357a12fab27.png">
</image>
</view> </view>
</view> </view>
<view class="collection-content" v-else> <view class="collection-content" v-else>
<view class="course-list" v-if="filteredCourseList.length > 0"> <view class="course-list" v-if="filteredCourseList.length > 0">
<skill-card <skill-card v-for="(item, index) in filteredCourseList" :key="index" :item="item"></skill-card>
v-for="(item, index) in filteredCourseList"
:key="index"
:item="item"
></skill-card>
</view> </view>
<view class="empty-state" v-else> <view class="empty-state" v-else>
<image class="empty-icon" src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/da814ede-1adc-4f90-8cdf-5357a12fab27.png"></image> <image class="empty-icon"
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/da814ede-1adc-4f90-8cdf-5357a12fab27.png">
</image>
</view> </view>
</view> </view>
@ -170,9 +147,9 @@ export default {
// //
goToSearch() { goToSearch() {
// this.currentTab 'brand' 'course' // this.currentTab 'brand' 'course'
uni.navigateTo({ uni.navigateTo({
url: `/pages/search_common/search?type=collection_${this.currentTab}` url: `/pages/search_common/search?type=collection_${this.currentTab}`
}); });
}, },
goBack() { goBack() {
uni.navigateBack() uni.navigateBack()
@ -216,7 +193,7 @@ export default {
title: first.title, title: first.title,
children: ((subRes.code === 200 || subRes.state === 1) && subRes.data) ? subRes.data : [] children: ((subRes.code === 200 || subRes.state === 1) && subRes.data) ? subRes.data : []
} }
} catch(e) { } catch (e) {
return { id: first.id, title: first.title, children: [] } return { id: first.id, title: first.title, children: [] }
} }
}); });
@ -243,9 +220,9 @@ export default {
// //
selectCourseType(type) { selectCourseType(type) {
// //
if(this.selectedCourseType === type){ if (this.selectedCourseType === type) {
this.selectedCourseType = '' this.selectedCourseType = ''
}else{ } else {
this.selectedCourseType = type this.selectedCourseType = type
} }
}, },
@ -445,7 +422,8 @@ export default {
/* 将页面左右 padding 转移到内容区,保证 Tab 背景贯穿全屏 */ /* 将页面左右 padding 转移到内容区,保证 Tab 背景贯穿全屏 */
.tab-bar-wrap { .tab-bar-wrap {
position: sticky; /* 吸顶,保证滑动页面时一直显示在最前面 */ position: sticky;
/* 吸顶,保证滑动页面时一直显示在最前面 */
background: #fff; background: #fff;
padding: 10rpx 24rpx; padding: 10rpx 24rpx;
z-index: 101; z-index: 101;
@ -476,7 +454,7 @@ export default {
color: #FF4767; color: #FF4767;
background: #FFECEF; background: #FFECEF;
border: 1rpx solid #FFB0BD; border: 1rpx solid #FFB0BD;
border-radius: 29rpx; border-radius: 29rpx;
} }
} }
} }
@ -496,6 +474,7 @@ export default {
width: 16rpx; width: 16rpx;
height: 10rpx; height: 10rpx;
transition: transform 0.3s ease; transition: transform 0.3s ease;
/* 展开时图标倒转 */ /* 展开时图标倒转 */
&.rotate { &.rotate {
transform: rotate(180deg); transform: rotate(180deg);
@ -510,39 +489,52 @@ export default {
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
z-index: 100; /* 低于 Tab区的101保证隐藏时躲在其后 */ z-index: 100;
pointer-events: none; /* 面板关闭时,穿透点击到底部列表 */ /* 低于 Tab区的101保证隐藏时躲在其后 */
overflow: hidden; /* 防止抽屉向上滑出时外溢 */ pointer-events: none;
/* 面板关闭时,穿透点击到底部列表 */
overflow: hidden;
/* 防止抽屉向上滑出时外溢 */
&.show { &.show {
pointer-events: auto; /* 打开时恢复点击拦截 */ pointer-events: auto;
/* 打开时恢复点击拦截 */
.filter-mask { .filter-mask {
opacity: 1; opacity: 1;
} }
.filter-container { .filter-container {
transform: translateY(50rpx); /* 滑出 */ transform: translateY(50rpx);
/* 滑出 */
} }
} }
.filter-mask { .filter-mask {
position: absolute; position: absolute;
top: 0; left: 0; right: 0; bottom: 0; top: 0;
background: rgba(0,0,0,0.4); left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.4);
opacity: 0; opacity: 0;
transition: opacity 0.3s ease-in-out; transition: opacity 0.3s ease-in-out;
} }
.filter-container { .filter-container {
position: absolute; position: absolute;
top: 0; left: 0; right: 0; top: 0;
left: 0;
right: 0;
background: #fff; background: #fff;
border-radius: 0 0 30rpx 30rpx; border-radius: 0 0 30rpx 30rpx;
padding: 40rpx 30rpx; padding: 40rpx 30rpx;
max-height: 80vh; max-height: 80vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
box-shadow: 0 10rpx 20rpx rgba(0,0,0,0.05); box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.05);
transform: translateY(-100%); /* 默认隐藏在上方即Tab背后 */ transform: translateY(-100%);
/* 默认隐藏在上方即Tab背后 */
transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
} }
} }
@ -551,14 +543,15 @@ export default {
.filter-scroll { .filter-scroll {
max-height: 50vh; max-height: 50vh;
} }
.filter-group { .filter-group {
margin-bottom: 30rpx; margin-bottom: 30rpx;
.group-title { .group-title {
font-weight: 500; font-weight: 500;
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
line-height: 40rpx; line-height: 40rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
@ -571,13 +564,14 @@ export default {
/* 通用胶囊按钮 */ /* 通用胶囊按钮 */
.pill-item { .pill-item {
width: calc(25% - 16rpx); /* 25%是一行四个,减去间距 */ width: calc(25% - 16rpx);
/* 25%是一行四个,减去间距 */
height: 58rpx; height: 58rpx;
background: #F5F5F5; background: #F5F5F5;
font-weight: 400; font-weight: 400;
font-size: 26rpx; font-size: 26rpx;
color: #333333; color: #333333;
line-height: 37rpx; line-height: 37rpx;
/* 使用 flex 居中 */ /* 使用 flex 居中 */
display: flex; display: flex;
@ -586,7 +580,8 @@ export default {
border-radius: 12rpx; border-radius: 12rpx;
transition: all 0.3s; transition: all 0.3s;
box-sizing: border-box; /* 防止 padding 会撑大盒子 */ box-sizing: border-box;
/* 防止 padding 会撑大盒子 */
&.active { &.active {
background: #FFF0F2; background: #FFF0F2;
@ -621,7 +616,8 @@ export default {
padding-top: 20rpx; padding-top: 20rpx;
/* border-top: 1rpx solid #F5F5F5; */ /* border-top: 1rpx solid #F5F5F5; */
.reset-btn, .confirm-btn { .reset-btn,
.confirm-btn {
width: 47%; width: 47%;
text-align: center; text-align: center;
padding: 20rpx 0; padding: 20rpx 0;
@ -676,7 +672,7 @@ export default {
} }
::v-deep .icon-headle { ::v-deep .icon-headle {
width: 32rpx !important; width: 32rpx !important;
height: 32rpx !important; height: 32rpx !important;
} }
</style> </style>