Commit adf35da4 authored by 王's avatar

群发助手优化

parent d0645b51
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
<el-input v-model="searchFrom.user_ids"></el-input> <el-input v-model="searchFrom.user_ids"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="6" :offset="2">
<el-button type="primary" @click="onSelectUser">选择用户</el-button> <el-button type="primary" @click="onSelectUser">选择用户</el-button>
</el-col> </el-col>
</el-row> </el-row>
...@@ -157,7 +157,8 @@ ...@@ -157,7 +157,8 @@
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="图片" name="image"> <el-tab-pane label="图片" name="image">
<div class="inner-edit_area"> <div class="flex-start">
<div>
<el-upload <el-upload
action="/api/public/upload/zone" action="/api/public/upload/zone"
:http-request="uploadFile" :http-request="uploadFile"
...@@ -170,8 +171,37 @@ ...@@ -170,8 +171,37 @@
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
</el-upload> </el-upload>
</div> </div>
<div class="display-b" style="margin-left: 10px">
<div class="choose_item" style="color: #888;" @click="getMediaList()"><i class="el-icon-plus" style="color: #8c939d"></i>从素材库中选择</div>
</div>
</div>
<div v-if="showImage && mediaImageList.length > 0">
<el-table
:data="mediaImageList"
@row-click="onChooseMedia"
style="width: 100%">
<el-table-column
prop="name"
label="名称">
</el-table-column>
<el-table-column
prop="media_id"
label="mediaId">
</el-table-column>
<el-table-column
label="URL">
<template slot-scope="scope">
<a :href="scope.row.url">
<img style="width: 60px;" :src="scope.row.url"/>
</a>
</template>
</el-table-column>
</el-table>
<page-image :total="mediaImagePage.total" v-model="mediaImagePage.nowPage" :limit="mediaImagePage.limit" @pageChange="onImagePageChange" @sizeChange="onImageSizeChange"/>
</div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="视频" name="video"> <el-tab-pane label="视频" name="video">
<div class="flex-start">
<el-upload <el-upload
class="upload-video" class="upload-video"
action="/api/public/upload/zone" action="/api/public/upload/zone"
...@@ -184,6 +214,34 @@ ...@@ -184,6 +214,34 @@
<el-progress v-if="fileUid" :percentage="progress"></el-progress> <el-progress v-if="fileUid" :percentage="progress"></el-progress>
</div> </div>
</el-upload> </el-upload>
<div class="display-b">
<div class="choose_item" style="color: #888;" @click="getMediaList()"><i class="el-icon-plus" style="color: #8c939d"></i>从素材库中选择</div>
</div>
</div>
<div v-if="showVideo && mediaVideoList.length > 0">
<el-table
:data="mediaVideoList"
@row-click="onChooseMedia"
style="width: 100%">
<el-table-column
prop="name"
label="名称">
</el-table-column>
<el-table-column
prop="media_id"
label="mediaId">
</el-table-column>
<el-table-column
label="URL">
<template slot-scope="scope">
<a :href="scope.row.info.down_url" target="_blank" v-if="scope.row.info && scope.row.info.down_url">
{{scope.row.info.title}}
</a>
</template>
</el-table-column>
</el-table>
<page :total="total" v-model="nowPage" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/>
</div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="图文" name="news"> <el-tab-pane label="图文" name="news">
<div v-if="newsContent && newsContent.content && newsContent.content.news_item"> <div v-if="newsContent && newsContent.content && newsContent.content.news_item">
...@@ -217,7 +275,7 @@ ...@@ -217,7 +275,7 @@
<i class="el-icon-delete" @click="newsContent=''" style="display: inline-block"></i> <i class="el-icon-delete" @click="newsContent=''" style="display: inline-block"></i>
</div> </div>
<div class="display-b"> <div class="display-b">
<div class="choose_item" style="color: #888;" @click="getMediaList()">+从素材库中选择</div> <div class="choose_item" style="color: #888;" @click="getMediaList()"><i class="el-icon-plus" style="color: #8c939d"></i>从素材库中选择</div>
</div> </div>
<div v-if="showMedia && mediaList.length > 0"> <div v-if="showMedia && mediaList.length > 0">
<el-table <el-table
...@@ -329,6 +387,8 @@ ...@@ -329,6 +387,8 @@
import {uploadFileApi,getMsgListApi,sendMsgApi,getUserListApi,getMediaListApi} from "../../service/api"; import {uploadFileApi,getMsgListApi,sendMsgApi,getUserListApi,getMediaListApi} from "../../service/api";
import page from '../framework/page' import page from '../framework/page'
import page2 from '../framework/page' import page2 from '../framework/page'
import pageImage from '../framework/page'
import pageVideo from '../framework/page'
import emotion from '../framework/Emotion/index' import emotion from '../framework/Emotion/index'
import CommonJs from '../../util/common'; import CommonJs from '../../util/common';
export default { export default {
...@@ -336,6 +396,8 @@ ...@@ -336,6 +396,8 @@
components: { components: {
page, page,
page2, page2,
pageImage,
pageVideo,
emotion emotion
}, },
data() { data() {
...@@ -346,7 +408,7 @@ ...@@ -346,7 +408,7 @@
mediaPage: { mediaPage: {
nowPage: 1, nowPage: 1,
total: 0, total: 0,
limit: 10, limit: 5,
}, },
show: false, show: false,
loading: false, loading: false,
...@@ -375,7 +437,21 @@ ...@@ -375,7 +437,21 @@
multipleSelection: [], multipleSelection: [],
showEmotion: false, showEmotion: false,
showMedia: false, showMedia: false,
showImage: false,
showVideo: false,
mediaList: [], mediaList: [],
mediaImageList: [],
mediaVideoList: [],
mediaImagePage: {
nowPage: 1,
total: 0,
limit: 5,
},
mediaVideoPage: {
nowPage: 1,
total: 0,
limit: 5,
},
imageContent: null, imageContent: null,
videoContent: null, videoContent: null,
newsContent: null newsContent: null
...@@ -598,6 +674,24 @@ ...@@ -598,6 +674,24 @@
this.mediaPage.limit = val this.mediaPage.limit = val
this.getMediaList() this.getMediaList()
}, },
onImagePageChange(val){
this.mediaImagePage.nowPage = val
this.getMediaList()
},
onImageSizeChange(val){
this.mediaImagePage.nowPage = 1
this.mediaImagePage.limit = val
this.getMediaList()
},
onVideoPageChange(val){
this.mediaVideoPage.nowPage = val
this.getMediaList()
},
onVideoSizeChange(val){
this.mediaVideoPage.nowPage = 1
this.mediaVideoPage.limit = val
this.getMediaList()
},
onPageChange(val){ onPageChange(val){
this.nowPage = val this.nowPage = val
this.getMsgList() this.getMsgList()
...@@ -697,14 +791,25 @@ ...@@ -697,14 +791,25 @@
this.content += i this.content += i
}, },
onChooseMedia(val){ onChooseMedia(val){
console.log('onChooseMedia', val)
if (this.type === 'image') { if (this.type === 'image') {
this.imageContent = val this.imageContent = {
content: val.media_id,
url: val.url
}
this.imageList = [{name:val.media_id,url:val.url}]
this.showImage = false;
} else if (this.type === 'video'){ } else if (this.type === 'video'){
this.videoContent = val this.videoContent = {
content: val.media_id,
url: val.info.down_url
}
this.fileList = [{name:val.info.title,url:val.info.url}]
this.showVideo = false;
} else if (this.type === 'news'){ } else if (this.type === 'news'){
this.newsContent = val this.newsContent = val
}
this.showMedia = false; this.showMedia = false;
}
}, },
getMediaList(){ getMediaList(){
let type = this.activeName; let type = this.activeName;
...@@ -713,13 +818,35 @@ ...@@ -713,13 +818,35 @@
page: this.mediaPage.nowPage, page: this.mediaPage.nowPage,
limit: this.mediaPage.limit limit: this.mediaPage.limit
}; };
this.loading = true; if(type === 'image'){
json.page = this.mediaImagePage.nowPage
json.limit = this.mediaImagePage.limit
this.showImage = true;
}else if (type === 'video'){
json.page = this.mediaVideoPage.nowPage
json.limit = this.mediaVideoPage.limit
this.showVideo = true;
}else if (type === 'news'){
json.page = this.mediaPage.nowPage
json.limit = this.mediaPage.limit
this.showMedia = true; this.showMedia = true;
}
this.loading = true;
getMediaListApi(json).then(res=>{ getMediaListApi(json).then(res=>{
this.loading = false; this.loading = false;
this.type = type; this.type = type;
this.mediaList = res.item; this.mediaList = res.item;
this.mediaPage.total = res.total_count; this.mediaPage.total = res.total_count;
if(type === 'image'){
this.mediaImageList = res.item;
this.mediaImagePage.total = res.total_count;
}else if (type === 'video'){
this.mediaVideoList = res.item;
this.mediaVideoPage.total = res.total_count;
}else if (type === 'news'){
this.mediaList = res.item;
this.mediaPage.total = res.total_count;
}
if (this.total === 0 ) { if (this.total === 0 ) {
this.$message({ this.$message({
showClose: true, showClose: true,
...@@ -804,13 +931,15 @@ ...@@ -804,13 +931,15 @@
margin-top: 20px; margin-top: 20px;
} }
.choose_item { .choose_item {
box-sizing: border-box;
margin-bottom: 25px; margin-bottom: 25px;
color: rgb(136, 136, 136); color: rgb(136, 136, 136);
height: 80px; height: 148px;
line-height: 80px; line-height: 148px;
width: 45%; width: 148px;
border: 1px dashed;
text-align: center; text-align: center;
border: 1px dashed #c0ccda;
border-radius: 6px;
} }
.display-b { .display-b {
display: flex; display: flex;
...@@ -911,16 +1040,22 @@ ...@@ -911,16 +1040,22 @@
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.flex-start {
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: flex-start;
}
</style> </style>
<style> <style>
.el-radio-group { .el-radio-group {
display: flex; display: flex !important;
flex-flow: column; flex-flow: column;
justify-content: flex-start; justify-content: flex-start;
align-items: flex-start; align-items: flex-start;
} }
.el-radio+.el-radio { .el-radio+.el-radio {
margin-left: 0; margin-left: 0 !important;
} }
.el-radio { .el-radio {
margin-bottom: 6px; margin-bottom: 6px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment