v1.5更新

事务大厅以此为准;
This commit is contained in:
zyb 2025-05-16 19:18:36 +08:00
parent 0c0b5d869c
commit 8e052811e3
13 changed files with 85 additions and 84 deletions

View File

@ -1,31 +1,31 @@
{ {
"hash": "afcf6c3c", "hash": "884a29ef",
"configHash": "91750b15", "configHash": "dbe75e76",
"lockfileHash": "05472006", "lockfileHash": "05472006",
"browserHash": "2290a967", "browserHash": "8f3502fc",
"optimized": { "optimized": {
"axios": { "axios": {
"src": "../../axios/index.js", "src": "../../axios/index.js",
"file": "axios.js", "file": "axios.js",
"fileHash": "61004dcb", "fileHash": "ecea6d22",
"needsInterop": false "needsInterop": false
}, },
"vue": { "vue": {
"src": "../../vue/dist/vue.runtime.esm-bundler.js", "src": "../../vue/dist/vue.runtime.esm-bundler.js",
"file": "vue.js", "file": "vue.js",
"fileHash": "061664fd", "fileHash": "b7828a52",
"needsInterop": false "needsInterop": false
}, },
"vue-router": { "vue-router": {
"src": "../../vue-router/dist/vue-router.mjs", "src": "../../vue-router/dist/vue-router.mjs",
"file": "vue-router.js", "file": "vue-router.js",
"fileHash": "a15c45dc", "fileHash": "2fae1e26",
"needsInterop": false "needsInterop": false
} }
}, },
"chunks": { "chunks": {
"chunk-U3LI7FBV": { "chunk-YBGSFZ7G": {
"file": "chunk-U3LI7FBV.js" "file": "chunk-YBGSFZ7G.js"
}, },
"chunk-PZ5AY32C": { "chunk-PZ5AY32C": {
"file": "chunk-PZ5AY32C.js" "file": "chunk-PZ5AY32C.js"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12539,4 +12539,4 @@ vue/dist/vue.runtime.esm-bundler.js:
* @license MIT * @license MIT
**) **)
*/ */
//# sourceMappingURL=chunk-U3LI7FBV.js.map //# sourceMappingURL=chunk-YBGSFZ7G.js.map

7
node_modules/.vite/deps/chunk-YBGSFZ7G.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@ import {
unref, unref,
watch, watch,
watchEffect watchEffect
} from "./chunk-U3LI7FBV.js"; } from "./chunk-YBGSFZ7G.js";
import "./chunk-PZ5AY32C.js"; import "./chunk-PZ5AY32C.js";
// node_modules/@vue/devtools-api/lib/esm/env.js // node_modules/@vue/devtools-api/lib/esm/env.js

File diff suppressed because one or more lines are too long

2
node_modules/.vite/deps/vue.js generated vendored
View File

@ -168,7 +168,7 @@ import {
withMemo, withMemo,
withModifiers, withModifiers,
withScopeId withScopeId
} from "./chunk-U3LI7FBV.js"; } from "./chunk-YBGSFZ7G.js";
import "./chunk-PZ5AY32C.js"; import "./chunk-PZ5AY32C.js";
export { export {
BaseTransition, BaseTransition,

View File

@ -11,7 +11,7 @@ export const getMaps = async (params = {}) => {
search: params.search || '', search: params.search || '',
player_count: params.player_count || '', player_count: params.player_count || '',
tags: params.tags || '', tags: params.tags || '',
ordering: params.ordering || '-download_count' ordering: params.ordering || ''
} }
}) })
return response.data return response.data
@ -22,18 +22,18 @@ export const getMaps = async (params = {}) => {
} }
// 获取每周推荐地图 // 获取每周推荐地图
export const getWeeklyTopMaps = async () => { export const getWeeklyTopMaps = async (params = {}) => {
try { try {
const response = await axios.get('https://ra3.z31.xyz/v1/maps/', { const response = await axios.get(`${API_BASE_URL}/maps/`, {
params: { params: {
ordering: '-download_count', p: params.page || 1,
format: 'json', format: 'json',
p: 1 ordering: params.ordering || ''
} }
}) })
return response.data.results.slice(0, 10) return response.data.results
} catch (error) { } catch (error) {
console.error('获取每周推荐地图失败:', error) console.error('获取地图列表失败:', error)
throw error throw error
} }
} }

View File

