|
|
|
@ -1,4 +1,5 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
|
|
|
|
<ComponentContainerProperty v-model="formData.style">
|
|
|
|
<el-form label-width="80px" :model="formData" :rules="rules">
|
|
|
|
<el-form label-width="80px" :model="formData" :rules="rules">
|
|
|
|
<el-form-item label="公告图标" prop="iconUrl">
|
|
|
|
<el-form-item label="公告图标" prop="iconUrl">
|
|
|
|
<UploadImg v-model="formData.iconUrl" height="48px">
|
|
|
|
<UploadImg v-model="formData.iconUrl" height="48px">
|
|
|
|
@ -11,48 +12,26 @@
|
|
|
|
<el-form-item label="文字颜色" prop="文字颜色">
|
|
|
|
<el-form-item label="文字颜色" prop="文字颜色">
|
|
|
|
<ColorInput v-model="formData.textColor" />
|
|
|
|
<ColorInput v-model="formData.textColor" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-text tag="p"> 公告内容 </el-text>
|
|
|
|
|
|
|
|
<el-text type="info" size="small"> 拖动左上角的小圆点可以调整热词顺序 </el-text>
|
|
|
|
<el-card header="公告内容" class="property-group" shadow="never">
|
|
|
|
<template v-if="formData.contents.length">
|
|
|
|
<Draggable v-model="formData.contents">
|
|
|
|
<VueDraggable
|
|
|
|
<template #default="{ element }">
|
|
|
|
:list="formData.contents"
|
|
|
|
<el-form-item label="公告" prop="text" label-width="40px">
|
|
|
|
item-key="index"
|
|
|
|
|
|
|
|
handle=".drag-icon"
|
|
|
|
|
|
|
|
:forceFallback="true"
|
|
|
|
|
|
|
|
:animation="200"
|
|
|
|
|
|
|
|
class="m-t-8px"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<template #item="{ element, index }">
|
|
|
|
|
|
|
|
<div class="mb-4px flex flex-row gap-4px rounded bg-gray-100 p-8px">
|
|
|
|
|
|
|
|
<div class="flex flex-col items-start justify-between">
|
|
|
|
|
|
|
|
<Icon icon="ic:round-drag-indicator" class="drag-icon cursor-move" />
|
|
|
|
|
|
|
|
<Icon
|
|
|
|
|
|
|
|
icon="ep:delete"
|
|
|
|
|
|
|
|
class="cursor-pointer text-red-5"
|
|
|
|
|
|
|
|
@click="handleDeleteContent(index)"
|
|
|
|
|
|
|
|
v-if="formData.contents.length > 1"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="w-full flex flex-col gap-8px">
|
|
|
|
|
|
|
|
<el-input v-model="element.text" placeholder="请输入公告" />
|
|
|
|
<el-input v-model="element.text" placeholder="请输入公告" />
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="链接" prop="url" label-width="40px">
|
|
|
|
<AppLinkInput v-model="element.url" />
|
|
|
|
<AppLinkInput v-model="element.url" />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</VueDraggable>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<el-form-item label-width="0">
|
|
|
|
|
|
|
|
<el-button @click="handleAddContent" type="primary" plain class="m-t-8px w-full">
|
|
|
|
|
|
|
|
添加内容
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</Draggable>
|
|
|
|
|
|
|
|
</el-card>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
</ComponentContainerProperty>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { NoticeBarProperty, NoticeContentProperty } from './config'
|
|
|
|
import { NoticeBarProperty } from './config'
|
|
|
|
import { usePropertyForm } from '@/components/DiyEditor/util'
|
|
|
|
import { usePropertyForm } from '@/components/DiyEditor/util'
|
|
|
|
import VueDraggable from 'vuedraggable'
|
|
|
|
|
|
|
|
// 通知栏属性面板
|
|
|
|
// 通知栏属性面板
|
|
|
|
defineOptions({ name: 'NoticeBarProperty' })
|
|
|
|
defineOptions({ name: 'NoticeBarProperty' })
|
|
|
|
// 表单校验
|
|
|
|
// 表单校验
|
|
|
|
@ -63,15 +42,6 @@ const rules = {
|
|
|
|
const props = defineProps<{ modelValue: NoticeBarProperty }>()
|
|
|
|
const props = defineProps<{ modelValue: NoticeBarProperty }>()
|
|
|
|
const emit = defineEmits(['update:modelValue'])
|
|
|
|
const emit = defineEmits(['update:modelValue'])
|
|
|
|
const { formData } = usePropertyForm(props.modelValue, emit)
|
|
|
|
const { formData } = usePropertyForm(props.modelValue, emit)
|
|
|
|
|
|
|
|
|
|
|
|
/* 添加公告 */
|
|
|
|
|
|
|
|
const handleAddContent = () => {
|
|
|
|
|
|
|
|
formData.value.contents.push({} as NoticeContentProperty)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 删除公告 */
|
|
|
|
|
|
|
|
const handleDeleteContent = (index: number) => {
|
|
|
|
|
|
|
|
formData.value.contents.splice(index, 1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"></style>
|
|
|
|
<style scoped lang="scss"></style>
|
|
|
|
|