tianyi 1 day ago
parent
commit
126e26c21c
  1. 59
      App.vue

59
App.vue

@ -46,8 +46,8 @@
// mainurl: 'https://taketest.sdwanyue.com/api/?s=',
// mainurl: 'https://take.sdwanyue.com/api/?s=',
// mainurl: 'https://dev.xenjoyou.com/hiver',
mainurl: 'https://hbkuaishi.com/hiver',
// mainurl: 'http://192.168.1.192:8888/hiver',
// mainurl: 'https://hbkuaishi.com/hiver',
mainurl: 'http://192.168.1.192:8888/hiver',
// #endif
// weburl: 'https://taketest.sdwanyue.com/',
weburl: 'https://takeout.sdwanyue.com/',
@ -69,7 +69,7 @@
$t: '',
userInfo: {},
registrationID: '',
printData:[]
printData: []
},
onLaunch: function() {
let context = this;
@ -94,7 +94,7 @@
//
this.getNotificationEnabled();
jpushModule.addConnectEventListener(result => {
console.log('----------------------------',result)
console.log('----------------------------', result)
let connectEnable = result.connectEnable
if (connectEnable == true) {
@ -110,11 +110,20 @@
let notificationEventType = result.notificationEventType
let woopId = result.extras && result.extras.dataType === 'woop' && result.extras.value;
console.log("通知", result)
this.globalData.printData.push(JSON.parse(result.android.inAppExtras))
console.log("通知数据",this.globalData.printData)
// printer.getIsData("1")
printer.getData()
if (result.content.includes('订单出餐已超时')) {
this.onPlayAudio(2)
} else{
if(result.content.includes('您有一笔新的订单')){
this.onPlayAudio(4)
}else if(result.content.includes('您有一笔新的到店订单')){
this.onPlayAudio(3)
} else if(result.content.includes('您有一笔订单申请退款')){
this.onPlayAudio(1)
}
this.globalData.printData.push(JSON.parse(result.android.inAppExtras))
printer.getData()
}
console.log("通知数据", this.globalData.printData)
});
jpushModule.isPushStopped(res => {
@ -151,16 +160,16 @@
// #ifdef MP-WEIXIN
this.globalData.GaoDeKey_amapkey = '52de86da47be2ea547c37dd382025a0c'
// #endif
if(!uni.getStorageSync('bluetoothDeviceId')){
if (!uni.getStorageSync('bluetoothDeviceId')) {
uni.showModal({
title: '提示',
content: '您还没有连接打印机,将无法为您打印小票!',
confirmText:'连接蓝牙',
cancelText:'暂不连接',
success: function (res) {
confirmText: '连接蓝牙',
cancelText: '暂不连接',
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url:'/pages/myCenter/setPrint'
url: '/pages/myCenter/setPrint'
})
}
}
@ -174,6 +183,28 @@
},
},
methods: {
onPlayAudio(type) {
var audio = null;
audio = uni.getBackgroundAudioManager();
audio.title = "通知音";
audio.singer = "通知音";
// #ifdef APP-PLUS
if (type == 1) { //退
audio.src = 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/cb24e35cfb1b48a58823633f23398d45.mp3';
} else if (type == 2) { //
audio.src = 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/4d20a1cbc92c42f4b70de1b9dacb7979.mp3';
} else if (type == 3) { //
audio.src = 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/3ced308cf72348a3adeb07d003ced5f3.mp3';
} else if (type == 4) { //
audio.src = 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/c60ef3944e58461fbe7ce23ae38c70a2.mp3';
}
// #endif
audio.play();
audio.onEnded(function(res) {
audio = null;
})
},
getAreaSize() {
var res = uni.getSystemInfoSync()
// console.log(res)

Loading…
Cancel
Save