检测优化

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> </template>
<script> <script>
const innerAudioContext = uni.createInnerAudioContext();
import request from '../../utils/request'; import request from '../../utils/request';
export default{ export default{
data(){ data(){
return{ return{
msgSocket: this.$msgSocket,
aindex:1, aindex:1,
arr:[ arr:[
{text:'首页'}, {text:'首页'},
@ -42,16 +44,56 @@
onLoad() { onLoad() {
this.aindex = this.msg this.aindex = this.msg
}, },
// onShow() {
// this.aindex = this.msg
// },
mounted() { mounted() {
console.log(this.aindex); console.log(this.aindex);
this.aindex = this.msg this.aindex = this.msg
}, },
watch: {
msgSocket(newVal, oldVal) {
console.log('msgSocket值发生变化', newVal, oldVal)
this.msgInfo()
},
deep: true,
},
methods:{ methods:{
getgogo(index){ 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){ if(index == 1){
this.aindex = index this.aindex = index
uni.reLaunch({ uni.reLaunch({
@ -59,7 +101,6 @@
}); });
} }
if(index == 3){ if(index == 3){
this.aindex = index this.aindex = index
uni.reLaunch({ uni.reLaunch({

25
main.js
View File

@ -5,8 +5,33 @@ const baseUrl = config.baseUrl
Vue.prototype.$baseUrl = baseUrl; Vue.prototype.$baseUrl = baseUrl;
const baseImageUrl = config.baseImageUrl const baseImageUrl = config.baseImageUrl
Vue.prototype.$baseImageUrl = baseImageUrl; Vue.prototype.$baseImageUrl = baseImageUrl;
const wsUrl = config.wsUrl
Vue.prototype.$wsUrl = wsUrl;
Vue.use(uView) 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'; Vue.prototype.$imgeUrl = 'http://www.nuoyunr.com/lananRsc';
// #ifndef VUE3 // #ifndef VUE3

View File

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

View File

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

View File

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