From 99dfeb5fc86bce593a5d3f43f45c26eedc00ab0a Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期二, 10 九月 2024 16:28:54 +0800
Subject: [PATCH] bug

---
 packageBookService/pages/bookServices/detail/index.js |   91 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 73 insertions(+), 18 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index e8b3f6f..8d73b89 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -169,6 +169,37 @@
       description: '',
       agree: false
     },
+    resourceVisible: false,
+    resourceValue: [],
+    fileTypeList: [{
+        label: '闊抽',
+        value: '闊抽'
+      },
+      {
+        label: '瑙嗛',
+        value: '瑙嗛'
+      },
+      {
+        label: '鍥剧墖',
+        value: '鍥剧墖'
+      },
+      {
+        label: 'PDF',
+        value: 'PDF'
+      },
+      {
+        label: '璧勬簮鍖�',
+        value: '璧勬簮鍖�'
+      },
+      {
+        label: '鏂囨。',
+        value: '鏂囨。'
+      },
+      {
+        label: '鍏朵粬',
+        value: '鍏朵粬'
+      }
+    ],
     fileList: [],
     isShowUp: true,
     protocolShow: false,
@@ -229,10 +260,8 @@
       this.setData({
         tabValue: options.tabValue,
       });
-      const checkData = this.data.cmsDatas.find(
-        (item) => item.refCode == options.tabValue
-      );
-      this.getResourceDataList(checkData)
+
+
     }
   },
 
@@ -450,6 +479,16 @@
             })
           }
           await this.getBookClass(classData);
+        }
+      }
+      if (this.data.tabValue == 'questionBank' || this.data.tabValue == 'jsek_cloudLearning' || this.data.tabValue == 'jsek_teachingResources') {
+        const checkData = this.data.cmsDatas.find(
+          (item) => item.refCode == this.data.tabValue
+        );
+        if (this.data.tabValue == "questionBank") {
+          this.getResourceData(checkData)
+        } else {
+          this.getResourceDataList(checkData)
         }
       }
 
@@ -2582,7 +2621,6 @@
     return childrenList
   },
   uploadFile(e) {
-    console.log(123)
     this.setData({
       dialogBox: true,
       isShowUp: true
@@ -2591,6 +2629,12 @@
   closeDialog() {
     this.setData({
       dialogBox: false,
+      resourceInfo: {
+        resourceName: '',
+        fileType: '',
+        description: '',
+        agree: false
+      },
     });
   },
   onCloseProtocol() {
@@ -2634,9 +2678,24 @@
       'resourceInfo.resourceName': e.detail.value,
     });
   },
-  onFileTypeInput(e) {
+  onResourcePicker(e) {
     this.setData({
-      'resourceInfo.fileType': e.detail.value,
+      resourceVisible: true,
+    });
+  },
+  onPickerChange(e) {
+    const {
+      value
+    } = e.detail;
+    this.setData({
+      resourceVisible: false,
+      resourceValue: value,
+      'resourceInfo.fileType': value.join(' '),
+    });
+  },
+  onPickerCancel(e) {
+    this.setData({
+      resourceVisible: false,
     });
   },
   textareaChange(e) {
@@ -2677,6 +2736,7 @@
         const pdfData = ['pdf']
         const Compression = ['rar', 'zip']
         const pictureData = ['jpg', 'png']
+        const documentData = ['doc', 'docx', 'xls', 'xlsx', "ppt", "pptx"]
         if (audioData.indexOf(Extension) > -1) {
           medioType = '闊抽'
         } else if (videoData.indexOf(Extension) > -1) {
@@ -2687,6 +2747,8 @@
           medioType = '璧勬簮鍖�'
         } else if (pictureData.indexOf(Extension) > -1) {
           medioType = '鍥剧墖'
+        } else if (documentData.indexOf(Extension) > -1) {
+          medioType = '鏂囨。'
         } else {
           medioType = '鍏朵粬'
         }
@@ -2730,6 +2792,7 @@
                     that.setData({
                       "resourceInfo.resourceName": FileName,
                       "resourceInfo.fileType": medioType,
+
                       fileList: file,
                       isShowUp: false
                     })
@@ -2744,15 +2807,9 @@
 
   },
   handleRemove(e) {
-    console.log(e)
-    let md5 = e.currentTarget.dataset.md5
-    for (let i = 0; i < this.data.fileList.length; i++) {
-      if (this.data.fileList.md5 == md5) {
-        this.data.fileList.splice(i, 1)
-      }
-    }
     this.setData({
       isShowUp: true,
+      fileList: []
     });
   },
   confirmM() {
@@ -2765,7 +2822,7 @@
     if (this.data.resourceInfo.fileType == '') {
       return wx.showToast({
         icon: "error",
-        title: "璇峰~鍐欒祫婧愮被鍨�",
+        title: "璇烽�夋嫨璧勬簮绫诲瀷",
       });
     }
 
@@ -2795,9 +2852,7 @@
         icon: "success",
         title: "璇蜂笂浼犺祫婧愭枃浠�",
       });
-      this.setData({
-        dialogBox: false,
-      });
+      this.closeDialog()
     })
   }
 })
\ No newline at end of file

--
Gitblit v1.9.1