2024-09-11 15:55:28 +08:00
|
|
|
|
<template>
|
|
|
|
|
<view class="bottoms">
|
|
|
|
|
<view class="box" @click="getgogo(1)">
|
|
|
|
|
<view class="imgs">
|
|
|
|
|
<image src="../../static/detection/sy.png" v-show="aindex == 1" ></image>
|
|
|
|
|
<image src="../../static/detection/syw.png" v-show="aindex != 1" ></image>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="xzz" v-show="aindex == 1">首页</view>
|
|
|
|
|
<view class="wxz" v-show="aindex != 1">首页</view>
|
|
|
|
|
</view>
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
|
|
|
|
|
2024-09-11 15:55:28 +08:00
|
|
|
|
<view class="box" @click="getgogo(3)">
|
|
|
|
|
<view class="imgs">
|
|
|
|
|
<image src="../../static/detection/wd.png" v-show="aindex == 3"></image>
|
|
|
|
|
<image src="../../static/detection/wdw.png" v-show="aindex != 3"></image>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="xzz" v-show="aindex == 3">我的</view>
|
|
|
|
|
<view class="wxz" v-show="aindex != 3">我的</view>
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-09-11 15:55:28 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-11-09 11:50:25 +08:00
|
|
|
|
const innerAudioContext = uni.createInnerAudioContext();
|
2024-09-11 15:55:28 +08:00
|
|
|
|
import request from '../../utils/request';
|
|
|
|
|
export default{
|
|
|
|
|
data(){
|
|
|
|
|
return{
|
2024-11-11 11:25:51 +08:00
|
|
|
|
msgSocket: null,
|
2024-09-11 15:55:28 +08:00
|
|
|
|
aindex:1,
|
|
|
|
|
arr:[
|
|
|
|
|
{text:'首页'},
|
|
|
|
|
{text:'个人中心'},
|
|
|
|
|
],
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-09-11 15:55:28 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
props:{
|
|
|
|
|
msg:String,
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-09-11 15:55:28 +08:00
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
this.aindex = this.msg
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-11-11 11:25:51 +08:00
|
|
|
|
this.msgSocket = this.$msgSocket,
|
2024-09-11 15:55:28 +08:00
|
|
|
|
this.aindex = this.msg
|
|
|
|
|
},
|
2024-11-09 11:50:25 +08:00
|
|
|
|
watch: {
|
|
|
|
|
msgSocket(newVal, oldVal) {
|
|
|
|
|
console.log('msgSocket值发生变化', newVal, oldVal)
|
|
|
|
|
this.msgInfo()
|
|
|
|
|
},
|
|
|
|
|
deep: true,
|
|
|
|
|
},
|
2024-09-11 15:55:28 +08:00
|
|
|
|
methods:{
|
2024-11-09 11:50:25 +08:00
|
|
|
|
dianyidain() {
|
2024-11-11 13:18:56 +08:00
|
|
|
|
// console.log('执行了,dianyidain');
|
2024-11-09 11:50:25 +08:00
|
|
|
|
innerAudioContext.src = 'https://www.nuoyunr.com/lananRsc/rescue/msgV.mp3';
|
|
|
|
|
// 设置播放次数和计数器
|
|
|
|
|
const playCount = 3;
|
|
|
|
|
let currentCount = 0;
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-11-09 11:50:25 +08:00
|
|
|
|
// 监听音频播放结束事件
|
|
|
|
|
innerAudioContext.onEnded(() => {
|
|
|
|
|
// 播放计数加一
|
|
|
|
|
currentCount++;
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-11-09 11:50:25 +08:00
|
|
|
|
// 判断是否达到播放次数上限
|
|
|
|
|
if (currentCount < playCount) {
|
|
|
|
|
// 继续播放
|
|
|
|
|
innerAudioContext.play();
|
|
|
|
|
} else {
|
|
|
|
|
// 播放完成,可以在这里添加额外的逻辑
|
|
|
|
|
console.log('播放完成');
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-11-09 11:50:25 +08:00
|
|
|
|
// 初次播放
|
|
|
|
|
innerAudioContext.play();
|
|
|
|
|
},
|
|
|
|
|
msgInfo() {
|
|
|
|
|
console.log(this.msgSocket, 'msgSocket')
|
|
|
|
|
if (this.msgSocket) {
|
|
|
|
|
console.log('消息回调启动成功')
|
|
|
|
|
this.msgSocket.onMessage(res => {
|
|
|
|
|
console.log("发出提示音");
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-11-09 11:50:25 +08:00
|
|
|
|
this.dianyidain()
|
|
|
|
|
})
|
|
|
|
|
}
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-11-09 11:50:25 +08:00
|
|
|
|
},
|
2024-09-11 15:55:28 +08:00
|
|
|
|
getgogo(index){
|
|
|
|
|
if(index == 1){
|
|
|
|
|
this.aindex = index
|
|
|
|
|
uni.reLaunch({
|
|
|
|
|
url:'/pages/staff/staff'
|
|
|
|
|
});
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-09-11 15:55:28 +08:00
|
|
|
|
}
|
|
|
|
|
if(index == 3){
|
|
|
|
|
this.aindex = index
|
|
|
|
|
uni.reLaunch({
|
|
|
|
|
url:'/pages/staff/staff-my'
|
|
|
|
|
})
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-09-11 15:55:28 +08:00
|
|
|
|
}
|
|
|
|
|
if(index == 4){
|
|
|
|
|
this.aindex = index
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title:'此功能暂未开发',
|
|
|
|
|
icon:'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-11 15:55:28 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-09-11 15:55:28 +08:00
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.bottoms{
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 50px;
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0px;
|
|
|
|
|
background: white;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
z-index: 9999999999999999999999999999999999999999999999999999999;
|
2024-11-11 13:18:56 +08:00
|
|
|
|
|
2024-09-11 15:55:28 +08:00
|
|
|
|
}
|
|
|
|
|
.box{
|
|
|
|
|
width: 50%;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
.imgs{
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
width: 18px;
|
|
|
|
|
height: 16px;
|
|
|
|
|
image{
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.xzz{
|
|
|
|
|
color: #0D2E8D;
|
|
|
|
|
}
|
|
|
|
|
.wxz{
|
|
|
|
|
color: #AAAAAA;
|
|
|
|
|
}
|
2024-11-11 13:18:56 +08:00
|
|
|
|
</style>
|