update
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user