迁移广播通知

This commit is contained in:
aixianling
2021-12-16 18:30:17 +08:00
parent b96dcf261a
commit d2296dc116
36 changed files with 46 additions and 133 deletions

View File

@@ -0,0 +1,252 @@
<template>
<div class="AppResourcesManage">
<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="`${$cdn}video/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/>
</div>
</template>
<script>
export default {
name: "AppResourcesManage",
appName: "媒资管理",
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) {
this.isChoose = !!query.isChoose
this.getList()
uni.$on('getList', () => {
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: `./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>
.AppResourcesManage {
padding-bottom: 128px;
.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% - 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;
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>