mo 3 anni fa
parent
commit
8e10d7e45f

+ 13 - 0
src/api/appTenant.js

@@ -1,4 +1,5 @@
 import request from '@/utils/request'
+import request2 from '@/utils/request2'
 import qs from 'qs'
 let api = '/api-web'
 // 分页查询活动列表
@@ -172,3 +173,15 @@ export function uploadFileWithBase64(data) {
     data
   })
 }
+
+
+// 获取上传信息
+export function policy(data) {
+  return request2({
+    method: 'post',
+    url: '/api-web/getUploadSign',
+    data,
+  })
+}
+
+

+ 105 - 26
src/components/Editor/index.vue

@@ -6,21 +6,22 @@
       v-model="form"
       ref="myAlias"
       :options="editorOption"
-       @blur="onEditorBlur($event)"
+      @blur="onEditorBlur($event)"
       @focus="onEditorFocus($event)"
       @change="onEditorChange($event)"
     ></quill-editor>
 
     <el-upload
-    ref='ivuUpload'
+      ref="ivuUpload"
       class="ivu-upload"
       :show-file-list="false"
-      :headers="headers"
       :on-success="handleSuccess"
       accept=".jpg, .jpeg, .png"
+      :before-upload="beforeImgUpload"
       :max-size="2048"
       multiple
-      action="/api-web/uploadFile"
+      :action="ossUploadUrl"
+      :data="dataObj"
     >
       <Button icon="ios-cloud-upload-outline"></Button>
     </el-upload>
@@ -36,14 +37,14 @@
           <el-upload
             class="avatar-uploader"
             style="line-height: 0; display: inline-block"
-            action="/api-web/uploadFile"
-            :headers="headers"
             :show-file-list="false"
             v-loading="uploadImgLoading"
             accept=".jpg, .jpeg, .png"
             :on-success="handleImgSuccess"
             :on-error="handleUploadImgError"
             :before-upload="beforeImgUpload"
+            :action="ossUploadUrl"
+            :data="dataObj"
           >
             <img
               width="300px"
@@ -82,7 +83,6 @@
             class="upload-demo"
             style="display: inline-block"
             v-loading="uploadLoading"
-            action="/api-web/uploadFile"
             :before-upload="beforeUpload"
             :on-success="handleUploadSuccess"
             :on-error="handleUploadError"
@@ -90,6 +90,8 @@
             accept=".mp4"
             :file-list="fileList"
             :on-exceed="handleExceed"
+            :action="ossUploadUrl"
+            :data="dataObj"
           >
             <video
               style="width: 120px; height: 120px"
@@ -120,6 +122,7 @@ import "quill/dist/quill.snow.css";
 import "quill/dist/quill.bubble.css";
 import Quill from "quill";
 import { quillEditor } from "vue-quill-editor";
