mp:修复 WxMaterialSelect 组件的音乐 tab,无法选择图片素材报错

This commit is contained in:
YunaiV 2023-01-15 19:09:13 +08:00
parent 0499226c3d
commit 3654afedcc
2 changed files with 437 additions and 471 deletions

View File

@ -137,7 +137,7 @@
</el-row> </el-row>
</div> </div>
<el-dialog title="选择图文" :visible.sync="dialogNewsVisible" width="90%" append-to-body> <el-dialog title="选择图文" :visible.sync="dialogNewsVisible" width="90%" append-to-body>
<WxMaterialSelect :objData="objData" @selectMaterial="selectMaterial" :newsType="newsType"></WxMaterialSelect> <wx-material-select :objData="objData" @selectMaterial="selectMaterial" :newsType="newsType" />
</el-dialog> </el-dialog>
</el-row> </el-row>
</el-tab-pane> </el-tab-pane>
@ -158,7 +158,7 @@
</div> </div>
</div> </div>
<el-dialog title="选择图片" :visible.sync="dialogThumbVisible" width="80%" append-to-body> <el-dialog title="选择图片" :visible.sync="dialogThumbVisible" width="80%" append-to-body>
<wx-material-select :objData="{type:'image'}" @selectMaterial="selectMaterial" /> <wx-material-select :objData="{type:'image', accountId: objData.accountId}" @selectMaterial="selectMaterial" />
</el-dialog> </el-dialog>
</el-col> </el-col>
<el-col :span="18"> <el-col :span="18">
@ -176,14 +176,14 @@
</template> </template>
<script> <script>
// import { getPage, getMaterialVideo } from '@/api/wxmp/wxmaterial' import WxNews from '@/views/mp/components/wx-news/main.vue'
import {getAccessToken} from '@/utils/auth' import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue'
import WxNews from '@/views/mp/components/wx-news/main.vue' import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue';
import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue' import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue';
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue';
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue';
export default { import { getAccessToken } from '@/utils/auth'
export default {
name: "wxReplySelect", name: "wxReplySelect",
components: { components: {
WxNews, WxNews,
@ -206,15 +206,6 @@
tempPlayerObj: { tempPlayerObj: {
type: '2' type: '2'
}, },
tableData: [],
page: {
total: 0, //
currentPage: 1, //
pageSize: 20, //
ascs:[],//
descs:[]//
},
tableLoading: false,
tempObj: new Map().set( // tab tempObj: new Map().set( // tab
this.objData.type, // this.objData.type, //
@ -259,7 +250,6 @@
return true; return true;
}, },
beforeVoiceUpload(file){ beforeVoiceUpload(file){
this.tableLoading = true
// //
const isType = file.type === 'audio/mp3' const isType = file.type === 'audio/mp3'
|| file.type === 'audio/mpeg' || file.type === 'audio/mpeg'
@ -464,25 +454,6 @@
// //
this.tempObj.set(this.objData.type, Object.assign({}, this.objData)); this.tempObj.set(this.objData.type, Object.assign({}, this.objData));
}, },
getPage(page, params) {
this.tableLoading = true
// getPage(Object.assign({
// current: page.currentPage,
// size: page.pageSize,
// type:this.objData.type
// }, params)).then(response => {
// this.tableData = response.data.items
// this.page.total = response.data.totalCount
// this.page.currentPage = page.currentPage
// this.page.pageSize = page.pageSize
// this.tableLoading = false
// })
},
sizeChange(val) {
this.page.currentPage = 1
this.page.pageSize = val
this.getPage(this.page)
},
/** /**
* 输入时缓存每次 objData tempObj * 输入时缓存每次 objData tempObj
* *
@ -493,64 +464,64 @@
this.tempObj.set(this.objData.type, Object.assign({}, this.objData)); this.tempObj.set(this.objData.type, Object.assign({}, this.objData));
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.public-account-management{ .public-account-management{
.el-input{ .el-input{
width: 70%; width: 70%;
margin-right: 2%; margin-right: 2%;
} }
} }
.pagination{ .pagination{
text-align: right; text-align: right;
margin-right: 25px; margin-right: 25px;
} }
.select-item{ .select-item{
width: 280px; width: 280px;
padding: 10px; padding: 10px;
margin: 0 auto 10px auto; margin: 0 auto 10px auto;
border: 1px solid #eaeaea; border: 1px solid #eaeaea;
} }
.select-item2{ .select-item2{
padding: 10px; padding: 10px;
margin: 0 auto 10px auto; margin: 0 auto 10px auto;
border: 1px solid #eaeaea; border: 1px solid #eaeaea;
} }
.ope-row{ .ope-row{
padding-top: 10px; padding-top: 10px;
text-align: center; text-align: center;
} }
.item-name{ .item-name{
font-size: 12px; font-size: 12px;
overflow: hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow:ellipsis;
white-space: nowrap; white-space: nowrap;
text-align: center; text-align: center;
} }
.el-form-item__content{ .el-form-item__content{
line-height:unset!important; line-height:unset!important;
} }
.col-select{ .col-select{
border: 1px solid rgb(234, 234, 234); border: 1px solid rgb(234, 234, 234);
padding: 50px 0px; padding: 50px 0px;
height: 160px; height: 160px;
width: 49.5%; width: 49.5%;
} }
.col-select2{ .col-select2{
border: 1px solid rgb(234, 234, 234); border: 1px solid rgb(234, 234, 234);
padding: 50px 0px; padding: 50px 0px;
height: 160px; height: 160px;
} }
.col-add{ .col-add{
border: 1px solid rgb(234, 234, 234); border: 1px solid rgb(234, 234, 234);
padding: 50px 0px; padding: 50px 0px;
height: 160px; height: 160px;
width: 49.5%; width: 49.5%;
float: right float: right
} }
.avatar-uploader-icon { .avatar-uploader-icon {
border: 1px solid #d9d9d9; border: 1px solid #d9d9d9;
font-size: 28px; font-size: 28px;
color: #8c939d; color: #8c939d;
@ -558,16 +529,16 @@
height: 100px!important; height: 100px!important;
line-height: 100px!important; line-height: 100px!important;
text-align: center; text-align: center;
} }
.material-img { .material-img {
width: 100%; width: 100%;
} }
.thumb-div{ .thumb-div{
display: inline-block; display: inline-block;
text-align: center; text-align: center;
} }
.item-infos{ .item-infos{
width: 30%; width: 30%;
margin: auto margin: auto
} }
</style> </style>

View File

@ -116,7 +116,7 @@ SOFTWARE.
<div class="select-item" v-if="tempObj && tempObj.content && tempObj.content.articles"> <div class="select-item" v-if="tempObj && tempObj.content && tempObj.content.articles">
<WxNews :objData="tempObj.content.articles"></WxNews> <WxNews :objData="tempObj.content.articles"></WxNews>
<el-row class="ope-row"> <el-row class="ope-row">
<el-button type="danger" icon="el-icon-delete" circle @click="deleteTempObj"></el-button> <el-button type="danger" icon="el-icon-delete" circle @click="deleteTempObj" />
</el-row> </el-row>
</div> </div>
<div v-if="!tempObj.content || !tempObj.content.articles"> <div v-if="!tempObj.content || !tempObj.content.articles">
@ -183,12 +183,10 @@ export default {
nameMaxLength: 0, // 1 4 2 7 nameMaxLength: 0, // 1 4 2 7
showConfigureContent: true, // showConfigureContent: true, //
hackResetWxReplySelect: false, // WxReplySelect hackResetWxReplySelect: false, // WxReplySelect
tempObj: {}, // tempObj: {}, //
tempSelfObj: { // tempObjmenu tempSelfObj: { // tempObjmenu
}, },
visible2: false, // "" dialogNewsVisible: false, //
tableData:[], //,
menuOptions: [{ menuOptions: [{
value: 'view', value: 'view',
label: '跳转网页' label: '跳转网页'
@ -220,7 +218,6 @@ export default {
value: 'location_select', value: 'location_select',
label: '选择地理位置' label: '选择地理位置'
}], }],
dialogNewsVisible: false,
// //
accounts: [], accounts: [],
@ -357,13 +354,13 @@ export default {
if (!item.children || item.children.length <= 0) { if (!item.children || item.children.length <= 0) {
this.$set( item, 'children',[]) this.$set( item, 'children',[])
this.$delete( item, 'type') this.$delete( item, 'type')
this.$delete( item, 'menuKey')
this.$delete( item, 'miniProgramAppId') this.$delete( item, 'miniProgramAppId')
this.$delete( item, 'miniProgramPagePath') this.$delete( item, 'miniProgramPagePath')
this.$delete( item, 'url') this.$delete( item, 'url')
this.$delete( item, 'reply') this.$delete( item, 'reply')
// TODO // TODO
this.$delete( item, 'key')
this.$delete( item, 'article_id') this.$delete( item, 'article_id')
this.$delete( item, 'textContent') this.$delete( item, 'textContent')
this.showConfigureContent = false this.showConfigureContent = false
@ -470,15 +467,8 @@ export default {
} }
return result; return result;
}, },
// ======================== ========================
// TODO openMaterial() {
deleteTempObj(){
this.$delete(this.tempObj,'repName')
this.$delete(this.tempObj,'repUrl')
this.$delete(this.tempObj,'content')
},
openMaterial(){
this.dialogNewsVisible = true this.dialogNewsVisible = true
}, },
selectMaterial(item){ selectMaterial(item){
@ -495,6 +485,11 @@ export default {
item.content.articles = item.content.articles.slice(0,1) item.content.articles = item.content.articles.slice(0,1)
this.tempObj.content = item.content this.tempObj.content = item.content
}, },
deleteTempObj() {
this.$delete(this.tempObj,'repName')
this.$delete(this.tempObj,'repUrl')
this.$delete(this.tempObj,'content')
},
}, },
} }
</script> </script>