浏览代码

预览上一页下一页 树组件同步及 拖拽上传样式

秦鹏 3 年之前
父节点
当前提交
2941db6c24

+ 8 - 7
src/components/Adult/common/UploadView.vue

@@ -14,6 +14,7 @@
       :on-success="handleSuccess"
       :on-change="handleChange"
       :file-list="currentfileList"
+      :show-file-list="showList"
       :limit="filleNumber"
     >
       <div class="uploadBtn">
@@ -49,6 +50,7 @@ export default {
       currentfileList: [],
       fileTypeName: "",
       loading: false,
+      showList: false,
     };
   },
   computed: {
@@ -83,13 +85,14 @@ export default {
       // 深度观察监听
       deep: true,
     },
-    fileList(newval,oldval){
-      this.currentfileList = newval
-    }
+    fileList(newval, oldval) {
+      this.currentfileList = newval||[];
+    },
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   created() {
-    this.currentfileList = this.fileList;
+    this.currentfileList = this.fileList || [];
+    this.showList = this.fileList ? true : false;
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
@@ -147,9 +150,7 @@ export default {
         } 个文件`
       );
     },
-    initUpload() {
- 
-    },
+    initUpload() {},
   }, // 如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>

+ 9 - 7
src/components/Adult/inputModules/UploadControl.vue

@@ -1,13 +1,15 @@
 <!--  -->
 <template>
   <div class="Big-Book-prev-Textdes Tinydemo" v-if="curQue">
-    <!-- <UploadView
-      :changeFillId="changeFillId"
-      :accept="accept"
-      :filleNumber="1"
-      :fileList="curQue.fileList"
-    /> -->
-    <div>
+    <template v-if="type =='upload_control_preview_chs'">
+      <UploadView
+        :changeFillId="changeFillId"
+        :accept="accept"
+        :filleNumber="1"
+        :fileList="curQue.fileList"
+      />
+    </template>
+    <div v-else>
       <div class="uploadBtn">
         <img
           style="width: 24px; height: 24px"

+ 11 - 3
src/components/Adult/preview/SentenceSortQP.vue

@@ -17,7 +17,12 @@
         >
           <transition-group>
             <div
-              class="item"
+              :class="[
+                'item',
+                JSON.stringify(SortArr[index]).indexOf(itemNode.pinyin) != -1
+                  ? 'select'
+                  : '',
+              ]"
               v-for="(itemNode, indexNode) in item.detail.wordsList"
               :key="indexNode"
             >
@@ -217,13 +222,16 @@ export default {
             font-size: 20px;
           }
         }
+        .select {
+          background: rgba(0, 0, 0, 0.06);
+        }
       }
     }
   }
   .item-right_bottom {
     min-width: 200px;
     max-width: 696px;
-    background: white;
+    background: rgba(0, 0, 0, 0.06);
     margin-left: 35px;
     margin-top: 10px;
     min-height: 70px;
@@ -234,7 +242,7 @@ export default {
         .item {
           width: 82px;
           height: 70px;
-          background: #e6e6e6;
+          background: #ffffff;
           border-radius: 8px;
           text-align: center;
           margin-right: 2px;

+ 2 - 1
src/components/Adult/preview/UploadControlView.vue

@@ -6,6 +6,7 @@
         :changeFillId="changeFillId"
         :accept="accept"
         :filleNumber="1"
+        :fileList="false"
       />
       <!-- <div class="uploadBtn" @click="downLoad">
         <img
@@ -16,7 +17,7 @@
         下载表格
       </div> -->
     </div>
-    <div class="dv" v-loading="loading">
+    <div class="dv"  v-if="curQue.data">
       <div class="main">
         <div class="content">
           <template v-if="curQue.data">

+ 43 - 1
src/components/TreeView.vue

@@ -77,7 +77,14 @@ export default {
   components: {
     Tree: Tree.mixPlugins([Fold, Draggable]),
   },
-  props: ["changeId", "emptyQustion", "bookId", "tryFree", "changeTreeData"],
+  props: [
+    "changeId",
+    "emptyQustion",
+    "bookId",
+    "tryFree",
+    "changeTreeData",
+    "currentTreeID",
+  ],
   data() {
     return {
       treeData: [],
@@ -102,9 +109,44 @@ export default {
       activeIndex: "", // 高亮节点
       nodeLevel: "", // 高亮节点的level
       nodeName: "",
+      pidList: [],
     };
   },
+  watch: {
+    async currentTreeID(newval, oldval) {
+      if (newval) {
+        this.activeIndex = newval;
+        await this.unfoldData(this.activeIndex, this.treeData);
+        await this.unfoldFather(this.treeData);
+      }
+    },
+  },
   methods: {
+    // 递归找到当前节点的所有父节点
+    unfoldData(activeIndex, data, index, child) {
+      data.forEach((item, i) => {
+        if (item.id == activeIndex) {
+          this.pidList.push(item.pid);
+          if (Object.prototype.toString.call(index).indexOf("Number") != -1) {
+            this.pidList.push(child.pid);
+          }
+        } else if (item.children) {
+          this.unfoldData(activeIndex, item.children, i, item);
+        }
+      });
+    },
+    // 展示父节点
+    unfoldFather(data) {
+      data.forEach((item, i) => {
+        this.pidList.forEach((p) => {
+          if (item.id == p) {
+            item.$folded = false;
+          } else if (item.children) {
+            this.unfoldFather(item.children);
+          }
+        });
+      });
+    },
     foldAll() {
       if (this.$refs.tree !== undefined) {
         this.$refs.tree.foldAll();

+ 1 - 0
src/views/courseView.vue

@@ -8,6 +8,7 @@
           :book-id="bookId"
           :change-id="changeId"
           :changeTreeData="changeTreeData"
+          :currentTreeID="chapterId"
         />
       </div>
       <div id="data-screen" class="inner">