diff --git a/src/api/common/consts.ts b/src/api/common/consts.ts index ecde969..962a18c 100644 --- a/src/api/common/consts.ts +++ b/src/api/common/consts.ts @@ -1371,7 +1371,14 @@ export const RankNames = [ ]; export const LoginUrlState = { - NORMAL:1, + NORMAL: 1, MAINTENANCE: 2, - WHITE_LIST:3, -} \ No newline at end of file + WHITE_LIST: 3, +}; + +export const BATTLE_PASS = { + Close: 'red', + Open: 'green', + Unopened: '#66b7cf', + PermanentClosed: 'grey', +}; diff --git a/src/api/game/gameConfig.ts b/src/api/game/gameConfig.ts index 17e4812..11ceeed 100644 --- a/src/api/game/gameConfig.ts +++ b/src/api/game/gameConfig.ts @@ -224,6 +224,14 @@ export function gameGMGetBattlePass(params: object) { }); } +export function gameGMGetBattlePassLog(params: object) { + return request({ + url: '/api/v1/game/battlePassLog/get', + method: 'get', + params: params, + }); +} + export function gameGMCheckPeriodIdBattlePass(params: object) { return request({ url: '/api/v1/game/battlePass/checkPeriodId', diff --git a/src/utils/countdownMsg.ts b/src/utils/countdownMsg.ts new file mode 100644 index 0000000..7d911b5 --- /dev/null +++ b/src/utils/countdownMsg.ts @@ -0,0 +1,48 @@ +// 在 Vue 组件的 setup 或普通方法中使用 +import { ElMessageBox } from 'element-plus'; +import { nextTick } from 'vue'; + +export function showCountdownConfirm(message, title = '提示', confirmText = '确定', cancelText = '取消', timeout = 5) { + return new Promise((resolve) => { + let countdown = timeout; + let timer = null; + + // 自定义消息内容(包含确认和取消按钮) + ElMessageBox.confirm(message, title, { + confirmButtonText: countdown + 's后' + confirmText, + cancelButtonText: cancelText, + type: 'warning', + confirmButtonClass: 'countdown-confirm', + showClose: false, + dangerouslyUseHTMLString: true, + // 关闭前的回调,会阻止关闭操作 + beforeClose: (action, instance, done) => { + // 当提交操作时执行后面的步骤 + if (action !== 'confirm') return done(); + if (!timer) done(); + }, + }) + .then((result) => { + console.log('then: ', result); + resolve(true); + }) + .catch((err) => { + clearInterval(timer); + console.error('err: ', err); + resolve(false); + }); + + nextTick(() => { + timer = setInterval(() => { + countdown--; + const countdownNum = document.getElementsByClassName('countdown-confirm'); + if (countdownNum.length > 0) countdownNum[0].textContent = countdown + 's后' + confirmText; + if (countdown <= 0) { + clearInterval(timer); + timer = null; + if (countdownNum.length > 0) countdownNum[0].textContent = confirmText; + } + }, 1000); + }); + }); +} diff --git a/src/views/serverBattlePass/log/index.vue b/src/views/serverBattlePass/log/index.vue index cec3733..2897204 100644 --- a/src/views/serverBattlePass/log/index.vue +++ b/src/views/serverBattlePass/log/index.vue @@ -35,9 +35,10 @@ @@ -109,29 +110,29 @@ export default defineComponent({ let now = new Date().getTime() / 1000; console.log('gameGMGetBattlePass: time ', now); let BattlePassConfig = unique(); - console.log('gameGMGetBattlePass: BattlePassConfig ', BattlePassConfig); - BattlePassConfig.forEach((data) => { + console.log('gameGMGetBattlePass: BattlePassConfig ', BattlePassConfig); + BattlePassConfig.forEach((data) => { let item = state.tableData.list.find((r) => r.PeriodId === data.PeriodId); if (!item) { - state.tableData.list.push({ PeriodId: data.PeriodId }); + item = { PeriodId: data.PeriodId }; + let bt = state.tableData.list.find((r) => r.PeriodId > data.PeriodId && r.BeginTime <= now); + if (bt) { + item.State = 3; + } + state.tableData.list.push(item); return; } if (item.BeginTime >= now) { - item.State = 3; + item.State = 4; } - item.BeginTime = new Date(item.BeginTime * 1000).toLocaleDateString(); - item.EndTime = new Date(item.EndTime * 1000).toLocaleDateString(); }); - state.tableData.list.sort((a, b) => { - return a.PeriodId - b.PeriodId; - }); - // state.tableData.list.forEach((item) => { - // if (item.BeginTime >= now) { - // item.State = 3; - // } - // item.BeginTime = new Date(item.BeginTime * 1000).toLocaleDateString(); - // item.EndTime = new Date(item.EndTime * 1000).toLocaleDateString(); - // }); + state.tableData.list.sort((a, b) => { + return a.PeriodId - b.PeriodId; + }); + state.tableData.list.forEach((item) => { + if (item.BeginTime) item.BeginTime = new Date(item.BeginTime * 1000).toLocaleDateString(); + if (item.EndTime) item.EndTime = new Date(item.EndTime * 1000).toLocaleDateString(); + }); console.log('gameGMGetBattlePass: state.tableData.data', state.tableData.list); }) .finally(() => { diff --git a/src/views/serverBattlePass/shopLog/index.vue b/src/views/serverBattlePass/shopLog/index.vue new file mode 100644 index 0000000..c5d1c15 --- /dev/null +++ b/src/views/serverBattlePass/shopLog/index.vue @@ -0,0 +1,257 @@ + + + + diff --git a/src/views/serverBattlePass/update/component/listConfig.vue b/src/views/serverBattlePass/update/component/listConfig.vue new file mode 100644 index 0000000..4cd0465 --- /dev/null +++ b/src/views/serverBattlePass/update/component/listConfig.vue @@ -0,0 +1,127 @@ + + + diff --git a/src/views/serverBattlePass/update/index.vue b/src/views/serverBattlePass/update/index.vue index b48d8ab..342b584 100644 --- a/src/views/serverBattlePass/update/index.vue +++ b/src/views/serverBattlePass/update/index.vue @@ -49,7 +49,7 @@ - + @@ -67,20 +67,32 @@ - - + + + + + +