完成008A功能开发
This commit is contained in:
146
App.vue
146
App.vue
@ -15,25 +15,25 @@
|
||||
console.log("appid=", appid);
|
||||
|
||||
if (appid === 'HBuilder') {
|
||||
let store = uni.getStorageInfoSync();
|
||||
store.keys.forEach((val, index, array) => {
|
||||
if (val == "tokenTime") {
|
||||
let time = uni.getStorageSync(val);
|
||||
if (!time) {
|
||||
time = 0;
|
||||
}
|
||||
let currTime = new Date().getTime();
|
||||
if (currTime >= time) {
|
||||
uni.removeStorageSync(val);
|
||||
uni.removeStorageSync("token");
|
||||
uni.removeStorageSync("clientID");
|
||||
}
|
||||
} else if (val == "token" || val == "clientID" || val == 'phone') {
|
||||
console.log("忽略登陆信息");
|
||||
} else {
|
||||
uni.removeStorageSync(val);
|
||||
}
|
||||
});
|
||||
// let store = uni.getStorageInfoSync();
|
||||
// store.keys.forEach((val, index, array) => {
|
||||
// if (val == "tokenTime") {
|
||||
// let time = uni.getStorageSync(val);
|
||||
// if (!time) {
|
||||
// time = 0;
|
||||
// }
|
||||
// let currTime = new Date().getTime();
|
||||
// if (currTime >= time) {
|
||||
// uni.removeStorageSync(val);
|
||||
// uni.removeStorageSync("token");
|
||||
// uni.removeStorageSync("clientID");
|
||||
// }
|
||||
// } else if (val == "token" || val == "clientID" || val == 'phone') {
|
||||
// console.log("忽略登陆信息");
|
||||
// } else {
|
||||
// uni.removeStorageSync(val);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
|
||||
uni.getPushClientId({
|
||||
success(res) {
|
||||
|
||||
console.log("推送信息:", res);
|
||||
uni.setStorageSync('push_cid', res.cid);
|
||||
},
|
||||
@ -65,29 +66,31 @@
|
||||
//将App角标设置为0,清空app在消息中心的所有消息
|
||||
uni.setAppBadgeNumber(0);
|
||||
plus && plus.push.clear();
|
||||
uni.navigateTo({
|
||||
url:'/pages/common/Msgs/deviceMsg',
|
||||
success(r) {
|
||||
console.log("11111");
|
||||
r.eventChannel.emit("pushMsg",res);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.createPushMessage({
|
||||
title: res.data.title,
|
||||
content: res.data.content,
|
||||
payload: res.data.payload
|
||||
});
|
||||
if(res.data.payload && res.data.payload.force==true){
|
||||
console.log("此消息是强制消息")
|
||||
//设备在线,丢弃消息,只显示强制的消息
|
||||
uni.createPushMessage({
|
||||
title: res.data.title,
|
||||
content: res.data.content,
|
||||
payload: res.data.payload
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.error("设备在线,不是强制消息,丢弃此消息");
|
||||
|
||||
|
||||
});
|
||||
|
||||
//监听网络变化
|
||||
uni.onNetworkStatusChange((res)=>{
|
||||
let title='网络连接已断开';
|
||||
|
||||
if(res.isConnected){
|
||||
title='网络连接已恢复';
|
||||
|
||||
}
|
||||
uni.showToast({
|
||||
title:title
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (system.osName == 'android') {
|
||||
@ -105,14 +108,16 @@
|
||||
},
|
||||
onShow: function() {
|
||||
console.log('App Show');
|
||||
// 取消延迟断开:用户可能只是选文件/录音后返回,不断开蓝牙
|
||||
|
||||
|
||||
//将检查更新换到onshow,因为苹果用户喜欢一直挂着
|
||||
// #ifdef APP|APP-PLUS
|
||||
|
||||
if (_bleDisconnectTimer) {
|
||||
clearTimeout(_bleDisconnectTimer);
|
||||
_bleDisconnectTimer = null;
|
||||
}
|
||||
//将检查更新换到onshow,因为苹果用户喜欢一直挂着
|
||||
// #ifdef APP|APP-PLUS
|
||||
|
||||
|
||||
let appid = plus.runtime.appid;
|
||||
console.log("appid=", appid);
|
||||
|
||||
@ -123,14 +128,28 @@
|
||||
uni.setKeepScreenOn({
|
||||
keepScreenOn: true
|
||||
}).then(res => {
|
||||
console.log("已设置屏幕常亮");
|
||||
console.log("已打开屏幕常亮");
|
||||
}).catch(ex => {
|
||||
console.error("设置屏幕常亮失败,ex=", ex)
|
||||
})
|
||||
});
|
||||
|
||||
//监听网络变化
|
||||
uni.onNetworkStatusChange((res)=>{
|
||||
let title='网络连接已断开';
|
||||
|
||||
if(res.isConnected){
|
||||
title='网络连接已恢复';
|
||||
|
||||
}
|
||||
uni.showToast({
|
||||
title:title
|
||||
|
||||
});
|
||||
});
|
||||
// #endif
|
||||
|
||||
|
||||
},
|
||||
},
|
||||
onHide: function() {
|
||||
console.log('App Hide');
|
||||
// #ifdef APP|APP-PLUS
|
||||
@ -157,11 +176,11 @@
|
||||
if (_bleDisconnectTimer) clearTimeout(_bleDisconnectTimer);
|
||||
_bleDisconnectTimer = setTimeout(() => {
|
||||
_bleDisconnectTimer = null;
|
||||
let ble2 = bleTool.getBleTool();
|
||||
if (ble2) {
|
||||
|
||||
if (ble) {
|
||||
console.log("App隐藏了,断开所有蓝牙设备,停止搜索");
|
||||
ble2.StopSearch().catch(ex => {});
|
||||
ble2.disconnectDevice().catch(ex => {});
|
||||
ble.StopSearch().catch(ex => {});
|
||||
ble.disconnectDevice().catch(ex => {});
|
||||
console.log("断开所有蓝牙设备");
|
||||
|
||||
|
||||
@ -285,13 +304,22 @@
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.colCenter{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.navbarRight .img {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.navbarRight .img:last-child{
|
||||
margin-right: 10rpx !important;
|
||||
}
|
||||
.uni-navbar--fixed {
|
||||
top: 0rpx;
|
||||
}
|
||||
@ -303,17 +331,19 @@
|
||||
::v-deep .uni-navbar__placeholder {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
::v-deep .mescroll-upwarp{
|
||||
text-align: center;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
|
||||
// @font-face {
|
||||
// font-family: "PingFang SC";
|
||||
// src: url("~@/static/fonts/PingFangSC.ttf") format("opentype");
|
||||
// }
|
||||
@font-face {
|
||||
font-family: "PingFang SC";
|
||||
src: url("~@/static/fonts/PingFangSC.ttf") format("opentype");
|
||||
}
|
||||
|
||||
// @font-face {
|
||||
// font-family: "PingFangBold";
|
||||
// src: url("~@/static/fonts/PingFangBold.ttf") format("opentype");
|
||||
// }
|
||||
@font-face {
|
||||
font-family: "PingFangBold";
|
||||
src: url("~@/static/fonts/PingFangSC.ttf") format("opentype");
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user