登陆后才能评分,而且要下载后才能评分
This commit is contained in:
parent
7e5e1b4365
commit
a1e7309528
@ -43,8 +43,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<a :href="map.zip_file" class="download-btn" download>下载地图</a>
|
<a :href="map.zip_file" class="download-btn" download @click="handleDownload">下载地图</a>
|
||||||
<a class="score-btn" @click="showScoreDialog = true">地图评分</a>
|
<a class="score-btn" @click="handleScoreClick">地图评分</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -107,6 +107,7 @@
|
|||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { getMapDetail } from '../../api/maps.js'
|
import { getMapDetail } from '../../api/maps.js'
|
||||||
|
import { hasValidToken } from '../../utils/jwt'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -118,6 +119,31 @@ const mapScore = ref(0)
|
|||||||
const authorScore = ref(0)
|
const authorScore = ref(0)
|
||||||
const mapComment = ref('')
|
const mapComment = ref('')
|
||||||
const authorComment = 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 () => {
|
const fetchMapDetail = async () => {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user