refactor: 统一订阅字段为buy_count并优化评价弹窗
将多处订阅字段从subscribers改为buy_count以保持一致性。同时,为ReviewPopup组件添加title属性,使其在不同场景下显示不同的标题,并删除不再使用的CreateReviewPopup组件。
Showing
6 changed files
with
13 additions
and
107 deletions
| ... | @@ -5,7 +5,7 @@ | ... | @@ -5,7 +5,7 @@ |
| 5 | <template> | 5 | <template> |
| 6 | <van-popup :show="show" @update:show="emit('update:show', $event)" position="bottom" round> | 6 | <van-popup :show="show" @update:show="emit('update:show', $event)" position="bottom" round> |
| 7 | <div class="p-4"> | 7 | <div class="p-4"> |
| 8 | - <div class="text-lg font-bold text-center mb-4">编辑评价</div> | 8 | + <div class="text-lg font-bold text-center mb-4">{{ title }}</div> |
| 9 | <div class="flex justify-center mb-4"> | 9 | <div class="flex justify-center mb-4"> |
| 10 | <van-rate v-model="score" :size="24" color="#ffd21e" void-icon="star" void-color="#eee" /> | 10 | <van-rate v-model="score" :size="24" color="#ffd21e" void-icon="star" void-color="#eee" /> |
| 11 | </div> | 11 | </div> |
| ... | @@ -34,6 +34,10 @@ const props = defineProps({ | ... | @@ -34,6 +34,10 @@ const props = defineProps({ |
| 34 | initialNote: { | 34 | initialNote: { |
| 35 | type: String, | 35 | type: String, |
| 36 | default: '' | 36 | default: '' |
| 37 | + }, | ||
| 38 | + title: { | ||
| 39 | + type: String, | ||
| 40 | + default: '评价' | ||
| 37 | } | 41 | } |
| 38 | }) | 42 | }) |
| 39 | 43 | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-03-20 20:36:36 | 2 | * @Date: 2025-03-20 20:36:36 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-04-15 12:52:27 | 4 | + * @LastEditTime: 2025-04-22 10:17:33 |
| 5 | * @FilePath: /mlaj/src/components/ui/CourseCard.vue | 5 | * @FilePath: /mlaj/src/components/ui/CourseCard.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -22,11 +22,11 @@ | ... | @@ -22,11 +22,11 @@ |
| 22 | <div class="flex justify-between items-end mt-1"> | 22 | <div class="flex justify-between items-end mt-1"> |
| 23 | <div class="text-orange-500 font-semibold">¥{{ course.price || 'N/A' }}</div> | 23 | <div class="text-orange-500 font-semibold">¥{{ course.price || 'N/A' }}</div> |
| 24 | <div class="text-gray-400 text-xs"> | 24 | <div class="text-gray-400 text-xs"> |
| 25 | - {{ course.subscribers || '没字段' }}人订阅 | 25 | + {{ course.buy_count }}人订阅 |
| 26 | </div> | 26 | </div> |
| 27 | </div> | 27 | </div> |
| 28 | <div class="text-gray-400 text-xs"> | 28 | <div class="text-gray-400 text-xs"> |
| 29 | - 已更新{{ course.count }}期 | {{ course.subscribers || '没字段' }}人订阅 | 29 | + 已更新{{ course.count }}期 | {{ course.buy_count }}人订阅 |
| 30 | </div> | 30 | </div> |
| 31 | </div> | 31 | </div> |
| 32 | </router-link> | 32 | </router-link> | ... | ... |
| 1 | -<!-- | ||
| 2 | - * @Date: 2025-03-24 16:57:55 | ||
| 3 | - * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | - * @LastEditTime: 2025-04-18 14:12:14 | ||
| 5 | - * @FilePath: /mlaj/src/components/ui/ReviewPopup.vue | ||
| 6 | - * @Description: 文件描述 | ||
| 7 | ---> | ||
| 8 | -<template> | ||
| 9 | - <van-popup | ||
| 10 | - :show="show" | ||
| 11 | - @update:show="emit('update:show', $event)" | ||
| 12 | - position="bottom" | ||
| 13 | - round | ||
| 14 | - > | ||
| 15 | - <div class="p-4"> | ||
| 16 | - <div class="text-lg font-bold text-center mb-4">课程评价</div> | ||
| 17 | - <div class="flex justify-center mb-4"> | ||
| 18 | - <van-rate | ||
| 19 | - v-model="rating" | ||
| 20 | - :size="24" | ||
| 21 | - color="#ffd21e" | ||
| 22 | - void-icon="star" | ||
| 23 | - void-color="#eee" | ||
| 24 | - /> | ||
| 25 | - </div> | ||
| 26 | - <van-field | ||
| 27 | - v-model="content" | ||
| 28 | - rows="3" | ||
| 29 | - type="textarea" | ||
| 30 | - placeholder="请输入您的评价内容" | ||
| 31 | - class="mb-4" | ||
| 32 | - /> | ||
| 33 | - <div class="flex justify-end"> | ||
| 34 | - <van-button | ||
| 35 | - round | ||
| 36 | - type="default" | ||
| 37 | - style="margin-right: 0.5rem" | ||
| 38 | - @click="handleCancel" | ||
| 39 | - >取消</van-button | ||
| 40 | - > | ||
| 41 | - <van-button round type="primary" color="#4CAF50" @click="handleSubmit" | ||
| 42 | - >提交评价</van-button | ||
| 43 | - > | ||
| 44 | - </div> | ||
| 45 | - </div> | ||
| 46 | - </van-popup> | ||
| 47 | - | ||
| 48 | - <van-toast v-model:show="show_toast"> | ||
| 49 | - <template #message> | ||
| 50 | - {{ message }} | ||
| 51 | - </template> | ||
| 52 | - </van-toast> | ||
| 53 | -</template> | ||
| 54 | - | ||
| 55 | -<script setup> | ||
| 56 | -import { ref } from "vue"; | ||
| 57 | - | ||
| 58 | -const props = defineProps({ | ||
| 59 | - show: { | ||
| 60 | - type: Boolean, | ||
| 61 | - default: false, | ||
| 62 | - }, | ||
| 63 | -}); | ||
| 64 | - | ||
| 65 | -const emit = defineEmits(["update:show", "submit"]); | ||
| 66 | - | ||
| 67 | -const rating = ref(5); | ||
| 68 | -const content = ref(""); | ||
| 69 | - | ||
| 70 | -const handleCancel = () => { | ||
| 71 | - emit("update:show", false); | ||
| 72 | - rating.value = 5; | ||
| 73 | - content.value = ""; | ||
| 74 | -}; | ||
| 75 | - | ||
| 76 | -const show_toast = ref(false); | ||
| 77 | -const message = ref(""); | ||
| 78 | - | ||
| 79 | -const handleSubmit = () => { | ||
| 80 | - if (rating.value === 0) { | ||
| 81 | - show_toast.value = true; | ||
| 82 | - message.value = "请选择评分"; | ||
| 83 | - return; | ||
| 84 | - } | ||
| 85 | - if (!content.value.trim()) { | ||
| 86 | - show_toast.value = true; | ||
| 87 | - message.value = "请输入评论内容"; | ||
| 88 | - return; | ||
| 89 | - } | ||
| 90 | - emit("submit", { | ||
| 91 | - rating: rating.value, | ||
| 92 | - content: content.value.trim(), | ||
| 93 | - }); | ||
| 94 | - // 提交成功后关闭弹窗 | ||
| 95 | - handleCancel(); | ||
| 96 | -}; | ||
| 97 | -</script> |
| ... | @@ -39,7 +39,7 @@ | ... | @@ -39,7 +39,7 @@ |
| 39 | 39 | ||
| 40 | <div class="flex justify-between text-xs text-white/80 mt-3"> | 40 | <div class="flex justify-between text-xs text-white/80 mt-3"> |
| 41 | <div>已更新{{ item.episodes }}期</div> | 41 | <div>已更新{{ item.episodes }}期</div> |
| 42 | - <div>{{ item.subscribers }}人订阅</div> | 42 | + <div>{{ item.buy_count }}人订阅</div> |
| 43 | </div> | 43 | </div> |
| 44 | </div> | 44 | </div> |
| 45 | </div> | 45 | </div> | ... | ... |
| ... | @@ -17,7 +17,7 @@ | ... | @@ -17,7 +17,7 @@ |
| 17 | </div> | 17 | </div> |
| 18 | <div class="flex justify-between text-xs text-white/80 mt-3"> | 18 | <div class="flex justify-between text-xs text-white/80 mt-3"> |
| 19 | <div>已更新{{ course?.count || 'N/A' }}期</div> | 19 | <div>已更新{{ course?.count || 'N/A' }}期</div> |
| 20 | - <div>{{ course?.subscribers || '没有字段' }}人订阅</div> | 20 | + <div>{{ course?.buy_count }}人订阅</div> |
| 21 | </div> | 21 | </div> |
| 22 | <div v-if="course?.expireDate" class="text-xs text-white/80 mt-1"> | 22 | <div v-if="course?.expireDate" class="text-xs text-white/80 mt-1"> |
| 23 | 有效期: {{ course?.expireDate || '没有字段' }} | 23 | 有效期: {{ course?.expireDate || '没有字段' }} |
| ... | @@ -213,7 +213,7 @@ | ... | @@ -213,7 +213,7 @@ |
| 213 | </div> | 213 | </div> |
| 214 | 214 | ||
| 215 | <!-- Review Popup --> | 215 | <!-- Review Popup --> |
| 216 | - <ReviewPopup v-model:show="showReviewPopup" @submit="handleReviewSubmit" /> | 216 | + <ReviewPopup v-model:show="showReviewPopup" title="立即评价" @submit="handleReviewSubmit" /> |
| 217 | </AppLayout> | 217 | </AppLayout> |
| 218 | </template> | 218 | </template> |
| 219 | 219 | ||
| ... | @@ -227,7 +227,6 @@ import { formatDate } from '@/utils/tools' | ... | @@ -227,7 +227,6 @@ import { formatDate } from '@/utils/tools' |
| 227 | 227 | ||
| 228 | import AppLayout from '@/components/layout/AppLayout.vue' | 228 | import AppLayout from '@/components/layout/AppLayout.vue' |
| 229 | import FrostedGlass from '@/components/ui/FrostedGlass.vue' | 229 | import FrostedGlass from '@/components/ui/FrostedGlass.vue' |
| 230 | -import CreateReviewPopup from '@/components/ui/CreateReviewPopup.vue' | ||
| 231 | 230 | ||
| 232 | // 导入接口 | 231 | // 导入接口 |
| 233 | import { getCourseDetailAPI, getGroupCommentListAPI, addGroupCommentAPI } from "@/api/course"; | 232 | import { getCourseDetailAPI, getGroupCommentListAPI, addGroupCommentAPI } from "@/api/course"; | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-03-21 11:33:26 | 2 | * @Date: 2025-03-21 11:33:26 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-04-18 14:55:53 | 4 | + * @LastEditTime: 2025-04-22 10:21:10 |
| 5 | * @FilePath: /mlaj/src/views/courses/CourseReviewsPage.vue | 5 | * @FilePath: /mlaj/src/views/courses/CourseReviewsPage.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -42,7 +42,7 @@ | ... | @@ -42,7 +42,7 @@ |
| 42 | @select="onSelect" /> | 42 | @select="onSelect" /> |
| 43 | 43 | ||
| 44 | <!-- Review Edit Popup --> | 44 | <!-- Review Edit Popup --> |
| 45 | - <ReviewPopup v-model:show="showReviewPopup" :initial-score="currentReview?.score" | 45 | + <ReviewPopup v-model:show="showReviewPopup" title="编辑评价" :initial-score="currentReview?.score" |
| 46 | :initial-note="currentReview?.note" @submit="handleReviewEdit" /> | 46 | :initial-note="currentReview?.note" @submit="handleReviewEdit" /> |
| 47 | </AppLayout> | 47 | </AppLayout> |
| 48 | </template> | 48 | </template> | ... | ... |
-
Please register or login to post a comment