018A初步完成
This commit is contained in:
17
App.vue
17
App.vue
@ -35,6 +35,10 @@
|
|||||||
//以上代码仅在开发时使用,否则会出现不可预知的问题。
|
//以上代码仅在开发时使用,否则会出现不可预知的问题。
|
||||||
|
|
||||||
// #ifdef APP|APP-PLUS
|
// #ifdef APP|APP-PLUS
|
||||||
|
|
||||||
|
let system=uni.getSystemInfoSync();
|
||||||
|
|
||||||
|
|
||||||
let initOS = () => {
|
let initOS = () => {
|
||||||
let ble = bleTool.getBleTool();
|
let ble = bleTool.getBleTool();
|
||||||
|
|
||||||
@ -48,14 +52,17 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!uni.setAppBadgeNumber) { //兼容鸿蒙的写法
|
if (!uni.setAppBadgeNumber) { //兼容鸿蒙的写法
|
||||||
uni.setAppBadgeNumber = plus.runtime.setBadgeNumber;
|
if(plus){
|
||||||
|
uni.setAppBadgeNumber = plus.runtime.setBadgeNumber;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
uni.onPushMessage((res) => {
|
uni.onPushMessage((res) => {
|
||||||
console.log("收到推送消息:", res); //监听推送消息
|
console.log("收到推送消息:", res); //监听推送消息
|
||||||
if (res.type == 'click') {
|
if (res.type == 'click') {
|
||||||
//将App角标设置为0,清空app在消息中心的所有消息
|
//将App角标设置为0,清空app在消息中心的所有消息
|
||||||
uni.setAppBadgeNumber(0);
|
uni.setAppBadgeNumber(0);
|
||||||
plus.push.clear();
|
plus && plus.push.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.createPushMessage({
|
uni.createPushMessage({
|
||||||
@ -66,6 +73,7 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plus.os.name == 'Android') {
|
if (plus.os.name == 'Android') {
|
||||||
if (plus.runtime.isAgreePrivacy()) {
|
if (plus.runtime.isAgreePrivacy()) {
|
||||||
initOS();
|
initOS();
|
||||||
@ -75,7 +83,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let system=uni.getSystemInfoSync();
|
|
||||||
console.log("system=",system);
|
console.log("system=",system);
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
@ -206,6 +214,9 @@
|
|||||||
color: #ffffffde;
|
color: #ffffffde;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.uni-app--maxwidth,.uni-body{
|
||||||
|
background-color: #121212;
|
||||||
|
}
|
||||||
|
|
||||||
.fleft {
|
.fleft {
|
||||||
float: left;
|
float: left;
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
<image v-if="item.icon" :src="item.icon" mode="aspectFit"></image>
|
<image v-if="item.icon" :src="item.icon" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<text>{{ item.text }}</text>
|
<text class="itemTxt">{{ item.text }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
@ -139,6 +139,9 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.itemTxt{
|
||||||
|
text-indent: 20rpx;
|
||||||
|
}
|
||||||
.message-popup {
|
.message-popup {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@ -135,30 +135,42 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getTypeStyle(styleType) {
|
getTypeStyle(styleType) {
|
||||||
|
debugger;
|
||||||
const styles = {
|
const styles = {
|
||||||
success: {
|
success: {
|
||||||
bgColor: '#f0fff0',
|
bgColor: '#383934cc',
|
||||||
borderColor: '#52c41a',
|
borderColor: '#52c41a4d',
|
||||||
textColor: '#389e0d',
|
textColor: '#389e0d',
|
||||||
buttonBgColor: '#52c41a',
|
buttonBgColor: '#52c41a',
|
||||||
buttonTextColor: '#FFFFFF'
|
buttonTextColor: '#FFFFFF'
|
||||||
},
|
},
|
||||||
error: {
|
error: {
|
||||||
bgColor: '#fff0f0',
|
bgColor: '#383934cc',
|
||||||
borderColor: '#ff4d4f',
|
borderColor: '#ff4d4f4d',
|
||||||
textColor: '#cf1322',
|
textColor: '#cf1322',
|
||||||
buttonBgColor: '#ff4d4f',
|
buttonBgColor: '#ff4d4f',
|
||||||
buttonTextColor: '#FFFFFF'
|
buttonTextColor: '#FFFFFF'
|
||||||
},
|
},
|
||||||
info: {
|
info: {
|
||||||
bgColor: '#e6f7ff',
|
bgColor: '#383934cc',
|
||||||
borderColor: '#1890ff',
|
borderColor: '#1890ff',
|
||||||
textColor: '#0050b3',
|
textColor: '#0050b3',
|
||||||
buttonBgColor: '#1890ff',
|
buttonBgColor: '#1890ff',
|
||||||
buttonTextColor: '#FFFFFF'
|
buttonTextColor: '#FFFFFF'
|
||||||
|
},
|
||||||
|
customer:{
|
||||||
|
bgColor: '#383934cc',
|
||||||
|
borderColor: '#52c41a4d',
|
||||||
|
textColor: '#389e0d',
|
||||||
|
buttonBgColor: '#52c41a',
|
||||||
|
buttonTextColor: '#232323de'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return styles[this.type][styleType]
|
let f= styles[this.type];
|
||||||
|
if(f){
|
||||||
|
return f[styleType];
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
handleButtonClick() {
|
handleButtonClick() {
|
||||||
|
|
||||||
|
|||||||
@ -140,25 +140,28 @@
|
|||||||
icoUrl: '/static/images/common/uploadErr.png',
|
icoUrl: '/static/images/common/uploadErr.png',
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
bgColor:'#38393466',
|
bgColor:'#383934cc',
|
||||||
buttonTextColor:'#FFFFFFde'
|
buttonTextColor:'#FFFFFFde'
|
||||||
},
|
},
|
||||||
succ: {
|
succ: {
|
||||||
icoUrl: '/static/images/common/success.png',
|
icoUrl: '/static/images/common/success.png',
|
||||||
borderColor: "#BBE6004d",
|
borderColor: "#BBE6004d",
|
||||||
buttonBgColor: "#BBE600",
|
buttonBgColor: "#BBE600",
|
||||||
bgColor:'#38393466'
|
buttonTextColor:'#232323de',
|
||||||
|
bgColor:'#383934cc'
|
||||||
},
|
},
|
||||||
warn: {
|
warn: {
|
||||||
icoUrl: '/static/images/common/warning.png',
|
icoUrl: '/static/images/common/warning.png',
|
||||||
borderColor: "#FFC84E4d",
|
borderColor: "#FFC84E4d",
|
||||||
buttonBgColor: "#FFC84E",
|
buttonBgColor: "#FFC84E",
|
||||||
bgColor:'#38393466'
|
buttonTextColor:'#FFFFFFde',
|
||||||
|
bgColor:'#383934cc'
|
||||||
},
|
},
|
||||||
info:{
|
info:{
|
||||||
borderColor: "#BBE6004d",
|
borderColor: "#BBE6004d",
|
||||||
buttonBgColor: "#BBE600",
|
buttonBgColor: "#BBE600",
|
||||||
bgColor:'#38393466'
|
bgColor:'#383934cc',
|
||||||
|
buttonTextColor:'#232323de'
|
||||||
},
|
},
|
||||||
prompt:{
|
prompt:{
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
currentCanvasWidth: {
|
currentCanvasWidth: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 80
|
default: 96
|
||||||
},
|
},
|
||||||
currentCanvasHeight: {
|
currentCanvasHeight: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@ -147,22 +147,10 @@
|
|||||||
let a = imageData[k + 3];
|
let a = imageData[k + 3];
|
||||||
|
|
||||||
|
|
||||||
// if (r === 255 && a >= 0) {
|
|
||||||
// r = 255;
|
|
||||||
// } else {
|
|
||||||
// r = 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// if (r === 255) {
|
|
||||||
// tmpArr.push(1);
|
|
||||||
// } else {
|
|
||||||
// tmpArr.push(0);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// 黑色像素(R值较低)视为1,白色视为0
|
// 黑色像素(R值较低)视为1,白色视为0
|
||||||
let isBlack = r < 128;
|
// let isBlack = r < 128;
|
||||||
|
let gray = (r + g + b) / 3;
|
||||||
|
let isBlack = gray < 255 ;
|
||||||
|
|
||||||
let byte1 = 0;
|
let byte1 = 0;
|
||||||
|
|
||||||
@ -216,7 +204,7 @@
|
|||||||
ctx.setTextBaseline('middle');
|
ctx.setTextBaseline('middle');
|
||||||
// ctx.setTextAlign('center')
|
// ctx.setTextAlign('center')
|
||||||
ctx.setFontSize(this.fontSize);
|
ctx.setFontSize(this.fontSize);
|
||||||
ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
|
ctx.font = `${this.fontSize}px "PingFang SC","PingFangBold", Arial, sans-serif`;
|
||||||
|
|
||||||
// 4. 绘制当前行文本
|
// 4. 绘制当前行文本
|
||||||
let currentX = 0;
|
let currentX = 0;
|
||||||
|
|||||||
@ -167,7 +167,7 @@
|
|||||||
ctx.setTextBaseline('middle');
|
ctx.setTextBaseline('middle');
|
||||||
// ctx.setTextAlign('center')
|
// ctx.setTextAlign('center')
|
||||||
ctx.setFontSize(this.fontSize);
|
ctx.setFontSize(this.fontSize);
|
||||||
ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
|
ctx.font = `${this.fontSize}px "PingFang SC","PingFangBold", Arial, sans-serif`;
|
||||||
|
|
||||||
// 4. 绘制当前行文本
|
// 4. 绘制当前行文本
|
||||||
let currentX = 0;
|
let currentX = 0;
|
||||||
|
|||||||
@ -171,7 +171,7 @@
|
|||||||
ctx.setTextBaseline('middle');
|
ctx.setTextBaseline('middle');
|
||||||
// ctx.setTextAlign('center')
|
// ctx.setTextAlign('center')
|
||||||
ctx.setFontSize(this.fontSize);
|
ctx.setFontSize(this.fontSize);
|
||||||
ctx.font = `${this.fontSize}px PingFangBold", "PingFang SC", Arial, sans-serif`;
|
ctx.font = `${this.fontSize}px "PingFang SC",PingFangBold", Arial, sans-serif`;
|
||||||
|
|
||||||
// 4. 绘制当前行文本
|
// 4. 绘制当前行文本
|
||||||
let currentX = 0;
|
let currentX = 0;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
const config = {
|
const config = {
|
||||||
// 开发环境
|
// 开发环境
|
||||||
development: {
|
development: {
|
||||||
BASE_URL: 'http://192.168.2.34:8000',//http://139.224.253.23:8000
|
BASE_URL: 'http://192.168.110.57:8000',//http://139.224.253.23:8000
|
||||||
API_PREFIX: '',
|
API_PREFIX: '',
|
||||||
// MQTT 配置
|
// MQTT 配置
|
||||||
MQTT_HOST: '47.120.79.150',
|
MQTT_HOST: '47.120.79.150',
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name" : "星汉物联",
|
"name" : "星汉物联",
|
||||||
"appid" : "__UNI__A21EF43",
|
"appid" : "__UNI__A21EF43",
|
||||||
"description" : "设备管控",
|
"description" : "设备管控",
|
||||||
"versionName" : "1.0.24",
|
"versionName" : "1.0.25",
|
||||||
"versionCode" : 101,
|
"versionCode" : 101,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
|
|||||||
21
pages.json
21
pages.json
@ -180,7 +180,14 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/common/allShare/index",
|
"path": "pages/common/allShare/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "所有分享"
|
"navigationBarTitleText": "所有分享",
|
||||||
|
"app-plus": {
|
||||||
|
"pullToRefresh": {
|
||||||
|
"support": false, // 开启下拉刷新
|
||||||
|
"color": "#FF5500", // 刷新图标颜色,仅 circle 样式支持
|
||||||
|
"style": "default" // 可选 "default" 或 "circle"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -466,6 +473,18 @@
|
|||||||
"navigationStyle": "custom",
|
"navigationStyle": "custom",
|
||||||
"navigationBarTitleText": "HBY210"
|
"navigationBarTitleText": "HBY210"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/common/sosSet/TxtMsgSetting",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "短信设置"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/common/sosSet/LinkManSetting",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "紧急联系人"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
<text class="lbl">设备名称</text>
|
<text class="lbl">设备名称</text>
|
||||||
<text class="value valueFont">{{device.deviceName}}</text>
|
<text class="value valueFont">{{device.deviceName}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">Mac地址</text>
|
<text class="lbl">Mac地址</text>
|
||||||
@ -62,13 +62,13 @@
|
|||||||
<text class="value valueFont">{{formData.sta_system}}</text>
|
<text class="value valueFont">{{formData.sta_system}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<ProParams :id="device.id"></ProParams>
|
<ProParams :id="device.id"></ProParams>
|
||||||
|
|
||||||
<MsgBox ref="msgPop" />
|
<MsgBox ref="msgPop" />
|
||||||
|
|
||||||
<global-loading ref="loading" />
|
<global-loading ref="loading" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -100,7 +100,7 @@
|
|||||||
var ble = null;
|
var ble = null;
|
||||||
var recei = null;
|
var recei = null;
|
||||||
var mq = null;
|
var mq = null;
|
||||||
var pagePath="pages/008A/HBY008A";
|
var pagePath = "pages/008A/HBY008A";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -112,9 +112,11 @@
|
|||||||
apiType: "listA",
|
apiType: "listA",
|
||||||
navbar: {
|
navbar: {
|
||||||
icons: [{
|
icons: [{
|
||||||
|
type:'msg',
|
||||||
src: '/static/images/common/msg.png'
|
src: '/static/images/common/msg.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
type:'share',
|
||||||
src: '/static/images/common/shape.png'
|
src: '/static/images/common/shape.png'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -196,11 +198,11 @@
|
|||||||
onUnload() {
|
onUnload() {
|
||||||
console.log("页面卸载,释放资源");
|
console.log("页面卸载,释放资源");
|
||||||
let statusTopic = `A/${this.formData.imei?this.formData.imei:this.device.deviceImei}`;
|
let statusTopic = `A/${this.formData.imei?this.formData.imei:this.device.deviceImei}`;
|
||||||
if(ble){
|
if (ble) {
|
||||||
ble.removeAllCallback(pagePath);
|
ble.removeAllCallback(pagePath);
|
||||||
ble.removeReceiveCallback(pagePath);
|
ble.removeReceiveCallback(pagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mq) {
|
if (mq) {
|
||||||
mq.unsubscribe(statusTopic);
|
mq.unsubscribe(statusTopic);
|
||||||
mq.disconnect();
|
mq.disconnect();
|
||||||
@ -216,7 +218,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
||||||
these = this;
|
these = this;
|
||||||
recei = BleReceive.getBleReceive();
|
recei = BleReceive.getBleReceive();
|
||||||
ble = BleTool.getBleTool();
|
ble = BleTool.getBleTool();
|
||||||
@ -230,8 +232,8 @@
|
|||||||
|
|
||||||
eventChannel = this.getOpenerEventChannel();
|
eventChannel = this.getOpenerEventChannel();
|
||||||
|
|
||||||
eventChannel.on('detailData', (data)=> {
|
eventChannel.on('detailData', (data) => {
|
||||||
|
|
||||||
console.log("收到父页面的参数:" + JSON.stringify(data));
|
console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||||
var device = data.data;
|
var device = data.data;
|
||||||
these.Status.apiType = data.apiType;
|
these.Status.apiType = data.apiType;
|
||||||
@ -285,7 +287,7 @@
|
|||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -312,12 +314,43 @@
|
|||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
getDevice: function() {
|
||||||
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
|
return v.macAddress == these.device.deviceMac;
|
||||||
|
});
|
||||||
|
|
||||||
|
return f;
|
||||||
|
},
|
||||||
|
showBleUnConnect() {
|
||||||
|
MsgError("蓝牙未连接过该设备,请使用蓝牙重新添加该设备", "去连接", these, () => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/common/addBLE/addEquip",
|
||||||
|
events: {
|
||||||
|
BindOver: function(data) {
|
||||||
|
console.log(data)
|
||||||
|
these.formData.bleStatu = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
success: function(res) {
|
||||||
|
// 通过eventChannel向被打开页面传送数据
|
||||||
|
res.eventChannel.emit('detailData', {
|
||||||
|
data: these.device
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail(ex) {
|
||||||
|
console.log("跳转失败", ex);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
initMQ() {
|
initMQ() {
|
||||||
|
|
||||||
@ -442,8 +475,8 @@
|
|||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
})
|
})
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
@ -451,7 +484,7 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
prevPage() {
|
prevPage() {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -339,36 +339,37 @@
|
|||||||
},
|
},
|
||||||
dic: {
|
dic: {
|
||||||
sta_VoiceType: {
|
sta_VoiceType: {
|
||||||
"1": {
|
|
||||||
key: "1",
|
|
||||||
name: '消防',
|
|
||||||
show: true
|
|
||||||
},
|
|
||||||
"2": {
|
"2": {
|
||||||
key: "2",
|
key: "2",
|
||||||
name: '公安',
|
name: '公安',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
|
"1": {
|
||||||
|
key: "1",
|
||||||
|
name: '消防',
|
||||||
|
show: true
|
||||||
|
},
|
||||||
"3": {
|
"3": {
|
||||||
key: "3",
|
key: "3",
|
||||||
name: '交警',
|
name: '交警',
|
||||||
show: true
|
show: true
|
||||||
|
},
|
||||||
|
"5": {
|
||||||
|
key: "5",
|
||||||
|
name: '应急',
|
||||||
|
show: true
|
||||||
|
},
|
||||||
|
|
||||||
|
"6": {
|
||||||
|
key: "6",
|
||||||
|
name: '医疗',
|
||||||
|
show: true
|
||||||
},
|
},
|
||||||
"4": {
|
"4": {
|
||||||
key: "4",
|
key: "4",
|
||||||
name: '市政',
|
name: '市政',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
"5": {
|
|
||||||
key: "5",
|
|
||||||
name: '应急',
|
|
||||||
show: true
|
|
||||||
},
|
|
||||||
"6": {
|
|
||||||
key: "6",
|
|
||||||
name: '医疗',
|
|
||||||
show: true
|
|
||||||
},
|
|
||||||
"7": {
|
"7": {
|
||||||
key: "7",
|
key: "7",
|
||||||
name: '铁道',
|
name: '铁道',
|
||||||
|
|||||||
@ -334,26 +334,22 @@
|
|||||||
},
|
},
|
||||||
dic: {
|
dic: {
|
||||||
sta_VoiceType: {
|
sta_VoiceType: {
|
||||||
"1": {
|
|
||||||
key: "1",
|
|
||||||
name: '消防',
|
|
||||||
show: true
|
|
||||||
},
|
|
||||||
"0": {
|
"0": {
|
||||||
key: "0",
|
key: "0",
|
||||||
name: '公安',
|
name: '公安',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
|
"1": {
|
||||||
|
key: "1",
|
||||||
|
name: '消防',
|
||||||
|
show: true
|
||||||
|
},
|
||||||
|
|
||||||
"3": {
|
"3": {
|
||||||
key: "3",
|
key: "3",
|
||||||
name: '交警',
|
name: '交警',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
"4": {
|
|
||||||
key: "4",
|
|
||||||
name: '市政',
|
|
||||||
show: true
|
|
||||||
},
|
|
||||||
"2": {
|
"2": {
|
||||||
key: "2",
|
key: "2",
|
||||||
name: '应急',
|
name: '应急',
|
||||||
@ -364,6 +360,11 @@
|
|||||||
name: '医疗',
|
name: '医疗',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
|
"4": {
|
||||||
|
key: "4",
|
||||||
|
name: '市政',
|
||||||
|
show: true
|
||||||
|
},
|
||||||
"5": {
|
"5": {
|
||||||
key: "5",
|
key: "5",
|
||||||
name: '铁道',
|
name: '铁道',
|
||||||
|
|||||||
@ -184,7 +184,8 @@
|
|||||||
isLock: false,
|
isLock: false,
|
||||||
empty: {
|
empty: {
|
||||||
tip: '暂无数据',
|
tip: '暂无数据',
|
||||||
hideScroll: false
|
hideScroll: false,
|
||||||
|
icon: '/static/images/common/empty.png'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
page: 1, // 当前页码
|
page: 1, // 当前页码
|
||||||
|
|||||||
@ -192,7 +192,8 @@
|
|||||||
isLock: false,
|
isLock: false,
|
||||||
empty: {
|
empty: {
|
||||||
tip: "暂无数据",
|
tip: "暂无数据",
|
||||||
hideScroll: false,
|
hideScroll: false,
|
||||||
|
icon: '/static/images/common/empty.png'
|
||||||
},
|
},
|
||||||
textNoMore: "没有更多数据了",
|
textNoMore: "没有更多数据了",
|
||||||
},
|
},
|
||||||
|
|||||||
@ -25,17 +25,11 @@
|
|||||||
<view class="row">
|
<view class="row">
|
||||||
<image class="img" src="/static/images/common/battry.png" mode="aspectFit"></image>
|
<image class="img" src="/static/images/common/battry.png" mode="aspectFit"></image>
|
||||||
<view class="txt">
|
<view class="txt">
|
||||||
<view class="bigTxt">{{formData.battary}}%</view>
|
<view class="bigTxt">{{formData.sta_PowerPercent}}%</view>
|
||||||
<view class="smallTxt">电量</view>
|
<view class="smallTxt">电量</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="row">
|
|
||||||
<image class="img" src="/static/images/common/time.png" mode="aspectFit"></image>
|
|
||||||
<view class="txt">
|
|
||||||
<view class="bigTxt">{{formData.xuhang}}</view>
|
|
||||||
<view class="smallTxt">续航时间</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="eqinfo">
|
<view class="eqinfo">
|
||||||
@ -69,15 +63,15 @@
|
|||||||
<view class="multiValue" @click.stop="gotoMap()">
|
<view class="multiValue" @click.stop="gotoMap()">
|
||||||
<view class="valueItem valueFont">
|
<view class="valueItem valueFont">
|
||||||
{{formData.sta_longitude}}
|
{{formData.sta_longitude}}
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="valueItem valueFont">
|
<view class="valueItem valueFont">
|
||||||
|
|
||||||
{{formData.sta_latitude}}
|
{{formData.sta_latitude}}
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="valueItem">
|
<view class="valueItem">
|
||||||
|
|
||||||
<view style="width:80%;float: right;text-align: right;" class="valueFont">
|
<view style="width:80%;float: right;text-align: right;" class="valueFont">
|
||||||
<uni-icons type="location" size="17" color="rgba(255, 255, 255, 0.8)"
|
<uni-icons type="location" size="17" color="rgba(255, 255, 255, 0.8)"
|
||||||
style="vertical-align: bottom;" />
|
style="vertical-align: bottom;" />
|
||||||
@ -86,46 +80,109 @@
|
|||||||
<view class="clear"></view>
|
<view class="clear"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="warnnig" :class="ShakeBit?'':'displayNone'">
|
||||||
|
<view>{{ShakeBit}}!</view>
|
||||||
|
<view>{{AlarmTime}}</view>
|
||||||
|
<uni-icons type="closeempty" size="16" color="#FFFFFF" @click="CloseWarn()"></uni-icons>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view class="lampMode">
|
<view class="lampMode">
|
||||||
<view class="mode " :class="{active:formData.sta_SOSGrade=='2'}" v-on:click.stop="sosSetting(2)">
|
<view class="mode " :class="{active:formData.sta_SOSGrade=='2'}" v-on:click.stop="sosSetting(2)">
|
||||||
<view class="leftImg">
|
<view class="leftImg">
|
||||||
<image v-show="formData.sta_SOSGrade!='2'" class="img" src="/static/images/670/rb.png" mode="aspectFit"></image>
|
<image v-show="formData.sta_SOSGrade!='2'" class="img" src="/static/images/670/rb.png"
|
||||||
<image v-show="formData.sta_SOSGrade=='2'" class="img" src="/static/images/670/rbActive.png" mode="aspectFit"></image>
|
mode="aspectFit"></image>
|
||||||
|
<image v-show="formData.sta_SOSGrade=='2'" class="img" src="/static/images/670/rbActive.png"
|
||||||
|
mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="rightTxt">
|
<view class="rightTxt">
|
||||||
<text class="bigTxt">红蓝警示</text>
|
<text class="bigTxt">红蓝警示</text>
|
||||||
<text class="smallTxt">{{formData.sta_SOSGrade=='2'?'开启':'关闭'}}</text>
|
<text class="smallTxt">{{formData.sta_SOSGrade=='2'?'开启':'关闭'}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mode " :class="{active:formData.sta_SOSGrade=='1'}" v-on:click.stop="sosSetting(1)">
|
<view class="mode " :class="{active:formData.sta_SOSGrade=='1'}" v-on:click.stop="sosSetting(1)">
|
||||||
<view class="leftImg">
|
<view class="leftImg">
|
||||||
<image v-show="formData.sta_SOSGrade!='1'" class="img" src="/static/images/670/sg.png" mode="aspectFit"></image>
|
<image v-show="formData.sta_SOSGrade!='1'" class="img" src="/static/images/670/sg.png"
|
||||||
<image v-show="formData.sta_SOSGrade=='1'" class="img" src="/static/images/670/sgActive.png" mode="aspectFit"></image>
|
mode="aspectFit"></image>
|
||||||
|
<image v-show="formData.sta_SOSGrade=='1'" class="img" src="/static/images/670/sgActive.png"
|
||||||
|
mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="rightTxt">
|
<view class="rightTxt">
|
||||||
<text class="bigTxt">声光报警</text>
|
<text class="bigTxt">声光报警</text>
|
||||||
<text class="smallTxt">{{formData.sta_SOSGrade=='1'?'开启':'关闭'}}</text>
|
<text class="smallTxt">{{formData.sta_SOSGrade=='1'?'开启':'关闭'}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mode " :class="{active:formData.sta_RadarType=='1'}" v-on:click.stop="redarSetting(1)">
|
<view class="mode " :class="{active:formData.sta_RadarType=='1'}"
|
||||||
|
v-on:click.stop="showAction">
|
||||||
<view class="leftImg">
|
<view class="leftImg">
|
||||||
<image v-show="formData.sta_RadarType=='1'" class="img" src="/static/images/102/redarActive.png" mode="aspectFit"></image>
|
<image v-show="formData.sta_RadarType=='1'" class="img" src="/static/images/102/redarActive.png"
|
||||||
<image v-show="formData.sta_RadarType!='1'" class="img" src="/static/images/102/redar.png" mode="aspectFit"></image>
|
mode="aspectFit"></image>
|
||||||
|
<image v-show="formData.sta_RadarType!='1'" class="img" src="/static/images/102/redar.png"
|
||||||
|
mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="rightTxt">
|
<view class="rightTxt">
|
||||||
<text class="bigTxt">物体感应</text>
|
<text class="bigTxt">雷达感应</text>
|
||||||
<text class="smallTxt">{{formData.sta_RadarType=='1'?'开启':'关闭'}}</text>
|
<text class="smallTxt">{{formData.sta_RadarType==0?'关闭':formData.sta_RadarType+'M'}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<view class="mode " :class="{active:formData.sta_InfraRed=='1'}"
|
||||||
|
v-on:click.stop="toggleSetting(1,'InfraRed')">
|
||||||
|
<view class="leftImg">
|
||||||
|
<image v-show="formData.sta_InfraRed=='1'" class="img" src="/static/images/common/hongwaiActive.png"
|
||||||
|
mode="aspectFit"></image>
|
||||||
|
<image v-show="formData.sta_InfraRed!='1'" class="img" src="/static/images/common/hongwai.png"
|
||||||
|
mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
<view class="rightTxt">
|
||||||
|
<text class="bigTxt">红外感应</text>
|
||||||
|
<text class="smallTxt">{{formData.sta_InfraRed=='1'?'开启':'关闭'}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<view class="usrinfo">
|
||||||
|
<view>
|
||||||
|
<text class="usrtitle fleft">人员信息登记</text>
|
||||||
|
<view class="btnSend fright" v-on:click.stop="sendUsr">发送</view>
|
||||||
|
<view class="clear"></view>
|
||||||
|
<TextToHexV1 class="TextToHex" ref="textToHex" :txts="formData.textLines" :bgColor="'#FFFFFF'"
|
||||||
|
:color="'#000000'" :fontSize="16" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="item">
|
||||||
|
<text class="lbl">单位:</text>
|
||||||
|
<input class="value" v-model.trim="formData.textLines[0]" placeholder="请输入单位" maxlength="8"
|
||||||
|
placeholder-class="usrplace" />
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<text class="lbl">部门:</text>
|
||||||
|
<input class="value" v-model.trim="formData.textLines[1]" placeholder="请输入姓名" maxlength="8"
|
||||||
|
placeholder-class="usrplace" />
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<text class="lbl">姓名:</text>
|
||||||
|
<input class="value" v-model.trim="formData.textLines[2]" placeholder="请输入职位" maxlength="8"
|
||||||
|
placeholder-class="usrplace" />
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<text class="lbl">ID:</text>
|
||||||
|
<input class="value" v-model.trim="formData.textLines[3]" placeholder="ID" maxlength="16"
|
||||||
|
placeholder-class="usrplace" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<BottomSlideMenuPlus :config="Status.BottomMenu" @btnClick="btnClick" @itemClick="itemClick" @close="closeActionSheet"></BottomSlideMenuPlus>
|
||||||
<ProParams :id="device.id"></ProParams>
|
<ProParams :id="device.id"></ProParams>
|
||||||
<MsgBox ref="msgPop" />
|
<MsgBox ref="msgPop" />
|
||||||
<global-loading ref="loading" />
|
<global-loading ref="loading" />
|
||||||
@ -133,6 +190,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import usrApi from '@/api/670/HBY670.js';
|
||||||
|
import TextToHexV1 from '@/components/TextToHex/TextToHexV1.vue';
|
||||||
import request from '@/utils/request.js';
|
import request from '@/utils/request.js';
|
||||||
import {
|
import {
|
||||||
showLoading,
|
showLoading,
|
||||||
@ -161,6 +220,9 @@
|
|||||||
var pagePath = "/pages/210/HBY210";
|
var pagePath = "/pages/210/HBY210";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
TextToHexV1
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
Status: {
|
Status: {
|
||||||
@ -181,12 +243,61 @@
|
|||||||
height: 90
|
height: 90
|
||||||
},
|
},
|
||||||
usrToggle: true,
|
usrToggle: true,
|
||||||
bleLinkCnt: 0
|
bleLinkCnt: 0,
|
||||||
|
BottomMenu: {
|
||||||
|
show: false,
|
||||||
|
showHeader: true,
|
||||||
|
menuItems: [{
|
||||||
|
text: '2M',
|
||||||
|
value: 2,
|
||||||
|
icon: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '4M',
|
||||||
|
value: 4,
|
||||||
|
icon: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '7M',
|
||||||
|
value: 7,
|
||||||
|
icon: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '10M',
|
||||||
|
value: 10,
|
||||||
|
icon: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '关闭',
|
||||||
|
value: 0,
|
||||||
|
icon: ''
|
||||||
|
}
|
||||||
|
],
|
||||||
|
activeIndex: -1,
|
||||||
|
bgColor: '#2a2a2a',
|
||||||
|
itemBgColor: '#3a3a3a',
|
||||||
|
textColor: '#ffffffde',
|
||||||
|
textAlign: 'flex-start',
|
||||||
|
title: '雷达设置',
|
||||||
|
showDivider: false,
|
||||||
|
dividerColor: '#00000000',
|
||||||
|
dividerThickness: '0rpx',
|
||||||
|
dividerMargin: '10rpx',
|
||||||
|
itemHeight: '80rpx',
|
||||||
|
type: '',
|
||||||
|
showBtn: true,
|
||||||
|
btnBgColor: "#bbe600",
|
||||||
|
btnText: "确定",
|
||||||
|
btnTextColor: "#232323de",
|
||||||
|
showMask: true,
|
||||||
|
maskBgColor: '#00000066',
|
||||||
|
showClose: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
formData: {
|
formData: {
|
||||||
img: '/static/images/common/BJQ6075.png',
|
img: '/static/images/common/HBY210.png',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
address: "", //地址
|
address: "", //地址
|
||||||
|
|
||||||
company: "湖北消防总队", //单位
|
company: "湖北消防总队", //单位
|
||||||
@ -197,14 +308,17 @@
|
|||||||
deviceId: "",
|
deviceId: "",
|
||||||
|
|
||||||
bleStatu: false,
|
bleStatu: false,
|
||||||
|
sta_AlarmTime:0,
|
||||||
sta_PowerPercent: "",
|
sta_PowerPercent: "",
|
||||||
sta_PowerTime: "",
|
sta_PowerTime: "",
|
||||||
sta_SOSGrade: '',
|
sta_SOSGrade:0,
|
||||||
sta_longitude: "",
|
sta_longitude: "",
|
||||||
sta_latitude: "",
|
sta_latitude: "",
|
||||||
sta_system: "", //设备状态,0关机,1仅充电,2开机未充电,3,开机且充电
|
sta_system: "", //设备状态,0关机,1仅充电,2开机未充电,3,开机且充电
|
||||||
sta_RadarType:""
|
sta_RadarType: "",
|
||||||
|
sta_ShakeBit: 0, //报警状态
|
||||||
|
sta_InfraRed:0,
|
||||||
|
textLines: ['湖北星汉文化', '有限', '公司','12345678']
|
||||||
},
|
},
|
||||||
device: {
|
device: {
|
||||||
id: "",
|
id: "",
|
||||||
@ -231,6 +345,35 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
AlarmTime(){
|
||||||
|
if(this.formData.sta_AlarmTime){
|
||||||
|
return Common.formatTime(this.formData.sta_AlarmTime,"second");
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
ShakeBit() {
|
||||||
|
//"sta_ShakeBit":0-未报警,1-强制报警,2静止报警,3撞击报警,4雷达报警,5漏电报警,6触水报警,7红外报警
|
||||||
|
let dic = {
|
||||||
|
"0": "",
|
||||||
|
"1": "设备强制报警中",
|
||||||
|
"2": "设备静止报警中",
|
||||||
|
"3": "设备疑似受到撞击",
|
||||||
|
"4": "设备雷达报警中",
|
||||||
|
"5": "设监测到漏电",
|
||||||
|
"6": "设备触水报警中",
|
||||||
|
"7": "红外闯入报警中"
|
||||||
|
};
|
||||||
|
let keys = Object.keys(dic);
|
||||||
|
let f = keys.find(v => {
|
||||||
|
return v == this.formData.sta_ShakeBit;
|
||||||
|
});
|
||||||
|
if (f) {
|
||||||
|
let str= dic[f]
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
getbleStatu() {
|
getbleStatu() {
|
||||||
if (this.formData.bleStatu === true) {
|
if (this.formData.bleStatu === true) {
|
||||||
return '已连接';
|
return '已连接';
|
||||||
@ -246,18 +389,18 @@
|
|||||||
}
|
}
|
||||||
return '未连接';
|
return '未连接';
|
||||||
},
|
},
|
||||||
sta_system(){
|
sta_system() {
|
||||||
//0关机,1仅充电,2开机未充电,3,开机且充电
|
//0关机,1仅充电,2开机未充电,3,开机且充电
|
||||||
if(this.formData.sta_system=='0'){
|
if (this.formData.sta_system == '0') {
|
||||||
return '已关机'
|
return '已关机'
|
||||||
}
|
}
|
||||||
if(this.formData.sta_system=='1'){
|
if (this.formData.sta_system == '1') {
|
||||||
return '仅充电'
|
return '仅充电'
|
||||||
}
|
}
|
||||||
if(this.formData.sta_system=='2'){
|
if (this.formData.sta_system == '2') {
|
||||||
return '开机未充电'
|
return '开机未充电'
|
||||||
}
|
}
|
||||||
if(this.formData.sta_system=='3'){
|
if (this.formData.sta_system == '3') {
|
||||||
return '开机充电中'
|
return '开机充电中'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,7 +481,7 @@
|
|||||||
});
|
});
|
||||||
if (!f) {
|
if (!f) {
|
||||||
these.showBleUnConnect();
|
these.showBleUnConnect();
|
||||||
these.getDetail();
|
// these.getDetail();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let form = f.formData;
|
let form = f.formData;
|
||||||
@ -355,7 +498,7 @@
|
|||||||
} else if (these.device.deviceImei) {
|
} else if (these.device.deviceImei) {
|
||||||
these.formData['imei'] = these.device.deviceImei;
|
these.formData['imei'] = these.device.deviceImei;
|
||||||
}
|
}
|
||||||
these.getDetail();
|
// these.getDetail();
|
||||||
|
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
@ -369,91 +512,373 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
redarSetting(val) {
|
showAction(){
|
||||||
let f=this.getDevice();
|
this.Status.BottomMenu.show = true;
|
||||||
|
|
||||||
|
this.Status.BottomMenu.menuItems.find((v,i)=>{
|
||||||
|
if(this.formData.sta_RadarType==v.value){
|
||||||
|
this.Status.BottomMenu.activeIndex=i;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
btnClick(){
|
||||||
|
this.Status.BottomMenu.show = false;
|
||||||
|
|
||||||
|
let d=this.Status.BottomMenu.menuItems[this.Status.BottomMenu.activeIndex];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let f = this.getDevice();
|
||||||
|
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
this.showBleUnConnect();
|
this.showBleUnConnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let newVal = null;
|
|
||||||
if (val == this.formData.sta_RadarType) {
|
|
||||||
newVal = 0;
|
|
||||||
}else{
|
|
||||||
newVal=val;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
let bleSend = () => {
|
||||||
let bleSend=()=>{
|
let json = {ins_RadarType:d.value};
|
||||||
let json={ins_RadarType:newVal};
|
|
||||||
json=JSON.stringify(json);
|
json = JSON.stringify(json);
|
||||||
if(ble){
|
if (ble) {
|
||||||
ble.sendString(f.deviceId, json).then(res=>{
|
ble.sendString(f.deviceId, json).then(res => {
|
||||||
this.formData.sta_RadarType=newVal;
|
console.log("send success")
|
||||||
}).catch(ex=>{
|
this.formData.sta_RadarType = d.value;
|
||||||
|
}).catch(ex => {
|
||||||
this.mqSend(json);
|
this.mqSend(json);
|
||||||
this.formData.sta_RadarType=newVal;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bleSend();
|
bleSend();
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
sosSetting(val) {
|
itemClick(item, index) {
|
||||||
let f=this.getDevice();
|
this.Status.BottomMenu.activeIndex=index;
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
closeActionSheet() {
|
||||||
|
this.Status.BottomMenu.show = false;
|
||||||
|
},
|
||||||
|
sendUsr() {
|
||||||
|
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
|
||||||
|
|
||||||
|
|
||||||
|
MsgError('无操作权限', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let f = this.getDevice();
|
||||||
|
if (!f) {
|
||||||
|
these.showBleUnConnect()
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let toByteValue = (value) => {
|
||||||
|
if (typeof value === 'number') {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
if (value.startsWith('0x') || value.startsWith('0X')) {
|
||||||
|
return parseInt(value, 16);
|
||||||
|
}
|
||||||
|
return parseInt(`0x${value}`, 16);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
let err = false;
|
||||||
|
this.formData.textLines.find((txt) => {
|
||||||
|
if (txt.length === 0) {
|
||||||
|
console.log("txt=", txt);
|
||||||
|
err = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
if (err) {
|
||||||
|
MsgError('单位、部门、姓名、ID必须填写', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showLoading(these, {
|
||||||
|
text: "请稍候..."
|
||||||
|
});
|
||||||
|
//握手
|
||||||
|
let holdHand = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
updateLoading(these, {
|
||||||
|
text: '设备准备中...'
|
||||||
|
})
|
||||||
|
let hexs = 'word transmit start';
|
||||||
|
ble.sendString(f.deviceId, hexs, f.writeServiceId, f.wirteCharactId, 10).then(res => {
|
||||||
|
setTimeout(() => {
|
||||||
|
resolve(res)
|
||||||
|
}, 2200);
|
||||||
|
|
||||||
|
}).catch(ex => {
|
||||||
|
reject(ex)
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//画图
|
||||||
|
let drawText = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.$refs.textToHex.drawAndGetPixels().then(allPixels => {
|
||||||
|
if (!allPixels) {
|
||||||
|
reject("文本初始化失败");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
resolve(allPixels);
|
||||||
|
}).catch(compEx => {
|
||||||
|
reject(compEx);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//发送3个分包的数据
|
||||||
|
let task = (allPixels) => {
|
||||||
|
try {
|
||||||
|
let combinedData = [];
|
||||||
|
for (let i = 0; i < this.formData.textLines.length; i++) {
|
||||||
|
let linePixels = (allPixels[i] || []).flat(Infinity).map(item =>
|
||||||
|
typeof item === 'string' ? toByteValue(item) : item
|
||||||
|
);
|
||||||
|
for (var j = linePixels.length; j < 256; j++) {
|
||||||
|
linePixels.push(0x00);
|
||||||
|
|
||||||
|
}
|
||||||
|
combinedData.push([0xFA, 0x06, i + 1, 1].concat(linePixels.slice(0, 128)));
|
||||||
|
combinedData.push([0xFA, 0x06, i + 1, 2].concat(linePixels.slice(128, 256)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
combinedData.push([0x74, 0x72, 0x61, 0x6E, 0x73, 0x6D, 0x69, 0x74, 0x20, 0x63, 0x6F, 0x6D,
|
||||||
|
0x70, 0x6C, 0x65, 0x74, 0x65
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let curr = 1;
|
||||||
|
let len = combinedData.length;
|
||||||
|
console.log(combinedData);
|
||||||
|
showLoading(these, {
|
||||||
|
text: '正在发送' + (curr - 1) + '/' + len
|
||||||
|
});
|
||||||
|
|
||||||
|
//分包发送
|
||||||
|
let sendPacket = () => {
|
||||||
|
|
||||||
|
if (combinedData.length === curr - 1) {
|
||||||
|
|
||||||
|
these.setBleFormData();
|
||||||
|
|
||||||
|
MsgSuccess("发送成功", '', these);
|
||||||
|
let json = {
|
||||||
|
deviceId: these.device.id,
|
||||||
|
name: these.formData.textLines[1],
|
||||||
|
position: these.formData.textLines[0],
|
||||||
|
unitName: these.formData.textLines[2],
|
||||||
|
code: ""
|
||||||
|
};
|
||||||
|
usrApi.sendUsr(json);
|
||||||
|
|
||||||
|
hideLoading(these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let array = combinedData[curr - 1];
|
||||||
|
|
||||||
|
|
||||||
|
ble.sendHexs(f.deviceId, array, f.writeServiceId, f.wirteCharactId, 10).then(
|
||||||
|
res => {
|
||||||
|
|
||||||
|
|
||||||
|
updateLoading(these, {
|
||||||
|
text: '正在发送' + curr + '/' + len
|
||||||
|
});
|
||||||
|
curr++;
|
||||||
|
setTimeout(sendPacket, 300);
|
||||||
|
}).catch(err => {
|
||||||
|
if (err.code == '10007') {
|
||||||
|
|
||||||
|
setTimeout(sendPacket, 300);
|
||||||
|
} else {
|
||||||
|
console.log("err:", err);
|
||||||
|
hideLoading(these);
|
||||||
|
MsgError("发送失败: " + (err.msg || err.message), '', these)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(sendPacket, 0);
|
||||||
|
// 5. 发送成功处理
|
||||||
|
|
||||||
|
|
||||||
|
} catch (ex) {
|
||||||
|
hideLoading(these);
|
||||||
|
|
||||||
|
MsgError("发送失败: " + (ex.msg || ex.message), '', these);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
Promise.allSettled([holdHand(), drawText()]).then(results => {
|
||||||
|
console.log("results=", results)
|
||||||
|
if (results[0].status == 'rejected') {
|
||||||
|
updateLoading(these, {
|
||||||
|
text: results[0].reason
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
hideLoading(these)
|
||||||
|
}, 500);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (results[1].status == 'rejected') {
|
||||||
|
updateLoading(these, {
|
||||||
|
text: results[1].reason
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
hideLoading(these)
|
||||||
|
}, 500);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
task(results[1].value);
|
||||||
|
})
|
||||||
|
|
||||||
|
}, 0);
|
||||||
|
},
|
||||||
|
toggleSetting(val, type) {
|
||||||
|
let f = this.getDevice();
|
||||||
|
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
this.showBleUnConnect();
|
this.showBleUnConnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let sta_type = "sta_" + type;
|
||||||
|
let newVal = null;
|
||||||
|
if (val == this.formData[sta_type]) {
|
||||||
|
newVal = 0;
|
||||||
|
} else {
|
||||||
|
newVal = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let bleSend = () => {
|
||||||
|
let json = {};
|
||||||
|
json['ins_' + type] = newVal
|
||||||
|
json = JSON.stringify(json);
|
||||||
|
if (ble) {
|
||||||
|
ble.sendString(f.deviceId, json).then(res => {
|
||||||
|
console.log("send success")
|
||||||
|
this.formData[sta_type] = newVal;
|
||||||
|
}).catch(ex => {
|
||||||
|
this.mqSend(json);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bleSend();
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
CloseWarn(){
|
||||||
|
let f = this.getDevice();
|
||||||
|
|
||||||
|
// #ifdef APP
|
||||||
|
if (!f) {
|
||||||
|
this.showBleUnConnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef WEB
|
||||||
|
f={deviceId:12345}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
let bleSend = () => {
|
||||||
|
let json = {
|
||||||
|
ins_ShakeBit: 0
|
||||||
|
};
|
||||||
|
json = JSON.stringify(json);
|
||||||
|
if (ble) {
|
||||||
|
ble.sendString(f.deviceId, json).then(res => {
|
||||||
|
this.formData.sta_ShakeBit = 0;
|
||||||
|
this.formData.sta_InfraRed=0;
|
||||||
|
}).catch(ex => {
|
||||||
|
this.mqSend(json);
|
||||||
|
this.formData.sta_ShakeBit = 0;
|
||||||
|
this.formData.sta_InfraRed=0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MsgError('确定解除报警?', '', these, bleSend);
|
||||||
|
},
|
||||||
|
sosSetting(val) {
|
||||||
|
let f = this.getDevice();
|
||||||
|
|
||||||
|
|
||||||
|
if (!f) {
|
||||||
|
this.showBleUnConnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let newVal = null;
|
let newVal = null;
|
||||||
if (val == this.formData.sta_SOSGrade) {
|
if (val == this.formData.sta_SOSGrade) {
|
||||||
newVal = 0;
|
newVal = 0;
|
||||||
}else{
|
} else {
|
||||||
newVal=val;
|
newVal = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let msg="";
|
let msg = "";
|
||||||
if (newVal == 0 && this.formData.sta_SOSGrade == 1) {
|
if (newVal == 0 && this.formData.sta_SOSGrade == 1) {
|
||||||
msg="确定解除声光报警?";
|
msg = "确定解除声光报警?";
|
||||||
|
|
||||||
|
} else if (newVal == 1) {
|
||||||
|
msg = "确定开启声光报警?";
|
||||||
}
|
}
|
||||||
else if (newVal == 1) {
|
let bleSend = () => {
|
||||||
msg="确定开启声光报警?";
|
let json = {
|
||||||
}
|
ins_SOSGrade: newVal
|
||||||
let bleSend=()=>{
|
};
|
||||||
let json={ins_SOSGrade:newVal};
|
json = JSON.stringify(json);
|
||||||
json=JSON.stringify(json);
|
if (ble) {
|
||||||
if(ble){
|
ble.sendString(f.deviceId, json).then(res => {
|
||||||
ble.sendString(f.deviceId, json).then(res=>{
|
this.formData.sta_SOSGrade = newVal;
|
||||||
this.formData.sta_SOSGrade=newVal;
|
}).catch(ex => {
|
||||||
}).catch(ex=>{
|
|
||||||
this.mqSend(json);
|
this.mqSend(json);
|
||||||
this.formData.sta_SOSGrade=newVal;
|
this.formData.sta_SOSGrade = newVal;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg){
|
if (msg) {
|
||||||
MsgError(msg,'',these,()=>{
|
MsgError(msg, '', these, () => {
|
||||||
bleSend();
|
bleSend();
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
bleSend();
|
bleSend();
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
if (v.macAddress == these.device.deviceMac) {
|
if (v.macAddress == these.device.deviceMac) {
|
||||||
if (!this.formData.deviceId) {
|
if (!this.formData.deviceId) {
|
||||||
@ -462,7 +887,7 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
},
|
},
|
||||||
bleStatuToggle() {
|
bleStatuToggle() {
|
||||||
@ -492,20 +917,25 @@
|
|||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
mqSend(json){
|
mqSend(json) {
|
||||||
if(mq){
|
if (mq) {
|
||||||
mq.publish("B/" + this.device.deviceImei, json).then(res=>{
|
mq.publish("B/" + this.device.deviceImei, json).then(res => {
|
||||||
|
let keys = Object.keys(JSON.parse(json));
|
||||||
}).catch(ex=>{
|
for (let i = 0; i < keys.length; i++) {
|
||||||
|
let key = keys[i];
|
||||||
|
let state = key.replace('ins_', 'sta_');
|
||||||
|
this.formData[state] = json[key];
|
||||||
|
}
|
||||||
|
}).catch(ex => {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
showBleUnConnect() {
|
showBleUnConnect() {
|
||||||
MsgError("蓝牙未连接过该设备,请使用蓝牙重新添加该设备",'去连接',this,()=>{
|
MsgError("蓝牙未连接过该设备,请使用蓝牙重新添加该设备", '去连接', this, () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/common/addBLE/addEquip",
|
url: "/pages/common/addBLE/addEquip",
|
||||||
events: {
|
events: {
|
||||||
@ -522,7 +952,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
initMQ() {
|
initMQ() {
|
||||||
|
|
||||||
@ -869,7 +1299,7 @@
|
|||||||
padding: 30rpx 0rpx;
|
padding: 30rpx 0rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-content: space-around;
|
align-content: space-around;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -891,11 +1321,12 @@ display: flex;
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
border: 1rpx solid #00000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lampMode .mode.active {
|
.lampMode .mode.active {
|
||||||
|
|
||||||
border: 1px solid rgba(174, 214, 0, 1);
|
border: 1rpx solid rgba(174, 214, 0, 1) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lampMode .mode.active .bigTxt {
|
.lampMode .mode.active .bigTxt {
|
||||||
@ -939,7 +1370,7 @@ display: flex;
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
|
||||||
letter-spacing: 0.07px;
|
letter-spacing: 0.07px;
|
||||||
|
border: 1px solid #00000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.usrinfo {
|
.usrinfo {
|
||||||
@ -1424,4 +1855,11 @@ display: flex;
|
|||||||
/deep/ .uni-navbar__placeholder {
|
/deep/ .uni-navbar__placeholder {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.TextToHex {
|
||||||
|
position: fixed;
|
||||||
|
top: -99999rpx;
|
||||||
|
left: -99999rpx;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -291,7 +291,8 @@
|
|||||||
MsgClose,
|
MsgClose,
|
||||||
MsgWarning,
|
MsgWarning,
|
||||||
showPop,
|
showPop,
|
||||||
MsgInfo
|
MsgInfo,
|
||||||
|
MsgClear
|
||||||
} from '@/utils/MsgPops.js'
|
} from '@/utils/MsgPops.js'
|
||||||
const pagePath = "/pages/4877/BJQ4877";
|
const pagePath = "/pages/4877/BJQ4877";
|
||||||
|
|
||||||
@ -1180,6 +1181,7 @@
|
|||||||
if (receive.deviceId !== this.formData.deviceId) {
|
if (receive.deviceId !== this.formData.deviceId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("收到设备的数据", receive)
|
console.log("收到设备的数据", receive)
|
||||||
let data = recei.ReceiveData(receive, device, pagePath, recArr);
|
let data = recei.ReceiveData(receive, device, pagePath, recArr);
|
||||||
console.log("处理后的数据:", data);
|
console.log("处理后的数据:", data);
|
||||||
@ -1206,6 +1208,7 @@
|
|||||||
}
|
}
|
||||||
if (msg.length) {
|
if (msg.length) {
|
||||||
msg = msg.join(",");
|
msg = msg.join(",");
|
||||||
|
MsgClear(these);
|
||||||
this.showMsg(msg);
|
this.showMsg(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1349,23 +1352,13 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
showMsg(msg, isSucc) {
|
showMsg(msg, isSucc) {
|
||||||
let icoUrl = '/static/images/common/uploadErr.png';
|
|
||||||
let borderColor = "#e034344d";
|
|
||||||
let buttonBgColor = "#E03434";
|
|
||||||
if (isSucc) {
|
if (isSucc) {
|
||||||
icoUrl = '/static/images/common/success.png';
|
MsgSuccess(msg,'',this);
|
||||||
borderColor = "#BBE600";
|
}
|
||||||
buttonBgColor = "#BBE600";
|
else{
|
||||||
|
MsgError(msg,'',this);
|
||||||
}
|
}
|
||||||
showPop({
|
|
||||||
message: msg,
|
|
||||||
iconUrl: icoUrl,
|
|
||||||
borderColor: borderColor,
|
|
||||||
buttonBgColor: buttonBgColor,
|
|
||||||
buttonText: '确定',
|
|
||||||
okCallback: null
|
|
||||||
},this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,14 +39,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="warnnig" :class="formData.sta_ShakeBit!=0 ?'':'displayNone'">
|
|
||||||
<view>{{formData.sta_ShakeBit==3?'设备疑似受到外力碰撞':'设备声光报警中'}}!</view>
|
|
||||||
<view @click.stop="SOSToggle()">
|
|
||||||
<uni-icons type="closeempty" color="#FFFFFFde" size="16"></uni-icons>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -119,8 +112,15 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="warnnig" :class="formData.sta_ShakeBit!=0 ?'':'displayNone'">
|
||||||
|
<view>{{formData.sta_ShakeBit==3?'设备疑似受到外力碰撞':'设备声光报警中'}}!</view>
|
||||||
|
<view @click.stop="SOSToggle()">
|
||||||
|
<uni-icons type="closeempty" color="#FFFFFFde" size="16"></uni-icons>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="lamp">
|
<view class="lamp">
|
||||||
<view class="title">
|
<view class="title">
|
||||||
<text>灯光亮度</text>
|
<text>灯光亮度</text>
|
||||||
@ -223,10 +223,7 @@
|
|||||||
<text class="lbl">职位:</text>
|
<text class="lbl">职位:</text>
|
||||||
<input class="value" v-model="formData.job" placeholder="请输入职位" placeholder-class="usrplace" />
|
<input class="value" v-model="formData.job" placeholder="请输入职位" placeholder-class="usrplace" />
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
|
||||||
<text class="lbl">ID号:</text>
|
|
||||||
<input class="value" v-model="formData.usrid" placeholder="请输入ID" placeholder-class="usrplace" />
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -625,7 +622,7 @@
|
|||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: '确定',
|
buttonText: '确定',
|
||||||
buttonTextColor: '#232323de',
|
buttonTextColor: '#FFFFFFde',
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
showHeader: false,
|
showHeader: false,
|
||||||
visibleClose: true,
|
visibleClose: true,
|
||||||
@ -1128,7 +1125,7 @@
|
|||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sizeType: ['original', 'compressed'],
|
sizeType: ['original', 'compressed'],
|
||||||
sourceType: ['album'],
|
sourceType: ['album','camera'],
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/common/ImgCrop/ImgCrop",
|
url: "/pages/common/ImgCrop/ImgCrop",
|
||||||
@ -1426,7 +1423,7 @@
|
|||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: '确定',
|
buttonText: '确定',
|
||||||
buttonTextColor: '#232323de',
|
buttonTextColor: '#FFFFFFde',
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
buttonCancelText: '取消',
|
buttonCancelText: '取消',
|
||||||
okCallback: send
|
okCallback: send
|
||||||
@ -1463,7 +1460,7 @@
|
|||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: '确定',
|
buttonText: '确定',
|
||||||
buttonTextColor: '#232323de',
|
buttonTextColor: '#FFFFFFde',
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
showHeader: true,
|
showHeader: true,
|
||||||
visibleClose: false,
|
visibleClose: false,
|
||||||
@ -1522,9 +1519,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.formData.textLines = [this.formData.company, this.formData.usrname, this.formData.job, this.formData
|
this.formData.textLines = [this.formData.company, this.formData.usrname, this.formData.job];
|
||||||
.usrid
|
|
||||||
];
|
|
||||||
console.log("data=", this.formData.textLines);
|
console.log("data=", this.formData.textLines);
|
||||||
showLoading(these, {
|
showLoading(these, {
|
||||||
text: "发送中"
|
text: "发送中"
|
||||||
@ -1590,11 +1585,14 @@
|
|||||||
let sendPacket = () => {
|
let sendPacket = () => {
|
||||||
|
|
||||||
if (combinedData.length === curr - 1) {
|
if (combinedData.length === curr - 1) {
|
||||||
holdHand('transmit complete', 200).then(res => {
|
setTimeout(()=>{
|
||||||
|
holdHand('transmit complete', 200).then(res => {
|
||||||
MsgSuccess("人员信息发送成功", "确定", these);
|
MsgSuccess("人员信息发送成功", "确定", these);
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
this.setBleFormData();
|
this.setBleFormData();
|
||||||
});
|
});
|
||||||
|
},300);
|
||||||
|
|
||||||
hideLoading();
|
hideLoading();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1608,7 +1606,7 @@
|
|||||||
curr++;
|
curr++;
|
||||||
console.log("发送成功", curr);
|
console.log("发送成功", curr);
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: '发送中,' + (curr - 1) + '/' + 4
|
text: '发送中,' + (curr - 1) + '/' + combinedData.length
|
||||||
})
|
})
|
||||||
setTimeout(sendPacket, 250);
|
setTimeout(sendPacket, 250);
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|||||||
@ -865,7 +865,7 @@
|
|||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sizeType: ['original', 'compressed'],
|
sizeType: ['original', 'compressed'],
|
||||||
sourceType: ['album'],
|
sourceType: ['album','camera'],
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/common/ImgCrop/ImgCrop",
|
url: "/pages/common/ImgCrop/ImgCrop",
|
||||||
|
|||||||
@ -903,7 +903,7 @@
|
|||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sizeType: ['original', 'compressed'],
|
sizeType: ['original', 'compressed'],
|
||||||
sourceType: ['album'],
|
sourceType: ['album','camera'],
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/common/ImgCrop/ImgCrop",
|
url: "/pages/common/ImgCrop/ImgCrop",
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
<view class="battery-v1">
|
<view class="battery-v1">
|
||||||
<image src="/static/images/common/time.png" class="dlIMG" mode="aspectFit"></image>
|
<image src="/static/images/common/time.png" class="dlIMG" mode="aspectFit"></image>
|
||||||
<view>
|
<view>
|
||||||
<view class="battery-v2">{{ deviceInfo.batteryRemainingTime || '0' }}分钟</view>
|
<view class="battery-v2">{{remainTime}}</view>
|
||||||
<view class="battery-v3">续航时间</view>
|
<view class="battery-v3">续航时间</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -54,13 +54,13 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="info-row" v-if="itemInfo.deviceMac" @click="bleStatuToggle">
|
<view class="info-row" v-if="itemInfo.deviceMac" @click="bleStatuToggle">
|
||||||
<text class="info-label">蓝牙状态</text>
|
<text class="info-label">蓝牙状态</text>
|
||||||
<text class="info-value status-running" :class="formData.bleStatu?'green':'red'" >
|
<text class="info-value status-running" :class="formData.bleStatu?'green':'red'">
|
||||||
{{getbleStatu}}
|
{{getbleStatu}}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-row" v-if="itemInfo.deviceMac" @click="bleStatuToggle">
|
<view class="info-row" v-if="itemInfo.deviceMac" @click="bleStatuToggle">
|
||||||
<text class="info-label">充电状态</text>
|
<text class="info-label">充电状态</text>
|
||||||
<text class="info-value status-running" >
|
<text class="info-value status-running">
|
||||||
{{deviceInfo.chargeState != 0?'充电中':'未充电'}}
|
{{deviceInfo.chargeState != 0?'充电中':'未充电'}}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
@ -112,7 +112,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mode-v1" v-if="hasPermission('2')">
|
<view class="mode-v1" v-if="hasPermission('2')" :class="{'active':isLaserOn}">
|
||||||
<view class="mode-v2" @click="lasermode">
|
<view class="mode-v2" @click="lasermode">
|
||||||
<image src="/static/images/6170/jg.png" class="setIMG" mode="aspectFit"></image>
|
<image src="/static/images/6170/jg.png" class="setIMG" mode="aspectFit"></image>
|
||||||
<view>
|
<view>
|
||||||
@ -121,17 +121,20 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mode-v1" :class="{'active':itemInfo.alarmStatus===1 || itemInfo.alarmStatus==='1'}" >
|
<view class="mode-v1"
|
||||||
|
:class="{'active':itemInfo.alarmStatus===1 || itemInfo.alarmStatus==='1'}">
|
||||||
<view class="mode-v2" @click="warnToggle">
|
<view class="mode-v2" @click="warnToggle">
|
||||||
<image v-show="itemInfo.alarmStatus!=1" src="/static/images/common/sg.png" class="setIMG" mode="aspectFit"></image>
|
<image v-show="itemInfo.alarmStatus!=1" src="/static/images/common/sg.png"
|
||||||
<image v-show="itemInfo.alarmStatus==1" src="/static/images/common/sgActive.png" class="setIMG" mode="aspectFit"></image>
|
class="setIMG" mode="aspectFit"></image>
|
||||||
|
<image v-show="itemInfo.alarmStatus==1" src="/static/images/common/sgActive.png"
|
||||||
|
class="setIMG" mode="aspectFit"></image>
|
||||||
<view>
|
<view>
|
||||||
<view class="battery-v2">{{itemInfo.alarmStatus==1?'解除报警':'强制报警'}}</view>
|
<view class="battery-v2">{{itemInfo.alarmStatus==1?'解除报警':'强制报警'}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mode-v1" v-if="hasPermission('3')">
|
<view class="mode-v1" v-if="hasPermission('3')">
|
||||||
<view class="mode-v2" @click="uploadStartup">
|
<view class="mode-v2" @click="uploadStartup">
|
||||||
<image src="/static/images/common/path7.png" class="setIMG" mode="aspectFit"></image>
|
<image src="/static/images/common/path7.png" class="setIMG" mode="aspectFit"></image>
|
||||||
@ -147,7 +150,7 @@
|
|||||||
<!-- 人员信息登记 -->
|
<!-- 人员信息登记 -->
|
||||||
<view class="form-section" v-if="hasPermission('4')">
|
<view class="form-section" v-if="hasPermission('4')">
|
||||||
<TextToHexV2 class="TextToHex" ref="textToHex" :txts="formData.textLines" :bgColor="'#FFFFFF'"
|
<TextToHexV2 class="TextToHex" ref="textToHex" :txts="formData.textLines" :bgColor="'#FFFFFF'"
|
||||||
:color="'#000000'" :fontSize="14" :returnType="10" />
|
:color="'#000000'" :fontSize="12" :returnType="10" />
|
||||||
|
|
||||||
<view class="mode-buttons">
|
<view class="mode-buttons">
|
||||||
<view class="section-title">人员信息登记</view>
|
<view class="section-title">人员信息登记</view>
|
||||||
@ -161,17 +164,16 @@
|
|||||||
<view class="form-row">
|
<view class="form-row">
|
||||||
<text class="form-label">单位:</text>
|
<text class="form-label">单位:</text>
|
||||||
<input class="form-input" placeholder="请输入单位" v-model="personnelInfo.unitName"
|
<input class="form-input" placeholder="请输入单位" v-model="personnelInfo.unitName"
|
||||||
:maxlength="15" />
|
:maxlength="8" />
|
||||||
</view>
|
</view>
|
||||||
<view class="form-row">
|
<view class="form-row">
|
||||||
<text class="form-label">姓名:</text>
|
<text class="form-label">姓名:</text>
|
||||||
<input class="form-input" placeholder="请输入姓名" v-model="personnelInfo.name"
|
<input class="form-input" placeholder="请输入姓名" v-model="personnelInfo.name" :maxlength="8" />
|
||||||
:maxlength="15" />
|
|
||||||
</view>
|
</view>
|
||||||
<view class="form-row">
|
<view class="form-row">
|
||||||
<text class="form-label">职位:</text>
|
<text class="form-label">职位:</text>
|
||||||
<input class="form-input" placeholder="请输入职位" v-model="personnelInfo.position"
|
<input class="form-input" placeholder="请输入职位" v-model="personnelInfo.position"
|
||||||
:maxlength="15" />
|
:maxlength="8" />
|
||||||
</view>
|
</view>
|
||||||
<view class="form-row">
|
<view class="form-row">
|
||||||
<text class="form-label">ID:</text>
|
<text class="form-label">ID:</text>
|
||||||
@ -180,7 +182,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 人员信息登记 -->
|
<!-- 发送信息-->
|
||||||
<view class="form-section" v-if="hasPermission('5')">
|
<view class="form-section" v-if="hasPermission('5')">
|
||||||
<view class="mode-buttons">
|
<view class="mode-buttons">
|
||||||
<view class="section-title">发送信息</view>
|
<view class="section-title">发送信息</view>
|
||||||
@ -193,7 +195,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 产品信息 -->
|
<!-- 产品信息 -->
|
||||||
<ProParams :id="itemInfo.id"></ProParams>
|
<ProParams :id="itemInfo.id"></ProParams>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<!-- 弹框 -->
|
<!-- 弹框 -->
|
||||||
<view class="agreement-mask" v-if="lightModeA" @click.stop="closePopup">
|
<view class="agreement-mask" v-if="lightModeA" @click.stop="closePopup">
|
||||||
@ -276,15 +278,17 @@
|
|||||||
<CustomPopup v-if="popupType === 'cancel'" :show="showPopupFlag"
|
<CustomPopup v-if="popupType === 'cancel'" :show="showPopupFlag"
|
||||||
popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage"
|
popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage"
|
||||||
icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="true"
|
icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="true"
|
||||||
@confirm="onPopupConfirmPolice" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
|
@cancel="onPopupConfirm" @confirm="onPopupConfirmPolice" confirmBtnBg="rgba(224, 52, 52, 1)"
|
||||||
|
confirmBtnColor="#fff" />
|
||||||
|
|
||||||
<!-- 强制报警 -->
|
<!-- 强制报警 -->
|
||||||
<CustomPopup v-if="popupType === 'openWarn'" :show="showPopupFlag"
|
<CustomPopup v-if="popupType === 'openWarn'" :show="showPopupFlag"
|
||||||
popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage"
|
popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage"
|
||||||
icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="true"
|
icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="true"
|
||||||
@confirm="OpenWarn(1)" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
|
@cancel="onPopupConfirm" @confirm="OpenWarn(1)" confirmBtnBg="rgba(224, 52, 52, 1)"
|
||||||
|
confirmBtnColor="#fff" />
|
||||||
|
|
||||||
|
|
||||||
<MsgBox ref="msgPop" />
|
<MsgBox ref="msgPop" />
|
||||||
<global-loading ref="loading" />
|
<global-loading ref="loading" />
|
||||||
</view>
|
</view>
|
||||||
@ -306,7 +310,8 @@
|
|||||||
MsgError,
|
MsgError,
|
||||||
MsgClose,
|
MsgClose,
|
||||||
MsgWarning,
|
MsgWarning,
|
||||||
showPop
|
showPop,
|
||||||
|
MsgInfo
|
||||||
} from '@/utils/MsgPops.js';
|
} from '@/utils/MsgPops.js';
|
||||||
import Common from '@/utils/Common.js';
|
import Common from '@/utils/Common.js';
|
||||||
|
|
||||||
@ -355,7 +360,7 @@
|
|||||||
navTitle: "",
|
navTitle: "",
|
||||||
sliderValue: 25,
|
sliderValue: 25,
|
||||||
lightModeA: false,
|
lightModeA: false,
|
||||||
currentMainMode: '强光',
|
currentMainMode: '关闭',
|
||||||
currentlaserMode: "关闭",
|
currentlaserMode: "关闭",
|
||||||
lightModeB: false,
|
lightModeB: false,
|
||||||
lightModeC: false, //激光提示框
|
lightModeC: false, //激光提示框
|
||||||
@ -402,7 +407,7 @@
|
|||||||
rgb565Data: null,
|
rgb565Data: null,
|
||||||
selectedItemIndex: 0,
|
selectedItemIndex: 0,
|
||||||
popupType: 'person', //弹框类型
|
popupType: 'person', //弹框类型
|
||||||
isLaserOn: false,
|
isLaserOn: false, //激光开启状态
|
||||||
isSending: false,
|
isSending: false,
|
||||||
isProcessing: false,
|
isProcessing: false,
|
||||||
isPolling: false, // 轮询状态
|
isPolling: false, // 轮询状态
|
||||||
@ -418,6 +423,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
remainTime() {
|
||||||
|
return Common.formatTime(this.deviceInfo.batteryRemainingTime);
|
||||||
|
},
|
||||||
computedDeviceId() {
|
computedDeviceId() {
|
||||||
return this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId;
|
return this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId;
|
||||||
},
|
},
|
||||||
@ -442,7 +450,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onReceive(deviceState){//蓝牙/Mq通用消息处理
|
|
||||||
|
onReceive(deviceState, parsedMessage) { //蓝牙/Mq通用消息处理
|
||||||
switch (deviceState[0]) {
|
switch (deviceState[0]) {
|
||||||
// 1设备切换灯光实时返回
|
// 1设备切换灯光实时返回
|
||||||
case 1:
|
case 1:
|
||||||
@ -452,13 +461,21 @@
|
|||||||
this.sliderValue = deviceState[2];
|
this.sliderValue = deviceState[2];
|
||||||
this.deviceInfo.batteryRemainingTime = deviceState[3];
|
this.deviceInfo.batteryRemainingTime = deviceState[3];
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
if(deviceState[1]==50){
|
||||||
|
this.popupType = 'person';
|
||||||
|
this.showPopupFlag = true;
|
||||||
|
this.popupMessage = '信息发送成功';
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
break;
|
||||||
// 12为设备实时上报
|
// 12为设备实时上报
|
||||||
case 12:
|
case 12:
|
||||||
this.currentMainMode = this.getMainLightModeLabel(
|
this.currentMainMode = this.getMainLightModeLabel(deviceState[1]);
|
||||||
deviceState[
|
|
||||||
1]);
|
|
||||||
this.isLaserOn = deviceState[2] === 1; //第3位表示当时激光灯档位
|
this.isLaserOn = deviceState[2] === 1; //第3位表示当时激光灯档位
|
||||||
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
|
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
|
||||||
|
this.deviceInfo.alarmStatus= deviceState[6];//报警状态
|
||||||
|
this.itemInfo.alarmStatus= deviceState[6];
|
||||||
if (this.deviceInfo) {
|
if (this.deviceInfo) {
|
||||||
this.deviceInfo.batteryPercentage = deviceState[3]; //第4位电量百分比
|
this.deviceInfo.batteryPercentage = deviceState[3]; //第4位电量百分比
|
||||||
this.deviceInfo.chargeState = deviceState[4]; //第5位为充电状态(0没有充电,1正在充电,2为已充满)
|
this.deviceInfo.chargeState = deviceState[4]; //第5位为充电状态(0没有充电,1正在充电,2为已充满)
|
||||||
@ -501,19 +518,19 @@
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
|
if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:"+ex.msg,"确定",these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
if (ble) {
|
if (ble) {
|
||||||
@ -556,7 +573,7 @@
|
|||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: '去连接',
|
buttonText: '去连接',
|
||||||
buttonTextColor: '#FFFFFFde',
|
buttonTextColor: '#FFFFFFde',
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
okCallback: function() {
|
okCallback: function() {
|
||||||
console.log("1111");
|
console.log("1111");
|
||||||
@ -583,10 +600,15 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let data = rec.ReceiveData(receive, device, pagePath, recArr);
|
let data = rec.ReceiveData(receive, device, pagePath, recArr);
|
||||||
console.log("蓝牙收到消息", data)
|
let keys = Object.keys(data);
|
||||||
this.onReceive(data.state);
|
if (keys.length && "state" in data) {
|
||||||
|
this.onReceive(data.state, receive.str);
|
||||||
|
} else {
|
||||||
|
console.log("不是状态数据,丢弃", data);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
bleStateBreak() {
|
bleStateBreak() {
|
||||||
if (this.Status.pageHide) {
|
if (this.Status.pageHide) {
|
||||||
return;
|
return;
|
||||||
@ -620,7 +642,7 @@
|
|||||||
text: ex.msg
|
text: ex.msg
|
||||||
})
|
})
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:"+ex.msg,"确定",these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
@ -737,60 +759,62 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onSliderChanging(e) {
|
onSliderChanging(e) {
|
||||||
if (!this.cardRect) return;
|
|
||||||
let value = e.detail.value;
|
let value = e.detail.value;
|
||||||
if (value < 10) {
|
|
||||||
value = 10;
|
|
||||||
}
|
|
||||||
this.sliderValue = value; // 实时更新UI
|
this.sliderValue = value; // 实时更新UI
|
||||||
const now = Date.now();
|
return;
|
||||||
// 使用节流防止指令发送过于频繁
|
// const now = Date.now();
|
||||||
if (now - this.lastBrightnessTime > 200) { // 200毫秒节流
|
// // 使用节流防止指令发送过于频繁
|
||||||
this.lastBrightnessTime = now;
|
// if (now - this.lastBrightnessTime > 200) { // 200毫秒节流
|
||||||
|
// this.lastBrightnessTime = now;
|
||||||
|
|
||||||
let mqSend = () => {
|
// let mqSend = () => {
|
||||||
|
|
||||||
// 增加轻微的震动反馈,提升手感
|
// // 增加轻微的震动反馈,提升手感
|
||||||
uni.vibrateShort({
|
// uni.vibrateShort({
|
||||||
type: 'light'
|
// type: 'light'
|
||||||
});
|
// });
|
||||||
|
|
||||||
let data = {
|
// let data = {
|
||||||
deviceId: this.computedDeviceId,
|
// deviceId: this.computedDeviceId,
|
||||||
instructValue: this.sliderValue + '.00',
|
// instructValue: this.sliderValue + '.00',
|
||||||
deviceImei: this.itemInfo.deviceImei,
|
// deviceImei: this.itemInfo.deviceImei,
|
||||||
}
|
// }
|
||||||
lightBrightnessSettings(data).then((res) => {
|
// lightBrightnessSettings(data).then((res) => {
|
||||||
if (res.code !== 200) {
|
// if (res.code !== 200) {
|
||||||
// 可以在这里处理错误,但滑动中不建议用toast
|
// // 可以在这里处理错误,但滑动中不建议用toast
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (ble && this.itemInfo.deviceMac) {
|
// if (ble && this.itemInfo.deviceMac) {
|
||||||
let f = this.getDevice();
|
// let f = this.getDevice();
|
||||||
if (f) {
|
// if (f) {
|
||||||
let json = {
|
// let json = {
|
||||||
instruct: [5, 0, 0, 0, 0]
|
// instruct: [5, 0, 0, 0, 0]
|
||||||
};
|
// };
|
||||||
json.instruct[1] = parseInt(this.sliderValue);
|
// json.instruct[1] = parseInt(this.sliderValue);
|
||||||
|
|
||||||
ble.sendString(f.deviceId, json).then(res => {
|
// ble.sendString(f.deviceId, json).then(res => {
|
||||||
|
|
||||||
}).catch(ex => {
|
// }).catch(ex => {
|
||||||
mqSend();
|
// mqSend();
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
mqSend();
|
// mqSend();
|
||||||
}
|
// }
|
||||||
return;
|
// return;
|
||||||
} else {
|
// } else {
|
||||||
mqSend();
|
// mqSend();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
onSliderChangeEnd(e) {
|
onSliderChangeEnd(e) {
|
||||||
|
if (this.deviceInfo.alarmStatus == 1) {
|
||||||
|
MsgError('请先解除强制报警', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
let value = e.detail.value;
|
let value = e.detail.value;
|
||||||
if (value < 10) {
|
if (value < 10) {
|
||||||
value = 10;
|
value = 10;
|
||||||
@ -847,6 +871,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectMode(type) {
|
selectMode(type) {
|
||||||
|
if (this.deviceInfo.alarmStatus == 1) {
|
||||||
|
MsgError('请先解除强制报警', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.modeType = type;
|
this.modeType = type;
|
||||||
this.lightModeA = true;
|
this.lightModeA = true;
|
||||||
if (type === 'main') {
|
if (type === 'main') {
|
||||||
@ -906,7 +934,10 @@
|
|||||||
},
|
},
|
||||||
// 灯光模式的确认
|
// 灯光模式的确认
|
||||||
handleSumbit() {
|
handleSumbit() {
|
||||||
|
if (this.deviceInfo.alarmStatus == 1) {
|
||||||
|
MsgError('请先解除强制报警', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.selectedItemIndex === null) return;
|
if (this.selectedItemIndex === null) return;
|
||||||
const selectedItem = this.items[this.selectedItemIndex];
|
const selectedItem = this.items[this.selectedItemIndex];
|
||||||
@ -928,8 +959,13 @@
|
|||||||
};
|
};
|
||||||
lightModeSettings(data).then((res) => {
|
lightModeSettings(data).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.currentMainMode = this.pendingMainMode;
|
|
||||||
this.selectedItemIndex = selectedItem;
|
this.selectedItemIndex = selectedItem;
|
||||||
|
|
||||||
|
this.currentMainMode = this.getMainLightModeLabel(selectedItem.instructValue);
|
||||||
|
this.isLaserOn = false; //第3位表示当时激光灯档位
|
||||||
|
this.currentlaserMode = "关闭";
|
||||||
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@ -959,8 +995,11 @@
|
|||||||
json.instruct[1] = parseInt(selectedItem.instructValue);
|
json.instruct[1] = parseInt(selectedItem.instructValue);
|
||||||
|
|
||||||
ble.sendString(f.deviceId, json).then(res => {
|
ble.sendString(f.deviceId, json).then(res => {
|
||||||
console.log("ble send success",json);
|
console.log("ble send success", json);
|
||||||
this.lightModeA = false;
|
this.lightModeA = false;
|
||||||
|
this.currentMainMode = this.getMainLightModeLabel(selectedItem.instructValue);
|
||||||
|
this.isLaserOn = false;
|
||||||
|
this.currentlaserMode = "关闭";
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
console.error("ble send fail,mqsending....")
|
console.error("ble send fail,mqsending....")
|
||||||
mqSend();
|
mqSend();
|
||||||
@ -976,15 +1015,23 @@
|
|||||||
},
|
},
|
||||||
// 激光模式
|
// 激光模式
|
||||||
lasermode() {
|
lasermode() {
|
||||||
|
if (this.deviceInfo.alarmStatus == 1) {
|
||||||
|
MsgError('请先解除强制报警', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.lightModeC = true
|
this.lightModeC = true
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 激光确认框提交
|
// 激光确认框提交
|
||||||
handleBtn() {
|
handleBtn() {
|
||||||
|
|
||||||
|
if (this.deviceInfo.alarmStatus == 1) {
|
||||||
|
MsgError('请先解除强制报警', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const instructValue = this.isLaserOn ? 0 : 1;
|
const instructValue = this.isLaserOn ? 0 : 1;
|
||||||
|
|
||||||
let mqSend = () => {
|
let mqSend = () => {
|
||||||
@ -1011,6 +1058,10 @@
|
|||||||
// 更新状态
|
// 更新状态
|
||||||
this.isLaserOn = !this.isLaserOn;
|
this.isLaserOn = !this.isLaserOn;
|
||||||
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
|
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
|
||||||
|
|
||||||
|
this.currentMainMode = this.getMainLightModeLabel(0);
|
||||||
|
|
||||||
|
|
||||||
this.lightModeC = false;
|
this.lightModeC = false;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -1035,6 +1086,8 @@
|
|||||||
this.lightModeC = false;
|
this.lightModeC = false;
|
||||||
this.isLaserOn = !this.isLaserOn;
|
this.isLaserOn = !this.isLaserOn;
|
||||||
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
|
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
|
||||||
|
|
||||||
|
this.currentMainMode = this.getMainLightModeLabel(0);
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
mqSend();
|
mqSend();
|
||||||
});
|
});
|
||||||
@ -1052,7 +1105,12 @@
|
|||||||
},
|
},
|
||||||
// 上传开机画面
|
// 上传开机画面
|
||||||
uploadStartup() {
|
uploadStartup() {
|
||||||
this.lightModeB = true
|
if (this.deviceInfo.alarmStatus == 1) {
|
||||||
|
MsgError('请先解除强制报警', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.lightModeB = true;
|
||||||
|
this.selectedImage=null;
|
||||||
},
|
},
|
||||||
// 上传开机画面
|
// 上传开机画面
|
||||||
checkImgUpload() {
|
checkImgUpload() {
|
||||||
@ -1102,6 +1160,10 @@
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.deviceInfo.alarmStatus == 1) {
|
||||||
|
MsgError('请先解除强制报警', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let mqSend = () => {
|
let mqSend = () => {
|
||||||
if (this.deviceInfo.onlineStatus !== 1) {
|
if (this.deviceInfo.onlineStatus !== 1) {
|
||||||
@ -1264,9 +1326,9 @@
|
|||||||
dataView.setUint8(0, 0x55); // 帧头
|
dataView.setUint8(0, 0x55); // 帧头
|
||||||
dataView.setUint8(1, 0x02); // 帧类型:开机画面
|
dataView.setUint8(1, 0x02); // 帧类型:开机画面
|
||||||
dataView.setUint8(2, currentPacket); // 包序号
|
dataView.setUint8(2, currentPacket); // 包序号
|
||||||
dataView.setUint16(3, packetData.length*2,false); // 包t长度
|
dataView.setUint16(3, packetData.length * 2, false); // 包t长度
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 填充数据(每个RGB565值占2字节)
|
// 填充数据(每个RGB565值占2字节)
|
||||||
for (let i = 0; i < packetData.length; i++) {
|
for (let i = 0; i < packetData.length; i++) {
|
||||||
@ -1338,11 +1400,11 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(()=> {
|
setTimeout(() => {
|
||||||
sendImagePackets().catch(() => {
|
sendImagePackets().catch(() => {
|
||||||
|
|
||||||
}).finally(()=>{
|
}).finally(() => {
|
||||||
this.lightModeB=false;
|
this.lightModeB = false;
|
||||||
});
|
});
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
@ -1373,6 +1435,11 @@
|
|||||||
},
|
},
|
||||||
// 发送人员信息
|
// 发送人员信息
|
||||||
sendPersonnelInfo() {
|
sendPersonnelInfo() {
|
||||||
|
if (this.deviceInfo.alarmStatus == 1) {
|
||||||
|
MsgError('请先解除强制报警', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let mqSend = async () => {
|
let mqSend = async () => {
|
||||||
if (this.isSending) return;
|
if (this.isSending) return;
|
||||||
const requiredFields = [{
|
const requiredFields = [{
|
||||||
@ -1532,9 +1599,9 @@
|
|||||||
hideLoading();
|
hideLoading();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let packData = combinedData[curr - 1];
|
||||||
let array = {
|
let array = {
|
||||||
instruct: [2, curr].concat(combinedData[curr - 1])
|
instruct: [2, curr, packData.length].concat(packData)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1574,15 +1641,17 @@
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Promise.allSettled([holdHand('word transmit start', 2200), drawText()]).then(
|
Promise.allSettled([holdHand('word transmit start', 2200), drawText()]).then(
|
||||||
results => {
|
results => {
|
||||||
|
console.log("results=", results);
|
||||||
if (results[0].status == 'rejected') {
|
if (results[0].status == 'rejected') {
|
||||||
|
MsgError(results[0].reason.code + ':' + results[0].reason.msg, '',
|
||||||
|
these);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these)
|
hideLoading(these)
|
||||||
}, 500);
|
}, 500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (results[1].status == 'rejected') {
|
if (results[1].status == 'rejected') {
|
||||||
|
MsgError("无法完成文字取模", '', these);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1615,32 +1684,36 @@
|
|||||||
this.showPopupFlag = true;
|
this.showPopupFlag = true;
|
||||||
// this.popupConfirmText="";
|
// this.popupConfirmText="";
|
||||||
},
|
},
|
||||||
OpenWarn(val){//开启/解除强制报警
|
OpenWarn(val) { //开启/解除强制报警
|
||||||
debugger;
|
debugger;
|
||||||
const topic = `B/${this.itemInfo.deviceImei}`;
|
const topic = `B/${this.itemInfo.deviceImei}`;
|
||||||
let message={"instruct":[7,val,0,0,0,0]};
|
let message = {
|
||||||
message=JSON.stringify(message);
|
"instruct": [7, val, 0, 0, 0, 0]
|
||||||
|
};
|
||||||
let flag=this.mqttClient.publish(topic, message, {
|
message = JSON.stringify(message);
|
||||||
|
|
||||||
|
let flag = this.mqttClient.publish(topic, message, {
|
||||||
qos: 1
|
qos: 1
|
||||||
});
|
});
|
||||||
if(flag){
|
if (flag) {
|
||||||
this.itemInfo.alarmStatus=val;
|
this.itemInfo.alarmStatus = val;
|
||||||
}else{
|
this.deviceInfo.alarmStatus = val;
|
||||||
MsgError("操作没有成功",'确定',this);
|
} else {
|
||||||
|
MsgError("操作没有成功", '确定', this);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.showPopupFlag = false;
|
this.onPopupConfirm();
|
||||||
|
|
||||||
},
|
},
|
||||||
warnToggle(){
|
warnToggle() {
|
||||||
if(this.itemInfo.alarmStatus==1){
|
if (this.itemInfo.alarmStatus == 1) {
|
||||||
this.popupType = 'cancel';
|
this.popupType = 'cancel';
|
||||||
this.popupMessage = '确认解除报警状态';
|
this.popupMessage = '确认解除报警状态';
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
this.popupType = 'openWarn';
|
this.popupType = 'openWarn';
|
||||||
this.popupMessage = '确认开启报警状态';
|
this.popupMessage = '确认开启报警状态';
|
||||||
|
|
||||||
}
|
}
|
||||||
this.showPopupFlag = true;
|
this.showPopupFlag = true;
|
||||||
// this.popupConfirmText="开启";
|
// this.popupConfirmText="开启";
|
||||||
@ -1650,25 +1723,25 @@
|
|||||||
// val=0;
|
// val=0;
|
||||||
// msg="确认解除强制报警?";
|
// msg="确认解除强制报警?";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// let mqSend=()=>{
|
// let mqSend=()=>{
|
||||||
// const topic = `B/${this.itemInfo.deviceImei}`;
|
// const topic = `B/${this.itemInfo.deviceImei}`;
|
||||||
// let message={"instruct":[7,val,0,0,0,0]};
|
// let message={"instruct":[7,val,0,0,0,0]};
|
||||||
// message=JSON.stringify(message);
|
// message=JSON.stringify(message);
|
||||||
|
|
||||||
// let flag=this.mqttClient.publish(topic, message, {
|
// let flag=this.mqttClient.publish(topic, message, {
|
||||||
// qos: 1
|
// qos: 1
|
||||||
// });
|
// });
|
||||||
// if(flag){
|
// if(flag){
|
||||||
// this.itemInfo.alarmStatus=val;
|
// this.itemInfo.alarmStatus=val;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 解除报警逻辑
|
// 解除报警逻辑
|
||||||
async onPopupConfirmPolice() {
|
async onPopupConfirmPolice() {
|
||||||
if (this.deviceInfo.onlineStatus !== 1) {
|
if (this.deviceInfo.onlineStatus !== 1) {
|
||||||
@ -1676,7 +1749,7 @@
|
|||||||
// title: '设备已离线',
|
// title: '设备已离线',
|
||||||
// icon: 'none'
|
// icon: 'none'
|
||||||
// });
|
// });
|
||||||
this.OpenWarn(0);//走mq直发
|
this.OpenWarn(0); //走mq直发
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.isPolling = true; // 标记开始轮询
|
this.isPolling = true; // 标记开始轮询
|
||||||
@ -1701,14 +1774,18 @@
|
|||||||
// title: registerRes.msg,
|
// title: registerRes.msg,
|
||||||
// icon: 'none'
|
// icon: 'none'
|
||||||
// })
|
// })
|
||||||
this.OpenWarn(0);
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.itemInfo.alarmStatus=0;
|
this.itemInfo.alarmStatus = 0;
|
||||||
|
this.deviceInfo.alarmStatus = 0;
|
||||||
|
uni.hideLoading();
|
||||||
|
this.showPopupFlag = false
|
||||||
// 4. 获取设备状态FunctionAccessBatchStatusRule 批量
|
// 4. 获取设备状态FunctionAccessBatchStatusRule 批量
|
||||||
let deviceImei = this.itemInfo.deviceImei
|
let deviceImei = this.itemInfo.deviceImei
|
||||||
let typeName = this.itemInfo.typeName
|
let typeName = this.itemInfo.typeName
|
||||||
const statusRes = await getdeviceSTatus({
|
getdeviceSTatus({
|
||||||
functionMode: 2,
|
functionMode: 2,
|
||||||
batchId,
|
batchId,
|
||||||
typeName: 'FunctionAccessBatchStatusRule',
|
typeName: 'FunctionAccessBatchStatusRule',
|
||||||
@ -1716,22 +1793,26 @@
|
|||||||
interval: 500
|
interval: 500
|
||||||
},
|
},
|
||||||
deviceRealTimeStatus
|
deviceRealTimeStatus
|
||||||
);
|
).then(statusRes => {
|
||||||
if (statusRes.data.functionAccess === 'OK') {
|
if (statusRes.data.functionAccess === 'OK') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: statusRes.msg,
|
title: statusRes.msg,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
uni.$emit('deviceStatusUpdate', {});
|
uni.$emit('deviceStatusUpdate', {});
|
||||||
this.showPopupFlag = false
|
|
||||||
if (this.apiType === 'listA') {
|
if (this.apiType === 'listA') {
|
||||||
this.fetchDeviceDetail(this.computedDeviceId)
|
this.fetchDeviceDetail(this.computedDeviceId)
|
||||||
} else {
|
} else {
|
||||||
// 分享权限详情
|
// 分享权限详情
|
||||||
this.fetchSharedDeviceDetail(this.itemInfo.id)
|
this.fetchSharedDeviceDetail(this.itemInfo.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}).catch(ex => {
|
||||||
|
console.error("出现错误", ex);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.message,
|
title: error.message,
|
||||||
@ -1751,6 +1832,12 @@
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.deviceInfo.alarmStatus == 1) {
|
||||||
|
MsgError('请先解除强制报警', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 防重复提交
|
// 防重复提交
|
||||||
if (this.isSending) return;
|
if (this.isSending) return;
|
||||||
if (!this.messageToSend) {
|
if (!this.messageToSend) {
|
||||||
@ -1801,9 +1888,9 @@
|
|||||||
);
|
);
|
||||||
// 只有当状态为'OK'时才显示成功弹窗
|
// 只有当状态为'OK'时才显示成功弹窗
|
||||||
if (statusRes.data.functionAccess === 'OK') {
|
if (statusRes.data.functionAccess === 'OK') {
|
||||||
this.popupType = 'person';
|
// this.popupType = 'person';
|
||||||
this.showPopupFlag = true;
|
// this.showPopupFlag = true;
|
||||||
this.popupMessage = '信息发送成功';
|
// this.popupMessage = '信息发送成功';
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -1899,7 +1986,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 发送mqtt查询设备信息
|
// 发送mqtt查询设备信息
|
||||||
queryDeviceStatus() {
|
queryDeviceStatus() {
|
||||||
if (this.mqttClient && this.mqttClient.isConnected()) {
|
if (this.mqttClient && this.mqttClient.isConnected()) {
|
||||||
@ -1955,14 +2042,30 @@
|
|||||||
this.mqttClient.subscribe(statusTopic, (payload) => {
|
this.mqttClient.subscribe(statusTopic, (payload) => {
|
||||||
try {
|
try {
|
||||||
console.log(`收到来自 ${statusTopic} 的消息:`, payload);
|
console.log(`收到来自 ${statusTopic} 的消息:`, payload);
|
||||||
|
console.log("typeof payload=", typeof payload);
|
||||||
const parsedMessage = typeof payload === 'string' ? JSON.parse(
|
const parsedMessage = typeof payload === 'string' ? JSON.parse(
|
||||||
payload) :
|
payload) : payload;
|
||||||
payload;
|
|
||||||
const deviceState = parsedMessage.state; // 直接取 state 数组
|
let keys = Object.keys(parsedMessage);
|
||||||
// 切换主灯光模式,亮度值设备同步
|
if("sta_BreakNews" in parsedMessage){
|
||||||
if (!deviceState) return;
|
console.error("收到确认消息")
|
||||||
|
if(parsedMessage.sta_BreakNews=='I get it'){
|
||||||
this.onReceive(deviceState);
|
MsgSuccess("用户已确认收到紧急通知","",this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (keys.length && "state" in parsedMessage) {
|
||||||
|
const deviceState = parsedMessage.state; // 直接取 state 数组
|
||||||
|
// 切换主灯光模式,亮度值设备同步
|
||||||
|
if (!deviceState || !deviceState instanceof Array) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.onReceive(deviceState, parsedMessage);
|
||||||
|
}else{
|
||||||
|
console.error("丢弃的消息",payload)
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('解析MQTT消息失败:', error, '原始消息:', payload);
|
console.log('解析MQTT消息失败:', error, '原始消息:', payload);
|
||||||
}
|
}
|
||||||
@ -1999,10 +2102,10 @@
|
|||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(
|
||||||
res => {
|
res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex=>{
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:"+ex.msg,"确定",these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2022,8 +2125,8 @@
|
|||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
console.log("连接成功")
|
console.log("连接成功")
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
}).catch(ex=>{
|
}).catch(ex => {
|
||||||
MsgError("连接错误:"+ex.msg,"确定",these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2261,8 +2364,9 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1rpx solid #00000000;
|
border: 1rpx solid #00000000;
|
||||||
}
|
}
|
||||||
.mode-v1.active{
|
|
||||||
border:1rpx solid #bbe600 !important;
|
.mode-v1.active {
|
||||||
|
border: 1rpx solid #bbe600 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode-v2 {
|
.mode-v2 {
|
||||||
|
|||||||
@ -758,7 +758,7 @@
|
|||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sizeType: ['original', 'compressed'],
|
sizeType: ['original', 'compressed'],
|
||||||
sourceType: ['album'],
|
sourceType: ['album','camera'],
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/common/ImgCrop/ImgCrop",
|
url: "/pages/common/ImgCrop/ImgCrop",
|
||||||
|
|||||||
@ -23,10 +23,11 @@
|
|||||||
<view class="p100">
|
<view class="p100">
|
||||||
|
|
||||||
<view class="lblTitle">配对设备</view>
|
<view class="lblTitle">配对设备</view>
|
||||||
|
|
||||||
<view class="list" style="margin-bottom: 30rpx;">
|
<view class="list" style="margin-bottom: 30rpx;">
|
||||||
|
|
||||||
<view class="item " @click.stop="disConnect(item,index)" v-for="item, index in PairEquip" v-show="PairEquip.length>0">
|
<view class="item " @click.stop="disConnect(item,index)" v-for="item, index in PairEquip"
|
||||||
|
v-show="PairEquip.length>0">
|
||||||
<view class="leftImg ">
|
<view class="leftImg ">
|
||||||
<image src="/static/images/common/bluetooth.png" class="titleIco filterNone"
|
<image src="/static/images/common/bluetooth.png" class="titleIco filterNone"
|
||||||
mode="heightFix">
|
mode="heightFix">
|
||||||
@ -34,7 +35,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="centertxt ">
|
<view class="centertxt ">
|
||||||
<view class="name" v-text="item.name"></view>
|
<view class="name" v-text="item.name"></view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="rightIco center">
|
<view class="rightIco center">
|
||||||
<image src="/static/images/BLEAdd/linked.png" class="img" mode="aspectFit">
|
<image src="/static/images/BLEAdd/linked.png" class="img" mode="aspectFit">
|
||||||
@ -50,10 +51,8 @@
|
|||||||
<text>发现设备:{{deviceCnt}}</text>
|
<text>发现设备:{{deviceCnt}}</text>
|
||||||
<view @click="refreshBleList()">刷新</view>
|
<view @click="refreshBleList()">刷新</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="lblTitle">
|
<view class="">
|
||||||
<input class="uni-input" v-model="search" placeholder="名称筛选" />
|
<input class="uni-input" v-model="search" placeholder="名称筛选" />
|
||||||
<!-- <uni-easyinput :styles="{color:'#ffffffde',borderColor:'#cbcbcba8'}" :clearable="true" class="uni-mt-5" :trim="'both'"
|
|
||||||
prefixIcon="search" v-model="search" placeholder="名称筛选"></uni-easyinput> -->
|
|
||||||
</view>
|
</view>
|
||||||
<view class="list searchList">
|
<view class="list searchList">
|
||||||
<view class="item" v-on:click="Link(item,index)" v-for="item, index in EquipMents"
|
<view class="item" v-on:click="Link(item,index)" v-for="item, index in EquipMents"
|
||||||
@ -165,7 +164,7 @@
|
|||||||
},
|
},
|
||||||
search: '', //筛选
|
search: '', //筛选
|
||||||
PairEquip: [], //已配对设备
|
PairEquip: [], //已配对设备
|
||||||
tmpLink:[],//本次已配对
|
tmpLink: [], //本次已配对
|
||||||
EquipMents: [], //搜索出来的设备
|
EquipMents: [], //搜索出来的设备
|
||||||
device: null,
|
device: null,
|
||||||
item: {
|
item: {
|
||||||
@ -224,8 +223,8 @@
|
|||||||
|
|
||||||
const systemInfo = uni.getSystemInfoSync();
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
|
||||||
// Ensure ble is initialized
|
// Ensure ble is initialized
|
||||||
|
|
||||||
if (systemInfo.uniPlatform == 'web') {
|
if (systemInfo.uniPlatform == 'web') {
|
||||||
|
|
||||||
|
|
||||||
@ -253,15 +252,15 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
console.error("1111111111")
|
console.error("1111111111")
|
||||||
this.PairEquip=[this.EquipMents[0]];
|
this.PairEquip = [this.EquipMents[0]];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ble = bleTool.getBleTool();
|
ble = bleTool.getBleTool();
|
||||||
this.refreshLinked();
|
this.refreshLinked();
|
||||||
|
|
||||||
let StartSubsrib = () => {
|
let StartSubsrib = () => {
|
||||||
|
|
||||||
these.EquipMents = [];
|
these.EquipMents = [];
|
||||||
if (!ble) {
|
if (!ble) {
|
||||||
ble = bleTool.getBleTool();
|
ble = bleTool.getBleTool();
|
||||||
@ -366,31 +365,31 @@
|
|||||||
these.EquipMents.sort((a, b) => b.RSSI - a.RSSI); //信号好的排前面,一般信号好的是目标设备
|
these.EquipMents.sort((a, b) => b.RSSI - a.RSSI); //信号好的排前面,一般信号好的是目标设备
|
||||||
}
|
}
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
|
|
||||||
//蓝牙连接已恢复的回调
|
//蓝牙连接已恢复的回调
|
||||||
ble.addRecoveryCallback(res => {
|
ble.addRecoveryCallback(res => {
|
||||||
if (these.Status.isPageHidden) {
|
if (these.Status.isPageHidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
these.refreshLinked();
|
these.refreshLinked();
|
||||||
|
|
||||||
// hideLoading(these);
|
// hideLoading(these);
|
||||||
|
|
||||||
if (!these.device) {
|
if (!these.device) {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
}else{
|
} else {
|
||||||
clearInterval(this.Status.intval);
|
clearInterval(this.Status.intval);
|
||||||
these.DeviceVerdict(res.deviceId);
|
these.DeviceVerdict(res.deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
let startValidDevice = () => {
|
let startValidDevice = () => {
|
||||||
if (these.device) {
|
if (these.device) {
|
||||||
console.log("进入配对模式,启用连接恢复和验证逻辑。");
|
console.log("进入配对模式,启用连接恢复和验证逻辑。");
|
||||||
|
|
||||||
|
|
||||||
//收到设备的消息回调
|
//收到设备的消息回调
|
||||||
ble.addReceiveCallback((receivData, f, path, arr) => {
|
ble.addReceiveCallback((receivData, f, path, arr) => {
|
||||||
@ -412,7 +411,7 @@
|
|||||||
showLoading(these, {
|
showLoading(these, {
|
||||||
text: '正在验证设备'
|
text: '正在验证设备'
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
these.DeviceVerdict(f.deviceId);
|
these.DeviceVerdict(f.deviceId);
|
||||||
}, 0);
|
}, 0);
|
||||||
@ -424,7 +423,7 @@
|
|||||||
|
|
||||||
StartSubsrib();
|
StartSubsrib();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -437,19 +436,19 @@
|
|||||||
this.refreshLinked();
|
this.refreshLinked();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
refreshLinked(){
|
refreshLinked() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(ble){
|
if (ble) {
|
||||||
let arr=[];
|
let arr = [];
|
||||||
arr=ble.data.LinkedList.filter(v=>{
|
arr = ble.data.LinkedList.filter(v => {
|
||||||
return v.Linked;
|
return v.Linked;
|
||||||
});
|
});
|
||||||
this.PairEquip=arr;
|
this.PairEquip = arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
checkAndRequestLocationPermission() {
|
checkAndRequestLocationPermission() {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
@ -500,7 +499,8 @@
|
|||||||
}
|
}
|
||||||
const hasPermission = await this.checkAndRequestLocationPermission();
|
const hasPermission = await this.checkAndRequestLocationPermission();
|
||||||
if (!hasPermission) {
|
if (!hasPermission) {
|
||||||
console.log("缺少定位权限,已中止蓝牙扫描。");
|
|
||||||
|
MsgError('缺少定位权限,已中止蓝牙扫描', '', this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,19 +524,19 @@
|
|||||||
|
|
||||||
time = setTimeout(() => {
|
time = setTimeout(() => {
|
||||||
these.EquipMents = [];
|
these.EquipMents = [];
|
||||||
|
|
||||||
|
|
||||||
ble.StartSearch().then(result => {
|
ble.StartSearch().then(result => {
|
||||||
// console.log("开始搜索成功", result);
|
// console.log("开始搜索成功", result);
|
||||||
these.Status.BottomMenu.show=false;
|
these.Status.BottomMenu.show = false;
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error("开始搜索失败:", err);
|
console.error("开始搜索失败:", err);
|
||||||
if (err.code === 10001) {
|
if (err.code === 10001) {
|
||||||
these.showOpenSetting();
|
these.showOpenSetting();
|
||||||
} else {
|
} else {
|
||||||
|
MsgError('出现错误:' + err.msg, '确定', these, () => {
|
||||||
MsgClear(these);
|
MsgClear(these);
|
||||||
MsgError('出现错误:' + err.msg, '确定', these);
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
@ -580,9 +580,9 @@
|
|||||||
ble.showBlueSetting(false);
|
ble.showBlueSetting(false);
|
||||||
},
|
},
|
||||||
DeviceVerdict(deviceId) { //判断是否是目标设备
|
DeviceVerdict(deviceId) { //判断是否是目标设备
|
||||||
if (these.Status.isPageHidden) {
|
if (these.Status.isPageHidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("deviceid=", deviceId);
|
console.log("deviceid=", deviceId);
|
||||||
console.log("these.device=", these.device)
|
console.log("these.device=", these.device)
|
||||||
if (these.device) { //从设备详情过来的,回设备详情去
|
if (these.device) { //从设备详情过来的,回设备详情去
|
||||||
@ -681,7 +681,7 @@
|
|||||||
|
|
||||||
text: "等待设备上报Mac地址," + these.Status.time + 's'
|
text: "等待设备上报Mac地址," + these.Status.time + 's'
|
||||||
});
|
});
|
||||||
|
|
||||||
clearInterval(this.Status.intval);
|
clearInterval(this.Status.intval);
|
||||||
this.Status.intval = null;
|
this.Status.intval = null;
|
||||||
|
|
||||||
@ -708,7 +708,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
|
|
||||||
text: "等待设备上报Mac地址," + these.Status.time + 's'
|
text: "等待设备上报Mac地址," + these.Status.time + 's'
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -729,7 +729,7 @@
|
|||||||
let index = 1;
|
let index = 1;
|
||||||
let total = 5;
|
let total = 5;
|
||||||
|
|
||||||
let linkCallback = (res) => {
|
let linkCallback = (res) => {
|
||||||
console.log("连接成功", these.device);
|
console.log("连接成功", these.device);
|
||||||
if (!these.device) {
|
if (!these.device) {
|
||||||
console.log("跳转到绑定")
|
console.log("跳转到绑定")
|
||||||
@ -746,12 +746,12 @@
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
let execLink = () => {
|
let execLink = () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
|
||||||
if (index > total) {
|
if (index > total) {
|
||||||
reject({
|
reject({
|
||||||
msg: "连接超时"
|
msg: "连接超时"
|
||||||
@ -759,7 +759,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ble.LinkBlue(item.deviceId).then((res) => {
|
ble.LinkBlue(item.deviceId).then((res) => {
|
||||||
this.tmpLink=[item];
|
this.tmpLink = [item];
|
||||||
console.log("连接成功");
|
console.log("连接成功");
|
||||||
ble.StopSearch();
|
ble.StopSearch();
|
||||||
resolve(res);
|
resolve(res);
|
||||||
@ -767,9 +767,9 @@
|
|||||||
if (index == total) {
|
if (index == total) {
|
||||||
console.log("连接了N次都没连上");
|
console.log("连接了N次都没连上");
|
||||||
reject(ex);
|
reject(ex);
|
||||||
updateLoading(this, {
|
updateLoading(this, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
})
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
@ -786,7 +786,7 @@
|
|||||||
|
|
||||||
execLink().then((res) => {
|
execLink().then((res) => {
|
||||||
console.log("res=", res);
|
console.log("res=", res);
|
||||||
if(this.Status.isPageHidden){
|
if (this.Status.isPageHidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
linkCallback(res);
|
linkCallback(res);
|
||||||
@ -802,21 +802,21 @@
|
|||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
disConnect:function(item,index){
|
disConnect: function(item, index) {
|
||||||
// #ifdef H5|WEB
|
// #ifdef H5|WEB
|
||||||
|
|
||||||
this.PairEquip.splice(index,1);
|
this.PairEquip.splice(index, 1);
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef APP|APP-PLUS
|
// #ifdef APP|APP-PLUS
|
||||||
if(ble){
|
if (ble) {
|
||||||
ble.disconnectDevice(item.deviceId).catch(ex=>{
|
ble.disconnectDevice(item.deviceId).catch(ex => {
|
||||||
console.error("无法断开连接",ex);
|
console.error("无法断开连接", ex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -486,13 +486,11 @@
|
|||||||
|
|
||||||
MsgError('蓝牙不可用','',these);
|
MsgError('蓝牙不可用','',these);
|
||||||
|
|
||||||
these.EquipMents.filter((v, i) => {
|
these.EquipMents=[];
|
||||||
these.$set(these.EquipMents[i], 'link', false);
|
|
||||||
});
|
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
ble.addStateRecoveryCallback(() => {
|
ble.addStateRecoveryCallback(() => {
|
||||||
|
|
||||||
|
these.ReSearch();
|
||||||
MsgSuccess('蓝牙恢复可用','',these,()=>{
|
MsgSuccess('蓝牙恢复可用','',these,()=>{
|
||||||
MsgClear(these);
|
MsgClear(these);
|
||||||
})
|
})
|
||||||
@ -557,6 +555,7 @@
|
|||||||
|
|
||||||
|
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
|
debugger;
|
||||||
MsgInfo("如需要在PC上查看此数据,请复制链接后通过微信发送到PC,在PC端打开,然后点右上角扫码授权","复制链接",these,true,()=>{
|
MsgInfo("如需要在PC上查看此数据,请复制链接后通过微信发送到PC,在PC端打开,然后点右上角扫码授权","复制链接",these,true,()=>{
|
||||||
console.log("执行复制");
|
console.log("执行复制");
|
||||||
uni.setClipboardData({
|
uni.setClipboardData({
|
||||||
@ -566,10 +565,18 @@
|
|||||||
title:'已复制链接'
|
title:'已复制链接'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// #ifdef APP
|
||||||
plus.runtime.openURL('weixin://', (err) => {
|
plus.runtime.openURL('weixin://', (err) => {
|
||||||
MsgError("打开微信失败,请手动打开微信,发送至'文件传输助手'");
|
MsgError("打开微信失败,请手动打开微信,发送至'文件传输助手'");
|
||||||
});
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef APP
|
||||||
|
MsgInfo("已复制链接,请打开浏览器查看","",these);
|
||||||
|
setTimeout(()=>{
|
||||||
|
MsgClear(these);
|
||||||
|
},1200)
|
||||||
|
// #endif
|
||||||
},
|
},
|
||||||
fail(ex){
|
fail(ex){
|
||||||
console.error("无法复制",ex)
|
console.error("无法复制",ex)
|
||||||
@ -878,9 +885,10 @@
|
|||||||
},
|
},
|
||||||
ReSearch() {
|
ReSearch() {
|
||||||
if (!ble) {
|
if (!ble) {
|
||||||
|
MsgError('蓝牙模块未初始化','',this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
showLoading(this,{text:'请稍候...'});
|
||||||
ble.disconnectDevice().finally(dis => {
|
ble.disconnectDevice().finally(dis => {
|
||||||
|
|
||||||
ble.StopSearch().finally(res => {
|
ble.StopSearch().finally(res => {
|
||||||
@ -893,6 +901,8 @@
|
|||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error("err=", err);
|
console.error("err=", err);
|
||||||
MsgError("出现错误:" + err.msg, '', these);
|
MsgError("出现错误:" + err.msg, '', these);
|
||||||
|
}).finally(()=>{
|
||||||
|
hideLoading(these);
|
||||||
});
|
});
|
||||||
},200);
|
},200);
|
||||||
|
|
||||||
|
|||||||
@ -9,57 +9,64 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<scroll-view class="device-list" scroll-y @scrolltolower="onScrollToLower" :lower-threshold="100"
|
<view style="height: calc(100% - 200rpx);">
|
||||||
style="height:80vh">
|
|
||||||
<view v-if="deviceList.length>0">
|
|
||||||
<view v-for="(group, groupIndex) in groupedDevices" :key="groupIndex">
|
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback"
|
||||||
<view class="share-header">
|
:up="upOption" :down="downOption" :fixed="false">
|
||||||
<text>{{
|
<!-- <scroll-view class="device-list" scroll-y @scrolltolower="onScrollToLower" :lower-threshold="100"
|
||||||
|
style="height:80vh"> -->
|
||||||
|
<view v-if="deviceList.length>0">
|
||||||
|
<view v-for="(group, groupIndex) in groupedDevices" :key="groupIndex">
|
||||||
|
<view class="share-header">
|
||||||
|
<text>{{
|
||||||
tabs[activeTab].name === '我的分享'
|
tabs[activeTab].name === '我的分享'
|
||||||
? `分享给“${group.sharedTo}”的设备`
|
? `分享给“${group.sharedTo}”的设备`
|
||||||
: `来自“${group.othersharedTo}”分享的设备`
|
: `来自“${group.othersharedTo}”分享的设备`
|
||||||
}}</text>
|
}}</text>
|
||||||
<text class="edit-btn"
|
<text class="edit-btn"
|
||||||
@click="toggleEdit(groupIndex)">{{editingGroup === groupIndex ? '完成' : '编辑'}}</text>
|
@click="toggleEdit(groupIndex)">{{editingGroup === groupIndex ? '完成' : '编辑'}}</text>
|
||||||
</view>
|
</view>
|
||||||
<block>
|
<block>
|
||||||
|
|
||||||
<view class="device-card" v-for="(item, index) in group.devices" :key="index"
|
<view class="device-card" v-for="(item, index) in group.devices" :key="index"
|
||||||
:ref="'swipeItem_' + index">
|
:ref="'swipeItem_' + index">
|
||||||
<view class="checkbox" v-if="editingGroup === groupIndex">
|
<view class="checkbox" v-if="editingGroup === groupIndex">
|
||||||
<uni-icons @click="handleDelete(item)" type="minus" size="20"
|
<uni-icons @click="handleDelete(item)" type="minus" size="20"
|
||||||
color="#FF4D4F"></uni-icons>
|
color="#FF4D4F"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
<view class="device-content" @click.stop="handleFile(item)">
|
<view class="device-content" @click.stop="handleFile(item)">
|
||||||
<view class="device-header">
|
<view class="device-header">
|
||||||
<view class="deviceIMG">
|
<view class="deviceIMG">
|
||||||
<image :src="item.devicePic" class="IMG" mode="aspectFit"></image>
|
<image :src="item.devicePic" class="IMG" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="device-name">
|
<view class="device-name">
|
||||||
<view>设备:{{item.deviceName}}</view>
|
<view>设备:{{item.deviceName}}</view>
|
||||||
<view class="ID">
|
|
||||||
<view class="ID">
|
<view class="ID">
|
||||||
ID:{{item.deviceImei}}</view>
|
<view class="ID">
|
||||||
<!-- 在线状态 -->
|
ID:{{item.deviceImei}}</view>
|
||||||
<view class="onlines" v-if="item.onlineStatus==1">在线</view>
|
<!-- 在线状态 -->
|
||||||
<!-- 离线状态 -->
|
<view class="onlines" v-if="item.onlineStatus==1">在线</view>
|
||||||
<view class="offlines" v-if="item.onlineStatus==0">离线</view>
|
<!-- 离线状态 -->
|
||||||
<view>电量:{{item.battery || '0'}}%</view>
|
<view class="offlines" v-if="item.onlineStatus==0">离线</view>
|
||||||
|
<view>电量:{{item.battery || '0'}}%</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</block>
|
||||||
</block>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<!-- <view v-else class="noDATA">
|
||||||
<view v-else class="noDATA">
|
|
||||||
<view>
|
<view>
|
||||||
<uni-icons type="image-filled" size="120" color="rgba(255, 255, 255, 0.9)"></uni-icons>
|
<uni-icons type="image-filled" size="120" color="rgba(255, 255, 255, 0.9)"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
暂无数据
|
暂无数据
|
||||||
</view>
|
</view> -->
|
||||||
</scroll-view>
|
<!-- </scroll-view> -->
|
||||||
|
</mescroll-uni>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 删除弹框 -->
|
<!-- 删除弹框 -->
|
||||||
<view class="agreement-mask" v-if="deleteShow" @click="closePopup('delete')">
|
<view class="agreement-mask" v-if="deleteShow" @click="closePopup('delete')">
|
||||||
@ -81,6 +88,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
var timeout=null;
|
||||||
import {
|
import {
|
||||||
deviceShareList,
|
deviceShareList,
|
||||||
otherDeviceShareList,
|
otherDeviceShareList,
|
||||||
@ -89,6 +97,23 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
mescroll: null,
|
||||||
|
downOption: {
|
||||||
|
auto: true,
|
||||||
|
autoShowLoading: false,
|
||||||
|
},
|
||||||
|
upOption: {
|
||||||
|
auto: false,
|
||||||
|
noMoreSize: 0,
|
||||||
|
offset: 10,
|
||||||
|
isLock: false,
|
||||||
|
empty: {
|
||||||
|
tip: '暂无数据',
|
||||||
|
hideScroll: false,
|
||||||
|
icon: '/static/images/common/empty.png'
|
||||||
|
},
|
||||||
|
textNoMore: '没有更多数据了'
|
||||||
|
},
|
||||||
deviceList: [],
|
deviceList: [],
|
||||||
tabs: [{
|
tabs: [{
|
||||||
name: '我的分享',
|
name: '我的分享',
|
||||||
@ -131,6 +156,28 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
mescrollInit(mescroll) {
|
||||||
|
this.mescroll = mescroll;
|
||||||
|
},
|
||||||
|
// 下拉刷新
|
||||||
|
downCallback() {
|
||||||
|
|
||||||
|
|
||||||
|
if (this.mescroll) {
|
||||||
|
this.mescroll.resetUpScroll(false);
|
||||||
|
this.mescroll.scrollTo(0, 0);
|
||||||
|
}
|
||||||
|
this.getData();
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
// 上拉加载
|
||||||
|
upCallback() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this.getData();
|
||||||
|
},
|
||||||
// 点击弹框外的区域关闭
|
// 点击弹框外的区域关闭
|
||||||
closePopup(type) {
|
closePopup(type) {
|
||||||
if (type === 'delete') {
|
if (type === 'delete') {
|
||||||
@ -142,12 +189,13 @@
|
|||||||
let url = item.detailPageUrl;
|
let url = item.detailPageUrl;
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
// url: "/pages/6170/deviceControl/index",
|
// url: "/pages/6170/deviceControl/index",
|
||||||
url:url,
|
url: url,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
// 页面跳转成功后的回调函数
|
// 页面跳转成功后的回调函数
|
||||||
res.eventChannel.emit('detailData', {
|
res.eventChannel.emit('detailData', {
|
||||||
data: item,
|
data: item,
|
||||||
apiType:this.activeTab===0?'listA':'listB' // 自定义标识 // 自定义标识,详情哪里根据这个参数不同信息
|
apiType: this.activeTab === 0 ? 'listA' :
|
||||||
|
'listB' // 自定义标识 // 自定义标识,详情哪里根据这个参数不同信息
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -200,43 +248,59 @@
|
|||||||
},
|
},
|
||||||
// 获取设备列表
|
// 获取设备列表
|
||||||
getData(tab) {
|
getData(tab) {
|
||||||
//console.log(tab.name, 'tab');
|
let task = () => {
|
||||||
if (this.loading) return;
|
if (this.loading) return;
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
let data = {
|
let data = {
|
||||||
pageNum: this.page,
|
pageNum: this.mescroll.num,
|
||||||
pageSize: this.size,
|
pageSize: this.size,
|
||||||
}
|
|
||||||
// 根据当前tab决定调用哪个接口
|
|
||||||
const apiCall = tab.name === '我的分享' ? deviceShareList : otherDeviceShareList;
|
|
||||||
console.log('nihao');
|
|
||||||
apiCall(data).then((res) => {
|
|
||||||
if (res.code == 200) {
|
|
||||||
const newDevices = res.rows.map(device => ({
|
|
||||||
...device,
|
|
||||||
showConfirm: false,
|
|
||||||
sharedTo: device.phonenumber,
|
|
||||||
othersharedTo: device.otherPhonenumber
|
|
||||||
}));
|
|
||||||
// 分页处理
|
|
||||||
if (this.page === 1) {
|
|
||||||
this.deviceList = newDevices;
|
|
||||||
} else {
|
|
||||||
this.deviceList = [...this.deviceList, ...newDevices];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.total = res.total;
|
|
||||||
// 判断是否已加载全部数据
|
|
||||||
if (res.rows.length < this.size || this.deviceList.length >= this.total) {
|
|
||||||
this.finished = true;
|
|
||||||
} else {
|
|
||||||
this.page++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
|
||||||
this.loading = false;
|
if (!data.pageNum) {
|
||||||
});
|
this.mescroll.endSuccess(0, false);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据当前tab决定调用哪个接口
|
||||||
|
const apiCall = this.tabs[this.activeTab].name === '我的分享' ? deviceShareList : otherDeviceShareList;
|
||||||
|
console.log('nihao');
|
||||||
|
apiCall(data).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
const newDevices = res.rows.map(device => ({
|
||||||
|
...device,
|
||||||
|
showConfirm: false,
|
||||||
|
sharedTo: device.phonenumber,
|
||||||
|
othersharedTo: device.otherPhonenumber
|
||||||
|
}));
|
||||||
|
// 分页处理
|
||||||
|
if (this.page === 1) {
|
||||||
|
this.deviceList = newDevices;
|
||||||
|
} else {
|
||||||
|
this.deviceList = [...this.deviceList, ...newDevices];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.total = res.total;
|
||||||
|
let hasNext = true;
|
||||||
|
// 判断是否已加载全部数据
|
||||||
|
if (res.rows.length < this.size || this.deviceList.length >= this.total) {
|
||||||
|
this.finished = true;
|
||||||
|
hasNext = false;
|
||||||
|
} else {
|
||||||
|
this.page++;
|
||||||
|
hasNext = true;
|
||||||
|
}
|
||||||
|
this.mescroll.endSuccess(res.rows.length, hasNext);
|
||||||
|
}else{
|
||||||
|
this.mescroll.endSuccess(0, false);
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(task, 50);
|
||||||
|
|
||||||
},
|
},
|
||||||
// 滚动触底事件处理
|
// 滚动触底事件处理
|
||||||
@ -254,7 +318,7 @@
|
|||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
// 组件销毁前移除监听器
|
// 组件销毁前移除监听器
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -267,6 +331,9 @@
|
|||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background-color: rgb(18, 18, 18);
|
background-color: rgb(18, 18, 18);
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-bar {
|
.tab-bar {
|
||||||
|
|||||||
@ -196,7 +196,8 @@
|
|||||||
isLock: false,
|
isLock: false,
|
||||||
empty: {
|
empty: {
|
||||||
tip: '暂无数据',
|
tip: '暂无数据',
|
||||||
hideScroll: false
|
hideScroll: false,
|
||||||
|
icon: '/static/images/common/empty.png'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
page: 1, // 当前页码
|
page: 1, // 当前页码
|
||||||
|
|||||||
@ -117,6 +117,13 @@
|
|||||||
sendApi: deviceSendAlarmMessage,
|
sendApi: deviceSendAlarmMessage,
|
||||||
statusTypeName: '',
|
statusTypeName: '',
|
||||||
sendType: 'XSSend'
|
sendType: 'XSSend'
|
||||||
|
},
|
||||||
|
,
|
||||||
|
{
|
||||||
|
type: ['HBY018A'],
|
||||||
|
sendApi: deviceSendAlarmMessage,
|
||||||
|
statusTypeName: '',
|
||||||
|
sendType: 'CommonSend'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -134,7 +141,8 @@
|
|||||||
isLock: false,
|
isLock: false,
|
||||||
empty: {
|
empty: {
|
||||||
tip: '暂无数据',
|
tip: '暂无数据',
|
||||||
hideScroll: false
|
hideScroll: false,
|
||||||
|
icon: '/static/images/common/empty.png'
|
||||||
},
|
},
|
||||||
textNoMore: '没有更多数据了'
|
textNoMore: '没有更多数据了'
|
||||||
},
|
},
|
||||||
|
|||||||
@ -29,10 +29,10 @@
|
|||||||
<view v-if="deviceList.length>0">
|
<view v-if="deviceList.length>0">
|
||||||
<uni-swipe-action ref="swipeAction" >
|
<uni-swipe-action ref="swipeAction" >
|
||||||
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
|
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
|
||||||
<uni-swipe-action-item :right-options="Options"
|
<uni-swipe-action-item :right-options="Options" :show="item.showOption"
|
||||||
@click="handleSwipeClick($event, item, index)" class="device-card"
|
@click="handleSwipeClick($event, item, index)" class="device-card"
|
||||||
:style="{ border: item.communicationMode==0 && item.onlineStatus==1 && item.alarmStatus==1 ? '1px solid rgba(224, 52, 52, 1)' : 'none' }">
|
:style="{ border: item.communicationMode==0 && item.onlineStatus==1 && item.alarmStatus==1 ? '1px solid rgba(224, 52, 52, 1)' : 'none' }">
|
||||||
<view @click.stop="handleFile(item)">
|
<view @click.stop="handleFile(item,index)">
|
||||||
<view class="device-header">
|
<view class="device-header">
|
||||||
<view class="deviceIMG">
|
<view class="deviceIMG">
|
||||||
<image :src="item.devicePic" class="IMG" mode="aspectFit"></image>
|
<image :src="item.devicePic" class="IMG" mode="aspectFit"></image>
|
||||||
@ -62,7 +62,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<image src="/static/images/common/cires.png" class="circle" mode="aspectFit"></image>
|
<image @click.stop="swipeToggle(item,index)" src="/static/images/common/cires.png" class="circle" mode="aspectFit"></image>
|
||||||
</uni-swipe-action-item>
|
</uni-swipe-action-item>
|
||||||
</block>
|
</block>
|
||||||
</uni-swipe-action>
|
</uni-swipe-action>
|
||||||
@ -242,7 +242,8 @@
|
|||||||
isLock: false,
|
isLock: false,
|
||||||
empty: {
|
empty: {
|
||||||
tip: '暂无数据',
|
tip: '暂无数据',
|
||||||
hideScroll: false
|
hideScroll: false,
|
||||||
|
icon: '/static/images/common/empty.png'
|
||||||
},
|
},
|
||||||
textNoMore: '没有更多数据了'
|
textNoMore: '没有更多数据了'
|
||||||
},
|
},
|
||||||
@ -697,13 +698,20 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
swipeToggle(item,index){
|
||||||
|
if(!item.showOption || item.showOption=='none'){
|
||||||
|
this.$set(this.deviceList[index],'showOption','right');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$set(this.deviceList[index],'showOption','none');
|
||||||
|
},
|
||||||
// 列表跳转
|
// 列表跳转
|
||||||
handleFile(item) {
|
handleFile(item,index) {
|
||||||
let url = item.detailPageUrl;
|
if(item.showOption=='right'){
|
||||||
// url="/pages/6075/BJQ6075L";
|
this.$set(this.deviceList[index],'showOption','none');
|
||||||
// if(!url){
|
return;
|
||||||
// url="/pages/6075/BJQ6075"
|
}
|
||||||
// }
|
let url = item.detailPageUrl;
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: url,
|
url: url,
|
||||||
events: {
|
events: {
|
||||||
@ -773,7 +781,7 @@
|
|||||||
});
|
});
|
||||||
// 监听设备状态更新事件
|
// 监听设备状态更新事件
|
||||||
uni.$on('deviceStatusUpdate', (data) => {
|
uni.$on('deviceStatusUpdate', (data) => {
|
||||||
console.log('列表收到消息了么');
|
// console.log('列表收到消息了么');
|
||||||
this.downCallback();
|
this.downCallback();
|
||||||
});
|
});
|
||||||
ble = bleTool.getBleTool();
|
ble = bleTool.getBleTool();
|
||||||
@ -805,9 +813,9 @@
|
|||||||
|
|
||||||
//接收到消息的回调
|
//接收到消息的回调
|
||||||
ble.addReceiveCallback((receive, device, path, recArr) => {
|
ble.addReceiveCallback((receive, device, path, recArr) => {
|
||||||
console.error("首页收到消息了");
|
// console.error("首页收到消息了");
|
||||||
let json=recei.ReceiveData(receive, device, path, recArr);
|
let json=recei.ReceiveData(receive, device, path, recArr);
|
||||||
console.error("消息内容",json);
|
// console.error("消息内容",json);
|
||||||
this.updateBleStatu();
|
this.updateBleStatu();
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
|
|
||||||
@ -1148,7 +1156,7 @@
|
|||||||
border-radius: 40rpx;
|
border-radius: 40rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 1px solid #E034344d;
|
border: 1px solid #E0343480;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1161,7 +1169,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.agreement-popupC .cancelBtn{
|
.agreement-popupC .cancelBtn{
|
||||||
border:1rpx solid #E034344d;
|
border:1rpx solid #E03434;
|
||||||
color:#E03434;
|
color:#E03434;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -113,7 +113,8 @@
|
|||||||
isLock: false,
|
isLock: false,
|
||||||
empty: {
|
empty: {
|
||||||
tip: '暂无数据',
|
tip: '暂无数据',
|
||||||
hideScroll: false
|
hideScroll: false,
|
||||||
|
icon: '/static/images/common/empty.png'
|
||||||
},
|
},
|
||||||
textNoMore: '没有更多数据了'
|
textNoMore: '没有更多数据了'
|
||||||
},
|
},
|
||||||
|
|||||||
398
pages/common/sosSet/LinkManSetting.vue
Normal file
398
pages/common/sosSet/LinkManSetting.vue
Normal file
@ -0,0 +1,398 @@
|
|||||||
|
<template>
|
||||||
|
<view class="maincontent contentBg">
|
||||||
|
<view class='btnAdd' @click="showEdit(null,null)">添加</view>
|
||||||
|
<view class="clear"></view>
|
||||||
|
<view v-for="item,index in list" v-if="item" class="item">
|
||||||
|
<view class="itemTitle">紧急联系人{{index+1}}</view>
|
||||||
|
<view class="center main">
|
||||||
|
<view class="phone">{{item}}</view>
|
||||||
|
<view class="btns">
|
||||||
|
<view class="btnEdit" @click.stop="showEdit(item,index)">修改</view>
|
||||||
|
<view class="btnDrop" @click.stop="dropPerson(item,index)">删除</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="line" v-if="index%2==0"></view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<mescroll-empty v-show="calcList.length==0" :option="Status.optEmpty"></mescroll-empty>
|
||||||
|
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<MsgBox ref="editPop">
|
||||||
|
<view>
|
||||||
|
修改紧急联系人
|
||||||
|
</view>
|
||||||
|
<view class="w60">
|
||||||
|
|
||||||
|
<input type="text" placeholder="输入手机号" class="uni-input" v-model="cEdit.txt" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</MsgBox>
|
||||||
|
|
||||||
|
|
||||||
|
<MsgBox ref="msgPop" />
|
||||||
|
<global-loading ref="loading" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request.js';
|
||||||
|
import {
|
||||||
|
showLoading,
|
||||||
|
hideLoading,
|
||||||
|
updateLoading
|
||||||
|
} from '@/utils/loading.js';
|
||||||
|
|
||||||
|
import {
|
||||||
|
MsgSuccess,
|
||||||
|
MsgError,
|
||||||
|
MsgClose,
|
||||||
|
MsgWarning,
|
||||||
|
showPop,
|
||||||
|
MsgInfo,
|
||||||
|
MsgPrompt
|
||||||
|
} from '@/utils/MsgPops.js'
|
||||||
|
import Common from '@/utils/Common.js';
|
||||||
|
var these = null;
|
||||||
|
var eventChannel = null;
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: ['', ''],
|
||||||
|
cEdit: {
|
||||||
|
txt: '',
|
||||||
|
index: -1
|
||||||
|
},
|
||||||
|
Status: {
|
||||||
|
optEmpty: {
|
||||||
|
tip: '暂无数据',
|
||||||
|
icon: '/static/images/common/empty.png'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
device: {
|
||||||
|
id: "",
|
||||||
|
deviceName: "",
|
||||||
|
deviceImei: "",
|
||||||
|
deviceMac: "",
|
||||||
|
communicationMode: 0,
|
||||||
|
devicePic: "",
|
||||||
|
typeName: "",
|
||||||
|
bluetoothName: null,
|
||||||
|
deviceStatus: null,
|
||||||
|
bindingTime: "",
|
||||||
|
onlineStatus: 0,
|
||||||
|
battery: "0",
|
||||||
|
latitude: null,
|
||||||
|
longitude: null,
|
||||||
|
alarmStatus: null,
|
||||||
|
detailPageUrl: "/pages/650/HBY650",
|
||||||
|
showConfirm: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
calcList() {
|
||||||
|
let f = this.list.filter((v, i) => {
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
onHide: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad() {
|
||||||
|
|
||||||
|
these = this;
|
||||||
|
|
||||||
|
|
||||||
|
eventChannel = this.getOpenerEventChannel();
|
||||||
|
|
||||||
|
eventChannel.on('device', (data) => {
|
||||||
|
|
||||||
|
console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||||
|
these.device = data;
|
||||||
|
|
||||||
|
this.list[0] = data.contact1Phone;
|
||||||
|
this.list[1] = data.contact2Phone;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
notifyPrevPage(){//通知上一个页面
|
||||||
|
if (eventChannel) {
|
||||||
|
eventChannel.emit('linkManOver', this.list);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
saveData(json) {
|
||||||
|
return request({
|
||||||
|
url: "/app/hby018a/device/SetContactPhone",
|
||||||
|
method: 'POST',
|
||||||
|
data:json
|
||||||
|
});
|
||||||
|
},
|
||||||
|
dropPerson(item, index) {
|
||||||
|
showPop({
|
||||||
|
iconUrl: '/static/images/common/dell.png',
|
||||||
|
borderColor: "#e034344d",
|
||||||
|
buttonBgColor: "#E03434",
|
||||||
|
bgColor: '#383934cc',
|
||||||
|
buttonTextColor: '#FFFFFFde',
|
||||||
|
message: "确定删除紧急联系人" + (index + 1),
|
||||||
|
buttonText: '确定',
|
||||||
|
showSlot: false,
|
||||||
|
showCancel: true,
|
||||||
|
buttonCancelText: '取消',
|
||||||
|
okCallback: () => {
|
||||||
|
|
||||||
|
let url = '/app/hby018a/device/SetContactPhone';
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
this.$set(this.list,index,"");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let json = {
|
||||||
|
deviceId: this.device.id,
|
||||||
|
contact1Phone:index == 0 ? "" : this.list[0],
|
||||||
|
contact2Phone: index == 0 ? this.list[1] : ""
|
||||||
|
};
|
||||||
|
showLoading(these,{text:'请稍候...'});
|
||||||
|
this.saveData(json).then(res => {
|
||||||
|
if (res && res.code == 200) {
|
||||||
|
|
||||||
|
this.$set(this.list,index,"");
|
||||||
|
this.notifyPrevPage();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MsgError(res.msg, '', these);
|
||||||
|
}).catch(ex => {
|
||||||
|
MsgError(ex.msg, '', these);
|
||||||
|
}).finally(() => {
|
||||||
|
hideLoading(these)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}, these, false);
|
||||||
|
|
||||||
|
},
|
||||||
|
showEdit(item, index) {
|
||||||
|
if (!item && this.calcList.length >= 2) {
|
||||||
|
MsgError('紧急联系人数量达到上限', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (item) {
|
||||||
|
this.cEdit.txt = item;
|
||||||
|
this.cEdit.index = index;
|
||||||
|
} else {
|
||||||
|
this.cEdit.index = this.calcList.length;
|
||||||
|
}
|
||||||
|
MsgPrompt(these, 'editPop', () => {
|
||||||
|
if (this.cEdit.txt.replace(/ /g, '') == '') {
|
||||||
|
MsgError('请输入联系人号码', '', these);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
let reg = /^1\d{10}$/;
|
||||||
|
if (!reg.test(this.cEdit.txt)) {
|
||||||
|
MsgError('手机号格式不正确', '', these);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item) {
|
||||||
|
let f = this.list.find((v, i) => {
|
||||||
|
if (i == index) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (v == this.cEdit.txt) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
if (f) {
|
||||||
|
MsgError('已设置了相同的手机号', '', these);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let requestCall = () => {
|
||||||
|
|
||||||
|
this.$set(this.list, this.cEdit.index, this.cEdit.txt)
|
||||||
|
|
||||||
|
|
||||||
|
this.cEdit.txt = "";
|
||||||
|
this.cEdit.index = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
let url = '/app/hby018a/device/SetContactPhone';
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
requestCall();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let json = {
|
||||||
|
deviceId: this.device.id,
|
||||||
|
contact1Phone: this.cEdit.index == 0 ? this.cEdit.txt : this.list[0],
|
||||||
|
contact2Phone: this.cEdit.index == 0 ? this.list[1] : this.cEdit.txt
|
||||||
|
};
|
||||||
|
showLoading(these,{text:'请稍候...'});
|
||||||
|
this.saveData(json).then(res => {
|
||||||
|
if (res && res.code == 200) {
|
||||||
|
requestCall();
|
||||||
|
this.notifyPrevPage();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MsgError(res.msg, '', these);
|
||||||
|
}).catch(ex => {
|
||||||
|
MsgError(ex.msg, '', these);
|
||||||
|
}).finally(() => {
|
||||||
|
hideLoading(these)
|
||||||
|
});
|
||||||
|
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.item .main {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
width: 100%;
|
||||||
|
height: 0rpx;
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
|
margin: 30rpx 0rpx 20rpx 0rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.phone {
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(26, 26, 26, 1);
|
||||||
|
width: calc(100% - 160rpx);
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
text-indent: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btns .btnEdit {
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btns .btnDrop {
|
||||||
|
color: rgba(224, 52, 52, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btns {
|
||||||
|
width: 160rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
align-content: center;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
font-family: "PingFang SC";
|
||||||
|
font-style: Regular;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
|
letter-spacing: 0.07px;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.itemTitle {
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
|
||||||
|
font-family: "PingFang SC";
|
||||||
|
font-style: Regular;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
letter-spacing: 0.07px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.w60 {
|
||||||
|
width: 70%;
|
||||||
|
margin-left: 15%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-input {
|
||||||
|
margin: 30rpx 0rpx 0rpx 0rpx;
|
||||||
|
background-color: #121212;
|
||||||
|
width: 100%;
|
||||||
|
height: 60rpx;
|
||||||
|
color: #ffffffde;
|
||||||
|
border: 1rpx solid #BBE600de;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
text-indent: 8rpx;
|
||||||
|
font-family: "PingFang SC";
|
||||||
|
line-height: 60rpx;
|
||||||
|
caret-color: #BBE600;
|
||||||
|
font-weight: 200;
|
||||||
|
text-align: left;
|
||||||
|
text-indent: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnAdd {
|
||||||
|
float: right;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
font-family: "PingFang SC";
|
||||||
|
font-style: Regular;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
letter-spacing: 0.07px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding: 30rpx;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100vh;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.navbarRight .img {
|
||||||
|
width: 35rpx;
|
||||||
|
height: 35rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-navbar--fixed {
|
||||||
|
top: 0rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .uni-navbar--fixed {
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .uni-navbar__placeholder {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
251
pages/common/sosSet/TxtMsgSetting.vue
Normal file
251
pages/common/sosSet/TxtMsgSetting.vue
Normal file
@ -0,0 +1,251 @@
|
|||||||
|
<template>
|
||||||
|
<view class="maincontent contentBg">
|
||||||
|
|
||||||
|
<view class="text-content">
|
||||||
|
<view class="uni-textarea">
|
||||||
|
<textarea class="textarea" v-model="txt" placeholder-class="placehoderClass"
|
||||||
|
placeholder="SOS求救短信内容二十字以内" :auto-height="true" maxlength="20" cursor-color="#BBE600" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="footBtn">
|
||||||
|
<view class="fright convert" @click.stop="saveTxt()">保存</view>
|
||||||
|
<view class="clear"></view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="title">常用短信</view>
|
||||||
|
<view class="staItem" v-for="item,index in list" @click="copyTo(item,index)">{{item}}</view>
|
||||||
|
|
||||||
|
|
||||||
|
<MsgBox ref="msgPop" />
|
||||||
|
<global-loading ref="loading" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request.js';
|
||||||
|
import {
|
||||||
|
showLoading,
|
||||||
|
hideLoading,
|
||||||
|
updateLoading
|
||||||
|
} from '@/utils/loading.js';
|
||||||
|
|
||||||
|
import {
|
||||||
|
MsgSuccess,
|
||||||
|
MsgError,
|
||||||
|
MsgClose,
|
||||||
|
MsgWarning,
|
||||||
|
showPop,
|
||||||
|
MsgInfo
|
||||||
|
} from '@/utils/MsgPops.js'
|
||||||
|
import Common from '@/utils/Common.js';
|
||||||
|
|
||||||
|
|
||||||
|
var these = null;
|
||||||
|
var eventChannel = null;
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
txt: '',
|
||||||
|
oldTxt:'',
|
||||||
|
list: ['出现危险,速来救我!', '被困险境,万分危急,求援!', '生死关头,请立刻报警'],
|
||||||
|
device: {
|
||||||
|
id: "",
|
||||||
|
deviceName: "",
|
||||||
|
deviceImei: "",
|
||||||
|
deviceMac: "",
|
||||||
|
communicationMode: 0,
|
||||||
|
devicePic: "",
|
||||||
|
typeName: "",
|
||||||
|
bluetoothName: null,
|
||||||
|
deviceStatus: null,
|
||||||
|
bindingTime: "",
|
||||||
|
onlineStatus: 0,
|
||||||
|
battery: "0",
|
||||||
|
latitude: null,
|
||||||
|
longitude: null,
|
||||||
|
alarmStatus: null,
|
||||||
|
detailPageUrl: "",
|
||||||
|
showConfirm: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
onHide: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad() {
|
||||||
|
|
||||||
|
these = this;
|
||||||
|
|
||||||
|
|
||||||
|
eventChannel = this.getOpenerEventChannel();
|
||||||
|
|
||||||
|
eventChannel.on('device', (data)=> {
|
||||||
|
|
||||||
|
console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||||
|
these.device = data;
|
||||||
|
if(data.sosSmsMsg){
|
||||||
|
this.txt=data.sosSmsMsg;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
copyTo(item, index) {
|
||||||
|
this.txt = item;
|
||||||
|
},
|
||||||
|
|
||||||
|
saveTxt() {
|
||||||
|
if (this.txt.replace(/ /g, '') == '') {
|
||||||
|
MsgError('请输入通知内容', '', these);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showLoading(this, {
|
||||||
|
text: '请稍候...'
|
||||||
|
});
|
||||||
|
console.log("this.device=",this.device);
|
||||||
|
request({
|
||||||
|
url: '/app/hby018a/device/SetSmsMsg',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
sendMsg: this.txt,
|
||||||
|
deviceIds: [this.device.id]
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (res && res.code == 200) {
|
||||||
|
MsgSuccess('操作成功', '', these);
|
||||||
|
|
||||||
|
if(eventChannel){
|
||||||
|
eventChannel.emit('MsgOver', this.txt);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MsgError(res.msg, '', these);
|
||||||
|
}).catch(ex => {
|
||||||
|
MsgError('出现错误,操作失败', '', these);
|
||||||
|
}).finally(() => {
|
||||||
|
hideLoading(these)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.staItem {
|
||||||
|
width: 100%;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(26, 26, 26, 1);
|
||||||
|
text-indent: 30rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
font-family: "PingFang SC";
|
||||||
|
font-style: Regular;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
letter-spacing: 0.07px;
|
||||||
|
margin-bottom: 25rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
margin: 15rpx 0rpx;
|
||||||
|
font-family: "PingFang SC";
|
||||||
|
font-style: Regular;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 40rpx;
|
||||||
|
width: 100%;
|
||||||
|
height: 40rpx;
|
||||||
|
letter-spacing: 0.07px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footBtn .convert {
|
||||||
|
/* 组合 99 */
|
||||||
|
width: 130rpx;
|
||||||
|
height: 55rpx;
|
||||||
|
line-height: 55rpx;
|
||||||
|
border-radius: 180px;
|
||||||
|
color: #232323;
|
||||||
|
background-color: #AED600;
|
||||||
|
text-align: center;
|
||||||
|
font-family: 'PingFang SC';
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
letter-spacing: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placehoderClass {
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
|
||||||
|
font-family: PingFang SC;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 44rpx;
|
||||||
|
letter-spacing: 0.14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textarea {
|
||||||
|
min-height: 200rpx;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-content {
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background: rgba(26, 26, 26, 1);
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 20rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding: 30rpx;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100vh;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.navbarRight .img {
|
||||||
|
width: 35rpx;
|
||||||
|
height: 35rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-navbar--fixed {
|
||||||
|
top: 0rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .uni-navbar--fixed {
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .uni-navbar__placeholder {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="pageContent">
|
<view class="pageContent">
|
||||||
<image src="/static/images/common/login.png" mode="" class="login-bg"></image>
|
<image src="/static/images/common/login.png" mode="" class="login-bg"></image>
|
||||||
<view class="content_con">
|
<view class="content_con" @click="account">
|
||||||
<view class="user_logo">
|
<view class="user_logo">
|
||||||
<image src="/static/images/common/logo.png" class="logo"></image>
|
<image src="/static/images/common/logo.png" class="logo"></image>
|
||||||
</view>
|
</view>
|
||||||
@ -37,14 +37,14 @@
|
|||||||
<text class="title">关于我们</text>
|
<text class="title">关于我们</text>
|
||||||
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
<view class="menu-item" @click="logOff">
|
<!-- <view class="menu-item" @click="logOff">
|
||||||
<image src="/static/images/common/zhuxiao.png" class="icon"></image>
|
<image src="/static/images/common/zhuxiao.png" class="icon"></image>
|
||||||
<text class="title">注销账号</text>
|
<text class="title">注销账号</text>
|
||||||
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="menu-item" @click="account">
|
<view class="menu-item" @click="account">
|
||||||
<image src="/static/images/common/wm.png" class="icon"></image>
|
<image src="/static/images/common/wm.png" class="icon"></image>
|
||||||
<text class="title">账号安全</text>
|
<text class="title">账号</text>
|
||||||
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn_footer">
|
<view class="btn_footer">
|
||||||
|
|||||||
BIN
static/images/common/HBY018A.png
Normal file
BIN
static/images/common/HBY018A.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
static/images/common/empty.png
Normal file
BIN
static/images/common/empty.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
BIN
static/images/common/hongwai.png
Normal file
BIN
static/images/common/hongwai.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
static/images/common/hongwaiActive.png
Normal file
BIN
static/images/common/hongwaiActive.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
static/images/common/linkMan.png
Normal file
BIN
static/images/common/linkMan.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
static/images/common/shortMsg.png
Normal file
BIN
static/images/common/shortMsg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@ -651,7 +651,7 @@ class BleHelper {
|
|||||||
BleReceive() {
|
BleReceive() {
|
||||||
uni.onBLECharacteristicValueChange((receive) => {
|
uni.onBLECharacteristicValueChange((receive) => {
|
||||||
//订阅消息
|
//订阅消息
|
||||||
// console.log("收到订阅消息", receive);
|
// console.log("收到订阅消息", receive);
|
||||||
let f = this.data.LinkedList.find((v) => {
|
let f = this.data.LinkedList.find((v) => {
|
||||||
return v.deviceId == receive.deviceId;
|
return v.deviceId == receive.deviceId;
|
||||||
})
|
})
|
||||||
@ -768,6 +768,7 @@ class BleHelper {
|
|||||||
} catch (convertException) {
|
} catch (convertException) {
|
||||||
if (str && (str.trim().startsWith('{') || str.trim().startsWith('['))) {
|
if (str && (str.trim().startsWith('{') || str.trim().startsWith('['))) {
|
||||||
console.error("JSON解析失败(可能是格式错误的数据)", convertException);
|
console.error("JSON解析失败(可能是格式错误的数据)", convertException);
|
||||||
|
console.error("错误的数据", str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,6 +811,7 @@ class BleHelper {
|
|||||||
console.error(
|
console.error(
|
||||||
"订阅消息出现异常",
|
"订阅消息出现异常",
|
||||||
err);
|
err);
|
||||||
|
console.error("异常数据:", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -976,7 +978,10 @@ class BleHelper {
|
|||||||
if (this.cfg.recoveryCallback.length > 0) {
|
if (this.cfg.recoveryCallback.length > 0) {
|
||||||
this.cfg.recoveryCallback.forEach(c => {
|
this.cfg.recoveryCallback.forEach(c => {
|
||||||
try {
|
try {
|
||||||
c.callback({ deviceId: res.deviceId, connected: true });
|
c.callback({
|
||||||
|
deviceId: res.deviceId,
|
||||||
|
connected: true
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("执行蓝牙恢复连接的回调异常", err);
|
console.error("执行蓝牙恢复连接的回调异常", err);
|
||||||
}
|
}
|
||||||
@ -998,15 +1003,15 @@ class BleHelper {
|
|||||||
// console.log("发现新设备",item.name+" "+item.RSSI);
|
// console.log("发现新设备",item.name+" "+item.RSSI);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
let f = serviceDic.find(v => {
|
let f = serviceDic.find(v => {
|
||||||
return item.advertisServiceUUIDs
|
return item.advertisServiceUUIDs
|
||||||
.includes(v.serviceId);
|
.includes(v.serviceId);
|
||||||
});
|
});
|
||||||
if (f) {
|
if (f) {
|
||||||
|
|
||||||
// console.log("发现目标设备:", item);
|
// console.log("发现目标设备:", item);
|
||||||
arr.push(item);
|
arr.push(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (arr.length === 0) {
|
if (arr.length === 0) {
|
||||||
@ -1140,7 +1145,7 @@ class BleHelper {
|
|||||||
//停止搜索
|
//停止搜索
|
||||||
StopSearch() {
|
StopSearch() {
|
||||||
if (this.data.platform == 'web' || !this.data.discovering) {
|
if (this.data.platform == 'web' || !this.data.discovering) {
|
||||||
console.error("web平台或当前没有搜索,直接返回",this.data.discovering);
|
console.error("web平台或当前没有搜索,直接返回", this.data.discovering);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
let p1 = new Promise((resolve, reject) => {
|
let p1 = new Promise((resolve, reject) => {
|
||||||
@ -1575,9 +1580,11 @@ class BleHelper {
|
|||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
if (this.data.connectingDevices[deviceId]) {
|
if (this.data.connectingDevices[deviceId]) {
|
||||||
|
console.error("连接任务进行中,本次连接被阻断")
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
this.data.connectingDevices = true;
|
|
||||||
|
this.data.connectingDevices[deviceId] = true;
|
||||||
|
|
||||||
if (maxRetries === undefined) {
|
if (maxRetries === undefined) {
|
||||||
maxRetries = 0; // 最大重试次数
|
maxRetries = 0; // 最大重试次数
|
||||||
@ -1600,35 +1607,37 @@ class BleHelper {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
////console.log("findex=" + fIndex);
|
////console.log("findex=" + fIndex);
|
||||||
|
|
||||||
var these = this;
|
var these = this;
|
||||||
|
|
||||||
|
|
||||||
//连接设备
|
//连接设备
|
||||||
var linkDevice = () => {
|
var linkDevice = () => {
|
||||||
// 添加重试次数限制
|
// 添加重试次数限制
|
||||||
|
|
||||||
let retryCount = 0;
|
let retryCount = 0;
|
||||||
|
|
||||||
|
|
||||||
const connect = () => {
|
const connect = () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
if (fIndex > -1 && f?.Linked) {
|
if (fIndex > -1 && f?.Linked) {
|
||||||
// console.log("当前已连接,跳过其他步骤");
|
// console.log("当前已连接,跳过其他步骤");
|
||||||
resolve(false);
|
resolve(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.data.available) {
|
if (!this.data.available) {
|
||||||
reject(this.getError({
|
reject(this.getError({
|
||||||
code: 10001
|
code: 10001
|
||||||
}));
|
}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log("正在连接" + deviceId);
|
console.log("正在连接" + deviceId);
|
||||||
uni.createBLEConnection({
|
uni.createBLEConnection({
|
||||||
deviceId: deviceId,
|
deviceId: deviceId,
|
||||||
timeout: 20000,
|
timeout: 10000,
|
||||||
success: (info) => {
|
success: (info) => {
|
||||||
//释放连接锁
|
//释放连接锁
|
||||||
|
|
||||||
@ -1728,7 +1737,7 @@ class BleHelper {
|
|||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.OpenBlue().then((res) => {
|
this.OpenBlue().then((res) => {
|
||||||
////console.log("2222222");
|
console.log("2222222");
|
||||||
return linkDevice(deviceId);
|
return linkDevice(deviceId);
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
|
||||||
@ -1772,6 +1781,7 @@ class BleHelper {
|
|||||||
}, 500);
|
}, 500);
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
console.error("出现异常", ex);
|
console.error("出现异常", ex);
|
||||||
|
delete this.data.connectingDevices[deviceId];
|
||||||
reject(ex);
|
reject(ex);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1869,6 +1879,7 @@ class BleHelper {
|
|||||||
}
|
}
|
||||||
//向蓝牙设备发送一个字符串的ASCII码
|
//向蓝牙设备发送一个字符串的ASCII码
|
||||||
sendString(deviceid, str, writeServiceId, wirteCharactId, ms, iosIsChuck, chunkSize) {
|
sendString(deviceid, str, writeServiceId, wirteCharactId, ms, iosIsChuck, chunkSize) {
|
||||||
|
debugger;
|
||||||
if (str && typeof(str) == 'object') {
|
if (str && typeof(str) == 'object') {
|
||||||
str = JSON.stringify(str);
|
str = JSON.stringify(str);
|
||||||
}
|
}
|
||||||
@ -1913,6 +1924,7 @@ class BleHelper {
|
|||||||
}
|
}
|
||||||
//向蓝牙设备发送数据,如果没连接将自动连接后再发
|
//向蓝牙设备发送数据,如果没连接将自动连接后再发
|
||||||
sendData(deviceid, buffer, writeServiceId, wirteCharactId, ms, iosIsChuck, chunkSize) {
|
sendData(deviceid, buffer, writeServiceId, wirteCharactId, ms, iosIsChuck, chunkSize) {
|
||||||
|
debugger;
|
||||||
if (this.data.platform == 'web') {
|
if (this.data.platform == 'web') {
|
||||||
return Promise.resolve("h5平台默认成功");
|
return Promise.resolve("h5平台默认成功");
|
||||||
}
|
}
|
||||||
@ -1995,7 +2007,9 @@ class BleHelper {
|
|||||||
},
|
},
|
||||||
fail: (ex) => {
|
fail: (ex) => {
|
||||||
ex = this.getError(ex);
|
ex = this.getError(ex);
|
||||||
console.error("✗ 蓝牙指令发送失败 - deviceId:",device.deviceId, "错误:", ex);
|
console.error(
|
||||||
|
"✗ 蓝牙指令发送失败 - deviceId:",
|
||||||
|
device.deviceId, "错误:", ex);
|
||||||
|
|
||||||
_err(ex);
|
_err(ex);
|
||||||
}
|
}
|
||||||
@ -2057,7 +2071,7 @@ class BleHelper {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
20
|
20
|
||||||
); // 20ms延迟,可根据需要调整
|
); // 20ms延迟,可根据需要调整
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_resolve(result);
|
_resolve(result);
|
||||||
@ -2078,7 +2092,7 @@ class BleHelper {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
20
|
20
|
||||||
); // 20ms延迟,可根据需要调整
|
); // 20ms延迟,可根据需要调整
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_resolve(ex);
|
_resolve(ex);
|
||||||
|
|||||||
@ -31,6 +31,7 @@ class BleReceive {
|
|||||||
'/pages/100J/HBY100-J': this.Receive_100J.bind(this),
|
'/pages/100J/HBY100-J': this.Receive_100J.bind(this),
|
||||||
'/pages/6075J/BJQ6075J': this.Receive_6075.bind(this),
|
'/pages/6075J/BJQ6075J': this.Receive_6075.bind(this),
|
||||||
'/pages/210/HBY210':this.Receive_210.bind(this),
|
'/pages/210/HBY210':this.Receive_210.bind(this),
|
||||||
|
'/pages/018A/HBY018A':this.Receive_018A.bind(this)
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -743,9 +744,9 @@ class BleReceive {
|
|||||||
let receiveData = {};
|
let receiveData = {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log("订阅消息者:", path);
|
// console.log("订阅消息者:", path);
|
||||||
console.log("设备收到消息:", f);
|
// console.log("设备收到消息:", f);
|
||||||
console.log("消息内容:", receive);
|
// console.log("消息内容:", receive);
|
||||||
receiveData = JSON.parse(receive.str);
|
receiveData = JSON.parse(receive.str);
|
||||||
|
|
||||||
let recCnt = recArr.find(v => {
|
let recCnt = recArr.find(v => {
|
||||||
@ -770,6 +771,7 @@ class BleReceive {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
receiveData = {};
|
receiveData = {};
|
||||||
console.error("文本解析失败", error)
|
console.error("文本解析失败", error)
|
||||||
|
console.error("错误数据:",receive);
|
||||||
}
|
}
|
||||||
return receiveData;
|
return receiveData;
|
||||||
|
|
||||||
@ -973,6 +975,35 @@ class BleReceive {
|
|||||||
return receiveData;
|
return receiveData;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Receive_018A(receive, f, path, recArr) {
|
||||||
|
let receiveData = {};
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
receiveData = JSON.parse(receive.str);
|
||||||
|
|
||||||
|
let recCnt = recArr.find(v => {
|
||||||
|
return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
|
||||||
|
.replace(/\//g, "").toLowerCase();
|
||||||
|
});
|
||||||
|
if (!recCnt && this.ref) {
|
||||||
|
if (receiveData.sta_PowerPercent <= 20 && (receiveData.sta_system != 3 || receiveData.sta_system !=1)) {
|
||||||
|
|
||||||
|
MsgError("设备'" + f.device.deviceName + "'电量低", '', this.ref, () => {
|
||||||
|
MsgClear(this.ref);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
receiveData = {};
|
||||||
|
console.log("文本解析失败", error)
|
||||||
|
}
|
||||||
|
return receiveData;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Receive_210(receive, f, path, recArr) {
|
Receive_210(receive, f, path, recArr) {
|
||||||
let receiveData = {};
|
let receiveData = {};
|
||||||
|
|
||||||
@ -1008,11 +1039,9 @@ class BleReceive {
|
|||||||
let receiveInstance = null;
|
let receiveInstance = null;
|
||||||
export default {
|
export default {
|
||||||
getBleReceive: function(_ref) {
|
getBleReceive: function(_ref) {
|
||||||
console.log("_ref=",_ref);
|
// console.log("_ref=",_ref);
|
||||||
if (!receiveInstance) {
|
if (!receiveInstance) {
|
||||||
receiveInstance = new BleReceive(_ref);
|
receiveInstance = new BleReceive(_ref);
|
||||||
}else{
|
|
||||||
console.log("使用现有实例receiveInstance")
|
|
||||||
}
|
}
|
||||||
return receiveInstance;
|
return receiveInstance;
|
||||||
}
|
}
|
||||||
|
|||||||
166
utils/Common.js
166
utils/Common.js
@ -218,31 +218,31 @@ export default {
|
|||||||
value: "1",
|
value: "1",
|
||||||
label: "灯光模式",
|
label: "灯光模式",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['6170', '670','102','6155','650','7305','6075']
|
type: ['6170', '670', '102', '6155', '650', '7305', '6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "2",
|
value: "2",
|
||||||
label: "激光模式",
|
label: "激光模式",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['6170','6075']
|
type: ['6170', '6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "3",
|
value: "3",
|
||||||
label: "开机画面",
|
label: "开机画面",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['210', '6170', '670','6155','650','7305','6075']
|
type: ['210', '6170', '670', '6155', '650', '7305', '6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "4",
|
value: "4",
|
||||||
label: "人员信息登记",
|
label: "人员信息登记",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['210', '6170', '670','6155','650','7305','6075']
|
type: ['210', '6170', '670', '6155', '650', '7305', '6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "5",
|
value: "5",
|
||||||
label: "发送信息",
|
label: "发送信息",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['210', '6170', '670','6075']
|
type: ['210', '6170', '670', '6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "6",
|
value: "6",
|
||||||
@ -253,12 +253,12 @@ export default {
|
|||||||
value: "41",
|
value: "41",
|
||||||
label: "静电探测",
|
label: "静电探测",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['670','650']
|
type: ['670', '650']
|
||||||
}, {
|
}, {
|
||||||
value: "42",
|
value: "42",
|
||||||
label: "SOS",
|
label: "SOS",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['670','4877','6075']
|
type: ['670', '4877', '6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "43",
|
value: "43",
|
||||||
@ -266,25 +266,25 @@ export default {
|
|||||||
checked: false,
|
checked: false,
|
||||||
type: ['210']
|
type: ['210']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "44",
|
value: "44",
|
||||||
label: "报警声音",
|
label: "报警声音",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['210']
|
type: ['210']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "45",
|
value: "45",
|
||||||
label: "自动报警",
|
label: "自动报警",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['210']
|
type: ['210']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "46",
|
value: "46",
|
||||||
label: "手动报警",
|
label: "手动报警",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['210','102','6170']
|
type: ['210', '102', '6170']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "47",
|
value: "47",
|
||||||
label: "报警时长",
|
label: "报警时长",
|
||||||
checked: false,
|
checked: false,
|
||||||
@ -302,28 +302,28 @@ export default {
|
|||||||
checked: false,
|
checked: false,
|
||||||
type: ['102']
|
type: ['102']
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
value: "50",
|
value: "50",
|
||||||
label: "报警模式",
|
label: "报警模式",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['100','100J']
|
type: ['100', '100J']
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
value: "51",
|
value: "51",
|
||||||
label: "警示灯",
|
label: "警示灯",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['100','100J']
|
type: ['100', '100J']
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
value: "52",
|
value: "52",
|
||||||
label: "语音管理",
|
label: "语音管理",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['100','100J']
|
type: ['100', '100J']
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
value: "53",
|
value: "53",
|
||||||
label: "箭头模式",
|
label: "箭头模式",
|
||||||
@ -340,7 +340,7 @@ export default {
|
|||||||
value: "55",
|
value: "55",
|
||||||
label: "修改信道",
|
label: "修改信道",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['4877','102']
|
type: ['4877', '102']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "56",
|
value: "56",
|
||||||
@ -400,10 +400,10 @@ export default {
|
|||||||
},
|
},
|
||||||
//将相对路径的文件移动到_downloads文件夹中
|
//将相对路径的文件移动到_downloads文件夹中
|
||||||
moveFileToDownloads(tempFilePath) {
|
moveFileToDownloads(tempFilePath) {
|
||||||
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if(!tempFilePath){
|
if (!tempFilePath) {
|
||||||
console.log("无文件需要移动");
|
console.log("无文件需要移动");
|
||||||
resolve(tempFilePath);
|
resolve(tempFilePath);
|
||||||
return;
|
return;
|
||||||
@ -452,20 +452,21 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getOSAndUpload(){
|
getOSAndUpload() {
|
||||||
let os=uni.getSystemInfoSync().platform;
|
let os = uni.getSystemInfoSync().platform;
|
||||||
let url=''
|
let url = ''
|
||||||
if(os==='ios'){
|
if (os === 'ios') {
|
||||||
url='https://apps.apple.com/cn/app/星汉物联/id6752555460'
|
url = 'https://apps.apple.com/cn/app/星汉物联/id6752555460'
|
||||||
|
} else if (os === 'android') {
|
||||||
|
url = 'https://www.pgyer.com/xhwl';
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
else if(os==='android'){
|
os: os,
|
||||||
url='https://www.pgyer.com/xhwl';
|
url: url
|
||||||
}
|
};
|
||||||
return {os:os,url:url};
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
//将点阵数据转换成RGB565
|
//将点阵数据转换成RGB565
|
||||||
convertToRGB565(pixels, type) {
|
convertToRGB565(pixels, type) {
|
||||||
if (!type) {
|
if (!type) {
|
||||||
@ -478,15 +479,106 @@ export default {
|
|||||||
let g = pixels[i + 1];
|
let g = pixels[i + 1];
|
||||||
let b = pixels[i + 2];
|
let b = pixels[i + 2];
|
||||||
let a = pixels[i + 3];
|
let a = pixels[i + 3];
|
||||||
|
|
||||||
if (type == 'bgr') {
|
if (type == 'bgr') {
|
||||||
result[index++] = ((b & 0xF8) << 8) | ((g & 0xFC) << 3) | (r >> 3);
|
result[index++] = ((b & 0xF8) << 8) | ((g & 0xFC) << 3) | (r >> 3);
|
||||||
} else {
|
} else {
|
||||||
result[index++] = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
|
result[index++] = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
},
|
||||||
|
formatTime(value, unit = 'minute') {
|
||||||
|
// 边界处理:空值、0或负数
|
||||||
|
if (!value || value <= 0) return '0秒';
|
||||||
|
|
||||||
|
// 将所有单位统一转换为分钟和总秒数
|
||||||
|
let minutes;
|
||||||
|
let totalSeconds;
|
||||||
|
|
||||||
|
switch (unit) {
|
||||||
|
case 'second': // 秒
|
||||||
|
minutes = value / 60;
|
||||||
|
totalSeconds = value;
|
||||||
|
break;
|
||||||
|
case 'minute': // 分钟(默认)
|
||||||
|
minutes = value;
|
||||||
|
totalSeconds = value * 60;
|
||||||
|
break;
|
||||||
|
case 'hour': // 小时
|
||||||
|
minutes = value * 60;
|
||||||
|
totalSeconds = value * 3600;
|
||||||
|
break;
|
||||||
|
case 'day': // 天
|
||||||
|
minutes = value * 24 * 60;
|
||||||
|
totalSeconds = value * 86400;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
minutes = value;
|
||||||
|
totalSeconds = value * 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义时间单位(分钟)
|
||||||
|
const units = [
|
||||||
|
{ label: '年', minutes: 365 * 24 * 60 },
|
||||||
|
{ label: '月', minutes: 30 * 24 * 60 }, // 按30天简化计算
|
||||||
|
{ label: '天', minutes: 24 * 60 },
|
||||||
|
{ label: '小时', minutes: 60 },
|
||||||
|
{ label: '分', minutes: 1 }
|
||||||
|
];
|
||||||
|
|
||||||
|
let remaining = minutes;
|
||||||
|
const parts = [];
|
||||||
|
|
||||||
|
for (const unitObj of units) {
|
||||||
|
const val = Math.floor(remaining / unitObj.minutes);
|
||||||
|
if (val > 0) {
|
||||||
|
parts.push(`${val}${unitObj.label}`);
|
||||||
|
remaining %= unitObj.minutes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理剩余的秒数(remaining 现在是小于1分钟的分钟数)
|
||||||
|
if (remaining > 0) {
|
||||||
|
const seconds = Math.round(remaining * 60);
|
||||||
|
if (seconds > 0) {
|
||||||
|
parts.push(`${seconds}秒`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没有任何部分,返回总秒数
|
||||||
|
if (parts.length === 0) {
|
||||||
|
return `${Math.floor(totalSeconds)}秒`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parts.join('');
|
||||||
|
},
|
||||||
|
regeo(lon, lat) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let url =
|
||||||
|
'https://restapi.amap.com/v3/geocode/regeo?key=ca3af8a20d628897020893892bda5ae4&location=' +
|
||||||
|
lon + ',' + lat;
|
||||||
|
|
||||||
|
request({
|
||||||
|
url: url,
|
||||||
|
method: 'GET',
|
||||||
|
isAuthen: false
|
||||||
|
}).then(res => {
|
||||||
|
if (res) {
|
||||||
|
if (res.infocode == '10000' && res.info == 'OK') {
|
||||||
|
resolve(res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reject(res);
|
||||||
|
}).catch(ex => {
|
||||||
|
reject(ex);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import config from '../config/index.js';
|
import config from '../config/index.js';
|
||||||
export const env = 'production'; //production development //开发of线上 改这里就行
|
export const env = 'development'; //production development //开发of线上 改这里就行
|
||||||
const BASE = config[env];
|
const BASE = config[env];
|
||||||
const request = (options) => {
|
const request = (options) => {
|
||||||
// console.log("options" + JSON.stringify(options), BASE.BASE_URL)
|
// console.log("options" + JSON.stringify(options), BASE.BASE_URL)
|
||||||
|
|||||||
Reference in New Issue
Block a user