1
0
forked from dyf/APP

Compare commits

...

3 Commits

10 changed files with 77 additions and 53 deletions

View File

@ -4,7 +4,8 @@ export function login(data) {
return request({
url: '/app/auth/login',
method: 'POST',
data: data
data: data,
isAuthen:false
})
}
// 注册发送验证码

View File

@ -2,7 +2,7 @@
const config = {
// 开发环境
development: {
BASE_URL: 'http://192.168.110.57:8000',//http://139.224.253.23:8000
BASE_URL: 'http://192.168.110.172:8000',//http://139.224.253.23:8000
API_PREFIX: '',
// MQTT 配置
MQTT_HOST: 'www.cnxhyc.com',

View File

@ -2,7 +2,7 @@
"name" : "星汉物联",
"appid" : "__UNI__A21EF43",
"description" : "设备管控",
"versionName" : "1.0.12",
"versionName" : "1.0.14",
"versionCode" : "100",
"transformPx" : false,
/* 5+App */

View File

@ -95,7 +95,7 @@
<view class="warn" style="padding-bottom: 20rpx;">
<view style="padding-bottom: 20rpx;">
<view class="proinfo lamp">

View File

@ -223,6 +223,11 @@
</view>
<view class="proinfo lamp">
<text class="title">产品信息</text>
<view class="itemcontent">
@ -264,7 +269,6 @@
<global-loading ref="loading" />
</view>
</view>
</template>
<script>

View File

@ -147,7 +147,7 @@
</view>
<view class="warn" style="padding-bottom: 20rpx;">
<view style="padding-bottom: 20rpx;">
<view class="proinfo lamp">

View File

@ -183,7 +183,7 @@
</view>
</view>
<view class="warn" style="padding-bottom: 20rpx;">
<view style="padding-bottom: 20rpx;">
<view class="proinfo lamp">

View File

@ -190,7 +190,7 @@
these.device = rec.data;
if (rec.data.bluetoothName) {
these.search = rec.data.bluetoothName;
}else if(rec.data.deviceName){
} else if (rec.data.deviceName) {
these.search = rec.data.deviceName;
}
@ -533,21 +533,15 @@
return;
}
}
showLoading(these,{text:'正在刷新'})
let time = null;
let startSearch = () => {
ble.StopSearch().finally(() => {
let disconnectPromises = [];
if (ble.data && ble.data.LinkedList) {
ble.data.LinkedList.forEach(device => {
console.log(`Requesting disconnect for ${device.deviceId}`);
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
});
if(time){
clearTimeout(time);
}
Promise.allSettled(disconnectPromises).finally(() => {
time = setTimeout(() => {
these.EquipMents = [];
these.PairEquip = [];
@ -563,8 +557,31 @@
content: '开始搜索失败:' + err.msg
});
}
}).finally(()=>{
hideLoading(these);
});
}, 500);
}
ble.StopSearch().finally(() => {
let disconnectPromises = [];
if (ble.data && ble.data.LinkedList) {
ble.data.LinkedList.forEach(device => {
if (device.Linked) {
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
}
});
}
if (disconnectPromises.length > 0) {
Promise.allSettled(disconnectPromises).finally(() => {
startSearch();
});
} else {
startSearch();
}
});
@ -678,8 +695,7 @@
console.log("客户端验证失败");
deviceInvalid();
return;
}
else if (f.macAddress == these.device.deviceMac){
} else if (f.macAddress == these.device.deviceMac) {
console.log("客户端验证成功");
deviceOK();
}

View File

@ -775,7 +775,7 @@ class BleHelper {
str: str,
hexs: hexs
};
// console.log("监听到特征值:" + JSON.stringify(recData));
console.log("监听到特征值:" + JSON.stringify(recData));
if (this.cfg.receivDataCallback) {
if (this.cfg.receivDataCallback.length > 0) {

View File

@ -48,8 +48,11 @@ const request = (options) => {
reject(err);
}
};
if (!options.url.includes('/login')) {
//是否添加身份验证undefined时默认需要
if(options.isAuthen===undefined){
options.isAuthen=true;
}
if (options.isAuthen) {
const token = uni.getStorageSync('token');
const clientid = uni.getStorageSync('clientID');
if (token) {