diff --git a/src/api/modules/hourlyChart.ts b/src/api/modules/hourlyChart.ts new file mode 100644 index 0000000..241a54c --- /dev/null +++ b/src/api/modules/hourlyChart.ts @@ -0,0 +1,40 @@ +import { http } from "@/utils/http"; + + +type Result = { + code: string; + data: any; +}; + +export const queryList = params => { + return http.request( + "get", + "/adminapi/RoomHourRanking/room_hour_ranking", + { params } + ); +}; +export const queryTimeList = () => { + return http.request( + "get", + "/adminapi/RoomHourRanking/time_period_correspondence" + ); +}; +export const getRuleSetting = () => { + return http.request( + "get", + "/adminapi/RoomHourRanking/room_hour_ranking_config" + ); +}; +export const settingRuleApi = (data) => { + return http.request( + "post", + "/adminapi/RoomHourRanking/room_hour_ranking_config_edit", + { data } + ); +} +export const settingRuleTable = () => { + return http.request( + "get", + "/adminapi/RoomHourRanking/core_config_list" + ); +} \ No newline at end of file diff --git a/src/utils/http/config.ts b/src/utils/http/config.ts index 50e0f6c..185382f 100644 --- a/src/utils/http/config.ts +++ b/src/utils/http/config.ts @@ -1,5 +1,5 @@ -export const URL = "https://md.xscmmidi.site"; -// http://md.xscmmidi.site 正式 -// http://tmd.xscmmidi.site 测试 +export const URL = "https://tmd.xscmmidi.site"; +// https://md.xscmmidi.site 正式 +// https://tmd.xscmmidi.site 测试 // 声网appId 在这里换 export const appIdBySw = 'a3f0f0c78307434fa1c697c3429fbdcf' \ No newline at end of file diff --git a/src/views/Version/form.vue b/src/views/Version/form.vue index b954bed..cce7241 100644 --- a/src/views/Version/form.vue +++ b/src/views/Version/form.vue @@ -68,8 +68,9 @@ defineExpose({ getRef }); - - + + + diff --git a/src/views/Version/hook.tsx b/src/views/Version/hook.tsx index 3c5e425..7028396 100644 --- a/src/views/Version/hook.tsx +++ b/src/views/Version/hook.tsx @@ -71,16 +71,7 @@ export function useData() { label: "启用状态", prop: "status", cellRenderer: ({ row, props }) => ( - onChange(row as any)} - active-value={1} - inactive-value={0} - active-text="启用" - inactive-text="禁用" - active-color="#13ce66" - inactive-color="#ff4949"> - + {row.status === 0 ? '待发布' : row.status === 1 ? '已发布' : '禁用'} ) }, { diff --git a/src/views/room/hourlyChart/hook.tsx b/src/views/room/hourlyChart/hook.tsx new file mode 100644 index 0000000..0b14759 --- /dev/null +++ b/src/views/room/hourlyChart/hook.tsx @@ -0,0 +1,194 @@ +import { ref, h, nextTick } from "vue"; +import { utils, writeFile } from "xlsx"; +import { message } from "@/utils/message"; +import ExportForm from '@/components/exportDialog/index.vue'; +import ruleView from './ruleform.vue'; +import { queryList, settingRuleApi, getRuleSetting, settingRuleTable } from '@/api/modules/hourlyChart'; +import { addDialog } from "@/components/ReDialog"; +export function useData() { + const formRef = ref(); + const loading = ref(true); + const tableList = ref([]); + const isShow = ref(false); + const searchForm = ref({ + search_ranking: "", + search_stime: "", + search_etime: "" + }); + const searchLabel = ref([ + { label: "排名", prop: "search_ranking", type: "input" }, + { label: "开始时间", prop: "search_stime", type: "date" }, + { label: "结束时间", prop: "search_etime", type: "date" }, + ]); + const pagination = ref({ + total: 0, + pageSize: 10, + pageSizes: [10, 20, 50, 100], + currentPage: 1, + background: true + }); + const tableLabel = ref([ + { + label: "排名", + prop: "ranking" + }, + { + label: "房间ID", + prop: "room_id" + }, + { + label: "房间名称", + prop: "room_name" + }, + { + label: "房主名称", + prop: "nickname" + }, + { + label: "锁定流水总值", + prop: "flowing_water" + }, + { + label: "全服播报", + prop: "is_public_server", + cellRenderer: ({ row }) => ( + {row.is_public_server === 1 ? '显示' : '隐藏'} + ) + }, + { + label: "本期开始时间", + prop: "stime" + } + ]); + const onSearch = async (formData) => { + loading.value = true; + searchForm.value = { ...formData } + const { data, code } = await queryList({ + ...formData, + page: pagination.value.currentPage, + page_limit: pagination.value.pageSize + }); + if (code) { + tableList.value = data.lists; + pagination.value.total = data.count; + pagination.value.currentPage = data.page; + } + loading.value = false; + }; + const handleSizeChange = (val: number) => { + pagination.value.pageSize = val; + onSearch(searchForm.value); + }; + const handleCurrentChange = (val: number) => { + pagination.value.currentPage = val; + onSearch(searchForm.value); + }; + const settingRule = async () => { + const ruleInfo = await getRuleSetting() + const ruleTable = await settingRuleTable() + console.log(ruleTable) + nextTick(() => { + addDialog({ + title: `设置规则`, + props: { + ruleInfo: { + ...ruleInfo.data, + }, + ruleJson: ruleTable.data + }, + fullscreen: true, + closeOnClickModal: false, + contentRenderer: () => h(ruleView, { ref: formRef, formInline: null }), + beforeSure: (done, { options }) => { + const formData = formRef.value.confrimData(); + const SaveSetting = async (form) => { + const { code } = await settingRuleApi({ ...form }); + if (code) { + message("设置成功", { type: "success" }); + done(); + } else { + message("设置失败", { type: "error" }); + } + }; + SaveSetting(formData) + } + }); + }) + } + const exportFormRef = ref(null) + const exportExcel = () => { + let exportTableList = [] + addDialog({ + title: `导出数据`, + props: { + formInline: { + time: '' + } + }, + width: "40%", + closeOnClickModal: false, + contentRenderer: () => h(ExportForm, { ref: exportFormRef, formInline: null }), + beforeSure: (done, { options }) => { + const FormRef = exportFormRef.value.getRef(); + const curData = options.props.formInline; + const exportData = async (formData) => { + const { data, code } = await queryList({ + search_stime: formData.begin_time, + search_etime: formData.end_time, + page: 1, + page_limit: 20000 + }); + if (code) { + exportTableList = data.lists; + const res = exportTableList.map(item => { + const arr = []; + tableLabel.value.forEach(column => { + arr.push(item[column.prop as string]); + }); + return arr; + }); + const titleList = []; + tableLabel.value.forEach(column => { + titleList.push(column.label); + }); + res.unshift(titleList); + const workSheet = utils.aoa_to_sheet(res); + const workBook = utils.book_new(); + utils.book_append_sheet(workBook, workSheet, "数据报表"); + writeFile(workBook, `小时榜数据统计${formData.begin_time} - ${formData.end_time}.xlsx`); + message("导出成功", { + type: "success" + }); + done() + } else { + message("获取数据失败,请重试!", { + type: "error" + }); + } + } + FormRef.validate(valid => { + if (valid) { + if (curData.time && curData.time.length) { + exportData({ begin_time: curData.time[0] || '', end_time: curData.time[1] || '' }) + } + } + }); + } + }); + + } + return { + searchForm, + searchLabel, + onSearch, + isShow, + tableList, + tableLabel, + pagination, + handleSizeChange, + handleCurrentChange, + loading, + exportExcel, + settingRule + }; +} diff --git a/src/views/room/hourlyChart/index.vue b/src/views/room/hourlyChart/index.vue new file mode 100644 index 0000000..38ef3f7 --- /dev/null +++ b/src/views/room/hourlyChart/index.vue @@ -0,0 +1,57 @@ + + + + + diff --git a/src/views/room/hourlyChart/reward.vue b/src/views/room/hourlyChart/reward.vue new file mode 100644 index 0000000..8ab6b3b --- /dev/null +++ b/src/views/room/hourlyChart/reward.vue @@ -0,0 +1,151 @@ + + + diff --git a/src/views/room/hourlyChart/ruleform.vue b/src/views/room/hourlyChart/ruleform.vue new file mode 100644 index 0000000..20a94a3 --- /dev/null +++ b/src/views/room/hourlyChart/ruleform.vue @@ -0,0 +1,289 @@ + + \ No newline at end of file diff --git a/src/views/union/unionList/hook.tsx b/src/views/union/unionList/hook.tsx index ae05dee..cda4cd2 100644 --- a/src/views/union/unionList/hook.tsx +++ b/src/views/union/unionList/hook.tsx @@ -21,10 +21,10 @@ export function useData() { const searchForm = ref({ search_id: "", search_name: "", - search_stime: new Date(), + search_stime: "", search_etime: "" }); - console.log(new Date()) + // console.log(new Date()) const searchLabel = ref([ { label: "公会ID", prop: "search_id", type: "input" }, { label: "公会名称", prop: "search_name", type: "input" }, diff --git a/vite.config.ts b/vite.config.ts index 0d7d26d..b68012f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -35,8 +35,8 @@ export default ({ mode }: ConfigEnv): UserConfigExport => { onProxyReq: (proxyReq, req, res) => { if (req.method === 'OPTIONS') { proxyReq.method = 'OPTIONS'; - // 设置CORS头 - res.setHeader('Access-Control-Allow-Origin', 'https://admin.xscmmidi.site'); + // 设置CORS头 https://admin.xscmmidi.site + res.setHeader('Access-Control-Allow-Origin', 'https://tmd.xscmmidi.site'); res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization'); res.end();