|
|
|
@ -23,8 +23,12 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div class="weui-tab__panel">
|
|
|
|
|
<div class="weui-tab__content">
|
|
|
|
|
{{getCode.pattern}}
|
|
|
|
|
<input type="button" value="1" />
|
|
|
|
|
{{code}}
|
|
|
|
|
<button type="button" :value="power.value" v-on:click="changePower($event)">开关</button>{{power.name}}
|
|
|
|
|
<button type="button" :value="pattern.value" v-on:click="changePattern($event)">模式</button>{{pattern.name}}
|
|
|
|
|
<button type="button" :value="direction.value" v-on:click="changeDirection($event)">风向</button>{{direction.name}}
|
|
|
|
|
<button type="button" :value="wind.value" v-on:click="changeWind($event)">风速</button>{{wind.name}}
|
|
|
|
|
<button type="button" :value="temperature.value" v-on:click="changeTemperature($event)">温度</button>{{temperature.name}}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="weui-tab__content">
|
|
|
|
|
2
|
|
|
|
@ -46,67 +50,95 @@
|
|
|
|
|
mounted: function () {
|
|
|
|
|
weui.tab('.weui-tab');
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
changePattern: function (e) {
|
|
|
|
|
this.change(e, 0, 480, 120);
|
|
|
|
|
},
|
|
|
|
|
changeDirection(e) {
|
|
|
|
|
this.change(e, 0, 60, 60);
|
|
|
|
|
},
|
|
|
|
|
changeWind(e) {
|
|
|
|
|
this.change(e, 0, 45, 15);
|
|
|
|
|
},
|
|
|
|
|
changePower: function (e) {
|
|
|
|
|
var oldValue = parseInt(e.target.value);
|
|
|
|
|
if (oldValue === 1) {
|
|
|
|
|
this.change(e, 1, 15, 1);
|
|
|
|
|
}
|
|
|
|
|
else if (oldValue === 2) {
|
|
|
|
|
getData(this.device, '按键').value = 1;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
changeTemperature:function (e) {
|
|
|
|
|
this.change(e, 1, 15, 1);
|
|
|
|
|
},
|
|
|
|
|
change: function (e, min, max, step) {
|
|
|
|
|
var oldValue = parseInt(e.target.value);
|
|
|
|
|
var newValue = oldValue + step;
|
|
|
|
|
if (newValue > max) {
|
|
|
|
|
newValue = min;
|
|
|
|
|
}
|
|
|
|
|
getData(this.device, '按键').value = this.code - oldValue + newValue;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
getCode: function () {
|
|
|
|
|
var code = getDeviceDataValue(this.device, '按键');
|
|
|
|
|
var pattern = 0;
|
|
|
|
|
var direction = 0;
|
|
|
|
|
var wind = 0;
|
|
|
|
|
var power = 2;
|
|
|
|
|
var temperature = 1;
|
|
|
|
|
code: function () {
|
|
|
|
|
return getDeviceDataValue(this.device, '按键');
|
|
|
|
|
},
|
|
|
|
|
pattern: function () {
|
|
|
|
|
var code = this.code;
|
|
|
|
|
var pattern = { name: '制冷', value: 0 };
|
|
|
|
|
if (code > 480 + 2) {
|
|
|
|
|
pattern = 480;
|
|
|
|
|
pattern = { name: '通风', value: 480 };
|
|
|
|
|
}
|
|
|
|
|
else if (code > 360 + 2) {
|
|
|
|
|
pattern = 360;
|
|
|
|
|
pattern = { name: '抽湿', value: 360 };
|
|
|
|
|
}
|
|
|
|
|
else if (code > 240 + 2) {
|
|
|
|
|
pattern = 240;
|
|
|
|
|
pattern = { name: '制热', value: 240 };
|
|
|
|
|
}
|
|
|
|
|
else if (code > 120 + 2) {
|
|
|
|
|
pattern = 120;
|
|
|
|
|
pattern = { name: '自动', value: 120 };
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pattern = 0;
|
|
|
|
|
return pattern;
|
|
|
|
|
},
|
|
|
|
|
direction: function () {
|
|
|
|
|
var code = this.code - this.pattern.value;
|
|
|
|
|
var direction = { name: '自动', value: 0 };;
|
|
|
|
|
if (code > 60 + 2) {
|
|
|
|
|
direction = { name: '手动', value: 60 };
|
|
|
|
|
}
|
|
|
|
|
code -= pattern;
|
|
|
|
|
if (code > 75 + 2) {
|
|
|
|
|
direction = 75;
|
|
|
|
|
}
|
|
|
|
|
else if (code > 60 + 2) {
|
|
|
|
|
direction = 60;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
direction = 0;
|
|
|
|
|
}
|
|
|
|
|
code -= direction;
|
|
|
|
|
return direction;
|
|
|
|
|
},
|
|
|
|
|
wind: function () {
|
|
|
|
|
var code = this.code - this.pattern.value - this.direction.value;
|
|
|
|
|
var wind = { name: '自动', value: 0 };
|
|
|
|
|
if (code > 45 + 2) {
|
|
|
|
|
wind = 45;
|
|
|
|
|
wind = { name: '低', value: 45 };
|
|
|
|
|
}
|
|
|
|
|
else if (code > 30 + 2) {
|
|
|
|
|
wind = 30;
|
|
|
|
|
wind = { name: '中', value: 30 };
|
|
|
|
|
}
|
|
|
|
|
else if (code > 15 + 2) {
|
|
|
|
|
wind = 15;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
wind = 0;
|
|
|
|
|
wind = { name: '高', value: 15 };
|
|
|
|
|
}
|
|
|
|
|
code -= wind;
|
|
|
|
|
if (code === 1) {
|
|
|
|
|
power = 1;
|
|
|
|
|
return wind;
|
|
|
|
|
},
|
|
|
|
|
power: function () {
|
|
|
|
|
var code = this.code - this.pattern.value - this.direction.value - this.wind.value;
|
|
|
|
|
var power = { name: '关', value: 1 };
|
|
|
|
|
if (code > 1) {
|
|
|
|
|
power = { name: '开', value: 2 };
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
power = 2;
|
|
|
|
|
temperature = code - power;
|
|
|
|
|
return power;
|
|
|
|
|
},
|
|
|
|
|
temperature: function () {
|
|
|
|
|
var code = this.code - this.pattern.value - this.direction.value - this.wind.value - this.power.value;
|
|
|
|
|
var temperature = { name: '16℃', value: 1 };
|
|
|
|
|
if (code > 1) {
|
|
|
|
|
temperature = { name: parseInt(code+15) + '℃', value: code };
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
pattern: pattern,
|
|
|
|
|
direction: direction,
|
|
|
|
|
wind: wind,
|
|
|
|
|
power: power,
|
|
|
|
|
temperature: temperature
|
|
|
|
|
};
|
|
|
|
|
return temperature;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|