登陆后才能评分,而且要下载后才能评分

This commit is contained in:
Kunagisa 2025-06-09 22:58:23 +08:00
parent 7e5e1b4365
commit a1e7309528

View File

@ -43,8 +43,8 @@
</div>
<div class="actions">
<a :href="map.zip_file" class="download-btn" download>下载地图</a>
<a class="score-btn" @click="showScoreDialog = true">地图评分</a>
<a :href="map.zip_file" class="download-btn" download @click="handleDownload">下载地图</a>
<a class="score-btn" @click="handleScoreClick">地图评分</a>
</div>
</div>
</div>
@ -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 {