diff --git a/components/tabBar/tabBar.vue b/components/tabBar/tabBar.vue index 8a48bd6..b701c70 100644 --- a/components/tabBar/tabBar.vue +++ b/components/tabBar/tabBar.vue @@ -44,16 +44,6 @@ identity: 'user', nowPageInterval: null, userInfo:{}, - arr: [{ - text: '首页' - }, - { - text: '消息' - }, - { - text: '运力' - } - ] } }, props: { diff --git a/pages-home/home/home.vue b/pages-home/home/home.vue index 695a4c8..d85f0e3 100644 --- a/pages-home/home/home.vue +++ b/pages-home/home/home.vue @@ -229,8 +229,6 @@ export default { selectedProj: [], //告知客户的内容 tellCusText:"", - //是否首次打开页面 - ifFirstLogin:true, } }, onLoad(){ @@ -674,12 +672,6 @@ export default { if(res.code==200){ this.noReadNum = res.data>99?99:res.data } - console.log("开始播放") - if(this.ifFirstLogin && this.noReadNum>0){ - console.log("播放") - this.$refs.tarBar.dianyidain() - this.ifFirstLogin=false - } }) }, /** diff --git a/pages-order/orderDetail/orderDetail.vue b/pages-order/orderDetail/orderDetail.vue index 19371da..11951e0 100644 --- a/pages-order/orderDetail/orderDetail.vue +++ b/pages-order/orderDetail/orderDetail.vue @@ -925,10 +925,13 @@ export default { resultObj.projects = resultObj.projects.map((item)=>{ if(projectMap.has(item.id)){ console.log(projectMap.get(item.id)) - return projectMap.get(item.id) - }else{ - return item + let localObj = projectMap.get(item.id) + item.itemPrice = localObj.itemPrice + item.itemCount = localObj.itemCount + item.itemDiscount = localObj.itemDiscount + item.itemMoney = localObj.itemMoney } + return item }) } this.$nextTick(()=>{ diff --git a/pages/index/index.vue b/pages/index/index.vue index 8d8666a..6a65471 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -6,10 +6,14 @@ diff --git a/pages/login/login.vue b/pages/login/login.vue index d32a483..874e3e7 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -60,9 +60,12 @@ getInfo, getTenantIdByPhone } from '@/api/login' + let innerAudioContext =''; export default { data() { return { + // 是否正在播放 + ifPlay:false, //系统标识 sysCode:"weixiu", phoneNumber: "", @@ -160,6 +163,7 @@ setToken(res.data.loginResult.accessToken) setUserInfo(res.data.userinfo) setStrData("userId",res.data.userinfo.id) + this.getNoReadNum() if(res.data.userinfo.roleCodes.includes("repair_staff")){ //维修工角色,需要再查一下是否是班组长 this.getIdLeader() @@ -302,6 +306,85 @@ } }, 1000); }, + /** + * 获取未读消息数量 + * @returns {Promise} + */ + async getNoReadNum(){ + await request({ + url: "/admin-api/system/notify-message/get-unread-count", + method: "GET" + }).then((res) => { + if(res.code==200 && res.data>0){ + this.dianyidain() + } + }) + }, + dianyidain() { + if(!this.ifPlay){ + console.log('执行了,dianyidain'); + if(innerAudioContext!=""){ + try { + console.log('调用前先销毁'); + innerAudioContext.stop(); + innerAudioContext.destroy(); + innerAudioContext=""; + }catch (e){ + console.log('销毁出错'); + } + } + innerAudioContext = uni.createInnerAudioContext(); + this.ifPlay=true + // #ifdef APP-PLUS + innerAudioContext.src = '../../static/msgV.mp3'; + // #endif + // #ifndef APP-PLUS + innerAudioContext.src = 'https://www.nuoyunr.com/lananRsc/rescue/msgV.mp3'; + // #endif + // 设置播放次数和计数器 + const playCount = 4; + let currentCount = 0; + // 初次播放 + innerAudioContext.play(); + // 震动 + uni.vibrateLong({ + success: function () { + console.log('success'); + } + }); + innerAudioContext.onError((err) => { + console.error('播放错误', err); + this.ifPlay=false + innerAudioContext.stop(); + innerAudioContext.destroy(); // 播放错误后释放实例 + }); + // 监听音频播放结束事件 + innerAudioContext.onEnded(() => { + // 播放计数加一 + currentCount++; + // 判断是否达到播放次数上限 + if (currentCount < playCount) { + // 继续播放 + innerAudioContext.play(); + // 震动 + uni.vibrateLong({ + success: function () { + console.log('success'); + } + }); + } else { + // 播放完成,可以在这里添加额外的逻辑 + console.log('播放完成'); + this.ifPlay=false + //及时释放资源 + innerAudioContext.stop(); + innerAudioContext.destroy(); + } + }); + }else{ + console.log('正在播放音频,拒绝播放请求'); + } + }, } }