|
@@ -1,11 +1,33 @@
|
|
|
<template>
|
|
|
<div class="upload">
|
|
|
- <el-upload v-if="isBtn()" :platformId="platformId" :action="action" :headers="headers" :multiple="multiple"
|
|
|
- :data="data" :name="name" :show-file-list="showFileList" :drag="drag" :accept="accept" :listType="listType"
|
|
|
- :autoUpload="autoUpload" :disabled="disabled" :before-upload="beforeUpload" :on-progress="onProgress"
|
|
|
- :on-success="onSuccess" :on-error="onError" :width="width" :height="height">
|
|
|
+ <el-upload
|
|
|
+ v-if="isBtn()"
|
|
|
+ :platformId="platformId"
|
|
|
+ :action="action"
|
|
|
+ :headers="headers"
|
|
|
+ :multiple="multiple"
|
|
|
+ :data="data"
|
|
|
+ :name="name"
|
|
|
+ :show-file-list="showFileList"
|
|
|
+ :drag="drag"
|
|
|
+ :accept="accept"
|
|
|
+ :listType="listType"
|
|
|
+ :autoUpload="autoUpload"
|
|
|
+ :disabled="disabled"
|
|
|
+ :before-upload="beforeUpload"
|
|
|
+ :on-progress="onProgress"
|
|
|
+ :on-success="onSuccess"
|
|
|
+ :on-error="onError"
|
|
|
+ :width="width"
|
|
|
+ :height="height"
|
|
|
+ >
|
|
|
<!-- <el-button v-if="listType !== 'picture-card'" :type="type" ref="upload"> -->
|
|
|
- <el-button v-if="listType !== 'picture-card'" type="primary" size="mini" ref="upload">
|
|
|
+ <el-button
|
|
|
+ v-if="listType !== 'picture-card'"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ ref="upload"
|
|
|
+ >
|
|
|
<slot v-if="percentage <= 0 && !form.file">点击上传</slot>
|
|
|
<span v-if="percentage > 0 && !form.file">{{ title }}</span>
|
|
|
<span v-if="form.file">上传成功</span>
|
|
@@ -14,8 +36,14 @@
|
|
|
<i class="el-icon-plus" />
|
|
|
</div>
|
|
|
</el-upload>
|
|
|
- <el-progress v-if="isPercentage()" type="circle" :percentage="percentage" :status="status"
|
|
|
- @click.native="handleUpload" :width="146" />
|
|
|
+ <el-progress
|
|
|
+ v-if="isPercentage()"
|
|
|
+ type="circle"
|
|
|
+ :percentage="percentage"
|
|
|
+ :status="status"
|
|
|
+ @click.native="handleUpload"
|
|
|
+ :width="146"
|
|
|
+ />
|
|
|
<div class="img" v-if="isImg()">
|
|
|
<i class="el-icon-delete" v-if="!disabled" @click="onDelete" />
|
|
|
<el-image :src="form.file" />
|
|
@@ -50,6 +78,10 @@ export default {
|
|
|
type: String,
|
|
|
default: "text",
|
|
|
},
|
|
|
+ listTypes: {
|
|
|
+ type: String,
|
|
|
+ default: "text",
|
|
|
+ },
|
|
|
platformId: {
|
|
|
type: Number,
|
|
|
default: null,
|
|
@@ -98,6 +130,7 @@ export default {
|
|
|
obj: {
|
|
|
text: `${baseUrl}/system/file/file/upload`, // 文件上传
|
|
|
"picture-card": `${baseUrl}/system/file/picture/upload`, // 图片上传
|
|
|
+ "picture-rgb": `${baseUrl}/system/file/getRGBUrl`, // 图片上传
|
|
|
audio: `${baseUrl}/system/file/mp3/upload`, // 音频上传
|
|
|
zip: `${baseUrl}/system/file/file/uploadFolderZip`, // 压缩包上传
|
|
|
mp3: `${baseUrl}/admin/program/batch/upload`, // 歌曲批量上传
|
|
@@ -142,7 +175,13 @@ export default {
|
|
|
|
|
|
created() {
|
|
|
// 根据上传类型 变更 上传地址
|
|
|
- this.action = this.obj[this.listType];
|
|
|
+ console.log("gadfqwerqewrqr===00==" + this.listType);
|
|
|
+ if (this.listTypes == "picture-rgb") {
|
|
|
+ this.action = this.obj[this.listTypes];
|
|
|
+ } else {
|
|
|
+ this.action = this.obj[this.listType];
|
|
|
+ }
|
|
|
+ console.log("gadfqwerqewrqr===11==" + this.action);
|
|
|
// 回显图片
|
|
|
this.form.file = this.url;
|
|
|
},
|
|
@@ -158,8 +197,10 @@ export default {
|
|
|
// var w = Number(this.width);
|
|
|
// var h = Number(this.height);
|
|
|
// 检查并转换 width 和 height 为数字
|
|
|
- const w = typeof this.width === 'String' ? Number(this.width) : this.width;
|
|
|
- const h = typeof this.height === 'String' ? Number(this.height) : this.height;
|
|
|
+ const w =
|
|
|
+ typeof this.width === "String" ? Number(this.width) : this.width;
|
|
|
+ const h =
|
|
|
+ typeof this.height === "String" ? Number(this.height) : this.height;
|
|
|
// console.log("传入的:", w, h, "666", typeof this.height === 'string')
|
|
|
const data = await this.readerImg(file);
|
|
|
let _width =
|