natasha %!s(int64=2) %!d(string=hai) anos
pai
achega
ad0509fdaf
Modificáronse 1 ficheiros con 130 adicións e 88 borrados
  1. 130 88
      src/views/courseList.vue

+ 130 - 88
src/views/courseList.vue

@@ -127,6 +127,9 @@
                 <el-button type="text" @click="handleDiscount(scope.row)"
                   >激活码</el-button
                 >
+                <el-button type="text" @click="handleCreatLink(scope.row)"
+                  >生成链接</el-button
+                >
                 <el-button type="text" @click="handleDel(scope.row)"
                   >删除</el-button
                 >
@@ -145,6 +148,16 @@
           @size-change="handleSizeChange"
         />
       </div>
+      <div
+        id="temporaryLinks"
+        style="
+          height: 0;
+          width: 1200px;
+          opacity: 0;
+          z-index: -1;
+          word-break: break-all;
+        "
+      ></div>
     </div>
     <el-dialog
       :before-close="handleClose"
@@ -362,11 +375,11 @@
               >
                 <el-button size="mini" type="success">上传封面</el-button>
                 <div
-                    style="display: inline; padding-left: 30px"
-                    slot="tip"
-                    class="el-upload__tip"
+                  style="display: inline; padding-left: 30px"
+                  slot="tip"
+                  class="el-upload__tip"
                 >
-                    只能上传.jpg, .jpeg, .png文件,大小不超过2MB
+                  只能上传.jpg, .jpeg, .png文件,大小不超过2MB
                 </div>
               </el-upload>
             </el-form-item>
@@ -395,11 +408,11 @@
                   >上传视频</el-button
                 >
                 <div
-                    style="display: inline; padding-left: 30px"
-                    slot="tip"
-                    class="el-upload__tip"
+                  style="display: inline; padding-left: 30px"
+                  slot="tip"
+                  class="el-upload__tip"
                 >
-                    只能上传视频文件,大小不超过500MB
+                  只能上传视频文件,大小不超过500MB
                 </div>
               </el-upload>
             </el-form-item>
@@ -426,11 +439,11 @@
                   >上传音频</el-button
                 >
                 <div
-                    style="display: inline; padding-left: 30px"
-                    slot="tip"
-                    class="el-upload__tip"
+                  style="display: inline; padding-left: 30px"
+                  slot="tip"
+                  class="el-upload__tip"
                 >
-                    只能上传音频文件,大小不超过20MB
+                  只能上传音频文件,大小不超过20MB
                 </div>
               </el-upload>
             </el-form-item>
@@ -460,11 +473,11 @@
                   >上传音频</el-button
                 >
                 <div
-                    style="display: inline; padding-left: 30px"
-                    slot="tip"
-                    class="el-upload__tip"
+                  style="display: inline; padding-left: 30px"
+                  slot="tip"
+                  class="el-upload__tip"
                 >
-                    只能上传音频文件,大小不超过20MB
+                  只能上传音频文件,大小不超过20MB
                 </div>
               </el-upload>
             </el-form-item>
@@ -487,11 +500,11 @@
                   >上传PDF</el-button
                 >
                 <div
-                    style="display: inline; padding-left: 30px"
-                    slot="tip"
-                    class="el-upload__tip"
+                  style="display: inline; padding-left: 30px"
+                  slot="tip"
+                  class="el-upload__tip"
                 >
-                    只能上传pdf文件,大小不超过20MB
+                  只能上传pdf文件,大小不超过20MB
                 </div>
               </el-upload>
             </el-form-item>