@ -166,7 +166,7 @@ const fetchDemands = async () => {
loading.value = true loading.value = true
error.value = null error.value = null
try { try {
const response = await fetch('/api/demands/getlist', { const response = await fetch('http://zybdatasupport.online:8000/demands/getlist', {
headers: { headers: {
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
@ -235,7 +235,7 @@ async function submitAddForm() {
date: dateStr, date: dateStr,
qq_code: addForm.value.qq_code qq_code: addForm.value.qq_code
}; };
const response = await fetch('/api/demands/add', { const response = await fetch('http://zybdatasupport.online:8000/demands/add', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload) body: JSON.stringify(payload)

View File

@ -1,9 +1,10 @@
<template> <template>
<div class="maps"> <div class="maps">
<div class="page-header"> <div class="page-header">
<h1>最近上传地图</h1> <h1>最近地图上传</h1>
</div> </div>
<div class="filters"> <div class="filters">
搜索
<div class="search-box"> <div class="search-box">
<input <input
type="text" type="text"
@ -13,14 +14,17 @@
@blur="handleSearchBlur" @blur="handleSearchBlur"
> >
</div> </div>
玩家数
<select v-model="playerCountFilter" class="filter-select" @change="handleFilterChange"> <select v-model="playerCountFilter" class="filter-select" @change="handleFilterChange">
<option value="">玩家数</option> <option value="">全部</option>
<option v-for="n in [2,3,4,5,6,7,8]" :key="n" :value="n">{{ n }}</option> <option v-for="n in [2,3,4,5,6,7,8]" :key="n" :value="n">{{ n }}</option>
</select> </select>
分类
<select v-model="tagFilter" class="filter-select" @change="handleFilterChange"> <select v-model="tagFilter" class="filter-select" @change="handleFilterChange">
<option value="">分类</option> <option value="">全部</option>
<option v-for="tag in tagOptions" :key="tag" :value="tag">{{ tag }}</option> <option v-for="tag in tagOptions" :key="tag" :value="tag">{{ tag }}</option>
</select> </select>
排序
<select v-model="selectedOrder" class="filter-select" @change="handleFilterChange"> <select v-model="selectedOrder" class="filter-select" @change="handleFilterChange">
<option v-for="opt in orderOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</option> <option v-for="opt in orderOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</option>
</select> </select>
@ -171,38 +175,7 @@ const fetchMaps = async (page = 1) => {
} }
const data = await getMaps(params) const data = await getMaps(params)
//
if (selectedOrder.value === '-create_time' || selectedOrder.value === 'create_time') {
//
const groupedMaps = data.results.reduce((groups, map) => {
const date = new Date(map.create_time).toLocaleDateString('zh-CN')
if (!groups[date]) {
groups[date] = []
}
groups[date].push(map)
return groups
}, {})
//
Object.keys(groupedMaps).forEach(date => {
groupedMaps[date].sort((a, b) => b.download_count - a.download_count)
})
//
const sortedDates = Object.keys(groupedMaps).sort((a, b) => {
return selectedOrder.value === '-create_time'
? new Date(b) - new Date(a) //
: new Date(a) - new Date(b) //
})
//
maps.value = sortedDates.reduce((acc, date) => {
return acc.concat(groupedMaps[date])
}, [])
} else {
maps.value = data.results maps.value = data.results
}
hasNextPage.value = !!data.next hasNextPage.value = !!data.next
totalPages.value = Math.ceil(data.count / 20) totalPages.value = Math.ceil(data.count / 20)
currentPage.value = page currentPage.value = page

View File

@ -1,12 +1,11 @@
<template> <template>
<div class="weekly-recommend"> <div class="weekly-recommend">
<div class="page-header"> <div class="page-header">
<h1>热门下载地图</h1> <h1>每周热门下载地图</h1>
<div class="header-subtitle"> <div class="header-subtitle">
<span class="date-range">{{ currentWeekRange }}</span> <span class="date-range">{{ currentWeekRange }}</span>
</div> </div>
</div> </div>
<div class="table-container"> <div class="table-container">
<table class="maps-table"> <table class="maps-table">
<thead> <thead>
@ -43,6 +42,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</template> </template>
@ -58,10 +58,10 @@ const recommendedMaps = ref([])
// //
const currentWeekRange = computed(() => { const currentWeekRange = computed(() => {
const now = new Date() const end = new Date()
const start = new Date(now.setDate(now.getDate() - now.getDay())) const start = new Date()
const end = new Date(now.setDate(now.getDate() - now.getDay() + 6)) start.setDate(start.getDate() - 6) // 67
return `${start.toLocaleDateString('zh-CN')} - ${end.toLocaleDateString('zh-CN')}` return `${start.toLocaleDateString('zh-CN')} - 今天 ${end.toLocaleDateString('zh-CN')}`
}) })
const goToMapDetail = (id) => { const goToMapDetail = (id) => {
@ -74,7 +74,42 @@ const formatDate = (dateString) => {
const fetchRecommendedMaps = async () => { const fetchRecommendedMaps = async () => {
try { try {
recommendedMaps.value = await getWeeklyTopMaps() const maps = await getWeeklyTopMaps()
// 7
const sevenDaysAgo = new Date()
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 6) // 67
// 7
const recentMaps = maps.filter(map => {
const mapDate = new Date(map.create_time)
return mapDate >= sevenDaysAgo
})
//
const groupedMaps = recentMaps.reduce((groups, map) => {
const date = new Date(map.create_time).toLocaleDateString('zh-CN')
if (!groups[date]) {
groups[date] = []
}
groups[date].push(map)
return groups
}, {})
//
Object.keys(groupedMaps).forEach(date => {
groupedMaps[date].sort((a, b) => b.download_count - a.download_count)
})
//
const sortedDates = Object.keys(groupedMaps).sort((a, b) =>
new Date(b) - new Date(a)
)
//
recommendedMaps.value = sortedDates.reduce((acc, date) => {
return acc.concat(groupedMaps[date])
}, [])
} catch (error) { } catch (error) {
console.error('获取推荐地图失败:', error) console.error('获取推荐地图失败:', error)
} }

View File

@ -10,14 +10,7 @@ export default defineConfig({
} }
}, },
server: { server: {
port: 8082, port: 80,
open: true, open: true
proxy: {
'/api': {
target: 'http://49.232.8.189:8000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
} }
}) })