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

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

View File

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