246 lines
5.5 KiB
Vue
246 lines
5.5 KiB
Vue
|
|
<template>
|
||
|
|
<div class="resourcesManage">
|
||
|
|
<div class="tab">
|
||
|
|
<u-tabs :list="tab" :is-scroll="false" :current="currIndex" @change="change" height="96" :bar-style="barStyle"></u-tabs>
|
||
|
|
</div>
|
||
|
|
<div class="record" v-if="currIndex == 0">
|
||
|
|
<div class="item" v-for="(item, index) in list" :key="index" @click="choose(item)">
|
||
|
|
<img src="./img/play-icon.png" alt="">
|
||
|
|
<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>
|
||
|
|
<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>
|
||
|
|
<AiBack></AiBack>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
<script>
|
||
|
|
import AiVideo from '@/components/AiVideo'
|
||
|
|
import AiBack from "@/components/AiBack";
|
||
|
|
export default {
|
||
|
|
name: "resourcesManage",
|
||
|
|
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'}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
components: {
|
||
|
|
AiBack,
|
||
|
|
AiVideo
|
||
|
|
},
|
||
|
|
|
||
|
|
onLoad (query) {
|
||
|
|
this.isChoose = query.isChoose ? true : false
|
||
|
|
this.getList()
|
||
|
|
uni.$on('getList', e => {
|
||
|
|
this.isMore = false
|
||
|
|
this.list = []
|
||
|
|
this.current = 1
|
||
|
|
|
||
|
|
this.$nextTick(() => {
|
||
|
|
this.getList()
|
||
|
|
})
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
methods: {
|
||
|
|
change(index) {
|
||
|
|
this.isMore = false
|
||
|
|
this.list = []
|
||
|
|
this.current = 1
|
||
|
|
this.currIndex = index
|
||
|
|
|
||
|
|
this.$nextTick(() => {
|
||
|
|
this.getList()
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
add () {
|
||
|
|
uni.navigateTo({
|
||
|
|
url: `/pages/resourcesManage/addPlay?type=${this.currIndex === 0 ? 1 : 3}`
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
choose (item) {
|
||
|
|
if (!this.isChoose) {
|
||
|
|
console.log(item.url)
|
||
|
|
this.url = item.url
|
||
|
|
this.isShow = true
|
||
|
|
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
uni.$emit('choose', {
|
||
|
|
mediaId: item.id,
|
||
|
|
mediaName: item.name
|
||
|
|
})
|
||
|
|
uni.navigateBack({
|
||
|
|
delta: 1
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
getList () {
|
||
|
|
if (this.isMore) return
|
||
|
|
|
||
|
|
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]
|
||
|
|
} 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()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
onReachBottom() {
|
||
|
|
this.getList()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
<style lang="scss" scoped>
|
||
|
|
.resourcesManage {
|
||
|
|
padding-bottom: 128px;
|
||
|
|
.tab{
|
||
|
|
border-bottom: 1px solid #ddd;
|
||
|
|
margin-bottom: 4px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.audio {
|
||
|
|
width: 100%;
|
||
|
|
height: 400rpx;
|
||
|
|
box-sizing: border-box;
|
||
|
|
padding: 104rpx 0 46rpx;
|
||
|
|
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% - 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;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
.record-text{
|
||
|
|
background-color: #fff;
|
||
|
|
.item{
|
||
|
|
width: 100%;
|
||
|
|
border-bottom: 1px solid #ddd;
|
||
|
|
padding: 32px 30px;
|
||
|
|
box-sizing: border-box;
|
||
|
|
font-size: 30px;
|
||
|
|
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;
|
||
|
|
text-overflow: -o-ellipsis-lastline;
|
||
|
|
overflow: hidden;
|
||
|
|
text-overflow: ellipsis;
|
||
|
|
display: -webkit-box;
|
||
|
|
-webkit-line-clamp: 2;
|
||
|
|
line-clamp: 2;
|
||
|
|
word-break: break-all;
|
||
|
|
-webkit-box-orient: vertical;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
.add-img{
|
||
|
|
width: 120px;
|
||
|
|
position: fixed;
|
||
|
|
bottom: 120px;
|
||
|
|
right: 32px;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</style>
|