Browse Source

视频控件的封面问题 表格的问题

秦鹏 3 years ago
parent
commit
f2e2c4e59a

+ 201 - 0
src/components/Adult/common/UploadVideo.vue

@@ -0,0 +1,201 @@
+<!--  -->
+<template>
+  <div class="upload">
+    <el-upload
+      :accept="accept"
+      style="width: 300px"
+      class="upload-demo"
+      :action="url"
+      :on-preview="handlePreview"
+      :on-remove="handleRemove"
+      :before-remove="beforeRemove"
+      multiple
+      :limit="filleNumber ? filleNumber : 1"
+      :before-upload="handlebeforeUplaod"
+      :on-exceed="handleExceed"
+      :on-success="handleSuccess"
+      :on-change="handleChange"
+      :file-list="fileList"
+    >
+      <el-button size="mini" type="success">上传{{ fileTypeName }}</el-button>
+      <div
+        slot="tip"
+        style="display: inline; padding-left: 30px"
+        class="el-upload__tip"
+      >
+        {{ uploadName }}
+      </div>
+    </el-upload>
+    <!-- <div class="zhezhao" v-loading.fullscreen.lock="fullscreenLoading"></div> -->
+  </div>
+</template>
+
+<script>
+import { getToken } from "@/utils/auth";
+export default {
+  components: {},
+  props: [
+    "uploadType",
+    "filleNumber",
+    "datafileList",
+    "changeFillId",
+    "deleteImg",
+    "index",
+    "uiType",
+    "handleMp3Base64",
+  ],
+  data() {
+    return {
+      fileList: [],
+      accept: "",
+      fileTypeName: "",
+      uploadName: "",
+      loading: false,
+    };
+  },
+  computed: {
+    url() {
+      let userInfor = getToken();
+      let SessionID = "";
+      let UserCode = "";
+      let UserType = "";
+      if (userInfor) {
+        let user = JSON.parse(getToken());
+        UserCode = user.user_code;
+        UserType = user.user_type;
+        SessionID = user.session_id;
+      }
+      return (
+        process.env.VUE_APP_BASE_API +
+        "/GCLSFileServer/WebFileUpload?UserCode=" +
+        UserCode +
+        "&UserType=" +
+        UserType +
+        "&SessionID=" +
+        SessionID +
+        "&SecurityLevel=Mid"
+      );
+    },
+  },
+  watch: {
+    datafileList: {
+      handler(val, oldVal) {
+        this.initUpload();
+      },
+      // 深度观察监听
+      deep: true,
+    },
+  },
+  // 生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  // 生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+    this.initUpload();
+  },
+  beforeCreate() {}, // 生命周期 - 创建之前
+  beforeMount() {}, // 生命周期 - 挂载之前
+  beforeUpdate() {}, // 生命周期 - 更新之前
+  updated() {}, // 生命周期 - 更新之后
+  beforeDestroy() {}, // 生命周期 - 销毁之前
+  destroyed() {}, // 生命周期 - 销毁完成
+  activated() {},
+  // 方法集合
+  methods: {
+    handleChange(file, fileList) {},
+    handleSuccess(response, file, fileList) {
+      if (response.status == 1) {
+        if (this.handleMp3Base64) {
+          this.handleMp3Base64(file);
+        }
+
+        response.duration = response.file_info_list[0].media_duration
+          ? response.file_info_list[0].media_duration
+          : 10;
+        this.$message.success("用户上传成功");
+
+        this.changeFillId(fileList, response.duration, this.index);
+
+        this.loading.close();
+      } else {
+        this.fileList = [];
+        this.$message.warning(response.msg);
+        this.loading.close();
+      }
+    },
+    handlebeforeUplaod(file) {
+      this.loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+    },
+    handleRemove(file, fileList) {
+      console.log(fileList);
+      this.changeFillId(fileList);
+      this.$message.success("移除成功");
+    },
+    beforeRemove(file, fileList) {
+      return this.$confirm(`确定移除 ${file.name}?`);
+    },
+    handlePreview(file) {},
+    handleExceed(files, fileList) {
+      this.$message.warning(
+        `当前限制选择 ${
+          this.filleNumber ? this.filleNumber : 1
+        } 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
+          files.length + fileList.length
+        } 个文件`
+      );
+    },
+    initUpload() {
+      this.fileList = this.datafileList || [];
+      let name = "只能上传";
+      switch (this.uploadType) {
+        case "image":
+          this.accept = "image/*";
+          this.fileTypeName = "图片";
+          this.uploadName = name + "图片";
+          break;
+        case "mp3":
+          this.accept = "audio/*";
+          this.fileTypeName = "音频";
+          this.uploadName = name + "音频";
+          break;
+        case "pdf":
+          this.accept = ".pdf";
+          this.fileTypeName = "pdf";
+          this.uploadName = name + "pdf";
+          break;
+        case "xls":
+          this.accept = ".xls,.xlsx";
+          this.fileTypeName = "表格";
+          this.uploadName = name + "表格";
+          break;
+        case "lrc":
+          this.accept = ".lrc";
+          this.fileTypeName = "lrc";
+          this.uploadName = name + "lrc";
+          break;
+
+        default:
+          this.accept = "*";
+          this.fileTypeName = "文件";
+          this.uploadName = "";
+          break;
+      }
+    },
+  }, // 如果页面有keep-alive缓存功能,这个函数会触发
+};
+</script>
+<style lang="scss" scoped>
+.zhezhao {
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100vh;
+  background: rgba(0, 0, 0, 0.4);
+  z-index: 10000;
+}
+</style>

