@@ -41,7 +41,7 @@
},
"quickapp" : {},
"mp-weixin" : {
- "appid" : "wxccd7e2a0911b3397",
+ "appid" : "wx67fbe90ca1db0372",
"setting" : {
"urlCheck" : false,
"es6" : false,
@@ -40,14 +40,9 @@ const ecBLE = require('@/utils/ecBLE/ecBLE.js')
onLoad() {
ctx = this
clearInterval(this.timer);
- const blueid = uni.getStorageSync('blueid');
- if(blueid){
- this.listViewTap(blueid);
- }else{
- this.timer = setInterval(() => {
- ctx.deviceListDataShow = JSON.parse(JSON.stringify(deviceListData))
- }, 800)
- }
+ this.timer = setInterval(() => {
+ ctx.deviceListDataShow = JSON.parse(JSON.stringify(deviceListData))
+ }, 800)
onShow() {
@@ -63,8 +58,11 @@ const ecBLE = require('@/utils/ecBLE/ecBLE.js')
if (res.ok) {
uni.setStorageSync('blueid', id);
ecBLE.stopBluetoothDevicesDiscovery()
- uni.navigateTo({ url: '../device/device' })
+ uni.navigateTo({
+ url: '/pages/weitiandi/bluetooth/index'
+ });
} else {
+ uni.removeStorageSync('blueid');
ecUI.showModal(
'提示',
'连接失败,errCode=' + res.errCode + ',errMsg=' + res.errMsg
@@ -74,10 +72,16 @@ const ecBLE = require('@/utils/ecBLE/ecBLE.js')
ecBLE.createBLEConnection(id)
openBluetoothAdapter() {
+ let self = this;
ecBLE.onBluetoothAdapterStateChange(res => {
console.log('Bluetooth adapter ok')
- ctx.startBluetoothDevicesDiscovery()
+ let blueid = uni.getStorageSync('blueid');
+ if(blueid){
+ self.listViewTap(blueid);
+ }else{
+ ctx.startBluetoothDevicesDiscovery()
+ }
@@ -129,7 +129,6 @@
}
created() {
- debugger
this.checkLogin();
methods: {
@@ -1,5 +1,8 @@
<template>
<view class="container">
+ <view style="position: fixed;right: 1px;" @click="closeSocket">
+ 断开链接
+ </view>
<view class="header">
<view class="header-status chong-active" v-if="portDetail.portStatus == 1">
充电枪未连接
@@ -248,7 +251,11 @@ export default {
//receive data
ecBLE.onBLECharacteristicValueChange((str, strHex) => {
ctx.textRevData = str
+ self.$modal.closeLoading();
console.log("收到消息:"+str);
+ if(1){
+ return
let data = JSON.parse(str);
let type = data.type;
let real_data = data.real_data;
@@ -378,16 +385,6 @@ export default {
getInfo() {
this.$modal.loading("正在获取状态,请稍等...");
sendPortDetailCmd().then(res => {
- this.$modal.loading("正在获取状态,请稍等...");
- this.visitTime = res.msg;
- if(!this.visitTime){
- this.$modal.msg("请重新进入页面");
- return;
- if(!this.scriptTask){
- // this.initSocket(this.deviceInfo.deviceId);
- // this.getPortInfo()
})
stopCharge(){
@@ -439,6 +436,10 @@ export default {
return true;
+ goBack(){
+ uni.navigateBack({
+ },
closeSocket(){
ecBLE.onBLEConnectionStateChange(() => {})
ecBLE.onBLECharacteristicValueChange(() => {})
@@ -41,7 +41,7 @@ const deviceTool = {
function sendData(arr){
arr = changeArr(arr);
let str = arr.join(" ");
- return str;
+ sendBlueData(str);
function changeArr(arr){
@@ -248,6 +248,7 @@ function decToCmd(value) {
//parseData([170,103,18,1,0,0,54,5,0,0,0,0,2,241,25,67,3,75,0,77,0,159])
export function sendPortDetailCmd(){
+ deviceTool.sendPortDetailCmd()
return new Promise(resolve => {
resolve()
});