|
@@ -0,0 +1,561 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="pc-edit">
|
|
|
|
|
+ <!-- 内容 -->
|
|
|
|
|
+ <div class="content-wrap" v-show="diyStore.editTab == 'content'">
|
|
|
|
|
+ <div class="edit-attr-item-wrap">
|
|
|
|
|
+ <h3 class="mb-[10px]">站点头部</h3>
|
|
|
|
|
+ <el-form label-width="80px" class="px-[10px]">
|
|
|
|
|
+ <el-form-item label="设置">
|
|
|
|
|
+ <el-radio-group v-model="diyStore.editComponent.settings" fill="#409eff">
|
|
|
|
|
+ <el-radio-button label="顶部" :value="1" />
|
|
|
|
|
+ <el-radio-button label="左侧" :value="2" />
|
|
|
|
|
+ <el-radio-button label="中间" :value="3" />
|
|
|
|
|
+ <el-radio-button label="右侧" :value="4" />
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <template v-if="diyStore.editComponent.settings == 1">
|
|
|
|
|
+ <div class="edit-attr-item-wrap">
|
|
|
|
|
+ <h3 class="mb-[10px]">顶部设置</h3>
|
|
|
|
|
+ <el-form label-width="80px" class="px-[10px]">
|
|
|
|
|
+ <el-form-item label="logo1">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <upload-image v-model="diyStore.editComponent.logo1" :limit="1" />
|
|
|
|
|
+ <div class="annotation">建议尺寸:宽度170px*88px</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="logo2">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <upload-image v-model="diyStore.editComponent.logo2" :limit="1" />
|
|
|
|
|
+ <div class="annotation">建议尺寸:宽度170px*88px</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="二维码">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <upload-image v-model="diyStore.editComponent.code" :limit="1" />
|
|
|
|
|
+ <div class="annotation">建议尺寸:宽度100px*100px</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="edit-attr-item-wrap">
|
|
|
|
|
+ <div class="edit-attr-title flex-row-between">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <span>导航栏</span>
|
|
|
|
|
+ <span class="title2">鼠标拖拽可以改变顺序</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <el-radio-group v-model="diyStore.editComponent.topType" fill="#409eff">
|
|
|
|
|
+ <el-radio-button label="顶部导航" :value="1" />
|
|
|
|
|
+ <el-radio-button label="标签" :value="2" />
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-form label-width="80px" class="px-[10px]">
|
|
|
|
|
+ <template v-if="diyStore.editComponent.topType == 1">
|
|
|
|
|
+ <draggable v-model="diyStore.editComponent.topNav" item-key="id">
|
|
|
|
|
+ <template #item="{ element, index }">
|
|
|
|
|
+ <div class="edit-attr-box">
|
|
|
|
|
+ <el-icon @click="onDel(1, index)" color="#F56C6C" size="18px" class="circleClose">
|
|
|
|
|
+ <CircleCloseFilled />
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ <el-form-item label="导航名称">
|
|
|
|
|
+ <el-input v-model="element.title" placeholder="请输入导航名称" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="链接地址">
|
|
|
|
|
+ <WebLinkInput v-model="element.url" placeholder="请输入或选择链接" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </draggable>
|
|
|
|
|
+ <el-button @click="onAdd(1)" style="width: 100%; margin-top: 10px">新增顶部导航</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-if="diyStore.editComponent.topType == 2">
|
|
|
|
|
+ <draggable v-model="diyStore.editComponent.toplabel" item-key="id">
|
|
|
|
|
+ <template #item="{ element, index }">
|
|
|
|
|
+ <div class="edit-attr-box">
|
|
|
|
|
+ <el-icon @click="onDel(2, index)" color="#F56C6C" size="18px" class="circleClose">
|
|
|
|
|
+ <CircleCloseFilled />
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ <el-form-item label="标签名称">
|
|
|
|
|
+ <el-input v-model="element.title" placeholder="请输入标签名称" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="链接地址">
|
|
|
|
|
+ <WebLinkInput v-model="element.url" placeholder="请输入或选择链接" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </draggable>
|
|
|
|
|
+ <el-button @click="onAdd(2)" style="width: 100%; margin-top: 10px">新增标签</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-if="diyStore.editComponent.settings == 2">
|
|
|
|
|
+ <div class="edit-attr-item-wrap">
|
|
|
|
|
+ <h3 class="mb-[10px]">左侧导航设置</h3>
|
|
|
|
|
+ <el-form label-width="80px" class="px-[10px]">
|
|
|
|
|
+ <el-form-item label="样式选择">
|
|
|
|
|
+ <el-radio-group v-model="diyStore.editComponent.leftStyle">
|
|
|
|
|
+ <el-radio :value="1">样式1</el-radio>
|
|
|
|
|
+ <el-radio :value="2">样式2</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-if="diyStore.editComponent.settings == 3">
|
|
|
|
|
+ <div class="edit-attr-item-wrap">
|
|
|
|
|
+ <h3 class="mb-[10px]">中间轮播图</h3>
|
|
|
|
|
+ <el-form label-width="80px" class="px-[10px]">
|
|
|
|
|
+ <el-form-item label="轮播左右键" label-width="120">
|
|
|
|
|
+ <el-radio-group v-model="diyStore.editComponent.carouselType">
|
|
|
|
|
+ <el-radio :value="1">圆形</el-radio>
|
|
|
|
|
+ <el-radio :value="2">方形</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-if="diyStore.editComponent.settings == 4">
|
|
|
|
|
+ <div class="edit-attr-item-wrap">
|
|
|
|
|
+ <h3 class="mb-[10px]">右侧设置</h3>
|
|
|
|
|
+ <el-form label-width="80px" class="px-[10px]">
|
|
|
|
|
+ <el-form-item label="登录状态">
|
|
|
|
|
+ <el-radio-group v-model="diyStore.editComponent.login">
|
|
|
|
|
+ <el-radio :value="1">未登录</el-radio>
|
|
|
|
|
+ <el-radio :value="2">已登录</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <!-- <el-form-item label="资讯位置">
|
|
|
|
|
+ <el-radio-group v-model="diyStore.editComponent.realType">
|
|
|
|
|
+ <el-radio :value="1">在上</el-radio>
|
|
|
|
|
+ <el-radio :value="2">在下</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item> -->
|
|
|
|
|
+ <el-form-item label="数据来源">
|
|
|
|
|
+ <el-radio-group v-model="diyStore.editComponent.realDataType">
|
|
|
|
|
+ <el-radio :value="1">默认</el-radio>
|
|
|
|
|
+ <el-radio :value="2">手动</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="文章数量" v-if="diyStore.editComponent.realDataType == 1">
|
|
|
|
|
+ <el-slider v-model="diyStore.editComponent.realNumber" show-input :min="1" :max="5" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="手动选择" v-else>
|
|
|
|
|
+ <div class="data-num" @click="openDialog">
|
|
|
|
|
+ <span v-if="diyStore.editComponent.realIds.length == 0">请选择</span>
|
|
|
|
|
+ <span v-else>已选择{{ diyStore.editComponent.realIds.length }}个</span>
|
|
|
|
|
+ <el-icon><ArrowRight /></el-icon>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="edit-attr-item-wrap">
|
|
|
|
|
+ <div class="edit-attr-title flex-row-between">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <span>导航设置</span>
|
|
|
|
|
+ <span class="title2">鼠标拖拽可以改变顺序</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-form label-width="80px" class="px-[10px]">
|
|
|
|
|
+ <draggable v-model="diyStore.editComponent.navlList" item-key="id">
|
|
|
|
|
+ <template #item="{ element, index }">
|
|
|
|
|
+ <div class="edit-attr-box">
|
|
|
|
|
+ <el-icon @click="onDel(4, index)" color="#F56C6C" size="18px" class="circleClose">
|
|
|
|
|
+ <CircleCloseFilled />
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ <el-form-item label="图片上传">
|
|
|
|
|
+ <div class="flex-row-start">
|
|
|
|
|
+ <upload-image v-model="element.imageUrl" :limit="1" />
|
|
|
|
|
+ <div class="flex-column-between images-bos">
|
|
|
|
|
+ <div class="annotation3">(建议上传尺寸相同图片,推荐尺寸150*150)</div>
|
|
|
|
|
+ <div class="flex-row-between images-box">
|
|
|
|
|
+ <div>缩放模式</div>
|
|
|
|
|
+ <div class="flex-row-start" @click="openImageType(element, 3)">
|
|
|
|
|
+ <span style="margin-top: 2px" class="text-primary flex-1 cursor-pointer">{{
|
|
|
|
|
+ element.imgType == 1 ? '拉伸' : element.imgType == 2 ? '缩放' : '填充'
|
|
|
|
|
+ }}</span>
|
|
|
|
|
+ <el-icon class="cursor-pointer">
|
|
|
|
|
+ <ArrowRight />
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="标签名称">
|
|
|
|
|
+ <el-input v-model="element.title" placeholder="请输入标签名称" :maxlength="4" show-word-limit />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="链接地址">
|
|
|
|
|
+ <WebLinkInput v-model="element.url" placeholder="请输入或选择链接" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </draggable>
|
|
|
|
|
+ <el-button @click="onAdd(4)" style="width: 100%; margin-top: 10px">新增导航</el-button>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- 样式 -->
|
|
|
|
|
+ <div class="style-wrap" v-show="diyStore.editTab == 'style'">
|
|
|
|
|
+ <div class="edit-attr-item-wrap">
|
|
|
|
|
+ <h3 class="mb-[10px]">轮播区域设置</h3>
|
|
|
|
|
+ <el-form label-width="80px" class="px-[10px]">
|
|
|
|
|
+ <el-form-item label="切换间隔ms" label-width="100px">
|
|
|
|
|
+ <el-slider v-model="diyStore.editComponent.carouselInterval" show-input :min="1000" :max="6000" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="图片圆角">
|
|
|
|
|
+ <el-slider v-model="diyStore.editComponent.carouselRadius" show-input :min="0" :max="100" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="样式">
|
|
|
|
|
+ <el-radio-group v-model="diyStore.editComponent.carouselStyleType">
|
|
|
|
|
+ <el-radio :value="1">直线</el-radio>
|
|
|
|
|
+ <el-radio :value="2">圆点</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="位置">
|
|
|
|
|
+ <el-radio-group v-model="diyStore.editComponent.carouselPosition">
|
|
|
|
|
+ <el-radio :value="1">居左</el-radio>
|
|
|
|
|
+ <el-radio :value="2">居中</el-radio>
|
|
|
|
|
+ <el-radio :value="3">居右</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="颜色">
|
|
|
|
|
+ <span class="mr-[10px]">{{ diyStore.editComponent.carouselStyleColor }}</span>
|
|
|
|
|
+ <el-color-picker class="mr-[10px]" v-model="diyStore.editComponent.carouselStyleColor" />
|
|
|
|
|
+ <el-button @click="diyStore.editComponent.carouselStyleColor = '#ffffff'" size="small">重置</el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="edit-attr-item-wrap">
|
|
|
|
|
+ <h3 class="mb-[10px]">左侧区域设置</h3>
|
|
|
|
|
+ <el-form class="px-[10px]">
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="主文字颜色">
|
|
|
|
|
+ <el-color-picker v-model="diyStore.editComponent.leftColor1" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="背景颜色">
|
|
|
|
|
+ <el-color-picker v-model="diyStore.editComponent.leftBackground" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="副文字颜色">
|
|
|
|
|
+ <el-color-picker v-model="diyStore.editComponent.leftColor2" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="edit-attr-item-wrap">
|
|
|
|
|
+ <h3 class="mb-[10px]">右侧区域导航</h3>
|
|
|
|
|
+ <el-form label-width="80px" class="px-[10px]">
|
|
|
|
|
+ <el-form-item label="图片圆角">
|
|
|
|
|
+ <el-slider v-model="diyStore.editComponent.rightRadius" show-input :min="0" :max="50" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- 组件样式 -->
|
|
|
|
|
+ <slot name="style"></slot>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <ImagesForm ref="ImagesFormRef" @confirmCallBack="confirmCallBack"></ImagesForm>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 手动选择 -->
|
|
|
|
|
+ <el-dialog v-model="showDialog" title="选择资讯">
|
|
|
|
|
+ <div class="data-bos">
|
|
|
|
|
+ <el-input v-model="queryParams.announcementTitle" placeholder="请输入资讯标题" clearable style="width: 300px; margin-bottom: 10px">
|
|
|
|
|
+ <template #append>
|
|
|
|
|
+ <el-button @click="handleQuery" :icon="Search" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ <el-table ref="multipleTableRef" v-loading="loading" :data="tableData" border @selection-change="handleSelectionChange">
|
|
|
|
|
+ <el-table-column type="selection" width="55" />
|
|
|
|
|
+ <el-table-column label="标题" prop="announcementTitle" align="center" min-width="200" show-overflow-tooltip />
|
|
|
|
|
+ <el-table-column label="发布时间" align="center" prop="createTime" width="180" />
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ <pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList">
|
|
|
|
|
+ <template #slotDiv>
|
|
|
|
|
+ <div class="selected">已选择 {{ multipleSelection.length }} 个</div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </pagination>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <span class="dialog-footer">
|
|
|
|
|
+ <el-button @click="showDialog = false">取消</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="onConfirm">确认</el-button>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script setup name="Index" lang="ts">
|
|
|
|
|
+import draggable from 'vuedraggable';
|
|
|
|
|
+import usePcdiyStore from '@/store/modules/pcdiy';
|
|
|
|
|
+import uploadImage from '@/components/upload-image/index.vue';
|
|
|
|
|
+import ImagesForm from '@/components/ImagesForm/index.vue';
|
|
|
|
|
+import { listAnnouncement } from '@/api/system/announcement';
|
|
|
|
|
+import type { TableInstance } from 'element-plus';
|
|
|
|
|
+import { Search } from '@element-plus/icons-vue';
|
|
|
|
|
+const diyStore = usePcdiyStore();
|
|
|
|
|
+const ImagesFormRef = ref();
|
|
|
|
|
+const multipleTableRef = ref<TableInstance>();
|
|
|
|
|
+const showDialog = ref(false);
|
|
|
|
|
+const loading = ref(false);
|
|
|
|
|
+const tableData = ref<any[]>([]);
|
|
|
|
|
+const multipleSelection: any = ref([]); // 选中数据
|
|
|
|
|
+const total = ref(0);
|
|
|
|
|
+const queryParams = reactive({
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: 10,
|
|
|
|
|
+ announcementTitle: ''
|
|
|
|
|
+});
|
|
|
|
|
+const resultList = ref<any>([]); //单页之前被选中的数据
|
|
|
|
|
+
|
|
|
|
|
+const onAdd = (res: any) => {
|
|
|
|
|
+ if (res == 1) {
|
|
|
|
|
+ //顶部导航
|
|
|
|
|
+ diyStore.editComponent.topNav.push({
|
|
|
|
|
+ title: '',
|
|
|
|
|
+ url: ''
|
|
|
|
|
+ });
|
|
|
|
|
+ } else if (res == 2) {
|
|
|
|
|
+ //标签
|
|
|
|
|
+ diyStore.editComponent.toplabel.push({
|
|
|
|
|
+ title: '',
|
|
|
|
|
+ url: ''
|
|
|
|
|
+ });
|
|
|
|
|
+ } else if (res == 3) {
|
|
|
|
|
+ //轮播图
|
|
|
|
|
+ diyStore.editComponent.carouselList.push({
|
|
|
|
|
+ imageUrl: '',
|
|
|
|
|
+ url: '',
|
|
|
|
|
+ imgType: 1,
|
|
|
|
|
+ show: true,
|
|
|
|
|
+ id: Date.now()
|
|
|
|
|
+ });
|
|
|
|
|
+ } else if (res == 4) {
|
|
|
|
|
+ //导航
|
|
|
|
|
+ diyStore.editComponent.navlList.push({
|
|
|
|
|
+ imageUrl: '',
|
|
|
|
|
+ title: '',
|
|
|
|
|
+ url: '',
|
|
|
|
|
+ imgType: 1,
|
|
|
|
|
+ id: Date.now()
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const onDel = (res: any, index: any) => {
|
|
|
|
|
+ if (res == 1) {
|
|
|
|
|
+ //顶部导航
|
|
|
|
|
+ diyStore.editComponent.topNav.splice(index, 1);
|
|
|
|
|
+ } else if (res == 2) {
|
|
|
|
|
+ //标签
|
|
|
|
|
+ diyStore.editComponent.toplabel.splice(index, 1);
|
|
|
|
|
+ } else if (res == 3) {
|
|
|
|
|
+ //轮播图
|
|
|
|
|
+ diyStore.editComponent.carouselList.splice(index, 1);
|
|
|
|
|
+ } else if (res == 4) {
|
|
|
|
|
+ //导航
|
|
|
|
|
+ diyStore.editComponent.navlList.splice(index, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const onAdvertNum = (res: any) => {
|
|
|
|
|
+ diyStore.editComponent.advertList.forEach((item: any, index: any) => {
|
|
|
|
|
+ item.show = false;
|
|
|
|
|
+ if (index < res) {
|
|
|
|
|
+ item.show = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 打开图片类型
|
|
|
|
|
+const openImageType = (element: any, type: any) => {
|
|
|
|
|
+ const datas = JSON.parse(JSON.stringify(element));
|
|
|
|
|
+ ImagesFormRef.value.onOpen(datas, type);
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 图片类型返回
|
|
|
|
|
+const confirmCallBack = (res: any, type: any) => {
|
|
|
|
|
+ let list = [];
|
|
|
|
|
+ if (type == 1) list = diyStore.editComponent.carouselList;
|
|
|
|
|
+ if (type == 2) list = diyStore.editComponent.advertList;
|
|
|
|
|
+ if (type == 3) list = diyStore.editComponent.navlList;
|
|
|
|
|
+ list.forEach((item: any) => {
|
|
|
|
|
+ if (item.id == res.id) {
|
|
|
|
|
+ item.imgType = res.imgType;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 搜索 */
|
|
|
|
|
+const handleQuery = () => {
|
|
|
|
|
+ queryParams.pageNum = 1;
|
|
|
|
|
+ getList();
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 获取列表 */
|
|
|
|
|
+const getList = async () => {
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await listAnnouncement(queryParams);
|
|
|
|
|
+ tableData.value = res.rows || [];
|
|
|
|
|
+ const result = tableData.value.filter((item: any) => diyStore.editComponent.realIds.includes(item.id));
|
|
|
|
|
+ resultList.value = result;
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ result.forEach((item: any) => {
|
|
|
|
|
+ multipleTableRef.value?.toggleRowSelection(item, true);
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ console.log('result', result);
|
|
|
|
|
+ total.value = res.total || 0;
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+//打开弹窗
|
|
|
|
|
+const openDialog = () => {
|
|
|
|
|
+ showDialog.value = true;
|
|
|
|
|
+ getList();
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 监听表格单行选中
|
|
|
|
|
+const handleSelectionChange = (val: []) => {
|
|
|
|
|
+ multipleSelection.value = val;
|
|
|
|
|
+};
|
|
|
|
|
+//确定
|
|
|
|
|
+const onConfirm = () => {
|
|
|
|
|
+ const newIds = calculateNewIds(diyStore.editComponent.realIds, tableData.value, multipleSelection.value);
|
|
|
|
|
+ diyStore.editComponent.realIds = newIds;
|
|
|
|
|
+ showDialog.value = false;
|
|
|
|
|
+};
|
|
|
|
|
+const calculateNewIds = (cacheIds: any, allPageItems: any, selectedItems: any) => {
|
|
|
|
|
+ // 1. 获取当前页所有存在的 ID 集合 (用于识别哪些旧数据属于当前页)
|
|
|
|
|
+ const currentPageIdSet = new Set(allPageItems.map((item) => item.id));
|
|
|
|
|
+ // 2. 获取最终选中项的 ID 集合
|
|
|
|
|
+ const selectedIdSet = new Set(selectedItems.map((item) => item.id));
|
|
|
|
|
+ // 3. 过滤旧的缓存 IDs
|
|
|
|
|
+ const retainedOldIds = cacheIds.filter((id) => {
|
|
|
|
|
+ // 情况 A: 该 ID 不在当前页数据中 (说明是其他页的数据,必须无条件保留)
|
|
|
|
|
+ if (!currentPageIdSet.has(id)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 情况 B: 该 ID 在当前页数据中,且也在最终选中列表中 (说明用户保持了选中)
|
|
|
|
|
+ if (selectedIdSet.has(id)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 情况 C: 该 ID 在当前页数据中,但不在最终选中列表中 (说明用户取消了选中,如 ID 4)
|
|
|
|
|
+ // 返回 false,将其剔除
|
|
|
|
|
+ return false;
|
|
|
|
|
+ });
|
|
|
|
|
+ // 4. 合并:保留的旧数据 + 当前页新选中的数据
|
|
|
|
|
+ // 使用 Set 去重,虽然逻辑上 retainedOldIds 和 selectedIdSet 不会有交集,但以防万一
|
|
|
|
|
+ const newIdsSet = new Set([...retainedOldIds, ...selectedIdSet]);
|
|
|
|
|
+ // 转回数组 (如果需要保持原有顺序或特定排序,可以在此处调整)
|
|
|
|
|
+ // 这里简单转为数组,通常建议按数字大小排序以便阅读,或者保持插入顺序
|
|
|
|
|
+ return Array.from(newIdsSet).sort((a, b) => a - b);
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+.pc-edit {
|
|
|
|
|
+ .edit-attr-item-wrap {
|
|
|
|
|
+ border-top: 2px solid var(--el-color-info-light-8);
|
|
|
|
|
+ padding-top: 20px;
|
|
|
|
|
+
|
|
|
|
|
+ &:first-of-type {
|
|
|
|
|
+ border-top: none;
|
|
|
|
|
+ padding-top: 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .edit-attr-title {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+
|
|
|
|
|
+ .title2 {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #666;
|
|
|
|
|
+ margin-left: 6px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .data-num {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
|
+ color: var(--el-color-primary);
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .edit-attr-box {
|
|
|
|
|
+ padding: 18px 10px 0 10px;
|
|
|
|
|
+ border: 1px solid #e5e6eb;
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ margin-top: 18px;
|
|
|
|
|
+
|
|
|
|
|
+ .images-bos {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ height: 98px;
|
|
|
|
|
+ padding: 5px 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .images-box {
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ color: #666;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .circleClose {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: -9px;
|
|
|
|
|
+ right: -9px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .annotation {
|
|
|
|
|
+ // position: absolute;
|
|
|
|
|
+ // bottom: 0;
|
|
|
|
|
+ // left: 0;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #666;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .annotation2 {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #666;
|
|
|
|
|
+ margin-left: 10px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .annotation3 {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #666;
|
|
|
|
|
+ line-height: 14px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .selected {
|
|
|
|
|
+ line-height: 32px;
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ left: 0px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.el-form-item__label) {
|
|
|
|
|
+ font-weight: 400;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.file-selector) {
|
|
|
|
|
+ display: none;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|