日历修改
Showing
3 changed files
with
109 additions
and
16 deletions
| ... | @@ -6,11 +6,13 @@ | ... | @@ -6,11 +6,13 @@ |
| 6 | <span class="textDay">{{ date }}</span> | 6 | <span class="textDay">{{ date }}</span> |
| 7 | <el-button-group class="son"> | 7 | <el-button-group class="son"> |
| 8 | <el-button size="small" type="primary" @click="selectDateCalendar('prev-month')"> | 8 | <el-button size="small" type="primary" @click="selectDateCalendar('prev-month')"> |
| 9 | 上一月 | 9 | {{ language == 0 ? '上一月' : 'Last month' }} |
| 10 | </el-button> | ||
| 11 | <el-button size="small" type="primary" @click="selectDateCalendar('today')"> | ||
| 12 | {{ language == 0 ? '今天' : 'Today' }} | ||
| 10 | </el-button> | 13 | </el-button> |
| 11 | <el-button size="small" type="primary" @click="selectDateCalendar('today')">今天</el-button> | ||
| 12 | <el-button size="small" type="primary" @click="selectDateCalendar('next-month')"> | 14 | <el-button size="small" type="primary" @click="selectDateCalendar('next-month')"> |
| 13 | 下一月 | 15 | {{ language == 0 ? '下一月' : 'Next month' }} |
| 14 | </el-button> | 16 | </el-button> |
| 15 | </el-button-group> | 17 | </el-button-group> |
| 16 | </div> | 18 | </div> |
| ... | @@ -39,10 +41,14 @@ | ... | @@ -39,10 +41,14 @@ |
| 39 | </template> | 41 | </template> |
| 40 | 42 | ||
| 41 | <script setup> | 43 | <script setup> |
| 42 | import { ref } from 'vue' | 44 | import { onMounted, ref } from 'vue' |
| 43 | import { dayjs } from 'element-plus' | 45 | import { dayjs } from 'element-plus' |
| 44 | import { getIndexScheduleList } from '@/apiPc/common' | 46 | import { getIndexScheduleList } from '@/apiPc/common' |
| 45 | import { useRouter } from 'vue-router' | 47 | import { useRouter } from 'vue-router' |
| 48 | import { useStorage } from '@vueuse/core/index' | ||
| 49 | import { getMaList } from '@/apiPc/match' | ||
| 50 | |||
| 51 | const language = useStorage('language', 0) | ||
| 46 | 52 | ||
| 47 | const calendar = ref('') | 53 | const calendar = ref('') |
| 48 | const router = useRouter() | 54 | const router = useRouter() |
| ... | @@ -54,12 +60,30 @@ const query = ref({ | ... | @@ -54,12 +60,30 @@ const query = ref({ |
| 54 | // currentDate:dayjs().format('YYYY-MM-DD') | 60 | // currentDate:dayjs().format('YYYY-MM-DD') |
| 55 | currentDate: dayjs().format('YYYY-MM-DD') | 61 | currentDate: dayjs().format('YYYY-MM-DD') |
| 56 | }) | 62 | }) |
| 57 | getScheduleList() | ||
| 58 | 63 | ||
| 59 | function getScheduleList() { | 64 | onMounted(async() => { |
| 65 | await handelGetMatch() | ||
| 66 | await getScheduleList() | ||
| 67 | }) | ||
| 68 | |||
| 69 | async function handelGetMatch() { | ||
| 70 | const res = await getMaList({ | ||
| 71 | type: '-1', | ||
| 72 | progressStatusCode: '-1', | ||
| 73 | pageNum: 1, | ||
| 74 | pageSize: 10 | ||
| 75 | }) | ||
| 76 | if (res.rows.length > 0) { | ||
| 77 | query.value.currentDate = res.rows[0].beginTime | ||
| 78 | currentDate.value = res.rows[0].beginTime | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | |||
| 83 | async function getScheduleList() { | ||
| 60 | loading.value = true | 84 | loading.value = true |
| 61 | query.value.currentDate = dayjs(query.value.currentDate).format('YYYY-MM-DD') | 85 | query.value.currentDate = dayjs(query.value.currentDate).format('YYYY-MM-DD') |
| 62 | getIndexScheduleList(query.value).then(res => { | 86 | await getIndexScheduleList(query.value).then(res => { |
| 63 | loading.value = false | 87 | loading.value = false |
| 64 | schList.value = res.data | 88 | schList.value = res.data |
| 65 | }) | 89 | }) |
| ... | @@ -93,6 +117,7 @@ const selectDateCalendar = (val) => { | ... | @@ -93,6 +117,7 @@ const selectDateCalendar = (val) => { |
| 93 | } | 117 | } |
| 94 | } | 118 | } |
| 95 | 119 | ||
| 120 | |||
| 96 | </script> | 121 | </script> |
| 97 | 122 | ||
| 98 | <style lang="scss" scoped> | 123 | <style lang="scss" scoped> |
| ... | @@ -224,7 +249,7 @@ const selectDateCalendar = (val) => { | ... | @@ -224,7 +249,7 @@ const selectDateCalendar = (val) => { |
| 224 | .son { | 249 | .son { |
| 225 | position: absolute; | 250 | position: absolute; |
| 226 | right: 0; | 251 | right: 0; |
| 227 | width: 200px; | 252 | width: 230px; |
| 228 | } | 253 | } |
| 229 | 254 | ||
| 230 | .textDay { | 255 | .textDay { | ... | ... |
| ... | @@ -167,7 +167,7 @@ | ... | @@ -167,7 +167,7 @@ |
| 167 | </div> | 167 | </div> |
| 168 | <!--历史排名--> | 168 | <!--历史排名--> |
| 169 | <el-card :body-style="{'padding':'10px 20px 18px'}"> | 169 | <el-card :body-style="{'padding':'10px 20px 18px'}"> |
| 170 | <el-table :data="rank" height="336" stripe @row-click="handleRowClick"> | 170 | <el-table :data="rank" height="495" stripe @row-click="handleRowClick"> |
| 171 | <el-table-column align="center" label="名次" prop="index" width="50" /> | 171 | <el-table-column align="center" label="名次" prop="index" width="50" /> |
| 172 | 172 | ||
| 173 | <el-table-column label="国家" prop="name"> | 173 | <el-table-column label="国家" prop="name"> | ... | ... |
| ... | @@ -6,7 +6,24 @@ | ... | @@ -6,7 +6,24 @@ |
| 6 | <el-row :gutter="20"> | 6 | <el-row :gutter="20"> |
| 7 | <el-col :lg="12" :sm="24"> | 7 | <el-col :lg="12" :sm="24"> |
| 8 | <!--赛事日历--> | 8 | <!--赛事日历--> |
| 9 | <el-calendar v-model="currentDate"> | 9 | <el-calendar ref="calendar" v-model="currentDate"> |
| 10 | <template #header="{ date }"> | ||
| 11 | <div class="father"> | ||
| 12 | <span class="textDay">{{ date }}</span> | ||
| 13 | <el-button-group class="son"> | ||
| 14 | <el-button size="small" type="primary" @click="selectDateCalendar('prev-month')"> | ||
| 15 | {{ language == 0 ? '上一月' : 'Last month' }} | ||
| 16 | </el-button> | ||
| 17 | <el-button size="small" type="primary" @click="selectDateCalendar('today')"> | ||
| 18 | {{ language == 0 ? '今天' : 'Today' }} | ||
| 19 | </el-button> | ||
| 20 | <el-button size="small" type="primary" @click="selectDateCalendar('next-month')"> | ||
| 21 | {{ language == 0 ? '下一月' : 'Next month' }} | ||
| 22 | </el-button> | ||
| 23 | </el-button-group> | ||
| 24 | </div> | ||
| 25 | |||
| 26 | </template> | ||
| 10 | <template #date-cell="data"> | 27 | <template #date-cell="data"> |
| 11 | <div | 28 | <div |
| 12 | :class="data.data.day==query.currentDate?'primaryDate':''" class="date" | 29 | :class="data.data.day==query.currentDate?'primaryDate':''" class="date" |
| ... | @@ -150,7 +167,9 @@ import { getIndexScheduleList } from '@/apiPc/common' | ... | @@ -150,7 +167,9 @@ import { getIndexScheduleList } from '@/apiPc/common' |
| 150 | import { getRank } from '@/apiPc/webSite' | 167 | import { getRank } from '@/apiPc/webSite' |
| 151 | import { useRouter } from 'vue-router' | 168 | import { useRouter } from 'vue-router' |
| 152 | import { medalTableAll } from '/@/apiPc/match' | 169 | import { medalTableAll } from '/@/apiPc/match' |
| 170 | import { getMaList } from '@/apiPc/match' | ||
| 153 | 171 | ||
| 172 | const calendar = ref('') | ||
| 154 | const language = useStorage('language', 0) | 173 | const language = useStorage('language', 0) |
| 155 | const years = ref([]) | 174 | const years = ref([]) |
| 156 | const currYear = ref(null) | 175 | const currYear = ref(null) |
| ... | @@ -159,10 +178,10 @@ const planList = ref([]) | ... | @@ -159,10 +178,10 @@ const planList = ref([]) |
| 159 | const rank = ref([]) | 178 | const rank = ref([]) |
| 160 | const schList = ref([]) | 179 | const schList = ref([]) |
| 161 | const loading = ref(false) | 180 | const loading = ref(false) |
| 162 | const currentDate = ref(dayjs('2025-07-17').toDate()) | 181 | const currentDate = ref(dayjs().toDate()) |
| 163 | const query = ref({ | 182 | const query = ref({ |
| 164 | // currentDate:dayjs().format('YYYY-MM-DD') | 183 | // currentDate:dayjs().format('YYYY-MM-DD') |
| 165 | currentDate: '2025-07-17' | 184 | currentDate: dayjs().toDate() |
| 166 | }) | 185 | }) |
| 167 | const paramsQuery = ref({ | 186 | const paramsQuery = ref({ |
| 168 | pageSize: 10, | 187 | pageSize: 10, |
| ... | @@ -170,8 +189,26 @@ const paramsQuery = ref({ | ... | @@ -170,8 +189,26 @@ const paramsQuery = ref({ |
| 170 | }) | 189 | }) |
| 171 | const total = ref(0) | 190 | const total = ref(0) |
| 172 | 191 | ||
| 173 | getScheduleList() | 192 | onMounted(async() => { |
| 174 | getRankList() | 193 | await handelGetMatch() |
| 194 | await getScheduleList() | ||
| 195 | getRankList() | ||
| 196 | }) | ||
| 197 | |||
| 198 | |||
| 199 | async function handelGetMatch() { | ||
| 200 | const res = await getMaList({ | ||
| 201 | type: '-1', | ||
| 202 | progressStatusCode: '-1', | ||
| 203 | pageNum: 1, | ||
| 204 | pageSize: 10 | ||
| 205 | }) | ||
| 206 | if (res.rows.length > 0) { | ||
| 207 | query.value.currentDate = res.rows[0].beginTime | ||
| 208 | currentDate.value = res.rows[0].beginTime | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 175 | 212 | ||
| 176 | function getRankList() { | 213 | function getRankList() { |
| 177 | match.medalTableAll(paramsQuery.value).then(res => { | 214 | match.medalTableAll(paramsQuery.value).then(res => { |
| ... | @@ -180,10 +217,10 @@ function getRankList() { | ... | @@ -180,10 +217,10 @@ function getRankList() { |
| 180 | }) | 217 | }) |
| 181 | } | 218 | } |
| 182 | 219 | ||
| 183 | function getScheduleList() { | 220 | async function getScheduleList() { |
| 184 | loading.value = true | 221 | loading.value = true |
| 185 | query.value.currentDate = dayjs(query.value.currentDate).format('YYYY-MM-DD') | 222 | query.value.currentDate = dayjs(query.value.currentDate).format('YYYY-MM-DD') |
| 186 | getIndexScheduleList(query.value).then(res => { | 223 | await getIndexScheduleList(query.value).then(res => { |
| 187 | loading.value = false | 224 | loading.value = false |
| 188 | schList.value = res.data | 225 | schList.value = res.data |
| 189 | }) | 226 | }) |
| ... | @@ -218,6 +255,17 @@ function goMatch(n) { | ... | @@ -218,6 +255,17 @@ function goMatch(n) { |
| 218 | } | 255 | } |
| 219 | }) | 256 | }) |
| 220 | } | 257 | } |
| 258 | |||
| 259 | |||
| 260 | const selectDateCalendar = (val) => { | ||
| 261 | if (!calendar.value) return | ||
| 262 | calendar.value.selectDate(val) | ||
| 263 | if (val == 'today') { | ||
| 264 | query.value.currentDate = dayjs().toDate() | ||
| 265 | getScheduleList() | ||
| 266 | } | ||
| 267 | } | ||
| 268 | |||
| 221 | </script> | 269 | </script> |
| 222 | 270 | ||
| 223 | <style lang="scss" scoped> | 271 | <style lang="scss" scoped> |
| ... | @@ -373,4 +421,24 @@ h3 { | ... | @@ -373,4 +421,24 @@ h3 { |
| 373 | .w15 { | 421 | .w15 { |
| 374 | width: 15%; | 422 | width: 15%; |
| 375 | } | 423 | } |
| 424 | |||
| 425 | .father { | ||
| 426 | text-align: center; | ||
| 427 | position: relative; | ||
| 428 | width: 100%; | ||
| 429 | } | ||
| 430 | |||
| 431 | .son { | ||
| 432 | position: absolute; | ||
| 433 | right: 0; | ||
| 434 | width: 230px; | ||
| 435 | } | ||
| 436 | |||
| 437 | .textDay { | ||
| 438 | font-weight: bold; | ||
| 439 | background: linear-gradient(to right, #8623FC, #453DEA); /* 定义渐变方向和颜色 */ | ||
| 440 | -webkit-background-clip: text; /* 兼容 WebKit 浏览器 */ | ||
| 441 | background-clip: text; /* 标准语法 */ | ||
| 442 | -webkit-text-fill-color: transparent; /* 文字颜色透明 */ | ||
| 443 | } | ||
| 376 | </style> | 444 | </style> | ... | ... |
-
Please register or sign in to post a comment