main.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <!--&lt;!&ndash;-->
  2. <!-- - Copyright (C) 2018-2019-->
  3. <!-- - All rights reserved, Designed By www.joolun.com-->
  4. <!-- 芋道源码:-->
  5. <!-- ① 移除多余的 rep 为前缀的变量,让 message 消息更简单-->
  6. <!-- ② 代码优化,补充注释,提升阅读性-->
  7. <!-- ③ 优化消息的临时缓存策略,发送消息时,只清理被发送消息的 tab,不会强制切回到 text 输入-->
  8. <!-- ④ 支持发送【视频】消息时,支持新建视频-->
  9. <!--&ndash;&gt;-->
  10. <!--<template>-->
  11. <!-- <el-tabs type="border-card" v-model="objData.type" @tab-click="handleClick">-->
  12. <!-- &lt;!&ndash; 类型 1:文本 &ndash;&gt;-->
  13. <!-- <el-tab-pane name="text">-->
  14. <!-- <span slot="label"><i class="el-icon-document"></i> 文本</span>-->
  15. <!-- <el-input-->
  16. <!-- type="textarea"-->
  17. <!-- :rows="5"-->
  18. <!-- placeholder="请输入内容"-->
  19. <!-- v-model="objData.content"-->
  20. <!-- @input="inputContent"-->
  21. <!-- />-->
  22. <!-- </el-tab-pane>-->
  23. <!-- &lt;!&ndash; 类型 2:图片 &ndash;&gt;-->
  24. <!-- <el-tab-pane name="image">-->
  25. <!-- <span slot="label"><i class="el-icon-picture"></i> 图片</span>-->
  26. <!-- <el-row>-->
  27. <!-- &lt;!&ndash; 情况一:已经选择好素材、或者上传好图片 &ndash;&gt;-->
  28. <!-- <div class="select-item" v-if="objData.url">-->
  29. <!-- <img class="material-img" :src="objData.url" />-->
  30. <!-- <p class="item-name" v-if="objData.name">{{ objData.name }}</p>-->
  31. <!-- <el-row class="ope-row">-->
  32. <!-- <el-button type="danger" icon="el-icon-delete" circle @click="deleteObj" />-->
  33. <!-- </el-row>-->
  34. <!-- </div>-->
  35. <!-- &lt;!&ndash; 情况二:未做完上述操作 &ndash;&gt;-->
  36. <!-- <div v-else>-->
  37. <!-- <el-row style="text-align: center">-->
  38. <!-- &lt;!&ndash; 选择素材 &ndash;&gt;-->
  39. <!-- <el-col :span="12" class="col-select">-->
  40. <!-- <el-button type="success" @click="openMaterial">-->
  41. <!-- 素材库选择<i class="el-icon-circle-check el-icon&#45;&#45;right"></i>-->
  42. <!-- </el-button>-->
  43. <!-- <el-dialog-->
  44. <!-- title="选择图片"-->
  45. <!-- v-model:visible="dialogImageVisible"-->
  46. <!-- width="90%"-->
  47. <!-- append-to-body-->
  48. <!-- >-->
  49. <!-- <wx-material-select :obj-data="objData" @selectMaterial="selectMaterial" />-->
  50. <!-- </el-dialog>-->
  51. <!-- </el-col>-->
  52. <!-- &lt;!&ndash; 文件上传 &ndash;&gt;-->
  53. <!-- <el-col :span="12" class="col-add">-->
  54. <!-- <el-upload-->
  55. <!-- :action="actionUrl"-->
  56. <!-- :headers="headers"-->
  57. <!-- multiple-->
  58. <!-- :limit="1"-->
  59. <!-- :file-list="fileList"-->
  60. <!-- :data="uploadData"-->
  61. <!-- :before-upload="beforeImageUpload"-->
  62. <!-- :on-success="handleUploadSuccess"-->
  63. <!-- >-->
  64. <!-- <el-button type="primary">上传图片</el-button>-->
  65. <!-- <div slot="tip" class="el-upload__tip"-->
  66. <!-- >支持 bmp/png/jpeg/jpg/gif 格式,大小不超过 2M</div-->
  67. <!-- >-->
  68. <!-- </el-upload>-->
  69. <!-- </el-col>-->
  70. <!-- </el-row>-->
  71. <!-- </div>-->
  72. <!-- </el-row>-->
  73. <!-- </el-tab-pane>-->
  74. <!-- &lt;!&ndash; 类型 3:语音 &ndash;&gt;-->
  75. <!-- <el-tab-pane name="voice">-->
  76. <!-- <span slot="label"><i class="el-icon-phone"></i> 语音</span>-->
  77. <!-- <el-row>-->
  78. <!-- <div class="select-item2" v-if="objData.url">-->
  79. <!-- <p class="item-name">{{ objData.name }}</p>-->
  80. <!-- <div class="item-infos">-->
  81. <!-- <wx-voice-player :url="objData.url" />-->
  82. <!-- </div>-->
  83. <!-- <el-row class="ope-row">-->
  84. <!-- <el-button type="danger" icon="el-icon-delete" circle @click="deleteObj" />-->
  85. <!-- </el-row>-->
  86. <!-- </div>-->
  87. <!-- <div v-else>-->
  88. <!-- <el-row style="text-align: center">-->
  89. <!-- &lt;!&ndash; 选择素材 &ndash;&gt;-->
  90. <!-- <el-col :span="12" class="col-select">-->
  91. <!-- <el-button type="success" @click="openMaterial">-->
  92. <!-- 素材库选择<i class="el-icon-circle-check el-icon&#45;&#45;right"></i>-->
  93. <!-- </el-button>-->
  94. <!-- <el-dialog-->
  95. <!-- title="选择语音"-->
  96. <!-- v-model:visible="dialogVoiceVisible"-->
  97. <!-- width="90%"-->
  98. <!-- append-to-body-->
  99. <!-- >-->
  100. <!-- <WxMaterialSelect :objData="objData" @selectMaterial="selectMaterial" />-->
  101. <!-- </el-dialog>-->
  102. <!-- </el-col>-->
  103. <!-- &lt;!&ndash; 文件上传 &ndash;&gt;-->
  104. <!-- <el-col :span="12" class="col-add">-->
  105. <!-- <el-upload-->
  106. <!-- :action="actionUrl"-->
  107. <!-- :headers="headers"-->
  108. <!-- multiple-->
  109. <!-- :limit="1"-->
  110. <!-- :file-list="fileList"-->
  111. <!-- :data="uploadData"-->
  112. <!-- :before-upload="beforeVoiceUpload"-->
  113. <!-- :on-success="handleUploadSuccess"-->
  114. <!-- >-->
  115. <!-- <el-button type="primary">点击上传</el-button>-->
  116. <!-- <div slot="tip" class="el-upload__tip"-->
  117. <!-- >格式支持 mp3/wma/wav/amr,文件大小不超过 2M,播放长度不超过 60s</div-->
  118. <!-- >-->
  119. <!-- </el-upload>-->
  120. <!-- </el-col>-->
  121. <!-- </el-row>-->
  122. <!-- </div>-->
  123. <!-- </el-row>-->
  124. <!-- </el-tab-pane>-->
  125. <!-- &lt;!&ndash; 类型 4:视频 &ndash;&gt;-->
  126. <!-- <el-tab-pane name="video">-->
  127. <!-- <span slot="label"><i class="el-icon-share"></i> 视频</span>-->
  128. <!-- <el-row>-->
  129. <!-- <el-input v-model="objData.title" placeholder="请输入标题" @input="inputContent" />-->
  130. <!-- <div style="margin: 20px 0"></div>-->
  131. <!-- <el-input v-model="objData.description" placeholder="请输入描述" @input="inputContent" />-->
  132. <!-- <div style="margin: 20px 0"></div>-->
  133. <!-- <div style="text-align: center">-->
  134. <!-- <wx-video-player v-if="objData.url" :url="objData.url" />-->
  135. <!-- </div>-->
  136. <!-- <div style="margin: 20px 0"></div>-->
  137. <!-- <el-row style="text-align: center">-->
  138. <!-- &lt;!&ndash; 选择素材 &ndash;&gt;-->
  139. <!-- <el-col :span="12">-->
  140. <!-- <el-button type="success" @click="openMaterial">-->
  141. <!-- 素材库选择<i class="el-icon-circle-check el-icon&#45;&#45;right"></i>-->
  142. <!-- </el-button>-->
  143. <!-- <el-dialog-->
  144. <!-- title="选择视频"-->
  145. <!-- v-model:visible="dialogVideoVisible"-->
  146. <!-- width="90%"-->
  147. <!-- append-to-body-->
  148. <!-- >-->
  149. <!-- <wx-material-select :objData="objData" @selectMaterial="selectMaterial" />-->
  150. <!-- </el-dialog>-->
  151. <!-- </el-col>-->
  152. <!-- &lt;!&ndash; 文件上传 &ndash;&gt;-->
  153. <!-- <el-col :span="12">-->
  154. <!-- <el-upload-->
  155. <!-- :action="actionUrl"-->
  156. <!-- :headers="headers"-->
  157. <!-- multiple-->
  158. <!-- :limit="1"-->
  159. <!-- :file-list="fileList"-->
  160. <!-- :data="uploadData"-->
  161. <!-- :before-upload="beforeVideoUpload"-->
  162. <!-- :on-success="handleUploadSuccess"-->
  163. <!-- >-->
  164. <!-- <el-button type="primary"-->
  165. <!-- >新建视频<i class="el-icon-upload el-icon&#45;&#45;right"></i-->
  166. <!-- ></el-button>-->
  167. <!-- </el-upload>-->
  168. <!-- </el-col>-->
  169. <!-- </el-row>-->
  170. <!-- </el-row>-->
  171. <!-- </el-tab-pane>-->
  172. <!-- &lt;!&ndash; 类型 5:图文 &ndash;&gt;-->
  173. <!-- <el-tab-pane name="news">-->
  174. <!-- <span slot="label"><i class="el-icon-news"></i> 图文</span>-->
  175. <!-- <el-row>-->
  176. <!-- <div class="select-item" v-if="objData.articles">-->
  177. <!-- <wx-news :articles="objData.articles" />-->
  178. <!-- <el-row class="ope-row">-->
  179. <!-- <el-button type="danger" icon="el-icon-delete" circle @click="deleteObj" />-->
  180. <!-- </el-row>-->
  181. <!-- </div>-->
  182. <!-- &lt;!&ndash; 选择素材 &ndash;&gt;-->
  183. <!-- <div v-if="!objData.content">-->
  184. <!-- <el-row style="text-align: center">-->
  185. <!-- <el-col :span="24">-->
  186. <!-- <el-button type="success" @click="openMaterial"-->
  187. <!-- >{{ newsType === '1' ? '选择已发布图文' : '选择草稿箱图文'-->
  188. <!-- }}<i class="el-icon-circle-check el-icon&#45;&#45;right"></i-->
  189. <!-- ></el-button>-->
  190. <!-- </el-col>-->
  191. <!-- </el-row>-->
  192. <!-- </div>-->
  193. <!-- <el-dialog title="选择图文" v-model:visible="dialogNewsVisible" width="90%" append-to-body>-->
  194. <!-- <wx-material-select-->
  195. <!-- :objData="objData"-->
  196. <!-- @selectMaterial="selectMaterial"-->
  197. <!-- :newsType="newsType"-->
  198. <!-- />-->
  199. <!-- </el-dialog>-->
  200. <!-- </el-row>-->
  201. <!-- </el-tab-pane>-->
  202. <!-- &lt;!&ndash; 类型 6:音乐 &ndash;&gt;-->
  203. <!-- <el-tab-pane name="music">-->
  204. <!-- <span slot="label"><i class="el-icon-service"></i> 音乐</span>-->
  205. <!-- <el-row>-->
  206. <!-- <el-col :span="6">-->
  207. <!-- <div class="thumb-div">-->
  208. <!-- <img style="width: 100px" v-if="objData.thumbMediaUrl" :src="objData.thumbMediaUrl" />-->
  209. <!-- <i v-else class="el-icon-plus avatar-uploader-icon"></i>-->
  210. <!-- <div class="thumb-but">-->
  211. <!-- <el-upload-->
  212. <!-- :action="actionUrl"-->
  213. <!-- :headers="headers"-->
  214. <!-- multiple-->
  215. <!-- :limit="1"-->
  216. <!-- :file-list="fileList"-->
  217. <!-- :data="uploadData"-->
  218. <!-- :before-upload="beforeThumbImageUpload"-->
  219. <!-- :on-success="handleUploadSuccess"-->
  220. <!-- >-->
  221. <!-- <el-button slot="trigger" size="mini" type="text">本地上传</el-button>-->
  222. <!-- <el-button size="mini" type="text" @click="openMaterial" style="margin-left: 5px"-->
  223. <!-- >素材库选择</el-button-->
  224. <!-- >-->
  225. <!-- </el-upload>-->
  226. <!-- </div>-->
  227. <!-- </div>-->
  228. <!-- <el-dialog-->
  229. <!-- title="选择图片"-->
  230. <!-- v-model:visible="dialogThumbVisible"-->
  231. <!-- width="80%"-->
  232. <!-- append-to-body-->
  233. <!-- >-->
  234. <!-- <wx-material-select-->
  235. <!-- :objData="{ type: 'image', accountId: objData.accountId }"-->
  236. <!-- @selectMaterial="selectMaterial"-->
  237. <!-- />-->
  238. <!-- </el-dialog>-->
  239. <!-- </el-col>-->
  240. <!-- <el-col :span="18">-->
  241. <!-- <el-input v-model="objData.title" placeholder="请输入标题" @input="inputContent" />-->
  242. <!-- <div style="margin: 20px 0"></div>-->
  243. <!-- <el-input v-model="objData.description" placeholder="请输入描述" @input="inputContent" />-->
  244. <!-- </el-col>-->
  245. <!-- </el-row>-->
  246. <!-- <div style="margin: 20px 0"></div>-->
  247. <!-- <el-input v-model="objData.musicUrl" placeholder="请输入音乐链接" @input="inputContent" />-->
  248. <!-- <div style="margin: 20px 0"></div>-->
  249. <!-- <el-input-->
  250. <!-- v-model="objData.hqMusicUrl"-->
  251. <!-- placeholder="请输入高质量音乐链接"-->
  252. <!-- @input="inputContent"-->
  253. <!-- />-->
  254. <!-- </el-tab-pane>-->
  255. <!-- </el-tabs>-->
  256. <!--</template>-->
  257. <!--<script>-->
  258. <!--import WxNews from '@/views/mp/components/wx-news/main.vue'-->
  259. <!--import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue'-->
  260. <!--import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'-->
  261. <!--import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'-->
  262. <!--import { getAccessToken } from '@/utils/auth'-->
  263. <!--export default {-->
  264. <!-- name: 'WxReplySelect',-->
  265. <!-- components: {-->
  266. <!-- WxNews,-->
  267. <!-- WxMaterialSelect,-->
  268. <!-- WxVoicePlayer,-->
  269. <!-- WxVideoPlayer-->
  270. <!-- },-->
  271. <!-- props: {-->
  272. <!-- objData: {-->
  273. <!-- // 消息对象。-->
  274. <!-- type: Object, // 设置为 Object 的原因,方便属性的传递-->
  275. <!-- required: true-->
  276. <!-- },-->
  277. <!-- newsType: {-->
  278. <!-- // 图文类型:1、已发布图文;2、草稿箱图文-->
  279. <!-- type: String,-->
  280. <!-- default: '1'-->
  281. <!-- }-->
  282. <!-- },-->
  283. <!-- data() {-->
  284. <!-- return {-->
  285. <!-- tempPlayerObj: {-->
  286. <!-- type: '2'-->
  287. <!-- },-->
  288. <!-- tempObj: new Map().set(-->
  289. <!-- // 临时缓存,切换消息类型的 tab 的时候,可以保存对应的数据;-->
  290. <!-- this.objData.type, // 消息类型-->
  291. <!-- Object.assign({}, this.objData)-->
  292. <!-- ), // 消息内容-->
  293. <!-- // ========== 素材选择的弹窗,是否可见 ==========-->
  294. <!-- dialogNewsVisible: false, // 图文-->
  295. <!-- dialogImageVisible: false, // 图片-->
  296. <!-- dialogVoiceVisible: false, // 语音-->
  297. <!-- dialogVideoVisible: false, // 视频-->
  298. <!-- dialogThumbVisible: false, // 缩略图-->
  299. <!-- // ========== 文件上传(图片、语音、视频) ==========-->
  300. <!-- fileList: [], // 文件列表-->
  301. <!-- uploadData: {-->
  302. <!-- accountId: undefined,-->
  303. <!-- type: this.objData.type,-->
  304. <!-- title: '',-->
  305. <!-- introduction: ''-->
  306. <!-- },-->
  307. <!-- actionUrl: process.env.VUE_APP_BASE_API + '/admin-api/mp/material/upload-temporary',-->
  308. <!-- headers: { Authorization: 'Bearer ' + getAccessToken() } // 设置上传的请求头部-->
  309. <!-- }-->
  310. <!-- },-->
  311. <!-- methods: {-->
  312. <!-- beforeThumbImageUpload(file) {-->
  313. <!-- const isType =-->
  314. <!-- file.type === 'image/jpeg' ||-->
  315. <!-- file.type === 'image/png' ||-->
  316. <!-- file.type === 'image/gif' ||-->
  317. <!-- file.type === 'image/bmp' ||-->
  318. <!-- file.type === 'image/jpg'-->
  319. <!-- if (!isType) {-->
  320. <!-- this.$message.error('上传图片格式不对!')-->
  321. <!-- return false-->
  322. <!-- }-->
  323. <!-- const isLt = file.size / 1024 / 1024 < 2-->
  324. <!-- if (!isLt) {-->
  325. <!-- this.$message.error('上传图片大小不能超过 2M!')-->
  326. <!-- return false-->
  327. <!-- }-->
  328. <!-- this.uploadData.accountId = this.objData.accountId-->
  329. <!-- return true-->
  330. <!-- },-->
  331. <!-- beforeVoiceUpload(file) {-->
  332. <!-- // 校验格式-->
  333. <!-- const isType =-->
  334. <!-- file.type === 'audio/mp3' ||-->
  335. <!-- file.type === 'audio/mpeg' ||-->
  336. <!-- file.type === 'audio/wma' ||-->
  337. <!-- file.type === 'audio/wav' ||-->
  338. <!-- file.type === 'audio/amr'-->
  339. <!-- if (!isType) {-->
  340. <!-- this.$message.error('上传语音格式不对!' + file.type)-->
  341. <!-- return false-->
  342. <!-- }-->
  343. <!-- // 校验大小-->
  344. <!-- const isLt = file.size / 1024 / 1024 < 2-->
  345. <!-- if (!isLt) {-->
  346. <!-- this.$message.error('上传语音大小不能超过 2M!')-->
  347. <!-- return false-->
  348. <!-- }-->
  349. <!-- this.uploadData.accountId = this.objData.accountId-->
  350. <!-- return true-->
  351. <!-- },-->
  352. <!-- beforeImageUpload(file) {-->
  353. <!-- // 校验格式-->
  354. <!-- const isType =-->
  355. <!-- file.type === 'image/jpeg' ||-->
  356. <!-- file.type === 'image/png' ||-->
  357. <!-- file.type === 'image/gif' ||-->
  358. <!-- file.type === 'image/bmp' ||-->
  359. <!-- file.type === 'image/jpg'-->
  360. <!-- if (!isType) {-->
  361. <!-- this.$message.error('上传图片格式不对!')-->
  362. <!-- return false-->
  363. <!-- }-->
  364. <!-- // 校验大小-->
  365. <!-- const isLt = file.size / 1024 / 1024 < 2-->
  366. <!-- if (!isLt) {-->
  367. <!-- this.$message.error('上传图片大小不能超过 2M!')-->
  368. <!-- return false-->
  369. <!-- }-->
  370. <!-- this.uploadData.accountId = this.objData.accountId-->
  371. <!-- return true-->
  372. <!-- },-->
  373. <!-- beforeVideoUpload(file) {-->
  374. <!-- // 校验格式-->
  375. <!-- const isType = file.type === 'video/mp4'-->
  376. <!-- if (!isType) {-->
  377. <!-- this.$message.error('上传视频格式不对!')-->
  378. <!-- return false-->
  379. <!-- }-->
  380. <!-- // 校验大小-->
  381. <!-- const isLt = file.size / 1024 / 1024 < 10-->
  382. <!-- if (!isLt) {-->
  383. <!-- this.$message.error('上传视频大小不能超过 10M!')-->
  384. <!-- return false-->
  385. <!-- }-->
  386. <!-- this.uploadData.accountId = this.objData.accountId-->
  387. <!-- return true-->
  388. <!-- },-->
  389. <!-- handleUploadSuccess(response, file, fileList) {-->
  390. <!-- if (response.code !== 0) {-->
  391. <!-- this.$message.error('上传出错:' + response.msg)-->
  392. <!-- return false-->
  393. <!-- }-->
  394. <!-- // 清空上传时的各种数据-->
  395. <!-- this.fileList = []-->
  396. <!-- this.uploadData.title = ''-->
  397. <!-- this.uploadData.introduction = ''-->
  398. <!-- // 上传好的文件,本质是个素材,所以可以进行选中-->
  399. <!-- let item = response.data-->
  400. <!-- this.selectMaterial(item)-->
  401. <!-- },-->
  402. <!-- /**-->
  403. <!-- * 切换消息类型的 tab-->
  404. <!-- *-->
  405. <!-- * @param tab tab-->
  406. <!-- */-->
  407. <!-- handleClick(tab) {-->
  408. <!-- // 设置后续文件上传的文件类型-->
  409. <!-- this.uploadData.type = this.objData.type-->
  410. <!-- if (this.uploadData.type === 'music') {-->
  411. <!-- // 【音乐】上传的是缩略图-->
  412. <!-- this.uploadData.type = 'thumb'-->
  413. <!-- }-->
  414. <!-- // 从 tempObj 临时缓存中,获取对应的数据,并设置回 objData-->
  415. <!-- let tempObjItem = this.tempObj.get(this.objData.type)-->
  416. <!-- if (tempObjItem) {-->
  417. <!-- this.objData.content = tempObjItem.content ? tempObjItem.content : null-->
  418. <!-- this.objData.mediaId = tempObjItem.mediaId ? tempObjItem.mediaId : null-->
  419. <!-- this.objData.url = tempObjItem.url ? tempObjItem.url : null-->
  420. <!-- this.objData.name = tempObjItem.url ? tempObjItem.name : null-->
  421. <!-- this.objData.title = tempObjItem.title ? tempObjItem.title : null-->
  422. <!-- this.objData.description = tempObjItem.description ? tempObjItem.description : null-->
  423. <!-- return-->
  424. <!-- }-->
  425. <!-- // 如果获取不到,需要把 objData 复原-->
  426. <!-- // 必须使用 $set 赋值,不然 input 无法输入内容-->
  427. <!-- this.$set(this.objData, 'content', '')-->
  428. <!-- this.$delete(this.objData, 'mediaId')-->
  429. <!-- this.$delete(this.objData, 'url')-->
  430. <!-- this.$set(this.objData, 'title', '')-->
  431. <!-- this.$set(this.objData, 'description', '')-->
  432. <!-- },-->
  433. <!-- /**-->
  434. <!-- * 选择素材,将设置设置到 objData 变量-->
  435. <!-- *-->
  436. <!-- * @param item 素材-->
  437. <!-- */-->
  438. <!-- selectMaterial(item) {-->
  439. <!-- // 选择好素材,所以隐藏弹窗-->
  440. <!-- this.closeMaterial()-->
  441. <!-- // 创建 tempObjItem 对象,并设置对应的值-->
  442. <!-- let tempObjItem = {}-->
  443. <!-- tempObjItem.type = this.objData.type-->
  444. <!-- if (this.objData.type === 'news') {-->
  445. <!-- tempObjItem.articles = item.content.newsItem-->
  446. <!-- this.objData.articles = item.content.newsItem-->
  447. <!-- } else if (this.objData.type === 'music') {-->
  448. <!-- // 音乐需要特殊处理,因为选择的是图片的缩略图-->
  449. <!-- tempObjItem.thumbMediaId = item.mediaId-->
  450. <!-- this.objData.thumbMediaId = item.mediaId-->
  451. <!-- tempObjItem.thumbMediaUrl = item.url-->
  452. <!-- this.objData.thumbMediaUrl = item.url-->
  453. <!-- // title、introduction、musicUrl、hqMusicUrl:从 objData 到 tempObjItem,避免上传素材后,被覆盖掉-->
  454. <!-- tempObjItem.title = this.objData.title || ''-->
  455. <!-- tempObjItem.introduction = this.objData.introduction || ''-->
  456. <!-- tempObjItem.musicUrl = this.objData.musicUrl || ''-->
  457. <!-- tempObjItem.hqMusicUrl = this.objData.hqMusicUrl || ''-->
  458. <!-- } else if (this.objData.type === 'image' || this.objData.type === 'voice') {-->
  459. <!-- tempObjItem.mediaId = item.mediaId-->
  460. <!-- this.objData.mediaId = item.mediaId-->
  461. <!-- tempObjItem.url = item.url-->
  462. <!-- this.objData.url = item.url-->
  463. <!-- tempObjItem.name = item.name-->
  464. <!-- this.objData.name = item.name-->
  465. <!-- } else if (this.objData.type === 'video') {-->
  466. <!-- tempObjItem.mediaId = item.mediaId-->
  467. <!-- this.objData.mediaId = item.mediaId-->
  468. <!-- tempObjItem.url = item.url-->
  469. <!-- this.objData.url = item.url-->
  470. <!-- tempObjItem.name = item.name-->
  471. <!-- this.objData.name = item.name-->
  472. <!-- // title、introduction:从 item 到 tempObjItem,因为素材里有 title、introduction-->
  473. <!-- if (item.title) {-->
  474. <!-- this.objData.title = item.title || ''-->
  475. <!-- tempObjItem.title = item.title || ''-->
  476. <!-- }-->
  477. <!-- if (item.introduction) {-->
  478. <!-- this.objData.description = item.introduction || '' // 消息使用的是 description,素材使用的是 introduction,所以转换下-->
  479. <!-- tempObjItem.description = item.introduction || ''-->
  480. <!-- }-->
  481. <!-- } else if (this.objData.type === 'text') {-->
  482. <!-- this.objData.content = item.content || ''-->
  483. <!-- }-->
  484. <!-- // 最终设置到临时缓存-->
  485. <!-- this.tempObj.set(this.objData.type, tempObjItem)-->
  486. <!-- },-->
  487. <!-- openMaterial() {-->
  488. <!-- if (this.objData.type === 'news') {-->
  489. <!-- this.dialogNewsVisible = true-->
  490. <!-- } else if (this.objData.type === 'image') {-->
  491. <!-- this.dialogImageVisible = true-->
  492. <!-- } else if (this.objData.type === 'voice') {-->
  493. <!-- this.dialogVoiceVisible = true-->
  494. <!-- } else if (this.objData.type === 'video') {-->
  495. <!-- this.dialogVideoVisible = true-->
  496. <!-- } else if (this.objData.type === 'music') {-->
  497. <!-- this.dialogThumbVisible = true-->
  498. <!-- }-->
  499. <!-- },-->
  500. <!-- closeMaterial() {-->
  501. <!-- this.dialogNewsVisible = false-->
  502. <!-- this.dialogImageVisible = false-->
  503. <!-- this.dialogVoiceVisible = false-->
  504. <!-- this.dialogVideoVisible = false-->
  505. <!-- this.dialogThumbVisible = false-->
  506. <!-- },-->
  507. <!-- deleteObj() {-->
  508. <!-- if (this.objData.type === 'news') {-->
  509. <!-- this.$delete(this.objData, 'articles')-->
  510. <!-- } else if (this.objData.type === 'image') {-->
  511. <!-- this.objData.mediaId = null-->
  512. <!-- this.$delete(this.objData, 'url')-->
  513. <!-- this.objData.name = null-->
  514. <!-- } else if (this.objData.type === 'voice') {-->
  515. <!-- this.objData.mediaId = null-->
  516. <!-- this.$delete(this.objData, 'url')-->
  517. <!-- this.objData.name = null-->
  518. <!-- } else if (this.objData.type === 'video') {-->
  519. <!-- this.objData.mediaId = null-->
  520. <!-- this.$delete(this.objData, 'url')-->
  521. <!-- this.objData.name = null-->
  522. <!-- this.objData.title = null-->
  523. <!-- this.objData.description = null-->
  524. <!-- } else if (this.objData.type === 'music') {-->
  525. <!-- this.objData.thumbMediaId = null-->
  526. <!-- this.objData.thumbMediaUrl = null-->
  527. <!-- this.objData.title = null-->
  528. <!-- this.objData.description = null-->
  529. <!-- this.objData.musicUrl = null-->
  530. <!-- this.objData.hqMusicUrl = null-->
  531. <!-- } else if (this.objData.type === 'text') {-->
  532. <!-- this.objData.content = null-->
  533. <!-- }-->
  534. <!-- // 覆盖缓存-->
  535. <!-- this.tempObj.set(this.objData.type, Object.assign({}, this.objData))-->
  536. <!-- },-->
  537. <!-- /**-->
  538. <!-- * 输入时,缓存每次 objData 到 tempObj 中-->
  539. <!-- *-->
  540. <!-- * why?不确定为什么 v-model="objData.content" 不能自动缓存,所以通过这样的方式-->
  541. <!-- */-->
  542. <!-- inputContent(str) {-->
  543. <!-- // 覆盖缓存-->
  544. <!-- this.tempObj.set(this.objData.type, Object.assign({}, this.objData))-->
  545. <!-- }-->
  546. <!-- }-->
  547. <!--}-->
  548. <!--</script>-->
  549. <!--<style lang="scss" scoped>-->
  550. <!--.public-account-management {-->
  551. <!-- .el-input {-->
  552. <!-- width: 70%;-->
  553. <!-- margin-right: 2%;-->
  554. <!-- }-->
  555. <!--}-->
  556. <!--.pagination {-->
  557. <!-- text-align: right;-->
  558. <!-- margin-right: 25px;-->
  559. <!--}-->
  560. <!--.select-item {-->
  561. <!-- width: 280px;-->
  562. <!-- padding: 10px;-->
  563. <!-- margin: 0 auto 10px auto;-->
  564. <!-- border: 1px solid #eaeaea;-->
  565. <!--}-->
  566. <!--.select-item2 {-->
  567. <!-- padding: 10px;-->
  568. <!-- margin: 0 auto 10px auto;-->
  569. <!-- border: 1px solid #eaeaea;-->
  570. <!--}-->
  571. <!--.ope-row {-->
  572. <!-- padding-top: 10px;-->
  573. <!-- text-align: center;-->
  574. <!--}-->
  575. <!--.item-name {-->
  576. <!-- font-size: 12px;-->
  577. <!-- overflow: hidden;-->
  578. <!-- text-overflow: ellipsis;-->
  579. <!-- white-space: nowrap;-->
  580. <!-- text-align: center;-->
  581. <!--}-->
  582. <!--.el-form-item__content {-->
  583. <!-- line-height: unset !important;-->
  584. <!--}-->
  585. <!--.col-select {-->
  586. <!-- border: 1px solid rgb(234, 234, 234);-->
  587. <!-- padding: 50px 0px;-->
  588. <!-- height: 160px;-->
  589. <!-- width: 49.5%;-->
  590. <!--}-->
  591. <!--.col-select2 {-->
  592. <!-- border: 1px solid rgb(234, 234, 234);-->
  593. <!-- padding: 50px 0px;-->
  594. <!-- height: 160px;-->
  595. <!--}-->
  596. <!--.col-add {-->
  597. <!-- border: 1px solid rgb(234, 234, 234);-->
  598. <!-- padding: 50px 0px;-->
  599. <!-- height: 160px;-->
  600. <!-- width: 49.5%;-->
  601. <!-- float: right;-->
  602. <!--}-->
  603. <!--.avatar-uploader-icon {-->
  604. <!-- border: 1px solid #d9d9d9;-->
  605. <!-- font-size: 28px;-->
  606. <!-- color: #8c939d;-->
  607. <!-- width: 100px !important;-->
  608. <!-- height: 100px !important;-->
  609. <!-- line-height: 100px !important;-->
  610. <!-- text-align: center;-->
  611. <!--}-->
  612. <!--.material-img {-->
  613. <!-- width: 100%;-->
  614. <!--}-->
  615. <!--.thumb-div {-->
  616. <!-- display: inline-block;-->
  617. <!-- text-align: center;-->
  618. <!--}-->
  619. <!--.item-infos {-->
  620. <!-- width: 30%;-->
  621. <!-- margin: auto;-->
  622. <!--}-->
  623. <!--</style>-->