Просмотр исходного кода

1、厦门海嘉成-栏目菜单

41235 1 год назад
Родитель
Сommit
8b18ba2a8b

+ 44 - 0
src/api/XMHJC/home.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+
+
+/**
+ * 首页配置列表
+ * @param data
+ * @returns {*}
+ */
+export function findHomeSettingList(data) {
+    return request({
+        url: '/homeSetting/list',
+        method: 'post',
+        data: data
+    })
+}
+
+
+
+/**
+ * 首页配置列表
+ * @param data
+ * @returns {*}
+ */
+export function getHomeSetting(data) {
+    return request({
+        url: '/homeSetting/detail',
+        method: 'post',
+        data: data
+    })
+}
+
+/**
+ * 首页配置编辑
+ * @param data
+ * @returns {*}
+ */
+export function editHomeSetting(data) {
+    return request({
+        url: '/homeSetting/edit',
+        method: 'post',
+        data: data
+    })
+}

+ 13 - 1
src/views/XMHJC/column/index.vue

@@ -92,7 +92,7 @@ import TinymceEditor from "@/components/Editor/TinymceEditor.vue";
 import {getDictOneByXmhjc, getFileList,getFileStr} from "@/api/XMHJC/common";
 import {
   addColumnMenu, checkDeleteColumnMenuSub, deleteColumnMenu,
-  editColumnMenu,
+  editColumnMenu, findColumnArticleList,
   findColumnMenuList,
   getColumnMenu
 } from "@/api/XMHJC/column";
@@ -465,6 +465,18 @@ const clickDelete = async (index) => {
 
 };
 
+const getArticleList = async () => {
+  const res = await findColumnArticleList({
+    pageNum: 1,
+    pageSize: 99999,
+    status: 1,
+  });
+  articleList.value = res.data.rows.map((x) => ({
+    label: x.title,
+    value: x.id,
+  }));
+};
+
 getDictlist()
 getList()
 

+ 344 - 0
src/views/XMHJC/home/index.vue