+ 29 - 28
src/components/Adult/inputModules/Table.vue

@@ -97,25 +97,24 @@
             增加列
           </div>
         </div>
-        <div class="adult-book-input-item">
-          请输入每一列的宽度占比,最多为100,最少为0
-        </div>
-        <div
-          class="adult-book-input-item"
-          v-for="(item, i) in curQue.colWidthList"
-          :key="'Colwid' + i"
-        >
-          <span class="adult-book-lable">第{{ i + 1 }}列</span>
-           <el-input
-            type="textarea"
-            placeholder="请输入列的宽度"
-            v-model="item.con"
-            class="adult-book-input"
-            :autosize="{ minRows: 2 }"
-            @blur="item.con = item.con.trim()"
-          ></el-input>
-        </div>
-
+          <div class="adult-book-input-item">
+            请输入每一列的宽度占比,最多为100,最少为0
+          </div>
+          <div
+            class="adult-book-input-item"
+            v-for="(item, i) in curQue.colWidthList"
+            :key="'Colwid' + i"
+          >
+            <span class="adult-book-lable">第{{ i + 1 }}列</span>
+             <el-input
+              type="textarea"
+              placeholder="请输入列的宽度"
+              v-model="item.width"
+              class="adult-book-input"
+              :autosize="{ minRows: 2 }"
+              @blur="item.width = item.width.trim()"
+            ></el-input>
+          </div>
         <div class="adult-book-input-item">
           <span class="adult-book-lable">提示标题:</span>           
           <el-input
@@ -552,15 +551,17 @@ export default {
     if (!this.curQue) {
       this.changeCurQue(this.data_structure);
     } else {
-      if (!this.curQue.colWidthList) {
-        let widthObj = JSON.parse(
-          JSON.stringify(this.data_structure.colWidthList[0])
-        );
-        this.curQue.colWidthList = [];
-        this.curQue.option[0].forEach((item) => {
-          this.curQue.colWidthList.push(widthObj);
-        });
-      }
+      // if (!this.curQue.colWidthList) {
+      //   let colWidthList = [];
+      //   this.curQue.option[0].forEach((item) => {
+      //     let widthObj = JSON.parse(
+      //       JSON.stringify(this.data_structure.colWidthList[0])
+      //     );
+      //     colWidthList.push(widthObj);
+      //   });
+      //   this.curQue.colWidthList = colWidthList;
+      //   this.$forceUpdate()
+      // }
     }
   },
   //生命周期 - 挂载完成(可以访问DOM元素)

+ 1 - 1
src/components/Adult/preview/VideoControl.vue

@@ -3,7 +3,7 @@
     <video
       :src="curQue.video_list[0].url"
       controls
-      :poster="curQue.img_list[0].url"
+      :poster="curQue.img_list.length>0?curQue.img_list[0].url:''"
       controlslist="nodownload"
       disablePictureInPicture
     ></video>