Compare commits
6 Commits
8d84309ce8
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b6a5e095c | |||
| 3fecf3380a | |||
| 943d98dd40 | |||
| 7d657d4429 | |||
| 7735abc2a1 | |||
| c626f3766e |
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
<view
|
<view
|
||||||
class="popup-button-cancel"
|
class="popup-button-cancel"
|
||||||
v-if="showCancel"
|
|
||||||
:style="{display:showCancel?'block':'none'}"
|
:style="{display:showCancel?'block':'none'}"
|
||||||
@click="handleCancelClick"
|
@click="handleCancelClick"
|
||||||
>{{ buttonCancelText?buttonCancelText:'取消' }}</view>
|
>{{ buttonCancelText?buttonCancelText:'取消' }}</view>
|
||||||
|
|||||||
@ -1,187 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="msgBox" v-if="Msgboxs.length>0">
|
|
||||||
|
|
||||||
<MessagePopup v-for="item,index in Msgboxs" :visible="item.showPop" :type="item.popType" :bgColor="item.bgColor"
|
|
||||||
:borderColor="item.borderColor" :textColor="item.textColor" :buttonBgColor="item.buttonBgColor"
|
|
||||||
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
|
|
||||||
:buttonText="item.buttonText" @buttonClick="okCallback(item,index)" :visiblePrompt="item.visiblePrompt"
|
|
||||||
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
|
|
||||||
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" @cancelPop="cancelClick(item,index)" />
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'MsgBox',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
Msgboxs:[]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
//确认按钮事件,如果回调函数返回true,将阻止关闭弹窗
|
|
||||||
okCallback(item,index){
|
|
||||||
let flag=false;
|
|
||||||
if(item.okCallback){
|
|
||||||
flag=item.okCallback(item,index)
|
|
||||||
}
|
|
||||||
|
|
||||||
if(flag){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.closePop(item);
|
|
||||||
},
|
|
||||||
//取消按钮,如果回调函数返回true,将阻止关闭弹窗
|
|
||||||
cancelClick(item,index){
|
|
||||||
let flag=false;
|
|
||||||
if(item.cancelCallback){
|
|
||||||
flag=item.cancelCallback(item,index)
|
|
||||||
}
|
|
||||||
|
|
||||||
if(flag){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.closePop(item);
|
|
||||||
},
|
|
||||||
closePop: function(item) {
|
|
||||||
|
|
||||||
if (item) {
|
|
||||||
this.Msgboxs.find((v, i) => {
|
|
||||||
if (item.key === v.key) {
|
|
||||||
this.Msgboxs.splice(i, 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (item.cancelCallback) {
|
|
||||||
item.cancelCallback();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (this.Msgboxs.length > 0) {
|
|
||||||
this.Msgboxs.splice(this.Msgboxs.length - 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
//根据传入的配置,自定义一个弹窗
|
|
||||||
showPop: function(option,isClear) {
|
|
||||||
let def = {
|
|
||||||
key: '',
|
|
||||||
showPop: true, //是否显示弹窗
|
|
||||||
popType: 'custom',
|
|
||||||
bgColor: '#383934bd',
|
|
||||||
borderColor: '#BBE600',
|
|
||||||
textColor: '#ffffffde',
|
|
||||||
buttonBgColor: '#BBE600',
|
|
||||||
buttonTextColor: '#232323DE',
|
|
||||||
iconUrl: '',
|
|
||||||
message: '',
|
|
||||||
buttonText: '确定',
|
|
||||||
clickEvt: '',
|
|
||||||
visiblePrompt: false,
|
|
||||||
promptTitle: '',
|
|
||||||
modelValue: '',
|
|
||||||
visibleClose: false,
|
|
||||||
okCallback: null,
|
|
||||||
showSlot: false,
|
|
||||||
buttonCancelText: '',
|
|
||||||
showCancel: false,
|
|
||||||
cancelCallback: null
|
|
||||||
}
|
|
||||||
let json = {};
|
|
||||||
let keys = Object.keys(def);
|
|
||||||
|
|
||||||
for (let i = 0; i < keys.length; i++) {
|
|
||||||
let key = keys[i];
|
|
||||||
|
|
||||||
json[key] = def[key];
|
|
||||||
}
|
|
||||||
if (option) {
|
|
||||||
keys = Object.keys(option);
|
|
||||||
for (let i = 0; i < keys.length; i++) {
|
|
||||||
let key = keys[i];
|
|
||||||
|
|
||||||
json[key] = option[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!json.borderColor) {
|
|
||||||
json.borderColor = '#BBE600';
|
|
||||||
json.buttonBgColor = '#BBE600';
|
|
||||||
}
|
|
||||||
json.showPop = true;
|
|
||||||
if (!('key' in json)) {
|
|
||||||
json.key = new Date().getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Msgboxs.push(json);
|
|
||||||
|
|
||||||
return json;
|
|
||||||
},
|
|
||||||
//弹出预定好的三种弹窗
|
|
||||||
showMsg(msg,btnTxt, type,okCallback) {
|
|
||||||
|
|
||||||
let cfg = {
|
|
||||||
error: {
|
|
||||||
icoUrl: '/static/images/6155/DeviceDetail/uploadErr.png',
|
|
||||||
borderColor: "#e034344d",
|
|
||||||
buttonBgColor: "#E03434"
|
|
||||||
},
|
|
||||||
succ: {
|
|
||||||
icoUrl: '/static/images/common/success.png',
|
|
||||||
borderColor: "#BBE600",
|
|
||||||
buttonBgColor: "#BBE600"
|
|
||||||
},
|
|
||||||
warn: {
|
|
||||||
icoUrl: '/static/images/common/warning.png',
|
|
||||||
borderColor: "#FFC84E",
|
|
||||||
buttonBgColor: "#FFC84E",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!type) {
|
|
||||||
type = 'error';
|
|
||||||
}
|
|
||||||
if (!cfg[type]) {
|
|
||||||
type = 'error';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let guid = new Date().getTime()+"";
|
|
||||||
let options = {
|
|
||||||
key: guid,
|
|
||||||
message: msg,
|
|
||||||
iconUrl: cfg[type].icoUrl,
|
|
||||||
borderColor: cfg[type].borderColor,
|
|
||||||
buttonBgColor: cfg[type].buttonBgColor,
|
|
||||||
buttonText: btnTxt?btnTxt:'确定',
|
|
||||||
okCallback: okCallback?okCallback:this.closePop
|
|
||||||
};
|
|
||||||
return this.showPop(options);
|
|
||||||
|
|
||||||
},
|
|
||||||
//清除所有弹窗
|
|
||||||
clearPops(){
|
|
||||||
this.Msgboxs=[];
|
|
||||||
},
|
|
||||||
//获取当前所有弹窗的数量
|
|
||||||
getPops(){
|
|
||||||
return this.Msgboxs.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.msgBox{
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
z-index: 9999;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -2,13 +2,13 @@
|
|||||||
const config = {
|
const config = {
|
||||||
// 开发环境
|
// 开发环境
|
||||||
development: {
|
development: {
|
||||||
BASE_URL: 'http://192.168.110.172:8000',//http://139.224.253.23:8000
|
BASE_URL: 'http://192.168.2.34:8000',//http://139.224.253.23:8000
|
||||||
API_PREFIX: '',
|
API_PREFIX: '',
|
||||||
// MQTT 配置
|
// MQTT 配置
|
||||||
MQTT_HOST: 'www.cnxhyc.com',
|
MQTT_HOST: '47.120.79.150',
|
||||||
MQTT_PORT: 8083,
|
MQTT_PORT: 9083,
|
||||||
MQTT_USERNAME: 'admin',
|
MQTT_USERNAME: 'admin',
|
||||||
MQTT_PASSWORD: '#YtvpSfCNG'
|
MQTT_PASSWORD: '#YtvpSfCNG'
|
||||||
},
|
},
|
||||||
// 生产环境
|
// 生产环境
|
||||||
production: {
|
production: {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name" : "星汉物联",
|
"name" : "星汉物联",
|
||||||
"appid" : "__UNI__A21EF43",
|
"appid" : "__UNI__A21EF43",
|
||||||
"description" : "设备管控",
|
"description" : "设备管控",
|
||||||
"versionName" : "1.0.16",
|
"versionName" : "1.0.15",
|
||||||
"versionCode" : "100",
|
"versionCode" : "100",
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
|
|||||||
@ -414,14 +414,6 @@
|
|||||||
{
|
{
|
||||||
"navigationBarTitleText" : "录制语音"
|
"navigationBarTitleText" : "录制语音"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"path" : "pages/common/addScan/ScanEquip",
|
|
||||||
"style" :
|
|
||||||
{
|
|
||||||
"navigationBarTitleText" : "扫码",
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -736,7 +736,7 @@
|
|||||||
for (let i = 0; i < header.length; i++) {
|
for (let i = 0; i < header.length; i++) {
|
||||||
dataView.setUint8(i, header[i]);
|
dataView.setUint8(i, header[i]);
|
||||||
}
|
}
|
||||||
// console.log("curr=" + curr + "orderNo=", orderNo);
|
console.log("curr=" + curr + "orderNo=", orderNo);
|
||||||
dataView.setUint8(14, '0x' + orderNo.substring(0, 2));
|
dataView.setUint8(14, '0x' + orderNo.substring(0, 2));
|
||||||
dataView.setUint8(15, '0x' + orderNo.substring(2, 4));
|
dataView.setUint8(15, '0x' + orderNo.substring(2, 4));
|
||||||
|
|
||||||
@ -764,7 +764,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log("发送成功," + curr + "/" + total);
|
console.log("发送成功," + curr + "/" + total);
|
||||||
this.Status.curr = curr;
|
this.Status.curr = curr;
|
||||||
curr++;
|
curr++;
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<view class="row">
|
<view class="row">
|
||||||
<image class="img" src="/static/images/6155/DeviceDetail/time.png" mode="aspectFit"></image>
|
<image class="img" src="/static/images/6155/DeviceDetail/time.png" mode="aspectFit"></image>
|
||||||
<view class="txt">
|
<view class="txt">
|
||||||
<view class="bigTxt">{{ deviceInfo.batteryRemainingTime || '0' }}分钟
|
<view class="bigTxt"> {{ Math.floor((Number(deviceInfo.batteryRemainingTime)||0)/60) }}小时 {{ (Number(deviceInfo.batteryRemainingTime)||0)%60 }}分钟
|
||||||
</view>
|
</view>
|
||||||
<view class="smallTxt">续航时间</view>
|
<view class="smallTxt">续航时间</view>
|
||||||
</view>
|
</view>
|
||||||
@ -43,26 +43,26 @@
|
|||||||
<text class="value">{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus
|
<text class="value">{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus
|
||||||
=== 2 ? '故障' : '在线' }}</text>
|
=== 2 ? '故障' : '在线' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="info-row">
|
||||||
<text class="lbl">定位信息</text>
|
<text class="info-label" style="display: flex; align-items: center;">定位信息</text>
|
||||||
<view class="info-value">
|
<view class="info-value status-running" @click="gpsPosition(deviceInfo)">
|
||||||
<view class="value" @click="gpsPosition(deviceInfo)">
|
<view class="info-value status-running">
|
||||||
{{ deviceInfo && deviceInfo.longitude ? Number(deviceInfo.longitude).toFixed(4) : '' }}
|
{{ deviceInfo && deviceInfo.longitude ? Number(deviceInfo.longitude).toFixed(4) : '' }}
|
||||||
{{ deviceInfo && deviceInfo.latitude ? Number(deviceInfo.latitude).toFixed(4) : '' }}
|
{{ deviceInfo && deviceInfo.latitude ? Number(deviceInfo.latitude).toFixed(4) : '' }}
|
||||||
</view>
|
|
||||||
<view class="locationGPS">
|
|
||||||
<uni-icons type="location" size="17" color="rgba(255, 255, 255, 0.8)"
|
|
||||||
style="vertical-align: bottom;" />
|
|
||||||
{{ deviceInfo.address }}
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="info-value status-running locationGPS">
|
||||||
|
<uni-icons type="location" size="17"
|
||||||
|
color="rgba(255, 255, 255, 0.8)" style="vertical-align: bottom;" />
|
||||||
|
{{ deviceInfo.address }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
<view class="lampMode">
|
<view class="lampMode">
|
||||||
<view class="sosContent">
|
<view class="sosContent">
|
||||||
<view class="btnSos openSos center" :class="{ active: formData.sta_SOSType === 1 }"
|
<view class="btnSos openSos center" :class="{ active: formData.sta_SOSType === 1 }"
|
||||||
@click="sosSetting(1)">
|
@click="sosSetting(1)">
|
||||||
{{ deviceInfo.chargeState === 1 ? '报警中' : '强制报警' }}
|
{{ deviceInfo.voiceStrobeAlarm === 1 ? '报警中' : '强制报警' }}
|
||||||
</view>
|
</view>
|
||||||
<view class="btnSos closeSos center" @click="sosSetting(0)">解除</view>
|
<view class="btnSos closeSos center" @click="sosSetting(0)">解除</view>
|
||||||
</view>
|
</view>
|
||||||
@ -80,7 +80,7 @@
|
|||||||
<view class="arrow" @click.stop="openVolume(item, index)" v-if="item.show"
|
<view class="arrow" @click.stop="openVolume(item, index)" v-if="item.show"
|
||||||
v-for="item, index in dic.sta_VoiceType" :class="{
|
v-for="item, index in dic.sta_VoiceType" :class="{
|
||||||
'active': formData.sta_VoiceType === item.key,
|
'active': formData.sta_VoiceType === item.key,
|
||||||
'displayNone': !Status.usrToggle && index > 3
|
'displayNone': !Status.usrToggle && index > 2
|
||||||
}">
|
}">
|
||||||
<view class="outCircle">
|
<view class="outCircle">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
@ -148,32 +148,32 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="header paddingTop0">
|
<view class="header paddingTop0">
|
||||||
<text class="sliderTxt">亮度</text>
|
<text class="sliderTxt">亮度</text>
|
||||||
<text class="sliderVal">{{ formData.sta_LightDimmer }}%</text>
|
<text class="sliderVal">{{ formData.lightBrightness }}%</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="slider-container">
|
<view class="slider-container">
|
||||||
<slider min="10" max="100" step="10" :disabled="false" :value="formData.sta_LightDimmer"
|
<slider min="10" max="100" step="10" :disabled="false" :value="formData.lightBrightness"
|
||||||
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
|
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
|
||||||
@change="onBrightnessChanging" @changing="onBrightnessChanging" class="custom-slider" />
|
@change="onBrightnessChanging" @changing="onBrightnessChanging" class="custom-slider" />
|
||||||
</view>
|
</view>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<view class="header paddingTop0">
|
<view class="header paddingTop0">
|
||||||
<text class="sliderTxt">频率</text>
|
<text class="sliderTxt">频率</text>
|
||||||
<text class="sliderVal">{{ formData.sta_LightFreq }}HZ</text>
|
<text class="sliderVal">{{ formData.strobeFrequency }}HZ</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="slider-container">
|
<view class="slider-container">
|
||||||
<slider min="0.5" max="10" step="0.5" :disabled="false" :value="formData.sta_LightFreq"
|
<slider min="0.5" max="10" step="0.5" :disabled="false" :value="formData.strobeFrequency"
|
||||||
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
|
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
|
||||||
@change="onFreqChanging" @changing="onFreqChanging" class="custom-slider" />
|
@change="onFreqChanging" @changing="onFreqChanging" class="custom-slider" />
|
||||||
</view>
|
</view>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<view class="header paddingTop0">
|
<view class="header paddingTop0">
|
||||||
<text class="sliderTxt">音量</text>
|
<text class="sliderTxt">音量</text>
|
||||||
<text class="sliderVal">{{ formData.sta_VoiceVolume }}</text>
|
<text class="sliderVal">{{ formData.volume }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="slider-container">
|
<view class="slider-container">
|
||||||
<slider min="1" max="8" step="1" :disabled="false" :value="formData.sta_VoiceVolume"
|
<slider min="10" max="100" step="1" :disabled="false" :value="formData.volume" activeColor="#bbe600"
|
||||||
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
|
backgroundColor="#686767" block-size="20" block-color="#ffffffde" @change="onVolumeChanging"
|
||||||
@change="onVolumeChanging" @changing="onVolumeChanging" class="custom-slider" />
|
@changing="onVolumeChanging" class="custom-slider" />
|
||||||
</view>
|
</view>
|
||||||
<view class="proinfo lamp">
|
<view class="proinfo lamp">
|
||||||
<text class="title">产品信息</text>
|
<text class="title">产品信息</text>
|
||||||
@ -211,6 +211,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import gbk from '@/utils/gbk.js'
|
import gbk from '@/utils/gbk.js'
|
||||||
|
import MqttClient from '@/utils/mqtt.js';
|
||||||
import {
|
import {
|
||||||
showLoading,
|
showLoading,
|
||||||
hideLoading,
|
hideLoading,
|
||||||
@ -234,6 +235,7 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
mqttClient: null,
|
||||||
Status: {
|
Status: {
|
||||||
isRightIconVisible: false,
|
isRightIconVisible: false,
|
||||||
navTitle: '',
|
navTitle: '',
|
||||||
@ -304,10 +306,10 @@
|
|||||||
bleStatu: false,
|
bleStatu: false,
|
||||||
sta_address: '',
|
sta_address: '',
|
||||||
sta_VoiceType: '0',
|
sta_VoiceType: '0',
|
||||||
sta_VoiceVolume: 1,
|
volume: 10,
|
||||||
sta_LightType: '',
|
sta_LightType: '',
|
||||||
sta_LightFreq: 0.5,
|
strobeFrequency: 0.5,
|
||||||
sta_LightDimmer: 10,
|
lightBrightness: 10,
|
||||||
sta_system: '',
|
sta_system: '',
|
||||||
warnTime: 0,
|
warnTime: 0,
|
||||||
sta_SOSType: 0
|
sta_SOSType: 0
|
||||||
@ -363,7 +365,7 @@
|
|||||||
|
|
||||||
sta_LightType: [{
|
sta_LightType: [{
|
||||||
key: "6",
|
key: "6",
|
||||||
name: '红蓝',
|
name: '红蓝交替',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -383,17 +385,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "3",
|
key: "3",
|
||||||
name: '红流水',
|
name: '红色顺时针',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "4",
|
key: "4",
|
||||||
name: '黄流水',
|
name: '黄色顺时针',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "5",
|
key: "5",
|
||||||
name: '蓝流水',
|
name: '红蓝顺时针',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -450,6 +452,7 @@
|
|||||||
these.Status.navTitle = data.data.deviceName;
|
these.Status.navTitle = data.data.deviceName;
|
||||||
these.Status.apiType = data.apiType;
|
these.Status.apiType = data.apiType;
|
||||||
these.Status.isRightIconVisible = these.Status.apiType === 'listA';
|
these.Status.isRightIconVisible = these.Status.apiType === 'listA';
|
||||||
|
|
||||||
if (data.apiType !== 'listA') {
|
if (data.apiType !== 'listA') {
|
||||||
Common.getdeviceShareId(data.data.id).then(res => {
|
Common.getdeviceShareId(data.data.id).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
@ -460,6 +463,20 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
this.mqttClient = new MqttClient();
|
||||||
|
// this.mqttClient.connect(() => {
|
||||||
|
// // 订阅来自设备的状态更新
|
||||||
|
// const statusTopic = `status/894078/HBY100/${data.data.deviceImei}`;
|
||||||
|
// this.mqttClient.subscribe(statusTopic, (payload) => {
|
||||||
|
// try {
|
||||||
|
// // 解析MQTT返回的payload
|
||||||
|
// const payloadObj = typeof payload === 'string' ? JSON.parse(
|
||||||
|
// payload) : payload;
|
||||||
|
// } catch (e) {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// })
|
||||||
console.log(data, 'datatatatat');
|
console.log(data, 'datatatatat');
|
||||||
these.fetchDeviceDetail(data.data.id)
|
these.fetchDeviceDetail(data.data.id)
|
||||||
});
|
});
|
||||||
@ -487,7 +504,24 @@
|
|||||||
fetchDeviceDetail(id) {
|
fetchDeviceDetail(id) {
|
||||||
deviceDetail(id).then((res) => {
|
deviceDetail(id).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.deviceInfo = res.data
|
const validData = Object.fromEntries(
|
||||||
|
Object.entries(res.data).filter(([key, value]) => {
|
||||||
|
// 过滤规则:值为 null/undefined/0 的字段都不参与合并
|
||||||
|
return value !== null && value !== undefined && value !== 0;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
Object.assign(this.formData, validData);
|
||||||
|
this.deviceInfo = res.data;
|
||||||
|
// 0 红色爆闪,1 蓝色爆闪,2 黄色爆闪,3,红色顺时针旋转爆闪,4黄色顺时针旋转爆闪,5,红蓝顺时针旋转爆闪,6 红蓝交替爆闪
|
||||||
|
this.formData.sta_LightType = (res.data.strobeMode ?? 0) + ''
|
||||||
|
// 0爆闪关闭, 1爆闪开启
|
||||||
|
const strobeEnable = res.data.strobeEnable ?? 0;
|
||||||
|
this.formData.sta_LightType = strobeEnable === 1 ? 1 : -1;
|
||||||
|
if (res.data.alarmMode == 7) {
|
||||||
|
this.formData.sta_VoiceType = res.data.voiceStrobeAlarm ?? 0;
|
||||||
|
} else {
|
||||||
|
this.formData.sta_VoiceType = res.data.alarmMode + ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -519,6 +553,7 @@
|
|||||||
},
|
},
|
||||||
// 语音管理
|
// 语音管理
|
||||||
audioManager(item) {
|
audioManager(item) {
|
||||||
|
this.formData.sta_VoiceType = -1
|
||||||
if (this.Status.apiType !== 'listA') {}
|
if (this.Status.apiType !== 'listA') {}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/100J/audioManager/AudioList',
|
url: '/pages/100J/audioManager/AudioList',
|
||||||
@ -533,18 +568,18 @@
|
|||||||
},
|
},
|
||||||
//频率
|
//频率
|
||||||
onFreqChanging(e) {
|
onFreqChanging(e) {
|
||||||
this.formData.sta_LightFreq = e.detail.value;
|
this.formData.strobeFrequency = e.detail.value;
|
||||||
this.throttledFreqChange(e.detail.value);
|
this.throttledFreqChange(e.detail.value);
|
||||||
},
|
},
|
||||||
//音量
|
//音量
|
||||||
onVolumeChanging(e) {
|
onVolumeChanging(e) {
|
||||||
this.formData.sta_VoiceVolume = e.detail.value;
|
this.formData.volume = e.detail.value;
|
||||||
this.throttledVolumeChange(e.detail.value);
|
this.throttledVolumeChange(e.detail.value);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 亮度调节
|
// 亮度调节
|
||||||
onBrightnessChanging(e) {
|
onBrightnessChanging(e) {
|
||||||
this.formData.sta_LightDimmer = e.detail.value;
|
this.formData.lightBrightness = e.detail.value;
|
||||||
this.throttledBrightnessChange(e.detail.value);
|
this.throttledBrightnessChange(e.detail.value);
|
||||||
},
|
},
|
||||||
// 亮度调节
|
// 亮度调节
|
||||||
@ -698,7 +733,7 @@
|
|||||||
this.formData.sta_VoiceType = val;
|
this.formData.sta_VoiceType = val;
|
||||||
console.log(this.formData.sta_VoiceType, 'this.formData.sta_VoiceType')
|
console.log(this.formData.sta_VoiceType, 'this.formData.sta_VoiceType')
|
||||||
// 模式类型为7时才去判断
|
// 模式类型为7时才去判断
|
||||||
if (val == '7') {
|
if (val === '7' || val === '-1') {
|
||||||
let data = {
|
let data = {
|
||||||
deviceId: this.deviceInfo.deviceId,
|
deviceId: this.deviceInfo.deviceId,
|
||||||
voiceBroadcast: Number(this.formData.sta_VoiceType) === -1 ? 0 : 1
|
voiceBroadcast: Number(this.formData.sta_VoiceType) === -1 ? 0 : 1
|
||||||
@ -969,14 +1004,14 @@
|
|||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
background: rgba(26, 26, 26, 1);
|
background: rgba(26, 26, 26, 1);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 15rpx 0rpx 40rpx 0rpx;
|
padding: 15rpx 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.eqinfo .item {
|
.eqinfo .item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 60rpx;
|
height: 60rpx;
|
||||||
line-height: 60rpx;
|
line-height: 60rpx;
|
||||||
padding: 0rpx 28rpx;
|
/* padding: 0rpx 28rpx; */
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
@ -1006,12 +1041,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.eqinfo .info-value {
|
.eqinfo .info-value {
|
||||||
margin-top: 30rpx;
|
/* margin-top: 30rpx; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.eqinfo .status-running {
|
/* .eqinfo .status-running {
|
||||||
color: rgba(174, 214, 0, 1);
|
color: rgba(174, 214, 0, 1);
|
||||||
}
|
} */
|
||||||
|
|
||||||
.lamp {
|
.lamp {
|
||||||
margin-top: 24rpx;
|
margin-top: 24rpx;
|
||||||
@ -1714,4 +1749,32 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
|
.info-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-label {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-value {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-running {
|
||||||
|
/* color: rgba(255, 255, 255, 0.6); */
|
||||||
|
text-align: end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.locationGPS {
|
||||||
|
width: 88%;
|
||||||
|
text-align: end;
|
||||||
|
float: right;
|
||||||
|
line-height: 45rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -1,34 +1,36 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="maincontent contentBg">
|
<view class="maincontent contentBg">
|
||||||
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
|
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
|
||||||
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
|
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
|
||||||
<uni-swipe-action ref="swipeAction">
|
<uni-swipe-action ref="swipeAction">
|
||||||
<view v-for="(item, index) in dataListA" class="li" :key="index" :ref="'swipeItem_' + index">
|
<view v-for="(item, index) in dataListA" class="li" :key="index" :ref="'swipeItem_' + index">
|
||||||
<view class="itemIcon center" :class="{'displayNone':!Status.isEdit,'check':isCheck(item,index)}"
|
<view class="itemIcon center"
|
||||||
v-on:click.stop="checkToggle(item,index)">
|
:class="{ 'displayNone': !Status.isEdit, 'check': isCheck(item, index) }"
|
||||||
<image class="img" :class="{'displayNone':!isCheck(item,index)}"
|
v-on:click.stop="checkToggle(item, index)">
|
||||||
|
<image class="img" :class="{ 'displayNone': !isCheck(item, index) }"
|
||||||
src="/static/images/common/gou.png" mode="aspectFit"></image>
|
src="/static/images/common/gou.png" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="itemMain " :class="{'Edit':Status.isEdit}">
|
<view class="itemMain " :class="{ 'Edit': Status.isEdit }">
|
||||||
<uni-swipe-action-item :right-options="Options" @click="handleSwipeClick($event, item, index)"
|
<uni-swipe-action-item :right-options="Options" @click="handleSwipeClick($event, item, index)"
|
||||||
class="device-card ">
|
class="device-card ">
|
||||||
<view @click.stop="handleFile(item,index)">
|
<view @click.stop="handleFile(item, index)">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="itemLeft ">
|
<view class="itemLeft ">
|
||||||
<view class="title">{{ item.fileNameExt }}</view>
|
<view class="title">{{ item.fileNameExt }}</view>
|
||||||
<view class="smallTitle">
|
<view class="smallTitle">
|
||||||
<!-- 展示前端生成的时间 -->
|
<!-- 展示前端生成的时间 -->
|
||||||
<text>{{item.createTime || Common.DateFormat(new Date(), "yyyy年MM月dd日")}}</text>
|
<text>{{ item.createTime || Common.DateFormat(new Date(),
|
||||||
<text v-show="item.duration">{{item.duration}}秒</text>
|
"yyyy年MM月dd日") }}</text>
|
||||||
<image :class="{'displayNone':!item.fileUrl}" class="img"
|
<text v-show="item.duration">{{ item.duration }}秒</text>
|
||||||
|
<image :class="{ 'displayNone': !item.fileUrl }" class="img"
|
||||||
src="/static/images/100/volume.png" mode="aspectFit"
|
src="/static/images/100/volume.png" mode="aspectFit"
|
||||||
@click.stop="play(item,index)"></image>
|
@click.stop="play(item, index)"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="itemRight ">
|
<view class="itemRight ">
|
||||||
<view class="btn" @click.stop="Apply(item,index)"
|
<view class="btn" @click.stop="Apply(item, index)"
|
||||||
:class="{'active':item.useStatus,'btn-default':!item.useStatus}">
|
:class="{ 'active': item.useStatus, 'btn-default': !item.useStatus }">
|
||||||
{{item.useStatus==1 ?'使用中':'使用'}}
|
{{ item.useStatus == 1 ? '使用中' : '使用' }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="clear"></view>
|
<view class="clear"></view>
|
||||||
@ -40,7 +42,7 @@
|
|||||||
</uni-swipe-action>
|
</uni-swipe-action>
|
||||||
</mescroll-uni>
|
</mescroll-uni>
|
||||||
<view class="footer">
|
<view class="footer">
|
||||||
<view class="addContent" :class="{'displayNone':Status.isEdit}">
|
<view class="addContent" :class="{ 'displayNone': Status.isEdit }">
|
||||||
<view class="addItem" @click="gotoRecord('Record')">
|
<view class="addItem" @click="gotoRecord('Record')">
|
||||||
<view class="imgContent center">
|
<view class="imgContent center">
|
||||||
<image class="img" src="/static/images/100/record.png" mode="aspectFit"></image>
|
<image class="img" src="/static/images/100/record.png" mode="aspectFit"></image>
|
||||||
@ -60,7 +62,7 @@
|
|||||||
<view class="txt">文字转语音</view>
|
<view class="txt">文字转语音</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="editContent" :class="{'displayNone':!Status.isEdit}">
|
<view class="editContent" :class="{ 'displayNone': !Status.isEdit }">
|
||||||
<view class="btn-del" @click.stop="delCheckList()">删除</view>
|
<view class="btn-del" @click.stop="delCheckList()">删除</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -80,6 +82,12 @@
|
|||||||
<audio :src="cPlay.src" :id="cPlay.Id" :name="cPlay.name" author="">
|
<audio :src="cPlay.src" :id="cPlay.Id" :name="cPlay.name" author="">
|
||||||
</view> -->
|
</view> -->
|
||||||
<global-loading ref="loading"></global-loading>
|
<global-loading ref="loading"></global-loading>
|
||||||
|
<!-- 圆形进度条 + 全屏遮罩层(升级中显示) -->
|
||||||
|
<view v-if="isUpdating" class="mask-layer">
|
||||||
|
<view class="circle-progress-box">
|
||||||
|
<progress :percent="updateProgress" activeColor="#bbe600" backgroundColor="#686767" :border-radius='22' show-info stroke-width="15" class="custom-progress" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -91,6 +99,7 @@
|
|||||||
var timeout = null;
|
var timeout = null;
|
||||||
import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue'
|
import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue'
|
||||||
import BleTool from '@/utils/BleHelper.js'
|
import BleTool from '@/utils/BleHelper.js'
|
||||||
|
import MqttClient from '@/utils/mqtt.js';
|
||||||
import {
|
import {
|
||||||
deviceVoliceList,
|
deviceVoliceList,
|
||||||
videRenameAudioFile,
|
videRenameAudioFile,
|
||||||
@ -114,6 +123,7 @@
|
|||||||
isEdit: false,
|
isEdit: false,
|
||||||
playState: '',
|
playState: '',
|
||||||
playPath: '',
|
playPath: '',
|
||||||
|
mqttClient: null,
|
||||||
Pop: {
|
Pop: {
|
||||||
showPop: false, //是否显示弹窗
|
showPop: false, //是否显示弹窗
|
||||||
popType: 'custom',
|
popType: 'custom',
|
||||||
@ -193,7 +203,10 @@
|
|||||||
createTime: "", //创建时间
|
createTime: "", //创建时间
|
||||||
fileUrl: "", //本地地址
|
fileUrl: "", //本地地址
|
||||||
fileUrl: "", //网络地址
|
fileUrl: "", //网络地址
|
||||||
}
|
},
|
||||||
|
updateProgress: 0, // 升级进度,0-100
|
||||||
|
isUpdating: false, // 是否正在升级(控制进度条显示/隐藏)
|
||||||
|
mqttSubscribeSuccess: false // MQTT订阅是否成功
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@ -212,7 +225,10 @@
|
|||||||
console.log("页面返回")
|
console.log("页面返回")
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
console.log("页面卸载了");
|
// 页面卸载时断开MQTT连接
|
||||||
|
if (this.mqttClient) {
|
||||||
|
this.mqttClient.disconnect();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//语音管理列表
|
//语音管理列表
|
||||||
@ -452,57 +468,72 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Apply(item, index) {
|
Apply(item, index) {
|
||||||
console.log(item, 'itemmm');
|
this.mqttClient = new MqttClient();
|
||||||
|
this.updateProgress = 0;
|
||||||
|
this.isUpdating = true;
|
||||||
let data = {
|
let data = {
|
||||||
id: item.id
|
id: item.id
|
||||||
}
|
}
|
||||||
deviceUpdateVoice(data).then((RES) => {
|
deviceUpdateVoice(data).then((RES) => {
|
||||||
if (RES.code == 200) {
|
if (RES.code == 200) {
|
||||||
|
this.updateProgress = 0;
|
||||||
|
this.isUpdating = true;
|
||||||
|
this.mqttClient.connect(() => {
|
||||||
|
// 订阅来自设备的状态更新
|
||||||
|
const statusTopic = `status/894078/HBY100/${this.device.deviceImei}`;
|
||||||
|
this.mqttClient.subscribe(statusTopic, (payload) => {
|
||||||
|
console.log(payload, 'payloadpayloadpayload');
|
||||||
|
try {
|
||||||
|
// 解析MQTT返回的payload
|
||||||
|
const payloadObj = typeof payload === 'string' ? JSON.parse(
|
||||||
|
payload) : payload;
|
||||||
|
// 取出进度值(用可选链避免字段不存在报错)
|
||||||
|
const progress = payloadObj.data?.progress;
|
||||||
|
if (progress !== undefined && !isNaN(progress) && progress >=
|
||||||
|
0 && progress <= 100) {
|
||||||
|
this.updateProgress = progress;
|
||||||
|
console.log('当前升级进度:', progress + '%');
|
||||||
|
// 进度到100%时,触发升级完成逻辑
|
||||||
|
if (progress === 100) {
|
||||||
|
clearTimeout(this.upgradeTimer);
|
||||||
|
uni.showToast({
|
||||||
|
title: '升级完成!',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
this.isUpdating = false;
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack();
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
clearTimeout(this.upgradeTimer);
|
||||||
|
console.error('解析MQTT payload失败:', e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: RES.msg,
|
title: RES.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
console.log("状态修改完成");
|
|
||||||
// eventChannel.emit('audioApply', item.Id);
|
|
||||||
console.log("返回上一页");
|
|
||||||
setTimeout(()=>{
|
|
||||||
uni.navigateBack();
|
|
||||||
},1000)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
this.upgradeTimer = setTimeout(() => {
|
||||||
let task = () => {
|
// 超时后执行:隐藏进度条+提示超时+重置进度
|
||||||
//let fileList = uni.getStorageSync(Common.audioStorageKey);
|
uni.showToast({
|
||||||
// for (let i = 0; i < these.dataListA.length; i++) {
|
title: '升级进度同步超时',
|
||||||
// let ele = these.dataListA[i];
|
icon: 'none',
|
||||||
// if (i === index) {
|
duration: 2000
|
||||||
// these.$set(these.dataListA[index], "isApply", true);
|
});
|
||||||
// fileList.find(v => {
|
this.isUpdating = false; // 关闭进度条
|
||||||
// if (!v.devices) {
|
this.updateProgress = 0; // 重置进度值
|
||||||
// v.devices = [];
|
// 可选:如果需要取消MQTT订阅,加这行(根据需求选择)
|
||||||
// }
|
// this.mqttClient.unsubscribe(statusTopic);
|
||||||
// if (v.Id == ele.Id) {
|
}, 6000); // 6000ms = 6秒,时间可直接修改
|
||||||
// v.devices.push(these.device.id);
|
|
||||||
// return true;
|
|
||||||
// } else {
|
|
||||||
// for (let j = 0; j < v.devices.length; j++) {
|
|
||||||
// if (v.devices[j] === these.device.id) {
|
|
||||||
// v.devices.splice(j, 1);
|
|
||||||
// break
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// these.$set(these.dataListA[i], "isApply", false);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
closePop: function() {
|
closePop: function() {
|
||||||
this.Status.Pop.showPop = false;
|
this.Status.Pop.showPop = false;
|
||||||
@ -608,7 +639,18 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style lang="less">
|
||||||
|
.custom-progress{
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
.custom-progress .uni-progress-bar{
|
||||||
|
border-radius: 10rpx !important;
|
||||||
|
}
|
||||||
|
.custom-progress .uni-progress-info{
|
||||||
|
color: #BBE600;
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
.popup-prompt {
|
.popup-prompt {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 40rpx;
|
margin-top: 40rpx;
|
||||||
@ -645,8 +687,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.li .itemMain {}
|
|
||||||
|
|
||||||
.li .item {
|
.li .item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
@ -849,4 +889,28 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 全屏遮罩层:半透明黑色,覆盖整个页面,禁止底层滚动/点击 */
|
||||||
|
.mask-layer {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
/* 半透明黑,可调整透明度 */
|
||||||
|
z-index: 9999;
|
||||||
|
/* 遮罩层层级拉满,确保在最上层 */
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
/* 让内部圆形进度条垂直+水平居中 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 圆形进度条容器 */
|
||||||
|
.circle-progress-box {
|
||||||
|
position: relative;
|
||||||
|
width: 70%;
|
||||||
|
height: 100rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -976,7 +976,7 @@
|
|||||||
buttonBgColor: "#BBE600"
|
buttonBgColor: "#BBE600"
|
||||||
},
|
},
|
||||||
warn: {
|
warn: {
|
||||||
icoUrl: '/static/images/common/warning.png',
|
icoUrl: '/static/images/6170/svg.png',
|
||||||
borderColor: "#FFC84E",
|
borderColor: "#FFC84E",
|
||||||
buttonBgColor: "#FFC84E",
|
buttonBgColor: "#FFC84E",
|
||||||
}
|
}
|
||||||
|
|||||||
@ -656,7 +656,7 @@
|
|||||||
proParam: function() {
|
proParam: function() {
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/common/productDes/index?id=' + this.device.id,
|
url: '/pages/common/productDes/index?id=' + this.formData.id,
|
||||||
success(ev) {
|
success(ev) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -664,7 +664,7 @@
|
|||||||
},
|
},
|
||||||
handRemark: function() {
|
handRemark: function() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/common/operatingInstruct/index?id=' + this.device.id,
|
url: '/pages/common/operatingInstruct/index?id=' + this.formData.id,
|
||||||
success(ev) {
|
success(ev) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -672,7 +672,7 @@
|
|||||||
},
|
},
|
||||||
handVideo: function() {
|
handVideo: function() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/common/operationVideo/index?id=' + this.device.id,
|
url: '/pages/common/operationVideo/index?id=' + this.formData.id,
|
||||||
success(ev) {
|
success(ev) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -649,7 +649,7 @@
|
|||||||
proParam: function() {
|
proParam: function() {
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/common/productDes/index?id=' + this.device.id,
|
url: '/pages/common/productDes/index?id=' + this.formData.id,
|
||||||
success(ev) {
|
success(ev) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -657,7 +657,7 @@
|
|||||||
},
|
},
|
||||||
handRemark: function() {
|
handRemark: function() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/common/operatingInstruct/index?id=' + this.device.id,
|
url: '/pages/common/operatingInstruct/index?id=' + this.formData.id,
|
||||||
success(ev) {
|
success(ev) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -665,7 +665,7 @@
|
|||||||
},
|
},
|
||||||
handVideo: function() {
|
handVideo: function() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/common/operationVideo/index?id=' + this.device.id,
|
url: '/pages/common/operationVideo/index?id=' + this.formData.id,
|
||||||
success(ev) {
|
success(ev) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -590,7 +590,7 @@ these.Status.apiType = data.apiType;
|
|||||||
proParam: function() {
|
proParam: function() {
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/common/productDes/index?id=' + this.device.id,
|
url: '/pages/common/productDes/index?id=' + this.formData.id,
|
||||||
success(ev) {
|
success(ev) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -598,7 +598,7 @@ these.Status.apiType = data.apiType;
|
|||||||
},
|
},
|
||||||
handRemark: function() {
|
handRemark: function() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/common/operatingInstruct/index?id=' + this.device.id,
|
url: '/pages/common/operatingInstruct/index?id=' + this.formData.id,
|
||||||
success(ev) {
|
success(ev) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -606,7 +606,7 @@ these.Status.apiType = data.apiType;
|
|||||||
},
|
},
|
||||||
handVideo: function() {
|
handVideo: function() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/common/operationVideo/index?id=' + this.device.id,
|
url: '/pages/common/operationVideo/index?id=' + this.formData.id,
|
||||||
success(ev) {
|
success(ev) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,396 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="maincontent contentBg">
|
|
||||||
<uni-nav-bar class="nvbar" leftIcon="left" @clickLeft="navigatorBack">
|
|
||||||
<view slot="left">
|
|
||||||
<uni-icons type="back" size="23" color="#FFFFFF"></uni-icons>
|
|
||||||
</view>
|
|
||||||
<view slot="default" class="center uninavebartext">
|
|
||||||
{{Status.navbar.title}}
|
|
||||||
</view>
|
|
||||||
<view slot="right">
|
|
||||||
<view class="navbarRight center">
|
|
||||||
<view class="imgContent" @click.stop="handleRightClick(item,index)"
|
|
||||||
v-for="item,index in Status.navbar.icons">
|
|
||||||
<image class="img" :src="item.src" mode="aspectFit"></image>
|
|
||||||
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</uni-nav-bar>
|
|
||||||
|
|
||||||
<view class="scanPanel center">
|
|
||||||
<image @click.stop="scan" class="img" src="/static/images/common/scan.png" mode="aspectFit"></image>
|
|
||||||
</view>
|
|
||||||
<view class="txt">
|
|
||||||
对准二维码进行扫描
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="form">
|
|
||||||
|
|
||||||
<input class="formInput" type="text" v-model="formData.inputCode" placeholder="输入二维码内容"
|
|
||||||
placeholder-class="placeholder-class" cursor-spacing="30" cursor-color="#BBE600" />
|
|
||||||
|
|
||||||
<view class="btnOK" :class="{active:formData.inputCode}" @click.stop="addCode">确定</view>
|
|
||||||
</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
|
|
||||||
} from '@/utils/MsgPops.js'
|
|
||||||
import Common from '@/utils/Common.js';
|
|
||||||
var eventChannel = null;
|
|
||||||
var these = null;
|
|
||||||
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
Status: {
|
|
||||||
navbar: {
|
|
||||||
icons: [{
|
|
||||||
src: '/static/images/common/scane.png',
|
|
||||||
callback: this.scan
|
|
||||||
}],
|
|
||||||
title: '扫码'
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
formData: {
|
|
||||||
inputCode: ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
|
|
||||||
these = this;
|
|
||||||
setTimeout(this.scan, 500)
|
|
||||||
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
addCode() {
|
|
||||||
debugger;
|
|
||||||
if (!this.formData.inputCode) {
|
|
||||||
MsgWarning("请输入二维码内容","确定", this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let macStr = this.formData.inputCode;
|
|
||||||
|
|
||||||
if (macStr.indexOf(':') == -1) {
|
|
||||||
macStr = macStr.replace(/(.{2})/g, '$1:').slice(0, -1);
|
|
||||||
}
|
|
||||||
//通过mac地址查询
|
|
||||||
let p1 = new Promise((resolve, reject) => {
|
|
||||||
|
|
||||||
request({
|
|
||||||
url: '/app/device/getDeviceInfoByDeviceMac',
|
|
||||||
method: 'GET',
|
|
||||||
data: {
|
|
||||||
deviceMac: macStr
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
|
|
||||||
console.log("获取设备信息", res);
|
|
||||||
if (res && res.code == 200) {
|
|
||||||
console.log("res=", res);
|
|
||||||
let data = res.data;
|
|
||||||
|
|
||||||
if (data && data.id) {
|
|
||||||
resolve(data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
reject(null);
|
|
||||||
}).catch(() => {
|
|
||||||
reject(null);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
p1.then(dev => {
|
|
||||||
//蓝牙产品
|
|
||||||
this.qrCodeResult(macStr, false, 'ble');
|
|
||||||
}).catch(() => {
|
|
||||||
this.qrCodeResult(this.formData.inputCode, false, 'imei');
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
handleRightClick(item, s) {
|
|
||||||
if (item && item.callback) {
|
|
||||||
item.callback(item, s);
|
|
||||||
} else {
|
|
||||||
uni.showModal({
|
|
||||||
content: '敬请期待'
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
navigatorBack() {
|
|
||||||
uni.navigateBack();
|
|
||||||
},
|
|
||||||
qrCodeResult(cleanedResult, isConvert, type) { //条码文本,是否尝试解析,已知类型
|
|
||||||
|
|
||||||
|
|
||||||
let url = `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`;
|
|
||||||
try {
|
|
||||||
if (isConvert) {
|
|
||||||
let json = JSON.parse(cleanedResult);
|
|
||||||
if ('imei' in json) {
|
|
||||||
url =
|
|
||||||
`/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(json.imei)}`;
|
|
||||||
} else if ('blue' in json || 'ble' in json) {
|
|
||||||
if (json.ble) {
|
|
||||||
json.blue = json.ble;
|
|
||||||
}
|
|
||||||
if (json.blue) {
|
|
||||||
if (!json.blue.includes(':')) {
|
|
||||||
json.blue = json.blue.replace(
|
|
||||||
/(.{2})/g, '$1:')
|
|
||||||
.slice(0, -1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
url = `/pages/common/addBLE/LinkBle?mac=${encodeURIComponent(json.blue)}`;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (type === 'imei') {
|
|
||||||
url = `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`;
|
|
||||||
} else {
|
|
||||||
url = `/pages/common/addBLE/LinkBle?mac=${encodeURIComponent(cleanedResult)}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (ex) {
|
|
||||||
console.error("解析条码出现异常,", ex);
|
|
||||||
}
|
|
||||||
// 跳转并传递扫描结果
|
|
||||||
uni.navigateTo({
|
|
||||||
url: url
|
|
||||||
});
|
|
||||||
},
|
|
||||||
scan(item, s) {
|
|
||||||
debugger;
|
|
||||||
let systemInfo = uni.getSystemInfoSync();
|
|
||||||
if (systemInfo.uniPlatform == 'web') {
|
|
||||||
MsgError("Web平台不支持此功能,请手工录入条码", "确定", these);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.scanCode({
|
|
||||||
autoDecodeCharset: true,
|
|
||||||
autoZoom: true,
|
|
||||||
barCodeInput: true,
|
|
||||||
success: (res) => {
|
|
||||||
console.log('条码内容:', res);
|
|
||||||
let cleanedResult = res.result.trim();
|
|
||||||
this.qrCodeResult(cleanedResult, true, null);
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
this.showMsg("扫码失败:" + err.errMsg, MsgType.error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.scanPanel {
|
|
||||||
width: 100%;
|
|
||||||
height: 600rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scanPanel .img {
|
|
||||||
width: 350rpx;
|
|
||||||
height: 350rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.txt {
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
color: rgba(255, 255, 255, 0.6);
|
|
||||||
|
|
||||||
font-family: 'PingFang SC';
|
|
||||||
|
|
||||||
font-size: 28rpx;
|
|
||||||
font-weight: 400;
|
|
||||||
line-height: 20px;
|
|
||||||
letter-spacing: 0px;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.form {
|
|
||||||
width: 100%;
|
|
||||||
height: 250rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
align-content: center;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
|
||||||
|
|
||||||
.formInput {
|
|
||||||
width: 90%;
|
|
||||||
height: 80rpx;
|
|
||||||
line-height: 80rpx;
|
|
||||||
border-radius: 40rpx;
|
|
||||||
color: rgba(255, 255, 255, 0.87);
|
|
||||||
|
|
||||||
font-family: "PingFang SC";
|
|
||||||
font-style: Regular;
|
|
||||||
font-size: 28rpx;
|
|
||||||
font-weight: 400;
|
|
||||||
background: rgba(42, 42, 42, 1);
|
|
||||||
letter-spacing: 0px;
|
|
||||||
text-align: left;
|
|
||||||
text-indent: 30rpx;
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/deep/.placeholder-class {
|
|
||||||
font-family: "PingFang SC";
|
|
||||||
font-style: Regular;
|
|
||||||
font-size: 26rpx;
|
|
||||||
font-weight: 400;
|
|
||||||
color: rgba(255, 255, 255, 0.6);
|
|
||||||
letter-spacing: 0px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btnOK {
|
|
||||||
color: rgba(255, 255, 255, 0.6);
|
|
||||||
font-family: 'PingFang SC';
|
|
||||||
font-size: 30rpx;
|
|
||||||
font-weight: 400;
|
|
||||||
letter-spacing: 5rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btnOK.active {
|
|
||||||
color: #AED600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbarRight {
|
|
||||||
width: 40px;
|
|
||||||
height: 100%;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbarRight .imgContent {
|
|
||||||
width: 36rpx;
|
|
||||||
height: 36rpx;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbarRight .imgContent:first-child {
|
|
||||||
|
|
||||||
width: 38rpx !important;
|
|
||||||
height: 38rpx !important;
|
|
||||||
margin-top: -2rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbarRight .imgContent .baber {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 100;
|
|
||||||
width: 30rpx;
|
|
||||||
height: 30rpx;
|
|
||||||
line-height: 30rpx;
|
|
||||||
right: -15rpx;
|
|
||||||
top: -15rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: #f12828;
|
|
||||||
color: #ffffff;
|
|
||||||
font-family: 'PingFang SC';
|
|
||||||
font-style: Regular;
|
|
||||||
font-size: 20rpx;
|
|
||||||
font-weight: 400;
|
|
||||||
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbarRight .imgContent .img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
|
|
||||||
box-sizing: border-box;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbarRight .imgContent .img:last-child {
|
|
||||||
padding: 1rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nvbar {
|
|
||||||
top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/deep/ .uni-navbar--fixed {
|
|
||||||
top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uninavebartext {
|
|
||||||
width: 100%;
|
|
||||||
font-size: 32rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
position: fixed;
|
|
||||||
width: 100%;
|
|
||||||
bottom: 0rpx;
|
|
||||||
left: 0rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer .row {
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding: 20rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
align-content: center;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inputContent {
|
|
||||||
width: calc(100% - 110rpx);
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer .btn {
|
|
||||||
width: 100rpx;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #09a0f7;
|
|
||||||
color: #fff;
|
|
||||||
border-radius: 16rpx;
|
|
||||||
height: 70rpx;
|
|
||||||
line-height: 70rpx;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -497,57 +497,54 @@ import BleReceive from '@/utils/BleReceive';
|
|||||||
switch (item.action) {
|
switch (item.action) {
|
||||||
case 'scan':
|
case 'scan':
|
||||||
// 扫一扫
|
// 扫一扫
|
||||||
uni.navigateTo({
|
uni.scanCode({
|
||||||
url:'/pages/common/addScan/ScanEquip'
|
autoDecodeCharset:true,
|
||||||
});
|
autoZoom:true,
|
||||||
// uni.scanCode({
|
barCodeInput:true,
|
||||||
// autoDecodeCharset:true,
|
success: (res) => {
|
||||||
// autoZoom:true,
|
console.log('条码内容:', res);
|
||||||
// barCodeInput:true,
|
// 清除之前的数据
|
||||||
// success: (res) => {
|
this.previousScanResult = null;
|
||||||
// console.log('条码内容:', res);
|
// 处理新的扫码结果
|
||||||
// // 清除之前的数据
|
const cleanedResult = res.result.trim();
|
||||||
// this.previousScanResult = null;
|
console.log('扫码结果:', cleanedResult);
|
||||||
// // 处理新的扫码结果
|
let url =
|
||||||
// const cleanedResult = res.result.trim();
|
`/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`;
|
||||||
// console.log('扫码结果:', cleanedResult);
|
try {
|
||||||
// let url =
|
let json = JSON.parse(cleanedResult);
|
||||||
// `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`;
|
if ('imei' in json) {
|
||||||
// try {
|
url =
|
||||||
// let json = JSON.parse(cleanedResult);
|
`/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(json.imei)}`;
|
||||||
// if ('imei' in json) {
|
} else if ('blue' in json || 'ble' in json) {
|
||||||
// url =
|
if(json.ble){
|
||||||
// `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(json.imei)}`;
|
json.blue=json.ble;
|
||||||
// } else if ('blue' in json || 'ble' in json) {
|
}
|
||||||
// if(json.ble){
|
if(json.blue){
|
||||||
// json.blue=json.ble;
|
if (!json.blue.includes(':')) {
|
||||||
// }
|
json.blue = json.blue.replace(
|
||||||
// if(json.blue){
|
/(.{2})/g, '$1:')
|
||||||
// if (!json.blue.includes(':')) {
|
.slice(0, -1)
|
||||||
// json.blue = json.blue.replace(
|
}
|
||||||
// /(.{2})/g, '$1:')
|
}
|
||||||
// .slice(0, -1)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// url =`/pages/common/addBLE/LinkBle?mac=${encodeURIComponent(json.blue)}`;
|
url =`/pages/common/addBLE/LinkBle?mac=${encodeURIComponent(json.blue)}`;
|
||||||
// }
|
}
|
||||||
// } catch (ex) {
|
} catch (ex) {
|
||||||
|
|
||||||
// }
|
}
|
||||||
// // 跳转并传递扫描结果
|
// 跳转并传递扫描结果
|
||||||
// uni.navigateTo({
|
uni.navigateTo({
|
||||||
// url: url
|
url: url
|
||||||
// });
|
});
|
||||||
// },
|
},
|
||||||
// fail: (err) => {
|
fail: (err) => {
|
||||||
// console.log('扫码失败', err);
|
console.log('扫码失败', err);
|
||||||
// uni.showToast({
|
uni.showToast({
|
||||||
// title: '扫码失败',
|
title: '扫码失败',
|
||||||
// icon: 'none'
|
icon: 'none'
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
break;
|
break;
|
||||||
case 'bluetooth':
|
case 'bluetooth':
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 286 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
@ -784,18 +784,18 @@ class BleHelper {
|
|||||||
|
|
||||||
if (this.cfg.receivDataCallback.length > 0) {
|
if (this.cfg.receivDataCallback.length > 0) {
|
||||||
|
|
||||||
console.log("有人订阅消息")
|
// console.log("有人订阅消息")
|
||||||
this.cfg.receivDataCallback.forEach((
|
this.cfg.receivDataCallback.forEach((
|
||||||
rec) => {
|
rec) => {
|
||||||
console.log("有人订阅消息111", )
|
// console.log("有人订阅消息111", )
|
||||||
if (rec.callback) {
|
if (rec.callback) {
|
||||||
try {
|
try {
|
||||||
console.log("正在处理订阅消息",rec);
|
// console.log("正在处理订阅消息",rec);
|
||||||
rec.callback(recData, f,
|
rec.callback(recData, f,
|
||||||
rec.key, this.cfg
|
rec.key, this.cfg
|
||||||
.receivDataCallback
|
.receivDataCallback
|
||||||
);
|
);
|
||||||
console.log("处理订阅消息完毕");
|
// console.log("处理订阅消息完毕");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
"订阅消息出现异常",
|
"订阅消息出现异常",
|
||||||
|
|||||||
162
utils/MsgPops.js
162
utils/MsgPops.js
@ -1,162 +0,0 @@
|
|||||||
var MsgType = {
|
|
||||||
error: "error",
|
|
||||||
succ: "succ",
|
|
||||||
warn: "warn"
|
|
||||||
}
|
|
||||||
var time = null;
|
|
||||||
// 显示成功
|
|
||||||
export const MsgSuccess = (msg, btnTxt, ev) => {
|
|
||||||
|
|
||||||
if (!ev) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!ev.$refs.msgPop) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.succ);
|
|
||||||
|
|
||||||
createClear(ev);
|
|
||||||
return option;
|
|
||||||
}
|
|
||||||
//显示失败
|
|
||||||
export const MsgError = (msg, btnTxt, ev) => {
|
|
||||||
|
|
||||||
if (!ev) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!ev.$refs.msgPop) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.error);
|
|
||||||
createClear(ev);
|
|
||||||
return option;
|
|
||||||
}
|
|
||||||
//显示警告
|
|
||||||
export const MsgWarning = (msg, btnTxt, ev, isClear) => {
|
|
||||||
if (!ev) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!ev.$refs.msgPop) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.warn);
|
|
||||||
if (isClear === undefined || isClear) {
|
|
||||||
createClear(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
return option;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 隐藏loading
|
|
||||||
export const MsgClose = (options, ev) => {
|
|
||||||
|
|
||||||
|
|
||||||
if (!ev) {
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!ev.$refs.msgPop) {
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (typeof(options) == 'string') {
|
|
||||||
options = {
|
|
||||||
key: options
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ev.$refs.msgPop.closePop(options);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const showPop = (options, ev, isClear) => {
|
|
||||||
|
|
||||||
|
|
||||||
if (!ev) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!ev.$refs.msgPop) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
let option = ev.$refs.msgPop.showPop(options);
|
|
||||||
|
|
||||||
if (isClear === undefined || isClear) {
|
|
||||||
createClear(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
return option;
|
|
||||||
}
|
|
||||||
|
|
||||||
const createClear = (ev) => {
|
|
||||||
let cnt = getPops(ev);
|
|
||||||
if (cnt >= 5) {
|
|
||||||
clearTimeout(time);
|
|
||||||
time = setTimeout(() => {
|
|
||||||
let key = new Date().getTime();
|
|
||||||
showPop({
|
|
||||||
key: key,
|
|
||||||
message: "消息太多, 是否全部关闭",
|
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
|
||||||
borderColor: "#e034344d",
|
|
||||||
buttonBgColor: "#E03434",
|
|
||||||
buttonText: '全部关闭',
|
|
||||||
buttonTextColor: '#232323de',
|
|
||||||
showCancel: true,
|
|
||||||
buttonCancelText: "取消",
|
|
||||||
cancelCallback: () => {
|
|
||||||
|
|
||||||
MsgClose(key, ev);
|
|
||||||
},
|
|
||||||
okCallback: function() {
|
|
||||||
|
|
||||||
MsgClear(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, ev, false);
|
|
||||||
}, 500);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取当前弹窗数量
|
|
||||||
export const getPops = (ev) => {
|
|
||||||
if (!ev) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!ev.$refs.msgPop) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return ev.$refs.msgPop.getPops();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//清空所有弹窗
|
|
||||||
export const MsgClear = (ev) => {
|
|
||||||
if (!ev) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!ev.$refs.msgPop) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return ev.$refs.msgPop.clearPops();
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -22,7 +22,7 @@ const request = (options) => {
|
|||||||
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(options.data[key])}`)
|
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(options.data[key])}`)
|
||||||
.join('&');
|
.join('&');
|
||||||
url += `?${params}`;
|
url += `?${params}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
url: url,
|
url: url,
|
||||||
|
|||||||
Reference in New Issue
Block a user