Browse Source

change style id1350

privacy
刘嘉炜 1 year ago
parent
commit
11384c914a
  1. 29
      src/pages/index/index.vue
  2. 1
      src/store/actions.js
  3. 10
      src/store/device.js
  4. 2
      src/subpackage/device/components/store_name/store_name.vue
  5. 14
      src/subpackage/device/pages/air_conditioner/detail/detail.vue
  6. 531
      src/subpackage/device/pages/audio_manage/audio_manage.vue
  7. 28
      src/subpackage/device/pages/device_manage/device_manage.vue
  8. 246
      src/subpackage/device/pages/index/index.vue
  9. 103
      src/subpackage/device/pages/switch_manage/switch_manage.vue
  10. BIN
      src/subpackage/device/static/images/air_conditioner/nw_close.png
  11. BIN
      src/subpackage/device/static/images/air_conditioner/nw_open.png
  12. BIN
      src/subpackage/device/static/images/arrow_1a.png
  13. BIN
      src/subpackage/device/static/images/close.png
  14. BIN
      src/subpackage/device/static/images/electrify.png
  15. BIN
      src/subpackage/device/static/images/i_txt.png
  16. BIN
      src/subpackage/device/static/images/i_voice_1.png
  17. BIN
      src/subpackage/device/static/images/in.png
  18. BIN
      src/subpackage/device/static/images/longOpen.png
  19. BIN
      src/subpackage/device/static/images/open.png
  20. BIN
      src/subpackage/device/static/images/out.png
  21. BIN
      src/subpackage/device/static/images/outage.png
  22. BIN
      src/subpackage/device/static/images/page_bg.jpg
  23. BIN
      src/subpackage/device/static/images/timing.png

29
src/pages/index/index.vue

