Files
dvcp_v2_wxcp_app/src/apps/AppBroadcast1/AppResourcesManage/AppResourcesManage.vue
2022-06-11 13:43:59 +08:00

343 lines
7.7 KiB
Vue

<template>
<div class="AppResourcesManage">
<AiTopFixed>
<div class="currentLeft-top">
<div class="left">
<AiSelect @data="selectType" :list="typeList" v-model="type"></AiSelect>
</div>
<u-search v-model="keyword" :clearabled="true" placeholder="请输入素材名称/创建人员" :show-action="false" bg-color="#F5F5F5" search-icon-color="#ccc" color="#666" height="58" @search="getList" @clear="handerClear"></u-search>
</div>
<div class="tab">
<u-tabs :list="tab" :is-scroll="false" :current="currIndex" @change="change" height="96" :bar-style="barStyle"></u-tabs>
</div>
</AiTopFixed>
<div class="record" v-if="currIndex == 0">
<div class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)">
<img :src="`${$cdn}video/play-icon.png`" alt="" @click.stop="choose(item)">
<div class="info">
<p>{{ item.name ? item.name.split('.')[0] : '-' }}</p>
<div>{{ item.createUserName }}{{ item.createTime }}</div>
</div>
<div class="btn" @click.stop="toAddBroadcast(item)">发布</div>
</div>
</div>
<div class="record-text" v-else>
<div class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)">
<div class="info">
<div>{{ item.name }}</div>
<p>{{ item.content }}</p>
</div>
<div class="btn" @click.stop="toAddBroadcast(item)">发布</div>
</div>
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
<img src="./img/add-icon.png" alt="" class="add-img" @click="add">
<u-popup v-model="isShow" mode="bottom">
<div class="audio">
<AiVideo :src="url" autoplay></AiVideo>
<!-- <audio :src="url" ref="audio" :controls="true" :name="autioName" style="display: block;"></audio> -->
</div>
</u-popup>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: "AppResourcesManage",
data() {
return {
tab: [{name: '音频素材'}, {name: '文本素材'}],
list: [],
currIndex: 0,
current: 1,
isChoose: false,
isMore: false,
isShow: false,
url: '',
autioName: '',
audio: null,
barStyle: {width: '96px', bottom: '-3px', left: '-38px'},
keyword: '',
type: '0',
typeList: [{label: '全部', value: '0'}, {label: '我创建的', value: '1'},]
}
},
computed: { ...mapState(['user']) },
onLoad() {
this.getList()
uni.$on('getList', () => {
this.isMore = false
this.list = []
this.current = 1
this.$nextTick(() => {
this.getList()
})
})
},
onShow() {
document.title = '媒资管理'
},
methods: {
selectType(selecteds) {
this.type = selecteds?.[0]?.value
this.getListInit()
},
change(index) {
this.currIndex = index
this.getListInit()
},
add() {
uni.navigateTo({
url: `./addMedia?type=${this.currIndex === 0 ? 1 : 3}`
})
},
choose(item) {
this.url = item.url
this.isShow = true
},
handerClear() {
this.keyword = ''
this.getListInit()
},
getListInit() {
this.isMore = false
this.list = []
this.current = 1
this.getList()
},
getList() {
if (this.isMore) return
this.$http.post(`/app/appdlbresource/list`, null, {
params: {
name: this.keyword,
current: this.current,
size: 10,
createUserId: this.type == 1 ? this.user.id : ''
}
}).then(res => {
if (res.code == 0) {
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
} else {
this.list = res.data.records
}
uni.hideLoading()
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
uni.hideLoading()
}
}).catch(() => {
uni.hideLoading()
})
},
toDetail(item) {
uni.navigateTo({url: `./detail?id=${item.id}`})
},
toAddBroadcast(item) {
uni.navigateTo({ url: `../addPlay?mediaId=${item.id}&mediaName=${item.name}` })
}
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.AppResourcesManage {
padding-bottom: 128px;
::v-deep .AiTopFixed{
.content{
padding: 0;
}
}
.tab {
border-bottom: 1px solid #ddd;
margin-bottom: 4px;
}
.audio {
width: 100%;
height: 400px;
box-sizing: border-box;
padding: 104px 0 46px;
audio {
}
}
.record {
background-color: #fff;
.item {
width: 100%;
display: flex;
border-bottom: 1px solid #ddd;
padding: 32px 30px;
box-sizing: border-box;
img {
width: 56px;
height: 56px;
margin-right: 14px;
}
.info {
width: calc(100% - 256px);
line-height: 44px;
font-size: 34px;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #333;
p {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
}
div{
font-size: 26px;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #999;
line-height: 36px;
}
}
.btn{
width: 154px;
height: 60px;
line-height: 60px;
text-align: center;
background: #3975C6;
border-radius: 8px;
font-size: 30px;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #FFF;
margin-left: 32px;
}
.bg-AFD0FC{
background-color: #AFD0FC;
}
}
}
.record-text {
background-color: #fff;
.item {
width: 100%;
border-bottom: 1px solid #ddd;
padding: 32px 30px;
box-sizing: border-box;
font-size: 30px;
display: flex;
justify-content: space-between;
.info{
width: calc(100% - 190px);
div {
font-size: 30px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-bottom: 12px;
.color-0063E5 {
color: #0063E5;
}
.color-FF8100 {
color: #FF8100;
}
.color-FF4466 {
color: #FF4466;
}
}
p {
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666;
line-height: 40px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
word-break: break-all;
-webkit-box-orient: vertical;
}
}
.btn{
width: 154px;
height: 60px;
line-height: 60px;
text-align: center;
background: #3975C6;
border-radius: 8px;
font-size: 30px;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #FFF;
}
.bg-AFD0FC{
background-color: #AFD0FC;
}
}
}
.add-img {
width: 120px;
position: fixed;
bottom: 120px;
right: 32px;
}
.currentLeft-top {
display: flex;
align-items: center;
padding: 32px 32px 0;
.left {
width: 200px;
display: flex;
align-items: center;
img {
width: 48px;
height: 48px;
}
}
}
::v-deep .u-search {
margin-bottom: 0 !important;
}
}
</style>