update
This commit is contained in:
@@ -356,6 +356,13 @@ const admin = {
|
|||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
editADV: async (data) => {
|
||||||
|
return request({
|
||||||
|
url: '/admin/adv/edit',
|
||||||
|
method: Method.POST,
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
},
|
||||||
setADVStatus: async (id) => {
|
setADVStatus: async (id) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/admin/adv/status',
|
url: '/admin/adv/status',
|
||||||
|
|||||||
@@ -1,26 +1,48 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {reactive, ref} from "vue";
|
import {reactive, ref, watch} from "vue";
|
||||||
import JumpMethod from '../../../../../components/JumpMethod/index.vue';
|
import JumpMethod from '../../../../../components/JumpMethod/index.vue';
|
||||||
import UploadOne from "../../../../../components/upload/UploadOne.vue";
|
import UploadOne from "../../../../../components/upload/UploadOne.vue";
|
||||||
import Api from "../../../../../api/index.js";
|
import Api from "../../../../../api/index.js";
|
||||||
import {Message} from "@arco-design/web-vue";
|
import {Message} from "@arco-design/web-vue";
|
||||||
|
|
||||||
const {detail} = defineProps({
|
const {detail, position} = defineProps({
|
||||||
detail: {
|
detail: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {},
|
default: {},
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
type: Number,
|
||||||
|
default: 1,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const emits = defineEmits(['success']);
|
const emits = defineEmits(['success']);
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
|
watch(
|
||||||
|
() => visible.value,
|
||||||
|
(val) => {
|
||||||
|
if (val) Object.assign(form, detail);
|
||||||
|
}
|
||||||
|
)
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
file: null,
|
file: null,
|
||||||
type: 0,
|
type: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
const success = async () => {
|
const success = async () => {
|
||||||
const {msg} = await Api.admin.addADV(form);
|
if (detail.id) {
|
||||||
|
const {msg} = await Api.admin.editADV({
|
||||||
|
...form,
|
||||||
|
position
|
||||||
|
});
|
||||||
Message.success(msg);
|
Message.success(msg);
|
||||||
|
} else {
|
||||||
|
const {msg} = await Api.admin.addADV({
|
||||||
|
...form,
|
||||||
|
position
|
||||||
|
});
|
||||||
|
Message.success(msg);
|
||||||
|
}
|
||||||
|
|
||||||
emits('success');
|
emits('success');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ const delADV = async (id) => {
|
|||||||
</template>
|
</template>
|
||||||
<template v-slot:action="{record}">
|
<template v-slot:action="{record}">
|
||||||
<div class="flex gap-[10px]">
|
<div class="flex gap-[10px]">
|
||||||
<EditBanner>
|
<EditBanner :detail="record" @success="fetchData">
|
||||||
<a-link :hoverable="false">编辑</a-link>
|
<a-link :hoverable="false">编辑</a-link>
|
||||||
</EditBanner>
|
</EditBanner>
|
||||||
<a-popconfirm content="确认删除吗?" @ok="delADV(record.id)">
|
<a-popconfirm content="确认删除吗?" @ok="delADV(record.id)">
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {reactive} from "vue";
|
|||||||
import useTableQuery from "../../../../../hooks/useTableQuery.js";
|
import useTableQuery from "../../../../../hooks/useTableQuery.js";
|
||||||
import Api from "../../../../../api/index.js";
|
import Api from "../../../../../api/index.js";
|
||||||
import EditBanner from "./EditBanner.vue";
|
import EditBanner from "./EditBanner.vue";
|
||||||
|
import XSwitch from "../../../../../components/XSwitch/index.vue";
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
@@ -14,15 +15,16 @@ const columns = [
|
|||||||
{
|
{
|
||||||
title: '封面',
|
title: '封面',
|
||||||
dataIndex: 'key',
|
dataIndex: 'key',
|
||||||
|
slotName: 'file',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '跳转方式',
|
title: '跳转方式',
|
||||||
dataIndex: 'key',
|
dataIndex: 'type_text',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '是否启用',
|
title: '是否启用',
|
||||||
dataIndex: 'isA',
|
dataIndex: 'isStatus',
|
||||||
slotName: 'isA',
|
slotName: 'isStatus',
|
||||||
width: 100,
|
width: 100,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
@@ -40,16 +42,18 @@ const columns = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const po = reactive({});
|
const po = reactive({
|
||||||
|
position: 2,
|
||||||
|
});
|
||||||
const vo = reactive({
|
const vo = reactive({
|
||||||
page: '',
|
page: '',
|
||||||
rows: [],
|
rows: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
const {loading, pagination, initFetchData} = useTableQuery({
|
const {loading, pagination, fetchData} = useTableQuery({
|
||||||
parameter: po,
|
parameter: po,
|
||||||
api: Api.system.getData,
|
api: Api.admin.getADVList,
|
||||||
callback: (data) => {
|
callback: (data) => {
|
||||||
Object.assign(vo, data);
|
Object.assign(vo, data);
|
||||||
}
|
}
|
||||||
@@ -57,7 +61,7 @@ const {loading, pagination, initFetchData} = useTableQuery({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<EditBanner></EditBanner>
|
<EditBanner :position="2" @success="fetchData"></EditBanner>
|
||||||
|
|
||||||
<a-table
|
<a-table
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
@@ -66,18 +70,32 @@ const {loading, pagination, initFetchData} = useTableQuery({
|
|||||||
:data="vo.rows"
|
:data="vo.rows"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
class="flex-grow mt-[20px] w-full">
|
class="flex-grow mt-[20px] w-full">
|
||||||
<template v-slot:isA>
|
<template v-slot:file="{record}">
|
||||||
<a-switch></a-switch>
|
<a-image height="60" :src="record.file"></a-image>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:sort>
|
<template v-slot:isStatus="{record}">
|
||||||
<SequenceAdjustment></SequenceAdjustment>
|
<x-switch
|
||||||
|
v-model:model-value="record.status"
|
||||||
|
:id="record.id"
|
||||||
|
:api="Api.admin.setADVStatus"
|
||||||
|
@change="fetchData">
|
||||||
|
</x-switch>
|
||||||
</template>
|
</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]">
|
<div class="flex gap-[10px]">
|
||||||
<EditBanner>
|
<EditBanner :position="2" :detail="record" @success="fetchData">
|
||||||
<a-link :hoverable="false">编辑</a-link>
|
<a-link :hoverable="false">编辑</a-link>
|
||||||
</EditBanner>
|
</EditBanner>
|
||||||
|
<a-popconfirm content="确认删除吗?" @ok="delADV(record.id)">
|
||||||
<a-link :hoverable="false" status="danger">删除</a-link>
|
<a-link :hoverable="false" status="danger">删除</a-link>
|
||||||
|
</a-popconfirm>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
|
|||||||
Reference in New Issue
Block a user