@@ -28,7 +28,7 @@ | |||
import { ref, reactive } from "vue"; | |||
import { onLoad, onReady } from "@dcloudio/uni-app"; | |||
import { fileURL } from "@/datas/fileURL.js"; | |||
const imgURL = `${fileURL}image/`; | |||
const selectedUrl = "common/selected.png`"; | |||
@@ -64,6 +64,7 @@ | |||
const state = reactive({ | |||
fee: "", | |||
id: "", | |||
cardId: "", | |||
showPopup: false, //显示激活成功提示 | |||
curDeviceId: "", //当前选中的设备ID | |||
@@ -105,9 +106,13 @@ | |||
onLoad((option) => { | |||
routeType.value = option.routeType ? option.routeType : "1"; | |||
state.cardId = option.cardId; | |||
if (option.fee) { | |||
state.fee = option.fee; | |||
} | |||
if (option.id) { | |||
state.id = option.id; | |||
} | |||
console.log("传过来的参数", option) | |||
}); | |||
@@ -194,15 +199,17 @@ | |||
let foundDevices = []; //扫描到的蓝牙列表 | |||
uni.closeBluetoothAdapter(); //先关闭蓝牙 | |||
console.log('执行断开蓝牙方法') | |||
//打开蓝牙 | |||
uni.openBluetoothAdapter({ | |||
success: function (res) { | |||
success: function (item : any) { | |||
console.log('初始化蓝牙模块', item) | |||
uni.startBluetoothDevicesDiscovery({ | |||
success: function (res) { | |||
console.log(res); | |||
console.log('开始搜寻附近的蓝牙外围设备', res); | |||
//扫描结果的监听 | |||
uni.onBluetoothDeviceFound(function (res) { | |||
// console.log(res.devices); | |||
console.log('监听寻找到新设备的事件', res, res.devices); | |||
for (let i = 0; i < res.devices.length; i++) { | |||
let name = res.devices[i]["name"]; | |||
let prefixName = ""; | |||
@@ -281,15 +288,12 @@ | |||
break; | |||
} | |||
device._name = _name; | |||
console.log("device._name", device._name) | |||
if (deviceList.value.length == 0) { | |||
// #ifdef MP-ALIPAY | |||
if (device._name == '聚利' || device._name == '万集' || device._name == '天地融' || device._name == '建投') { | |||
foundDevices.push(device); | |||
console.log("device._name", device._name) | |||
} | |||
// #endif | |||
// #ifdef MP-WEIXIN | |||
foundDevices.push(device); | |||
// #endif | |||
@@ -332,7 +336,7 @@ | |||
console.log(e); | |||
let item = e; | |||
//停止扫描蓝牙 | |||
console.info("停止扫描蓝牙"); | |||
console.info("停止搜寻附近的蓝牙外围设备"); | |||
uni.stopBluetoothDevicesDiscovery({ | |||
success: function (res) { | |||
console.log(device); | |||
@@ -554,6 +558,10 @@ | |||
uni.navigateBack({ | |||
delta: 1 | |||
}) | |||
} else if (routeType.value == "6") { | |||
uni.navigateTo({ | |||
url: "/subpackage/after-sale/activation-once-again/activation-once-again?state=true&id=" + state.id | |||
}); | |||
} else { | |||
return; | |||
} | |||
@@ -588,7 +596,7 @@ | |||
// oks(); | |||
} else { | |||
//断开蓝牙 | |||
// bluetoothUtil.disconnectDevice(); | |||
bluetoothUtil.disconnectDevice(); | |||
datas.setData("bluLinkStatus", false); | |||
datas.setData("connectPrefixName", ""); | |||
tools.showToastAlert("蓝牙已断开"); |
@@ -26,6 +26,7 @@ let tdApi = require("../etc/TDAPI/TDRObuSDK.js"); | |||
let zzApi = require("../etc/WJAPI/wjBleAPI.js"); | |||
let jtApi = require("../etc/JTAPI/BleUtil.js"); | |||
const jlQZApi = require("../etc/JLQZAPI/JLObuSDK.js"); | |||
import { login } from "../../utils/network/api"; | |||
import { | |||
getItem | |||
} from "../../utils/storage"; | |||
@@ -44,6 +45,7 @@ if (getItem('environment') == 'ZFB') { | |||
*/ | |||
function disconnectDevice() { | |||
var connectPrefixName = datas.getData("connectPrefixName"); | |||
console.log('断开蓝牙connectPrefixName',getItem('environment'),tdApi,datas.getData("connectPrefixName")) | |||
switch (connectPrefixName) { | |||
case "WJ": | |||
wjApi.disconnectDevice(function(res) { | |||
@@ -102,7 +104,8 @@ function disconnectDevice() { | |||
}); | |||
break; | |||
case "TD": | |||
tdApi.disConnectDevice(function(res) { | |||
console.log(tdApi,'==================================') | |||
tdApi.disconnectDevice(function(res) { | |||
datas.setData("bluLinkStatus", false); | |||
datas.setData("connectPrefixName", ""); | |||
console.log(res, '=============') |
@@ -216,23 +216,31 @@ | |||
isJH: "" | |||
}); | |||
let cmdRandNum = ''; | |||
let ids = ''; | |||
onLoad((option) => { | |||
console.log('======重新激活开始======', option); | |||
ids = option.id; | |||
//请求订单详情 | |||
queryOrderDetail(option.id); | |||
uni.$on('bluetoothLink', res => { | |||
console.log(res,'===========123'); | |||
if (res.status) { | |||
// getCardRenewal() | |||
setTimeout(()=>{ | |||
getObuId() | |||
}) | |||
} | |||
//移除监听 | |||
console.log('======移除监听======', res) | |||
// uni.$off('bluetoothLink') | |||
}) | |||
// uni.$on('bluetoothLink', res => { | |||
// console.log(res,'===========123'); | |||
// if (res.status) { | |||
// // getCardRenewal() | |||
// setTimeout(()=>{ | |||
// getObuId() | |||
// }) | |||
// } | |||
// //移除监听 | |||
// console.log('======移除监听======', res) | |||
// // uni.$off('bluetoothLink') | |||
// }) | |||
if(option.state){ | |||
setTimeout(()=>{ | |||
getObuId() | |||
}) | |||
} | |||
}); | |||
onShow((option) => { | |||
@@ -269,6 +277,8 @@ | |||
} else { | |||
msg("请上传正确行驶证") | |||
} | |||
// navTo("/pages/bluetooth/bluetooth?routeType=6&id=" + ids); | |||
}; | |||
//获取订单详情 | |||
@@ -309,7 +319,7 @@ | |||
activationRecordQuery().then((val) => { | |||
console.log("jihuo", val) | |||
state.activationNum = val.num | |||
getObuId() | |||
// getObuId() | |||
}); | |||
}); |
@@ -345,8 +345,7 @@ | |||
obu.axleDistance = HexToInt(res.substring(44, 48)); | |||
obu.engineNum = HexToStrig(res.substring(86, 118)); | |||
obu.type = getVehicleType(HexToInt(res.substring(28, 30))); | |||
obu.userType = HexToInt(res.substring(30, 32)) == 1 ? "个人用户" : | |||
"单位用户"; | |||
obu.userType = HexToInt(res.substring(30, 32)) == 1 ? "个人用户" : "单位用户"; | |||
obu.vehiclePlate = HexToStrig(res.substring(0, 24), 2); | |||
//获取车牌颜色 | |||
obu.vehiclePlateColor = getVehiclePlateColor(HexToInt(res | |||
@@ -364,6 +363,8 @@ | |||
}); | |||
//断开蓝牙 | |||
bluetoothUtil.disconnectDevice(); | |||
tools.showToastAlert("蓝牙已断开"); | |||
console.log('蓝牙已断开=========') | |||
return; | |||
} | |||
alertF("OBU_00B400000A+rand+OBU_4F00指令长度不符" + res[1]); |
@@ -1,7 +1,7 @@ | |||
/* 接口中常量 */ | |||
// export const URL = "192.168.100.63"; | |||
export const URL = "trial.etcjz.cn"; | |||
// export const URL = "qtzl.etcjz.cn"; | |||
// export const URL = "trial.etcjz.cn"; | |||
export const URL = "qtzl.etcjz.cn"; | |||
// export const URL = "qtzl.etcjz.cn/test"; | |||
/** | |||
* 配置信息,针对不同的平台进行配置 | |||
@@ -11,8 +11,8 @@ export const URL = "trial.etcjz.cn"; | |||
export const envs = { | |||
//开发环境配置 | |||
development: { | |||
baseUrl: "https://trial.etcjz.cn", | |||
// baseUrl: "https://qtzl.etcjz.cn", | |||
// baseUrl: "https://trial.etcjz.cn", | |||
baseUrl: "https://qtzl.etcjz.cn", | |||
// baseUrl: "https://qtzl.etcjz.cn/test", | |||
// baseUrl: "http://192.168.100.158:8085", | |||
// baseUrl: "http://192.168.100.63:50001", | |||
@@ -21,8 +21,8 @@ export const envs = { | |||
production: { | |||
// baseUrl: "http://192.168.124.6:8087", | |||
// baseUrl: "http://222.85.144.89:19002", | |||
// baseUrl: "https://qtzl.etcjz.cn", | |||
baseUrl: "https://trial.etcjz.cn", | |||
baseUrl: "https://qtzl.etcjz.cn", | |||
// baseUrl: "https://trial.etcjz.cn", | |||
// baseUrl: "https://qtzl.etcjz.cn/test", | |||
// baseUrl: "http://192.168.100.158:8085", | |||
// baseUrl: "http://192.168.100.63:50001", |