uu
This commit is contained in:
parent
caf7a65b88
commit
6d556dcee6
@ -98,6 +98,7 @@ const audioTypeEnum = {
|
||||
printFail: getCdnRoot('tone/print-fail.mp3'),
|
||||
printSuccess: getCdnRoot('tone/print-success.mp3'),
|
||||
repetitive: getCdnRoot('tone/repetitive.mp3'),
|
||||
notifyTone: getCdnRoot('tone/notifyTone.mp3'),
|
||||
}
|
||||
|
||||
export {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
let envMap = {
|
||||
development: {
|
||||
apiHost: 'http://47.102.220.189:58089/api/bizsvr',
|
||||
socketHost: 'ws://47.102.220.189:58089/api/bizsvr',
|
||||
},
|
||||
production: {
|
||||
apiHost: 'http://api.emis.tanex56.com/api/bizsvr',
|
||||
socketHost: 'ws://api.emis.tanex56.com/api/bizsvr',
|
||||
}
|
||||
}
|
||||
let curEnvConf
|
||||
|
||||
64
common/messageNotice/socket.js
Normal file
64
common/messageNotice/socket.js
Normal file
@ -0,0 +1,64 @@
|
||||
import { curEnvConf } from "@/common/env"
|
||||
import { getCommonReqData } from "@/common/manageServer"
|
||||
import { showToast, playAudio } from "@/common/untool"
|
||||
import { audioTypeEnum } from "@/common/enum"
|
||||
|
||||
export const createSocketMessage = ({ userInfo })=> {
|
||||
const url = curEnvConf.socketHost
|
||||
let comReqData = getCommonReqData()
|
||||
const socketTask = uni.connectSocket({
|
||||
url: `${url}/ws/${userInfo?.userId}`,
|
||||
// method: 'GET',
|
||||
header: {
|
||||
...comReqData.header,
|
||||
},
|
||||
success(res){
|
||||
},
|
||||
fail(err) {
|
||||
}
|
||||
})
|
||||
socketTask.onError((err)=> {
|
||||
console.log('socketTask.onError: ', err);
|
||||
})
|
||||
socketTask.onClose((res)=> {
|
||||
console.log('socketTask.onClose: ', res);
|
||||
})
|
||||
socketTask.onOpen((res)=> {
|
||||
console.log('socketTask.onOpen: ', res);
|
||||
})
|
||||
socketTask.onMessage(function (res) {
|
||||
debugger
|
||||
console.log('onSocketMessage 收到服务器内容:', res?.data);
|
||||
playAudio(audioTypeEnum.notifyTone)
|
||||
// let that=this;
|
||||
// if(evtStr==null||evtStr==undefined){
|
||||
// return;
|
||||
// }
|
||||
|
||||
// let evt= JSON.parse(evtStr);
|
||||
// if(evt==null||evt==undefined){
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 播放声音通知
|
||||
// this.playTone();
|
||||
|
||||
// var messageBody = evt.title;
|
||||
// let noticeId= evt.noticeId;
|
||||
|
||||
// 弹出通知提示
|
||||
// Notification.info({
|
||||
// title: "系统通知",
|
||||
// dangerouslyUseHTMLString: true,
|
||||
// message: messageBody,
|
||||
// position: 'top-right',
|
||||
// customClass:'notify-success',
|
||||
// duration: 0,
|
||||
// onClick: function () {
|
||||
// // 提示消息
|
||||
// //that.setAddReadTimes(noticeId);
|
||||
// },
|
||||
// });
|
||||
debugger
|
||||
});
|
||||
}
|
||||
BIN
static/tone/notifyTone.mp3
Normal file
BIN
static/tone/notifyTone.mp3
Normal file
Binary file not shown.
@ -7,6 +7,7 @@ import {
|
||||
} from "@/session"
|
||||
import * as apiService from "@/common/api"
|
||||
import { goto } from "@/common/untool"
|
||||
import { createSocketMessage } from "@/common/messageNotice/socket"
|
||||
|
||||
export default {
|
||||
state: {
|
||||
@ -83,6 +84,8 @@ export default {
|
||||
let resQr = await apiService.getStaffQRCodePng()
|
||||
info.qrCodeImgUrl = resQr?.data?.fileUrl
|
||||
|
||||
// 链接socket
|
||||
createSocketMessage({ userInfo: info })
|
||||
commit(USERKEY.GETUSERINFO, info)
|
||||
},
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user