hookehuyr

refactor: 统一订阅字段为buy_count并优化评价弹窗

将多处订阅字段从subscribers改为buy_count以保持一致性。同时,为ReviewPopup组件添加title属性,使其在不同场景下显示不同的标题,并删除不再使用的CreateReviewPopup组件。
......@@ -5,7 +5,7 @@
<template>
<van-popup :show="show" @update:show="emit('update:show', $event)" position="bottom" round>
<div class="p-4">
<div class="text-lg font-bold text-center mb-4">编辑评价</div>
<div class="text-lg font-bold text-center mb-4">{{ title }}</div>
<div class="flex justify-center mb-4">
<van-rate v-model="score" :size="24" color="#ffd21e" void-icon="star" void-color="#eee" />
</div>
......@@ -34,6 +34,10 @@ const props = defineProps({
initialNote: {
type: String,
default: ''
},
title: {
type: String,
default: '评价'
}
})
......
<!--
* @Date: 2025-03-20 20:36:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-04-15 12:52:27
* @LastEditTime: 2025-04-22 10:17:33
* @FilePath: /mlaj/src/components/ui/CourseCard.vue
* @Description: 文件描述
-->
......@@ -22,11 +22,11 @@
<div class="flex justify-between items-end mt-1">
<div class="text-orange-500 font-semibold">¥{{ course.price || 'N/A' }}</div>
<div class="text-gray-400 text-xs">
{{ course.subscribers || '没字段' }}人订阅
{{ course.buy_count }}人订阅
</div>
</div>
<div class="text-gray-400 text-xs">
已更新{{ course.count }}期 | {{ course.subscribers || '没字段' }}人订阅
已更新{{ course.count }}期 | {{ course.buy_count }}人订阅
</div>
</div>
</router-link>
......
<!--
* @Date: 2025-03-24 16:57:55
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-04-18 14:12:14
* @FilePath: /mlaj/src/components/ui/ReviewPopup.vue
* @Description: 文件描述
-->
<template>
<van-popup
:show="show"
@update:show="emit('update:show', $event)"
position="bottom"
round
>
<div class="p-4">
<div class="text-lg font-bold text-center mb-4">课程评价</div>
<div class="flex justify-center mb-4">
<van-rate
v-model="rating"
:size="24"
color="#ffd21e"
void-icon="star"
void-color="#eee"
/>
</div>
<van-field
v-model="content"
rows="3"
type="textarea"
placeholder="请输入您的评价内容"
class="mb-4"
/>
<div class="flex justify-end">
<van-button
round
type="default"
style="margin-right: 0.5rem"
@click="handleCancel"
>取消</van-button
>
<van-button round type="primary" color="#4CAF50" @click="handleSubmit"
>提交评价</van-button
>
</div>
</div>
</van-popup>
<van-toast v-model:show="show_toast">
<template #message>
{{ message }}
</template>
</van-toast>
</template>
<script setup>
import { ref } from "vue";
const props = defineProps({
show: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:show", "submit"]);
const rating = ref(5);
const content = ref("");
const handleCancel = () => {
emit("update:show", false);
rating.value = 5;
content.value = "";
};
const show_toast = ref(false);
const message = ref("");
const handleSubmit = () => {
if (rating.value === 0) {
show_toast.value = true;
message.value = "请选择评分";
return;
}
if (!content.value.trim()) {
show_toast.value = true;
message.value = "请输入评论内容";
return;
}
emit("submit", {
rating: rating.value,
content: content.value.trim(),
});
// 提交成功后关闭弹窗
handleCancel();
};
</script>
......@@ -39,7 +39,7 @@
<div class="flex justify-between text-xs text-white/80 mt-3">
<div>已更新{{ item.episodes }}期</div>
<div>{{ item.subscribers }}人订阅</div>
<div>{{ item.buy_count }}人订阅</div>
</div>
</div>
</div>
......
......@@ -17,7 +17,7 @@
</div>
<div class="flex justify-between text-xs text-white/80 mt-3">
<div>已更新{{ course?.count || 'N/A' }}期</div>
<div>{{ course?.subscribers || '没有字段' }}人订阅</div>
<div>{{ course?.buy_count }}人订阅</div>
</div>
<div v-if="course?.expireDate" class="text-xs text-white/80 mt-1">
有效期: {{ course?.expireDate || '没有字段' }}
......@@ -213,7 +213,7 @@
</div>
<!-- Review Popup -->
<ReviewPopup v-model:show="showReviewPopup" @submit="handleReviewSubmit" />
<ReviewPopup v-model:show="showReviewPopup" title="立即评价" @submit="handleReviewSubmit" />
</AppLayout>
</template>
......@@ -227,7 +227,6 @@ import { formatDate } from '@/utils/tools'
import AppLayout from '@/components/layout/AppLayout.vue'
import FrostedGlass from '@/components/ui/FrostedGlass.vue'
import CreateReviewPopup from '@/components/ui/CreateReviewPopup.vue'
// 导入接口
import { getCourseDetailAPI, getGroupCommentListAPI, addGroupCommentAPI } from "@/api/course";
......
<!--
* @Date: 2025-03-21 11:33:26
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-04-18 14:55:53
* @LastEditTime: 2025-04-22 10:21:10
* @FilePath: /mlaj/src/views/courses/CourseReviewsPage.vue
* @Description: 文件描述
-->
......@@ -42,7 +42,7 @@
@select="onSelect" />
<!-- Review Edit Popup -->
<ReviewPopup v-model:show="showReviewPopup" :initial-score="currentReview?.score"
<ReviewPopup v-model:show="showReviewPopup" title="编辑评价" :initial-score="currentReview?.score"
:initial-note="currentReview?.note" @submit="handleReviewEdit" />
</AppLayout>
</template>
......