检测优化

This commit is contained in:
13405411873 2024-11-09 11:50:25 +08:00
parent aa080206a3
commit 0c6cbb7be9
5 changed files with 120 additions and 20 deletions

View File

@ -23,10 +23,12 @@
</template>
<script>
const innerAudioContext = uni.createInnerAudioContext();
import request from '../../utils/request';
export default{
data(){
return{
msgSocket: this.$msgSocket,
aindex:1,
arr:[
{text:'首页'},
@ -42,16 +44,56 @@
onLoad() {
this.aindex = this.msg
},
// onShow() {
// this.aindex = this.msg
// },
mounted() {
console.log(this.aindex);
this.aindex = this.msg
},
watch: {
msgSocket(newVal, oldVal) {
console.log('msgSocket值发生变化', newVal, oldVal)
this.msgInfo()
},
deep: true,
},
methods:{
dianyidain() {
console.log('执行了dianyidain');
innerAudioContext.src = 'https://www.nuoyunr.com/lananRsc/rescue/msgV.mp3';
//
const playCount = 3;
let currentCount = 0;
//
innerAudioContext.onEnded(() => {
//
currentCount++;
//
if (currentCount < playCount) {
//
innerAudioContext.play();
} else {
//
console.log('播放完成');
}
});
//
innerAudioContext.play();
},
msgInfo() {
console.log(this.msgSocket, 'msgSocket')
if (this.msgSocket) {
console.log('消息回调启动成功')
this.msgSocket.onMessage(res => {
console.log("发出提示音");
this.dianyidain()
})
}
},
getgogo(index){
if(index == 1){
this.aindex = index
uni.reLaunch({
@ -59,7 +101,6 @@
});
}
if(index == 3){
this.aindex = index
uni.reLaunch({

25
main.js
View File

@ -5,8 +5,33 @@ const baseUrl = config.baseUrl
Vue.prototype.$baseUrl = baseUrl;
const baseImageUrl = config.baseImageUrl
Vue.prototype.$baseImageUrl = baseImageUrl;
const wsUrl = config.wsUrl
Vue.prototype.$wsUrl = wsUrl;
Vue.use(uView)
import {
connect,
sendSocketMessage,
closeSocket
} from './utils/orderSocket.js'
let SocketTask;
let timerId;
export function startSocketConnect(userId) {
SocketTask = null
SocketTask = connect(userId);
if (!timerId && uni.getStorageSync('userId')) {
timerId = setInterval(() => {
sendSocketMessage(SocketTask)
}, 10000);
}
}
export function closeSocketMain(userId) {
clearInterval(timerId)
closeSocket(SocketTask);
}
Vue.prototype.$startSocketConnect = startSocketConnect
Vue.prototype.$closeSocketMain = closeSocketMain
Vue.prototype.$msgSocket = SocketTask
Vue.prototype.$imgeUrl = 'http://www.nuoyunr.com/lananRsc';
// #ifndef VUE3

View File

@ -216,12 +216,13 @@
method: 'get',
}).then((res)=>{
console.log(res,219219);
if(res.code == 200){
uni.setStorageSync('staffinfo',res.data.user)
uni.setStorageSync('partnerId',res.data.partnerId)
uni.setStorageSync('roleSelect','worker')
uni.setStorageSync('userId',res.data.user.id)
uni.hideLoading();
this.$startSocketConnect()
uni.redirectTo({
url:'/pages/staff/staff'
})

View File

@ -102,6 +102,14 @@ export default {
</script>
<style scoped>
::v-deep .step-style{
.u-steps-item__content{
.u-text__value {
font-size:80rpx !important;
line-height: 90rpx !important;
}
}
}
.cont_box {
box-sizing: border-box;
padding: 10px;
@ -124,11 +132,11 @@ export default {
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-size: 18px;
box-sizing: border-box;
padding: 5px 10px;
margin-right: 5px;
margin-bottom: 5px;
padding: 10px 15px;
margin-right: 15px;
margin-bottom: 15px;
background: #0D2E8D;
color: #fff;
}
@ -139,11 +147,11 @@ export default {
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-size: 18px;
box-sizing: border-box;
padding: 5px 10px;
margin-right: 5px;
margin-bottom: 5px;
padding: 10px 15px;
margin-right: 15px;
margin-bottom: 15px;
}
.dlanniu {

View File

@ -94,6 +94,7 @@ import tabBar from '../../components/staffTabBer/tabBar.vue'
export default {
data() {
return {
msgSocket: this.$msgSocket,
imgurl: this.$imgeUrl,
baseUrl: this.$baseUrl,
infoDatas: {},
@ -123,11 +124,17 @@ export default {
}
},
onLoad() {
// this.getList()
},
onShow() {
this.getList()
},
watch: {
msgSocket(newVal, oldVal) {
console.log('msgSocket值发生变化', newVal, oldVal)
this.msgInfo()
},
deep: true,
},
onReachBottom() {
console.log(111)
if (this.pageNum >= this.totalPages) {
@ -146,6 +153,19 @@ export default {
tabBar,
},
methods: {
msgInfo() {
console.log(this.msgSocket, 'msgSocket')
if (this.msgSocket) {
console.log('消息回调启动成功')
this.msgSocket.onMessage(res => {
console.log("刷新订单列表");
this.pageNum = 1
this.totalPages =0
this.getList()
})
}
},
callUser(phone) {
console.log(phone)
uni.makePhoneCall({
@ -385,7 +405,7 @@ export default {
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.button-container {
@ -395,10 +415,15 @@ export default {
}
.button {
flex: 0.5; /* 减小按钮的占比 */
margin: 0 5px; /* 缩小两侧间距 */
padding: 5px 10px; /* 缩小按钮内边距 */
font-size: 0.9rem; /* 缩小字体 */
width: 80%;
height: 45px;
background: linear-gradient(180deg, #3F61C0 0%, #0D2E8D 100%);
border-radius: 50px;
display: flex;
align-items: center;
justify-content: center;
color: white;
}