dev_review
yujialong 1 year ago
parent 152b3e969f
commit f1c6f571f8
  1. 10
      src/components/upload/index.vue
  2. 2
      src/views/match/add/step1.vue
  3. 41
      src/views/parnerOperation/learnMg.vue
  4. 37
      src/views/shop/addProduct/index.vue

@ -52,6 +52,11 @@ export default {
type: Array, type: Array,
default: () => [] default: () => []
}, },
// fileList使fileListfalse
changeFileList: {
type: Boolean,
default: true
},
// //
onRemove: { onRemove: {
type: Function, type: Function,
@ -70,6 +75,7 @@ export default {
this.initOss() this.initOss()
}, },
methods: { methods: {
// oss
initOss () { initOss () {
this.client = new OSS({ this.client = new OSS({
region: 'oss-cn-shenzhen', region: 'oss-cn-shenzhen',
@ -99,14 +105,14 @@ export default {
this.uploadProgress = 0 this.uploadProgress = 0
this.uploading = true this.uploading = true
this.showFiles = false this.showFiles = false
// ossurl // oss
const { name } = await this.client.multipartUpload(file.name, file, { const { name } = await this.client.multipartUpload(file.name, file, {
progress: this.handleProgress progress: this.handleProgress
}); });
this.uploading = false this.uploading = false
const url = 'http://huoran.oss-cn-shenzhen.aliyuncs.com/' + name const url = 'http://huoran.oss-cn-shenzhen.aliyuncs.com/' + name
this.$emit('update:fileList', [ this.changeFileList && this.$emit('update:fileList', [
...this.fileList, ...this.fileList,
{ {
name: name, name: name,

@ -223,7 +223,7 @@
<Upload :limit="5" <Upload :limit="5"
:file-list.sync="fileList" :file-list.sync="fileList"
:on-remove="handleAnnexRemove" :on-remove="handleAnnexRemove"
@onSuccess="uploadAnnexSuccess"></Upload> @onSuccess="uploadAnnexSuccess" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>

@ -147,14 +147,11 @@
</el-form-item> </el-form-item>
<el-form-item prop="file" <el-form-item prop="file"
label="文件上传"> label="文件上传">
<el-upload :before-upload="fileBeforeUpload" <Upload :limit="20"
:changeFileList="false"
:file-list.sync="form.fileList"
:on-remove="handleRemove" :on-remove="handleRemove"
:on-success="uploadSuccessFile" @onSuccess="uploadSuccessFile" />
:action="this.api.fileUploadNakadai"
:file-list="form.fileList"
:headers="headers">
<el-button>上传</el-button>
</el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="btns"> <div class="btns">
@ -294,10 +291,11 @@ import Setting from '@/setting'
import Util from '@/libs/util' import Util from '@/libs/util'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import Editor from '@tinymce/tinymce-vue' import Editor from '@tinymce/tinymce-vue'
// import t from "tinymce-plugin/plugins/tpImportword/plugin.js";
import editorConfig from '@/utils/editor' import editorConfig from '@/utils/editor'
import Cropper from '@/components/img-upload/Cropper' import Cropper from '@/components/img-upload/Cropper'
import Axios from 'axios' import Axios from 'axios'
import Upload from '@/components/upload';
export default { export default {
data () { data () {
return { return {
@ -357,7 +355,8 @@ export default {
}, },
components: { components: {
Editor, Editor,
Cropper Cropper,
Upload
}, },
watch: { watch: {
// , // ,
@ -641,29 +640,29 @@ export default {
this.uploading++ this.uploading++
}, },
// //
uploadSuccessFile (res) { uploadSuccessFile (file) {
const { originalFileName, fileUrl } = res.filesResult const { name, url } = file
this.uploading-- this.uploading--
this.form.id ? this.form.id ?
this.$post(this.api.saveParnerFile, { this.$post(this.api.saveParnerFile, {
contentId: this.form.id, contentId: this.form.id,
id: '', id: '',
fileName: originalFileName, fileName: name,
filePath: fileUrl filePath: url
}).then(({ data }) => { }).then(({ data }) => {
this.form.fileList.push({ this.form.fileList.push({
fileName: originalFileName, fileName: name,
filePath: fileUrl, filePath: url,
name: originalFileName, name: name,
url: fileUrl, url,
id: data id: data
}) })
}).catch(res => { }) : }).catch(res => { }) :
this.form.fileList.push({ this.form.fileList.push({
fileName: originalFileName, fileName: name,
filePath: fileUrl, filePath: url,
name: originalFileName, name: name,
url: fileUrl url
}) })
}, },
// //

@ -529,14 +529,11 @@
</el-form-item> </el-form-item>
<el-form-item prop="file" <el-form-item prop="file"
label="产品参数"> label="产品参数">
<el-upload :before-remove="beforeRemove" <Upload :limit="20"
:changeFileList="false"
:file-list.sync="form.mallAnnex"
:on-remove="handleFileRemove" :on-remove="handleFileRemove"
:on-success="uploadSuccessFile" @onSuccess="uploadSuccessFile" />
:action="api.fileUploadNakadai"
:file-list="form.mallAnnex"
:headers="headers">
<el-button>上传文件</el-button>
</el-upload>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -748,6 +745,7 @@ import quill from "@/components/quill";
import Editor from '@tinymce/tinymce-vue' import Editor from '@tinymce/tinymce-vue'
import editorConfig from '@/utils/editor' import editorConfig from '@/utils/editor'
import Cropper from '@/components/img-upload/Cropper' import Cropper from '@/components/img-upload/Cropper'
import Upload from '@/components/upload';
import Axios from 'axios' import Axios from 'axios'
export default { export default {
data () { data () {
@ -914,7 +912,8 @@ export default {
}, },
components: { components: {
Editor, Editor,
Cropper Cropper,
Upload
}, },
methods: { methods: {
getData () { getData () {
@ -1503,13 +1502,12 @@ export default {
uploadSuccessInterface (res) { // uploadSuccessInterface (res) { //
this.form.mall.interfaceDiagrams.push(res.data.filesResult.fileUrl) this.form.mall.interfaceDiagrams.push(res.data.filesResult.fileUrl)
}, },
uploadSuccessFile (res) { // uploadSuccessFile (file) { //
const e = res.filesResult
this.form.mallAnnex.push({ this.form.mallAnnex.push({
mallId: this.id, mallId: this.id,
filePath: e.fileUrl, filePath: file.url,
fileName: e.originalFileName, fileName: file.name,
name: e.originalFileName, name: file.name
}) })
}, },
beforeRemove (file, fileList) { beforeRemove (file, fileList) {
@ -1662,19 +1660,6 @@ $avatar-width: 104px;
} }
} }
} }
/deep/.el-upload__tip {
margin-top: 0;
p {
font-size: 14px;
color: rgba(0, 0, 0, 0.45);
line-height: 1;
&:first-child {
margin-bottom: 5px;
}
}
}
.pics { .pics {
display: flex; display: flex;
margin-top: 10px; margin-top: 10px;

Loading…
Cancel
Save