xiaohaizhao 1 месяц назад
Родитель
Сommit
41dcaf09ee

+ 1 - 1
dist/index.html

@@ -5,7 +5,7 @@
     <link rel="icon" type="image/svg+xml" href="./vite.svg" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title>营销宝</title>
-    <script type="module" crossorigin src="./assets/index-316bccfd.js"></script>
+    <script type="module" crossorigin src="./assets/index-27cb2e76.js"></script>
     <link rel="modulepreload" crossorigin href="./assets/vue-8259307b.js">
     <link rel="modulepreload" crossorigin href="./assets/vue-router-55bfd43b.js">
     <link rel="stylesheet" href="./assets/index-b8e2bd64.css">

+ 1 - 1
h5preview/index.html

@@ -1,2 +1,2 @@
 <!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>营销工具</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
-            document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=./static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=./static/js/chunk-vendors.53ba089c.js></script><script src=./static/js/index.4c97861a.js></script></body></html>
+            document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=./static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=./static/js/chunk-vendors.53ba089c.js></script><script src=./static/js/index.e6b3fec0.js></script></body></html>

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
h5preview/static/js/index.e6b3fec0.js


+ 2 - 2
src/MAR/archivesMag/modules/setClass/add.vue

@@ -96,7 +96,7 @@ const submit = async () => {
     upload.value.toUpload(() => {
       utils.message(res,'操作成功',() => {
         visible.value = false
-        emit('onSuccess')
+        emit('onSuccess', props.data)
         bindData.value = {}
         upload.value.refresh()
         loading.value = false
@@ -106,7 +106,7 @@ const submit = async () => {
     utils.message(res,'操作成功',() => {
       visible.value = false
       formRef.value.resetFields()
-      emit('onSuccess')
+      emit('onSuccess', props.data)
       loading.value = false
     })
   }

+ 76 - 46
src/MAR/archivesMag/modules/setClass/index.vue

@@ -1,40 +1,31 @@
 <template>
   <div>
-    <a-button @click="modeVisible=true" type="primary" size="samll">设置分类</a-button>
-    <a-drawer
-      ref="drawer"
-      v-model:open="modeVisible"
-      class="custom-class"
-      :title="'设置分类'"
-      placement="right"
-      :width="'1200px'"
-      :closable="false"
-      v-if="modeVisible"
-      >
+    <a-button @click="modeVisible = true" type="primary" size="samll">设置分类</a-button>
+    <a-drawer ref="drawer" v-model:open="modeVisible" class="custom-class" :title="'设置分类'" placement="right"
+      :width="'1200px'" :closable="false" v-if="modeVisible">
       <div style="margin-bottom: 10px" class="inline-16">
-        <Add @onSuccess="$refs.table.listData()" v-if="utils.hasPermission('setClass')"></Add>
+        <Add @onSuccess="onAddSuccess" v-if="utils.hasPermission('setClass')"></Add>
         <!-- <a-input style="width: 150px;margin-left: 10px;" v-model:value="param.content.where.condition" @keyup.enter="search"  placeholder="请输入搜索内容" autocomplete="off"></a-input> -->
       </div>
-      <normalTable :sequence="true" @listData="listData" rowKey="sat_courseware_classid" :is-select="false" ref="table" size="small" :columns="utils.TBLayout('tableSCChildclass')" :param="param">
-        <template #tb_cell="{data}">
+      <normalTable :sequence="true" @listData="listData" rowKey="sat_courseware_classid" :is-select="false" ref="table"
+        size="small" :columns="utils.TBLayout('tableSCChildclass')" :param="param" :expandedRowKeys="expandedKeys" @expand="onExpand">
+        <template #tb_cell="{ data }">
           <template v-if="data.column.dataIndex === 'issecret'">
-            <a-switch
-              v-model:checked="data.record.isenable"
-              :checkedValue="1"
-              :unCheckedValue="0"
-              unCheckedChildren="停用"
-              checkedChildren="启用"
-              @change="typeChange($event,data)"
-              >
+            <a-switch v-model:checked="data.record.isenable" :checkedValue="1" :unCheckedValue="0"
+              unCheckedChildren="停用" checkedChildren="启用" @change="typeChange($event, data)">
             </a-switch>
           </template>
           <template v-if="data.column.dataIndex === 'attinfos'">
-            <a-image v-if="data.record.parentid == 0 && data.record.attinfos[0]" :src="data.record.attinfos[0].url" style="width: 100px;"></a-image>
+            <a-image v-if="data.record.parentid == 0 && data.record.attinfos[0]" :src="data.record.attinfos[0].url"
+              style="width: 100px;"></a-image>
           </template>
           <template v-else-if="data.column.dataIndex == 'operation'">
-            <Edit @onSuccess="$refs.table.listData()" :data="data.record" @back="$refs.table.listData()" v-if="utils.hasPermission('setClass')" :disabled="data.record.isenable"></Edit>
-            <Add @onSuccess="$refs.table.listData()" :data="data.record" v-if="!data.record.parentid && utils.hasPermission('setClass')" :disabled="data.record.isenable"></Add>
-            <a-button :disabled="data.record.isenable" v-if="utils.hasPermission('setClass')" size="samll" type="link" @click="delClass(data.record)">删 除</a-button>
+            <Edit @onSuccess="$refs.table.listData()" :data="data.record" @back="$refs.table.listData()"
+              v-if="utils.hasPermission('setClass')" :disabled="data.record.isenable"></Edit>
+            <Add @onSuccess="onAddSuccess" :data="data.record"
+              v-if="utils.hasPermission('setClass') && data.record.level <= 2" :disabled="data.record.isenable"></Add>
+            <a-button :disabled="data.record.isenable" v-if="utils.hasPermission('setClass')" size="samll" type="link"
+              @click="delClass(data.record)">删 除</a-button>
           </template>
         </template>
       </normalTable>
@@ -45,32 +36,52 @@
 <script setup>
 import { EditOutlined } from '@ant-design/icons-vue';
 import normalTable from '@/template/MARnormalTable/index.vue'
-import {ref, defineProps, defineEmits,watch, nextTick} from 'vue'
+import { ref, defineProps, defineEmits, watch, nextTick } from 'vue'
 import Api from '@/api/api'
 import utils from '@/utils/utils'
 import { message, Modal } from 'ant-design-vue';
 import Add from './add.vue'
 import Edit from './edit.vue'
 let modeVisible = ref(false)
-const emit = defineEmits(['onSuccess','back'])
+let expandedKeys = ref([])
+const emit = defineEmits(['onSuccess', 'back'])
 
 let param = ref({
   "id": "20221102143302",
   "content": {
     "parentid": 0,
-    "pageSize":20,
-    "pageNumber":1,
+    "pageSize": 20,
+    "pageNumber": 1,
     "where": {
-        "isenable": ''
+      "isenable": ''
     }
   }
 })
 let table = ref()
-watch(() => modeVisible.value,(val) => {
+watch(() => modeVisible.value, (val) => {
   if (!val) emit('back')
 })
 
-const typeChange = async (e,data) => {
+// 处理表格展开/收起
+const onExpand = (expanded, record) => {
+  if (expanded) {
+    if (!expandedKeys.value.includes(record.sat_courseware_classid)) {
+      expandedKeys.value.push(record.sat_courseware_classid)
+    }
+  } else {
+    expandedKeys.value = expandedKeys.value.filter(key => key !== record.sat_courseware_classid)
+  }
+}
+
+// Add 成功回调
+const onAddSuccess = (parentData) => {
+  if (parentData && !expandedKeys.value.includes(parentData.sat_courseware_classid)) {
+    expandedKeys.value.push(parentData.sat_courseware_classid)
+  }
+  table.value.listData()
+}
+
+const typeChange = async (e, data) => {
   let arr = []
   function isChild(nodes) {
     for (let index = 0; index < nodes.length; index++) {
@@ -78,51 +89,70 @@ const typeChange = async (e,data) => {
       if (nodes[index].children && nodes[index].children.length) isChild(nodes[index].children)
     }
   }
-  if(data.record.children) isChild(data.record.children)
+  if (data.record.children) isChild(data.record.children)
   arr.push(data.record.sat_courseware_classid)
   let res = await Api.requested({
     "id": "20240313152302",
     "content": {
       "sat_courseware_classids": arr,
-      "isenable":e
+      "isenable": e
     }
   })
-  utils.message(res,'操作成功',() => {
-    data.record = Object.assign({},data.record,res.data)
+  utils.message(res, '操作成功', () => {
+    data.record = Object.assign({}, data.record, res.data)
   })
 }
 
 const listData = (res) => {
   res.forEach(item => {
     item.attinfos.forEach(item2 => item2.name = item2.document)
-    if (!item.children.length) delete item.children
+    item.level = 1 // 第1级
+    if (item.children && item.children.length) {
+      setChildrenLevel(item.children, 2)
+    } else {
+      delete item.children
+    }
   })
   console.log(res);
 }
 
+// 递归设置子节点级别
+const setChildrenLevel = (children, level) => {
+  children.forEach(item => {
+    item.level = level
+    if (item.children) {
+      if (level >= 3) {
+        item.children = undefined
+      } else if (item.children.length) {
+        setChildrenLevel(item.children, level + 1)
+      } else {
+        item.children = undefined
+      }
+    }
+  })
+}
+
 //删除板块
 const delClass = (data) => {
   Modal.confirm({
-    title:'确定删除当前分类吗?',
-    okText:'确认',
+    title: '确定删除当前分类吗?',
+    okText: '确认',
     async onOk() {
       let res = await Api.requested({
         "id": "20221102143702",
         "content": {
           "sat_courseware_classids": [
-              data.sat_courseware_classid
+            data.sat_courseware_classid
           ]
         }
       })
-      utils.message(res,'操作成功',() => {
+      utils.message(res, '操作成功', () => {
         table.value.listData()
       })
     },
-    onCancel() {},
+    onCancel() { },
   })
 }
 </script>
 
-<style scoped>
-
-</style>
+<style scoped></style>

+ 23 - 2
src/components/photoWall/index.vue

@@ -195,7 +195,8 @@ const acceptType = computed(() => {
   if (type === 2) {
     return 'video/*'; // 视频类型
   } else if (type === 4) {
-    return '*'; // 文档类型不限制
+    // 文档类型:排除图片和视频
+    return '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.rtf,.csv,.zip,.rar,.7z,.tar,.gz,.epub,.mobi,.json,.xml,.html,.css,.js,.ts,.java,.py,.php,.c,.cpp,.h,.hpp,.md,.log,.sql';
   }
   return 'image/*'; // 默认图片类型
 });
@@ -350,6 +351,18 @@ function switchImage(direction) {
 }
 
 function beforeUpload(file) {
+  // 文档类型(type === 4):禁止上传图片和视频
+  const type = Number(props.fileType);
+  if (type === 4) {
+    const ext = file.name.toLowerCase().split('.').pop();
+    const videoExts = ['mp4', 'webm', 'ogg', 'mov', 'avi', 'mkv', 'flv', 'wmv'];
+    const imageExts = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg', 'ico', 'tif', 'tiff'];
+    if (videoExts.includes(ext) || imageExts.includes(ext)) {
+      utils.message({ code: 0 }, '文档管理不支持上传图片或视频文件');
+      return false;
+    }
+  }
+
   file.document = file.name;
   const filetype = file.document.substr(file.document.lastIndexOf(".") + 1);
   file.sequence = list.value.length;
@@ -370,9 +383,17 @@ function beforeUpload(file) {
       return (list.value[file.sequence].exception = "exception");
     console.log("获取上传链接", res);
     const { uploadurl, serialfilename } = res.data;
+    console.log("uploadurl:", uploadurl, "serialfilename:", serialfilename);
+    // 根据文件扩展名获取正确的 MIME 类型
+    const ext = file.name.toLowerCase().split('.').pop();
+    const mimeTypes = {
+      pdf: 'application/pdf',
+    };
+    const contentType = mimeTypes[ext] || 'application/octet-stream';
+    console.log("文件类型:", contentType);
     Up.upload(uploadurl, file, {
       headers: {
-        "Content-Type": "application/octet-stream",
+        "Content-Type": contentType,
       },
       onUploadProgress: function (e) {
         list.value[file.sequence].progress = parseInt(e.progress * 100);

Некоторые файлы не были показаны из-за большого количества измененных файлов