update
This commit is contained in:
131
src/api/admin.js
131
src/api/admin.js
@@ -253,6 +253,137 @@ const admin = {
|
||||
data: data
|
||||
});
|
||||
},
|
||||
getBarragelist: async (data) => {
|
||||
return request({
|
||||
url: '/admin/barrage/getlist',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
addBarrage: async (data) => {
|
||||
return request({
|
||||
url: '/admin/barrage/add',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
editBarrage: async (data) => {
|
||||
return request({
|
||||
url: '/admin/barrage/edit',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
barrageWeigh: async (data) => {
|
||||
return request({
|
||||
url: '/admin/barrage/weigh',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
barrageDel: async (data) => {
|
||||
return request({
|
||||
url: '/admin/barrage/del',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
getNoticeList: async (data) => {
|
||||
return request({
|
||||
url: '/admin/notice/getList',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
addNotice: async (data) => {
|
||||
return request({
|
||||
url: '/admin/notice/add',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
editNotice: async (data) => {
|
||||
return request({
|
||||
url: '/admin/notice/edit',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
delNotice: async (id) => {
|
||||
return request({
|
||||
url: '/admin/notice/del',
|
||||
method: Method.POST,
|
||||
data: {id}
|
||||
});
|
||||
},
|
||||
getNoticeType: async () => {
|
||||
return request({
|
||||
url: '/admin/notice/getType',
|
||||
method: Method.POST,
|
||||
});
|
||||
},
|
||||
setNoticeStatus: async (id) => {
|
||||
return request({
|
||||
url: '/admin/notice/status',
|
||||
method: Method.POST,
|
||||
data: {id}
|
||||
});
|
||||
},
|
||||
setNoticeTop: async (id) => {
|
||||
return request({
|
||||
url: '/admin/notice/top',
|
||||
method: Method.POST,
|
||||
data: {id}
|
||||
});
|
||||
},
|
||||
setNotcieWeigh: async (data) => {
|
||||
return request({
|
||||
url: '/admin/notice/weigh',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
getADVType: async () => {
|
||||
return request({
|
||||
url: '/admin/adv/getType',
|
||||
method: Method.POST,
|
||||
});
|
||||
},
|
||||
addADV: async (data) => {
|
||||
return request({
|
||||
url: '/admin/adv/add',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
setADVStatus: async (id) => {
|
||||
return request({
|
||||
url: '/admin/adv/status',
|
||||
method: Method.POST,
|
||||
data: {id}
|
||||
});
|
||||
},
|
||||
setADVWeigh: async (data) => {
|
||||
return request({
|
||||
url: '/admin/adv/weigh',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
delADV: async (id) => {
|
||||
return request({
|
||||
url: '/admin/adv/del',
|
||||
method: Method.POST,
|
||||
data: {id}
|
||||
});
|
||||
},
|
||||
getADVList: async (data) => {
|
||||
return request({
|
||||
url: '/admin/adv/getList',
|
||||
method: Method.POST,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
export default admin;
|
||||
|
||||
@@ -30,6 +30,19 @@ const system = {
|
||||
]
|
||||
});
|
||||
})
|
||||
},
|
||||
uploadFile: async (file) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return request({
|
||||
UN_AES: true,
|
||||
url: '/admin/upload/upload',
|
||||
method: Method.POST,
|
||||
data: formData,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data; boundary=--------------------------611824495457697861278283'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,42 +1,38 @@
|
||||
<script setup>
|
||||
import {ref} from 'vue';
|
||||
const group = [
|
||||
{
|
||||
label: '站内URL',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: '站内富文本页面',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '微信链接',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '外部链接',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: '弹窗',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
label: '空',
|
||||
value: 5,
|
||||
},
|
||||
];
|
||||
const type = ref(0);
|
||||
import {onMounted, reactive} from 'vue';
|
||||
import Api from "../../api/index.js";
|
||||
|
||||
const group = reactive([]);
|
||||
|
||||
const {api} = defineProps({
|
||||
api: {
|
||||
type: Function,
|
||||
default: Api.admin.getNoticeType
|
||||
}
|
||||
});
|
||||
const form = defineModel('form');
|
||||
onMounted(() => {
|
||||
api().then(({data}) => {
|
||||
group.length = 0;
|
||||
group.push(...data);
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-radio-group v-model:model-value="type">
|
||||
<div class="grid grid-cols-3">
|
||||
<a-radio v-for="item in group" :key="item.value" :value="item.value">
|
||||
{{item.label}}
|
||||
</a-radio>
|
||||
</div>
|
||||
</a-radio-group>
|
||||
<a-form-item label="跳转方式">
|
||||
<a-radio-group class="w-full" v-model:model-value="form.type">
|
||||
<div class="grid grid-cols-3">
|
||||
<a-radio v-for="item in group" :key="item.id" :value="item.id">
|
||||
{{ item.name }}
|
||||
</a-radio>
|
||||
</div>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="url路径" v-if="[1,3,4].includes(form.type)">
|
||||
<a-input v-model:model-value="form.url" placeholder="请输入url路径"></a-input>
|
||||
</a-form-item>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -1,14 +1,36 @@
|
||||
<script setup>
|
||||
|
||||
import {Message} from "@arco-design/web-vue";
|
||||
|
||||
const emits = defineEmits(['success']);
|
||||
const {api, id} = defineProps({
|
||||
api: {
|
||||
type: Function,
|
||||
default: async () => {
|
||||
},
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
const move = async (status) => {
|
||||
const {code, msg} = await api({
|
||||
type: status,
|
||||
id: id,
|
||||
});
|
||||
if (code === 1) Message.success(msg);
|
||||
emits('success');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex gap-[10px]">
|
||||
<a-link :hoverable="false">
|
||||
<a-link :hoverable="false" @click="move(1)">
|
||||
<icon-arrow-rise/>
|
||||
上移
|
||||
</a-link>
|
||||
<a-link :hoverable="false">
|
||||
<a-link :hoverable="false" @click="move(0)">
|
||||
<icon-arrow-fall/>
|
||||
下移
|
||||
</a-link>
|
||||
|
||||
39
src/components/XSwitch/index.vue
Normal file
39
src/components/XSwitch/index.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<script setup>
|
||||
import {computed} from "vue";
|
||||
import {Message} from "@arco-design/web-vue";
|
||||
|
||||
const {api, id} = defineProps({
|
||||
api: {
|
||||
type: Function,
|
||||
default: async () => {
|
||||
}
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: null,
|
||||
}
|
||||
});
|
||||
const emits = defineEmits(['change']);
|
||||
const modelValue = defineModel('model-value');
|
||||
|
||||
const status = computed({
|
||||
get: () => Boolean(Number(modelValue.value)),
|
||||
set: (value) => {
|
||||
modelValue.value = value ? 1 : 0;
|
||||
},
|
||||
})
|
||||
|
||||
const change = async () => {
|
||||
const {msg} = await api(id);
|
||||
Message.success(msg);
|
||||
emits('change');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-switch v-bind="$attrs" v-model:model-value="status" @change="change"></a-switch>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
26
src/components/upload/UploadOne.vue
Normal file
26
src/components/upload/UploadOne.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<script setup>
|
||||
import Api from "../../api/index.js";
|
||||
|
||||
const emits = defineEmits(['success']);
|
||||
const files = defineModel('file');
|
||||
|
||||
const beforeUpload = (file) => {
|
||||
Api.system.uploadFile(file).then(({data}) => {
|
||||
files.value = data;
|
||||
emits('success', file);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-upload draggable @before-upload="beforeUpload">
|
||||
<template #upload-button v-if="files">
|
||||
<a-image :src="files"></a-image>
|
||||
</template>
|
||||
</a-upload>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
@@ -1,8 +1,28 @@
|
||||
<script setup>
|
||||
import {ref} from "vue";
|
||||
import {reactive, ref} from "vue";
|
||||
import JumpMethod from '../../../../../components/JumpMethod/index.vue';
|
||||
import UploadOne from "../../../../../components/upload/UploadOne.vue";
|
||||
import Api from "../../../../../api/index.js";
|
||||
import {Message} from "@arco-design/web-vue";
|
||||
|
||||
const {detail} = defineProps({
|
||||
detail: {
|
||||
type: Object,
|
||||
default: {},
|
||||
}
|
||||
});
|
||||
const emits = defineEmits(['success']);
|
||||
const visible = ref(false);
|
||||
const form = reactive({
|
||||
file: null,
|
||||
type: 0,
|
||||
});
|
||||
|
||||
const success = async () => {
|
||||
const {msg} = await Api.admin.addADV(form);
|
||||
Message.success(msg);
|
||||
emits('success');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -19,14 +39,13 @@ const visible = ref(false);
|
||||
<a-modal
|
||||
title="编辑平台消息"
|
||||
title-align="start"
|
||||
@ok="success"
|
||||
v-model:visible="visible">
|
||||
<a-form layout="vertical">
|
||||
<a-form-item label="封面">
|
||||
<a-upload></a-upload>
|
||||
</a-form-item>
|
||||
<a-form-item label="跳转方式">
|
||||
<JumpMethod></JumpMethod>
|
||||
<upload-one v-model:file="form.file"></upload-one>
|
||||
</a-form-item>
|
||||
<JumpMethod v-model:form="form" :api="Api.admin.getADVType"></JumpMethod>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
@@ -1,38 +1,63 @@
|
||||
<script setup>
|
||||
import {ref} from "vue";
|
||||
import {reactive, ref, watch} from "vue";
|
||||
import Api from "../../../../../api/index.js";
|
||||
import {Message} from "@arco-design/web-vue";
|
||||
import JumpMethod from "../../../../../components/JumpMethod/index.vue";
|
||||
|
||||
const visible = ref(false);
|
||||
const emits = defineEmits(['success']);
|
||||
const {detail} = defineProps({
|
||||
detail: {
|
||||
type: Object,
|
||||
default: null,
|
||||
}
|
||||
});
|
||||
const form = reactive({
|
||||
title: null,
|
||||
content: null,
|
||||
type: null,
|
||||
url: null,
|
||||
id: null,
|
||||
});
|
||||
|
||||
const success = async () => {
|
||||
if (detail?.id) {
|
||||
const {code, msg} = await Api.admin.editNotice(form);
|
||||
if (code === 1) Message.success(msg);
|
||||
} else {
|
||||
const {code, msg} = await Api.admin.addNotice(form);
|
||||
if (code === 1) Message.success(msg);
|
||||
}
|
||||
emits('success');
|
||||
}
|
||||
|
||||
watch(
|
||||
() => visible.value,
|
||||
(val) => {
|
||||
if (val) Object.assign(form, detail)
|
||||
},
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-link :hoverable="false" @click="visible=true">编辑</a-link>
|
||||
<a-link v-if="!$slots.default" :hoverable="false" @click="visible=true">编辑</a-link>
|
||||
<view @click="visible=true" v-else>
|
||||
<slot></slot>
|
||||
</view>
|
||||
|
||||
<a-modal
|
||||
title="编辑平台消息"
|
||||
:on-before-ok="success"
|
||||
:title="`${detail ? '编辑' : '新增'}平台消息`"
|
||||
title-align="start"
|
||||
v-model:visible="visible">
|
||||
<a-form layout="vertical">
|
||||
<a-form-item label="标题">
|
||||
<a-input placeholder="请输入标题"></a-input>
|
||||
<a-input v-model:model-value="form.title" placeholder="请输入标题"></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label="简介">
|
||||
<a-textarea placeholder="请输入简介"></a-textarea>
|
||||
</a-form-item>
|
||||
<a-form-item label="跳转方式">
|
||||
<a-radio-group>
|
||||
<div class="grid grid-cols-3">
|
||||
<a-radio :value="0">站内URL</a-radio>
|
||||
<a-radio :value="1">站内富文本页面</a-radio>
|
||||
<a-radio :value="2">微信链接</a-radio>
|
||||
<a-radio :value="3">外部链接</a-radio>
|
||||
<a-radio :value="4">弹窗</a-radio>
|
||||
<a-radio :value="5">空</a-radio>
|
||||
</div>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item label="链接">
|
||||
<a-input placeholder="请输入链接"></a-input>
|
||||
<a-textarea v-model:model-value="form.content" placeholder="请输入简介"></a-textarea>
|
||||
</a-form-item>
|
||||
<JumpMethod v-model:form="form"></JumpMethod>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
@@ -4,6 +4,8 @@ import {reactive} from "vue";
|
||||
import useTableQuery from "../../../../../hooks/useTableQuery.js";
|
||||
import Api from "../../../../../api/index.js";
|
||||
import EditBanner from "./EditBanner.vue";
|
||||
import XSwitch from "../../../../../components/XSwitch/index.vue";
|
||||
import {Message} from "@arco-design/web-vue";
|
||||
|
||||
const columns = [
|
||||
{
|
||||
@@ -14,15 +16,16 @@ const columns = [
|
||||
{
|
||||
title: '封面',
|
||||
dataIndex: 'key',
|
||||
slotName: 'file',
|
||||
},
|
||||
{
|
||||
title: '跳转方式',
|
||||
dataIndex: 'key',
|
||||
dataIndex: 'type_text',
|
||||
},
|
||||
{
|
||||
title: '是否启用',
|
||||
dataIndex: 'isA',
|
||||
slotName: 'isA',
|
||||
dataIndex: 'isStatus',
|
||||
slotName: 'isStatus',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
},
|
||||
@@ -47,17 +50,23 @@ const vo = reactive({
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const {loading, pagination, initFetchData} = useTableQuery({
|
||||
const {loading, pagination, fetchData} = useTableQuery({
|
||||
parameter: po,
|
||||
api: Api.system.getData,
|
||||
api: Api.admin.getADVList,
|
||||
callback: (data) => {
|
||||
Object.assign(vo, data);
|
||||
}
|
||||
});
|
||||
|
||||
const delADV = async (id) => {
|
||||
const {msg} = await Api.admin.delADV(id);
|
||||
Message.success(msg);
|
||||
await fetchData();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<EditBanner></EditBanner>
|
||||
<EditBanner @success="fetchData"></EditBanner>
|
||||
|
||||
<a-table
|
||||
:loading="loading"
|
||||
@@ -66,18 +75,32 @@ const {loading, pagination, initFetchData} = useTableQuery({
|
||||
:data="vo.rows"
|
||||
:columns="columns"
|
||||
class="flex-grow mt-[20px] w-full">
|
||||
<template v-slot:isA>
|
||||
<a-switch></a-switch>
|
||||
<template v-slot:file="{record}">
|
||||
<a-image height="60" :src="record.file"></a-image>
|
||||
</template>
|
||||
<template v-slot:sort>
|
||||
<SequenceAdjustment></SequenceAdjustment>
|
||||
<template v-slot:isStatus="{record}">
|
||||
<x-switch
|
||||
v-model:model-value="record.status"
|
||||
:id="record.id"
|
||||
:api="Api.admin.setADVStatus"
|
||||
@change="fetchData">
|
||||
</x-switch>
|
||||
</template>
|
||||
<template v-slot:action>
|
||||
<template v-slot:sort="{record}">
|
||||
<SequenceAdjustment
|
||||
:id="record.id"
|
||||
@success="fetchData"
|
||||
:api="Api.admin.setADVWeigh">
|
||||
</SequenceAdjustment>
|
||||
</template>
|
||||
<template v-slot:action="{record}">
|
||||
<div class="flex gap-[10px]">
|
||||
<EditBanner>
|
||||
<a-link :hoverable="false">编辑</a-link>
|
||||
</EditBanner>
|
||||
<a-link :hoverable="false" status="danger">删除</a-link>
|
||||
<a-popconfirm content="确认删除吗?" @ok="delADV(record.id)">
|
||||
<a-link :hoverable="false" status="danger">删除</a-link>
|
||||
</a-popconfirm>
|
||||
</div>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
@@ -3,16 +3,17 @@ import {reactive} from "vue";
|
||||
import useTableQuery from "../../../../../hooks/useTableQuery.js";
|
||||
import Api from "../../../../../api/index.js";
|
||||
import SequenceAdjustment from "../../../../../components/SequenceAdjustment/index.vue";
|
||||
import {Message} from "@arco-design/web-vue";
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'key',
|
||||
dataIndex: 'id',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: '内容',
|
||||
dataIndex: 'content',
|
||||
dataIndex: 'title',
|
||||
slotName: 'content',
|
||||
},
|
||||
{
|
||||
@@ -36,21 +37,48 @@ const vo = reactive({
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const {loading, pagination, initFetchData} = useTableQuery({
|
||||
const {loading, pagination, initFetchData, fetchData} = useTableQuery({
|
||||
parameter: po,
|
||||
api: Api.system.getData,
|
||||
api: Api.admin.getBarragelist,
|
||||
callback: (data) => {
|
||||
Object.assign(vo, data);
|
||||
}
|
||||
});
|
||||
|
||||
const success = async (item) => {
|
||||
if (item.id !== null) {
|
||||
const {msg, code} = await Api.admin.editBarrage({
|
||||
id: item.id,
|
||||
title: item.title
|
||||
});
|
||||
if (code === 1) Message.success(msg);
|
||||
} else {
|
||||
const {msg, code} = await Api.admin.addBarrage({
|
||||
title: item.title
|
||||
});
|
||||
if (code === 1) Message.success(msg);
|
||||
}
|
||||
await initFetchData();
|
||||
}
|
||||
|
||||
const addContext = () => {
|
||||
vo.rows.push({
|
||||
id: null,
|
||||
title: null,
|
||||
})
|
||||
}
|
||||
|
||||
const barrageDel = async (id) => {
|
||||
const {code, msg} = await Api.admin.barrageDel({
|
||||
id: id
|
||||
});
|
||||
if (code === 1) Message.success(msg);
|
||||
await fetchData();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-button type="primary">
|
||||
<a-button type="primary" @click="addContext">
|
||||
<template #icon>
|
||||
<icon-plus/>
|
||||
</template>
|
||||
@@ -67,15 +95,21 @@ const success = async (item) => {
|
||||
<template v-slot:content="{record}">
|
||||
<a-textarea
|
||||
@blur="success(record)"
|
||||
v-model:model-value="record.key"
|
||||
v-model:model-value="record.title"
|
||||
auto-size>
|
||||
</a-textarea>
|
||||
</template>
|
||||
<template v-slot:sort>
|
||||
<SequenceAdjustment></SequenceAdjustment>
|
||||
<template v-slot:sort="{record}">
|
||||
<SequenceAdjustment
|
||||
@success="fetchData"
|
||||
:api="Api.admin.barrageWeigh"
|
||||
:id="record.id">
|
||||
</SequenceAdjustment>
|
||||
</template>
|
||||
<template v-slot:action>
|
||||
<a-link :hoverable="false" status="danger">删除</a-link>
|
||||
<template v-slot:action="{record}">
|
||||
<a-popconfirm content="您确认删除吗?" @ok="barrageDel(record.id)">
|
||||
<a-link :hoverable="false" status="danger">删除</a-link>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
</a-table>
|
||||
</template>
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
import {reactive} from "vue";
|
||||
import useTableQuery from "../../../../../hooks/useTableQuery.js";
|
||||
import Api from "../../../../../api/index.js";
|
||||
import XSwitch from "../../../../../components/XSwitch/index.vue";
|
||||
import SequenceAdjustment from "../../../../../components/SequenceAdjustment/index.vue";
|
||||
import EditPlatformNews from "./EditPlatformNews.vue";
|
||||
import {Message} from "@arco-design/web-vue";
|
||||
|
||||
const columns = [
|
||||
{
|
||||
@@ -13,30 +15,30 @@ const columns = [
|
||||
},
|
||||
{
|
||||
title: '标题',
|
||||
dataIndex: 'key',
|
||||
dataIndex: 'title',
|
||||
},
|
||||
{
|
||||
title: '简介',
|
||||
dataIndex: 'key',
|
||||
dataIndex: 'content',
|
||||
},
|
||||
{
|
||||
title: '跳转方式',
|
||||
dataIndex: 'key',
|
||||
dataIndex: 'type_text',
|
||||
},
|
||||
{
|
||||
title: '发布时间',
|
||||
dataIndex: 'key',
|
||||
dataIndex: 'createtime',
|
||||
},
|
||||
{
|
||||
title: '是否启用',
|
||||
dataIndex: 'isA',
|
||||
slotName: 'isA',
|
||||
dataIndex: 'status',
|
||||
slotName: 'isStatus',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '是否置顶',
|
||||
dataIndex: 'isTop',
|
||||
dataIndex: 'is_top',
|
||||
slotName: 'isTop',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
@@ -62,22 +64,30 @@ const vo = reactive({
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const {loading, pagination, initFetchData} = useTableQuery({
|
||||
const {loading, pagination, initFetchData, fetchData} = useTableQuery({
|
||||
parameter: po,
|
||||
api: Api.system.getData,
|
||||
api: Api.admin.getNoticeList,
|
||||
callback: (data) => {
|
||||
Object.assign(vo, data);
|
||||
}
|
||||
});
|
||||
|
||||
const delNotice = async (id) => {
|
||||
const {code, msg} = await Api.admin.delNotice(id);
|
||||
if (code === 1) Message.success(msg);
|
||||
await fetchData();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-button type="primary">
|
||||
<template #icon>
|
||||
<icon-plus/>
|
||||
</template>
|
||||
新建
|
||||
</a-button>
|
||||
<EditPlatformNews @success="fetchData">
|
||||
<a-button type="primary">
|
||||
<template #icon>
|
||||
<icon-plus/>
|
||||
</template>
|
||||
新建
|
||||
</a-button>
|
||||
</EditPlatformNews>
|
||||
|
||||
<a-table
|
||||
:loading="loading"
|
||||
@@ -86,19 +96,35 @@ const {loading, pagination, initFetchData} = useTableQuery({
|
||||
:data="vo.rows"
|
||||
:columns="columns"
|
||||
class="flex-grow mt-[20px] w-full">
|
||||
<template v-slot:isA>
|
||||
<a-switch></a-switch>
|
||||
<template v-slot:isStatus="{record}">
|
||||
<x-switch
|
||||
v-model:model-value="record.status"
|
||||
:id="record.id"
|
||||
:api="Api.admin.setNoticeStatus"
|
||||
@change="fetchData">
|
||||
</x-switch>
|
||||
</template>
|
||||
<template v-slot:isTop>
|
||||
<a-switch></a-switch>
|
||||
<template v-slot:isTop="{record}">
|
||||
<x-switch
|
||||
v-model:model-value="record.is_top"
|
||||
:id="record.id"
|
||||
:api="Api.admin.setNoticeTop"
|
||||
@change="fetchData">
|
||||
</x-switch>
|
||||
</template>
|
||||
<template v-slot:sort>
|
||||
<SequenceAdjustment></SequenceAdjustment>
|
||||
<template v-slot:sort="{record}">
|
||||
<SequenceAdjustment
|
||||
:id="record.id"
|
||||
@success="fetchData"
|
||||
:api="Api.admin.setNotcieWeigh">
|
||||
</SequenceAdjustment>
|
||||
</template>
|
||||
<template v-slot:action>
|
||||
<template v-slot:action="{record}">
|
||||
<div class="flex gap-[20px]">
|
||||
<EditPlatformNews></EditPlatformNews>
|
||||
<a-link :hoverable="false" status="danger">删除</a-link>
|
||||
<EditPlatformNews @success="fetchData" :detail="record"></EditPlatformNews>
|
||||
<a-popconfirm content="确认删除吗?" @ok="delNotice(record.id)">
|
||||
<a-link :hoverable="false" status="danger">删除</a-link>
|
||||
</a-popconfirm>
|
||||
</div>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
@@ -20,11 +20,13 @@ request.interceptors.request.use((config) => {
|
||||
|
||||
console.log('请求拦截器', config.data);
|
||||
|
||||
const {context, iv} = AESCrypto.encrypt(JSON.stringify(config.data));
|
||||
if (!config.UN_AES) {
|
||||
const {context, iv} = AESCrypto.encrypt(JSON.stringify(config.data));
|
||||
|
||||
config.data = {
|
||||
requestData: context, iv: iv,
|
||||
};
|
||||
config.data = {
|
||||
requestData: context, iv: iv,
|
||||
};
|
||||
}
|
||||
|
||||
return config;
|
||||
}, (error) => {
|
||||
@@ -41,6 +43,7 @@ request.interceptors.response.use((response) => {
|
||||
}
|
||||
if (code !== 1) {
|
||||
Message.error(msg);
|
||||
return Promise.reject(msg);
|
||||
}
|
||||
if (!data.data) {
|
||||
return {msg, code, data}
|
||||
|
||||
Reference in New Issue
Block a user