@ -7,18 +7,20 @@
<image src="/static/images/icon/arrow_ff.png" mode="aspectFit"></image>
</view>
<view v-else class="ih-btn" hover-class="hover-active" @click="showAuthor">点击登陆</view>
<view class="ih-tip">今日总收入</view>
<view class="ih-price"><text>{{loginStatus?'¥':''}}</text>{{loginStatus?(indexData.amount || '0'):'***'}}</view>
<view class="ih-amount">
<view>
<view>收款笔数</view>
<view>{{loginStatus?(indexData.in_count || '0'):'**'}}</view>
</view>
<view>
<view>退款笔数</view>
<view>{{loginStatus?(indexData.out_count || '0'):'**'}}</view>
<block v-if="isPermissionShowTab({ serverKey: 1001 })">
<view class="ih-tip">今日总收入</view>
<view class="ih-price"><text>{{loginStatus?'¥':''}}</text>{{loginStatus?(indexData.amount || '0'):'***'}}</view>
<view class="ih-amount">
<view>
<view>收款笔数</view>
<view>{{loginStatus?(indexData.in_count || '0'):'**'}}</view>
</view>
<view>
<view>退款笔数</view>
<view>{{loginStatus?(indexData.out_count || '0'):'**'}}</view>
</view>
</view>
</view>
</block>
<image class="ih-bg-icon" style="left: 0;" mode="aspectFit" src="/static/images/icon/index/header_bg_a.png"></image>
<image class="ih-bg-icon" mode="aspectFit" src="/static/images/icon/index/header_bg_b.png"></image>
</view>
@ -375,11 +377,12 @@
}
.ic-header{
position: relative;
height: 476upx;
height: auto;
margin-bottom: 24upx;
padding: 38upx 24upx 0;
padding: 38upx 24upx 30upx;
border-radius: 14upx;
background-color: $themeColor;
overflow: hidden;
.ih-address{
margin-bottom: 26upx;
@include centerFlex(center);

1
src/store/actions.js

@ -3,6 +3,7 @@ import { servers } from '../js/server';
import { API } from '../js/api';
export default {
getBrandInfo({commit, state}){
if(state?.brandInfo?.brand?.id)return Promise.resolve(state.brandInfo);
return servers.get({
url: API.calc,
data: {},

10
src/store/device.js

@ -17,7 +17,7 @@ export default {
}
},
actions: { // 小程序模块化访问失败 this.$store.dispatch('device/getStoreList')
getStoreList({ commit, state , rootState}){
getStoreList({ commit, state , rootState}, { stadium_id = '' } = {}){
return deviceServer.get({
url: deviceApi.stadiumList,
data: { brand_id: rootState.brandInfo.brand.id },
@ -26,7 +26,13 @@ export default {
.then(res=>{
let _list = res.list || [];
commit('setStoreList', _list);
if(JSON.stringify(state.curStoreInfo) == '{}'&&_list.length)commit('setStoreInfo', _list[0]);
if(Object.keys(state.curStoreInfo)?.length ===0&&_list?.length){
if(stadium_id&&_list.some(item=>item.id===stadium_id)){
commit('setStoreInfo', _list.find(item=>item.id===stadium_id));
}else{
commit('setStoreInfo', _list[0]);
}
}
return res;
})
}

2
src/subpackage/device/components/store_name/store_name.vue

@ -17,7 +17,7 @@ export default {
curStoreInfo: state => state.device.curStoreInfo,
}),
getThemeIcon(){
return ()=> {return (this.theme=='light')?'../../static/images/arrow_b2_light.png':'../../static/images/arrow_b2.png';}
return ()=> {return (this.theme=='light')?'../../static/images/arrow_b2_light.png':'../../static/images/arrow_1a.png';}
},
getThemeColor(){
return ()=> {return (this.theme=='light')?'#FFFFFF':'#1a1a1a';}

14
src/subpackage/device/pages/air_conditioner/detail/detail.vue

@ -26,11 +26,11 @@
</view>
<view class="ap-btns">
<view class="ab-item" @click="operateBtn({ op: 'on' })">
<image mode="aspectFit" :src="getIconPath('open')"></image>
<image mode="aspectFit" :src="getIconPath('nw_open')"></image>
<view></view>
</view>
<view class="ab-item" @click="operateBtn({ op: 'off' })">
<image mode="aspectFit" :src="getIconPath('close')"></image>
<image mode="aspectFit" :src="getIconPath('nw_close')"></image>
<view></view>
</view>
</view>
@ -315,6 +315,11 @@ export default {
<style lang="scss">
@import '~style/public.scss';
page{
background:url(../../../static/images/page_bg.jpg) repeat-y;
background-size: 100%;
background-attachment: fixed;
}
.air-conditioner-detail{
padding: 40upx;
.acd-tit{
@ -327,7 +332,8 @@ export default {
margin-bottom: 60upx;
padding: 24upx 14upx 50upx;
border-radius: 10upx;
background-color: #fff;
box-shadow: 0 4upx 12upx 0 #00987454, inset 0 0 40upx 0 #ffffff80;
background-image: linear-gradient(180deg, #eff6f44d 0%, #FFFFFF 100%);
.ap-top-info{
margin-bottom: 64upx;
flex-wrap: nowrap;
@ -420,7 +426,7 @@ export default {
margin-bottom: 28upx;
line-height: 40upx;
font-size: 28upx;
color: #9c9c9f;
color: #fff;
}
.abl-ls{
display: flex;

531
src/subpackage/device/pages/audio_manage/audio_manage.vue

@ -4,16 +4,16 @@
<view class="sm-tit">
<text>{{pageInfo.name || '-'}}</text>
<text>{{pageInfo.tips || ''}}</text>
</view>
<view class="slider-box">
<text>音量</text>
<slider :value="voiceLevel" activeColor="#009874" block-color="#009874" block-size="22" @change="sliderChange" min="0" max="100" />
<view class="">
<text>0%</text>
<text>100%</text>
</view>
</view>
</view>
<view class="slider-box">
<text>音量</text>
<slider :value="voiceLevel" activeColor="#009874" block-color="#009874" block-size="22" @change="sliderChange" min="0" max="100" />
<view class="">
<text>0%</text>
<text>100%</text>
</view>
</view>
<view class="sm-list">
<view class="sl-item" v-for="(e, i) in deviceList" :key="i">
@ -117,7 +117,7 @@
mapState
} from 'vuex';
import util from '../../../../utils/util';
import DEVICE_FUN from '../../js/device_fun.js';
export default {
@ -132,7 +132,7 @@
return i => {
return `../../static/images/i_voice_${i}.png`
}
},
},
getVoiceTxt() {
return i => {
return [,'请按住说话','录音中...','录音已完成','播放中...'][i]
@ -146,7 +146,7 @@
this.getDeviceList({
stadium_id: newVal.id,
hardware_type: this.pageInfo.hardware_type
})
})
}
},
@ -160,237 +160,237 @@
txt: "",
voicePath: "",
voiceUrl: "",
},
},
voiceLevel:0
}
},
onLoad(options) {
this.initAudio();
this.initPage(options);
this.initPage(options);
},
methods: {
//
initAudio(){
let self = this;
recorderManager.onStop(function(res) {
console.log('recorder stop' + JSON.stringify(res));
self.voicePadConfig.voicePath = res.tempFilePath;
});
innerAudioContext.onPlay(function(res) {
console.log('play voice onPlay' + JSON.stringify(res));
if(self.voicePadConfig.step==3)self.voicePadConfig.step = 4
});
innerAudioContext.onEnded(function(res) {
console.log('play voice onEnded' + JSON.stringify(res));
if(self.voicePadConfig.step == 4)self.voicePadConfig.step = 3
});
},
initPage(options){
let _pageInfo = showArr[`s${options.sid}`] || {};
this.pageInfo = _pageInfo;
uni.setNavigationBarTitle({
title: _pageInfo.name
});
this.getDeviceList({
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
})
methods: {
//
initAudio(){
let self = this;
recorderManager.onStop(function(res) {
console.log('recorder stop' + JSON.stringify(res));
self.voicePadConfig.voicePath = res.tempFilePath;
});
innerAudioContext.onPlay(function(res) {
console.log('play voice onPlay' + JSON.stringify(res));
if(self.voicePadConfig.step==3)self.voicePadConfig.step = 4
});
innerAudioContext.onEnded(function(res) {
console.log('play voice onEnded' + JSON.stringify(res));
if(self.voicePadConfig.step == 4)self.voicePadConfig.step = 3
});
},
initPage(options){
let _pageInfo = showArr[`s${options.sid}`] || {};
this.pageInfo = _pageInfo;
uni.setNavigationBarTitle({
title: _pageInfo.name
});
this.getDeviceList({
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("长按开始...");
this.voicePadConfig.step = 2
console.log('开始录音');
recorderManager.start({
format: "wav"
console.log("长按开始...");
this.voicePadConfig.step = 2
console.log('开始录音');
recorderManager.start({
format: "wav"
});
},
touchEndHandle(e) {
console.log("触摸结束...");
this.voicePadConfig.step = 3
console.log('录音结束');
this.voicePadConfig.step = 3
console.log('录音结束');
recorderManager.stop();
},
//
HandleVoiceOperate({
switchInfo,
status
}) {
console.log(switchInfo, status);
if (status === 1) { //
console.log("文字转语音");
this.voicePadConfig.showVoicePad = true
this.voicePadConfig.step = 0
} else { //
console.log("语音发送");
this.voicePadConfig.showVoicePad = true
this.voicePadConfig.step = 1
}
},
//
async sendVoice() {
let that = this
console.log(deviceApi.ORIGIN)
//
let _url = ""; //
if(this.voicePadConfig.step==0){
let txt = this.voicePadConfig.txt
if(!txt)return util.showNone("请先输入您要说的话后重试")
_url = `${deviceApi.ORIGIN}/ouxuanac/tts/textToVoice.wav?text=${txt}&voice_type=4&speed=-1&volume=10`;
}
//
if(this.voicePadConfig.step==3){
console.log("本地录音path:",that.voicePadConfig.voicePath);
let e = await deviceServer.uploadFile({
url: deviceApi.uploadAudio,
filePath: that.voicePadConfig.voicePath
});
let _res = util.jsonPar(e.data);
if (_res.code == 0) {
that.voicePadConfig.voiceUrl = _res.data.url
console.log("上传成功后path:", that.voicePadConfig.voiceUrl);
_url = _res.data.url //
} else {
console.error('上传录音失败--->', _res);
util.showNone(_res.message || '上传录音失败,请重试!')
return
}
}
//data
let _data = {
"device": this.curStoreInfo.device_name,
"data": {
"name": "audio-player",
"value": {
"url": _url
}
},
// "token": "f0d5c19b-b87e-11eb-bc7d-5254005df464"
}
//
},
//
HandleVoiceOperate({
switchInfo,
status
}) {
console.log(switchInfo, status);
if (status === 1) { //
console.log("文字转语音");
this.voicePadConfig.showVoicePad = true
this.voicePadConfig.step = 0
} else { //
console.log("语音发送");
this.voicePadConfig.showVoicePad = true
this.voicePadConfig.step = 1
}
},
//
async sendVoice() {
let that = this
console.log(deviceApi.ORIGIN)
//
let _url = ""; //
if(this.voicePadConfig.step==0){
let txt = this.voicePadConfig.txt
if(!txt)return util.showNone("请先输入您要说的话后重试")
_url = `${deviceApi.ORIGIN}/ouxuanac/tts/textToVoice.wav?text=${txt}&voice_type=4&speed=-1&volume=10`;
}
//
if(this.voicePadConfig.step==3){
console.log("本地录音path:",that.voicePadConfig.voicePath);
let e = await deviceServer.uploadFile({
url: deviceApi.uploadAudio,
filePath: that.voicePadConfig.voicePath
});
let _res = util.jsonPar(e.data);
if (_res.code == 0) {
that.voicePadConfig.voiceUrl = _res.data.url
console.log("上传成功后path:", that.voicePadConfig.voiceUrl);
_url = _res.data.url //
} else {
console.error('上传录音失败--->', _res);
util.showNone(_res.message || '上传录音失败,请重试!')
return
}
}
//data
let _data = {
"device": this.curStoreInfo.device_name,
"data": {
"name": "audio-player",
"value": {
"url": _url
}
},
// "token": "f0d5c19b-b87e-11eb-bc7d-5254005df464"
}
//
if(_url)this.operateReq({
data: _data
})
},
/// /
async listenVoice() {
let self = this
if(this.voicePadConfig.step==0){
//,
let txt = this.voicePadConfig.txt;
if(!txt)return util.showNone("请先输入您要说的话后重试")
let url =`${deviceApi.ORIGIN}/ouxuanac/tts/textToVoice.wav?text=${txt}&voice_type=4&speed=-1&volume=10`;
let updated_url = await this.getDownloadUrl(url)
innerAudioContext.src = updated_url
}
if(this.voicePadConfig.step==3){
innerAudioContext.src = this.voicePadConfig.voicePath;
}
console.log('播放录音文件:', innerAudioContext.src);
if(innerAudioContext.src)innerAudioContext.play();
},
getDownloadUrl(url) {
console.log('下载录音');
util.showLoad()
return new Promise((rs,rj)=>{
uni.downloadFile({
url: url, //e
success: (res) => {
if (res.statusCode === 200) {
console.log('下载成功',res);
util.hideLoad()
rs(res.tempFilePath)
}
},
fail: (e) => {
console.log('文字转录音文件下载失败',e);
util.hideLoad()
rj(e)
},
complete: (e) => {
util.hideLoad()
},
});
})
},
getDeviceList({
stadium_id,
hardware_type,
limit = 100,
page = 1
}) {
util.showLoad();
deviceServer.get({
url: deviceApi.hardwareList,
data: {
'filter[hardware_type]': hardware_type,
'filter[stadium_id]': stadium_id,
'limit': limit,
'page': page,
},
failMsg: '加载失败!'
})
.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)
})
},
/// /
async listenVoice() {
let self = this
if(this.voicePadConfig.step==0){
//,
let txt = this.voicePadConfig.txt;
if(!txt)return util.showNone("请先输入您要说的话后重试")
let url =`${deviceApi.ORIGIN}/ouxuanac/tts/textToVoice.wav?text=${txt}&voice_type=4&speed=-1&volume=10`;
let updated_url = await this.getDownloadUrl(url)
innerAudioContext.src = updated_url
}
if(this.voicePadConfig.step==3){
innerAudioContext.src = this.voicePadConfig.voicePath;
}
console.log('播放录音文件:', innerAudioContext.src);
if(innerAudioContext.src)innerAudioContext.play();
},
getDownloadUrl(url) {
console.log('下载录音');
util.showLoad()
return new Promise((rs,rj)=>{
uni.downloadFile({
url: url, //e
success: (res) => {
if (res.statusCode === 200) {
console.log('下载成功',res);
util.hideLoad()
rs(res.tempFilePath)
}
},
fail: (e) => {
console.log('文字转录音文件下载失败',e);
util.hideLoad()
rj(e)
},
complete: (e) => {
util.hideLoad()
},
});
})
},
getDeviceList({
stadium_id,
hardware_type,
limit = 100,
page = 1
}) {
util.showLoad();
deviceServer.get({
url: deviceApi.hardwareList,
data: {
'filter[hardware_type]': hardware_type,
'filter[stadium_id]': stadium_id,
'limit': limit,
'page': page,
},
failMsg: '加载失败!'
})
.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)
},
// status 0 -> 1 ->
operateBtn: util.debounce(function({
@ -405,9 +405,9 @@
let _data = this.getOperateReqData({
switchInfo,
status
})
_data = DEVICE_FUN.AC_filterCloudACData(data,switchInfo);
})
_data = DEVICE_FUN.AC_filterCloudACData(data,switchInfo);
//->& 20201224 5
if (switchInfo.hardware_type === 'AccessControl' && status == 1) {
@ -457,13 +457,13 @@
},
//
operateReq({
data,
data,
succFun,
isTip = true,
isLoad = true
}) {
}) {
let that = this
if (isLoad) util.showLoad();
if (isLoad) util.showLoad();
deviceServer.post({
url: deviceApi.ouxuanac,
@ -472,9 +472,9 @@
})
.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 || '操作成功!');
if (isTip) util.showNone(res.data.message || '操作成功!');
that.voicePadConfig.showVoicePad = false; //voicePad
} else {
if (isTip) util.showNone(res.data.message || '操作失败!');
@ -516,12 +516,12 @@
// this.getStatusReq({
// data: this.getSwitchStatusQuery(switchInfo),
// index,
// })
//TODO ,
// _data = DEVICE_FUN.AC_filterCloudACData(data,switchInfo);
util.showLoad();
setTimeout(()=>util.hideLoad(),1000)
// })
//TODO ,
// _data = DEVICE_FUN.AC_filterCloudACData(data,switchInfo);
util.showLoad();
setTimeout(()=>util.hideLoad(),1000)
}, 300, 300),
//
getStatusReq({
@ -674,7 +674,7 @@
let _obj = {
'Gpio': 'get-rpio', //
'SerialPort485': 'zzio404d-gpio-status',
'Tcp': 'zzio404d-gpio-status-tcp',
'Tcp': 'zzio404d-gpio-status-tcp',
'YZK':'zzio404d-gpio-status'
};
@ -689,7 +689,7 @@
let _obj = {
'Gpio': 'set-rpio', //
'SerialPort485': 'zzio404d-gpio',
'Tcp': 'zzio404d-gpio-tcp',
'Tcp': 'zzio404d-gpio-tcp',
'YZK':'zzio404d-gpio'
};
@ -707,7 +707,7 @@
let _obj = {
'acmelec': 'acmelec',
'zhongnan': 'zhongnan',
'jianda': 'ray-air-rs',
'jianda': 'ray-air-rs',
"XiaoHuiXiong":"xhx-lora-air-tcp"
};
return _obj[this.changeLowerCase(hardware_model)] || '';
@ -726,20 +726,25 @@
<style lang="scss">
@import '~style/public.scss';
.slider-box{
margin-bottom: 40rpx;
> text {
margin-left: 30rpx;
font-size: 24rpx;
color: #9C9C9F;
}
> view{
width: 100%;
color: #9C9C9F;
font-size: 28rpx;
@include centerFlex(space-between);
padding: 0 34rpx;
}
page{
background:url(../../static/images/page_bg.jpg) repeat-y;
background-size: 100%;
background-attachment: fixed;
}
.slider-box{
margin-bottom: 40rpx;
> text {
margin-left: 30rpx;
font-size: 24rpx;
color: #9C9C9F;
}
> view{
width: 100%;
color: #9C9C9F;
font-size: 28rpx;
@include centerFlex(space-between);
padding: 0 34rpx;
}
}
.sm-tit {
padding-left: 40upx;
@ -758,7 +763,7 @@
text:last-child {
width: 466rpx;
color: #9C9C9F;
color: #fff;
font-size: 24rpx;
}
}
@ -773,8 +778,8 @@
margin-bottom: 30upx;
width: 328upx;
border-radius: 10upx;
background-color: #fff;
box-shadow: 0 4upx 12upx 0 #00987454, inset 0 0 40upx 0 #ffffff80;
background-image: linear-gradient(180deg, #eff6f44d 0%, #FFFFFF 100%);
.si-top {
padding: 20upx 20upx 30upx;
display: flex;
@ -973,4 +978,4 @@
}
}
</style>
</style>

28
src/subpackage/device/pages/device_manage/device_manage.vue

@ -109,7 +109,10 @@ export default {
curStoreInfo(newVal, oldVal){
let { pageInfo } = this;
this.deviceList = [];
this.getDeviceList(pageInfo)
this.getDeviceList({
stadium_id: newVal.id,
hardware_type: pageInfo.deviceType,
})
}
},
components: {
@ -126,7 +129,10 @@ export default {
let _pageInfo = dmObj[`d${options.sid}`] || {};
this.pageInfo = _pageInfo;
uni.setNavigationBarTitle({ title: _pageInfo.name });
this.getDeviceList(_pageInfo)
this.getDeviceList({
stadium_id: options.stadium_id,
hardware_type: _pageInfo.deviceType,
})
},
methods: {
refreshBtn: util.debounce(function({deviceInfo, index}){
@ -228,14 +234,13 @@ export default {
}
})
},
getDeviceList(pageInfo){
let { curStoreInfo } = this;
getDeviceList({ stadium_id, hardware_type }){
util.showLoad();
deviceServer.get({
url: deviceApi.hardwareList,
data: {
'filter[stadium_id]': curStoreInfo.id,
'filter[hardware_type]': pageInfo.deviceType,
'filter[stadium_id]': stadium_id,
'filter[hardware_type]': hardware_type,
},
failMsg: '加载设备失败!'
})
@ -284,6 +289,11 @@ export default {
<style lang="scss">
@import '~style/public.scss';
page{
background:url(../../static/images/page_bg.jpg) repeat-y;
background-size: 100%;
background-attachment: fixed;
}
.dm-tit{
padding: 50upx 40upx 30upx;
line-height: 60upx;
@ -295,13 +305,15 @@ export default {
padding: 0 40upx;
.dl-item{
margin-bottom: 30upx;
background-color: #fff;
border-radius: 10upx;
box-shadow: 0 4upx 12upx 0 #00987454, inset 0 0 40upx 0 #ffffff80;
background-image: linear-gradient(180deg, #eff6f44d 0%, #FFFFFF 100%);
}
.di-header{
padding: 24upx 20upx;
display: flex;
justify-content: space-between;
border-bottom: 2upx solid #D8D8D8;
border-bottom: 2upx solid #FFFFFF;
>image{
flex-shrink: 0;
flex-grow: 0;

246
src/subpackage/device/pages/index/index.vue

@ -1,20 +1,36 @@
<template>
<view class="index-container">
<view class="ic-top-box">
<image class="custom-back" @click="goBack()" src="../../static/images/arrow_back.png" :style="{top:getTop(18) + 'px'}" mode=""></image>
<view class="brand-name" :style="{marginTop:getTop(30) + 'px'}">{{curStoreInfo.brand_name}}</view>
<view class="ic-header">
<view class="ih-bar" :style="'padding-top:'+headerInfo.statusBarHeight+'px'">
<view class="ib-title-bar" :style="titleStyle">
<image class="itb-back-icon" @click="goBack()" src="../../static/images/arrow_back.png"></image>
<text>欧轩智能商家助手</text>
</view>
</view>
<store-name :theme="'light'"></store-name>
<view class="device-info">
<text class="device-name">欧轩智能中控</text>
<text @click="copyDeviceID">设备id: {{curStoreInfo.device_name||"-"}} <text class="id-copy" >复制</text></text>
<text>最后上线时间{{deviceInfo.LastOfflineTimeStr||"-"}} </text>
<view class="">
<view class="">状态{{deviceInfo.Online==1?'在线':'离线'}}</view>
<view class="" @click="goTimingList">
<image src="../../static/images/icon_clock.png" mode=""></image>
定时列表</view>
<view class="ih-container">
<view class="ic-title">欧轩智能中控</view>
<view class="ic-info">
<view class="ii-veiw">
<view class="iv-view">
<veiw class="iv-txt">设备id{{ curStoreInfo.device_name || "-" }}</veiw>
<view class="iv-btn" @click="copyDeviceID">复制</view>
</view>
<view class="iv-view">
<veiw class="iv-txt">状态{{ deviceInfo.Online == 1 ? '在线' : '离线' }}</veiw>
</view>
</view>
<view class="ii-veiw">
<view class="iv-view">
<veiw class="iv-txt">最后上线时间{{ deviceInfo.LastOfflineTimeStr || "-" }}</veiw>
</view>
<view class="iv-view" @click="goTimingList">
<image class="iv-img" src="../../static/images/icon_clock.png" mode="aspectFit"></image>
<veiw class="iv-txt" >定时列表</veiw>
</view>
</view>
</view>
<view class="ic-btn" hover-class="hover-active" @click="restartBtn">重启</view>
</view>
</view>
@ -70,24 +86,21 @@ export default {
storeList: state => state.device.storeList,
curStoreInfo: state => state.device.curStoreInfo,
}),
getTop(){
return (lineHeight)=>{
// #ifdef MP-WEIXIN
let wxBtn = wx.getMenuButtonBoundingClientRect()
// #endif
let txt_line_height = lineHeight //brand_name lineHeight
let top = (wxBtn?wxBtn.top:30 ) + (wxBtn.height-txt_line_height )/2
return top
}
},
//
showHardwareIdLs(){
let { hardwareTypeList } = this;
let _ls = hardwareTypeList || [];
let _fls = _ls.filter(ele=>ele.stadium_has);
let _fls = _ls.filter(ele => ele.stadium_has);
let _idLs = _fls.map(el => el.mini_local_menu_id);
return _idLs || [];
},
titleStyle(){
let { statusBarHeight, titleBarHeight } = this.headerInfo;
let _styleStr = `
line-height:${titleBarHeight}px;
`
return _styleStr
},
},
watch: {
curStoreInfo(nw, od){
@ -100,13 +113,17 @@ export default {
tabArr: [],
deviceInfo:"",
hardwareTypeList: [],
headerInfo: {
statusBarHeight: 0,
titleBarHeight: 0
},
}
},
async onLoad(){
async onLoad(options){
try{
util.showLoad();
let _brandInfo = await this.$store.dispatch('getBrandInfo');
await this.$store.dispatch('getStoreList');
await this.$store.dispatch('getStoreList', { stadium_id: +options.stadium_id || '' });
this.updateAC();
await this.getHardwareTypeList();
util.hideLoad();
@ -118,10 +135,25 @@ export default {
onShow() {
this.updateAC() //
},
onReady() {
this.initSysBarInfo();
},
methods: {
restartBtn(){
util.showNone('调试开发中!');
},
initSysBarInfo(){
let wxBtn = uni.getMenuButtonBoundingClientRect();
let sysInfo = uni.getSystemInfoSync();
let statusBarHeight = sysInfo.statusBarHeight || 0;
let titleBarHeight = (wxBtn?.height || 0) + (((wxBtn?.top || 0) - statusBarHeight) *2);
this.headerInfo = {
statusBarHeight,
titleBarHeight,
}
},
isShowHardwareTab(e){
let { showHardwareIdLs } = this;
if(!showHardwareIdLs || !showHardwareIdLs.length)return false;
return showHardwareIdLs.includes(e.id);
},
getHardwareTypeList(){
@ -178,26 +210,9 @@ export default {
return `/subpackage/device/static/images/devices/${id || 14}.png`
},
routeTo(e){
let { curStoreInfo } = this;
if(e.path == '')return util.showNone('开发中!');
if(
e.id == 1 || //
e.id == 2 || //
e.id == 3 || //
e.id == 4 || //
e.id == 5 ||  //
e.id == 6 ||  //
e.id == 8 ||  //
e.id == 9 ||  //
e.id == 10 ||  //
e.id == 11 ||  //
e.id == 13 ||  //
e.id == 14 ||  //
e.id == 17 ||  //
e.id == 18 ||  //
e.id == 19 ||  //
e.id == 7   //
)return util.routeTo(`${rootPage}${e.path}?sid=${e.id}`, 'nT');
util.showNone(`开发中!`);
util.routeTo(`${rootPage}${e.path}?sid=${e?.id || ''}&stadium_id=${curStoreInfo?.id || ''}`, 'nT');
}
}
}
@ -205,75 +220,96 @@ export default {
<style lang="scss">
@import '~style/public.scss';
.ic-top-box{
position: fixed;
top: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
background-color: lightgray;
background-image:url(../../static/images/index_bg.png);
background-size: 100% 100%;
.ic-header{
width: 100%;
height: 560rpx;
.custom-back{
width: 18px;
height: 18px;
padding:0 20rpx;
position: fixed;
left: 10rpx;
}
.brand-name{
line-height: 30px;
font-size: 32rpx;
text-align: center;
color: white;
}
store-name{
align-self: flex-start;
}
.device-info{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.id-copy{
margin-left: 20rpx;
font-size: 28rpx;
}
> text:first-child{
font-weight: 900;
margin-top: 20rpx;
}
> text:nth-child(2){
margin-top: 30rpx;
color: #FFFFFF;font-size: 24rpx;
height: 620upx;
background-image: linear-gradient(160deg, #89D499 0%, #33CCA9 81%);
.ih-bar{
.ib-title-bar{
position: relative;
padding: 0 12px;
text-align: center;
font-size: 19px;
font-weight: 500;
color: #fff;
.itb-back-icon{
position: absolute;
left: 12px;
top: 50%;
margin-top: -10px;
width: 20px;
height: 20px;
}
}
> text:nth-child(3){
margin-top: 20rpx;
font-size: 24rpx;
}
.ih-container{
padding: 4upx 50upx 38upx;
.ic-title{
text-align: center;
line-height: 56upx;
font-size: 40upx;
font-weight: 500;
color: #1A1A1A;
}
.ic-info{
margin-top: 42upx;
.ii-veiw{
@include centerFlex(space-between);
&:not(:first-child){
margin-top: 14upx;
> view:last-child{
margin-top: 55rpx;
width: 100%;font-size: 28rpx;
@include centerFlex(space-between);
> view{
@include centerFlex(center);
image{
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
}
.iv-view{
min-width: 30%;
@include centerFlex(flex-start);
.iv-img{
flex-shrink: 0;
flex-grow: 0;
margin-right: 8upx;
height: 24upx;
width: 24upx;
}
.iv-txt{
font-size: 24upx;
line-height: 34upx;
color: #1A1A1A;
@include textHide(1);
}
.iv-btn{
flex-shrink: 0;
margin-left: 14upx;
line-height: 28upx;
font-size: 20upx;
padding: 2upx 6upx;
border-radius: 4upx;
background-color: rgba($color: #ADFF2C, $alpha: .5);
color: $themeColor;
}
&+.iv-view{
@include centerFlex(flex-end);
}
}
}
}
.ic-btn{
margin: 44upx auto 0;
width: 200upx;
height: 68upx;
line-height: 68upx;
text-align: center;
background-image: linear-gradient(180deg, #ffffff6b 0%, #ffffffc9 100%);
box-shadow: 0 6upx 16upx 0 #18b48fb0, inset 0 2upx 12upx 0 #ffffff80;
border-radius: 6upx;
font-size: 28upx;
font-weight: 500;
color: $themeColor;
text-shadow: 0 0.3upx 1upx #005F49;
}
}
}
.ic-section{
padding: 60upx 30upx 0;
margin-top: 560rpx;//.ic-top-box
padding: 54upx 30upx 0;
.is-list{
display: flex;
flex-wrap: wrap;

103
src/subpackage/device/pages/switch_manage/switch_manage.vue

@ -2,9 +2,9 @@
<view class="switch-manage">
<store-name></store-name>
<view class="sm-tit">{{pageInfo.name || '-'}}</view>
<view class="sm-tip" v-if="pageInfo.longOpenName">*长开表示不再被系统智能控制只有手动关闭后才会被智能控制请谨慎操作</view>
<view class="sm-tip" v-if="pageInfo.longOpenName"><text>*</text>长开表示不再被系统智能控制只有手动关闭后才会被智能控制请谨慎操作</view>
<view class="sm-list">
<view class="sl-item" v-for="(e, i) in deviceList" :key="i" :style="{width:getViewWidth()}">
<view v-for="(e, i) in deviceList" :key="i" :class="[ 'sl-item', pageInfo.iconNum<=2?'sl-limit':'' ]">
<view class="si-top" >
<image mode="aspectFit" :src="getIcon()" ></image>
@ -25,23 +25,31 @@
</view>
<!-- 不同设备的可操作按钮区分,目前无明显规律,so 按需求单独 if 判断 -->
<view class="si-bottom" v-if="pageInfo.isOpen || pageInfo.isClose || pageInfo.isDetail||pageInfo.isTiming">
<view v-if="pageInfo.isOpen" @click="operateBtn({ switchInfo: e, status: 1 })" :style="{width:getIconWidth()}">
<view class="si-bottom" v-if="pageInfo.isOpen || pageInfo.isClose || pageInfo.isDetail||pageInfo.isTiming || pageInfo.isElectrify || pageInfo.isOutage">
<view v-if="pageInfo.isOpen" @click="operateBtn({ switchInfo: e, status: 1 })">
<image mode="aspectFit" :src="pageInfo.openIcon || ''"></image>
<view>{{pageInfo.openName || '-'}}</view>
</view>
<view v-if="pageInfo.isClose" @click="operateBtn({ switchInfo: e, status: 0 })" :style="{width:getIconWidth()}">
<view v-if="pageInfo.isClose" @click="operateBtn({ switchInfo: e, status: 0 })">
<image mode="aspectFit" :src="pageInfo.closeIcon || ''"></image>
<view>{{pageInfo.closeName || '-'}}</view>
</view>
<view v-if="pageInfo.isLongOpen" @click="operateBtn({ switchInfo: e, status: 2 })" :style="{width:getIconWidth()}">
<view v-if="pageInfo.isLongOpen" @click="operateBtn({ switchInfo: e, status: 2 })">
<image mode="aspectFit" :src="pageInfo.longOpenIcon || ''"></image>
<view>{{pageInfo.longOpenName || '-'}}</view>
</view>
<view v-if="pageInfo.isTiming" @click="operateBtn({ switchInfo: e, status: 3 })" :style="{width:getIconWidth()}">
<view v-if="pageInfo.isTiming" @click="operateBtn({ switchInfo: e, status: 3 })">
<image mode="aspectFit" :src="pageInfo.timingIcon || ''"></image>
<view>{{pageInfo.timingName || '-'}}</view>
</view>
<view v-if="pageInfo.isElectrify" @click="operateBtn({ switchInfo: e, status: 5 })">
<image mode="aspectFit" :src="pageInfo.electrifyIcon || ''"></image>
<view>{{pageInfo.electrifyName || '-'}}</view>
</view>
<view v-if="pageInfo.isOutage" @click="operateBtn({ switchInfo: e, status: 6 })">
<image mode="aspectFit" :src="pageInfo.outageIcon || ''"></image>
<view>{{pageInfo.outageName || '-'}}</view>
</view>
<view v-if="pageInfo.isDetail" @click="operateBtn({ switchInfo: e, status: 4 })" class="btn-detail">
<view >{{pageInfo.detailName || '-'}}</view>
</view>
@ -76,9 +84,7 @@ export default {
curStoreInfo: state => state.device.curStoreInfo,
}),
getIconWidth(){//icon
return ()=>{
return 100/this.pageInfo.iconNum+'%'
}
return ''
},
getLotStatus(){//sim, 0 :
return (e)=>{
@ -107,29 +113,42 @@ export default {
deviceList: [],
}
},
/**
*
* @param {Object} options
* @param {Object} options.sid // id
* @param {Object} options.stadium_id // id
*/
onLoad(options){
let _pageInfo = getShowArr(`s${options.sid}`) || {};
this.pageInfo = _pageInfo;
uni.setNavigationBarTitle({ title: _pageInfo.name });
this.getDeviceList({
stadium_id: this.curStoreInfo.id,
hardware_type: this.pageInfo.hardware_type
stadium_id: options.stadium_id || this.curStoreInfo.id,
hardware_type: _pageInfo.hardware_type
})
setTimeout(_=>{
this.$nextTick(_=>{
uni.createSelectorQuery().selectAll(".si-bottom > view")
.boundingClientRect(data => {
console.warn('createSelectorQuery', data)
}).exec();
})
}, 1000)
},
methods: {
isDetailBtn(e){
if(e&&e.toString() === "[object Object]"){
return e.hardware_model == 'XiaoHuiXiong'
return e.hardware_model == 'XiaoHuiXiong' && e.hardware_type === 'Air';
}
return false;
},
toDeviceDetail(e){
console.warn(e);
console.warn(this.getSwitchStatusQuery(e));
let _queryObj = this.getSwitchStatusQuery(e) || {};
if(!_queryObj.data || !_queryObj.data.name || !_queryObj.data.value)return;
_queryObj.data.value&&_queryObj.data.value.op&&(_queryObj.data.value.op = 'info');
if(!_queryObj?.data?.name || !_queryObj?.data?.value)return;
_queryObj?.data?.value?.op&&(_queryObj.data.value.op = 'info');
let _qrStr = util.jsonStr(_queryObj);
if(e.hardware_type == "Air")return util.routeTo(`/subpackage/device/pages/air_conditioner/detail/detail?qrstr=${_qrStr}&name=${e.hardware_name || '-'}`, 'nT');
},
@ -490,26 +509,33 @@ function getShowArr(key){
id: 4, name: '门禁管理', isOpen: true, isClose: false,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关', hardware_type: 'AccessControl',iconNum:2
openName: '开', closeName: '关', hardware_type: 'AccessControl',iconNum: 1
},
's5': {
id: 5, name: '门闸管理', isOpen: true, isClose: true,
id: 5, name: '门闸管理', isOpen: true, isClose: true, isElectrify: true, isOutage: true,
hardware_type: 'GateControl',iconNum: 4,
openIcon: '/subpackage/device/static/images/in.png',
openName: '进',
closeIcon: '/subpackage/device/static/images/out.png',
openName: '进', closeName: '出', hardware_type: 'GateControl',iconNum:2
closeName: '出',
electrifyIcon: '/subpackage/device/static/images/electrify.png',
electrifyName: '通电',
outageIcon: '/subpackage/device/static/images/outage.png',
outageName: '断电',
},
's6': {//TODO
id: 6, name: '平板管理', isOpen: false, isClose: false,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关', hardware_type: 'Router4G',iconNum:2
openName: '开', closeName: '关', hardware_type: 'Router4G',iconNum:1
},
's11': {
id: 11, name: '水阀管理', isOpen: true, isClose: true,isLongOpen:true, isTiming:true,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
longOpenIcon: '/subpackage/device/static/images/longOpen.png',timingIcon: '/subpackage/device/static/images/timing.png',
openName: '开', closeName: '关', hardware_type: 'WaterValve',longOpenName: '长开', timingName: '定时',iconNum:4,
longOpenIcon: '/subpackage/device/static/images/longOpen.png',
timingIcon: '/subpackage/device/static/images/timing.png',
openName: '开', closeName: '关', hardware_type: 'WaterValve',longOpenName: '长开', timingName: '定时',iconNum:4,
},
's12': {
id: 12, name: '互动设备管理', isOpen: true, isClose: true,
@ -521,25 +547,25 @@ function getShowArr(key){
id: 13, name: '监控管理', isOpen: false, isClose: false, isDetail:true,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关',detailName:"详情", hardware_type: 'IotSim',iconNum:2
openName: '开', closeName: '关',detailName:"详情", hardware_type: 'IotSim',iconNum:1
},
's17': {//TODO
id: 17, name: '窗帘管理', isOpen: false, isClose: false, isDetail:true,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关',detailName:"详情", hardware_type: 'Router4G',iconNum:2
openName: '开', closeName: '关',detailName:"详情", hardware_type: 'Router4G',iconNum:1
},
's18': {
id: 18, name: '路由器管理', isOpen: false, isClose: false, isDetail:true,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关',detailName:"详情", hardware_type: 'Router4G',iconNum:2
openName: '开', closeName: '关',detailName:"详情", hardware_type: 'Router4G',iconNum:1
},
's19': {
id: 19, name: '物联卡管理', isOpen: false, isClose: false, isDetail:true,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关',detailName:"详情", hardware_type: 'IotSim',iconNum:2
openName: '开', closeName: '关',detailName:"详情", hardware_type: 'IotSim',iconNum:1
},
@ -550,6 +576,11 @@ function getShowArr(key){
<style lang="scss">
@import '~style/public.scss';
page{
background:url(../../static/images/page_bg.jpg) repeat-y;
background-size: 100%;
background-attachment: fixed;
}
.sm-tit{
padding-left: 40upx;
padding-top: 52upx;
@ -558,12 +589,16 @@ function getShowArr(key){
font-size: 44upx;
font-weight: 500;
color: #333;
@include textHide(1);
}
.sm-tip{
padding: 0 40upx;
font-size: 28upx;
color: #979797;
color: #fff;
margin-bottom: 24upx;
>text{
color: #EA5061;
}
}
.sm-list{
padding: 0 32upx;
@ -571,10 +606,15 @@ function getShowArr(key){
justify-content: space-between;
flex-wrap: wrap ;
.sl-item{
flex-grow: 1;
margin-bottom: 30upx;
width: 328upx;
border-radius: 10upx;
background-color: #fff;
box-shadow: 0 4upx 12upx 0 #00987454, inset 0 0 40upx 0 #ffffff80;
background-image: linear-gradient(180deg, #eff6f44d 0%, #FFFFFF 100%);
&.sl-limit{
flex-grow: 0;
width: 328upx !important;
}
.si-top{
padding: 20upx 20upx 30upx;
display: flex;
@ -647,11 +687,10 @@ function getShowArr(key){
display: flex;
justify-content: center;
border-top: 2upx solid #F2F2F7;
>view{
flex-shrink: 0;
flex-grow: 0;
width: 50%;
padding: 0 30upx;
>image{
display: block;
margin: 0 auto 20upx;

BIN
src/subpackage/device/static/images/air_conditioner/nw_close.png

After

Width: 100  |  Height: 100  |  Size: 2.5 KiB

BIN
src/subpackage/device/static/images/air_conditioner/nw_open.png

After

Width: 100  |  Height: 100  |  Size: 2.3 KiB

BIN
src/subpackage/device/static/images/arrow_1a.png

After

Width: 28  |  Height: 28  |  Size: 225 B

BIN
src/subpackage/device/static/images/close.png

Before

Width: 100  |  Height: 100  |  Size: 816 B

After

Width: 100  |  Height: 100  |  Size: 2.5 KiB

BIN
src/subpackage/device/static/images/electrify.png

After

Width: 100  |  Height: 100  |  Size: 2.6 KiB

BIN
src/subpackage/device/static/images/i_txt.png

Before

Width: 200  |  Height: 200  |  Size: 11 KiB

After

Width: 100  |  Height: 100  |  Size: 2.5 KiB

BIN
src/subpackage/device/static/images/i_voice_1.png

Before

Width: 200  |  Height: 200  |  Size: 2.4 KiB

After

Width: 100  |  Height: 100  |  Size: 2.5 KiB

BIN
src/subpackage/device/static/images/in.png

Before

Width: 100  |  Height: 100  |  Size: 950 B

After

Width: 100  |  Height: 100  |  Size: 2.2 KiB

BIN
src/subpackage/device/static/images/longOpen.png

Before

Width: 100  |  Height: 100  |  Size: 6.3 KiB

After

Width: 100  |  Height: 100  |  Size: 2.8 KiB

BIN
src/subpackage/device/static/images/open.png

Before

Width: 100  |  Height: 100  |  Size: 924 B

After

Width: 100  |  Height: 100  |  Size: 2.3 KiB

BIN
src/subpackage/device/static/images/out.png

Before

Width: 100  |  Height: 100  |  Size: 1.0 KiB

After

Width: 100  |  Height: 100  |  Size: 2.4 KiB

BIN
src/subpackage/device/static/images/outage.png

After

Width: 100  |  Height: 100  |  Size: 2.5 KiB

BIN
src/subpackage/device/static/images/page_bg.jpg

After

Width: 750  |  Height: 1448  |  Size: 10 KiB

BIN
src/subpackage/device/static/images/timing.png

Before

Width: 100  |  Height: 100  |  Size: 1.3 KiB

After

Width: 100  |  Height: 100  |  Size: 2.7 KiB

Loading…
Cancel
Save