1
This commit is contained in:
parent
1f1c515f4f
commit
84e8529386
@ -44,16 +44,6 @@
|
|||||||
identity: 'user',
|
identity: 'user',
|
||||||
nowPageInterval: null,
|
nowPageInterval: null,
|
||||||
userInfo:{},
|
userInfo:{},
|
||||||
arr: [{
|
|
||||||
text: '首页'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '消息'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '运力'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -229,8 +229,6 @@ export default {
|
|||||||
selectedProj: [],
|
selectedProj: [],
|
||||||
//告知客户的内容
|
//告知客户的内容
|
||||||
tellCusText:"",
|
tellCusText:"",
|
||||||
//是否首次打开页面
|
|
||||||
ifFirstLogin:true,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(){
|
onLoad(){
|
||||||
@ -674,12 +672,6 @@ export default {
|
|||||||
if(res.code==200){
|
if(res.code==200){
|
||||||
this.noReadNum = res.data>99?99:res.data
|
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
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -925,10 +925,13 @@ export default {
|
|||||||
resultObj.projects = resultObj.projects.map((item)=>{
|
resultObj.projects = resultObj.projects.map((item)=>{
|
||||||
if(projectMap.has(item.id)){
|
if(projectMap.has(item.id)){
|
||||||
console.log(projectMap.get(item.id))
|
console.log(projectMap.get(item.id))
|
||||||
return projectMap.get(item.id)
|
let localObj = projectMap.get(item.id)
|
||||||
}else{
|
item.itemPrice = localObj.itemPrice
|
||||||
return item
|
item.itemCount = localObj.itemCount
|
||||||
|
item.itemDiscount = localObj.itemDiscount
|
||||||
|
item.itemMoney = localObj.itemMoney
|
||||||
}
|
}
|
||||||
|
return item
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(()=>{
|
||||||
|
@ -6,10 +6,14 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getToken,getUserInfo} from "@/utils/auth";
|
import {getToken,getUserInfo} from "@/utils/auth";
|
||||||
|
import request from '@/utils/request';
|
||||||
|
let innerAudioContext ='';
|
||||||
const keepAlivePlugin = uni.requireNativePlugin('Ba-KeepAlive')
|
const keepAlivePlugin = uni.requireNativePlugin('Ba-KeepAlive')
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
// 是否正在播放
|
||||||
|
ifPlay:false,
|
||||||
keepLive: {
|
keepLive: {
|
||||||
channelId: 'Ba-KeepAlive',
|
channelId: 'Ba-KeepAlive',
|
||||||
channelName: "Ba-KeepAlive",
|
channelName: "Ba-KeepAlive",
|
||||||
@ -26,6 +30,7 @@
|
|||||||
this.register()
|
this.register()
|
||||||
// #endif
|
// #endif
|
||||||
if(getToken()){
|
if(getToken()){
|
||||||
|
this.getNoReadNum()
|
||||||
//跳转首页
|
//跳转首页
|
||||||
//判断是否是仓管,仓管需要跳单独的首页
|
//判断是否是仓管,仓管需要跳单独的首页
|
||||||
let userInfo = getUserInfo()
|
let userInfo = getUserInfo()
|
||||||
@ -58,6 +63,85 @@
|
|||||||
console.log('保活注册', res);
|
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>
|
</script>
|
||||||
|
@ -60,9 +60,12 @@
|
|||||||
getInfo,
|
getInfo,
|
||||||
getTenantIdByPhone
|
getTenantIdByPhone
|
||||||
} from '@/api/login'
|
} from '@/api/login'
|
||||||
|
let innerAudioContext ='';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
// 是否正在播放
|
||||||
|
ifPlay:false,
|
||||||
//系统标识
|
//系统标识
|
||||||
sysCode:"weixiu",
|
sysCode:"weixiu",
|
||||||
phoneNumber: "",
|
phoneNumber: "",
|
||||||
@ -160,6 +163,7 @@
|
|||||||
setToken(res.data.loginResult.accessToken)
|
setToken(res.data.loginResult.accessToken)
|
||||||
setUserInfo(res.data.userinfo)
|
setUserInfo(res.data.userinfo)
|
||||||
setStrData("userId",res.data.userinfo.id)
|
setStrData("userId",res.data.userinfo.id)
|
||||||
|
this.getNoReadNum()
|
||||||
if(res.data.userinfo.roleCodes.includes("repair_staff")){
|
if(res.data.userinfo.roleCodes.includes("repair_staff")){
|
||||||
//维修工角色,需要再查一下是否是班组长
|
//维修工角色,需要再查一下是否是班组长
|
||||||
this.getIdLeader()
|
this.getIdLeader()
|
||||||
@ -302,6 +306,85 @@
|
|||||||
}
|
}
|
||||||
}, 1000);
|
}, 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>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user