Files
dvcp_v2_wxcp_app/src/apps/AppResourcesManage/AppResourcesManage.vue

253 lines
5.2 KiB
Vue
Raw Normal View History

2021-11-15 10:29:05 +08:00
<template>
2021-12-16 18:30:17 +08:00
<div class="AppResourcesManage">
2021-11-15 10:29:05 +08:00
<div class="tab">
2021-12-15 14:37:20 +08:00
<u-tabs :list="tab" :is-scroll="false" :current="currIndex" @change="change" height="96"
:bar-style="barStyle"></u-tabs>
2021-11-15 10:29:05 +08:00
</div>
<div class="record" v-if="currIndex == 0">
<div class="item" v-for="(item, index) in list" :key="index" @click="choose(item)">
2021-12-16 18:30:17 +08:00
<img :src="`${$cdn}video/play-icon.png`" alt="">
2021-11-15 10:29:05 +08:00
<div class="info">
<p>{{ item.name ? item.name.split('.')[0] : '-' }}</p>
</div>
</div>
</div>
<div class="record-text" v-else>
<div class="item" v-for="(item, index) in list" :key="index" @click="choose(item)">
<div>{{ item.name }}</div>
<p>{{ item.content }}</p>
</div>
</div>
2021-12-23 11:27:28 +08:00
<img src="./img/add-icon.png" alt="" class="add-img" @click="add">
2021-11-15 10:29:05 +08:00
<u-popup v-model="isShow" mode="bottom">
<div class="audio">
<AiVideo :src="url" autoplay></AiVideo>
2021-12-15 14:37:20 +08:00
<!-- <audio :src="url" ref="audio" :controls="true" :name="autioName" style="display: block;"></audio> -->
2021-11-15 10:29:05 +08:00
</div>
2021-12-15 14:37:20 +08:00
</u-popup>
2021-12-16 18:30:17 +08:00
<AiBack/>
2021-11-15 10:29:05 +08:00
</div>
</template>
2021-12-15 14:37:20 +08:00
<script>
export default {
2021-12-16 18:30:17 +08:00
name: "AppResourcesManage",
appName: "媒资管理",
2021-12-15 14:37:20 +08:00
data() {
return {
tab: [{name: '音频素材'}, {name: '文本素材'}],
list: [],
currIndex: 0,
current: 1,
isChoose: false,
isMore: false,
isShow: false,
url: '',
autioName: '',
audio: null,
barStyle: {width: '98px', bottom: '-3px', left: '-38px'}
}
},
onLoad(query) {
2021-12-16 18:30:17 +08:00
this.isChoose = !!query.isChoose
2021-12-15 14:37:20 +08:00
this.getList()
2021-12-16 18:30:17 +08:00
uni.$on('getList', () => {
2021-12-15 14:37:20 +08:00
this.isMore = false
this.list = []
this.current = 1
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
this.$nextTick(() => {
this.getList()
})
})
},
methods: {
change(index) {
this.isMore = false
this.list = []
this.current = 1
this.currIndex = index
this.$nextTick(() => {
this.getList()
})
2021-11-15 10:29:05 +08:00
},
2021-12-15 14:37:20 +08:00
add() {
uni.navigateTo({
2021-12-16 18:30:17 +08:00
url: `./addPlay?type=${this.currIndex === 0 ? 1 : 3}`
2021-11-15 10:29:05 +08:00
})
},
2021-12-15 14:37:20 +08:00
choose(item) {
if (!this.isChoose) {
console.log(item.url)
this.url = item.url
this.isShow = true
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
return false
}
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
uni.$emit('choose', {
mediaId: item.id,
mediaName: item.name
})
uni.navigateBack({
delta: 1
})
},
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
getList() {
if (this.isMore) return
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
this.$http.post(`/app/appdlbresource/list`, null, {
params: {
...this.search,
type: this.currIndex === 0 ? 1 : 3,
current: this.current,
size: 10
}
}).then(res => {
if (res.code == 0) {
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
2021-11-15 10:29:05 +08:00
} else {
2021-12-15 14:37:20 +08:00
this.list = res.data.records
2021-11-15 10:29:05 +08:00
}
2021-12-15 14:37:20 +08:00
2021-11-15 10:29:05 +08:00
uni.hideLoading()
2021-12-15 14:37:20 +08:00
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
uni.hideLoading()
}
}).catch(() => {
uni.hideLoading()
})
2021-11-15 10:29:05 +08:00
}
2021-12-15 14:37:20 +08:00
},
onReachBottom() {
this.getList()
2021-11-15 10:29:05 +08:00
}
2021-12-15 14:37:20 +08:00
}
2021-11-15 10:29:05 +08:00
</script>
<style lang="scss" scoped>
2021-12-16 18:30:17 +08:00
.AppResourcesManage {
2021-11-15 10:29:05 +08:00
padding-bottom: 128px;
2021-12-15 14:37:20 +08:00
.tab {
2021-11-15 10:29:05 +08:00
border-bottom: 1px solid #ddd;
margin-bottom: 4px;
}
.audio {
width: 100%;
2021-12-16 18:30:17 +08:00
height: 400px;
2021-11-15 10:29:05 +08:00
box-sizing: border-box;
2021-12-16 18:30:17 +08:00
padding: 104px 0 46px;
2021-12-15 14:37:20 +08:00
2021-11-15 10:29:05 +08:00
audio {
}
}
2021-12-15 14:37:20 +08:00
.record {
2021-11-15 10:29:05 +08:00
background-color: #fff;
2021-12-15 14:37:20 +08:00
.item {
2021-11-15 10:29:05 +08:00
width: 100%;
display: flex;
border-bottom: 1px solid #ddd;
padding: 32px 30px;
box-sizing: border-box;
2021-12-15 14:37:20 +08:00
img {
2021-11-15 10:29:05 +08:00
width: 56px;
height: 56px;
margin-right: 14px;
}
2021-12-15 14:37:20 +08:00
.info {
2021-11-15 10:29:05 +08:00
width: calc(100% - 70px);
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;
}
}
}
}
2021-12-15 14:37:20 +08:00
.record-text {
background-color: #fff;
.item {
2021-11-15 10:29:05 +08:00
width: 100%;
border-bottom: 1px solid #ddd;
padding: 32px 30px;
box-sizing: border-box;
font-size: 30px;
2021-12-15 14:37:20 +08:00
div {
2021-11-15 10:29:05 +08:00
font-size: 30px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333;
2021-12-15 14:37:20 +08:00
overflow: hidden;
text-overflow: ellipsis;
2021-11-15 10:29:05 +08:00
white-space: nowrap;
margin-bottom: 12px;
2021-12-15 14:37:20 +08:00
.color-0063E5 {
2021-11-15 10:29:05 +08:00
color: #0063E5;
}
2021-12-15 14:37:20 +08:00
.color-FF8100 {
2021-11-15 10:29:05 +08:00
color: #FF8100;
}
2021-12-15 14:37:20 +08:00
.color-FF4466 {
2021-11-15 10:29:05 +08:00
color: #FF4466;
}
}
2021-12-15 14:37:20 +08:00
p {
2021-11-15 10:29:05 +08:00
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;
}
}
}
2021-12-15 14:37:20 +08:00
.add-img {
2021-11-15 10:29:05 +08:00
width: 120px;
position: fixed;
bottom: 120px;
right: 32px;
}
}
</style>