@ -12,7 +12,7 @@
<!-- 设备电量信息 -- >
< view class = "battery-section" >
< view class = "battery-sectionLeft" >
< image :src = "deviceInfo.devicePic" class = "bipImg" > < / image >
< image :src = "deviceInfo.devicePic" class = "bipImg" mode = "aspectFit" > < / image >
< / view >
< view >
< view class = "battery-v1" >
@ -23,7 +23,7 @@
< / view >
< / view >
< view class = "battery-v1" >
< image src = "/static/images/nz.png" class = "dlIMG" > < / image >
< image src = "/static/images/nz.png" class = "dlIMG" mode = "aspectFit" > < / image >
< view >
< view class = "battery-v2" > 1 小时 < / view >
< view class = "battery-v3" > 续航时间 < / view >
@ -61,7 +61,7 @@
<!-- 灯光亮度控制 -- >
< view class = "control-card" >
< slider :value = "sliderValue" min = "0" max = "100" activeColor = "rgb(187, 230, 0)"
< slider :value = "sliderValue" min = "1 0" max = "100" activeColor = "rgb(187, 230, 0)"
backgroundColor = "rgb(26, 26, 26)" :show-value = "false" @changing ="onSliderChanging"
@change ="onSliderChanging" / >
< / view >
@ -80,7 +80,7 @@
< / view >
< view class = "mode-v1" v-if = "hasPermission('2')" >
< view class = "mode-v2" @click ="lasermode" >
< image src = "/static/images/jg.png" class = "setIMG" > < / image >
< image src = "/static/images/jg.png" class = "setIMG" mode = "aspectFit" > < / image >
< view >
< view class = "battery-v2" > 激光模式 < / view >
< / view >
@ -88,7 +88,7 @@
< / view >
< view class = "mode-v1" v-if = "hasPermission('3')" >
< view class = "mode-v2" @click ="uploadStartup" >
< image src = "/static/images/path7.png" class = "setIMG" > < / image >
< image src = "/static/images/path7.png" class = "setIMG" mode = "aspectFit" > < / image >
< view >
< view class = "battery-v2" > 开机画面 < / view >
< view class = "mode-v3" > 上传 < / view >
@ -143,22 +143,22 @@
< view class = "section-title" > 产品信息 < / view >
< view class = "mode-buttons" >
< view class = "mode_1" @click ="productparams" >
< image src = "/static/images/cp.png" mode = "" class = "cpIMG" > < / image >
< image src = "/static/images/cp.png" mode = "" class = "cpIMG" mode = "aspectFit" > < / image >
< view class = "" > 产品参数 < / view >
< / view >
< view class = "mode_1" @click ="operatingInst" >
< image src = "/static/images/sm.png" mode = "" class = "cpIMG" > < / image >
< image src = "/static/images/sm.png" mode = "" class = "cpIMG" mode = "aspectFit" > < / image >
< view class = "" > 操作说明 < / view >
< / view >
< view class = "mode_1" @click ="operatingVideo" >
< image src = "/static/images/sp.png" mode = "" class = "cpIMG" > < / image >
< image src = "/static/images/sp.png" mode = "" class = "cpIMG" mode = "aspectFit" > < / image >
< view class = "" > 操作视频 < / view >
< / view >
< / view >
< / view >
< / view >
<!-- 弹框 -- >
< view class = "agreement-mask" v-if = "lightModeA" @click="closePopup" >
< view class = "agreement-mask" v-if = "lightModeA" @click.stop ="closePopup" >
< ! - - 灯光模式弹窗 - - >
< view class = "agreement-popup" @click.stop >
< ! - - 标题 - - >
@ -178,9 +178,9 @@
< / view >
< / view >
< ! - - 上传开机画面弹框 - - >
< view class = "agreement-mask" v-if = "lightModeB" @click="closePopup" >
< view class = "agreement-mask" v-if = "lightModeB" @click.stop ="closePopup" >
< ! - - 上传画面弹窗 - - >
< view class = "agreement-popupB" >
< view class = "agreement-popupB" @click.stop >
< ! - - 标题 - - >
< view class = "popup-title" > 上传开机画面 < / view >
< view class = "popup-content" >
@ -204,9 +204,9 @@
< / view >
< / view >
< ! - - = = = = = = = = = = = = = = = = = = = = = 激光提示框 = = = = = = = = = = = = = = = = = = - - >
< view class = "agreement-mask" v-if = "lightModeC" @click="closePopup" >
< view class = "agreement-mask" v-if = "lightModeC" @click.stop ="closePopup" >
< ! - - 上传画面弹窗 - - >
< view class = "agreement-popupC" >
< view class = "agreement-popupC" @click.stop >
< ! - - 标题 - - >
< view class = "popup-title" > 确认开启激光模式 ? < / view >
< view class = "popup-content" >
@ -220,7 +220,7 @@
<!-- 按钮组 -- >
< view class = "popup-buttons" >
< button class = "btn disagree" @click ="handleDisagree" > 取消 < / button >
< button class = "btn agreeBtn" @click ="handleBtn" > 确定 < / button >
< button class = "btn agreeBtn" @click.stop ="handleBtn" > 确定 < / button >
< / view >
< / view >
< / view >
@ -255,9 +255,9 @@
secondaryMode : 'string' ,
navBarHeight : 70 + uni . getSystemInfoSync ( ) . statusBarHeight ,
navTitle : "" ,
sliderValue : 5 0,
sliderValue : 3 0,
lightModeA : false ,
currentMainMode : '强光模式 ' ,
currentMainMode : '强光' ,
lightModeB : false ,
lightModeC : false , //激光提示框
items : [ ] ,
@ -288,7 +288,8 @@
popupConfirmText : '确认' ,
showUploadPopup : false ,
selectedImage : null , // 添加这个变量来存储选择的图片
file : ''
file : '' ,
selectedItemIndex : 0
}
} ,
computed : {
@ -319,22 +320,22 @@
if ( type === 'main' ) {
this . items = [ {
text : '强光' ,
selected : this . currentMainMode === '强光模式 ' ,
image : '/static/images/sett.png'
selected : this . currentMainMode === '强光' , // 修正匹配条件
image : '/static/images/sett.png' ,
} ,
{
text : '弱光' ,
selected : this . currentMainMode === '弱光模式 ' ,
selected : this . currentMainMode === '弱光' ,
image : '/static/images/sett.png'
} ,
{
text : '爆闪' ,
selected : this . currentMainMode === '爆闪模式 ' ,
selected : this . currentMainMode === '爆闪' ,
image : '/static/images/bs.png'
} ,
{
text : '泛光' ,
selected : this . currentMainMode === '泛光模式 ' ,
selected : this . currentMainMode === '泛光' ,
image : '/static/images/settt.png'
} ,
] ;
@ -365,18 +366,28 @@
} ,
// 灯光模式的确认
handleSumbit ( ) {
if ( this . selectedItemIndex === null ) return ;
const selectedItem = this . items [ this . selectedItemIndex ] ;
const instruction = this . modeInstructions [ selectedItem . text ] ;
console . log ( selectedItem , 'selectedItemselectedItem' ) ;
this . selectedItemIndex = selectedItem . text ;
if ( instruction ) {
const topic = ` B/ ${ this . itemInfo . deviceImei } ` ;
const message = JSON . stringify ( instruction) ;
this . mqttClient . publish ( topic , message ) ;
console . log ( '已发送指令:' , instruction) ;
}
this . lightModeA = false ;
if ( this . selectedItemIndex === null ) return ;
const selectedItem = this . items [ this . selectedItemIndex ] ;
const instruction = this . modeInstructions [ selectedItem . text ] ;
console . log ( selectedItem , 'selectedItemselectedItem' ) ;
// 修正这里的赋值错误,应该保存索引而不是文本
this . selectedItemIndex = this . selectedItemIndex ;
console . log ( this . selectedItemIndex , 'this.selectedItemIndexthis.selectedItemIndex' ) ;
// if ( instruction) {
// const topic = `B/${this.itemInfo.deviceImei}`;
// const message = JSON.stringify( instruction);
// // 确保mqttClient已连接
// if (this.mqttClient && this.mqttClient.client && this.mqttClient.client.isConnected()) {
// this.mqttClient.publish(topic, message);
// console.log('已发送指令:', instruction);
// } else {
// uni.showToast({
// title: 'MQTT未连接',
// icon: 'none'
// });
// }
// }
this . lightModeA = false ;
} ,
// 上传开机画面
uploadStartup ( ) {