@@ -519,7 +532,7 @@ export default {
   name: "Courselist",
   components: {
     // Nav,
-    Header,
+    Header
   },
   data() {
     const validateNull = (rule, value, callback) => {
@@ -552,7 +565,7 @@ export default {
         publisher: "",
         publish_number: "",
         series_code: "",
-        publish_status: -1,
+        publish_status: -1
       },
       dialogFlag: false, // 新建教材弹出层
       agency: "",
@@ -576,27 +589,27 @@ export default {
         id: "",
         publisher: "",
         theme_color: "",
-        type_id: "",
+        type_id: ""
       },
       agencyList: [
         {
           id: "",
-          name: "请选择",
-        },
+          name: "请选择"
+        }
       ],
       agencyLists: [
         {
           id: "",
-          name: "请选择",
-        },
+          name: "请选择"
+        }
       ],
       publishStatus: {
         0: "下架",
-        1: "上架",
+        1: "上架"
       },
       publishScope: {
         0: "机构内用户",
-        1: "所有用户",
+        1: "所有用户"
       },
       fileList: [], // 上传图片数组
       fileListVideo: [], // 教材资源视频数组
@@ -610,16 +623,16 @@ export default {
         author: [{ required: true, trigger: "blur", validator: validateNull }],
         edition: [{ required: true, trigger: "blur", validator: validateNull }],
         publisher: [
-          { required: true, trigger: "blur", validator: validateNull },
+          { required: true, trigger: "blur", validator: validateNull }
         ],
         publish_number: [
-          { required: true, trigger: "blur", validator: validateNull },
+          { required: true, trigger: "blur", validator: validateNull }
         ],
         org_id: [{ required: true, message: "请选择机构", trigger: "change" }],
         type_id: [
-          { required: true, message: "请选择教材类型", trigger: "change" },
+          { required: true, message: "请选择教材类型", trigger: "change" }
         ],
-        price: [{ required: true, validator: validatePrice }],
+        price: [{ required: true, validator: validatePrice }]
       },
       loading: false,
       uploadingVideo: false,
@@ -634,26 +647,26 @@ export default {
       statusList: [
         {
           label: "全部",
-          value: -1,
+          value: -1
         },
         {
           label: "上架",
-          value: 1,
+          value: 1
         },
         {
           label: "下架",
-          value: 0,
-        },
+          value: 0
+        }
       ],
       myOrgList: [
         {
           org_id: "",
-          org_name: "全部",
-        },
+          org_name: "全部"
+        }
       ],
       diaMyOrgList: [],
       typeList: [],
