Merge pull request 'new-20250827 修改安卓蓝牙未开启定位服务的问题' (#32) from liubiao/APP:new-20250827 into main
Reviewed-on: #32
This commit is contained in:
@ -4,7 +4,8 @@ export function login(data) {
|
|||||||
return request({
|
return request({
|
||||||
url: '/app/auth/login',
|
url: '/app/auth/login',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: data
|
data: data,
|
||||||
|
isAuthen:false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 注册发送验证码
|
// 注册发送验证码
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
const config = {
|
const config = {
|
||||||
// 开发环境
|
// 开发环境
|
||||||
development: {
|
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: '',
|
API_PREFIX: '',
|
||||||
// MQTT 配置
|
// MQTT 配置
|
||||||
MQTT_HOST: 'www.cnxhyc.com',
|
MQTT_HOST: 'www.cnxhyc.com',
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name" : "星汉物联",
|
"name" : "星汉物联",
|
||||||
"appid" : "__UNI__A21EF43",
|
"appid" : "__UNI__A21EF43",
|
||||||
"description" : "设备管控",
|
"description" : "设备管控",
|
||||||
"versionName" : "1.0.12",
|
"versionName" : "1.0.15",
|
||||||
"versionCode" : "100",
|
"versionCode" : "100",
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
|
|||||||
@ -95,7 +95,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<view class="warn" style="padding-bottom: 20rpx;">
|
<view style="padding-bottom: 20rpx;">
|
||||||
|
|
||||||
|
|
||||||
<view class="proinfo lamp">
|
<view class="proinfo lamp">
|
||||||
|
|||||||
@ -223,25 +223,30 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<view class="proinfo lamp">
|
|
||||||
<text class="title">产品信息</text>
|
|
||||||
<view class="itemcontent">
|
|
||||||
<view class="item" @click="proParam()">
|
</view>
|
||||||
<image class="img" src="/static/images/6155/DeviceDetail/param.png" mode="aspectFit"></image>
|
|
||||||
<text class="txt">产品参数</text>
|
<view class="proinfo lamp">
|
||||||
</view>
|
<text class="title">产品信息</text>
|
||||||
<view class="item" @click="handRemark()">
|
<view class="itemcontent">
|
||||||
<image class="img" src="/static/images/6155/DeviceDetail/remark.png" mode="aspectFit"></image>
|
<view class="item" @click="proParam()">
|
||||||
<text class="txt">操作说明</text>
|
<image class="img" src="/static/images/6155/DeviceDetail/param.png" mode="aspectFit"></image>
|
||||||
</view>
|
<text class="txt">产品参数</text>
|
||||||
<view class="item" @click="handVideo()">
|
</view>
|
||||||
<image class="img" src="/static/images/6155/DeviceDetail/video.png" mode="aspectFit"></image>
|
<view class="item" @click="handRemark()">
|
||||||
<text class="txt">操作视频</text>
|
<image class="img" src="/static/images/6155/DeviceDetail/remark.png" mode="aspectFit"></image>
|
||||||
</view>
|
<text class="txt">操作说明</text>
|
||||||
|
</view>
|
||||||
|
<view class="item" @click="handVideo()">
|
||||||
|
<image class="img" src="/static/images/6155/DeviceDetail/video.png" mode="aspectFit"></image>
|
||||||
|
<text class="txt">操作视频</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 弹窗通知 -->
|
<!-- 弹窗通知 -->
|
||||||
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
|
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
|
||||||
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
||||||
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
|
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
|
||||||
@ -263,7 +268,6 @@
|
|||||||
</BottomSlideMenuPlus> -->
|
</BottomSlideMenuPlus> -->
|
||||||
|
|
||||||
<global-loading ref="loading" />
|
<global-loading ref="loading" />
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@ -147,7 +147,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view class="warn" style="padding-bottom: 20rpx;">
|
<view style="padding-bottom: 20rpx;">
|
||||||
|
|
||||||
|
|
||||||
<view class="proinfo lamp">
|
<view class="proinfo lamp">
|
||||||
|
|||||||
@ -183,7 +183,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="warn" style="padding-bottom: 20rpx;">
|
<view style="padding-bottom: 20rpx;">
|
||||||
|
|
||||||
|
|
||||||
<view class="proinfo lamp">
|
<view class="proinfo lamp">
|
||||||
|
|||||||
@ -190,7 +190,7 @@
|
|||||||
these.device = rec.data;
|
these.device = rec.data;
|
||||||
if (rec.data.bluetoothName) {
|
if (rec.data.bluetoothName) {
|
||||||
these.search = rec.data.bluetoothName;
|
these.search = rec.data.bluetoothName;
|
||||||
}else if(rec.data.deviceName){
|
} else if (rec.data.deviceName) {
|
||||||
these.search = rec.data.deviceName;
|
these.search = rec.data.deviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,9 +481,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
plus.android.requestPermissions(
|
plus.android.requestPermissions(
|
||||||
['android.permission.ACCESS_FINE_LOCATION'],
|
['android.permission.BLUETOOTH','android.permission.BLUETOOTH_ADMIN','android.permission.ACCESS_FINE_LOCATION','android.permission.ACCESS_COARSE_LOCATION'],
|
||||||
(result) => {
|
(result) => {
|
||||||
if (result.granted.length > 0) {
|
if (result.granted && result.granted.length > 0) {
|
||||||
console.log('定位权限已授予');
|
console.log('定位权限已授予');
|
||||||
resolve(true);
|
resolve(true);
|
||||||
} else {
|
} else {
|
||||||
@ -533,39 +533,40 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
showLoading(these,{text:'正在刷新'})
|
||||||
|
let time = null;
|
||||||
|
let startSearch = () => {
|
||||||
|
|
||||||
|
if(time!==null){
|
||||||
|
clearTimeout(time);
|
||||||
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));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.allSettled(disconnectPromises).finally(() => {
|
time = setTimeout(() => {
|
||||||
|
|
||||||
these.EquipMents = [];
|
these.EquipMents = [];
|
||||||
these.PairEquip = [];
|
these.PairEquip = [];
|
||||||
|
|
||||||
ble.StartSearch().then(result => {
|
ble.StartSearch().then(result => {
|
||||||
console.log("Fresh scan started successfully.");
|
console.log("开始搜索成功",result);
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error("Failed to start fresh scan:", err);
|
console.error("开始搜索失败:", err);
|
||||||
if (err.code === 10001) {
|
if (err.code === 10001) {
|
||||||
these.showOpenSetting();
|
these.showOpenSetting();
|
||||||
} else {
|
} else {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '开始搜索失败:' + err.msg
|
content: '出现错误:' + err.msg
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}).finally(()=>{
|
||||||
|
hideLoading(these);
|
||||||
});
|
});
|
||||||
});
|
}, 200);
|
||||||
});
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ble.StopSearch().finally(startSearch);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -678,8 +679,7 @@
|
|||||||
console.log("客户端验证失败");
|
console.log("客户端验证失败");
|
||||||
deviceInvalid();
|
deviceInvalid();
|
||||||
return;
|
return;
|
||||||
}
|
} else if (f.macAddress == these.device.deviceMac) {
|
||||||
else if (f.macAddress == these.device.deviceMac){
|
|
||||||
console.log("客户端验证成功");
|
console.log("客户端验证成功");
|
||||||
deviceOK();
|
deviceOK();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,12 +76,12 @@ class BleHelper {
|
|||||||
// recei.ReceiveData(receive, f, path, recArr);
|
// recei.ReceiveData(receive, f, path, recArr);
|
||||||
// }, "BleReceiveData");
|
// }, "BleReceiveData");
|
||||||
|
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
this.OpenBlue().then(() => {
|
// this.OpenBlue().then(() => {
|
||||||
this.linkAllDevices();
|
// this.linkAllDevices();
|
||||||
});
|
// });
|
||||||
|
|
||||||
}, 10);
|
// }, 10);
|
||||||
|
|
||||||
this.dic = {
|
this.dic = {
|
||||||
errRemarks: [{
|
errRemarks: [{
|
||||||
@ -139,6 +139,10 @@ class BleHelper {
|
|||||||
{
|
{
|
||||||
key: '10013',
|
key: '10013',
|
||||||
remark: '连接 deviceId 为空或者是格式不正确'
|
remark: '连接 deviceId 为空或者是格式不正确'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '10016',
|
||||||
|
remark: '定位服务已关闭'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -445,7 +449,7 @@ class BleHelper {
|
|||||||
|
|
||||||
getError(ex) {
|
getError(ex) {
|
||||||
let code = ex.code;
|
let code = ex.code;
|
||||||
ex.msg = "未知的异常"
|
ex.msg = code
|
||||||
let f = this.dic.errRemarks.find((v) => {
|
let f = this.dic.errRemarks.find((v) => {
|
||||||
return v.key == code;
|
return v.key == code;
|
||||||
});
|
});
|
||||||
@ -775,7 +779,7 @@ class BleHelper {
|
|||||||
str: str,
|
str: str,
|
||||||
hexs: hexs
|
hexs: hexs
|
||||||
};
|
};
|
||||||
// console.log("监听到特征值:" + JSON.stringify(recData));
|
console.log("监听到特征值:" + JSON.stringify(recData));
|
||||||
if (this.cfg.receivDataCallback) {
|
if (this.cfg.receivDataCallback) {
|
||||||
|
|
||||||
if (this.cfg.receivDataCallback.length > 0) {
|
if (this.cfg.receivDataCallback.length > 0) {
|
||||||
|
|||||||
@ -5,7 +5,16 @@ const request = (options) => {
|
|||||||
console.log("options" + JSON.stringify(options), BASE.BASE_URL)
|
console.log("options" + JSON.stringify(options), BASE.BASE_URL)
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// 处理GET请求参数
|
// 处理GET请求参数
|
||||||
let url = BASE.BASE_URL + options.url;
|
let url ="";
|
||||||
|
if(options.url.indexOf('http://')===0 || options.url.indexOf('https://')===0){
|
||||||
|
url=options.url;
|
||||||
|
if(options.url.indexOf(BASE.BASE_UR)===-1){
|
||||||
|
options.isAuthen=false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
url=BASE.BASE_URL + options.url;
|
||||||
|
}
|
||||||
|
|
||||||
console.log("url" + url)
|
console.log("url" + url)
|
||||||
if (options.method === 'GET' && options.data) {
|
if (options.method === 'GET' && options.data) {
|
||||||
// 使用qs序列化参数
|
// 使用qs序列化参数
|
||||||
@ -48,8 +57,11 @@ const request = (options) => {
|
|||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//是否添加身份验证,undefined时默认需要
|
||||||
if (!options.url.includes('/login')) {
|
if(options.isAuthen===undefined){
|
||||||
|
options.isAuthen=true;
|
||||||
|
}
|
||||||
|
if (options.isAuthen) {
|
||||||
const token = uni.getStorageSync('token');
|
const token = uni.getStorageSync('token');
|
||||||
const clientid = uni.getStorageSync('clientID');
|
const clientid = uni.getStorageSync('clientID');
|
||||||
if (token) {
|
if (token) {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ function checkAndUpdateWgt(updateUrl) {
|
|||||||
}
|
}
|
||||||
// 显示加载提示
|
// 显示加载提示
|
||||||
|
|
||||||
let urls = ['https://dmsapp.skf.com.cn/HummerService/app/CheckUpdate'];
|
let urls = ['https://dmsapp.skf.com.cn/HummerService/app/CheckUpdate'];//
|
||||||
|
|
||||||
// 1. 获取当前应用版本信息
|
// 1. 获取当前应用版本信息
|
||||||
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
|
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
|
||||||
@ -130,7 +130,8 @@ function checkAndUpdateWgt(updateUrl) {
|
|||||||
let Update1 = () => {
|
let Update1 = () => {
|
||||||
return request({
|
return request({
|
||||||
url: '/app/auth/version',
|
url: '/app/auth/version',
|
||||||
method: 'get'
|
method: 'get',
|
||||||
|
isAuthen:false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,16 +213,24 @@ function downloadAndInstallWgt(wgtUrl) {
|
|||||||
console.log("无法删除临时文件");
|
console.log("无法删除临时文件");
|
||||||
},
|
},
|
||||||
complete() {
|
complete() {
|
||||||
wating.close();
|
wating.setTitle("应用已更新,正在重启");
|
||||||
uni.showModal({
|
setTimeout(()=>{
|
||||||
title: '更新完成',
|
wating.close();
|
||||||
content: '应用已更新,是否重启应用?',
|
plus.runtime.restart();
|
||||||
showCancel: false,
|
|
||||||
success: () => {
|
},1000);
|
||||||
// 3. 重启应用
|
|
||||||
plus.runtime.restart();
|
|
||||||
}
|
// uni.showModal({
|
||||||
});
|
// title: '更新完成',
|
||||||
|
// content: '应用已更新,点击确定重启应用',
|
||||||
|
// showCancel: false,
|
||||||
|
// success() {
|
||||||
|
|
||||||
|
// plus.runtime.restart();
|
||||||
|
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user