Compare commits

...

2 Commits

Author SHA1 Message Date
Vinjor
b446915f86 Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-repair-app 2024-11-13 10:35:04 +08:00
Vinjor
84e8529386 1 2024-11-13 10:34:57 +08:00
5 changed files with 173 additions and 21 deletions

View File

@ -44,16 +44,6 @@
identity: 'user',
nowPageInterval: null,
userInfo:{},
arr: [{
text: '首页'
},
{
text: '消息'
},
{
text: '运力'
}
]
}
},
props: {

View File

@ -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
}
})
},
/**

View File

@ -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(()=>{

View File

@ -6,10 +6,14 @@
<script>
import {getToken,getUserInfo} from "@/utils/auth";
import request from '@/utils/request';
let innerAudioContext ='';
const keepAlivePlugin = uni.requireNativePlugin('Ba-KeepAlive')
export default {
data() {
return {
//
ifPlay:false,
keepLive: {
channelId: 'Ba-KeepAlive',
channelName: "Ba-KeepAlive",
@ -26,6 +30,7 @@
this.register()
// #endif
if(getToken()){
this.getNoReadNum()
//
//
let userInfo = getUserInfo()
@ -58,6 +63,85 @@
console.log('保活注册', res);
});
},
/**
* 获取未读消息数量
* @returns {Promise<void>}
*/
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('正在播放音频,拒绝播放请求');
}
},
}
}
</script>

View File

@ -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<void>}
*/
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('正在播放音频,拒绝播放请求');
}
},
}
}
</script>