Kaynağa Gözat

Merge branch 'beta' of https://git.cocorobo.cn/CocoRoboLabs/pbl-teacher-table into beta

zengyicheng 1 yıl önce
ebeveyn
işleme
b97dd19b9a

+ 84 - 5
src/components/pages/addCourse.vue

@@ -752,8 +752,12 @@
                     </div>
                     <div class="add_info_box">
                       <button class="info_btn" @click="addImg($event)">
+                            添加文件
+                            <input type="file" accept="*" style="display: none" v-if="inputShow" @change="beforeUpload2($event, unitIndex, 13, 0)
+                              " />
+                          </button>
+                      <!-- <button class="info_btn" @click="addImg($event)">
                         添加视频
-                        <!-- capture="camera" -->
                         <input type="file" accept="video/mp4, video/quicktime, video/x-msvideo" style="display: none"
                           v-if="inputShow" @change="beforeUpload2($event, unitIndex, 2, itemTaskIndex)
                             " />
@@ -764,7 +768,7 @@
                           accept="application/pdf, application/.ppt, .ppt, .pptx, .xlsx, .xls, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document"
                           style="display: none" v-if="inputShow" @change="beforeUpload2($event, unitIndex, 3, itemTaskIndex)
                             " />
-                      </button>
+                      </button> -->
                       <button class="info_btn" @click="addAttText(itemTaskIndex)">
                         添加图文
                       </button>
@@ -777,11 +781,11 @@
                       <button class="info_btn" @click="openSource(itemTaskIndex)">
                         添加资源
                       </button>
-                      <button class="info_btn" @click="addImg($event)">
+                      <!-- <button class="info_btn" @click="addImg($event)">
                         其他附件
                         <input type="file" accept="*" style="display: none" v-if="inputShow" @change="beforeUpload2($event, unitIndex, 12, itemTaskIndex)
                           " />
-                      </button>
+                      </button> -->
                     </div>
                     <div v-if="unitJson[unitIndex].chapterInfo[0].taskJson[
                       itemTaskIndex
