蓝牙配对模式优化,提示信息不正确,loading关闭时机不对的问题
蓝牙配对模式,修复提示不正确,loading关闭太早的问题
This commit is contained in:
178
App.vue
Normal file
178
App.vue
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
<script>
|
||||||
|
import bleTool from '@/utils/BleHelper.js'
|
||||||
|
import upgrade from '@/utils/update.js'
|
||||||
|
export default {
|
||||||
|
|
||||||
|
onLaunch: function() {
|
||||||
|
//以下代码仅在开发时使用,否则会出现不可预知的问题。
|
||||||
|
//清除登陆之外的所有信息;
|
||||||
|
// 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);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// uni.clearStorageSync();
|
||||||
|
//以上代码仅在开发时使用,否则会出现不可预知的问题。
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
var appid = plus.runtime.appid;
|
||||||
|
console.log('应用的 appid 为:' + appid);
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
onShow: function() {
|
||||||
|
console.log('App Show');
|
||||||
|
|
||||||
|
//将检查更新换到onshow,因为苹果用户喜欢一直挂着
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: function(res) {
|
||||||
|
if (res.uniPlatform == 'app') {
|
||||||
|
bleTool.getBleTool();
|
||||||
|
let appid = plus.runtime.appid;
|
||||||
|
if (appid !== 'HBuilder') {
|
||||||
|
console.log("appid=", appid);
|
||||||
|
upgrade.checkAndUpdateWgt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onHide: function() {
|
||||||
|
console.log('App Hide');
|
||||||
|
},
|
||||||
|
onError(ex) {
|
||||||
|
console.error("出现了未知的异常",ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import 'vk-uview-ui/index.scss';
|
||||||
|
|
||||||
|
/* #ifdef APP-ANDROID */
|
||||||
|
//苹果应用以下样式后Slider不可拖动
|
||||||
|
uni-slider .uni-slider-handle-wrapper {
|
||||||
|
border-radius: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
uni-slider .uni-slider-thumb {
|
||||||
|
width: 66rpx !important;
|
||||||
|
height: 80rpx !important;
|
||||||
|
margin-top: -40rpx !important;
|
||||||
|
border-radius: 16rpx !important;
|
||||||
|
margin-left: -72rpx !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uni-slider .uni-slider-handle-wrapper {
|
||||||
|
height: 88rpx;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
// }
|
||||||
|
/* #endif */
|
||||||
|
.custom-file-picker .file-picker__box-content {
|
||||||
|
background: rgba(26, 26, 26, 1);
|
||||||
|
border: none !important;
|
||||||
|
border-radius: 45rpx;
|
||||||
|
width: 180rpx;
|
||||||
|
height: 180rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-file-picker.custom-file-picker {
|
||||||
|
overflow: inherit !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-file-picker .icon-add {
|
||||||
|
height: 5rpx !important;
|
||||||
|
width: 70rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-picker-view-mask {
|
||||||
|
background: rgba(42, 42, 42, 1);
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-picker-view-content {
|
||||||
|
position: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-picker-view-wrapper {
|
||||||
|
background: rgba(42, 42, 42, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.green {
|
||||||
|
color: #aed600 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
color: #FF0000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maincontent {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100vh;
|
||||||
|
height: auto;
|
||||||
|
padding: 30rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentBg {
|
||||||
|
background-color: #121212;
|
||||||
|
color: #ffffffde;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.fleft {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fright {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.displayNone {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
.visibilityHidden{
|
||||||
|
visibility: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
align-content: center;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@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");
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -183,10 +183,23 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
debugger;
|
eventChannel = this.getOpenerEventChannel();
|
||||||
|
|
||||||
|
eventChannel.on('detailData', function(rec) {
|
||||||
|
console.log("接收到父页面的参数:", rec);
|
||||||
|
these.device = rec.data;
|
||||||
|
if (rec.data.bluetoothName) {
|
||||||
|
these.search = rec.data.bluetoothName;
|
||||||
|
}else if(rec.data.deviceName){
|
||||||
|
these.search = rec.data.deviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
startValidDevice();
|
||||||
|
|
||||||
|
});
|
||||||
let search = option.search;
|
let search = option.search;
|
||||||
these = this;
|
these = this;
|
||||||
eventChannel = this.getOpenerEventChannel();
|
|
||||||
const systemInfo = uni.getSystemInfoSync();
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
|
||||||
ble = bleTool.getBleTool(); // Ensure ble is initialized
|
ble = bleTool.getBleTool(); // Ensure ble is initialized
|
||||||
@ -451,16 +464,7 @@
|
|||||||
|
|
||||||
StartSubsrib();
|
StartSubsrib();
|
||||||
|
|
||||||
eventChannel.on('detailData', function(rec) {
|
|
||||||
console.log("接收到父页面的参数:", rec);
|
|
||||||
these.device = rec.data;
|
|
||||||
if (rec.data.bluetoothName) {
|
|
||||||
these.search = rec.data.bluetoothName;
|
|
||||||
}
|
|
||||||
|
|
||||||
startValidDevice();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user