2026-05-26 18:06:07 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="skill-item" @click="handleClick">
|
|
|
|
|
|
<view class="cover-box">
|
|
|
|
|
|
<image class="cover" :src="item.coverSrc" mode="aspectFill"></image>
|
2026-06-04 11:45:11 +08:00
|
|
|
|
<image v-if="item.video" class="play-icon"
|
|
|
|
|
|
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/5c1ddfef-a200-424a-a9dc-03d9395568f6.png"></image>
|
2026-05-26 18:06:07 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<view class="skill-info">
|
|
|
|
|
|
<view class="skill-title line-2">{{ item.title }}</view>
|
|
|
|
|
|
<view class="skill-type" :class="typeClass">
|
|
|
|
|
|
<image class="type-icon" :src="item.typeIcon || defaultTypeIcon"></image>
|
|
|
|
|
|
<text class="type-text">{{ item.type || '平台课程' }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="skill-stats">
|
2026-06-04 11:45:11 +08:00
|
|
|
|
<image class="view-icon"
|
|
|
|
|
|
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/2409b64a-56bb-4d9e-a4cc-5b3444fcf097.png">
|
|
|
|
|
|
</image>
|
2026-05-26 18:06:07 +08:00
|
|
|
|
{{ formatViews(item.views) }}观看 · {{ item.time }}
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'SkillItem',
|
|
|
|
|
|
props: {
|
|
|
|
|
|
item: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
default: () => ({
|
|
|
|
|
|
id: null,
|
|
|
|
|
|
title: '',
|
|
|
|
|
|
coverSrc: '',
|
|
|
|
|
|
type: '平台课程',
|
|
|
|
|
|
views: 0,
|
|
|
|
|
|
time: '',
|
|
|
|
|
|
typeIcon: ''
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
defaultTypeIcon: 'https://dummyimage.com/30x30/ccc/fff.png&text=I' // 用于占位
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
typeClass() {
|
|
|
|
|
|
const typeMap = {
|
|
|
|
|
|
'平台课程': 'platform-course',
|
|
|
|
|
|
'脸缘品牌': 'brand-course',
|
|
|
|
|
|
'品牌课程': 'brand-course'
|
|
|
|
|
|
}
|
|
|
|
|
|
return typeMap[this.item.type] || 'platform-course'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
formatViews(views) {
|
|
|
|
|
|
if (!views) return '0'
|
|
|
|
|
|
if (views >= 10000) {
|
|
|
|
|
|
return (views / 10000).toFixed(1) + 'w'
|
|
|
|
|
|
}
|
|
|
|
|
|
return views.toString()
|
|
|
|
|
|
},
|
|
|
|
|
|
handleClick() {
|
2026-05-29 13:50:58 +08:00
|
|
|
|
// 1. 保留 emit,方便外层如果有特殊需求可以监听到
|
|
|
|
|
|
this.$emit('click', this.item);
|
2026-06-04 11:45:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 2. 检查登录状态
|
|
|
|
|
|
if (!uni.getStorageSync("accessToken")) {
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: '/pages/blogPopup/blogPopup'
|
|
|
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 3. 直接在此处处理跳转逻辑
|
2026-05-29 13:50:58 +08:00
|
|
|
|
if (this.item && this.item.id) {
|
2026-05-26 18:06:07 +08:00
|
|
|
|
uni.navigateTo({
|
2026-05-29 13:50:58 +08:00
|
|
|
|
url: `/pages/jingxuan/skill-detail?id=${this.item.id}`
|
|
|
|
|
|
});
|
2026-05-26 18:06:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.skill-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
margin-bottom: 20rpx;
|
2026-06-04 11:45:11 +08:00
|
|
|
|
|
2026-05-26 18:06:07 +08:00
|
|
|
|
&:last-child {
|
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.cover-box {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
width: 224rpx;
|
|
|
|
|
|
height: 126rpx;
|
|
|
|
|
|
border-radius: 16rpx;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
margin-right: 24rpx;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
|
2026-06-04 11:45:11 +08:00
|
|
|
|
.cover {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
2026-05-26 18:06:07 +08:00
|
|
|
|
}
|
2026-06-04 11:45:11 +08:00
|
|
|
|
|
2026-05-26 18:06:07 +08:00
|
|
|
|
.play-icon {
|
|
|
|
|
|
position: absolute;
|
2026-06-04 11:45:11 +08:00
|
|
|
|
top: 50%;
|
2026-05-26 18:06:07 +08:00
|
|
|
|
left: 50%;
|
|
|
|
|
|
transform: translate(-50%, -50%);
|
2026-06-04 11:45:11 +08:00
|
|
|
|
width: 39rpx;
|
2026-05-26 18:06:07 +08:00
|
|
|
|
height: 39rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.skill-info {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
|
|
.skill-title {
|
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
|
|
-webkit-line-clamp: 1;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
line-height: 40rpx;
|
|
|
|
|
|
}
|
2026-06-04 11:45:11 +08:00
|
|
|
|
|
2026-05-26 18:06:07 +08:00
|
|
|
|
.skill-type {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
|
margin-top: 10rpx;
|
2026-06-04 11:45:11 +08:00
|
|
|
|
|
|
|
|
|
|
.type-icon {
|
2026-06-05 13:09:01 +08:00
|
|
|
|
border: 1rpx solid #D6CAC0;
|
2026-06-04 11:45:11 +08:00
|
|
|
|
width: 26rpx;
|
|
|
|
|
|
height: 26rpx;
|
|
|
|
|
|
margin-right: 8rpx;
|
2026-05-26 18:06:07 +08:00
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
}
|
2026-06-04 11:45:11 +08:00
|
|
|
|
|
2026-05-26 18:06:07 +08:00
|
|
|
|
.type-text {
|
|
|
|
|
|
border-radius: 7rpx;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
line-height: 33rpx;
|
|
|
|
|
|
padding: 2rpx 10rpx;
|
|
|
|
|
|
}
|
2026-06-04 11:45:11 +08:00
|
|
|
|
|
2026-05-26 18:06:07 +08:00
|
|
|
|
&.platform-course .type-text {
|
|
|
|
|
|
background: #f9d3d760;
|
|
|
|
|
|
color: #E55463;
|
|
|
|
|
|
}
|
2026-06-04 11:45:11 +08:00
|
|
|
|
|
2026-05-26 18:06:07 +08:00
|
|
|
|
&.brand-course .type-text {
|
2026-06-01 13:54:01 +08:00
|
|
|
|
background: #f9d3d760;
|
|
|
|
|
|
color: #E55463;
|
2026-05-26 18:06:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-06-04 11:45:11 +08:00
|
|
|
|
|
2026-05-26 18:06:07 +08:00
|
|
|
|
.skill-stats {
|
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
margin-top: 10rpx;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-06-04 11:45:11 +08:00
|
|
|
|
|
2026-05-26 18:06:07 +08:00
|
|
|
|
.view-icon {
|
|
|
|
|
|
width: 26rpx;
|
|
|
|
|
|
height: 22rpx;
|
|
|
|
|
|
margin-right: 8rpx;
|
|
|
|
|
|
margin-top: -2rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.line-2 {
|
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
|
|
-webkit-line-clamp: 2;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|