@@ -0,0 +1,344 @@
+<template>
+  <div class="tenant">
+    <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          select: select,
+        }"
+
+        @get-list="getList">
+
+    </byTable>
+    <el-dialog z-index="100" :title="'编辑栏目文章'" v-if="dialogVisible" v-model="dialogVisible" width="600" v-loading="loading">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
+        <template #menuId>
+          <el-form-item prop="menuId">
+            <el-select
+                v-model="formData.data.menuId"
+                :rule="rules.columnId"
+                placeholder="请选择菜单"
+                no-data-text="无数据,请到栏目菜单添加"
+                @change="(val) => getArticleListSelect(val)"
+            >
+              <el-option
+                  v-for="item in columnListData"
+                  :label="item.name"
+                  :value="item.id"
+              >
+              </el-option>
+            </el-select>
+
+          </el-form-item>
+
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button type="primary" v-no-double-click="submitForm" size="large" :loading="submitLoading">确 定</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import {computed, nextTick, reactive, ref} from "vue";
+import TinymceEditor from "@/components/Editor/TinymceEditor.vue";
+import {getDictOneByXmhjc, getFileList,getFileStr} from "@/api/XMHJC/common";
+import {
+  addColumnArticle, deleteColumnArticle,
+  editColumnArticle,
+  findColumnArticleList,
+  findMenuListByOpen, findSubMenuListByOpen,
+  getColumnArticle
+} from "@/api/XMHJC/column";
+import {editHomeSetting, findHomeSettingList, getHomeSetting} from "@/api/XMHJC/home";
+import {isNullOrUndefined} from "@tinymce/tinymce-vue/lib/es2015/main/ts/Utils";
+
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+
+let rules = ref({
+  titleEn: [{ required: true, message: "请输入标题英文名称", trigger: "blur" }],
+  menuId: [{ required: true, message: "请选择菜单", trigger: "change" }],
+  article1: [{ required: true, message: "请选择文章", trigger: "change" }],
+  article2: [{ required: true, message: "请选择文章", trigger: "change" }],
+  article3: [{ required: true, message: "请选择文章", trigger: "change" }],
+});
+const { proxy } = getCurrentInstance();
+
+const columnListData = ref([]);
+const articleList = ref([]);
+const selectConfig = [];
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "首页位置",
+        prop: "id",
+        width: '120',
+      },
+      render(id) {
+        return '首页位置'+id;
+      },
+    },
+    {
+      attrs: {
+        label: "菜单",
+        prop: "menuIdName",
+        width: '200'
+      },
+    },
+    {
+      attrs: {
+        label: "标题英文名称",
+        prop: "titleEn",
+        width: '180'
+      },
+    },
+    {
+      attrs: {
+        label: "文章1",
+        prop: "articleTitle1",
+      },
+    },
+    {
+      attrs: {
+        label: "文章2",
+        prop: "articleTitle2",
+      },
+    },
+    {
+      attrs: {
+        label: "文章3",
+        prop: "articleTitle3",
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "120",
+        align: "right",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+let formData = reactive({
+  data: {
+  },
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const formConfig = computed(() => {
+  return [
+    {
+      type: "slot",
+      slotName: "menuId",
+      prop: "menuId",
+      label: "菜单",
+      required: true,
+    },
+    {
+      type: "input",
+      prop: "titleEn",
+      label: "英文标题",
+      required: true,
+    },
+    {
+      type: "select",
+      prop: "article1",
+      label: "文章1",
+      placeholder: "请选择文章",
+      data: articleList.value,
+      filterable: true,
+    },
+    {
+      type: "select",
+      prop: "article2",
+      label: "文章2",
+      placeholder: "请选择文章",
+      data: articleList.value,
+      filterable: true,
+    },
+    {
+      type: "select",
+      prop: "article3",
+      label: "文章3",
+      placeholder: "请选择文章",
+      data: articleList.value,
+      filterable: true,
+    },
+  ];
+});
+
+
+
+const getList = async (req) => {
+  const res = await findHomeSettingList();
+  sourceList.value.data = res.data;
+  setTimeout(() => {
+    loading.value = false;
+  }, 200);
+
+};
+
+const selection = ref({
+  data: [],
+});
+const select = (_selection, row) => {
+  selection.value.data = _selection;
+};
+const submitForm = () => {
+  byform.value.handleSubmit(() => {
+
+    submitLoading.value = true;
+
+      editHomeSetting(formData.data).then(response => {
+        ElMessage({
+          message: "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      }).catch(()=>{
+        submitLoading.value = false;
+      });
+
+
+  });
+};
+
+const getDtl = async (row) => {
+  const response = await getHomeSetting({ id: row.id })
+  formData.data = response.data;
+  if (!isNullOrUndefined(formData.data.menuId)){
+    await getArticleList(formData.data.menuId);
+  }else {
+    articleList.value =[]
+  }
+  dialogVisible.value = true;
+};
+
+const getMenuList = async () => {
+  const res = await findMenuListByOpen({})
+  columnListData.value = res.data
+
+
+};
+
+//获取文章列表
+const getArticleListSelect = async (value) => {
+
+  formData.data.article1 = ""
+  formData.data.article2 = ""
+  formData.data.article3 = ""
+  formData.data.article4 = ""
+
+  const res = await findColumnArticleList({
+    pageNum: 1,
+    pageSize: 99999,
+    status: 1,
+    columnId: value,
+  });
+  articleList.value = res.data.rows.map((x) => ({
+    label: x.title,
+    value: x.id,
+  }));
+
+
+};
+
+
+//获取文章列表
+const getArticleList = async (value) => {
+  const res = await findColumnArticleList({
+    pageNum: 1,
+    pageSize: 99999,
+    status: 1,
+    columnId: value,
+  });
+  articleList.value = res.data.rows.map((x) => ({
+    label: x.title,
+    value: x.id,
+  }));
+
+
+};
+
+
+getMenuList()
+getList()
+
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+  .delete-btn{
+    margin-top: 10px;
+    margin-left: 25px;
+  }
+}
+.avatar-uploader .avatar {
+  width: 110px;
+  height: 110px;
+  display: block;
+  background-color: black;
+}
+.avatar-uploader .el-upload {
+  border: 1px dashed var(--el-border-color);
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+  transition: var(--el-transition-duration-fast);
+}
+.avatar-uploader .el-upload:hover {
+  border-color: var(--el-color-primary);
+}
+.el-icon.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 110px;
+  height: 110px;
+  text-align: center;
+  border: 1px dashed var(--el-border-color);
+}
+</style>

+ 1 - 1
src/views/XMHJC/topic/content/replyList.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="replyList">
+  <div class="replyList">111
     <div class="content">
       <byTable
         :source="sourceList.data"