This commit is contained in:
2025-04-23 19:48:47 +08:00
parent 86aa66800c
commit fbfd175258
12 changed files with 469 additions and 112 deletions

View File

@@ -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">

View File

@@ -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>

View 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>

View 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>