inleft
2022-08-10 10572998aa54d61c45df3e334eb01e44a15df729
src/components/mini/box10-add.vue
@@ -21,17 +21,11 @@
            </span>
         </a-form-model-item>
         <a-form-model-item label="日志文件" v-show="!form.online">
            <!-- <a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
               :default-file-list="form.blogFileList">
               <a-button>
                  <a-icon type="upload" /> 限 markdown/html
               </a-button>
            </a-upload> -->
            <a-upload :customRequest="customRequest" name="file" :showUploadList="true" @change="handleChange"
               :default-file-list="form.blogFileList" :beforeUpload="beforeUpload">
               :default-file-list="form.blogFileList" :beforeUpload="beforeUpload"
               :data="{'fileType':fileTypeMarkDown}">
               <a-button>
                  <a-icon type="upload" />限 markdown/html
@@ -69,13 +63,16 @@
            <a-form-model-item label=" 日志类型">
               <a-select v-model="form.blogType" mode="default" placeholder=""
                  :getPopupContainer="getCalendarContainer()">
                  <a-select-option   value="1">
                  <a-select-option value="1">
                     markdown
                  </a-select-option>
                  <a-select-option   value="2">
                  <a-select-option value="2">
                     html
                  </a-select-option>
                  <a-select-option   value="5">
                  <a-select-option value="3">
                     video
                  </a-select-option>
                  <a-select-option value="5">
                     fast(闪念)
                  </a-select-option>
               </a-select>
@@ -106,16 +103,9 @@
            <a-form-model-item label="封面">
               <!-- <a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76" list-type="picture"
                  :default-file-list="form.coverFileList" class="upload-list-inline">
                  <a-button>
                     <a-icon type="upload" /> jpg/png/jpeg..
                  </a-button>
               </a-upload> -->
               <a-upload :customRequest="customRequest" name="file" :showUploadList="true" list-type="picture"
                  @change="handleChangeCoverFile"
                  :default-file-list="form.coverFileList">
                  @change="handleChangeCoverFile" :default-file-list="form.coverFileList"
                  :beforeUpload="beforeUploadCover" :data="{'fileType':fileTypeCover}">
                  <a-button>
                     <a-icon type="upload" />jpg/png/jpeg..
                  </a-button>
@@ -188,13 +178,15 @@
<script>
   import moment from "moment";
   import {
      sysFileInfoUpload
      sysFileInfoUpload,
      myFileInfoUpload
   } from '../../api/fileManage.js';
   import {
      queryBlogArticleType
   } from '../../api/blogArticleType.js'
   import myConstant from "../../config/myConstant.js"
   export default {
      beforeMount() {
@@ -222,6 +214,8 @@
         };
         return {
            fileTypeMarkDown: myConstant.fileTypeMarkDown,
            fileTypeCover: myConstant.fileTypeCover,
            blogArticleType: [],
            tags: [],
            inputVisible: false,
@@ -244,7 +238,7 @@
               publishDate: "",
               lock: false,
               top: false,
               sliderValue:50,
               sliderValue: 50,
               auth: 1,
               password: "",
               fileId: null,
@@ -295,6 +289,13 @@
         };
      },
      methods: {
         beforeUploadCover(file, fileList) {
            if (this.form.coverFileList.length > 1) {
               this.$message.error('这里最多上传一个文件');
               return false;
            }
         },
         beforeUpload(file, fileList) {
            return new Promise((resolve, reject) => {
               if (this.form.fileId != null) {
@@ -345,7 +346,9 @@
         customRequest(option) {
            const formData = new FormData()
            formData.append('file', option.file)
            sysFileInfoUpload(formData).then((res) => {
            formData.append('fileType', option.data.fileType)
            formData.append('authCode', this.form.secret)
            myFileInfoUpload(formData).then((res) => {
               if (res.success) {
                  this.$message.success('上传成功')