diff --git a/src/views/index/MapDetail.vue b/src/views/index/MapDetail.vue index 6603f16..67df520 100644 --- a/src/views/index/MapDetail.vue +++ b/src/views/index/MapDetail.vue @@ -43,8 +43,8 @@
- 下载地图 - 地图评分 + 下载地图 + 地图评分
@@ -107,6 +107,7 @@ import { ref, onMounted } from 'vue' import { useRoute, useRouter } from 'vue-router' import { getMapDetail } from '../../api/maps.js' +import { hasValidToken } from '../../utils/jwt' const route = useRoute() const router = useRouter() @@ -118,6 +119,31 @@ const mapScore = ref(0) const authorScore = ref(0) const mapComment = ref('') const authorComment = ref('') +const hasDownloaded = ref(false) + +// 处理下载点击 +const handleDownload = () => { + hasDownloaded.value = true +} + +// 处理评分点击 +const handleScoreClick = () => { + if (!hasValidToken()) { + alert('请先登录后再进行评分') + router.push({ + path: '/backend/login', + query: { redirect: route.fullPath } + }) + return + } + + if (!hasDownloaded.value) { + alert('请先下载地图后再进行评分') + return + } + + showScoreDialog.value = true +} const fetchMapDetail = async () => { try {