diff --git a/src/subpackage/device/pages/audio_manage/audio_manage.vue b/src/subpackage/device/pages/audio_manage/audio_manage.vue index f8c6df6..e55849d 100644 --- a/src/subpackage/device/pages/audio_manage/audio_manage.vue +++ b/src/subpackage/device/pages/audio_manage/audio_manage.vue @@ -4,7 +4,17 @@ {{pageInfo.name || '-'}} {{pageInfo.tips || ''}} - + + + + 音量 + + + 0% + 100% + + + @@ -135,7 +145,8 @@ this.getDeviceList({ stadium_id: newVal.id, hardware_type: this.pageInfo.hardware_type - }) + }) + } }, data() { @@ -148,12 +159,14 @@ txt: "", voicePath: "", voiceUrl: "", - } + }, + voiceLevel:0 } }, onLoad(options) { this.initAudio(); - this.initPage(options); + this.initPage(options); + }, methods: { //初始化音频 @@ -183,6 +196,48 @@ stadium_id: this.curStoreInfo.id, hardware_type: _pageInfo.hardware_type }) + this.updateVoiceSlider(); + + }, + //滑动更改音响音量 + sliderChange(e) { + console.log('value 发生变化:' + e.detail.value) + let _data = { + "device": this.curStoreInfo.device_name, + "data": { + "name": "audio-player-volume", + "value": { + "volume": e.detail.value.toString() + } + }, + } + //发送命令到中控 + this.operateReq({ + data: _data, + isTip:true + }) + }, + //更新音响音量 + updateVoiceSlider(){ + let that = this + let _data = { + "device": this.curStoreInfo.device_name, + "data": { + "name": "audio-player-volume", + "value": { + "volume": "-1" + } + }, + } + //发送命令到中控 + this.operateReq({ + data: _data, + succFun: (res) => { + console.log("操作结果:",res); + that.voiceLevel = res.data + }, + isTip:false + }) }, longPressHandle(e) { console.log("长按开始..."); @@ -322,8 +377,17 @@ .then(res => { util.hideLoad(); let _list = res.list || []; + + //直接拿中控在线状态 做下临时处理先用中控状态的数据填一下 + let deviceInfo = uni.getStorageSync("deviceInfo"); + _list = _list.map((e,i)=>{ + e['defineStatusCode'] = deviceInfo.Online==1? 1 : 0; + return e + }) this.deviceList = _list; console.log(res) + + this.updateVoiceSlider(); }) .catch(util.hideLoad) }, @@ -389,12 +453,14 @@ }, // 操作接口请求 operateReq({ - data, + data, + succFun, isTip = true, isLoad = true }) { let that = this - if (isLoad) util.showLoad(); + if (isLoad) util.showLoad(); + console.log("123",data); deviceServer.post({ url: deviceApi.ouxuanac, data: data, @@ -402,7 +468,8 @@ }) .then(res => { if (isLoad) util.hideLoad(); - if (res.data.code == 0) { + if (res.data.code == 0) { + succFun(res.data); if (isTip) util.showNone(res.data.message || '操作成功!'); that.voicePadConfig.showVoicePad = false; //操作成功后关闭voicePad } else { @@ -442,10 +509,13 @@ switchInfo, index }) { - this.getStatusReq({ - data: this.getSwitchStatusQuery(switchInfo), - index, - }) + // this.getStatusReq({ + // data: this.getSwitchStatusQuery(switchInfo), + // index, + // }) + //TODO 等待后续音响设备调试后,再开放更新设备状态功能 + util.showLoad(); + setTimeout(()=>util.hideLoad(),1000) }, 300, 300), // 获取设备状态 getStatusReq({ @@ -647,7 +717,21 @@