diff --git a/src/api/modules/system.ts b/src/api/modules/system.ts index a358d0c..5054768 100644 --- a/src/api/modules/system.ts +++ b/src/api/modules/system.ts @@ -1,190 +1,156 @@ import { http } from "@/utils/http"; - type Result = { code: string; data: any; }; export const queryRuleList = params => { - return http.request( - "get", - "/adminapi/CanRecharge/recharge_lists", - { params } - ); + return http.request("get", "/adminapi/CanRecharge/recharge_lists", { + params + }); }; export const addRuleData = data => { return http.request("post", "/adminapi/CanRecharge/recharge_add", { data }); -} +}; export const editRuleData = data => { return http.request("post", "/adminapi/CanRecharge/recharge_edit", { data }); -} +}; export const deleteRuleData = data => { return http.request("post", "/adminapi/CanRecharge/recharge_del", { data }); -} +}; export const upadteRuleData = data => { return http.request("post", "/adminapi/CanRecharge/recharge_status", { data }); -} +}; // 以上充值规则设置 export const queryPageist = params => { - return http.request( - "get", - "/adminapi/Page/page_lists", - { params } - ); + return http.request("get", "/adminapi/Page/page_lists", { params }); }; export const addPageData = data => { return http.request("post", "/adminapi/Page/page_add", { data }); -} +}; export const editPageData = data => { return http.request("post", "/adminapi/Page/page_edit", { data }); -} +}; export const deletePageData = data => { return http.request("post", "/adminapi/Page/page_del", { data }); -} +}; // 主题设置 export const getThemeList = params => { - return http.request( - "get", - "/adminapi/Theme/theme_list", - { params } - ); + return http.request("get", "/adminapi/Theme/theme_list", { params }); }; export const addThemeData = data => { return http.request("post", "/adminapi/Theme/theme_add", { data }); -} +}; export const editThemeData = data => { return http.request("post", "/adminapi/Theme/theme_edit", { data }); -} +}; export const deleteThemeData = data => { return http.request("post", "/adminapi/Theme/theme_del", { data }); -} +}; export const useThemeData = data => { return http.request("post", "/adminapi/Theme/theme_apply", { data }); -} +}; // 私密设置 export const getConfigTypeList = params => { - return http.request( - "get", - "/adminapi/SysSet/type_list", - { params } - ); + return http.request("get", "/adminapi/SysSet/type_list", { params }); }; export const getConfigSetInfo = params => { - return http.request( - "get", - "/adminapi/SysSet/config_list", - { params } - ); + return http.request("get", "/adminapi/SysSet/config_list", { + params + }); }; export const SetConfigData = data => { - return http.request( - "post", - "/adminapi/SysSet/config_set", - { data } - ); + return http.request("post", "/adminapi/SysSet/config_set", { data }); }; // 帮助中心 export const getHelpTypeList = params => { - return http.request( - "get", - "/adminapi/Help/help_type_lists", - { params } - ); + return http.request("get", "/adminapi/Help/help_type_lists", { + params + }); }; export const addHelpTypeData = data => { return http.request("post", "/adminapi/Help/help_type_add", { data }); -} +}; export const editHelpTypeData = data => { return http.request("post", "/adminapi/Help/help_type_edit", { data }); -} +}; export const deleteHelpTypeData = data => { return http.request("post", "/adminapi/Help/help_type_del", { data }); -} +}; export const getProblemList = params => { - return http.request( - "get", - "/adminapi/Help/help_lists", - { params } - ); + return http.request("get", "/adminapi/Help/help_lists", { params }); }; export const addProblemData = data => { return http.request("post", "/adminapi/Help/help_add", { data }); -} +}; export const editProblemData = data => { return http.request("post", "/adminapi/Help/help_edit", { data }); -} +}; export const deleteProblemData = data => { return http.request("post", "/adminapi/Help/help_del", { data }); -} +}; export const queryTaskList = params => { - return http.request( - "get", - "/adminapi/Tasks/task_list", - { params } - ); + return http.request("get", "/adminapi/Tasks/task_list", { params }); }; export const editTaskData = data => { return http.request("post", "/adminapi/Tasks/task_edit", { data }); -} +}; export const upadteTaskData = data => { return http.request("post", "/adminapi/Tasks/task_open", { data }); -} +}; // 二级密码校验 export const checkPassWord = data => { return http.request("post", "/adminapi/SysSet/check_second_pwd", { data }); -} +}; // 私密设置 export const getLuckyCoinInfo = () => { - return http.request( - "get", - "/adminapi/Lottery/config_list" - ); + return http.request("get", "/adminapi/Lottery/config_list"); }; export const saveLuckyCoinInfo = data => { return http.request("post", "/adminapi/Lottery/config_set", { data }); -} \ No newline at end of file +}; diff --git a/src/utils/http/config.ts b/src/utils/http/config.ts index 4b1ab76..59eee5b 100644 --- a/src/utils/http/config.ts +++ b/src/utils/http/config.ts @@ -1,7 +1,7 @@ -export const URL = "https://yushengapi.qxyushen.top"; +// export const URL = "https://yushengapi.qxyushen.top"; // 预测版 -// export const URL = "https://vsyusheng.qxhs.xyz"; +export const URL = "https://vsyusheng.qxhs.xyz"; // 测试 // export const URL = "https://test.vespa.qxyushen.top"; // 声网appId 在这里换 -export const appIdBySw = '02f7339ec98947deaeab173599891932'; \ No newline at end of file +export const appIdBySw = "02f7339ec98947deaeab173599891932"; diff --git a/src/views/gift/giftList/hook.tsx b/src/views/gift/giftList/hook.tsx index 1a3d62d..4645e8e 100644 --- a/src/views/gift/giftList/hook.tsx +++ b/src/views/gift/giftList/hook.tsx @@ -1,7 +1,7 @@ import { ref, h } from "vue"; import editForm from "./form.vue"; import { message } from "@/utils/message"; -import { getGiftTypeOrLabel } from '@/api/modules/gift'; +import { getGiftTypeOrLabel } from "@/api/modules/gift"; import { queryGiftList, addGiftData, @@ -13,12 +13,14 @@ import { addDialog } from "@/components/ReDialog"; export function useData() { const getLableList = async () => { - const { data, code } = await getGiftTypeOrLabel({ type: 2 }) - searchLabel.value[searchLabel.value.length - 1].optionList = code ? data.map(ele => { - return { ...ele, label: ele.name, value: ele.id } - }) : [] - } - getLableList() + const { data, code } = await getGiftTypeOrLabel({ type: 2 }); + searchLabel.value[searchLabel.value.length - 1].optionList = code + ? data.map(ele => { + return { ...ele, label: ele.name, value: ele.id }; + }) + : []; + }; + getLableList(); const formRef = ref(); const loading = ref(true); const tableList = ref([]); @@ -33,20 +35,34 @@ export function useData() { { label: "礼物ID", prop: "search_gift_id", type: "input" }, { label: "礼物名称", prop: "search_gift_name", type: "input" }, { - label: "礼物分类", prop: "search_gift_type", type: "select", optionList: [ + label: "礼物分类", + prop: "search_gift_type", + type: "select", + optionList: [ { value: 1, - label: '普通礼物' - }, { + label: "普通礼物" + }, + { value: 2, - label: '盲盒礼物' - }, { + label: "盲盒礼物" + }, + { value: 3, - label: '礼包礼物' + label: "礼包礼物" + }, + { + value: 4, + label: "酒吧房礼物" } ] }, - { label: "礼物标签", prop: "search_gift_label", type: "select", optionList: [] } + { + label: "礼物标签", + prop: "search_gift_label", + type: "select", + optionList: [] + } ]); const pagination = ref({ total: 0, @@ -97,28 +113,36 @@ export function useData() { label: "公屏", prop: "is_public_screen", cellRenderer: ({ row }) => ( - {row.is_public_screen === 1 ? '是' : '否'} + + {row.is_public_screen === 1 ? "是" : "否"} + ) }, { label: "全服播报", prop: "is_public_server", cellRenderer: ({ row }) => ( - {row.is_public_server === 1 ? '是' : '否'} + + {row.is_public_server === 1 ? "是" : "否"} + ) }, { label: "是否显示", prop: "is_show", cellRenderer: ({ row }) => ( - {row.is_show === 1 ? '显示' : '隐藏'} + + {row.is_show === 1 ? "显示" : "隐藏"} + ) }, { label: "是否可购买", prop: "is_can_buy", cellRenderer: ({ row }) => ( - {row.is_can_buy === 1 ? '可购买' : '禁止购买'} + + {row.is_can_buy === 1 ? "可购买" : "禁止购买"} + ) }, { @@ -136,9 +160,9 @@ export function useData() { slot: "operation" } ]); - const onSearch = async (formData) => { + const onSearch = async formData => { loading.value = true; - searchForm.value = { ...formData } + searchForm.value = { ...formData }; const { data, code } = await queryGiftList({ ...formData, page: pagination.value.currentPage, @@ -170,7 +194,7 @@ export function useData() { }; // 新增 const openDialog = async (title = "新增", rowData: any) => { - const { data, code } = await getGiftInfo({ gid: rowData.gid }) + const { data, code } = await getGiftInfo({ gid: rowData.gid }); addDialog({ title: `${title}礼物`, props: { diff --git a/src/views/system/private/form.vue b/src/views/system/private/form.vue index 2838cf1..251fe41 100644 --- a/src/views/system/private/form.vue +++ b/src/views/system/private/form.vue @@ -9,8 +9,8 @@ const newFormInline = ref( props.formInline ? props.formInline : { - password: "" - } + password: "" + } ); function getRef() { return ruleFormRef.value; @@ -21,7 +21,7 @@ defineExpose({ getRef }); diff --git a/src/views/system/private/hook.tsx b/src/views/system/private/hook.tsx index 5ce2586..3a69df6 100644 --- a/src/views/system/private/hook.tsx +++ b/src/views/system/private/hook.tsx @@ -11,51 +11,52 @@ import { import { addDialog } from "@/components/ReDialog"; export function useData() { const formRef = ref(); - const formData = ref({}) + const formData = ref({}); const loading = ref(true); - const activeId = ref(0) + const activeId = ref(0); const tableList = ref([]); - const formLabel = ref([]) + const formLabel = ref([]); const isShow = ref(false); const onSearch = async () => { loading.value = true; const { data, code } = await getConfigTypeList({}); if (code) { // 测试git - tableList.value = data.filter(ele => { return ele.id !== 11 }) - activeId.value = data[0].id - getInfo(activeId.value) + tableList.value = data.filter(ele => { + return ele.id !== 11; + }); + activeId.value = data[0].id; + getInfo(activeId.value); } loading.value = false; }; - const getInfo = async (id) => { - const { data, code } = await getConfigSetInfo({ type: id }) + const getInfo = async id => { + const { data, code } = await getConfigSetInfo({ type: id }); if (code) { - formLabel.value = code ? data : [] + formLabel.value = code ? data : []; if (data && data.length) { data.forEach(ele => { - formData.value[ele.key_title] = ele.key_value - }) + formData.value[ele.key_title] = ele.key_value; + }); } } - - } - const tabClick = (event) => { - const { name } = event.props - getInfo(name) - } + }; + const tabClick = event => { + const { name } = event.props; + getInfo(name); + }; const saveConfigEvent = async () => { const { code, msg } = await SetConfigData({ ...formData.value, type: activeId.value - }) + }); if (code) { message("操作成功", { type: "success" }); - getInfo(activeId.value) + getInfo(activeId.value); } else { message(msg, { type: "error" }); } - } + }; const saveConfig = async () => { // 输入二级密码 addDialog({ @@ -72,14 +73,13 @@ export function useData() { const FormRef = formRef.value.getRef(); const curData = options.props.formInline; const saveData = async form => { - const { data, code, msg } = await checkPassWord(form) + const { data, code, msg } = await checkPassWord(form); if (code) { - saveConfigEvent() - done() + saveConfigEvent(); + done(); } else { message(msg, { type: "error" }); } - }; FormRef.validate(valid => { if (valid) { @@ -108,7 +108,7 @@ export function useData() { // } // }) // .catch(() => { }); - } + }; return { onSearch, isShow, diff --git a/vite.config.ts b/vite.config.ts index 83f64f6..7471896 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -33,13 +33,22 @@ export default ({ mode }: ConfigEnv): UserConfigExport => { // 如果后端服务器没有对OPTIONS请求进行正确处理,代理服务器可能会自动处理 // 你可以尝试添加以下配置来处理预检请求 onProxyReq: (proxyReq, req, res) => { - if (req.method === 'OPTIONS') { - proxyReq.method = 'OPTIONS'; - // res.setHeader('Access-Control-Allow-Origin', 'http://adminvs.qxhs.xyz'); - res.setHeader('Access-Control-Allow-Origin', 'http://yushenggliht.qxyushen.top'); + if (req.method === "OPTIONS") { + proxyReq.method = "OPTIONS"; + res.setHeader( + "Access-Control-Allow-Origin", + "http://adminvs.qxhs.xyz" + ); + // res.setHeader('Access-Control-Allow-Origin', 'http://yushenggliht.qxyushen.top'); // res.setHeader('Access-Control-Allow-Origin', 'https://test.vespa.qxyushen.top'); - 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-Methods", + "GET, POST, PUT, DELETE, OPTIONS" + ); + res.setHeader( + "Access-Control-Allow-Headers", + "Content-Type, Authorization" + ); res.end(); } }