大喇叭

This commit is contained in:
liuye
2022-06-07 15:06:06 +08:00
parent 45d7577eb3
commit b2e701b716
4 changed files with 408 additions and 45 deletions

View File

@@ -3,14 +3,15 @@
<div class="content"> <div class="content">
<div class="item"> <div class="item">
<div class="label">播发内容</div> <div class="label">播发内容</div>
<div class="value" @click="nameClick"> <div class="value" @click="toSelectMedia">
<span :class="formData.mediaName == '请选择' ? 'color-999' : ''">{{ formData.mediaName }}</span> <span :class="formData.mediaName == '请选择' ? 'color-999' : ''">{{ formData.mediaName }}</span>
<img src="./img/right-icon.png" alt=""> <img src="./img/right-icon.png" alt="">
</div> </div>
</div> </div>
<div class="item"> <div class="item">
<div class="label">播放设备</div> <div class="label">播放设备</div>
<div class="value" @click="selectClick('showEquipment', equipmentList)"> <div class="value" @click="toSelectEquipment">
<!-- @click="selectClick('showEquipment', equipmentList)" -->
<span :class="formData.serialName == '请选择' ? 'color-999' : ''">{{ formData.serialName }}</span> <span :class="formData.serialName == '请选择' ? 'color-999' : ''">{{ formData.serialName }}</span>
<img src="./img/right-icon.png" alt=""> <img src="./img/right-icon.png" alt="">
</div> </div>
@@ -50,8 +51,7 @@
<div class="item"> <div class="item">
<div class="label">播放天数</div> <div class="label">播放天数</div>
<div class="value"> <div class="value">
<u-input type="text" placeholder="请输入" height="18" input-align="right" v-model="formData.broadcastDay" <u-input type="text" placeholder="请输入" height="18" input-align="right" v-model="formData.broadcastDay" maxlength="4"/>
maxlength="4"/>
</div> </div>
</div> </div>
</div> </div>
@@ -169,7 +169,7 @@ export default {
} }
}, },
onLoad() { onLoad() {
uni.$on('choose', e => { uni.$on('chooseMedia', e => {
console.log(e) console.log(e)
this.formData.mediaId = e.mediaId this.formData.mediaId = e.mediaId
this.formData.mediaName = e.mediaName this.formData.mediaName = e.mediaName
@@ -180,8 +180,11 @@ export default {
}, },
methods: { methods: {
nameClick() { toSelectMedia() {
uni.navigateTo({url: '../AppResourcesManage/AppResourcesManage?isChoose=1'}) uni.navigateTo({url: `./selectMedia?mediaId=${this.formData.mediaId}`})
},
toSelectEquipment() {
uni.navigateTo({url: `./selectEquipment`})
}, },
addConfirm() { addConfirm() {
var cyclingDateList = [] var cyclingDateList = []

View File

@@ -1,11 +1,17 @@
<template> <template>
<div class="selectEquipment"> <div class="selectEquipment">
<div class="search"> <AiTopFixed>
<div class="search-bg"> <div class="currentLeft-top">
<img src="./img/search-icon.png" alt=""> <div class="left">
<u-input v-model="value" type="text" placeholder="搜索设备名称" class="search-input" height="18"/> <AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="areaSelect" :name.sync="areaName" selectRoot>
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
<u-icon name="arrow-down" color="#666" size="24" style="margin-left: 4px" />
</AiAreaPicker>
</div> </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>
</AiTopFixed>
<div class="record"> <div class="record">
<div class="item"> <div class="item">
<img src="./img/cir.png" alt="" class="check-img"> <img src="./img/cir.png" alt="" class="check-img">
@@ -36,50 +42,50 @@
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex'
export default { export default {
name: "selectEquipment", name: "selectEquipment",
data() {
return {
areaId: '',
areaName: '',
keyword: ''
}
},
computed: { ...mapState(['user']) },
onLoad(option) {
this.areaId = this.user.areaId
this.areaName = this.user.areaName
},
methods: {
areaSelect(e) {
this.areaId = e
// this.getList()
},
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.selectEquipment { .selectEquipment {
padding-bottom: 128px; padding-bottom: 128px;
.search { .currentLeft-top {
width: 100%; display: flex;
height: 104px; align-items: center;
background: #FFF;
margin-bottom: 4px;
padding: 20px 32px;
box-sizing: border-box;
.search-bg { .left {
width: 686px; width: 200px;
height: 64px; display: flex;
padding: 14px 0; align-items: center;
box-sizing: border-box;
background: #F5F5F5;
border-radius: 32px;
position: relative;
img { img {
width: 32px; width: 48px;
height: 32px; height: 48px;
position: absolute;
top: 16px;
left: 32px;
}
.search-input {
width: 590px;
height: 36px;
line-height: 36px;
font-size: 28px;
margin-left: 70px;
} }
} }
} }
.record { .record {
margin-top: 8px;
padding-left: 32px; padding-left: 32px;
background-color: #fff; background-color: #fff;
@@ -89,8 +95,8 @@ export default {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
.check-img { .check-img {
width: 32px; width: 44px;
height: 32px; height: 44px;
margin: 32px 32px 0 0; margin: 32px 32px 0 0;
} }
@@ -101,7 +107,7 @@ export default {
} }
.info { .info {
width: calc(100% - 148px); width: calc(100% - 160px);
padding: 18px 0; padding: 18px 0;
line-height: 44px; line-height: 44px;
font-size: 34px; font-size: 34px;

View File

@@ -0,0 +1,355 @@
<template>
<div class="selectMedia">
<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>
</AiTopFixed>
<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/select-blue.png" alt="" @click.stop="check(index)" v-if="item.isCheck">
<img src="./img/cir.png" alt="" @click.stop="check(index)" v-else>
<div class="right">
<div class="info">
<p>{{ item.name ? item.name.split('.')[0] : '-' }}</p>
<div>李毅 2022-06-09 09:43:45</div>
</div>
</div>
</div>
</div>
<div class="record" v-else>
<div class="item" v-for="(item, index) in list" :key="index" @click="choose(item)">
<img src="./img/select-blue.png" alt="" @click.stop="check(index)" v-if="item.isCheck">
<img src="./img/cir.png" alt="" @click.stop="check(index)" v-else>
<div class="right">
<div class="info">
<p>{{ item.name }}</p>
<div>{{ item.content }}</div>
</div>
</div>
</div>
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
<div class="btn">
<div @click="confirm">确定选择</div>
</div>
<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>
export default {
name: "selectMedia",
data() {
return {
tab: [{name: '音频素材'}, {name: '文本素材'}],
list: [],
currIndex: 0,
current: 1,
isMore: false,
isShow: false,
url: '',
autioName: '',
audio: null,
barStyle: {width: '98px', bottom: '-3px', left: '-38px'},
keyword: '',
type: '0',
typeList: [{label: '全部', value: '0'}, {label: '我创建的', value: '1'},],
mediaId: '',
}
},
onLoad(option) {
this.mediaId = option.mediaId
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()
},
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: {
...this.search,
type: this.currIndex === 0 ? 1 : 3,
current: this.current,
size: 10
}
}).then(res => {
if (res.code == 0) {
res.data.records.map((item) => {
item.isCheck = false
if(item.id == this.mediaId) {
item.isCheck = true
this.mediaId = ''
}
})
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()
})
},
check(index) {
this.list.map((item) => {
item.isCheck = false
})
this.list[index].isCheck = true
},
confirm() {
var selectInfo = {}
this.list.map((item) => {
if(item.isCheck) {
selectInfo = item
}
})
if(!selectInfo.id) {
return this.$u.toast('请选择素材')
}
uni.$emit('chooseMedia', {
mediaId: selectInfo.id,
mediaName: selectInfo.name
})
uni.navigateBack({
delta: 1
})
}
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.selectMedia {
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;
}
.record {
background-color: #fff;
.item {
width: 100%;
display: flex;
padding: 32px 0 0 30px;
box-sizing: border-box;
img {
width: 44px;
height: 44px;
margin-right: 14px;
}
.right{
flex: 1;
border-bottom: 1px solid #ddd;
padding: 0 30px 32px 0;
}
.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;
}
div{
margin-top: 8px;
font-size: 26px;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #999;
line-height: 36px;
}
}
}
}
.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;
}
.currentLeft-top {
display: flex;
align-items: center;
.left {
width: 200px;
display: flex;
align-items: center;
img {
width: 48px;
height: 48px;
}
}
}
::v-deep .u-search {
margin-bottom: 0 !important;
}
.btn {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 128px;
background: #FFF;
border-top: 1px solid #ddd;
padding: 24px 32px 24px 0;
box-sizing: border-box;
div {
width: 192px;
height: 80px;
line-height: 80px;
text-align: center;
background: #3975C6;
border-radius: 4px;
color: #fff;
font-size: 32px;
float: right;
}
}
}
</style>

View File

@@ -33,7 +33,6 @@
<!-- <audio :src="url" ref="audio" :controls="true" :name="autioName" style="display: block;"></audio> --> <!-- <audio :src="url" ref="audio" :controls="true" :name="autioName" style="display: block;"></audio> -->
</div> </div>
</u-popup> </u-popup>
</div> </div>
</template> </template>
<script> <script>