Commit 2d8f2129 authored by Mac's avatar Mac

修改素材 选择图片和音频的上传按钮

parent 679838c5
<template> <template>
<div class="ChooseImg" style="width: 900px; max-width: 80vw;"> <div class="ChooseImg" style="width: 900px; max-width: 80vw;">
<div style="margin:10px;">选择图片</div> <div style="margin:10px;" v-if="type==1|| type==0">选择图片</div>
<div style="margin:10px;" v-if="type==2">选择音频</div>
<div style="margin:10px;" v-if="type==3">选择视频</div>
<el-row v-loading="loading" style="border: 1px solid rgb(227, 227, 227);"> <el-row v-loading="loading" style="border: 1px solid rgb(227, 227, 227);">
<el-col :span="24"> <el-col :span="24">
<div style="margin-top: 10px;margin-left: 20px;" class="appendInput"> <div style="margin-top: 10px;margin-left: 20px;display: flex;" class="appendInput">
<el-input size="small" style="width:250px" placeholder="请输入内容" @keyup.enter.native="GetPageList" v-model="msg.MediaName"> <el-input size="small" style="width:250px" placeholder="请输入内容" @keyup.enter.native="GetPageList" v-model="msg.MediaName">
<el-button @click="GetPageList" slot="append" icon="el-icon-search"></el-button> <el-button @click="GetPageList" slot="append" icon="el-icon-search"></el-button>
</el-input> </el-input>
<q-btn color="accent" size="sm" class="q-mr-md" icon="cloud_upload" style="margin-left: 15px;" @click="goadd" label="上传"></q-btn>
</div> </div>
<!-- type=0 图片单选 --> <!-- type=0 图片单选 -->
<template v-if="type==0"> <template v-if="type==0">
<div class="basefix app-attachment-list"> <div class="basefix app-attachment-list" v-if="dataList && dataList.length>0">
<el-tooltip v-for="(item,index) in dataList" :key="index" class="item" effect="dark" <el-tooltip v-for="(item,index) in dataList" :key="index" class="item" effect="dark"
:content="item.MediaGroupName" placement="top-start"> :content="item.MediaGroupName" placement="top-start">
<div @click="PageSelect(item)" :class="getChecked(item) ? 'selected' :''" <div @click="PageSelect(item)" :class="getChecked(item) ? 'selected' :''"
...@@ -20,10 +24,11 @@ ...@@ -20,10 +24,11 @@
</div> </div>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>
<!-- type=1 图片多选 --> <!-- type=1 图片多选 -->
<template v-if="type==1"> <template v-if="type==1">
<div class="basefix app-attachment-list"> <div class="basefix app-attachment-list" v-if="dataList && dataList.length>0">
<el-tooltip v-for="(item,index) in dataList" :key="index" class="item" effect="dark" <el-tooltip v-for="(item,index) in dataList" :key="index" class="item" effect="dark"
:content="item.MediaGroupName" placement="top-start"> :content="item.MediaGroupName" placement="top-start">
<div @click="PageSelect(item)" :class="getChecked(item) ? 'selected' :''" <div @click="PageSelect(item)" :class="getChecked(item) ? 'selected' :''"
...@@ -36,7 +41,7 @@ ...@@ -36,7 +41,7 @@
</template> </template>
<!-- type2 音频 --> <!-- type2 音频 -->
<template v-if="type==2"> <template v-if="type==2">
<div class="basefix app-attachment-list"> <div class="basefix app-attachment-list" v-if="dataList && dataList.length>0">
<el-tooltip v-for="(x,y) in dataList" :key="y" class="item" effect="dark" <el-tooltip v-for="(x,y) in dataList" :key="y" class="item" effect="dark"
:content="x.MediaGroupName" placement="top-start"> :content="x.MediaGroupName" placement="top-start">
<div @click="PageSelect(x)" :class="getChecked(x) ? 'selected' :''" <div @click="PageSelect(x)" :class="getChecked(x) ? 'selected' :''"
...@@ -54,7 +59,7 @@ ...@@ -54,7 +59,7 @@
</template> </template>
<!-- type3 视频 --> <!-- type3 视频 -->
<template v-if="type==3"> <template v-if="type==3">
<div class="basefix app-attachment-list"> <div class="basefix app-attachment-list" v-if="dataList && dataList.length>0">
<el-tooltip v-for="(x,y) in dataList" :key="y" class="item" effect="dark" <el-tooltip v-for="(x,y) in dataList" :key="y" class="item" effect="dark"
:content="x.MediaGroupName" placement="top-start"> :content="x.MediaGroupName" placement="top-start">
<div style="width:200px;height:185px;padding:10px;" @click.stop="PageSelect(x)" :class="getChecked(x) ? 'selected' :''" <div style="width:200px;height:185px;padding:10px;" @click.stop="PageSelect(x)" :class="getChecked(x) ? 'selected' :''"
...@@ -68,6 +73,9 @@ ...@@ -68,6 +73,9 @@
</div> </div>
</template> </template>
<div style="width: 100%;display: flex;align-items: center;justify-content: center;height: 100px;" v-if="dataList.length==0">
暂无数据
</div>
<div style="padding:0 10px 10px 0"> <div style="padding:0 10px 10px 0">
<el-pagination style="text-align:right" background :current-page="currentPage" <el-pagination style="text-align:right" background :current-page="currentPage"
@current-change="handleCurrentChange" :page-size="msg.pageSize" layout="prev, pager, next,jumper" @current-change="handleCurrentChange" :page-size="msg.pageSize" layout="prev, pager, next,jumper"
...@@ -80,10 +88,19 @@ ...@@ -80,10 +88,19 @@
<el-button size="small" @click="closeDialog">取消</el-button> <el-button size="small" @click="closeDialog">取消</el-button>
<el-button size="small" type="primary" @click="SelectImgId">选定</el-button> <el-button size="small" type="primary" @click="SelectImgId">选定</el-button>
</div> </div>
<div v-if="Isadd==true">
<alladdsc :allclassifyList="allclassifyList" :type='msg.Type' @editsuccess="getchildren" :editobj='editobj'
@getcancel='Isadd=false'></alladdsc>
</div>
</div> </div>
</template> </template>
<script> <script>
import alladdsc from '../components/alladdsc'
import {
GetContributeMediumGroupList,
} from '../../../api/system/wechat';
import { import {
GetContributeMediumPage GetContributeMediumPage
} from '../../../api/system/wechat'; } from '../../../api/system/wechat';
...@@ -91,6 +108,9 @@ ...@@ -91,6 +108,9 @@
export default { export default {
name: 'ChooseImg', name: 'ChooseImg',
components: {
alladdsc
},
props: { props: {
type: { type: {
type: Number, type: Number,
...@@ -119,9 +139,14 @@ ...@@ -119,9 +139,14 @@
PageCount:0, PageCount:0,
dataList:[], dataList:[],
playRec: null, //播放对象 playRec: null, //播放对象
Isadd: false,
editobj: null,
allclassifyList:[],
} }
}, },
created() {}, created() {
this.getWeChatMediumGroupList()
},
computed: { computed: {
}, },
...@@ -137,6 +162,11 @@ ...@@ -137,6 +162,11 @@
this.GetPageList(); this.GetPageList();
}, },
methods: { methods: {
getWeChatMediumGroupList() {
GetContributeMediumGroupList({}).then(res => {
this.allclassifyList = JSON.parse(JSON.stringify(res.Data))
})
},
playVoice(_url, index) { playVoice(_url, index) {
// TODO 这里暂时没处理 音频播放中暂停 // TODO 这里暂时没处理 音频播放中暂停
let vm = this let vm = this
...@@ -263,6 +293,13 @@ ...@@ -263,6 +293,13 @@
this.loading = false this.loading = false
}) })
}, },
goadd(){
this.Isadd = true;
},
getchildren(){
this.handleCurrentChange(1)
this.Isadd = false
},
}, },
} }
...@@ -349,5 +386,16 @@ ...@@ -349,5 +386,16 @@
border-left: none; border-left: none;
padding: 0 15px; padding: 0 15px;
} }
.materialupload {
width: 118px;
height: 118px;
border-radius: 4px;
border: 1px dashed #d9d9d9;
background: #fafafa;
display: flex;
align-items: center;
justify-content: center;
padding: 4px;
}
</style> </style>
...@@ -350,6 +350,7 @@ ...@@ -350,6 +350,7 @@
} else { } else {
that.$forceUpdate(); that.$forceUpdate();
that.addMsg.Path = res.FileUrl; that.addMsg.Path = res.FileUrl;
that.addMsg.MediaName = res.FileName?res.FileName:'';
that.addMsg.Minutes = parseInt(that.duration.toFixed()); that.addMsg.Minutes = parseInt(that.duration.toFixed());
console.log(that.addMsg.Minutes, 'Minutes'); console.log(that.addMsg.Minutes, 'Minutes');
} }
...@@ -393,6 +394,7 @@ ...@@ -393,6 +394,7 @@
amr.initWithUrl(res.FileUrl).then(function () { amr.initWithUrl(res.FileUrl).then(function () {
that.duration = amr.getDuration(); that.duration = amr.getDuration();
that.addMsg.Path = res.FileUrl; that.addMsg.Path = res.FileUrl;
that.addMsg.MediaName = res.FileName?res.FileName:'';
that.addMsg.Minutes = parseInt(that.duration.toFixed()); that.addMsg.Minutes = parseInt(that.duration.toFixed());
}).catch((e) => { }).catch((e) => {
......
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