Commit 331af28fe73e279f09c810bf91bffffea654ebc5

Authored by YunaiV
1 parent 188d8802

mp:增加【语音】【视频】的素材选择

yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/material/vo/MpMaterialRespVO.java
... ... @@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
4 4 import io.swagger.annotations.ApiModelProperty;
5 5 import lombok.Data;
6 6  
  7 +import java.util.Date;
  8 +
7 9 @ApiModel("管理后台 - 公众号素材 Response VO")
8 10 @Data
9 11 public class MpMaterialRespVO {
... ... @@ -39,4 +41,8 @@ public class MpMaterialRespVO {
39 41 private String title;
40 42 @ApiModelProperty(value = "视频素材的描述", example = "我是介绍", notes = "只有【永久素材】使用")
41 43 private String introduction;
  44 +
  45 + @ApiModelProperty(value = "创建时间", required = true)
  46 + private Date createTime;
  47 +
42 48 }
... ...
yudao-ui-admin/src/views/mp/components/wx-material-select/main.vue
... ... @@ -23,45 +23,59 @@
23 23 <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
24 24 @pagination="getMaterialPage"/>
25 25 </div>
26   - <div v-else-if="objData.type == 'voice'">
27   - <!-- TODO 芋艿:需要翻译 -->
28   -<!-- <avue-crud ref="crud"-->
29   -<!-- :page="page"-->
30   -<!-- :data="tableData"-->
31   -<!-- :table-loading="tableLoading"-->
32   -<!-- :option="tableOptionVoice"-->
33   -<!-- @on-load="getPage"-->
34   -<!-- @size-change="sizeChange"-->
35   -<!-- @refresh-change="refreshChange">-->
36   -<!-- <template slot-scope="scope"-->
37   -<!-- slot="menu">-->
38   -<!-- <el-button type="text"-->
39   -<!-- icon="el-icon-circle-plus"-->
40   -<!-- size="small"-->
41   -<!-- plain-->
42   -<!-- @click="selectMaterial(scope.row)">选择</el-button>-->
43   -<!-- </template>-->
44   -<!-- </avue-crud>-->
  26 + <!-- 类型:语音 -->
  27 + <div v-else-if="objData.type === 'voice'">
  28 + <!-- 列表 -->
  29 + <el-table v-loading="loading" :data="list">
  30 + <el-table-column label="编号" align="center" prop="mediaId" />
  31 + <el-table-column label="名字" align="center" prop="name" />
  32 + <el-table-column label="语音" align="center">
  33 + <template v-slot="scope">
  34 + <wx-voice-player :url="scope.row.url" />
  35 + </template>
  36 + </el-table-column>
  37 + <el-table-column label="上传时间" align="center" prop="createTime" width="180">
  38 + <template v-slot="scope">
  39 + <span>{{ parseTime(scope.row.createTime) }}</span>
  40 + </template>
  41 + </el-table-column>
  42 + <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
  43 + <template v-slot="scope">
  44 + <el-button size="mini" type="text" icon="el-icon-circle-plus"
  45 + @click="selectMaterial(scope.row)">选择</el-button>
  46 + </template>
  47 + </el-table-column>
  48 + </el-table>
  49 + <!-- 分页组件 -->
  50 + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  51 + @pagination="getMaterialPage"/>
45 52 </div>
46   - <div v-else-if="objData.type == 'video'">
47   - <!-- TODO 芋艿:需要翻译 -->
48   - <!-- <avue-crud ref="crud"-->
49   -<!-- :page="page"-->
50   -<!-- :data="tableData"-->
51   -<!-- :table-loading="tableLoading"-->
52   -<!-- :option="tableOptionVideo"-->
53   -<!-- @on-load="getPage"-->
54   -<!-- @size-change="sizeChange"-->
55   -<!-- @refresh-change="refreshChange">-->
56   -<!-- <template slot-scope="scope"-->
57   -<!-- slot="menu">-->
58   -<!-- <el-button type="text"-->
59   -<!-- icon="el-icon-circle-plus"-->
60   -<!-- size="small"-->
61   -<!-- plain-->
62   -<!-- @click="selectMaterial(scope.row)">选择</el-button>-->
63   -<!-- </template>-->
64   -<!-- </avue-crud>-->
  53 + <div v-else-if="objData.type === 'video'">
  54 + <!-- 列表 -->
  55 + <el-table v-loading="loading" :data="list">
  56 + <el-table-column label="编号" align="center" prop="mediaId" />
  57 + <el-table-column label="标题" align="center" prop="title" />
  58 + <el-table-column label="介绍" align="center" prop="introduction" />
  59 + <el-table-column label="视频" align="center">
  60 + <template v-slot="scope">
  61 + <wx-video-player :url="scope.row.url" />
  62 + </template>
  63 + </el-table-column>
  64 + <el-table-column label="上传时间" align="center" prop="createTime" width="180">
  65 + <template v-slot="scope">
  66 + <span>{{ parseTime(scope.row.createTime) }}</span>
  67 + </template>
  68 + </el-table-column>
  69 + <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
  70 + <template v-slot="scope">
  71 + <el-button size="mini" type="text" icon="el-icon-circle-plus"
  72 + @click="selectMaterial(scope.row)">选择</el-button>
  73 + </template>
  74 + </el-table-column>
  75 + </el-table>
  76 + <!-- 分页组件 -->
  77 + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  78 + @pagination="getMaterialPage"/>
65 79 </div>
66 80 <div v-else-if="objData.type == 'news'">
67 81 <div class="waterfall" v-loading="loading">
... ... @@ -95,6 +109,8 @@
95 109 // import { tableOptionVoice } from '@/const/crud/wxmp/wxmaterial_voice'
96 110 // import { tableOptionVideo } from '@/const/crud/wxmp/wxmaterial_video'
97 111 import WxNews from '@/views/mp/components/wx-news/main.vue';
  112 + import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue';
  113 + import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue';
98 114 import { getMaterialPage } from "@/api/mp/material";
99 115 // import {getPage as getPageNews} from '@/api/wxmp/wxfreepublish'
100 116 // import {getPage as getPageNewsDraft} from '@/api/wxmp/wxdraft'
... ... @@ -102,7 +118,9 @@
102 118 export default {
103 119 name: "wxMaterialSelect",
104 120 components: {
105   - WxNews
  121 + WxNews,
  122 + WxVoicePlayer,
  123 + WxVideoPlayer
106 124 },
107 125 props: {
108 126 objData: {
... ...
yudao-ui-admin/src/views/mp/components/wx-reply/main.vue
... ... @@ -19,7 +19,7 @@
19 19 <!-- 情况一:已经选择好素材、或者上传好图片 -->
20 20 <div class="select-item" v-if="objData.url">
21 21 <img class="material-img" :src="objData.url">
22   - <p class="item-name" v-if="objData.repName">{{objData.repName}}</p> <!-- TODO 芋艿:永久素材,name 字段 -->
  22 + <p class="item-name" v-if="objData.name">{{objData.name}}</p>
23 23 <el-row class="ope-row">
24 24 <el-button type="danger" icon="el-icon-delete" circle @click="deleteObj"></el-button>
25 25 </el-row>
... ... @@ -54,7 +54,7 @@
54 54 <span slot="label"><i class="el-icon-phone"></i> 语音</span>
55 55 <el-row>
56 56 <div class="select-item2" v-if="objData.url">
57   - <p class="item-name">{{objData.repName}}</p> <!-- TODO 芋艿:永久素材,name 字段 -->
  57 + <p class="item-name">{{objData.name}}</p>
58 58 <div class="item-infos">
59 59 <wx-voice-player :url="objData.url" />
60 60 </div>
... ... @@ -315,22 +315,17 @@
315 315 this.objData.content = tempObjItem.content ? tempObjItem.content : null
316 316 this.objData.mediaId = tempObjItem.mediaId ? tempObjItem.mediaId : null
317 317 this.objData.url = tempObjItem.url ? tempObjItem.url : null
  318 + this.objData.name = tempObjItem.url ? tempObjItem.name : null
318 319  
319 320 // TODO 芋艿:临时注释掉,看看有没用
320   - // this.objData.repName = tempObjItem.repName ? tempObjItem.repName : null
321   - // this.objData.repMediaId = tempObjItem.repMediaId ? tempObjItem.repMediaId : null
322 321 // this.objData.repDesc = tempObjItem.repDesc ? tempObjItem.repDesc : null
323 322 return;
324 323 }
325 324 // 如果获取不到,需要把 objData 复原
  325 + this.objData.content = undefined;
326 326 this.objData.mediaId = undefined;
327 327 this.objData.url = undefined;
328   - this.objData.content = undefined;
329   - // this.$delete(this.objData,'repName')
330   - // this.$delete(this.objData,'repMediaId')
331   - // this.$delete(this.objData,'mediaId')
332   - // this.$delete(this.objData,'url')
333   - // this.$delete(this.objData,'content') // TODO 芋艿:貌似删除了,文本无法输入
  328 + this.objData.name = undefined;
334 329 // this.$delete(this.objData,'repDesc')
335 330 },
336 331 /**
... ... @@ -357,12 +352,16 @@
357 352 tempObjItem.hqMusicUrl = this.objData.hqMusicUrl
358 353 } else if (this.objData.type === 'image'
359 354 || this.objData.type === 'voice') {
360   - tempObjItem.mediaId = item.mediaId;
  355 + tempObjItem.mediaId = item.mediaId
361 356 this.objData.mediaId = item.mediaId
362   - tempObjItem.url = item.url;
363   - this.objData.url = item.url
364   - // tempObjItem.repName = item.name
365   - // this.objData.repName = item.name
  357 + if (item.url) {
  358 + tempObjItem.url = item.url;
  359 + this.objData.url = item.url;
  360 + } else { // 必须使用 $delete 删除,否则 vue 监听不到数据
  361 + this.$delete(this.objData, 'url');
  362 + }
  363 + tempObjItem.name = item.name
  364 + this.objData.name = item.name
366 365 } else if (this.objData.type === 'video') {
367 366 // getMaterialVideo({
368 367 // mediaId:item.mediaId
... ... @@ -401,6 +400,7 @@
401 400 this.dialogThumbVisible = false
402 401 },
403 402 deleteObj() {
  403 + console.log('删除!');
404 404 if (this.objData.type === 'news') {
405 405 // TODO 芋艿,待实现
406 406 } else if(this.objData.type === 'image'
... ...