|
|
|
@ -14,7 +14,7 @@
|
|
|
|
|
<el-table :data="tableData.datas" style="width: 100%" :row-class-name="onTableRowClassName" stripe border> |
|
|
|
|
<el-table-column width="150" label="公告类型"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<span>{{ noticeTypes.find(r => r.Id == scope.row.noticeType).Name }}</span> |
|
|
|
|
<span>{{ noticeTypes.find((r) => r.Id == scope.row.noticeType).Name }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="content" label="公告内容" show-overflow-tooltip> |
|
|
|
@ -30,14 +30,14 @@
|
|
|
|
|
<el-table-column prop="times" label="渠道" width="150"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
{{ |
|
|
|
|
channels.find(r => r.value == scope.row.channel) ? channels.find(r => r.value == scope.row.channel).label : scope.row.channel |
|
|
|
|
channels.find((r) => r.value == scope.row.channel) ? channels.find((r) => r.value == scope.row.channel).label : scope.row.channel |
|
|
|
|
}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="times" label="区服" width="150"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
{{ |
|
|
|
|
servers.find(r => r.value == scope.row.serverId) ? servers.find(r => r.value == scope.row.serverId).name : scope.row.serverId |
|
|
|
|
servers.find((r) => r.value == scope.row.serverId) ? servers.find((r) => r.value == scope.row.serverId).name : scope.row.serverId |
|
|
|
|
}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -49,9 +49,15 @@
|
|
|
|
|
</el-table> |
|
|
|
|
</el-form> |
|
|
|
|
<el-row justify="space-evenly"> |
|
|
|
|
<el-pagination :hide-on-single-page="true" :page-size="tableData.param.pageSize" |
|
|
|
|
:pager-count="5" @current-change="handleCurrentChange" |
|
|
|
|
layout="total, prev, pager, next, jumper" :total="tableData.total"/> |
|
|
|
|
<el-pagination |
|
|
|
|
:hide-on-single-page="true" |
|
|
|
|
v-model:page-size="tableData.param.pageSize" |
|
|
|
|
@current-change="handleCurrentChange" |
|
|
|
|
v-model:current-page="tableData.param.pageNum" |
|
|
|
|
layout="total, prev, pager, next, jumper" |
|
|
|
|
:total="tableData.total" |
|
|
|
|
:pager-count="5" |
|
|
|
|
/> |
|
|
|
|
</el-row> |
|
|
|
|
</div> |
|
|
|
|
</el-card> |
|
|
|
@ -60,9 +66,7 @@
|
|
|
|
|
<p v-html="tableData.content"></p> |
|
|
|
|
<template #footer> |
|
|
|
|
<div class="dialog-footer"> |
|
|
|
|
<el-button type="primary" @click="copyContent"> |
|
|
|
|
复制 |
|
|
|
|
</el-button> |
|
|
|
|
<el-button type="primary" @click="copyContent"> 复制</el-button> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-dialog> |
|
|
|
@ -71,36 +75,36 @@
|
|
|
|
|
|
|
|
|
|
<script lang="ts"> |
|
|
|
|
import { toRefs, reactive, onMounted, defineComponent } from 'vue'; |
|
|
|
|
import {gameNoticeDelList, gameNoticeList, gameRechargeControlDelete} from "/@/api/game"; |
|
|
|
|
import {ElMessage, ElMessageBox} from "element-plus/es"; |
|
|
|
|
import {allChannelList, allServerList} from "/@/utils/game"; |
|
|
|
|
import {contentReplace} from "/@/utils/utils"; |
|
|
|
|
import {formatDate} from "/@/utils/formatTime"; |
|
|
|
|
import {Notice_Type} from "/@/api/common/consts"; |
|
|
|
|
import { gameNoticeDelList, gameNoticeList, gameRechargeControlDelete } from '/@/api/game'; |
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus/es'; |
|
|
|
|
import { allChannelList, allServerList } from '/@/utils/game'; |
|
|
|
|
import { contentReplace } from '/@/utils/utils'; |
|
|
|
|
import { formatDate } from '/@/utils/formatTime'; |
|
|
|
|
import { Notice_Type } from '/@/api/common/consts'; |
|
|
|
|
|
|
|
|
|
interface TableDataState { |
|
|
|
|
tableData: { |
|
|
|
|
copyContent: string |
|
|
|
|
content: string |
|
|
|
|
datas: object[] |
|
|
|
|
copyContent: string; |
|
|
|
|
content: string; |
|
|
|
|
datas: object[]; |
|
|
|
|
param: { |
|
|
|
|
channel: string, |
|
|
|
|
content: string |
|
|
|
|
noticeType: number |
|
|
|
|
id: number, |
|
|
|
|
noticeId: number, |
|
|
|
|
pageNum: number, |
|
|
|
|
pageSize: number, |
|
|
|
|
times: object[], |
|
|
|
|
beginTime: number, |
|
|
|
|
endTime: number, |
|
|
|
|
channel: string; |
|
|
|
|
content: string; |
|
|
|
|
noticeType: number; |
|
|
|
|
id: number; |
|
|
|
|
noticeId: number; |
|
|
|
|
pageNum: number; |
|
|
|
|
pageSize: number; |
|
|
|
|
times: object[]; |
|
|
|
|
beginTime: number; |
|
|
|
|
endTime: number; |
|
|
|
|
}; |
|
|
|
|
total: number |
|
|
|
|
total: number; |
|
|
|
|
}; |
|
|
|
|
noticeTypes: object[] |
|
|
|
|
channels: object |
|
|
|
|
servers: object[] |
|
|
|
|
contentVisible: boolean |
|
|
|
|
noticeTypes: object[]; |
|
|
|
|
channels: object; |
|
|
|
|
servers: object[]; |
|
|
|
|
contentVisible: boolean; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default defineComponent({ |
|
|
|
@ -109,38 +113,38 @@ export default defineComponent({
|
|
|
|
|
setup() { |
|
|
|
|
const state = reactive<TableDataState>({ |
|
|
|
|
tableData: { |
|
|
|
|
copyContent: "", |
|
|
|
|
content: "", |
|
|
|
|
copyContent: '', |
|
|
|
|
content: '', |
|
|
|
|
datas: [], |
|
|
|
|
param: { |
|
|
|
|
noticeType: 0, |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
}, |
|
|
|
|
total: 0 |
|
|
|
|
total: 0, |
|
|
|
|
}, |
|
|
|
|
channels: [], |
|
|
|
|
servers: [], |
|
|
|
|
contentVisible: false, |
|
|
|
|
noticeTypes: Notice_Type |
|
|
|
|
noticeTypes: Notice_Type, |
|
|
|
|
}); |
|
|
|
|
const noticeDel = (id: number) => { |
|
|
|
|
ElMessageBox.confirm("是否确认删除公告?", '提示', { |
|
|
|
|
ElMessageBox.confirm('是否确认删除公告?', '提示', { |
|
|
|
|
confirmButtonText: '确认', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}).then(() => { |
|
|
|
|
gameNoticeDelList({id: id}).then(() => { |
|
|
|
|
gameNoticeDelList({ id: id }) |
|
|
|
|
.then(() => { |
|
|
|
|
ElMessage.success('删除成功'); |
|
|
|
|
getNotice(); |
|
|
|
|
}).finally(() => { |
|
|
|
|
}) |
|
|
|
|
.finally(() => {}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
const noticeCopy = (value: string) => { |
|
|
|
|
// 创建输入框元素 |
|
|
|
|
let oInput = document.createElement("input"); |
|
|
|
|
let oInput = document.createElement('input'); |
|
|
|
|
// 将想要复制的值 |
|
|
|
|
oInput.value = value; |
|
|
|
|
// 页面底部追加输入框 |
|
|
|
@ -148,7 +152,7 @@ export default defineComponent({
|
|
|
|
|
// 选中输入框 |
|
|
|
|
oInput.select(); |
|
|
|
|
// 执行浏览器复制命令 |
|
|
|
|
document.execCommand("Copy"); |
|
|
|
|
document.execCommand('Copy'); |
|
|
|
|
// 弹出复制成功信息 |
|
|
|
|
ElMessage.success('复制成功'); |
|
|
|
|
// 复制后移除输入框 |
|
|
|
@ -158,31 +162,31 @@ export default defineComponent({
|
|
|
|
|
console.log(state.tableData.param); |
|
|
|
|
|
|
|
|
|
gameNoticeList(state.tableData.param).then((res: any) => { |
|
|
|
|
console.log("gameNoticeList: ", res); |
|
|
|
|
console.log('gameNoticeList: ', res); |
|
|
|
|
state.tableData.datas = res.data.list; |
|
|
|
|
state.tableData.total = res.data.total || 0; |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
// 页面加载时 |
|
|
|
|
onMounted(() => { |
|
|
|
|
allServerList().then(res => { |
|
|
|
|
allServerList().then((res) => { |
|
|
|
|
state.servers = res; |
|
|
|
|
}) |
|
|
|
|
allChannelList().then(res => { |
|
|
|
|
}); |
|
|
|
|
allChannelList().then((res) => { |
|
|
|
|
state.channels = res; |
|
|
|
|
}) |
|
|
|
|
getNotice() |
|
|
|
|
}); |
|
|
|
|
getNotice(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const handleClose = (done: () => void) => { |
|
|
|
|
done() |
|
|
|
|
done(); |
|
|
|
|
// ElMessageBox.confirm('确定退出编辑模板页面?').then(() => { |
|
|
|
|
// }).catch(() => { |
|
|
|
|
// catch error |
|
|
|
|
// }) |
|
|
|
|
}; |
|
|
|
|
const onTableRowClassName = ({ row, rowIndex }: any) => { |
|
|
|
|
console.log("onTableRowClassName", row, rowIndex); |
|
|
|
|
console.log('onTableRowClassName', row, rowIndex); |
|
|
|
|
if (row.Day % 2 == 0 || row.day % 2 == 0) { |
|
|
|
|
return 'warning-row'; |
|
|
|
|
} else { |
|
|
|
|