-      activeName: "courseInfo", // 教材信息tabs
+      activeName: "courseInfo" // 教材信息tabs
     };
   },
   computed: {
@@ -678,7 +691,7 @@ export default {
         SessionID +
         "&SecurityLevel=Mid"
       );
-    },
+    }
   },
   mounted() {
     this.getList();
@@ -732,7 +745,7 @@ export default {
       if (row.publish_status == 1) {
         this.$message({
           type: "warning",
-          message: "此教材处于上架状态不可以进行编辑",
+          message: "此教材处于上架状态不可以进行编辑"
         });
         return false;
       }
@@ -747,6 +760,35 @@ export default {
     // 激活码
     handleDiscount(row) {
       this.$router.push("/discountCodeList?bookId=" + row.id);
+    }, // 生成临时链接
+    handleCreatLink(row) {
+      let link =
+        "https://" +
+        window.location.host +
+        "/GCLS-Book/#/BookBrowsing?bookId=" +
+        row.id;
+      document.getElementById("temporaryLinks").innerHTML = link;
+      var doc = document,
+        text = doc.getElementById("temporaryLinks"),
+        range,
+        selection;
+      if (doc.body.createTextRange) {
+        range = doc.body.createTextRange();
+        range.moveToElementText(text);
+        range.select();
+      } else if (window.getSelection) {
+        selection = window.getSelection();
+        range = doc.createRange();
+        range.selectNodeContents(text);
+        selection.removeAllRanges();
+        selection.addRange(range);
+      }
+      document.execCommand("copy");
+      this.$message({
+        message: "复制成功",
+        type: "success"
+      });
+      window.getSelection().removeAllRanges();
     },
     // 新建教材
     handleAdd() {
@@ -772,7 +814,7 @@ export default {
         id: "",
         publisher: "",
         theme_color: "",
-        type_id: "",
+        type_id: ""
       };
       this.agency = "";
       this.fileList = [];
@@ -794,7 +836,7 @@ export default {
         this.$message.warning("有文件尚未上传成功,请耐心等待");
         return false;
       }
-      _this.$refs.formDialog.validate((valid) => {
+      _this.$refs.formDialog.validate(valid => {
         _this.formDialog.name = _this.formDialog.name.trim();
         _this.formDialog.author = _this.formDialog.author.trim();
         if (_this.formDialog.description !== "") {
@@ -811,7 +853,7 @@ export default {
           this.formDialog.publish_status = 1;
           let data = JSON.parse(JSON.stringify(_this.formDialog));
           getContent(MethodName, data)
-            .then((res) => {
+            .then(res => {
               this.$message.success("操作成功");
               if (_this.formDialog.id) {
                 this.$set(_this.tableData, this.rowIndex, data);
@@ -842,9 +884,9 @@ export default {
         org_id: this.form.agency,
         order_column: "create_time:desc",
         publish_status: this.form.publish_status,
-        is_control_publish_scope: "false",
+        is_control_publish_scope: "false"
       };
-      getContent(MethodName, data).then((res) => {
+      getContent(MethodName, data).then(res => {
         let _this = this;
         _this.tableData = res.book_list;
         _this.courseTotal = res.total_count;
@@ -857,11 +899,11 @@ export default {
       let data = {
         name: "",
         page_capacity: 50,
-        cur_page: this.pageIndex,
+        cur_page: this.pageIndex
       };
       let dataList = [];
       getContentFile(MethodName, data)
-        .then((res) => {
+        .then(res => {
           dataList = res.org_list;
           if (this.pageIndex === res.total_page) {
             // 获取到最后的值时,不再监听滚动条的动作,移除滚动事件
@@ -881,9 +923,9 @@ export default {
     getMyOrgList() {
       let MethodName = "org_manager-GetMyOrgList";
       let data = {
-        audited_status: 1,
+        audited_status: 1
       };
-      getContentFile(MethodName, data).then((res) => {
+      getContentFile(MethodName, data).then(res => {
         if (res && res.org_list.length > 0) {
           this.myOrgList = this.myOrgList.concat(res.org_list);
           this.diaMyOrgList = res.org_list;
@@ -894,9 +936,9 @@ export default {
     getMyOrgListAgree() {
       let MethodName = "org_manager-GetMyOrgList";
       let data = {
-        audited_status: 1,
+        audited_status: 1
       };
-      getContentFile(MethodName, data).then((res) => {
+      getContentFile(MethodName, data).then(res => {
         if (res && res.org_list.length > 0) {
           this.diaMyOrgList = res.org_list;
         }
@@ -906,7 +948,7 @@ export default {
     getTypeList() {
       let MethodName = "dict_manager-GetBookTypeList";
       let data = {};
-      getContentFile(MethodName, data).then((res) => {
+      getContentFile(MethodName, data).then(res => {
         this.typeList = res.type_list;
         console.log(this.typeList);
       });
@@ -1004,28 +1046,28 @@ export default {
     handleRemoveVideo(file, fileList) {
       this.fileListVideo = fileList;
       this.formDialog.resource_file_id_list_video = [];
-      fileList.forEach((item) => {
+      fileList.forEach(item => {
         this.formDialog.resource_file_id_list_video.push(item.file_id);
       });
     },
     handleRemoveAudio(file, fileList) {
       this.fileListAudio = fileList;
       this.formDialog.resource_file_id_list_audio = [];
-      fileList.forEach((item) => {
+      fileList.forEach(item => {
         this.formDialog.resource_file_id_list_audio.push(item.file_id);
       });
     },
     handleRemoveOtheraudio(file, fileList) {
       this.fileListOtheraudio = fileList;
       this.formDialog.resource_file_id_list_otheraudio = [];
-      fileList.forEach((item) => {
+      fileList.forEach(item => {
         this.formDialog.resource_file_id_list_otheraudio.push(item.file_id);
       });
     },
     handleRemoveDoc(file, fileList) {
       this.fileListDoc = fileList;
       this.formDialog.resource_file_id_list_doc = [];
-      fileList.forEach((item) => {
+      fileList.forEach(item => {
         this.formDialog.resource_file_id_list_doc.push(item.file_id);
       });
     },
@@ -1088,9 +1130,9 @@ export default {
     },
     handleExceed(files, fileList) {
       this.$message.warning(
-        `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
-          files.length + fileList.length
-        } 个文件`
+        `当前限制选择 1 个文件,本次选择了 ${
+          files.length
+        } 个文件,共选择了 ${files.length + fileList.length} 个文件`
       );
     },
     handleExceedVideo(files, fileList) {
@@ -1099,9 +1141,9 @@ export default {
       this.uploadingOtherAudio = false;
       this.uploadingDoc = false;
       this.$message.warning(
-        `当前限制选择 100 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
-          files.length + fileList.length
-        } 个文件`
+        `当前限制选择 100 个文件,本次选择了 ${
+          files.length
+        } 个文件,共选择了 ${files.length + fileList.length} 个文件`
       );
     },
     beforeRemoveVideo(file) {
@@ -1136,10 +1178,10 @@ export default {
       this.fileListDoc = [];
       let MethodName = "book-book_manager-GetBook";
       let data = {
-        id: row.id,
+        id: row.id
       };
       getContent(MethodName, data)
-        .then((res) => {
+        .then(res => {
           this.formDialog = {
             id: res.id,
             name: res.name,
@@ -1156,57 +1198,57 @@ export default {
             publisher: res.publisher,
             theme_color: res.theme_color,
             edition: res.edition,
-            type_id: res.type_id,
+            type_id: res.type_id
           };
           sessionStorage.setItem("Bookdetail", JSON.stringify(this.formDialog));
           if (res.picture_url) {
             let obj = {
               name: "",
-              url: res.picture_url,
+              url: res.picture_url
             };
             this.fileList.push(obj);
           }
           this.agency = res.org_id;
           let MethodNames = "book-resource_manager-GetBookResourceList";
           let datas = {
-            book_id: row.id,
+            book_id: row.id
           };
-          getContent(MethodNames, datas).then((res) => {
+          getContent(MethodNames, datas).then(res => {
             if (res.status == 1) {
               this.formDialog.resource_file_id_list_video = [];
               this.formDialog.resource_file_id_list_audio = [];
               this.formDialog.resource_file_id_list_otheraudio = [];
               this.formDialog.resource_file_id_list_doc = [];
-              res.video_list.forEach((item) => {
+              res.video_list.forEach(item => {
                 let obj = {
                   name: item.file_name,
-                  file_id: item.file_id,
+                  file_id: item.file_id
                 };
                 this.fileListVideo.push(obj);
                 this.formDialog.resource_file_id_list_video.push(item.file_id);
               });
-              res.audio_list.forEach((item) => {
+              res.audio_list.forEach(item => {
                 let obj = {
                   name: item.file_name,
-                  file_id: item.file_id,
+                  file_id: item.file_id
                 };
                 this.fileListAudio.push(obj);
                 this.formDialog.resource_file_id_list_audio.push(item.file_id);
               });
-              res.otheraudio_list.forEach((item) => {
+              res.otheraudio_list.forEach(item => {
                 let obj = {
                   name: item.file_name,
-                  file_id: item.file_id,
+                  file_id: item.file_id
                 };
                 this.fileListOtheraudio.push(obj);
                 this.formDialog.resource_file_id_list_otheraudio.push(
                   item.file_id
                 );
               });
-              res.doc_list.forEach((item) => {
+              res.doc_list.forEach(item => {
                 let obj = {
                   name: item.file_name,
-                  file_id: item.file_id,
+                  file_id: item.file_id
                 };
                 this.fileListDoc.push(obj);
                 this.formDialog.resource_file_id_list_doc.push(item.file_id);
@@ -1226,27 +1268,27 @@ export default {
       if (row.publish_status == 1) {
         this.$message({
           type: "warning",
-          message: "此教材处于上架状态不可以进行删除",
+          message: "此教材处于上架状态不可以进行删除"
         });
         return false;
       }
       this.$confirm("确定要删除此书籍吗?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(() => {
           let MethodName = "book-book_manager-DeleteBook";
           let data = {
-            id: row.id,
+            id: row.id
           };
           getContent(MethodName, data)
-            .then((res) => {
+            .then(res => {
               this.currentPage = 1;
               this.getList();
               this.$message({
                 type: "success",
-                message: "删除成功!",
+                message: "删除成功!"
               });
             })
             .catch(() => {});
@@ -1258,7 +1300,7 @@ export default {
       let Mname = "book-book_manager-SetPublishStatusForBook";
       let updataData = JSON.parse(JSON.stringify(row));
       let data = {
-        book_id: row.id,
+        book_id: row.id
       };
       if (row.publish_status == 0) {
         // 下架状态
@@ -1268,7 +1310,7 @@ export default {
         data.publish_status = 0;
         updataData.publish_status = 0;
       }
-      getContent(Mname, data).then((res) => {
+      getContent(Mname, data).then(res => {
         this.$message.success("操作成功");
         this.$set(this.tableData, index, updataData);
       });
@@ -1286,8 +1328,8 @@ export default {
       this.fileListDoc = [];
       this.formDialog.description = "";
       done();
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>
@@ -1379,4 +1421,4 @@ export default {
     overflow-y: auto;
   }
 }
-</style>
+</style>