diff --git a/src/views/index/MapDetail.vue b/src/views/index/MapDetail.vue
index 2d33b4d..6603f16 100644
--- a/src/views/index/MapDetail.vue
+++ b/src/views/index/MapDetail.vue
@@ -44,7 +44,59 @@
+
+
+
+
+
@@ -60,6 +112,13 @@ const route = useRoute()
const router = useRouter()
const map = ref(null)
+// 评分相关的响应式变量
+const showScoreDialog = ref(false)
+const mapScore = ref(0)
+const authorScore = ref(0)
+const mapComment = ref('')
+const authorComment = ref('')
+
const fetchMapDetail = async () => {
try {
map.value = await getMapDetail(route.params.id)
@@ -76,6 +135,36 @@ const formatDate = (dateString) => {
return new Date(dateString).toLocaleDateString('zh-CN')
}
+// 提交评分
+const submitScores = async () => {
+ if (mapScore.value === 0 || authorScore.value === 0) {
+ alert('请为地图和作者都进行评分')
+ return
+ }
+
+ try {
+ // TODO: 调用评分 API
+ console.log('提交评分:', {
+ mapScore: mapScore.value,
+ authorScore: authorScore.value,
+ mapComment: mapComment.value,
+ authorComment: authorComment.value
+ })
+
+ // 关闭弹窗并重置表单
+ showScoreDialog.value = false
+ mapScore.value = 0
+ authorScore.value = 0
+ mapComment.value = ''
+ authorComment.value = ''
+
+ alert('评分成功!')
+ } catch (error) {
+ console.error('评分失败:', error)
+ alert('评分失败,请稍后重试')
+ }
+}
+
onMounted(() => {
fetchMapDetail()
})
@@ -263,4 +352,146 @@ onMounted(() => {
font-size: 0.85rem;
}
}
+
+/* 评分弹窗样式 */
+.dialog-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, 0.5);
+ z-index: 100;
+}
+
+.dialog-content {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ background: white;
+ padding: 20px;
+ border-radius: 8px;
+ width: 90%;
+ max-width: 500px;
+ z-index: 101;
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
+}
+
+.dialog-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20px;
+ padding-bottom: 10px;
+ border-bottom: 1px solid #eee;
+}
+
+.dialog-header h2 {
+ margin: 0;
+ font-size: 1.25rem;
+ color: #333;
+}
+
+.close-btn {
+ background: none;
+ border: none;
+ font-size: 1.5rem;
+ cursor: pointer;
+ color: #666;
+ padding: 0 5px;
+}
+
+.score-section {
+ margin-bottom: 20px;
+}
+
+.score-section h3 {
+ margin: 0 0 10px;
+ font-size: 1rem;
+ color: #444;
+}
+
+.rating {
+ display: flex;
+ gap: 8px;
+ margin-bottom: 10px;
+}
+
+.star {
+ font-size: 24px;
+ cursor: pointer;
+ color: #ddd;
+ transition: color 0.2s;
+}
+
+.star:hover,
+.star.active {
+ color: #ffd700;
+}
+
+.comment-input {
+ width: 100%;
+ height: 80px;
+ padding: 8px;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+ resize: vertical;
+ font-size: 14px;
+ margin-top: 10px;
+}
+
+.dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ gap: 10px;
+ margin-top: 20px;
+ padding-top: 15px;
+ border-top: 1px solid #eee;
+}
+
+.cancel-btn,
+.submit-btn {
+ padding: 8px 16px;
+ border-radius: 4px;
+ cursor: pointer;
+ font-size: 14px;
+ transition: all 0.2s;
+}
+
+.cancel-btn {
+ background: #f5f5f5;
+ border: 1px solid #ddd;
+ color: #666;
+}
+
+.cancel-btn:hover {
+ background: #eee;
+}
+
+.submit-btn {
+ background: #007bff;
+ border: 1px solid #0056b3;
+ color: white;
+}
+
+.submit-btn:hover {
+ background: #0056b3;
+}
+
+/* 移动端适配 */
+@media (max-width: 480px) {
+ .dialog-content {
+ width: 95%;
+ padding: 15px;
+ }
+
+ .star {
+ font-size: 20px;
+ }
+
+ .comment-input {
+ height: 60px;
+ }
+}
\ No newline at end of file