更新
This commit is contained in:
40
src/api/modules/hourlyChart.ts
Normal file
40
src/api/modules/hourlyChart.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { http } from "@/utils/http";
|
||||||
|
|
||||||
|
|
||||||
|
type Result = {
|
||||||
|
code: string;
|
||||||
|
data: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const queryList = params => {
|
||||||
|
return http.request<Result>(
|
||||||
|
"get",
|
||||||
|
"/adminapi/RoomHourRanking/room_hour_ranking",
|
||||||
|
{ params }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export const queryTimeList = () => {
|
||||||
|
return http.request<Result>(
|
||||||
|
"get",
|
||||||
|
"/adminapi/RoomHourRanking/time_period_correspondence"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export const getRuleSetting = () => {
|
||||||
|
return http.request<Result>(
|
||||||
|
"get",
|
||||||
|
"/adminapi/RoomHourRanking/room_hour_ranking_config"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export const settingRuleApi = (data) => {
|
||||||
|
return http.request<Result>(
|
||||||
|
"post",
|
||||||
|
"/adminapi/RoomHourRanking/room_hour_ranking_config_edit",
|
||||||
|
{ data }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export const settingRuleTable = () => {
|
||||||
|
return http.request<Result>(
|
||||||
|
"get",
|
||||||
|
"/adminapi/RoomHourRanking/core_config_list"
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
export const URL = "https://md.xscmmidi.site";
|
export const URL = "https://tmd.xscmmidi.site";
|
||||||
// http://md.xscmmidi.site 正式
|
// https://md.xscmmidi.site 正式
|
||||||
// http://tmd.xscmmidi.site 测试
|
// https://tmd.xscmmidi.site 测试
|
||||||
// 声网appId 在这里换
|
// 声网appId 在这里换
|
||||||
export const appIdBySw = 'a3f0f0c78307434fa1c697c3429fbdcf'
|
export const appIdBySw = 'a3f0f0c78307434fa1c697c3429fbdcf'
|
||||||
@@ -68,8 +68,9 @@ defineExpose({ getRef });
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-radio-group v-model="newFormInline.status">
|
<el-radio-group v-model="newFormInline.status">
|
||||||
<el-radio label="启用" :value="1" />
|
<el-radio label="待发布" :value="0" />
|
||||||
<el-radio label="禁用" :value="0" />
|
<el-radio label="已发布" :value="1" />
|
||||||
|
<el-radio label="禁用" :value="2" />
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|||||||
@@ -71,16 +71,7 @@ export function useData() {
|
|||||||
label: "启用状态",
|
label: "启用状态",
|
||||||
prop: "status",
|
prop: "status",
|
||||||
cellRenderer: ({ row, props }) => (
|
cellRenderer: ({ row, props }) => (
|
||||||
<el-switch
|
<el-tag type={row.status === 0 ? 'info' : row.status === 1 ? 'success' : 'danger'}>{row.status === 0 ? '待发布' : row.status === 1 ? '已发布' : '禁用'}</el-tag>
|
||||||
v-model={row.status}
|
|
||||||
onChange={() => onChange(row as any)}
|
|
||||||
active-value={1}
|
|
||||||
inactive-value={0}
|
|
||||||
active-text="启用"
|
|
||||||
inactive-text="禁用"
|
|
||||||
active-color="#13ce66"
|
|
||||||
inactive-color="#ff4949">
|
|
||||||
</el-switch>
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
194
src/views/room/hourlyChart/hook.tsx
Normal file
194
src/views/room/hourlyChart/hook.tsx
Normal file
@@ -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 }) => (
|
||||||
|
<el-tag type={row.is_public_server === 1 ? 'success' : 'error'}>{row.is_public_server === 1 ? '显示' : '隐藏'}</el-tag>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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
|
||||||
|
};
|
||||||
|
}
|
||||||
57
src/views/room/hourlyChart/index.vue
Normal file
57
src/views/room/hourlyChart/index.vue
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted } from "vue";
|
||||||
|
import { useData } from "./hook";
|
||||||
|
import SearchForm from "@/components/SearchForm/index.vue";
|
||||||
|
import { PureTableBar } from "@/components/RePureTableBar";
|
||||||
|
import { deviceDetection } from "@pureadmin/utils";
|
||||||
|
const {
|
||||||
|
searchLabel,
|
||||||
|
searchForm,
|
||||||
|
onSearch,
|
||||||
|
isShow,
|
||||||
|
tableList,
|
||||||
|
pagination,
|
||||||
|
tableLabel,
|
||||||
|
handleSizeChange,
|
||||||
|
handleCurrentChange,
|
||||||
|
loading,
|
||||||
|
exportExcel,
|
||||||
|
settingRule
|
||||||
|
} = useData();
|
||||||
|
defineOptions({
|
||||||
|
name: "hourlyChart"
|
||||||
|
});
|
||||||
|
onMounted(() => {
|
||||||
|
onSearch(searchForm.value);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="main">
|
||||||
|
<SearchForm class="pb-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="onSearch" />
|
||||||
|
<div ref="contentRef" :class="['flex', deviceDetection() ? 'flex-wrap' : '']">
|
||||||
|
<PureTableBar title="小时榜数据列表" :class="[isShow && !deviceDetection() ? '!w-[60vw]' : 'w-full']"
|
||||||
|
:columns="tableLabel" @refresh="onSearch">
|
||||||
|
<template #buttons>
|
||||||
|
<el-button type="primary" @click="exportExcel">
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="settingRule">
|
||||||
|
设置规则
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<template v-slot="{ size, dynamicColumns }">
|
||||||
|
<pure-table ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto" default-expand-all
|
||||||
|
:loading="loading" :size="size" row-key="id" adaptive :adaptiveConfig="{ offsetBottom: 108 }"
|
||||||
|
:data="tableList" :columns="dynamicColumns" :pagination="{ ...pagination, size }" :header-cell-style="{
|
||||||
|
background: 'var(--el-fill-color-light)',
|
||||||
|
color: 'var(--el-text-color-primary)'
|
||||||
|
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">
|
||||||
|
</pure-table>
|
||||||
|
</template>
|
||||||
|
</PureTableBar>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
151
src/views/room/hourlyChart/reward.vue
Normal file
151
src/views/room/hourlyChart/reward.vue
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
import { queryGiftByTypeList } from '@/api/modules/blindBox';
|
||||||
|
import { queryAdornmentList } from '@/api/modules/activities'
|
||||||
|
const ruleFormRef = ref();
|
||||||
|
const formRules = ref({
|
||||||
|
coin: [{ required: true, message: "请输入金币数量", trigger: "blur" }],
|
||||||
|
inlet_bag_id: [{ required: true, message: "请选择礼物", trigger: "change" }],
|
||||||
|
avatar_id: [{ required: true, message: "请选择头像框", trigger: "change" }],
|
||||||
|
mount_id: [{ required: true, message: "请选择坐骑", trigger: "change" }],
|
||||||
|
});
|
||||||
|
const saveGiftForm = ref({})
|
||||||
|
const props = defineProps(["formInline"]);
|
||||||
|
const checkList = ref([])
|
||||||
|
const newFormInline = ref(
|
||||||
|
props.formInline
|
||||||
|
? props.formInline
|
||||||
|
: {
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const newFormData = ref({
|
||||||
|
coin: 0,
|
||||||
|
inlet_bag_id: '',
|
||||||
|
avatar_id: '',
|
||||||
|
mount_id: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
function getRef() {
|
||||||
|
return ruleFormRef.value;
|
||||||
|
}
|
||||||
|
const handleChange = (ele) => {
|
||||||
|
const type = newFormInline.value.content.map(s => { return s.type })
|
||||||
|
if (type.includes(0)) {
|
||||||
|
newFormInline.value.content.forEach((item, index) => {
|
||||||
|
newFormInline.value.content[index].value = ele
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
newFormInline.value.content.push({ type: 0, value: ele })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 礼物
|
||||||
|
const giftList = ref([])
|
||||||
|
const getList = async () => {
|
||||||
|
const { data, code } = await queryGiftByTypeList({ type: 2, label: 6 })
|
||||||
|
giftList.value = code ? data : []
|
||||||
|
}
|
||||||
|
// 道具
|
||||||
|
const AdornmentList = ref([])
|
||||||
|
const getAdornmentList = async () => {
|
||||||
|
const { data, code } = await queryAdornmentList()
|
||||||
|
AdornmentList.value = code ? data : []
|
||||||
|
}
|
||||||
|
// 选择礼物
|
||||||
|
const changeGife = (ele, typeProps) => {
|
||||||
|
if (ele) {
|
||||||
|
const valueProp = ele.split('_')
|
||||||
|
const valueId = valueProp[0] || 0
|
||||||
|
const valueName = valueProp[1] || ''
|
||||||
|
const type = newFormInline.value.content.map(s => { return s.type })
|
||||||
|
if (type.includes(typeProps)) {
|
||||||
|
newFormInline.value.content.forEach((item, index) => {
|
||||||
|
newFormInline.value.content[index].value = valueId
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
newFormInline.value.content.push({ type: typeProps, value: valueId, name: valueName })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
const getContent = () => {
|
||||||
|
saveGiftForm.value = {
|
||||||
|
index: newFormInline.value.index,
|
||||||
|
content: newFormInline.value.content
|
||||||
|
}
|
||||||
|
return saveGiftForm.value;
|
||||||
|
|
||||||
|
}
|
||||||
|
const chengeCheckValue = (ele) => {
|
||||||
|
// const checkList = ele.map(v => { return +v })
|
||||||
|
// newFormInline.value.content.forEach((ele, eleIndex) => {
|
||||||
|
// if (checkList.includes(ele.type)) {
|
||||||
|
// newFormInline.value.content.splice(eleIndex, 1)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
getAdornmentList()
|
||||||
|
if (props.formInline) {
|
||||||
|
if (props.formInline.content.length) {
|
||||||
|
let list = [...props.formInline.content]
|
||||||
|
list.forEach(child => {
|
||||||
|
checkList.value.push(child.type)
|
||||||
|
if (child.type === 0) newFormData.value.coin = child.value
|
||||||
|
if (child.type === 1) newFormData.value.inlet_bag_id = `${+child.value}_${child.name}`
|
||||||
|
if (child.type === 2) newFormData.value.avatar_id = `${+child.value}_${child.name}`
|
||||||
|
if (child.type === 3) newFormData.value.mount_id = `${+child.value}_${child.name}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
defineExpose({ getRef, getContent });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-form ref="ruleFormRef" :model="newFormData" :rules="formRules" label-width="120px">
|
||||||
|
<el-form-item label="选择类型" prop="version">
|
||||||
|
<el-checkbox-group v-model="checkList" @change="chengeCheckValue">
|
||||||
|
<el-checkbox :value="0">金币</el-checkbox>
|
||||||
|
<el-checkbox :value="1">礼物</el-checkbox>
|
||||||
|
<el-checkbox :value="2">头像框</el-checkbox>
|
||||||
|
<el-checkbox :value="3">坐骑</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
<template v-if="checkList.includes(0)">
|
||||||
|
<el-form-item label="输入金币数量" prop="coin">
|
||||||
|
<el-input-number v-model="newFormData.coin" @change="handleChange"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
<template v-if="checkList.includes(1)">
|
||||||
|
<el-form-item label="选择奖励礼物" prop="inlet_bag_id">
|
||||||
|
<el-select v-model="newFormData.inlet_bag_id" placeholder="请选择礼物" @change="(ele) => changeGife(ele, 1)">
|
||||||
|
<el-option v-for="item in giftList" :key="item.gid" :label="item.gift_name"
|
||||||
|
:value="`${item.gid}_${item.gift_name}`">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<template v-if="checkList.includes(2)">
|
||||||
|
<el-form-item label="选择奖励头像框" prop="avatar_id">
|
||||||
|
<el-select v-model="newFormData.avatar_id" placeholder="请选择头像框" @change="(ele) => changeGife(ele, 2)">
|
||||||
|
<el-option v-for="item in AdornmentList" :key="item.id" :label="item.name" :value="`${item.id}_${item.name}`">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<template v-if="checkList.includes(3)">
|
||||||
|
<el-form-item label="选择奖励坐骑" prop="mount_id">
|
||||||
|
<el-select v-model="newFormData.mount_id" placeholder="请选择坐骑" @change="(ele) => changeGife(ele, 3)">
|
||||||
|
<el-option v-for="item in AdornmentList" :key="item.id
|
||||||
|
" :label="item.name" :value="`${item.id}_${item.name}`
|
||||||
|
">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
289
src/views/room/hourlyChart/ruleform.vue
Normal file
289
src/views/room/hourlyChart/ruleform.vue
Normal file
@@ -0,0 +1,289 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted, h } from "vue";
|
||||||
|
import { addDialog } from "@/components/ReDialog";
|
||||||
|
import { queryTimeList } from '@/api/modules/hourlyChart';
|
||||||
|
import rewardView from './reward.vue';
|
||||||
|
const ruleFormRef = ref();
|
||||||
|
// const formRules = ref({
|
||||||
|
// admin_id: [{ required: true }], room_id: [{ required: true }],
|
||||||
|
// room_name: [{ required: true, message: '请输入房间名称', trigger: 'blur' }],
|
||||||
|
// room_intro: [{ required: true, message: '请输入房间公告', trigger: 'blur' }],
|
||||||
|
// room_cover: [{ required: true, message: '请上传房间封面', trigger: 'blur' }],
|
||||||
|
// room_background_id: [{ required: true, message: '请选择房间背景', trigger: 'change' }],
|
||||||
|
// type_id: [{ required: true, message: '请选择房间分类', trigger: 'change' }],
|
||||||
|
// is_earnings: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
|
// is_top: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
|
// is_hot: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
|
// is_recommend: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
|
// is_room_password: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
|
// room_password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
|
||||||
|
// room_status: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
|
// is_show_room: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
|
// is_robot_num: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
|
// robot_num: [{ required: true, message: '请输入机器人数量', trigger: 'blur' }]
|
||||||
|
// });
|
||||||
|
const props = defineProps(["formInline", "ruleInfo", 'ruleJson']);
|
||||||
|
const newFormInline = ref(
|
||||||
|
props.formInline
|
||||||
|
? props.ruleInfo
|
||||||
|
: {
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
function getRef() {
|
||||||
|
return ruleFormRef.value;
|
||||||
|
}
|
||||||
|
const getRuleInfo = async () => {
|
||||||
|
}
|
||||||
|
const dataList = ref([])
|
||||||
|
const options = ref([])
|
||||||
|
const TimeOptions = ref([])
|
||||||
|
const confrimData = () => {
|
||||||
|
const list = dataList.value.map(ele => {
|
||||||
|
return {
|
||||||
|
time: ele.time,
|
||||||
|
reward: ele.reward
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const formData = {
|
||||||
|
is_open_red_pack: newFormInline.value.is_open_red_pack,
|
||||||
|
is_public_server: newFormInline.value.is_public_server,
|
||||||
|
broadcast_times: newFormInline.value.broadcast_timesType === 25 ? 25 : newFormInline.value.broadcast_times.length ? newFormInline.value.broadcast_times.join(',') : '',
|
||||||
|
is_open_xlh: newFormInline.value.is_open_xlh,
|
||||||
|
min_price: newFormInline.value.min_price,
|
||||||
|
open_time: newFormInline.value.open_timeType === 1 ? `${newFormInline.value.time_date} ${newFormInline.value.time_hour}` : 0,
|
||||||
|
id: newFormInline.value.id,
|
||||||
|
timeJson: JSON.stringify(list),
|
||||||
|
}
|
||||||
|
console.log(formData, '提交的')
|
||||||
|
return formData
|
||||||
|
}
|
||||||
|
const formRef = ref({})
|
||||||
|
// 选择奖励弹窗
|
||||||
|
const settingReward = (time, content) => {
|
||||||
|
addDialog({
|
||||||
|
title: `选择奖励`,
|
||||||
|
props: {
|
||||||
|
formInline: content
|
||||||
|
},
|
||||||
|
width: "40%",
|
||||||
|
closeOnClickModal: false,
|
||||||
|
contentRenderer: () => h(rewardView, { ref: formRef, formInline: null }),
|
||||||
|
beforeSure: (done, { options }) => {
|
||||||
|
const FormRef = formRef.value.getRef();
|
||||||
|
const curData = formRef.value.getContent();
|
||||||
|
FormRef.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
content = curData
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 获取后台时间段配置
|
||||||
|
const getTimeInfo = async () => {
|
||||||
|
TimeOptions.value = []
|
||||||
|
for (let i = 0; i <= 24; i++) {
|
||||||
|
TimeOptions.value.push(`${i < 10 ? `0${i}` : i}:00`)
|
||||||
|
}
|
||||||
|
const { data, code } = await queryTimeList()
|
||||||
|
if (code) {
|
||||||
|
Object.keys(data).forEach(ele => {
|
||||||
|
options.value.push({
|
||||||
|
id: +ele,
|
||||||
|
value: data[ele]
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 构建表格
|
||||||
|
buildTable()
|
||||||
|
}
|
||||||
|
// 构建所有表格的时间段
|
||||||
|
const buildTable = () => {
|
||||||
|
dataList.value = []
|
||||||
|
if (props.ruleJson) {
|
||||||
|
props.ruleJson.forEach(ele => {
|
||||||
|
const list = ele.reward.map(v => {
|
||||||
|
return { ...v, name: `第${v.index + 1}名` }
|
||||||
|
})
|
||||||
|
dataList.value.push({ time: ele.time, reward: list })
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
options.value.forEach(t => {
|
||||||
|
let reward = []
|
||||||
|
for (let i = 0; i < 20; i++) {
|
||||||
|
const item = {
|
||||||
|
index: i,
|
||||||
|
name: `第${i + 1}名`,
|
||||||
|
content: []
|
||||||
|
}
|
||||||
|
reward.push(item)
|
||||||
|
}
|
||||||
|
dataList.value.push({ time: t.value, reward: reward })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
const handleClose = (list, data, dataIndex) => {
|
||||||
|
list.splice(dataIndex, 1)
|
||||||
|
}
|
||||||
|
if (props.ruleInfo) {
|
||||||
|
newFormInline.value = {
|
||||||
|
is_open_red_pack: props.ruleInfo.is_open_red_pack,
|
||||||
|
is_public_server: props.ruleInfo.is_public_server,
|
||||||
|
broadcast_times: props.ruleInfo,
|
||||||
|
is_open_xlh: props.ruleInfo.is_open_xlh,
|
||||||
|
min_price: props.ruleInfo.min_price,
|
||||||
|
open_time: props.ruleInfo.open_time,
|
||||||
|
id: props.ruleInfo.id,
|
||||||
|
}
|
||||||
|
// 回显时间飘屏
|
||||||
|
newFormInline.value.broadcast_timesType = props.ruleInfo.broadcast_times == '25' ? 25 : 2
|
||||||
|
if (newFormInline.value.broadcast_timesType === 2) {
|
||||||
|
if (props.ruleInfo.broadcast_times) {
|
||||||
|
newFormInline.value.broadcast_times = props.ruleInfo.broadcast_times.split(',').map(v => { return +v })
|
||||||
|
console.log()
|
||||||
|
} else {
|
||||||
|
newFormInline.value.broadcast_times = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 回显小时榜开启时间
|
||||||
|
newFormInline.value.open_timeType = props.ruleInfo.open_time == 0 ? 0 : 1
|
||||||
|
if (newFormInline.value.open_timeType) {
|
||||||
|
const date = props.ruleInfo.open_time.split(' ')
|
||||||
|
console.log(date)
|
||||||
|
if (date) {
|
||||||
|
newFormInline.value.time_date = date[0]
|
||||||
|
newFormInline.value.time_hour = date[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getRuleInfo()
|
||||||
|
getTimeInfo()
|
||||||
|
})
|
||||||
|
defineExpose({ getRef, confrimData });
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form ref="ruleFormRef" :model="newFormInline" label-width="200px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="小时榜结果是否飘屏" prop="is_public_server">
|
||||||
|
<el-switch v-model="newFormInline.is_public_server" :active-value="1" :inactive-value="2"
|
||||||
|
active-color="#13ce66" inactive-color="#ff4949">
|
||||||
|
</el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="什么时段飘屏" prop="room_intro" v-if="newFormInline.is_public_server === 1">
|
||||||
|
<el-radio-group v-model="newFormInline.broadcast_timesType">
|
||||||
|
<el-radio :label="25">全时段</el-radio>
|
||||||
|
<el-radio :label="2">自定义</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
<template v-if="newFormInline.broadcast_timesType === 2">
|
||||||
|
<el-select class="mt-5" v-model="newFormInline.broadcast_times" multiple placeholder="请选择">
|
||||||
|
<el-option v-for="item in options" :key="item.id" :label="item.value" :value="item.id">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="小时榜是否开启" prop="open_time">
|
||||||
|
<el-switch v-model="newFormInline.open_timeType" :active-value="1" :inactive-value="0"
|
||||||
|
active-color="#13ce66" inactive-color="#ff4949">
|
||||||
|
</el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" v-if="newFormInline.open_timeType === 1">
|
||||||
|
<el-form-item label="小时榜开启时间" prop="room_intro">
|
||||||
|
<div style="display: inline-flex;">
|
||||||
|
<div>
|
||||||
|
<el-date-picker v-model="newFormInline.time_date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
|
||||||
|
type="date" placeholder="选择日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</div>
|
||||||
|
<div style="width: 100px;margin-left: 10px;">
|
||||||
|
<el-select v-model="newFormInline.time_hour" placeholder="请选择时间点">
|
||||||
|
<el-option v-for="item in TimeOptions" :key="item" :label="item" :value="item">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="是否显示巡乐会入口" prop="is_open_xlh">
|
||||||
|
<el-switch v-model="newFormInline.is_open_xlh" :active-value="1" :inactive-value="0" active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949">
|
||||||
|
</el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="是否显示房间红包入口" prop="is_open_red_pack">
|
||||||
|
<el-switch v-model="newFormInline.is_open_red_pack" :active-value="1" :inactive-value="0"
|
||||||
|
active-color="#13ce66" inactive-color="#ff4949">
|
||||||
|
</el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="获奖励最少流水" prop="min_price">
|
||||||
|
<el-input-number v-model="newFormInline.min_price"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-form-item label="核心表格配置" prop="room_intro">
|
||||||
|
<div style="width: 80vw;overflow: auto;height: 500px;border: 1px solid gray; padding: 20px;margin-top: 10px;">
|
||||||
|
<div v-for="ele in dataList" :key="ele" style="width: 100%;">
|
||||||
|
<div style="font-weight: bolder;">{{ ele.time }}</div>
|
||||||
|
<div style="width:100%;display: inline-flex;margin-top: 20px;">
|
||||||
|
<div v-for="item in ele.reward"
|
||||||
|
style="min-width: 200px;cursor: pointer;border-bottom: 1px solid gray;padding-bottom: 20px;margin-bottom: 20px;width: 100%;"
|
||||||
|
@click="settingReward(ele, item)">
|
||||||
|
<div>{{ item.name }}</div>
|
||||||
|
<div v-if="item.content.length === 0">
|
||||||
|
选择奖励
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<div v-for="(child, childIndex) in item.content">
|
||||||
|
<el-tag v-if="child.type === 0" closable @close="handleClose(item.content, child, childIndex)">{{
|
||||||
|
`金币 X
|
||||||
|
${child.value || child.coin}`
|
||||||
|
}}</el-tag>
|
||||||
|
<el-tag v-if="child.type === 1" closable type="success"
|
||||||
|
@close="handleClose(item.content, child, childIndex)">{{ `礼物:
|
||||||
|
${child.name}`
|
||||||
|
}}</el-tag>
|
||||||
|
<el-tag v-if="child.type === 2" closable type="info"
|
||||||
|
@close="handleClose(item.content, child, childIndex)">{{ `${child.name}`
|
||||||
|
}}</el-tag>
|
||||||
|
<el-tag v-if="child.type === 3" closable type="warning"
|
||||||
|
@close="handleClose(item.content, child, childIndex)">{{ `${child.name}`
|
||||||
|
}}</el-tag>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -21,10 +21,10 @@ export function useData() {
|
|||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
search_id: "",
|
search_id: "",
|
||||||
search_name: "",
|
search_name: "",
|
||||||
search_stime: new Date(),
|
search_stime: "",
|
||||||
search_etime: ""
|
search_etime: ""
|
||||||
});
|
});
|
||||||
console.log(new Date())
|
// console.log(new Date())
|
||||||
const searchLabel = ref([
|
const searchLabel = ref([
|
||||||
{ label: "公会ID", prop: "search_id", type: "input" },
|
{ label: "公会ID", prop: "search_id", type: "input" },
|
||||||
{ label: "公会名称", prop: "search_name", type: "input" },
|
{ label: "公会名称", prop: "search_name", type: "input" },
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
|
|||||||
onProxyReq: (proxyReq, req, res) => {
|
onProxyReq: (proxyReq, req, res) => {
|
||||||
if (req.method === 'OPTIONS') {
|
if (req.method === 'OPTIONS') {
|
||||||
proxyReq.method = 'OPTIONS';
|
proxyReq.method = 'OPTIONS';
|
||||||
// 设置CORS头
|
// 设置CORS头 https://admin.xscmmidi.site
|
||||||
res.setHeader('Access-Control-Allow-Origin', '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-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
|
||||||
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
||||||
res.end();
|
res.end();
|
||||||
|
|||||||
Reference in New Issue
Block a user