mp:优化 wx-editor 图片的上传

This commit is contained in:
YunaiV 2023-01-14 08:02:31 +08:00
parent 73fac5235f
commit 28884ee638
2 changed files with 14 additions and 10 deletions

View File

@ -1,6 +1,8 @@
<!--
- Copyright (C) 2018-2019
- All rights reserved, Designed By www.joolun.com
芋道源码
调整 uploadData 属性只需要传入 accountId 即可
-->
<template>
<div id="wxEditor">
@ -44,14 +46,16 @@ import { getAccessToken } from "@/utils/auth";
export default {
props: {
uploadData: {
type: Object
/* 公众号账号编号 */
accountId: {
type: Number,
required: true
},
/*编辑器的内容*/
/* 编辑器的内容 */
value: {
type: String
},
/*图片大小*/
/* 图片大小 */
maxSize: {
type: Number,
default: 4000 // kb
@ -97,6 +101,10 @@ export default {
},
actionUrl: process.env.VUE_APP_BASE_API +'/admin-api/mp/material/upload-news-image', //
headers: { Authorization: "Bearer " + getAccessToken() }, //
uploadData: {
"type": 'image', // TODO thumb
"accountId": this.accountId,
},
}
},
methods: {

View File

@ -117,7 +117,7 @@ SOFTWARE.
<div class="right" v-loading="addMaterialLoading" v-if="articlesAdd.length > 0">
<!--富文本编辑器组件-->
<el-row>
<wx-editor v-model="articlesAdd[isActiveAddNews].content" :uploadData="uploadData"
<wx-editor v-model="articlesAdd[isActiveAddNews].content" :account-id="this.uploadData.accountId"
v-if="hackResetEditor"/>
</el-row>
<br><br><br><br>
@ -204,9 +204,7 @@ export default {
fileList: [],
uploadData: {
"type": 'image', // TODO thumb
"title": '',
"introduction": '',
"accountId": 1,
// "accountId": 1,
},
// ========== 稿 or ==========
@ -495,8 +493,6 @@ export default {
//
this.fileList = []
this.uploadData.title = ''
this.uploadData.introduction = ''
// 稿
this.articlesAdd[this.isActiveAddNews].thumbMediaId = response.data.mediaId