@@ -4348,7 +4352,82 @@ export default {
               // a.splice(a.length - 1, a.length);
               _this.$message.error("上传失败");
             } else {
-              if (type == 2 || type == 3 || type == 12) {
+              if (type == 13) {
+                let _type = 2
+                var fileA = [
+                  "PDF",
+                  "DOC",
+                  "DOCX",
+                  "DOCM",
+                  "DOTM",
+                  "DOTX",
+                  "PPTX",
+                  "PPSX",
+                  "PPT",
+                  "PPS",
+                  "PPTM",
+                  "POTM",
+                  "PPAM",
+                  "POTX",
+                  "PPSM","XLSX", "XLS"
+                ];
+                var videoA = [
+                  "AVI",
+                  "NAVI",
+                  "MPEG",
+                  "ASF",
+                  "MOV",
+                  "WMV",
+                  "3GP",
+                  "RM",
+                  "RMVB",
+                  "FLV",
+                  "F4V",
+                  "H.264",
+                  "H.265",
+                  "REAL VIDEO",
+                  "MKV",
+                  "WebM",
+                  "HDDVD",
+                  "MP4",
+                  "MPG",
+                  "M4V",
+                  "MGV",
+                  "OGV",
+                  "QTM",
+                  "STR",
+                  "AMC",
+                  "DVX",
+                  "EVO",
+                  "DAT",
+                  "OGG",
+                  "OGM",
+                ];
+                if (fileA.indexOf(
+                  data.Location
+                    .split(".")
+                  [data.Location.split(".").length - 1].toLocaleUpperCase()
+                ) != -1) {
+                  _type = 3
+                } else if (videoA.indexOf(
+                  data.Location
+                    .split(".")
+                  [data.Location.split(".").length - 1].toLocaleUpperCase()
+                ) != -1) {
+                  _type = 2
+                } else {
+                  _type = 12
+                }
+                _this.unitJson[unitIndex].chapterInfo[0].taskJson[
+                  itemTaskIndex
+                ].chapterData.push({
+                  name: file.name,
+                  url: data.Location,
+                  uid: file.uid,
+                  type: _type,
+                });
+                _this.imgChange1(null, null, _type, itemTaskIndex);
+              } else if (type == 2 || type == 3 || type == 12) {
                 _this.unitJson[unitIndex].chapterInfo[0].taskJson[
                   itemTaskIndex
                 ].chapterData.push({

+ 92 - 9
src/components/pages/task/addCourse.vue

@@ -382,8 +382,12 @@
                         </div>
                         <div class="add_info_box">
                           <button class="info_btn" @click="addImg($event)">
+                                添加文件
+                            <input type="file" accept="*" style="display: none" v-if="inputShow" @change="beforeUpload2($event, unitIndex, 13, 0)
+                                  " />
+                          </button>
+                          <!-- <button class="info_btn" @click="addImg($event)">
                             添加视频
-                            <!-- capture="camera" -->
                             <input type="file" accept="video/mp4, video/quicktime, video/x-msvideo" style="display: none"
                               v-if="inputShow" @change="beforeUpload2($event, unitIndex, 2, itemTaskIndex)
                                 " />
@@ -394,7 +398,7 @@
                               accept="application/pdf, application/.ppt, .ppt, .pptx, .xlsx, .xls, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document"
                               style="display: none" v-if="inputShow" @change="beforeUpload2($event, unitIndex, 3, itemTaskIndex)
                                 " />
-                          </button>
+                          </button> -->
                           <button class="info_btn" @click="addAttText(itemTaskIndex)">
                             添加图文
                           </button>
@@ -407,11 +411,11 @@
                           <button class="info_btn" @click="openSource(itemTaskIndex)">
                             添加资源
                           </button>
-                          <button class="info_btn" @click="addImg($event)">
+                          <!-- <button class="info_btn" @click="addImg($event)">
                             其他附件
                             <input type="file" accept="*" style="display: none" v-if="inputShow" @change="beforeUpload2($event, unitIndex, 12, itemTaskIndex)
                               " />
-                          </button>
+                          </button> -->
                         </div>
                         <div v-if="unitJson[unitIndex].chapterInfo[0].taskJson[
                           itemTaskIndex
@@ -820,8 +824,12 @@
                     </div>
                     <div class="add_info_box">
                       <button class="info_btn" @click="addImg($event)">
+                            添加文件
+                        <input type="file" accept="*" style="display: none" v-if="inputShow" @change="beforeUpload2($event, unitIndex, 13, 0)
+                              " />
+                      </button>
+                      <!-- <button class="info_btn" @click="addImg($event)">
                         添加视频
-                        <!-- capture="camera" -->
                         <input type="file" accept="video/mp4, video/quicktime, video/x-msvideo" style="display: none"
                           v-if="inputShow" @change="beforeUpload2($event, unitIndex, 2, itemTaskIndex)
                             " />
@@ -832,7 +840,7 @@
                           accept="application/pdf, application/.ppt, .ppt, .pptx, .xlsx, .xls, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document"
                           style="display: none" v-if="inputShow" @change="beforeUpload2($event, unitIndex, 3, itemTaskIndex)
                             " />
-                      </button>
+                      </button> -->
                       <button class="info_btn" @click="addAttText(itemTaskIndex)">
                         添加图文
                       </button>
@@ -845,11 +853,11 @@
                       <button class="info_btn" @click="openSource(itemTaskIndex)">
                         添加资源
                       </button>
-                      <button class="info_btn" @click="addImg($event)">
+                      <!-- <button class="info_btn" @click="addImg($event)">
                         其他附件
                         <input type="file" accept="*" style="display: none" v-if="inputShow" @change="beforeUpload2($event, unitIndex, 12, itemTaskIndex)
                           " />
-                      </button>
+                      </button> -->
                     </div>
                     <div v-if="unitJson[unitIndex].chapterInfo[0].taskJson[
                       itemTaskIndex
@@ -4289,7 +4297,82 @@ export default {
               // a.splice(a.length - 1, a.length);
               _this.$message.error("上传失败");
             } else {
-              if (type == 2 || type == 3 || type == 12) {
+              if (type == 13) {
+                let _type = 2
+                var fileA = [
+                  "PDF",
+                  "DOC",
+                  "DOCX",
+                  "DOCM",
+                  "DOTM",
+                  "DOTX",
+                  "PPTX",
+                  "PPSX",
+                  "PPT",
+                  "PPS",
+                  "PPTM",
+                  "POTM",
+                  "PPAM",
+                  "POTX",
+                  "PPSM","XLSX", "XLS"
+                ];
+                var videoA = [
+                  "AVI",
+                  "NAVI",
+                  "MPEG",
+                  "ASF",
+                  "MOV",
+                  "WMV",
+                  "3GP",
+                  "RM",
+                  "RMVB",
+                  "FLV",
+                  "F4V",
+                  "H.264",
+                  "H.265",
+                  "REAL VIDEO",
+                  "MKV",
+                  "WebM",
+                  "HDDVD",
+                  "MP4",
+                  "MPG",
+                  "M4V",
+                  "MGV",
+                  "OGV",
+                  "QTM",
+                  "STR",
+                  "AMC",
+                  "DVX",
+                  "EVO",
+                  "DAT",
+                  "OGG",
+                  "OGM",
+                ];
+                if (fileA.indexOf(
+                  data.Location
+                    .split(".")
+                  [data.Location.split(".").length - 1].toLocaleUpperCase()
+                ) != -1) {
+                  _type = 3
+                } else if (videoA.indexOf(
+                  data.Location
+                    .split(".")
+                  [data.Location.split(".").length - 1].toLocaleUpperCase()
+                ) != -1) {
+                  _type = 2
+                } else {
+                  _type = 12
+                }
+                _this.unitJson[unitIndex].chapterInfo[0].taskJson[
+                  itemTaskIndex
+                ].chapterData.push({
+                  name: file.name,
+                  url: data.Location,
+                  uid: file.uid,
+                  type: _type,
+                });
+                _this.imgChange1(null, null, _type, itemTaskIndex);
+              } else if (type == 2 || type == 3 || type == 12) {
                 _this.unitJson[unitIndex].chapterInfo[0].taskJson[
                   itemTaskIndex
                 ].chapterData.push({