+import { policy } from "@/api/appTenant";
 // 工具栏配置
 const toolbarOptions = [
   ["bold", "italic", "underline", "strike"], // 加粗 斜体 下划线 删除线
@@ -172,7 +175,7 @@ let that;
 export default {
   // props: ["form",'key'],
   props: {
-    id:'',
+    id: "",
     keyWord: {
       type: String,
       default: "content",
@@ -184,6 +187,10 @@ export default {
       type: String,
       default: "myQuillEditor",
     },
+    bucket_name: {
+      type: String,
+      default: "daya",
+    },
   },
   name: "editor",
   components: { quillEditor },
@@ -219,8 +226,7 @@ export default {
                   let editor = this.editor;
                   // this.ActiveEditor = this.editor
                   this.editorIndex = editor.getSelection()?.index || 0;
-                 ;
-                 this.$refs.ivuUpload.$children[0].$refs.input.click()
+                  this.$refs.ivuUpload.$children[0].$refs.input.click();
                 } else {
                   this.quill.format("image", false);
                 }
@@ -241,20 +247,30 @@ export default {
         },
       },
       ActiveEditor: null,
+      dataObj: {
+        policy: "",
+        signature: "",
+        key: "",
+        KSSAccessKeyId: "",
+        // dir: "",
+        acl: "public-read",
+        name: "",
+      },
+      ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/" + this.bucket_name,
     };
   },
   created() {},
   mounted() {
-    that = this
+    that = this;
     // console.log(this.form);\
   },
   methods: {
-     onEditorBlur({ quill, html, text }) {
+    onEditorBlur({ quill, html, text }) {
       //失去焦点事件
       // console.log('失去焦点');
     },
     onEditorFocus($event) {
-      console.log($event,this.id)
+      console.log($event, this.id);
       this.ActiveEditor = $event;
 
       //获得焦点事件
@@ -293,16 +309,17 @@ export default {
     },
     handleSuccess(res) {
       // 获取富文本组件实例
-      let quill =  this.ActiveEditor;
+      let quill = this.ActiveEditor;
       // 光标所在位置
       // 如果上传成功
-      console.log(quill,this.id)
+
       // return;
-      if (res.code) {
+      let url = this.ossUploadUrl + "/" + this.dataObj.key;
+      if (url) {
         // 获取光标所在位置
         let length = quill.getSelection().index || 0;
         // 插入图片,res为服务器返回的图片链接地址
-        quill.insertEmbed(length, "image", res.data.url);
+        quill.insertEmbed(length, "image", url);
         // 调整光标到最后
         quill.setSelection(length + 1);
       } else {
@@ -335,9 +352,10 @@ export default {
     },
     handleImgSuccess(res, file) {
       this.uploadImgLoading = false;
-      this.dialogForm.poster = res.data.url;
+      let url = this.ossUploadUrl + "/" + this.dataObj.key;
+      this.dialogForm.poster = url;
     },
-    beforeImgUpload(file) {
+    async beforeImgUpload(file) {
       const imageType = {
         "image/png": true,
         "image/jpeg": true,
@@ -354,6 +372,36 @@ export default {
       if (isImage && isLt2M) {
         this.uploadImgLoading = true;
       }
+
+      try {
+        let fileName = file.name.replaceAll(" ", "_");
+        let key = new Date().getTime() + fileName;
+        let obj = {
+          filename: fileName,
+          bucketName: this.bucket_name,
+          postData: {
+            filename: fileName,
+            acl: "public-read",
+            key: key,
+            unknowValueField: [],
+          },
+        };
+
+        const res = await policy(obj);
+        this.dataObj = {
+          policy: res.data.policy,
+          signature: res.data.signature,
+          key: key,
+          KSSAccessKeyId: res.data.kssAccessKeyId,
+          // dir: "",
+          acl: "public-read",
+          name: fileName,
+          // bucket_name: props.bucket_name
+        };
+      } catch (e) {
+        console.log(e);
+        return false;
+      }
       return isImage && isLt2M;
     },
     // handleAvatarSuccess(res, file) {
@@ -375,7 +423,7 @@ export default {
       }
       return isImage && isLt2M;
     },
-    beforeUpload(file) {
+    async beforeUpload(file) {
       // const isJPG = file.type === 'image/jpeg';
       const isLt2M = file.size / 1024 / 1024 < 100;
 
@@ -386,6 +434,35 @@ export default {
         this.$message.error("上传视频大小不能超过 100MB!");
       }
       this.uploadLoading = true;
+      try {
+        let fileName = file.name.replaceAll(" ", "_");
+        let key = new Date().getTime() + fileName;
+        let obj = {
+          filename: fileName,
+          bucketName: this.bucket_name,
+          postData: {
+            filename: fileName,
+            acl: "public-read",
+            key: key,
+            unknowValueField: [],
+          },
+        };
+
+        const res = await policy(obj);
+        this.dataObj = {
+          policy: res.data.policy,
+          signature: res.data.signature,
+          key: key,
+          KSSAccessKeyId: res.data.kssAccessKeyId,
+          // dir: "",
+          acl: "public-read",
+          name: fileName,
+          // bucket_name: props.bucket_name
+        };
+      } catch (e) {
+        console.log(e);
+        return false;
+      }
       return isLt2M;
     },
     handleUploadError(file) {
@@ -394,8 +471,10 @@ export default {
     },
     handleUploadSuccess(file, fileList) {
       this.uploadLoading = false;
-      this.$message.success("上传视频成功");
-      this.dialogForm.videoUrl = file.data.url;
+
+      let url = this.ossUploadUrl + "/" + this.dataObj.key;
+
+      this.dialogForm.videoUrl = url;
     },
     handleExceed(files, fileList) {
       this.$message.error("您已上传过视频");
@@ -405,10 +484,10 @@ export default {
     editor() {
       return this.$refs.myAlias.quill;
     },
-    ActiveEditors(){
-      console.log(this.id)
-      return this.ActiveEditor
-    }
+    ActiveEditors() {
+      console.log(this.id);
+      return this.ActiveEditor;
+    },
   },
 };
 </script>

+ 7 - 6
src/components/ImageCropper/CropperModal.vue

@@ -51,7 +51,7 @@ export default {
         autoCropHeight: 180, //默认生成截图框高度
         fixedBox: true, //是否固定截图框大小 不允许改变
         full: false,
-        enlarge: 1, // 是否按照截图框比例输出 默认为1 
+        enlarge: 1, // 是否按照截图框比例输出 默认为1
         previewsCircle: true, //预览图是否是原圆形
         centerBox: true,
         outputType: 'png',
@@ -87,20 +87,21 @@ export default {
       that.confirmLoading = true
       // 获取截图的base64 数据 getCropBlob getCropData
       this.$refs.cropper.getCropBlob(async (data) => {
-        const name = (this.options.name ? this.options.name.split('.')[0] : +new Date()) + '.png'
-        let form = new FormData()
-         form.append('file', this.blobToFile(data), name)
+        // const name = (this.options.name ? this.options.name.split('.')[0] : +new Date()) + '.png'
+        // let form = new FormData()
+        //  form.append('file', this.blobToFile(data), name)
 	      // form.append('base64Str', data)
         // form.append('fileName', name)
         // form.append('extName', 'png')
         try {
-          const res = await uploadFile(form)
+          // const res = await uploadFile(form)
 	      // form.append('base64Str', data)
         // form.append('fileName', name)
         // form.append('extName', 'png')
         // try {
         //   const res = await uploadFileWithBase64(form)
-          that.$emit('cropper-ok', res)
+               that.$emit('cropper-ok', data)
+
         } catch(err) {
           that.$message.error(err)
         } finally {

+ 207 - 81
src/components/ImageCropper/index.vue

@@ -1,32 +1,68 @@
 <template>
-    <div class="ant-upload-preview">
-        <div style="width: 100%">
-            <el-upload class="avatar-uploader" :class="[disabled ? 'uploadDisabled' : null]" :disabled="disabled" :accept="accept" :show-file-list="false" action :before-upload="beforeUpload" :http-request="handleChange">
-                <i v-if="isDelete && imageUrl" class="el-icon-error" @click.stop="onDelete" style="position: absolute;right: -14px;font-size: 24px;top: -14px;color: #787878;background: #fff;"></i>
-                <img v-if="imageUrl" :src="imageUrl" class="avatar" :style="showBox" />
-                <span v-else>
-                    <i v-if="loading" class="el-icon-loading avatar-uploader-icon" :style="showBox"></i>
-                    <i v-else class="el-icon-plus avatar-uploader-icon" :style="showBox"></i>
-                    <span class="upload-desc">添加上传图片</span>
-                </span>
-            </el-upload>
-        </div>
-        <!-- modal -->
-        <cropper-modal ref="CropperModal" @cropper-no="handleCropperClose" @cropper-ok="handleCropperSuccess"></cropper-modal>
+  <div class="ant-upload-preview">
+    <div style="width: 100%">
+      <el-upload
+        class="avatar-uploader"
+        :class="[disabled ? 'uploadDisabled' : null]"
+        :disabled="disabled"
+        :accept="accept"
+        :show-file-list="false"
+        :action="ossUploadUrl"
+        :data="dataObj"
+        :before-upload="beforeUpload"
+        :http-request="handleChange"
+      >
+        <i
+          v-if="isDelete && imageUrl"
+          class="el-icon-error"
+          @click.stop="onDelete"
+          style="
+            position: absolute;
+            right: -14px;
+            font-size: 24px;
+            top: -14px;
+            color: #787878;
+            background: #fff;
+          "
+        ></i>
+        <img v-if="imageUrl" :src="imageUrl" class="avatar" :style="showBox" />
+        <span v-else>
+          <i
+            v-if="loading"
+            class="el-icon-loading avatar-uploader-icon"
+            :style="showBox"
+          ></i>
+          <i
+            v-else
+            class="el-icon-plus avatar-uploader-icon"
+            :style="showBox"
+          ></i>
+          <span class="upload-desc">添加上传图片</span>
+        </span>
+      </el-upload>
     </div>
+    <!-- modal -->
+    <cropper-modal
+      ref="CropperModal"
+      @cropper-no="handleCropperClose"
+      @cropper-ok="handleCropperSuccess"
+    ></cropper-modal>
+  </div>
 </template>
 <script>
-import CropperModal from './CropperModal'
+import CropperModal from "./CropperModal";
+import { policy } from "@/api/appTenant";
+import axios from "axios";
 export default {
-  name: 'ImageCropper',
+  name: "ImageCropper",
   components: {
-    CropperModal
+    CropperModal,
   },
   props: {
     //图片裁切配置
     options: {
       type: Object,
-      default: function() {
+      default: function () {
         return {
           autoCrop: true, //是否默认生成截图框
           enlarge: 1, //  图片放大倍数
@@ -34,9 +70,9 @@ export default {
           autoCropHeight: 200, //默认生成截图框高度
           fixedBox: false, //是否固定截图框大小 不允许改变
           previewsCircle: true, //预览图是否是原圆形
-          title: '上传图片'
-        }
-      }
+          title: "上传图片",
+        };
+      },
     },
     // 显示图片原始图片
     showSize: {
@@ -46,115 +82,206 @@ export default {
     // 上传图片的大小,单位M
     imgSize: {
       type: Number,
-      default: 2
+      default: 2,
     },
     isDelete: {
       type: Boolean,
-      default: false
+      default: false,
     },
     // 图片地址
     imageUrl: {
       type: String,
-      default: ''
+      default: "",
     },
     // 默认图片格式
     accept: {
       type: String,
-      default: '.png,.jpg,.jpeg,.gif'
+      default: ".png,.jpg,.jpeg,.gif",
     },
     acceptArray: {
       type: [Array, Object],
       default() {
-        return ['image/jpeg', 'image/png', 'image/jpg', 'image/gif']
-      }
+        return ["image/jpeg", "image/png", "image/jpg", "image/gif"];
+      },
     },
     disabled: {
       type: Boolean,
-      default: false
-    }
+      default: false,
+    },
+    bucket_name: {
+      type: String,
+      default: "daya",
+    },
   },
   data() {
     return {
       loading: false,
-      isStopRun: false
-    }
+      isStopRun: false,
+      info: null,
+      ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/" + this.bucket_name,
+      dataObj: {
+        policy: "",
+        signature: "",
+        key: "",
+        KSSAccessKeyId: "",
+        // dir: "",
+        acl: "public-read",
+        name: "",
+      },
+    };
   },
   computed: {
     showBox() {
-      let styleList = {}
-      if(this.showSize) {
+      let styleList = {};
+      if (this.showSize) {
         styleList = {
-          width: this.options.autoCropWidth + 'px',
-          height: this.options.autoCropHeight + 'px',
-          lineHeight: this.options.autoCropHeight + 'px',
-        }
+          width: this.options.autoCropWidth + "px",
+          height: this.options.autoCropHeight + "px",
+          lineHeight: this.options.autoCropHeight + "px",
+        };
       }
-      console.log(styleList)
-      return styleList
-    }
+      console.log(styleList);
+      return styleList;
+    },
   },
   methods: {
-    onDelete() { // 删除图片
-      this.$emit('update:imageUrl', '')
+    onDelete() {
+      // 删除图片
+      this.$emit("update:imageUrl", "");
     },
     //从本地选择文件
-    handleChange(info) {
+    async handleChange(info) {
+      // 缓存原始数据信息
+      this.info = info;
       if (this.isStopRun) {
-        return
+        return;
       }
-      this.loading = true
-      const { options } = this
-      console.log(info)
-      this.getBase64(info.file, imageUrl => {
+      this.loading = true;
+      // ---
+
+      //----
+      const { options } = this;
+      this.getBase64(info.file, (imageUrl) => {
         const target = Object.assign({}, options, {
           img: imageUrl,
-          name: info.file.name // 上传文件名
-        })
-        this.$refs.CropperModal.edit(target)
-      })
+          name: info.file.name, // 上传文件名
+        });
+        this.$refs.CropperModal.edit(target);
+      });
     },
     // 上传之前 格式与大小校验
     beforeUpload(file) {
-      this.isStopRun = false
-      var fileType = file.type
-      if (fileType.indexOf('image') < 0) {
-        this.$message.warning('请上传图片')
-        this.isStopRun = true
-        return false
+      this.isStopRun = false;
+      var fileType = file.type;
+      if (fileType.indexOf("image") < 0) {
+        this.$message.warning("请上传图片");
+        this.isStopRun = true;
+        return false;
       }
-      const isJpgOrPng = this.acceptArray.includes(file.type)
-        // file.type === 'image/jpeg' ||
-        // file.type === 'image/png' ||
-        // file.type === 'image/jpg'
+      const isJpgOrPng = this.acceptArray.includes(file.type);
+      // file.type === 'image/jpeg' ||
+      // file.type === 'image/png' ||
+      // file.type === 'image/jpg'
       if (!isJpgOrPng) {
-        this.$message.error('你上传图片格式不正确!')
-        this.isStopRun = true
+        this.$message.error("你上传图片格式不正确!");
+        this.isStopRun = true;
       }
-      const isLtSize = file.size < this.imgSize * 1024 * 1024
+      const isLtSize = file.size < this.imgSize * 1024 * 1024;
       if (!isLtSize) {
-        this.$message.error('图片大小不能超过' + this.imgSize + 'MB!')
-        this.isStopRun = true
+        this.$message.error("图片大小不能超过" + this.imgSize + "MB!");
+        this.isStopRun = true;
       }
-      return isJpgOrPng && isLtSize
+      return isJpgOrPng && isLtSize;
     },
-    //获取服务器返回的地址
-    handleCropperSuccess(data) {
+
+    async handleCropperSuccess(data) {
+      // 开始上传数据
+      let { action, headers, filename } = this.info;
+      let fileName = this.info.file.name.replaceAll(" ", "_");
+      const formData = new FormData();
+      try {
+        let key = new Date().getTime() + fileName;
+        let obj = {
+          filename: fileName,
+          bucketName: this.bucket_name,
+          postData: {
+            filename: fileName,
+            acl: "public-read",
+            key: key,
+            unknowValueField: [],
+          },
+        };
+        const res = await policy(obj);
+        this.dataObj = {
+          policy: res.data.policy,
+          signature: res.data.signature,
+          key: key,
+          KSSAccessKeyId: res.data.kssAccessKeyId,
+          acl: "public-read",
+          name: fileName,
+        };
+        for (let key in this.dataObj) {
+          formData.append(key, this.dataObj[key]);
+        }
+        formData.append(filename, data, fileName);
+        console.log(this.ossUploadUrl, "this.ossUploadUrl", action);
+        axios
+          .post(action, formData, {
+            ...headers,
+          })
+          .then((res) => {
+
+            let url = this.ossUploadUrl + "/" + this.dataObj.key;
+
+            if (url) {
+
+              // filelist.value = [
+              //   {
+              //     name: url,
+              //     url: url,
+              //   },
+              // ];
+
+              // resValues.value = url;
+
+
+              let data = {
+                data: {
+                  url: url,
+                },
+              };
+                  this.loading = false;
+              this.$emit("crop-upload-success", data);
+              CropperModal.value.closeVisible();
+            } else {
+              this.handleCropperClose();
+              // ElMessage.error(res.msg || '上传失败')
+            }
+          })
+          .catch((e) => {
+            // console.log(e, '失败')
+            this.handleCropperClose();
+          });
+        //putObject
+      } catch (err) {
+        this.handleCropperClose();
+        this.$message.error("上传失败");
+      }
+
       //将返回的数据回显
-      this.loading = false
-      this.$emit('crop-upload-success', data)
     },
     // 取消上传
     handleCropperClose() {
-      this.loading = false
-      this.$emit('crop-upload-close')
+      this.loading = false;
+      this.$emit("crop-upload-close");
     },
     getBase64(img, callback) {
-      const reader = new FileReader()
-      reader.addEventListener('load', () => callback(reader.result))
-      reader.readAsDataURL(img)
-    }
-  }
-}
+      const reader = new FileReader();
+      reader.addEventListener("load", () => callback(reader.result));
+      reader.readAsDataURL(img);
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
@@ -204,7 +331,6 @@ export default {
   height: 108px;
   display: block;
 }
-
 </style>
 
 

+ 125 - 73
src/components/Upload/index.vue

@@ -1,21 +1,21 @@
 
 <template>
   <div class="upload">
-    <el-upload class="avatar-uploader"
-               style="line-height: 0;display: inline-block"
-               action="/api-web/uploadFile"
-               :headers="headers"
-               :show-file-list="false"
-               v-loading="uploadImgLoading"
-               :accept="accept"
-               :on-success="handleImgSuccess"
-               :on-error="handleUploadImgError"
-               :before-upload="beforeImgUpload">
-      <img v-if="imgUrl"
-           :src="imgUrl"
-           class="avatar" />
-      <i v-else
-         class="el-icon-plus avatar-uploader-icon"></i>
+    <!--       :headers="headers" -->
+    <el-upload
+      class="avatar-uploader"
+      style="line-height: 0; display: inline-block"
+      :action="ossUploadUrl"
+      :data="dataObj"
+      :show-file-list="false"
+      v-loading="uploadImgLoading"
+      :accept="accept"
+      :on-success="handleImgSuccess"
+      :on-error="handleUploadImgError"
+      :before-upload="beforeImgUpload"
+    >
+      <img v-if="imgUrl" :src="imgUrl" class="avatar" />
+      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
     </el-upload>
   </div>
 </template>
@@ -23,14 +23,26 @@
 <script>
 import load from "@/utils/loading";
 import { getToken } from "@/utils/auth";
+import { policy } from "@/api/appTenant";
 export default {
-  data () {
+  data() {
     return {
       headers: {
-        Authorization: getToken()
+        Authorization: getToken(),
       },
       uploadImgLoading: false,
       imgUrl: null,
+      ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/" + this.bucket_name,
+      dataObj: {
+        policy: "",
+        signature: "",
+        key: "",
+        KSSAccessKeyId: "",
+        // dir: "",
+        acl: "public-read",
+        name: "",
+        // bucket_name: props.bucket_name
+      },
     };
   },
   props: {
@@ -40,106 +52,146 @@ export default {
     },
     accept: {
       type: String,
-      default () {
-        return '.jpg, .jpeg, .png, .gif'
-      }
+      default() {
+        return ".jpg, .jpeg, .png, .gif";
+      },
     },
-    imageSizeM: { // 默认2M
+    imageSizeM: {
+      // 默认2M
       type: Number,
-      default () {
-        return 2
-      }
+      default() {
+        return 2;
+      },
     },
-    imageWidthM: { // 默认2M
+    imageWidthM: {
+      // 默认2M
       type: Number,
-      default () {
-        return null
-      }
+      default() {
+        return null;
+      },
     },
-    imageHeightM: { // 默认2M
+    imageHeightM: {
+      // 默认2M
       type: Number,
-      default () {
-        return null
-      }
+      default() {
+        return null;
+      },
     },
-    imageType: { // 检测类型
+    imageType: {
+      // 检测类型
       type: Object,
-      default () {
+      default() {
         return {
           "image/png": true,
           "image/jpeg": true,
           "image/jpg": true,
-          "image/gif": true
-        }
-      }
-    }
+          "image/gif": true,
+        };
+      },
+    },
+    bucket_name: {
+      type: String,
+      default: "daya",
+    },
   },
-  mounted () {
-    this.imgUrl = this.value
+  mounted() {
+    this.imgUrl = this.value;
   },
   methods: {
-    beforeImgUpload (file) {
+    async beforeImgUpload(file) {
       const isImage = this.imageType[file.type];
       const isLt2M = file.size / 1024 / 1024 < this.imageSizeM;
-      const imageWidth = this.imageWidthM
-      const imageHeigh = this.imageHeightM
-      const _URL = window.URL || window.webkitURL
+      const imageWidth = this.imageWidthM;
+      const imageHeigh = this.imageHeightM;
+      const _URL = window.URL || window.webkitURL;
       const isSize = new Promise((resolve, reject) => {
-        const img = new Image()
+        const img = new Image();
         img.onload = function () {
-
           if (imageWidth && imageHeigh) {
-            this.width === imageWidth && this.height === imageHeigh ? resolve() : reject(`请上传${imageWidth}x${imageHeigh}尺寸图片`)
+            this.width === imageWidth && this.height === imageHeigh
+              ? resolve()
+              : reject(`请上传${imageWidth}x${imageHeigh}尺寸图片`);
           } else if (imageWidth && !imageHeigh) {
-            this.width === imageWidth ? resolve() : reject(`请上传宽为${imageWidth}的图片`)
+            this.width === imageWidth
+              ? resolve()
+              : reject(`请上传宽为${imageWidth}的图片`);
           } else if (!imageWidth && imageHeigh) {
-            this.height === imageHeigh ? resolve() : reject(`请上传高为${imageHeigh}的图片`)
-          }
-          else {
-            resolve()
+            this.height === imageHeigh
+              ? resolve()
+              : reject(`请上传高为${imageHeigh}的图片`);
+          } else {
+            resolve();
           }
-
-        }
-        img.src = _URL.createObjectURL(file)
+        };
+        img.src = _URL.createObjectURL(file);
       }).then(
         () => {
-          return file
+          return file;
         },
         (src) => {
           this.$message.error(src);
-          this.uploadImgLoading = false
-          return Promise.reject()
+          this.uploadImgLoading = false;
+          return Promise.reject();
         }
-      )
+      );
       if (!isImage) {
         this.$message.error("只能上传图片格式!");
-
       }
       if (!isLt2M) {
         this.$message.error(`上传图片大小不能超过 ${this.imageSizeM}MB!`);
       }
       if (isImage && isLt2M && isSize) {
-        this.uploadImgLoading = true
+        this.uploadImgLoading = true;
+      }
+
+      try {
+        let fileName = file.name.replaceAll(" ", "_");
+        let key = new Date().getTime() + fileName;
+        let obj = {
+          filename: fileName,
+          bucketName: this.bucket_name,
+          postData: {
+            filename: fileName,
+            acl: "public-read",
+            key: key,
+            unknowValueField: [],
+          },
+        };
+
+        const res = await policy(obj);
+        this.dataObj = {
+          policy: res.data.policy,
+          signature: res.data.signature,
+          key: key,
+          KSSAccessKeyId: res.data.kssAccessKeyId,
+          // dir: "",
+          acl: "public-read",
+          name: fileName,
+          // bucket_name: props.
+        };
+        return isImage && isLt2M && isSize;
+      } catch (e) {
+        console.log(e);
+        return false;
       }
-      return isImage && isLt2M && isSize;
     },
-    handleUploadImgError (file) {
-      this.uploadImgLoading = false
-      this.$message.error('上传失败')
+    handleUploadImgError(file) {
+      this.uploadImgLoading = false;
+      this.$message.error("上传失败");
     },
-    handleImgSuccess (res, file) {
-      this.uploadImgLoading = false
-      this.imgUrl = res.data.url
-      this.$emit('input', res.data.url)
+    handleImgSuccess(res, file) {
+      this.uploadImgLoading = false;
+      let url = this.ossUploadUrl + "/" + this.dataObj.key;
+      this.imgUrl = url;
+      this.$emit("input", url);
     },
   },
   watch: {
-    value (newValue) {
-      this.imgUrl = newValue
+    value(newValue) {
+      this.imgUrl = newValue;
     },
   },
-  beforeDestroy () {
-  },
+  beforeDestroy() {},
 };
 </script>
 

+ 139 - 51
src/components/singe-file-upload/index.vue

@@ -1,20 +1,36 @@
 <template>
-    <!-- :before-upload="beforeUpload" -->
+  <!-- :before-upload="beforeUpload"     :headers="headers"    action="/api-web/uploadFile"-->
   <el-upload
-    action="/api-web/uploadFile"
-    :headers="headers"
+
+    :action="ossUploadUrl"
+    :data="dataObj"
     :on-success="success"
     :on-remove="remove"
     :on-progress="progress"
     :on-error="error"
     :file-list="filelist"
-    :accept="accept">
-    <el-button  type="primary" plain >{{ buttonText }}</el-button>
-    <div slot="tip" v-if="tips" class="el-upload__tip">{{tips}}</div>
-    <div slot="file" slot-scope="{file}">
-      <div style="display: flex; align-items: center;flex: 1 auto;justify-content: space-between;">
-        <div style="display: flex; align-items: center;overflow: hidden;">
-          <i v-if="!!file.url" @click.stop="copyText(file.url)" title="复制" style="padding-right: 5px" class="el-icon-document-copy"></i>
+    :before-upload="beforeUpload"
+    :accept="accept"
+  >
+    <el-button type="primary" plain>{{ buttonText }}</el-button>
+    <div slot="tip" v-if="tips" class="el-upload__tip">{{ tips }}</div>
+    <div slot="file" slot-scope="{ file }">
+      <div
+        style="
+          display: flex;
+          align-items: center;
+          flex: 1 auto;
+          justify-content: space-between;
+        "
+      >
+        <div style="display: flex; align-items: center; overflow: hidden">
+          <i
+            v-if="!!file.url"
+            @click.stop="copyText(file.url)"
+            title="复制"
+            style="padding-right: 5px"
+            class="el-icon-document-copy"
+          ></i>
           <span class="upload-text" :title="file.url">{{ file.url }}</span>
         </div>
         <i v-if="!!file.url" class="el-icon-delete" @click="remove"></i>
@@ -24,61 +40,79 @@
 </template>
 
 <script>
-import copy from 'copy-to-clipboard'
-import { getToken } from '@/utils/auth'
-import load from '@/utils/loading'
+import copy from "copy-to-clipboard";
+import { getToken } from "@/utils/auth";
+import load from "@/utils/loading";
+import { policy } from "@/api/appTenant";
 export default {
-  name: 'singe-file-upload',
+  name: "singe-file-upload",
   props: {
     buttonText: {
       type: String,
-      default: '点击上传',
+      default: "点击上传",
     },
     tips: {
       type: String,
-      default: ''
+      default: "",
     },
     value: {
       type: String,
-      default: ''
+      default: "",
     },
     accept: {
       type: String,
-      default: ''
-    }
+      default: "",
+    },
+    bucket_name: {
+      type: String,
+      default: "daya",
+    },
   },
   watch: {
     value: {
       handler() {
         if (this.value) {
-          this.filelist = [{
-            name: this.value,
-            url: this.value,
-          }]
+          this.filelist = [
+            {
+              name: this.value,
+              url: this.value,
+            },
+          ];
         } else {
-          this.remove()
+          this.remove();
         }
       },
-      immediate: true
-    }
+      immediate: true,
+    },
   },
   data() {
     return {
       filelist: [],
       headers: {
-        Authorization: getToken()
+        Authorization: getToken(),
+      },
+      ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/" + this.bucket_name,
+      dataObj: {
+        policy: "",
+        signature: "",
+        key: "",
+        KSSAccessKeyId: "",
+        // dir: "",
+        acl: "public-read",
+        name: "",
+        // bucket_name: props.bucket_name
       },
-    }
+    };
   },
   methods: {
     remove() {
-      this.filelist = []
-      this.$emit('update:value', '')
-      this.$emit('input', '')
+      this.filelist = [];
+      this.$emit("update:value", "");
+      this.$emit("input", "");
     },
     error() {
-      this.remove()
-      load.endLoading()
+      this.remove();
+      load.endLoading();
     },
     // beforeUpload(file) {
     //   console.log(file)
@@ -86,32 +120,86 @@ export default {
     //   return false
     // },
     progress(file) {
-      load.startLoading()
+      load.startLoading();
     },
     success(res, file) {
-      load.endLoading()
-      if (res.code == 200) {
-        this.filelist = [{
-          name: res.data.url,
-          url: res.data.url,
-        }]
-        this.$emit('update:value', res.data.url)
-        this.$emit('input', res.data.url)
-        this.$emit('inputFile', file)
-        this.$emit('getName',res)
+      console.log(file)
+      load.endLoading();
+       let url = this.ossUploadUrl + '/' + this.dataObj.key
+      if (url) {
+        this.filelist = [
+          {
+            name: url,
+            url: url,
+          },
+        ];
+        this.$emit("update:value",url);
+        this.$emit("input", url);
+        this.$emit("inputFile", file);
+        // val.data.name
+
+       let res= {
+        data:{
+          name:this.dataObj.name
+        }
+       }
+        this.$emit("getName", res);
       } else {
-        this.remove()
-        this.$message.error(res.msg || '上传失败')
+        this.remove();
+        this.$message.error(res.msg || "上传失败");
       }
     },
     copyText(text) {
       if (text) {
-        copy(text)
-        this.$message.success('复制成功')
+        copy(text);
+        this.$message.success("复制成功");
       }
-    }
-  }
-}
+    },
+    async beforeUpload(file) {
+      // let fileName = file.name.replaceAll(" ", "_");
+      // let key = new Date().getTime() + fileName;
+      // let obj = {
+      //   filename: fileName,
+      //   bucketName: props.bucket_name,
+      //   postData: {
+      //     filename: fileName,
+      //     acl: "public-read",
+      //     key: key,
+      //     unknowValueField: [],
+      //   },
+      // };
+
+      try {
+        let fileName = file.name.replaceAll(" ", "_");
+        let key = new Date().getTime() + fileName;
+        let obj = {
+          filename: fileName,
+          bucketName: this.bucket_name,
+          postData: {
+            filename: fileName,
+            acl: "public-read",
+            key: key,
+            unknowValueField: [],
+          },
+        };
+
+        const res = await policy(obj);
+        this.dataObj = {
+          policy: res.data.policy,
+          signature: res.data.signature,
+          key: key,
+          KSSAccessKeyId: res.data.kssAccessKeyId,
+          // dir: "",
+          acl: "public-read",
+          name: fileName,
+          // bucket_name: props.bucket_name
+        };
+      } catch (e) {
+        console.log(e)
+      }
+    },
+  },
+};
 </script>
 
 <style lang="less" scoped>

+ 86 - 66
src/layout/components/modal/userModal.vue

@@ -10,23 +10,20 @@
         <div style="width: 150px !important">
           <el-upload
             class="avatar-uploader"
-            action="/api-web/uploadFile"
             accept=".png, .jpg, .jpeg, .gif"
-            :headers="headers"
             :show-file-list="false"
             :on-success="handleAvatarSuccess"
             :before-upload="beforeAvatarUpload"
+            :action="ossUploadUrl"
+            :data="dataObj"
           >
             <img v-if="form.avatar" :src="form.avatar" class="avatar" />
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
           </el-upload>
         </div>
-        <div
-            class="tips"
-            style="line-height: 1;color: red;"
-          >
-            支持的格式:png, jpg, jpeg, gif;
-          </div>
+        <div class="tips" style="line-height: 1; color: red">
+          支持的格式:png, jpg, jpeg, gif;
+        </div>
       </el-form-item>
       <el-form-item label="姓名" prop="realName">
         <el-input
@@ -79,6 +76,7 @@ import { getInfo } from "@/api/user";
 import { simpleUpdate } from "@/api/systemManage";
 import { isvalidPhone } from "@/utils/validate";
 import { getToken } from "@/utils/auth";
+import { policy } from "@/api/appTenant";
 let validPhone = (rule, value, callback) => {
   if (!value) {
     callback(new Error("请输入电话号码"));
@@ -103,11 +101,15 @@ export default {
         gender: null,
         phone: null,
         contactAddress: null,
-        postalCode: null
+        postalCode: null,
       },
       rules: {
         avatar: [
-          { required: true, message: "请上传用户头像", trigger: "blur, change" }
+          {
+            required: true,
+            message: "请上传用户头像",
+            trigger: "blur, change",
+          },
         ],
         realName: [{ required: true, message: "请输入姓名", trigger: "blur" }],
         gender: [{ required: true, message: "请选择性别", trigger: "change" }],
@@ -116,15 +118,27 @@ export default {
             type: "number",
             required: true,
             validator: validPhone,
-            trigger: "blur"
+            trigger: "blur",
           },
           {
             pattern: /^1[3456789]\d{9}$/,
             message: "请输入正确的手机号",
-            trigger: "blur"
-          }
-        ]
-      }
+            trigger: "blur",
+          },
+        ],
+      },
+      ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/daya",
+      dataObj: {
+        policy: "",
+        signature: "",
+        key: "",
+        KSSAccessKeyId: "",
+        // dir: "",
+        acl: "public-read",
+        name: "",
+        //
+      },
+      bucket_name: 'daya'
     };
   },
   mounted() {
@@ -133,8 +147,16 @@ export default {
   methods: {
     async __init() {
       try {
-        const res = await getInfo()
-        const { id, avatar,realName,gender,phone,contactAddress,postalCode } = res.data
+        const res = await getInfo();
+        const {
+          id,
+          avatar,
+          realName,
+          gender,
+          phone,
+          contactAddress,
+          postalCode,
+        } = res.data;
         this.form = {
           id,
           avatar,
@@ -142,73 +164,71 @@ export default {
           gender,
           phone,
           contactAddress,
-          postalCode
-        }
-      } catch(e) {}
+          postalCode,
+        };
+      } catch (e) {}
     },
     handleAvatarSuccess(res) {
-      this.form.avatar = res.data.url;
+         let url = this.ossUploadUrl + '/' + this.dataObj.key
+      this.form.avatar =url;
     },
-    beforeAvatarUpload(file) {
+async beforeAvatarUpload(file) {
       const imageType = {
         "image/png": true,
         "image/jpg": true,
         "image/jpeg": true,
-        "image/gif": true
+        "image/gif": true,
       };
       const isImage = imageType[file.type];
       const isLt2M = file.size / 1024 / 1024 < 2;
       if (!isImage) {
         this.$message.error("只能上传图片格式!");
-        return false
+        return false;
       }
       if (!isLt2M) {
         this.$message.error("上传头像图片大小不能超过 2MB!");
+        return false;
+      }
+
+        try {
+        let fileName = file.name.replaceAll(" ", "_");
+        let key = new Date().getTime() + fileName;
+        let obj = {
+          filename: fileName,
+          bucketName: this.bucket_name,
+          postData: {
+            filename: fileName,
+            acl: "public-read",
+            key: key,
+            unknowValueField: [],
+          },
+        };
+
+        const res = await policy(obj);
+        this.dataObj = {
+          policy: res.data.policy,
+          signature: res.data.signature,
+          key: key,
+          KSSAccessKeyId: res.data.kssAccessKeyId,
+          // dir: "",
+          acl: "public-read",
+          name: fileName,
+          // bucket_name: props.bucket_name
+        };
+          return isImage && isLt2M;
+      } catch (e) {
+        console.log(e)
         return false
       }
-      // const imageWidth = this.imageWidthM;
-      // const imageHeigh = this.imageHeightM;
-      // const _URL = window.URL || window.webkitURL;
-      // const isSize = new Promise((resolve, reject) => {
-      //   const img = new Image();
-      //   img.onload = function () {
-      //     if (imageWidth && imageHeigh) {
-      //       this.width === imageWidth && this.height === imageHeigh
-      //         ? resolve()
-      //         : reject(`请上传${imageWidth}x${imageHeigh}尺寸图片`);
-      //     } else if (imageWidth && !imageHeigh) {
-      //       this.width === imageWidth
-      //         ? resolve()
-      //         : reject(`请上传宽为${imageWidth}的图片`);
-      //     } else if (!imageWidth && imageHeigh) {
-      //       this.height === imageHeigh
-      //         ? resolve()
-      //         : reject(`请上传高为${imageHeigh}的图片`);
-      //     } else {
-      //       resolve();
-      //     }
-      //   };
-      //   img.src = _URL.createObjectURL(file);
-      // }).then(
-      //   () => {
-      //     return file;
-      //   },
-      //   (src) => {
-      //     this.$message.error(src);
-      //     this.uploadImgLoading = false;
-      //     return Promise.reject();
-      //   }
-      // );
-      //  && isSize
-      return isImage && isLt2M;
+
     },
     onRoleSubmit() {
       // employee/simpleUpdate
-      this.$refs['ruleForm'].validate(async (valid) => {
+      this.$refs["ruleForm"].validate(async (valid) => {
         if (valid) {
           simpleUpdate(this.form).then((res) => {
-              this.messageTips("修改", res);
-            });
+            this.messageTips("修改", res);
+          });
         } else {
           return;
         }
@@ -217,15 +237,15 @@ export default {
     messageTips(title, res) {
       if (res.code == 200) {
         this.$message.success(title + "成功");
-        const { realName, avatar } = this.form
-        this.$store.dispatch('user/setUserName', realName)
-        this.$store.dispatch('user/setUserAvatar', avatar)
+        const { realName, avatar } = this.form;
+        this.$store.dispatch("user/setUserName", realName);
+        this.$store.dispatch("user/setUserAvatar", avatar);
         this.$listeners.close();
       } else {
         this.$message.error(res.msg);
       }
     },
-  }
+  },
 };
 </script>
 

+ 6 - 0
src/views/accompaniment/modals/form.vue

@@ -195,6 +195,7 @@
           tips="仅支持上传 mp3/aac 格式音频文件"
           accept=".mp3, .aac"
           v-model="form.sysMusicScore.url"
+          bucket_name="cloud-coach"
         />
       </el-form-item>
       <el-form-item
@@ -206,6 +207,7 @@
           tips="仅支持上传 mp3/aac 格式音频文件"
           accept=".mp3, .aac"
           v-model="form.sysMusicScore.metronomeUrl"
+            bucket_name="cloud-coach"
         />
       </el-form-item>
       <el-form-item
@@ -216,6 +218,7 @@
           tips="仅支持上传 mid 格式音频文件"
           accept=".mid"
           v-model="form.sysMusicScore.midiUrl"
+            bucket_name="cloud-coach"
         />
       </el-form-item>
       <div
@@ -299,6 +302,7 @@
                 tips="仅支持上传 mp3/aac 格式音频文件"
                 accept=".mp3, .aac"
                 v-model="song.mp3Url"
+                  bucket_name="cloud-coach"
               />
             </el-form-item>
           </el-col>
@@ -317,6 +321,7 @@
                 tips="仅支持上传 mp3/aac 格式音频文件"
                 accept=".mp3, .aac"
                 v-model="song.metronomeMp3Url"
+                  bucket_name="cloud-coach"
               />
             </el-form-item>
           </el-col>
@@ -333,6 +338,7 @@
                 accept=".xml"
                 v-model="song.xmlUrl"
                 @inputFile="inputFile"
+                  bucket_name="cloud-coach"
               />
             </el-form-item>
           </el-col>

+ 352 - 236
src/views/adapayAccount/form.vue

@@ -2,162 +2,193 @@
 <template>
   <div class="m-container">
     <h2>
-      <el-page-header @back="onCancel"
-                      :content="(payType == 'create' ? '创建账号' : '修改账号')"></el-page-header>
+      <el-page-header
+        @back="onCancel"
+        :content="payType == 'create' ? '创建账号' : '修改账号'"
+      ></el-page-header>
     </h2>
-    <div class="m-core"
-         style="overflow: hidden">
+    <div class="m-core" style="overflow: hidden">
       <el-col :span="12" :lg="14" :md="20" :sm="20" :xs="24">
-        <el-form :model="form"
-                 :rules="rules"
-                 ref="accountForm"
-                 label-position="right"
-                 label-width="180px">
-          <el-form-item label="商户号"
-                        prop="memberId">
-            <el-input v-model="form.memberId"
-                      :disabled="payType == 'update' ? true : false"
-                      placeholder="请输入商户号"></el-input>
+        <el-form
+          :model="form"
+          :rules="rules"
+          ref="accountForm"
+          label-position="right"
+          label-width="180px"
+        >
+          <el-form-item label="商户号" prop="memberId">
+            <el-input
+              v-model="form.memberId"
+              :disabled="payType == 'update' ? true : false"
+              placeholder="请输入商户号"
+            ></el-input>
           </el-form-item>
-          <el-form-item label="公司名称"
-                        prop="name">
-            <el-input v-model="form.name"
-                      placeholder="请输入公司名称"></el-input>
+          <el-form-item label="公司名称" prop="name">
+            <el-input
+              v-model="form.name"
+              placeholder="请输入公司名称"
+            ></el-input>
           </el-form-item>
-          <el-form-item label="公司法人"
-                        prop="legalPerson">
-            <el-input v-model="form.legalPerson"
-                      placeholder="请输入公司法人"></el-input>
+          <el-form-item label="公司法人" prop="legalPerson">
+            <el-input
+              v-model="form.legalPerson"
+              placeholder="请输入公司法人"
+            ></el-input>
           </el-form-item>
-          <el-form-item label="公司法人手机号"
-                        prop="legalMp">
-            <el-input v-model="form.legalMp" maxlength="11"
-                      placeholder="请输入公司法人手机号"></el-input>
+          <el-form-item label="公司法人手机号" prop="legalMp">
+            <el-input
+              v-model="form.legalMp"
+              maxlength="11"
+              placeholder="请输入公司法人手机号"
+            ></el-input>
           </el-form-item>
-          <el-form-item label="法人身份证号"
-                        prop="legalCertId">
-            <el-input v-model="form.legalCertId"
-                      placeholder="请输入法人身份证号"></el-input>
+          <el-form-item label="法人身份证号" prop="legalCertId">
+            <el-input
+              v-model="form.legalCertId"
+              placeholder="请输入法人身份证号"
+            ></el-input>
           </el-form-item>
-          <el-form-item label="身份证有效期"
-                        prop="legalCertIdExpires">
-            <el-date-picker v-model="form.legalCertIdExpires"
-                            :picker-options="{ firstDayOfWeek:1 }"
-                            value-format="yyyyMMdd"
-                            type="date"
-                            placeholder="请选择身份证有效期">
+          <el-form-item label="身份证有效期" prop="legalCertIdExpires">
+            <el-date-picker
+              v-model="form.legalCertIdExpires"
+              :picker-options="{ firstDayOfWeek: 1 }"
+              value-format="yyyyMMdd"
+              type="date"
+              placeholder="请选择身份证有效期"
+            >
             </el-date-picker>
           </el-form-item>
-          <el-form-item label="银行卡号"
-                        prop="cardNo">
-            <el-input v-model="form.cardNo"
-                      placeholder="请输入银行卡号"></el-input>
+          <el-form-item label="银行卡号" prop="cardNo">
+            <el-input
+              v-model="form.cardNo"
+              placeholder="请输入银行卡号"
+            ></el-input>
           </el-form-item>
-          <el-form-item label="所属银行"
-                        prop="bankCode">
-            <el-select v-model="form.bankCode"
-                       placeholder="请选择所属银行">
-              <el-option v-for="(item, index) in backList"
-                         :key="index"
-                         :label="item.title"
-                         :value="item.value"></el-option>
+          <el-form-item label="所属银行" prop="bankCode">
+            <el-select v-model="form.bankCode" placeholder="请选择所属银行">
+              <el-option
+                v-for="(item, index) in backList"
+                :key="index"
+                :label="item.title"
+                :value="item.value"
+              ></el-option>
             </el-select>
           </el-form-item>
           <el-form-item label="省市" required>
             <el-row>
               <el-col :span="12">
-                <el-form-item prop="provCode" style="margin-bottom: 0;">
-                  <el-select v-model="form.provCode"
-                             style="width: 98% !important"
-                             @change="onProvChange"
-                             placeholder="请选择省份">
-                    <el-option v-for="(item, index) in cityList"
-                               :key="index"
-                               :label="item.title"
-                               :value="item.value"></el-option>
+                <el-form-item prop="provCode" style="margin-bottom: 0">
+                  <el-select
+                    v-model="form.provCode"
+                    style="width: 98% !important"
+                    @change="onProvChange"
+                    placeholder="请选择省份"
+                  >
+                    <el-option
+                      v-for="(item, index) in cityList"
+                      :key="index"
+                      :label="item.title"
+                      :value="item.value"
+                    ></el-option>
                   </el-select>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item prop="areaCode" style="margin-bottom: 0;">
-                  <el-select v-model="form.areaCode"
-                             style="width: 100% !important"
-                             placeholder="请选择城市">
-                    <el-option v-for="(item, index) in selectListCity"
-                               :key="index"
-                               :label="item.title"
-                               :value="item.value"></el-option>
+                <el-form-item prop="areaCode" style="margin-bottom: 0">
+                  <el-select
+                    v-model="form.areaCode"
+                    style="width: 100% !important"
+                    placeholder="请选择城市"
+                  >
+                    <el-option
+                      v-for="(item, index) in selectListCity"
+                      :key="index"
+                      :label="item.title"
+                      :value="item.value"
+                    ></el-option>
                   </el-select>
                 </el-form-item>
               </el-col>
             </el-row>
           </el-form-item>
-          <el-form-item label="统一社会信用码"
-                        prop="socialCreditCode">
-            <el-input v-model="form.socialCreditCode"
-                      placeholder="请输入统一社会信用码"></el-input>
+          <el-form-item label="统一社会信用码" prop="socialCreditCode">
+            <el-input
+              v-model="form.socialCreditCode"
+              placeholder="请输入统一社会信用码"
+            ></el-input>
           </el-form-item>
-          <el-form-item label="统一社会信用码有效期"
-                        prop="socialCreditCodeExpires">
-            <el-date-picker v-model="form.socialCreditCodeExpires"
-                            :picker-options="{ firstDayOfWeek:1 }"
-                            value-format="yyyyMMdd"
-                            type="date"
-                            placeholder="请选择统一社会信用码有效期">
+          <el-form-item
+            label="统一社会信用码有效期"
+            prop="socialCreditCodeExpires"
+          >
+            <el-date-picker
+              v-model="form.socialCreditCodeExpires"
+              :picker-options="{ firstDayOfWeek: 1 }"
+              value-format="yyyyMMdd"
+              type="date"
+              placeholder="请选择统一社会信用码有效期"
+            >
             </el-date-picker>
           </el-form-item>
-          <el-form-item label="经营范围"
-                        prop="businessScope">
+          <el-form-item label="经营范围" prop="businessScope">
             <!-- <el-input v-model="form.businessScope" placeholder="请输入经营范围"></el-input> -->
-            <el-input type="textarea"
-                      :rows="3"
-                      v-model="form.businessScope"
-                      placeholder="请输入经营范围"></el-input>
+            <el-input
+              type="textarea"
+              :rows="3"
+              v-model="form.businessScope"
+              placeholder="请输入经营范围"
+            ></el-input>
           </el-form-item>
-          <el-form-item label="公司地址"
-                        prop="address">
-            <el-input v-model="form.address"
-                      placeholder="请输入公司地址"></el-input>
+          <el-form-item label="公司地址" prop="address">
+            <el-input
+              v-model="form.address"
+              placeholder="请输入公司地址"
+            ></el-input>
           </el-form-item>
-          <el-form-item label="证照文件"
-                        prop="multipartFile">
+          <el-form-item label="证照文件" prop="multipartFile">
             <template slot="label">
               证照文件
               <el-tooltip placement="top" popper-class="mTooltip">
-                  <div slot="content">
-                    内容须包含三证合一证件照、法人身份证正面照、法人身份证反面照、开户银行许可证照。 压缩 zip包后上传。最大限制为 9 M。
-                    <!-- 最大限制为 9 M。 -->
-                  </div>
-                  <i
-                    class="el-icon-question micon el-tooltip"
-                    style="
-                      font-size: 18px;
-                      color: #f56c6c;
-                      top: 2px;
-                      position: relative;
-                    "
-                  ></i>
-                </el-tooltip>
+                <div slot="content">
+                  内容须包含三证合一证件照、法人身份证正面照、法人身份证反面照、开户银行许可证照。
+                  压缩 zip包后上传。最大限制为 9 M。
+                  <!-- 最大限制为 9 M。 -->
+                </div>
+                <i
+                  class="el-icon-question micon el-tooltip"
+                  style="
+                    font-size: 18px;
+                    color: #f56c6c;
+                    top: 2px;
+                    position: relative;
+                  "
+                ></i>
+              </el-tooltip>
             </template>
             <!-- <el-input type="file" class="uploadFile" v-model="form.multipartFile"></el-input> -->
-            <el-upload class="avatar-upload"
-                       ref="upload"
-                       action="/api-web/uploadFile"
-                       :headers="headers"
-                       :on-preview="handlePreview"
-                       :on-remove="handleRemove"
-                       :on-change="handleChange"
-                       :file-list="fileList"
-                       accept=".zip"
-                       :multiple="false"
-                       :limit="1"
-                       :auto-upload="false">
-              <el-button slot="trigger"
-                         type="primary">选取文件</el-button>
+            <el-upload
+              class="avatar-upload"
+              ref="upload"
+              :action="ossUploadUrl"
+              :data="dataObj"
+              :on-preview="handlePreview"
+              :on-remove="handleRemove"
+              :on-change="handleChange"
+              :file-list="fileList"
+              accept=".zip"
+              :multiple="false"
+              :limit="1"
+              :auto-upload="false"
+            >
+              <el-button slot="trigger" type="primary">选取文件</el-button>
               <!-- ,且不超过500kb -->
-              <div slot="tip"
-                   style="display: inline; padding-left: 20px;"
-                   class="el-upload__tip">只能上传一个文件</div>
+              <div
+                slot="tip"
+                style="display: inline; padding-left: 20px"
+                class="el-upload__tip"
+              >
+                只能上传一个文件
+              </div>
             </el-upload>
             <!-- <el-upload class="avatar-uploader"
                             action="/api-web/uploadFile"
@@ -172,15 +203,17 @@
                             class="el-icon-plus avatar-uploader-icon"></i>
                         </el-upload> -->
           </el-form-item>
-          <el-form-item label="邮编"
-                        prop="zipCode">
-            <el-input v-model="form.zipCode"
-                      placeholder="请输入邮编"></el-input>
+          <el-form-item label="邮编" prop="zipCode">
+            <el-input
+              v-model="form.zipCode"
+              placeholder="请输入邮编"
+            ></el-input>
           </el-form-item>
           <el-form-item>
-            <el-button type="primary" 
-                       @click="onSubmit('accountForm')">确 定</el-button>
-            <el-button @click="onCancel" >取 消</el-button>
+            <el-button type="primary" @click="onSubmit('accountForm')"
+              >确 定</el-button
+            >
+            <el-button @click="onCancel">取 消</el-button>
           </el-form-item>
         </el-form>
       </el-col>
@@ -192,22 +225,23 @@
 import { cityJson } from "../../utils/cityJson";
 import { bankJson } from "../../utils/bankJson";
 import { getToken } from "@/utils/auth";
-import load from '@/utils/loading'
-import { createMember, updateMember } from './api.js'
-import { isvalidPhone } from '@/utils/validate'
+import load from "@/utils/loading";
+import { createMember, updateMember } from "./api.js";
+import { isvalidPhone } from "@/utils/validate";
+import { policy } from "@/api/appTenant";
 let validPhone = (rule, value, callback) => {
   if (!value) {
-    callback(new Error('请输入公司法人手机号'))
+    callback(new Error("请输入公司法人手机号"));
   } else if (!isvalidPhone(value)) {
-    callback(new Error('请输入正确的11位手机号码'))
+    callback(new Error("请输入正确的11位手机号码"));
   } else {
-    callback()
+    callback();
   }
-}
+};
 export default {
-  name: 'ADaPayAccount',
-  data () {
-    const query = this.$route.query
+  name: "ADaPayAccount",
+  data() {
+    const query = this.$route.query;
     return {
       payType: query.type,
       row: query.row ? JSON.parse(query.row) : {},
@@ -215,7 +249,7 @@ export default {
       cityList: cityJson,
       selectListCity: [],
       headers: {
-        Authorization: getToken()
+        Authorization: getToken(),
       },
       fileList: [],
       files: null, // 上传对象
@@ -236,42 +270,91 @@ export default {
         businessScope: null,
         address: null,
         multipartFile: null,
-        zipCode: null
+        zipCode: null,
       },
       rules: {
-        memberId: [{ required: true, message: '请输入商户号', trigger: 'blur' }],
-        name: [{ required: true, message: '请输入公司名称', trigger: 'blur' }],
-        legalPerson: [{ required: true, message: '请输入公司法人', trigger: 'blur' }],
-        legalMp: [{ type: 'number', required: true, validator: validPhone, trigger: 'blur' }],
-        legalCertId: [{ required: true, message: '请输入法人身份证号', trigger: 'blur' }],
-        legalCertIdExpires: [{ required: true, message: '请选择身份证有效期', trigger: 'change' }],
-        cardNo: [{ required: true, message: '请输入银行卡号', trigger: 'blur' }],
-        bankCode: [{ required: true, message: '请选择所属银行', trigger: 'change' }],
-        provCode: [{ required: true, message: '请选择省份', trigger: 'change' }],
-        areaCode: [{ required: true, message: '请选择城市', trigger: 'change' }],
-        socialCreditCode: [{ required: true, message: '请输入统一社会信用码', trigger: 'blur' }],
-        socialCreditCodeExpires: [{ required: true, message: '请选择统一社会信用码有效期', trigger: 'change' }],
-        businessScope: [{ required: true, message: '请输入经营范围', trigger: 'blur' }],
-        address: [{ required: true, message: '请输入公司地址', trigger: 'blur' }],
-        multipartFile: [{ required: true, message: '请上传证照文件', trigger: 'change' }],
-        zipCode: [{ required: true, message: '请输入邮编', trigger: 'blur' }]
-      }
+        memberId: [
+          { required: true, message: "请输入商户号", trigger: "blur" },
+        ],
+        name: [{ required: true, message: "请输入公司名称", trigger: "blur" }],
+        legalPerson: [
+          { required: true, message: "请输入公司法人", trigger: "blur" },
+        ],
+        legalMp: [
+          {
+            type: "number",
+            required: true,
+            validator: validPhone,
+            trigger: "blur",
+          },
+        ],
+        legalCertId: [
+          { required: true, message: "请输入法人身份证号", trigger: "blur" },
+        ],
+        legalCertIdExpires: [
+          { required: true, message: "请选择身份证有效期", trigger: "change" },
+        ],
+        cardNo: [
+          { required: true, message: "请输入银行卡号", trigger: "blur" },
+        ],
+        bankCode: [
+          { required: true, message: "请选择所属银行", trigger: "change" },
+        ],
+        provCode: [
+          { required: true, message: "请选择省份", trigger: "change" },
+        ],
+        areaCode: [
+          { required: true, message: "请选择城市", trigger: "change" },
+        ],
+        socialCreditCode: [
+          { required: true, message: "请输入统一社会信用码", trigger: "blur" },
+        ],
+        socialCreditCodeExpires: [
+          {
+            required: true,
+            message: "请选择统一社会信用码有效期",
+            trigger: "change",
+          },
+        ],
+        businessScope: [
+          { required: true, message: "请输入经营范围", trigger: "blur" },
+        ],
+        address: [
+          { required: true, message: "请输入公司地址", trigger: "blur" },
+        ],
+        multipartFile: [
+          { required: true, message: "请上传证照文件", trigger: "change" },
+        ],
+        zipCode: [{ required: true, message: "请输入邮编", trigger: "blur" }],
+      },
+      ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/" + this.bucket_name,
+      dataObj: {
+        policy: "",
+        signature: "",
+        key: "",
+        KSSAccessKeyId: "",
+        // dir: "",
+        acl: "public-read",
+        name: "",
+        // bucket_name: props.bucket_name
+      },
+      bucket_name: "daya",
     };
   },
-  mounted () {
-    this.__init()
+  mounted() {
+    this.__init();
   },
   methods: {
-    __init () {
-      const query = this.$route.query
-      this.payType = query.type
-      this.row = query.row ? JSON.parse(query.row) : {}
-      this.files = null
-      this.fileList = []
-      this.form.multipartFile = null
-      if (this.payType == 'update') {
-        const row = this.row
-        this.id = row.id
+    __init() {
+      const query = this.$route.query;
+      this.payType = query.type;
+      this.row = query.row ? JSON.parse(query.row) : {};
+      this.files = null;
+      this.fileList = [];
+      this.form.multipartFile = null;
+      if (this.payType == "update") {
+        const row = this.row;
+        this.id = row.id;
         this.form = {
           memberId: row.memberId,
           name: row.name,
@@ -288,14 +371,14 @@ export default {
           businessScope: row.businessScope,
           address: row.address,
           multipartFile: row.multipartFile,
-          zipCode: row.zipCode
-        }
-        this.cityList.forEach(item => {
+          zipCode: row.zipCode,
+        };
+        this.cityList.forEach((item) => {
           if (item.value == row.provCode) {
-            this.selectListCity = item.cities
+            this.selectListCity = item.cities;
           }
-        })
-      } else if (this.payType == 'create') {
+        });
+      } else if (this.payType == "create") {
         // this.form = {
         //     memberId: null,
         //     name: null,
@@ -314,98 +397,131 @@ export default {
         //     multipartFile: null,
         //     zipCode: null
         // }
-        this.$refs["accountForm"].resetFields()
+        this.$refs["accountForm"].resetFields();
       }
     },
-    async onSubmit (formName) {
-      this.$refs[formName].validate(valid => {
+    async onSubmit(formName) {
+      this.$refs[formName].validate((valid) => {
         if (valid) {
-          const form = this.form
-          let formData = new FormData()
-          formData.append("memberId", form.memberId)
-          formData.append("name", form.name)
-          formData.append("legalPerson", form.legalPerson)
-          formData.append("legalMp", form.legalMp)
-          formData.append("legalCertId", form.legalCertId)
-          formData.append("legalCertIdExpires", form.legalCertIdExpires)
-          formData.append("cardNo", form.cardNo)
-          formData.append("bankCode", form.bankCode)
-          formData.append("provCode", form.provCode)
-          formData.append("areaCode", form.areaCode)
-          formData.append("socialCreditCode", form.socialCreditCode)
-          formData.append("socialCreditCodeExpires", form.socialCreditCodeExpires)
-          formData.append("businessScope", form.businessScope)
-          formData.append("address", form.address)
-          formData.append("multipartFile", form.multipartFile)
-          formData.append("zipCode", form.zipCode)
-          if (this.payType == 'create') {
-            createMember(formData).then(res => {
+          const form = this.form;
+          let formData = new FormData();
+          formData.append("memberId", form.memberId);
+          formData.append("name", form.name);
+          formData.append("legalPerson", form.legalPerson);
+          formData.append("legalMp", form.legalMp);
+          formData.append("legalCertId", form.legalCertId);
+          formData.append("legalCertIdExpires", form.legalCertIdExpires);
+          formData.append("cardNo", form.cardNo);
+          formData.append("bankCode", form.bankCode);
+          formData.append("provCode", form.provCode);
+          formData.append("areaCode", form.areaCode);
+          formData.append("socialCreditCode", form.socialCreditCode);
+          formData.append(
+            "socialCreditCodeExpires",
+            form.socialCreditCodeExpires
+          );
+          formData.append("businessScope", form.businessScope);
+          formData.append("address", form.address);
+          formData.append("multipartFile", form.multipartFile);
+          formData.append("zipCode", form.zipCode);
+          if (this.payType == "create") {
+            createMember(formData).then((res) => {
               if (res.code == 200) {
-                this.$message.success('保存成功')
-                this.onCancel()
+                this.$message.success("保存成功");
+                this.onCancel();
               } else {
-                this.$message.error(res.msg)
+                this.$message.error(res.msg);
               }
-            })
-          } else if (this.payType == 'update') {
-            formData.append('id', this.id)
-            updateMember(formData).then(res => {
+            });
+          } else if (this.payType == "update") {
+            formData.append("id", this.id);
+            updateMember(formData).then((res) => {
               if (res.code == 200) {
-                this.$message.success('保存成功')
-                this.onCancel()
+                this.$message.success("保存成功");
+                this.onCancel();
               } else {
-                this.$message.error(res.msg)
+                this.$message.error(res.msg);
               }
-            })
+            });
           }
         } else {
           this.$nextTick(() => {
-            let isError = document.getElementsByClassName('is-error')
+            let isError = document.getElementsByClassName("is-error");
             isError[0].scrollIntoView({
-              block: 'center',
-              behavior: 'smooth',
-            })
-          })
+              block: "center",
+              behavior: "smooth",
+            });
+          });
           return false;
         }
       });
     },
-    handleChange (file) {
-      console.log(file)
+   async handleChange(file) {
       const isLt2M = file.size / 1024 / 1024 < 9;
       if (!isLt2M) {
         this.$message.error(`上传文件大小不能超过 ${9}MB!`);
-        this.fileList = []
-        return
+        this.fileList = [];
+        return;
       }
-      this.files = file
-      this.form.multipartFile = file.raw
-      this.$refs["accountForm"].validateField('multipartFile')
+      try {
+        let fileName = file.name.replaceAll(" ", "_");
+        let key = new Date().getTime() + fileName;
+        let obj = {
+          filename: fileName,
+          bucketName: this.bucket_name,
+          postData: {
+            filename: fileName,
+            acl: "public-read",
+            key: key,
+            unknowValueField: [],
+          },
+        };
+
+        const res = await policy(obj);
+        this.dataObj = {
+          policy: res.data.policy,
+          signature: res.data.signature,
+          key: key,
+          KSSAccessKeyId: res.data.kssAccessKeyId,
+          // dir: "",
+          acl: "public-read",
+          name: fileName,
+          // bucket_name: props.bucket_name
+        };
+        this.files = file;
+        this.form.multipartFile = file.raw;
+        this.$refs["accountForm"].validateField("multipartFile");
+      } catch (e) {
+        console.log(e);
+        return false;
+      }
+
+      return true;
     },
-    handleRemove (file, fileList) {
-      this.files = null
-      this.form.multipartFile = null
+    handleRemove(file, fileList) {
+      this.files = null;
+      this.form.multipartFile = null;
     },
-    handlePreview (file) {
+    handlePreview(file) {
       //  (file);
     },
-    onProvChange (value) {
-      this.form.areaCode = null
-      this.cityList.forEach(item => {
+    onProvChange(value) {
+      this.form.areaCode = null;
+      this.cityList.forEach((item) => {
         if (item.value == value) {
-          this.selectListCity = item.cities
+          this.selectListCity = item.cities;
         }
-      })
+      });
     },
-    onCancel () {
-      this.files = null
-      this.fileList = []
-      this.form.multipartFile = null
-      this.$store.dispatch('delVisitedViews', this.$route)
+    onCancel() {
+      this.files = null;
+      this.fileList = [];
+      this.form.multipartFile = null;
+      this.$store.dispatch("delVisitedViews", this.$route);
       this.$router.push({
-        path: "/sysBasics/adapayManager"
+        path: "/sysBasics/adapayManager",
       });
-    }
+    },
   },
 };
 </script>

+ 1 - 0
src/views/businessManager/shopManager/shopList.vue

@@ -1010,6 +1010,7 @@
             :imgSize="2"
             :imageUrl="form.image"
             @crop-upload-success="cropSuccess"
+            bucket_name='mall'
           />
           <p style="color: red">请上传大小2M以内,格式为jpg、png、gif图片</p>
         </el-form-item>

+ 1 - 0
src/views/businessManager/shopManager/shopOperation.vue

@@ -424,6 +424,7 @@
             :imgSize="2"
             :imageUrl="form.image"
             @crop-upload-success="cropSuccess"
+            bucket_name='mall'
           />
           <p class="imageSize">
             <!-- 仅支持上传尺寸为:{{ imageWidthM }}x{{ imageHeightM }}的图片 -->

+ 633 - 492
src/views/contentManager/model/systemNotifyModel.vue

@@ -1,45 +1,63 @@
 <template>
   <div class="systemNotifyModel">
     <div class="m-core">
-      <el-form :model="form"
-               :rules="rules"
-               ref="form"
-               label-width="110px"
-               style="width: 100%">
-        <el-form-item label="标题"
-                      prop="title">
-          <el-input v-model.trim="form.title" placeholder="请输入标题"></el-input>
+      <el-form
+        :model="form"
+        :rules="rules"
+        ref="form"
+        label-width="110px"
+        style="width: 100%"
+      >
+        <el-form-item label="标题" prop="title">
+          <el-input
+            v-model.trim="form.title"
+            placeholder="请输入标题"
+          ></el-input>
         </el-form-item>
         <el-form-item label="排序值">
-          <el-input v-model.trim="form.order" placeholder="请输入排序值" type="number"></el-input>
+          <el-input
+            v-model.trim="form.order"
+            placeholder="请输入排序值"
+            type="number"
+          ></el-input>
         </el-form-item>
 
-        <el-form-item label="所属分部"
-                      prop="organIdList">
-          <select-all v-model.trim="form.organIdList"
-                     style="width: 400px !important"
-                     filterable
-                     placeholder="请选择分部"
-                     multiple
-                     clearable>
-            <el-option v-for="(item,index) in selects.branchs"
-                       :key="index"
-                       :label="item.name"
-                       :value="item.id"></el-option>
+        <el-form-item label="所属分部" prop="organIdList">
+          <select-all
+            v-model.trim="form.organIdList"
+            style="width: 400px !important"
+            filterable
+            placeholder="请选择分部"
+            multiple
+            clearable
+          >
+            <el-option
+              v-for="(item, index) in selects.branchs"
+              :key="index"
+              :label="item.name"
+              :value="item.id"
+            ></el-option>
           </select-all>
         </el-form-item>
 
         <el-form-item label="是否使用外链">
-            <el-radio-group v-model="outUrlRadio">
-                <el-radio :label="1">是</el-radio>
-                <el-radio :label="0">否</el-radio>
-            </el-radio-group>
+          <el-radio-group v-model="outUrlRadio">
+            <el-radio :label="1">是</el-radio>
+            <el-radio :label="0">否</el-radio>
+          </el-radio-group>
         </el-form-item>
-        <el-form-item label="外链地址"
-                      prop="linkUrl"
-                      v-if="outUrlRadio == 1"
-                      :rules='[{ required: true, message: "请输入外链地址", trigger: "blur" }]'>
-          <el-input v-model.trim="form.linkUrl" placeholder="请输入外链地址"></el-input>
+        <el-form-item
+          label="外链地址"
+          prop="linkUrl"
+          v-if="outUrlRadio == 1"
+          :rules="[
+            { required: true, message: '请输入外链地址', trigger: 'blur' },
+          ]"
+        >
+          <el-input
+            v-model.trim="form.linkUrl"
+            placeholder="请输入外链地址"
+          ></el-input>
         </el-form-item>
 
         <!-- <el-form-item label="自动开启时间" prop="actionTime" :rules="[{required: true, message: '请选择自动开启时间范围', trigger: 'change'}]">
@@ -54,131 +72,171 @@
                     </el-date-picker>
         </el-form-item> -->
 
-        <el-form-item label="内容"
-                      prop="content"
-                      v-if="outUrlRadio == 0"
-                      :rules="[{ required: true, message: '请编辑内容', trigger: 'blur' }]">
-          <quill-editor class="ql-editor" style="margin-top: -17px;"
-                        v-model="form.content"
-                        ref="myQuillEditor"
-                        :options="editorOption"
-                        @change="onEditorChange($event)"></quill-editor>
+        <el-form-item
+          label="内容"
+          prop="content"
+          v-if="outUrlRadio == 0"
+          :rules="[{ required: true, message: '请编辑内容', trigger: 'blur' }]"
+        >
+          <quill-editor
+            class="ql-editor"
+            style="margin-top: -17px"
+            v-model="form.content"
+            ref="myQuillEditor"
+            :options="editorOption"
+            @change="onEditorChange($event)"
+          ></quill-editor>
 
-          <el-upload class="ivu-upload"
-                     :show-upload-list="false"
-                     :headers="headers"
-                     :on-success="handleSuccess"
-                     accept=".jpg, .jpeg, .png, .gif"
-                     :max-size="2048"
-                     multiple
-                     action="/api-web/uploadFile">
+          <el-upload
+            class="ivu-upload"
+            :show-upload-list="false"
+            :on-success="handleSuccess"
+            accept=".jpg, .jpeg, .png, .gif"
+            :max-size="2048"
+            multiple
+            :action="ossUploadUrl"
+            :data="dataObj"
+            :before-upload="beforeImgUpload"
+          >
             <Button icon="ios-cloud-upload-outline"></Button>
           </el-upload>
         </el-form-item>
         <el-form-item>
-          <el-button @click="onSubmit('form')"
-                     type="primary">立即{{ pageType == "create" ? '创建' : '修改' }}</el-button>
+          <el-button @click="onSubmit('form')" type="primary"
+            >立即{{ pageType == "create" ? "创建" : "修改" }}</el-button
+          >
           <el-button @click="onReSet('form')">重置</el-button>
           <el-button @click="onLook">预览</el-button>
         </el-form-item>
       </el-form>
     </div>
 
-    <el-dialog title="插入视频" :append-to-body="true"
-               width="500px"
-               @close="onDialogClose('diologForm')"
-               :visible.sync="dialogFormVisible">
-      <el-form :model="dialogForm"
-               ref="diologForm"
-               :rules="dialogFormRules">
-        <el-form-item label="封面图地址"
-                      prop="poster"
-                      :rules="[{required: uploadType == 2 ? true : false, message: '请上传封面图', trigger: 'blur'}]"
-                      label-width="120px">
-          <el-upload class="avatar-uploader"
-                     style="line-height: 0;display: inline-block"
-                     action="/api-web/uploadFile"
-                     :headers="headers"
-                     :show-file-list="false"
-                     v-loading="uploadImgLoading"
-                     accept=".jpg, .jpeg, .png, .gif"
-                     :on-success="handleImgSuccess"
-                     :on-error="handleUploadImgError"
-                     :before-upload="beforeImgUpload">
-            <img v-if="dialogForm.poster"
-                 :src="dialogForm.poster"
-                 class="avatar" />
-            <i v-else
-               class="el-icon-plus avatar-uploader-icon"></i>
+    <el-dialog
+      title="插入视频"
+      :append-to-body="true"
+      width="500px"
+      @close="onDialogClose('diologForm')"
+      :visible.sync="dialogFormVisible"
+    >
+      <el-form :model="dialogForm" ref="diologForm" :rules="dialogFormRules">
+        <el-form-item
+          label="封面图地址"
+          prop="poster"
+          :rules="[
+            {
+              required: uploadType == 2 ? true : false,
+              message: '请上传封面图',
+              trigger: 'blur',
+            },
+          ]"
+          label-width="120px"
+        >
+          <el-upload
+            class="avatar-uploader"
+            style="line-height: 0; display: inline-block"
+            :action="ossUploadUrl"
+            :data="dataObj"
+            :show-file-list="false"
+            v-loading="uploadImgLoading"
+            accept=".jpg, .jpeg, .png, .gif"
+            :on-success="handleImgSuccess"
+            :on-error="handleUploadImgError"
+            :before-upload="beforeImgUpload"
+          >
+            <img
+              v-if="dialogForm.poster"
+              :src="dialogForm.poster"
+              class="avatar"
+            />
+            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
           </el-upload>
         </el-form-item>
-        <el-form-item label="视频类型"
-                      label-width="120px">
+        <el-form-item label="视频类型" label-width="120px">
           <el-radio-group v-model="formRadio">
             <el-radio :label="1">外部链接</el-radio>
             <el-radio :label="2">上传</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item v-if="formRadio == 1"
-                      label="视频地址"
-                      label-width="120px"
-                      prop="url">
-          <el-input v-model="dialogForm.url"
-                    style="width: 100%;"
-                    autocomplete="off"></el-input>
+        <el-form-item
+          v-if="formRadio == 1"
+          label="视频地址"
+          label-width="120px"
+          prop="url"
+        >
+          <el-input
+            v-model="dialogForm.url"
+            style="width: 100%"
+            autocomplete="off"
+          ></el-input>
         </el-form-item>
-        <el-form-item v-if="formRadio == 2"
-                      label="上传视频"
-                      label-width="120px"
-                      prop="videoUrl">
-          <el-upload class="upload-demo"
-                     style="display: inline-block"
-                     v-loading="uploadLoading"
-                     action="/api-web/uploadFile"
-                     :before-upload="beforeUpload"
-                     :on-success="handleUploadSuccess"
-                     :on-error="handleUploadError"
-                     :show-file-list="false"
-                     accept=".mp4"
-                     :file-list="fileList"
-                     :on-exceed="handleExceed">
-            <video style="width: 120px; height: 120px"
-                   v-if="dialogForm.videoUrl"
-                   type="video/mp4"
-                   preload="auto"
-                   :src="dialogForm.videoUrl"></video>
-            <i v-else
-               class="el-icon-plus avatar-uploader-icon"></i>
+        <el-form-item
+          v-if="formRadio == 2"
+          label="上传视频"
+          label-width="120px"
+          prop="videoUrl"
+        >
+          <el-upload
+            class="upload-demo"
+            style="display: inline-block"
+            v-loading="uploadLoading"
+            :action="ossUploadUrl"
+            :data="dataObj"
+            :before-upload="beforeUpload"
+            :on-success="handleUploadSuccess"
+            :on-error="handleUploadError"
+            :show-file-list="false"
+            accept=".mp4"
+            :file-list="fileList"
+            :on-exceed="handleExceed"
+          >
+            <video
+              style="width: 120px; height: 120px"
+              v-if="dialogForm.videoUrl"
+              type="video/mp4"
+              preload="auto"
+              :src="dialogForm.videoUrl"
+            ></video>
+            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
           </el-upload>
           <p class="imageSize">
             <!-- 广告管理 & 广告类型为 视频 -->
-            <span v-if="uploadType == 2 && type == 8">上传视频尺寸建议:1242px * 2208px;</span><br />
+            <span v-if="uploadType == 2 && type == 8"
+              >上传视频尺寸建议:1242px * 2208px;</span
+            ><br />
             只能上传mp4文件, 且不超过100M
           </p>
         </el-form-item>
       </el-form>
-      <div slot="footer"
-           class="dialog-footer">
+      <div slot="footer" class="dialog-footer">
         <el-button @click="dialogFormVisible = false">取 消</el-button>
-        <el-button type="primary"
-                   @click="onVideoComfirm('diologForm')">确 定</el-button>
+        <el-button type="primary" @click="onVideoComfirm('diologForm')"
+          >确 定</el-button
+        >
       </div>
     </el-dialog>
 
-    <el-dialog width="375px" title="预览" :append-to-body="true" :visible.sync="lookVisible">
+    <el-dialog
+      width="375px"
+      title="预览"
+      :append-to-body="true"
+      :visible.sync="lookVisible"
+    >
       <div class="sd-container">
         <h2>{{ dataInfo.title }}</h2>
         <div class="titleInfo">
           <p>{{ typeCheck(dataInfo.type) }}</p>
           <p>{{ dataInfo.updateTime }}</p>
         </div>
-        <div class="msgWrap quill-editor ql-editor"
-             v-html="dataInfo.content"></div>
+        <div
+          class="msgWrap quill-editor ql-editor"
+          v-html="dataInfo.content"
+        ></div>
       </div>
     </el-dialog>
   </div>
 </template>
 <script>
+import { policy } from "@/api/appTenant";
 import { newsQueryId, newsAdd, newsUpdate } from "@/api/contentManager";
 import { getToken } from "@/utils/auth";
 import { vaildStudentUrl } from "@/utils/validate";
@@ -202,7 +260,7 @@ const toolbarOptions = [
   [{ font: [] }], // 字体种类
   [{ align: [] }], // 对齐方式
   ["clean"], // 清除文本格式
-  ["image", "video"] // 链接、图片、视频
+  ["image", "video"], // 链接、图片、视频
   // ["link", "image", "video"] // 链接、图片、视频
 ];
 // 标题
@@ -229,405 +287,488 @@ const titleConfig = {
   "ql-image": "图片",
   "ql-video": "视频",
   "ql-clean": "清除字体样式",
-  "ql-upload": "文件"
+  "ql-upload": "文件",
 };
 
-
 // 这里引入修改过的video模块并注册
 import Video from "../../quill/video.js";
-import dayjs from 'dayjs'
+import dayjs from "dayjs";
 Quill.register(Video, true);
 export default {
-    props: ['options'],
-    name: "contentOperation",
-    components: {
-        quillEditor
-    },
-    data () {
-        let that = this;
-        const query = this.options
-        return {
-            uploadType: 1, // 上传类型
-            uploadStatus: false,
-            type: query.type,
-            pageType: query.pageType,
-            organId: null,
-            headers: {
-                Authorization: getToken()
-            },
-            content: null,
-            dialogFormVisible: false,
-            formRadio: 1,
-            lookVisible: false,
-            dataInfo: {
-                title: '',
-                type: query.type,
-                updateTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
-                content: null
-            },
-            editorIndex: 0, // 光标位置
-            editorOption: {
-                placeholder: "请输入内容",
-                modules: {
-                    toolbar: {
-                        container: toolbarOptions,
-                        handlers: {
-                            image: function (value) {
-                                if (value) {
-                                    // 调用iview图片上传
-                                    document.querySelector(".ivu-upload .el-upload").click();
-                                } else {
-                                    this.quill.format("image", false);
-                                }
-                            },
-                            video: function (value) {
-                                if (value) {
-                                    that.dialogFormVisible = true;
-                                    let editor = that.$refs.myQuillEditor.quill;
-                                    // 光标所在位置
-                                    that.editorIndex = editor.getSelection().index;
-                                } else {
-                                    this.quill.format("image", false);
-                                }
-                            }
-                        }
-                    }
+  props: ["options"],
+  name: "contentOperation",
+  components: {
+    quillEditor,
+  },
+  data() {
+    let that = this;
+    const query = this.options;
+    return {
+      uploadType: 1, // 上传类型
+      uploadStatus: false,
+      type: query.type,
+      pageType: query.pageType,
+      organId: null,
+      // headers: {
+      //     Authorization: getToken()
+      // },
+      content: null,
+      dialogFormVisible: false,
+      formRadio: 1,
+      lookVisible: false,
+      dataInfo: {
+        title: "",
+        type: query.type,
+        updateTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
+        content: null,
+      },
+      editorIndex: 0, // 光标位置
+      editorOption: {
+        placeholder: "请输入内容",
+        modules: {
+          toolbar: {
+            container: toolbarOptions,
+            handlers: {
+              image: function (value) {
+                if (value) {
+                  // 调用iview图片上传
+                  document.querySelector(".ivu-upload .el-upload").click();
+                } else {
+                  this.quill.format("image", false);
                 }
+              },
+              video: function (value) {
+                if (value) {
+                  that.dialogFormVisible = true;
+                  let editor = that.$refs.myQuillEditor.quill;
+                  // 光标所在位置
+                  that.editorIndex = editor.getSelection().index;
+                } else {
+                  this.quill.format("image", false);
+                }
+              },
             },
-            dialogForm: {
-                poster: null,
-                url: null,
-                videoUrl: null
-            },
-            uploadLoading: false,
-            uploadImgLoading: false,
-            fileList: [],
-            dialogFormRules: {
-                url: [{ required: true, message: "请输入视频地址", trigger: "blur" }],
-                videoUrl: [{ required: true, message: "请上传视频", trigger: 'blur' }]
-            },
-            outUrlRadio: 0, // 是否使用外部连接,默认不使用
-            form: {
-                title: null,
-                order: null,
-                linkUrl: null,
-                type: query.type,
-                status: 0,
-                content: null,
-                organIdList: [],
-            },
-            rules: {
-                title: [
-                    { required: true, message: "请输入标题", trigger: "blur" },
-                    { min: 2, max: 30, message: "长度在 2 到 30 个字符", trigger: "blur" }
-                ],
-                organIdList: [{ required: true, message: "请选择分部", trigger: "change" }],
-            },
-            imageSize: null,
-        };
-    },
-    mounted () {
-        this.$store.dispatch("setBranchs");
-        this.init();
-    },
-    methods: {
-        init () {
-            this.getList();
-            this.addQuillTitle();
+          },
+        },
+      },
+      dialogForm: {
+        poster: null,
+        url: null,
+        videoUrl: null,
+      },
+      uploadLoading: false,
+      uploadImgLoading: false,
+      fileList: [],
+      dialogFormRules: {
+        url: [{ required: true, message: "请输入视频地址", trigger: "blur" }],
+        videoUrl: [{ required: true, message: "请上传视频", trigger: "blur" }],
+      },
+      outUrlRadio: 0, // 是否使用外部连接,默认不使用
+      form: {
+        title: null,
+        order: null,
+        linkUrl: null,
+        type: query.type,
+        status: 0,
+        content: null,
+        organIdList: [],
+      },
+      rules: {
+        title: [
+          { required: true, message: "请输入标题", trigger: "blur" },
+          {
+            min: 2,
+            max: 30,
+            message: "长度在 2 到 30 个字符",
+            trigger: "blur",
+          },
+        ],
+        organIdList: [
+          { required: true, message: "请选择分部", trigger: "change" },
+        ],
+      },
+      imageSize: null,
+      dataObj: {
+        policy: "",
+        signature: "",
+        key: "",
+        KSSAccessKeyId: "",
+        // dir: "",
+        acl: "public-read",
+        name: "",
+        // bucket_name: props.bucket_name
+      },
+      ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/" + "news-info",
+      bucket_name: "news-info",
+    };
+  },
+  mounted() {
+    this.$store.dispatch("setBranchs");
+    this.init();
+  },
+  methods: {
+    init() {
+      this.getList();
+      this.addQuillTitle();
 
-            // this.form.type
-            let tempTitle = {
-                1: "468px * 552px;图片不能超过 2M;",
-                2: "456px * 288px; 图片不能超过 2M;",
-                3: "686px * 140px; 图片不能超过 2M;",
-                4: "图片不能超过 2M;",
-                5: "图片不能超过 2M;",
-                6: "图片不能超过 2M;",
-                7: "图片不能超过 2M;",
-                8: "1242px * 2208px; 图片不能超过 2M;"
-            };
-            this.imageSize = tempTitle[this.form.type];
+      // this.form.type
+      let tempTitle = {
+        1: "468px * 552px;图片不能超过 2M;",
+        2: "456px * 288px; 图片不能超过 2M;",
+        3: "686px * 140px; 图片不能超过 2M;",
+        4: "图片不能超过 2M;",
+        5: "图片不能超过 2M;",
+        6: "图片不能超过 2M;",
+        7: "图片不能超过 2M;",
+        8: "1242px * 2208px; 图片不能超过 2M;",
+      };
+      this.imageSize = tempTitle[this.form.type];
 
-            this.$refs["form"].clearValidate();
-        },
-        onVideoComfirm (formName) {
-            this.$refs[formName].validate(valid => {
-                if (valid) {
-                    let dialogForm = this.dialogForm;
-                    // 编辑器输入视频
-                    // 获取富文本组件实例
-                    let quill = this.editor;
-                    // 插入图片,res为服务器返回的图片链接地址
-                    const params = {
-                        poster: dialogForm.poster,
-                        url: this.formRadio == 1 ? dialogForm.url : dialogForm.videoUrl,
-                    }
-                    quill.insertEmbed(this.editorIndex, "video", params);
-                    // 调整光标到最后
-                    quill.setSelection(this.editorIndex + 1, { preload: false });
+      this.$refs["form"].clearValidate();
+    },
+    onVideoComfirm(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          let dialogForm = this.dialogForm;
+          // 编辑器输入视频
+          // 获取富文本组件实例
+          let quill = this.editor;
+          // 插入图片,res为服务器返回的图片链接地址
+          const params = {
+            poster: dialogForm.poster,
+            url: this.formRadio == 1 ? dialogForm.url : dialogForm.videoUrl,
+          };
+          quill.insertEmbed(this.editorIndex, "video", params);
+          // 调整光标到最后
+          quill.setSelection(this.editorIndex + 1, { preload: false });
 
-                    this.dialogFormVisible = false;
-                    this.dialogForm = {
-                        poster: null,
-                        url: null,
-                        videoUrl: null
-                    };
-                } else {
-                    return false;
-                }
-            });
-        },
-        onDialogClose (diologForm) {
-            this.dialogForm = {
-                poster: null,
-                url: null,
-                videoUrl: null
+          this.dialogFormVisible = false;
+          this.dialogForm = {
+            poster: null,
+            url: null,
+            videoUrl: null,
+          };
+        } else {
+          return false;
+        }
+      });
+    },
+    onDialogClose(diologForm) {
+      this.dialogForm = {
+        poster: null,
+        url: null,
+        videoUrl: null,
+      };
+      this.$refs[diologForm].resetFields();
+    },
+    addQuillTitle() {
+      const oToolBar = document.querySelector(".ql-toolbar"),
+        aButton = oToolBar.querySelectorAll("button"),
+        aSelect = oToolBar.querySelectorAll("select");
+      aButton.forEach(function (item) {
+        if (item.className === "ql-script") {
+          item.value === "sub" ? (item.title = "下标") : (item.title = "上标");
+        } else if (item.className === "ql-indent") {
+          item.value === "+1"
+            ? (item.title = "向右缩进")
+            : (item.title = "向左缩进");
+        } else {
+          item.title = titleConfig[item.classList[0]];
+        }
+      });
+      aSelect.forEach(function (item) {
+        item.parentNode.title = titleConfig[item.classList[0]];
+      });
+    },
+    onSubmit(formName) {
+      this.$refs[formName].validate(async (valid) => {
+        if (valid) {
+          let { organIdList, linkUrl, content, ...rest } = this.form;
+          if (this.outUrlRadio == 1) {
+            content = null;
+          } else {
+            linkUrl = null;
+          }
+          let form = {
+            ...rest,
+            linkUrl,
+            content,
+            organIdList: organIdList ? organIdList.join(",") : null,
+          };
+          if (this.pageType == "create") {
+            if (form.id) {
+              // 判断有没有Id,如果有则删除
+              delete form.id;
             }
-            this.$refs[diologForm].resetFields()
-        },
-        addQuillTitle () {
-            const oToolBar = document.querySelector(".ql-toolbar"),
-                aButton = oToolBar.querySelectorAll("button"),
-                aSelect = oToolBar.querySelectorAll("select");
-            aButton.forEach(function (item) {
-                if (item.className === "ql-script") {
-                    item.value === "sub" ? (item.title = "下标") : (item.title = "上标");
-                } else if (item.className === "ql-indent") {
-                    item.value === "+1"
-                        ? (item.title = "向右缩进")
-                        : (item.title = "向左缩进");
-                } else {
-                    item.title = titleConfig[item.classList[0]];
-                }
+            // return false
+            await newsAdd(form).then((res) => {
+              this.messageTips("添加", res);
             });
-            aSelect.forEach(function (item) {
-                item.parentNode.title = titleConfig[item.classList[0]];
+          } else if (this.pageType == "update") {
+            await newsUpdate(form).then((res) => {
+              this.messageTips("修改", res);
             });
-        },
-        onSubmit (formName) {
-            this.$refs[formName].validate(async (valid) => {
-                if (valid) {
-                    let { organIdList, linkUrl, content, ...rest } = this.form
-                    if(this.outUrlRadio == 1) {
-                        content = null
-                    } else {
-                        linkUrl = null
-                    }
-                    let form = {
-                        ...rest,
-                        linkUrl,
-                        content,
-                        organIdList: organIdList ? organIdList.join(',') : null
-                    }
-                    if (this.pageType == "create") {
-                        if (form.id) {
-                            // 判断有没有Id,如果有则删除
-                            delete form.id;
-                        }
-                        // return false
-                        await newsAdd(form).then(res => {
-                            this.messageTips("添加", res);
-                        });
-                    } else if (this.pageType == "update") {
-                        await newsUpdate(form).then(res => {
-                            this.messageTips("修改", res);
-                        });
-                    }
-                } else {
-                    this.$nextTick(() => {
-                        let isError = document.getElementsByClassName('is-error')
-                        isError[0].scrollIntoView({
-                        block: 'center',
-                        behavior: 'smooth',
-                        })
-                    })
-                    return false;
-                }
+          }
+        } else {
+          this.$nextTick(() => {
+            let isError = document.getElementsByClassName("is-error");
+            isError[0].scrollIntoView({
+              block: "center",
+              behavior: "smooth",
             });
-        },
-        messageTips (title, res) {
-            if (res.code == 200) {
-                this.$message.success(title + "成功");
-                this.$listeners.submited()
-                this.$listeners.close()
-            } else {
-                this.$message.error(res.msg);
-            }
-        },
-        handleSuccess (res) {
-            // 获取富文本组件实例
-            let quill = this.editor;
-            // 如果上传成功
-            if (res.code) {
-                // 获取光标所在位置
-                let length = quill.getSelection().index;
-                // 插入图片,res为服务器返回的图片链接地址
-                quill.insertEmbed(length, "image", res.data.url);
-                // 调整光标到最后
-                quill.setSelection(length + 1);
+          });
+          return false;
+        }
+      });
+    },
+    messageTips(title, res) {
+      if (res.code == 200) {
+        this.$message.success(title + "成功");
+        this.$listeners.submited();
+        this.$listeners.close();
+      } else {
+        this.$message.error(res.msg);
+      }
+    },
+    handleSuccess(res) {
+      // 获取富文本组件实例
+      let quill = this.editor;
+      // 如果上传成功
+      let url = this.ossUploadUrl + "/" + this.dataObj.key;
+      if (url) {
+        // 获取光标所在位置
+        let length = quill.getSelection().index;
+
+        // 插入图片,res为服务器返回的图片链接地址
+        quill.insertEmbed(length, "image", url);
+        // 调整光标到最后
+        quill.setSelection(length + 1);
+      } else {
+        // 提示信息,需引入Message
+        this.$message.error("图片插入失败");
+      }
+    },
+    onReSet(formName) {
+      this.form = {
+        title: null,
+        order: null,
+        linkUrl: null,
+        type: this.type,
+        status: 1,
+        content: null,
+        organIdList: [],
+      };
+      this.$refs[formName].resetFields();
+    },
+    onLook() {
+      // 预览
+      let dataInfo = this.dataInfo;
+      dataInfo.title = this.form.title;
+      dataInfo.content = this.form.content;
+      // 处理图片显示问题
+      setTimeout(() => {
+        let imgNode = document.querySelectorAll(".msgWrap img");
+        if (imgNode.length > 0) {
+          imgNode.forEach((item) => {
+            item.style.width = "100%";
+          });
+        }
+
+        let videoNode = document.querySelectorAll(".msgWrap .ql-video");
+        if (videoNode.length > 0) {
+          videoNode.forEach((item) => {
+            item.style.width = "100%";
+            item.style.height = "195px";
+          });
+        }
+      }, 500);
+      this.lookVisible = true;
+    },
+    async getList() {
+      if (this.pageType == "create") {
+        return;
+      } else {
+        await newsQueryId({ id: this.options.id }).then((res) => {
+          if (res.code == 200) {
+            let result = res.data;
+            let organ = result.organIdList ? result.organIdList.split(",") : [];
+            // 是否使用外部链接
+            if (result.linkUrl) {
+              this.outUrlRadio = 1;
             } else {
-                // 提示信息,需引入Message
-                this.$message.error("图片插入失败");
+              this.outUrlRadio = 0;
             }
-        },
-        onReSet (formName) {
             this.form = {
-                title: null,
-                order: null,
-                linkUrl: null,
-                type: this.type,
-                status: 1,
-                content: null,
-                organIdList: []
+              id: result.id,
+              title: result.title,
+              order: result.order,
+              linkUrl: result.linkUrl,
+              type: result.type,
+              status: result.status,
+              organIdList: organ.map((item) => {
+                return +item;
+              }),
+              content: result.content,
             };
-            this.$refs[formName].resetFields();
-        },
-        onLook () {
-            // 预览
-            let dataInfo = this.dataInfo
-            dataInfo.title = this.form.title
-            dataInfo.content = this.form.content
-            // 处理图片显示问题
-            setTimeout(() => {
-                let imgNode = document.querySelectorAll(".msgWrap img");
-                if (imgNode.length > 0) {
-                    imgNode.forEach(item => {
-                        item.style.width = "100%";
-                    });
-                }
+            this.dataInfo.updateTime = result.updateTime;
+          }
+        });
+      }
+    },
+    handleUploadImgError(file) {
+      this.uploadImgLoading = false;
+      this.$message.error("上传失败");
+    },
+    handleImgSuccess(res, file) {
+      this.uploadImgLoading = false;
+      let url = this.ossUploadUrl + "/" + this.dataObj.key;
+      if (url) {
+        this.dialogForm.poster = url;
+      } else {
+        this.$message.error("上传失败");
+      }
+    },
+    async beforeImgUpload(file) {
+      const imageType = {
+        "image/png": true,
+        "image/jpeg": true,
+      };
+      const isImage = imageType[file.type];
+      const isLt2M = file.size / 1024 / 1024 < 2;
+      isImage, isLt2M;
+      if (!isImage) {
+        this.$message.error("只能上传图片格式!");
+      }
+      if (!isLt2M) {
+        this.$message.error("上传图片大小不能超过 2MB!");
+      }
+      if (isImage && isLt2M) {
+        this.uploadImgLoading = true;
+      }
 
-                let videoNode = document.querySelectorAll(".msgWrap .ql-video");
-                if (videoNode.length > 0) {
-                    videoNode.forEach(item => {
-                        item.style.width = "100%";
-                        item.style.height = "195px";
-                    });
-                }
-            }, 500);
-            this.lookVisible = true
-        },
-        async getList () {
-            if (this.pageType == "create") {
-                return;
-            } else {
-                await newsQueryId({ id: this.options.id }).then(res => {
-                    if (res.code == 200) {
-                        let result = res.data;
-                        let organ = result.organIdList ? result.organIdList.split(',') : []
-                        // 是否使用外部链接
-                        if(result.linkUrl) {
-                            this.outUrlRadio = 1
-                        } else {
-                            this.outUrlRadio = 0
-                        }
-                        this.form = {
-                            id: result.id,
-                            title: result.title,
-                            order: result.order,
-                            linkUrl: result.linkUrl,
-                            type: result.type,
-                            status: result.status,
-                            organIdList: organ.map(item => { return +item }),
-                            content: result.content
-                        };
-                        this.dataInfo.updateTime = result.updateTime
-                    }
-                });
-            }
-        },
-        handleUploadImgError (file) {
-            this.uploadImgLoading = false
-            this.$message.error('上传失败')
-        },
-        handleImgSuccess (res, file) {
-            this.uploadImgLoading = false
-            if (res.code == 200) {
-                this.dialogForm.poster = res.data.url
-            } else {
-                this.$message.error('上传失败')
-            }
-        },
-        beforeImgUpload (file) {
-            const imageType = {
-                "image/png": true,
-                "image/jpeg": true,
-                "image/gif": true
-            };
-            const isImage = imageType[file.type];
-            const isLt2M = file.size / 1024 / 1024 < 2;
-            if (!isImage) {
-                this.$message.error("只能上传图片格式!");
-            }
-            if (!isLt2M) {
-                this.$message.error("上传图片大小不能超过 2MB!");
-            }
-            if (isImage && isLt2M) {
-                this.uploadImgLoading = true
-            }
-            return isImage && isLt2M;
-        },
-        typeCheck (type) {
-            let params = {
-                1: '精彩活动',
-                2: '热门资讯',
-                4: '专项训练',
-                7: '知识库',
-                19: '系统通知',
-            }
-            return params[type] ? params[type] : '管乐迷'
-        },
-        typeIndex (type) {
-            let tempTitle = {
-                1: 0,
-                2: 1,
-                3: 4,
-                4: 2,
-                5: 3,
-                6: 5,
-                7: 6,
-                8: 7,
-                19: 8
-            };
-            return tempTitle[type];
-        },
-        onEditorChange ({ quill, html, text }) {
-            this.form.content = html;
-        },
-        beforeUpload (file) {
-            // const isJPG = file.type === 'image/jpeg';
-            const isLt2M = file.size / 1024 / 1024 < 100;
+      try {
+        let fileName = file.name.replaceAll(" ", "_");
+        let key = new Date().getTime() + fileName;
+        let obj = {
+          filename: fileName,
+          bucketName: this.bucket_name,
+          postData: {
+            filename: fileName,
+            acl: "public-read",
+            key: key,
+            unknowValueField: [],
+          },
+        };
 
-            //   if (!isJPG) {
-            //     this.$message.error('上传头像图片只能是 JPG 格式!');
-            //   }
-            if (!isLt2M) {
-                this.$message.error('上传视频大小不能超过 100MB!');
-            }
-            this.uploadLoading = true
-            return isLt2M;
-        },
-        handleUploadError (file) {
-            this.uploadLoading = false
-            this.$message.error('上传视频失败')
-        },
-        handleUploadSuccess (file, fileList) {
-            this.uploadLoading = false
-            if (file.code == 200) {
-                this.$message.success('上传视频成功')
-                this.dialogForm.videoUrl = file.data.url;
-            } else {
-                this.$message.error('上传视频失败')
-            }
-        },
-        handleExceed (files, fileList) {
-            this.$message.error('您已上传过视频')
-        }
+        const res = await policy(obj);
+        this.dataObj = {
+          policy: res.data.policy,
+          signature: res.data.signature,
+          key: key,
+          KSSAccessKeyId: res.data.kssAccessKeyId,
+          // dir: "",
+          acl: "public-read",
+          name: fileName,
+          // bucket_name: props.bucket_name
+        };
+      } catch (e) {
+        console.log(e);
+        return false;
+      }
+      return isImage && isLt2M;
     },
-    computed: {
-        editor () {
-            return this.$refs.myQuillEditor.quill;
-        }
-    }
+    typeCheck(type) {
+      let params = {
+        1: "精彩活动",
+        2: "热门资讯",
+        4: "专项训练",
+        7: "知识库",
+        19: "系统通知",
+      };
+      return params[type] ? params[type] : "管乐迷";
+    },
+    typeIndex(type) {
+      let tempTitle = {
+        1: 0,
+        2: 1,
+        3: 4,
+        4: 2,
+        5: 3,
+        6: 5,
+        7: 6,
+        8: 7,
+        19: 8,
+      };
+      return tempTitle[type];
+    },
+    onEditorChange({ quill, html, text }) {
+      this.form.content = html;
+    },
+    async beforeUpload(file) {
+      // const isJPG = file.type === 'image/jpeg';
+      const isLt2M = file.size / 1024 / 1024 < 100;
+
+      //   if (!isJPG) {
+      //     this.$message.error('上传头像图片只能是 JPG 格式!');
+      //   }
+      if (!isLt2M) {
+        this.$message.error("上传视频大小不能超过 100MB!");
+      }
+      this.uploadLoading = true;
+      try {
+        let fileName = file.name.replaceAll(" ", "_");
+        let key = new Date().getTime() + fileName;
+        let obj = {
+          filename: fileName,
+          bucketName: this.bucket_name,
+          postData: {
+            filename: fileName,
+            acl: "public-read",
+            key: key,
+            unknowValueField: [],
+          },
+        };
+
+        const res = await policy(obj);
+        this.dataObj = {
+          policy: res.data.policy,
+          signature: res.data.signature,
+          key: key,
+          KSSAccessKeyId: res.data.kssAccessKeyId,
+          // dir: "",
+          acl: "public-read",
+          name: fileName,
+          // bucket_name: props.bucket_name
+        };
+      } catch (e) {
+        console.log(e);
+        return false;
+      }
+      return isLt2M;
+    },
+    handleUploadError(file) {
+      this.uploadLoading = false;
+      this.$message.error("上传视频失败");
+    },
+    handleUploadSuccess(file, fileList) {
+      this.uploadLoading = false;
+      let url = this.ossUploadUrl + "/" + this.dataObj.key;
+      if (url) {
+        this.$message.success("上传视频成功");
+        this.dialogForm.videoUrl = url;
+      } else {
+        this.$message.error("上传视频失败");
+      }
+    },
+    handleExceed(files, fileList) {
+      this.$message.error("您已上传过视频");
+    },
+  },
+  computed: {
+    editor() {
+      return this.$refs.myQuillEditor.quill;
+    },
+  },
 };
 </script>
 <style lang="scss" scoped>

+ 1 - 0
src/views/liveShopManger/models/eidtLiveShop.vue

@@ -98,6 +98,7 @@
                 :imgSize="2"
                 :imageUrl="formes.image"
                 @crop-upload-success="cropSuccess"
+                bucket_name='mall'
               />
             </el-form-item>
           </el-col>

+ 51 - 53
src/views/recodeManager/modals/appeal.vue

@@ -1,12 +1,9 @@
 <template>
   <div>
     <el-form :model="form" ref="form" label-width="80px">
-      <el-form-item
-        label="申诉图片"
-        prop="url"
-      >
-        <div style="width: 100%;">
-          <el-upload
+      <el-form-item label="申诉图片" prop="url">
+        <div style="width: 100%">
+          <!-- <el-upload
             action="/api-web/uploadFile"
             class="avatar-uploader"
             :headers="headers"
@@ -16,13 +13,14 @@
           >
             <img v-if="form.url" :src="form.url" class="avatar">
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
-          </el-upload>
+          </el-upload> -->
+          <upload class="uploadImg" v-model="form.url" ref="uploadImg"></upload>
         </div>
       </el-form-item>
       <el-form-item
         label="申诉内容"
         prop="content"
-        :rules="[{required: true, message: '请输入申诉内容'}]"
+        :rules="[{ required: true, message: '请输入申诉内容' }]"
       >
         <el-input
           type="textarea"
@@ -31,75 +29,75 @@
         />
       </el-form-item>
     </el-form>
-    <div slot="footer" style="text-align: right;margin-top: 20px;">
+    <div slot="footer" style="text-align: right; margin-top: 20px">
       <el-button @click="$emit('close')">取消</el-button>
       <el-button type="primary" @click="submit">确认</el-button>
     </div>
   </div>
 </template>
 <script>
-import { addComplaints } from '../api'
-import {
-  getToken
-} from '@/utils/auth'
+import { addComplaints } from "../api";
+import Upload from "@/components/Upload/index";
+import { getToken } from "@/utils/auth";
 export default {
-  props: ['detail'],
+  props: ["detail"],
+  components: { Upload },
   data() {
-    return{
+    return {
       headers: {
-        Authorization: getToken()
+        Authorization: getToken(),
       },
       form: {
-        content: '',
-        url: '',
-      }
-    }
+        content: "",
+        url: "",
+      },
+    };
   },
   methods: {
     handleSuccess(res) {
-      this.$set(this.form, 'url', res.data.url)
+      this.$set(this.form, "url", res.data.url);
     },
     submit() {
-      this.$refs.form.validate(async valid => {
+      this.$refs.form.validate(async (valid) => {
         if (valid) {
           try {
             await addComplaints({
               ...this.form,
               courseScheduleId: this.detail.courseScheduleId,
               userId: this.detail.teacherId,
-            })
-            this.$message.success('提交成功')
-            this.$emit('submited')
-            this.$emit('close')
+            });
+            this.$message.success("提交成功");
+            this.$emit("submited");
+            this.$emit("close");
           } catch (error) {}
         }
-      })
-    }
-  }
-}
+      });
+    },
+  },
+};
 </script>
 <style>
-  .avatar-uploader .el-upload {
-    border: 1px dashed #d9d9d9;
-    border-radius: 6px;
-    cursor: pointer;
-    position: relative;
-    overflow: hidden;
-  }
-  .avatar-uploader .el-upload:hover {
-    border-color: #409EFF;
-  }
-  .avatar-uploader-icon {
-    font-size: 28px;
-    color: #8c939d;
-    width: 78px;
-    height: 78px;
-    line-height: 78px;
-    text-align: center;
-  }
-  .avatar {
-    width: 78px;
-    height: 78px;
-    display: block;
-  }
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409eff;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 78px;
+  height: 78px;
+  line-height: 78px;
+  text-align: center;
+}
+.avatar {
+  width: 78px;
+  height: 78px;
+  display: block;
+}
 </style>

+ 110 - 67
src/views/resetTeaming/components/training-photos/upload/index.vue

@@ -5,11 +5,8 @@
     label-width="80px"
     @submit.stop.native="submit"
   >
-    <el-form-item
-      v-if="name"
-      label="相册"
-    >
-      {{name}}
+    <el-form-item v-if="name" label="相册">
+      {{ name }}
     </el-form-item>
     <!-- <el-form-item
       v-else
@@ -21,101 +18,147 @@
         <el-option v-for="item in photos" :key="item.id" :label="item.name" :value="item.id"></el-option>
       </el-select>
     </el-form-item> -->
-    <el-form-item
-      :label="name ? '上传相册' : '上传证书'"
-    >
+    <el-form-item :label="name ? '上传相册' : '上传证书'">
       <el-upload
-        action="/api-web/uploadFile"
+        :action="ossUploadUrl"
+        :data="dataObj"
         :on-preview="handlePictureCardPreview"
         :show-file-list="false"
         multiple
         accept=".png, .jpg, .jpeg, .gif"
         :before-upload="beforeUpload"
         :on-success="successed"
-        :on-remove="handleRemove">
+        :on-remove="handleRemove"
+      >
         <el-button :loading="uploading" type="primary">上传图片</el-button>
       </el-upload>
       <div class="img-container">
         <div class="list" v-if="uploaded.length > 0">
-          <div
-            v-for="(item, index) in uploaded"
-            :key="item.url"
-            class="item"
-          >
+          <div v-for="(item, index) in uploaded" :key="item.url" class="item">
             <div class="ctrl-bar">
               <i class="el-icon-circle-close" @click="remove(index)"></i>
             </div>
             <el-image
               :src="item.url"
-              :preview-src-list="uploaded.map(item => item.url)"
-              class="img">
+              :preview-src-list="uploaded.map((item) => item.url)"
+              class="img"
+            >
             </el-image>
-            <el-input v-model="item.name" placeholder="请输入图片名称" clearable />
+            <el-input
+              v-model="item.name"
+              placeholder="请输入图片名称"
+              clearable
+            />
           </div>
         </div>
-        <empty v-else/>
+        <empty v-else />
       </div>
     </el-form-item>
     <div class="dialog-footer">
       <el-button @click="$emit('close')">取 消</el-button>
-      <el-button
-        type="primary"
-        native-type="submit"
-        :disabled="uploading"
-      >确 定</el-button>
+      <el-button type="primary" native-type="submit" :disabled="uploading"
+        >确 定</el-button
+      >
     </div>
     <el-dialog :visible.sync="dialogVisible">
-      <img width="100%" :src="dialogImageUrl" alt="">
+      <img width="100%" :src="dialogImageUrl" alt="" />
     </el-dialog>
   </el-form>
 </template>
 <script>
-import { photoAdd, photoAlbumQueryPage } from '../api'
+import { photoAdd, photoAlbumQueryPage } from "../api";
+import { policy } from "@/api/appTenant";
 export default {
   props: {
     name: String,
     query: {
       type: Object,
-      default: () => ({})
+      default: () => ({}),
+    },
+    bucket_name: {
+      type: String,
+      default: "daya",
     },
   },
   data() {
     return {
       fileList: [],
-      dialogImageUrl: '',
+      dialogImageUrl: "",
       dialogVisible: false,
       uploading: false,
       form: {
-        photoAlbumId: ''
+        photoAlbumId: "",
       },
       uploaded: [],
-      photos: []
-    }
+      photos: [],
+      ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/" + this.bucket_name,
+      dataObj: {
+        policy: "",
+        signature: "",
+        key: "",
+        KSSAccessKeyId: "",
+        // dir: "",
+        acl: "public-read",
+        name: "",
+        // bucket_name: props.bucket_name
+      },
+    };
   },
   mounted() {
-    console.log({...this})
+    console.log({ ...this });
     // this.FetchList()
   },
   methods: {
     handleChange(file, fileList) {
       this.fileList = fileList.slice(-3);
     },
-    beforeUpload() {
-      this.uploading = true
-      return true
+   async beforeUpload(file) {
+      this.uploading = true;
+      try {
+        let fileName = file.name.replaceAll(" ", "_");
+
+        let key =new Date().getTime() + fileName;
+        file.key = key;
+        let obj = {
+          filename: fileName,
+          bucketName: this.bucket_name,
+          postData: {
+            filename: fileName,
+            acl: "public-read",
+            key: key,
+            unknowValueField: [],
+          },
+        };
+
+        const res = await policy(obj);
+        this.dataObj = {
+          policy: res.data.policy,
+          signature: res.data.signature,
+          key: key,
+          KSSAccessKeyId: res.data.kssAccessKeyId,
+          // dir: "",
+          acl: "public-read",
+          name: fileName,
+          // bucket_name: props.bucket_name
+        };
+      } catch (e) {
+        console.log(e);
+      }
+      return true;
     },
     successed(response, file, fileList) {
-      this.uploading = false
-      if (response.code === 200) {
+      this.uploading = false;
+      let url = this.ossUploadUrl + "/" + file.raw.key;
+      if (url) {
         this.uploaded.push({
-          url: response.data.url,
-          name: file.name.split('.').shift(),
-          clientShow: 'YES',
-        })
+          url,
+          name: file.name.split(".").shift(),
+          clientShow: "YES",
+        });
       } else {
-        this.$message.error(res.data?.message || res.msg || '上传失败')
+        this.$message.error(res.data?.message || res.msg || "上传失败");
       }
-      console.log(response, file, fileList)
+      console.log(response, file, fileList);
     },
     handleRemove(file, fileList) {
       console.log(file, fileList);
@@ -128,57 +171,57 @@ export default {
       try {
         const res = await photoAlbumQueryPage({
           ...this.query,
-          rows: 9999
-        })
-        this.photos = res.data.rows
+          rows: 9999,
+        });
+        this.photos = res.data.rows;
       } catch (error) {}
     },
     async submit(evt) {
-      evt.stopPropagation()
-      evt.stopImmediatePropagation()
-      evt.preventDefault()
+      evt.stopPropagation();
+      evt.stopImmediatePropagation();
+      evt.preventDefault();
       try {
         this.$refs.form.validate(async (valid) => {
           if (valid) {
-            const phoths = this.uploaded.map(item => ({
+            const phoths = this.uploaded.map((item) => ({
               ...item,
               ...this.query,
               // photoAlbumId: this.form.photoAlbumId || this.$route.params.id,
-            }))
-            await photoAdd(phoths)
-            this.$message.success('添加成功')
-            this.$emit('close')
-            this.$emit('submited')
+            }));
+            await photoAdd(phoths);
+            this.$message.success("添加成功");
+            this.$emit("close");
+            this.$emit("submited");
           }
-        })
+        });
       } catch (error) {}
     },
     remove(index) {
-      this.uploaded.splice(index, 1)
-    }
-  }
-}
+      this.uploaded.splice(index, 1);
+    },
+  },
+};
 </script>
 <style lang="less" scoped>
-.dialog-footer{
+.dialog-footer {
   text-align: right;
 }
-.img-container{
+.img-container {
   margin: 10px auto;
 }
-.item{
+.item {
   width: 150px;
   margin-top: 10px;
   margin-right: 10px;
   display: inline-block;
   position: relative;
 }
-.img{
+.img {
   width: 150px;
   height: 150px;
 }
-.ctrl-bar{
-  background-color: rgba(0, 0, 0, .45);
+.ctrl-bar {
+  background-color: rgba(0, 0, 0, 0.45);
   height: 30px;
   position: absolute;
   top: 0;
@@ -188,7 +231,7 @@ export default {
   justify-content: flex-end;
   align-items: center;
   padding: 0 15px;
-  i{
+  i {
     color: #fff;
     cursor: pointer;
   }

+ 1 - 1
src/views/teachManager/modals/addRoot.vue

@@ -57,7 +57,7 @@
           :imageHeightM="imageHeightM"
           ref="uploadImg"
         ></upload> -->
-        <image-cropper :options="cropperOptions" :imgSize="2" :imageUrl="form.coverImg" showSize @crop-upload-success="cropSuccess" />
+        <image-cropper :options="cropperOptions" bucket_name='cloud-coach' :imgSize="2" :imageUrl="form.coverImg" showSize @crop-upload-success="cropSuccess" />
         <p style="color: red">
           大小2M以内,格式为jpg、png、gif图片
         </p>

+ 1 - 0
src/views/tenantSetting/model/addProtocol.vue

@@ -52,6 +52,7 @@
           accept=".docx, .pdf"
           @inputFile="readFileInputEventAsArrayBuffer"
           v-model="form.origanalFileUrl"
+            bucket_name="contracts"
         />
       </el-form-item>
     </el-form>