SmartBeehive/page_user/user_set.vue

407 lines
10 KiB
Vue
Raw Normal View History

2024-06-21 18:04:01 +08:00
<template>
<view class="page">
<u-navbar :title="title" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
:title-bold='true' height='45' id="navbar">
</u-navbar>
<view class="tit">
<image src="https://api.ccttiot.com/smartmeter/img/static/ufvwKG3vcJYtbkf0Oeij" mode=""></image>
除螨设置
</view>
<view class="tit1">
2024-07-12 18:14:24 +08:00
<image style="width: 42rpx;height: 42rpx;" src="https://api.ccttiot.com/smartmeter/img/static/utZh1saVjZgOBz3orDkL" mode=""></image>
2024-06-21 18:04:01 +08:00
间隔时长
</view>
<view class="set_li">
2024-07-03 18:03:01 +08:00
每隔<view class="ipt_box"><input type="text" class="ips" v-model="miteInterval" placeholder=" "
2024-07-12 18:14:24 +08:00
placeholder-class="my-placeholder" /> </view>/ &nbsp;&nbsp; 除螨工作
2024-07-01 10:06:13 +08:00
</view>
2024-07-10 17:52:46 +08:00
<view class="tit" style="margin-top: 58rpx;">
2024-07-12 18:14:24 +08:00
<image style="width: 52rpx;height: 52rpx;"
src="https://api.ccttiot.com/smartmeter/img/static/ulPpf3J16ARy14XH4R7r" mode=""></image>
2024-07-01 10:06:13 +08:00
保护设置
</view>
<view class="tit1">
2024-07-12 18:14:24 +08:00
<image style="width: 40rpx;height: 41rpx;"
src="https://api.ccttiot.com/smartmeter/img/static/ul8NIQoFMG44Nj0W1geF" mode=""></image>
2024-07-01 10:06:13 +08:00
电量保护%
</view>
<view class="set_li">
2024-07-03 18:03:01 +08:00
电量少于<view class="ipt_box"><input type="text" class="ips" v-model="minPower" placeholder=" "
placeholder-class="my-placeholder" /> </view>加热板/风扇停止工作
2024-07-01 10:06:13 +08:00
</view>
<view class="tit1">
2024-07-10 17:52:46 +08:00
<image src="https://api.ccttiot.com/smartmeter/img/static/unI3QR7NPZsPSn5ryMMH" mode=""></image>
2024-07-01 10:06:13 +08:00
加热
</view>
<view class="set_li">
2024-07-03 18:03:01 +08:00
箱外温度低于<view class="ipt_box"><input type="text" class="ips" v-model="minHeat" placeholder=" "
placeholder-class="my-placeholder" /> </view>加热板工作
2024-07-01 10:06:13 +08:00
</view>
<view class="set_li">
2024-07-03 18:03:01 +08:00
箱内高于箱外<view class="ipt_box"><input type="text" class="ips" v-model="maxHeat" placeholder=" "
placeholder-class="my-placeholder" /> </view>加热板停止工作
2024-07-01 10:06:13 +08:00
</view>
<view class="tit1">
2024-07-10 17:52:46 +08:00
<image src="https://api.ccttiot.com/smartmeter/img/static/urouHoLnzjyyRn0MmNoL" mode=""></image>
风扇 ppm
2024-07-01 10:06:13 +08:00
</view>
<view class="set_li">
2024-07-03 18:03:01 +08:00
箱内温度高于<view class="ipt_box"><input type="text" class="ips" v-model="maxFan" placeholder=" "
placeholder-class="my-placeholder" /> </view>风扇工作
2024-07-01 10:06:13 +08:00
</view>
2024-07-10 17:52:46 +08:00
<view class="set_li">
箱内温度低于<view class="ipt_box"><input type="text" class="ips" v-model="minFan" placeholder=" "
placeholder-class="my-placeholder" /> </view>风扇停止工作
</view>
2024-07-03 18:03:01 +08:00
<!-- <view class="set_li">
箱内温度降到<view class="ipt_box"><input type="text" class="ips" v-model="code" placeholder=" "
placeholder-class="my-placeholder" /> </view>风扇停止工作
</view> -->
2024-07-01 10:06:13 +08:00
<view class="set_li">
2024-07-03 18:03:01 +08:00
CO₂浓度高于<view class="ipt_box"><input type="text" class="ips" v-model="maxCo2" placeholder=" "
placeholder-class="my-placeholder" /> </view>风扇工作
2024-07-01 10:06:13 +08:00
</view>
<view class="set_li">
2024-07-03 18:03:01 +08:00
CO₂浓度低于<view class="ipt_box"><input type="text" class="ips" v-model="minCo2" placeholder=" "
placeholder-class="my-placeholder" /> </view>风扇停止工作
2024-07-01 10:06:13 +08:00
</view>
2024-07-10 17:52:46 +08:00
<view class="tit" style="margin-top: 58rpx;">
<image src="https://api.ccttiot.com/smartmeter/img/static/udbzkOF4S1rNec8U44KT" mode=""></image>
2024-07-01 10:06:13 +08:00
震动通知
</view>
<view class="tit1">
2024-07-10 17:52:46 +08:00
<image src="https://api.ccttiot.com/smartmeter/img/static/u3I0roygrn4BHJaWAT24" mode=""></image>
2024-07-01 10:06:13 +08:00
单次震动
</view>
2024-07-10 17:52:46 +08:00
<view class="" style="padding-left: 50rpx;padding-top: 40rpx;box-sizing: border-box;">
2024-07-03 18:03:01 +08:00
<u-checkbox-group>
<u-checkbox active-color="#FFCC25" @change="checkboxChange(item.type)" v-model="item.checked"
v-for="(item, index) in list" :key="index" :name="item.name">{{item.name}}</u-checkbox>
</u-checkbox-group>
</view>
2024-07-01 10:06:13 +08:00
<view class="tit1">
2024-07-10 17:52:46 +08:00
<image src="https://api.ccttiot.com/smartmeter/img/static/uG0iEjqzc5if82ocNeWo" mode=""></image>
2024-07-01 10:06:13 +08:00
持续震动
2024-07-03 18:03:01 +08:00
</view>
2024-07-10 17:52:46 +08:00
<view class="" style="padding-left: 50rpx;padding-top: 40rpx;box-sizing: border-box;">
2024-07-03 18:03:01 +08:00
<u-checkbox-group>
<u-checkbox active-color="#FFCC25" @change="checkboxChanges(item.type)" v-model="item.checked"
v-for="(item, index) in lists" :key="index" :name="item.name">{{item.name}}</u-checkbox>
</u-checkbox-group>
2024-06-21 18:04:01 +08:00
</view>
2024-07-01 10:06:13 +08:00
<view class="btn_box">
2024-07-05 14:07:28 +08:00
<view class="btns" @click="btncz">
2024-07-01 10:06:13 +08:00
重置
</view>
2024-07-03 18:03:01 +08:00
<view class="btn1" @click="btnbc">
2024-07-01 10:06:13 +08:00
保存
</view>
</view>
2024-06-21 18:04:01 +08:00
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: " #F4FAF8",
},
title: "设置",
2024-07-03 18:03:01 +08:00
code: '',
list: [{
name: '短信',
disabled: false,
checked: false,
type: 1
},
{
name: '电话',
disabled: false,
checked: false,
type: 2
},
{
name: '微信',
disabled: false,
checked: false,
type: 3
}
],
lists: [{
name: '短信',
disabled: false,
checked: false,
type: 1
},
{
name: '电话',
disabled: false,
checked: false,
type: 2
},
{
name: '微信',
disabled: false,
checked: false,
type: 3
}
],
value: [],
values: [],
miteInterval: '', //除螨间隔时间(天)
minPower: '', //电量保护最低电量%
minHeat: '', //加热板开始工作的最低箱外温度℃
maxHeat: '', //加热板停止工作的箱内外温差℃
maxFan: '', //风扇开始工作的最高箱内温度℃
2024-07-10 17:52:46 +08:00
minFan: '', //风扇停止工作的最低箱内温度℃
2024-07-03 18:03:01 +08:00
minCo2: '', //风扇停止工作的最低二氧化碳浓度℃
maxCo2: '', //风扇开始工作的最高二氧化碳浓度℃
2024-06-21 18:04:01 +08:00
}
},
onLoad() {
2024-07-03 18:03:01 +08:00
this.getinfo()
2024-06-21 18:04:01 +08:00
},
onShow() {
},
methods: {
2024-07-12 18:14:24 +08:00
btncz() {
this.$u.get(`/farm/userSetting/default`).then(res => {
if (res.code == 200) {
this.miteInterval = res.data.miteInterval
this.minPower = res.data.minPower
this.minHeat = res.data.minHeat
this.maxHeat = res.data.maxHeat
this.maxFan = res.data.maxFan
this.minFan = res.data.minFan
this.minCo2 = res.data.minCo2
this.maxCo2 = res.data.maxCo2
this.value = []
this.values = []
this.list.forEach(item => {
if (item.checked) {
item.checked = false;
}
})
this.lists.forEach(item => {
if (item.checked) {
item.checked = false;
}
})
}
2024-07-05 14:07:28 +08:00
})
2024-07-12 18:14:24 +08:00
2024-07-05 14:07:28 +08:00
},
2024-07-03 18:03:01 +08:00
checkboxChange(e) {
let index = this.value.indexOf(e)
if (index > -1) {
this.value.splice(index, 1)
} else {
this.value.push(e)
}
console.log(this.value)
},
checkboxChanges(e) {
let index = this.values.indexOf(e)
if (index > -1) {
this.values.splice(index, 1)
} else {
this.values.push(e)
}
},
// 获取设置
getinfo() {
this.$u.get(`farm/userSetting/my`).then(res => {
if (res.code == 200) {
this.miteInterval = res.data.miteInterval,
this.minPower = res.data.minPower,
this.minHeat = res.data.minHeat,
this.maxHeat = res.data.maxHeat,
this.maxFan = res.data.maxFan,
2024-07-10 17:52:46 +08:00
this.minFan = res.data.minFan,
2024-07-03 18:03:01 +08:00
this.minCo2 = res.data.minCo2,
this.maxCo2 = res.data.maxCo2
this.list.forEach(item => {
if (res.data.singleNotice.includes(item.type.toString())) {
item.checked = true;
}
})
this.value = res.data.singleNotice
this.lists.forEach(item => {
if (res.data.multipleNotice.includes(item.type.toString())) {
item.checked = true;
}
})
this.values = res.data.multipleNotice
}
})
},
btnbc() {
let data = {
miteInterval: this.miteInterval,
minPower: this.minPower,
minHeat: this.minHeat,
maxHeat: this.maxHeat,
maxFan: this.maxFan,
2024-07-12 18:14:24 +08:00
minFan: this.minFan,
2024-07-03 18:03:01 +08:00
minCo2: this.minCo2,
maxCo2: this.maxCo2,
singleNotice: this.value,
multipleNotice: this.values
}
this.$u.put(`farm/userSetting/user`, data).then(res => {
if (res.code == 200) {
uni.showToast({
title: '保存成功',
icon: 'success',
duration: 1000
})
2024-07-12 18:14:24 +08:00
} else if (res.code == 401) {
2024-07-03 18:03:01 +08:00
uni.navigateTo({
2024-07-12 18:14:24 +08:00
url: '/pages/login/login'
2024-07-03 18:03:01 +08:00
})
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
})
}
2024-06-21 18:04:01 +08:00
}
}
</script>
<style lang="scss">
2024-07-12 18:14:24 +08:00
/deep/ .u-checkbox {
2024-07-10 17:52:46 +08:00
margin-right: 80rpx;
}
2024-07-12 18:14:24 +08:00
2024-06-21 18:04:01 +08:00
page {
background-color: #F4FAF8;
}
.page {
// position: relative;
width: 750rpx;
padding: 40rpx;
2024-07-03 18:03:01 +08:00
.btn_box {
2024-07-01 10:06:13 +08:00
margin-top: 136rpx;
2024-06-21 18:04:01 +08:00
display: flex;
flex-wrap: nowrap;
align-items: center;
2024-07-03 18:03:01 +08:00
.btns {
2024-07-01 10:06:13 +08:00
display: flex;
align-items: center;
justify-content: center;
width: 322rpx;
height: 88rpx;
background: #FFF5D6;
border-radius: 20rpx 20rpx 20rpx 20rpx;
border: 2rpx solid #FFC107;
2024-07-03 18:03:01 +08:00
2024-07-01 10:06:13 +08:00
font-weight: 500;
font-size: 32rpx;
color: #FFC107;
}
2024-07-03 18:03:01 +08:00
.btn1 {
2024-07-01 10:06:13 +08:00
display: flex;
align-items: center;
justify-content: center;
margin-left: 30rpx;
width: 322rpx;
height: 88rpx;
background: #FFCC25;
border-radius: 20rpx 20rpx 20rpx 20rpx;
2024-07-03 18:03:01 +08:00
2024-07-01 10:06:13 +08:00
font-weight: 500;
font-size: 32rpx;
color: #3D3D3D;
}
}
2024-07-03 18:03:01 +08:00
2024-07-01 10:06:13 +08:00
.tit {
display: flex;
flex-wrap: nowrap;
align-items: center;
image {
2024-06-21 18:04:01 +08:00
margin-right: 22rpx;
width: 52rpx;
height: 52rpx;
2024-07-01 10:06:13 +08:00
2024-06-21 18:04:01 +08:00
}
2024-07-01 10:06:13 +08:00
2024-06-21 18:04:01 +08:00
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
}
2024-07-01 10:06:13 +08:00
.tit1 {
2024-07-10 17:52:46 +08:00
margin-top: 30rpx;
2024-07-12 18:14:24 +08:00
margin-left: 6rpx;
2024-06-21 18:04:01 +08:00
display: flex;
flex-wrap: nowrap;
align-items: center;
2024-07-01 10:06:13 +08:00
image {
2024-06-21 18:04:01 +08:00
margin-right: 18rpx;
width: 46rpx;
height: 46rpx;
2024-07-01 10:06:13 +08:00
2024-06-21 18:04:01 +08:00
}
2024-07-01 10:06:13 +08:00
2024-06-21 18:04:01 +08:00
font-weight: 400;
font-size: 32rpx;
color: #3D3D3D;
}
2024-07-01 10:06:13 +08:00
.set_li {
margin-top: 34rpx;
2024-07-10 17:52:46 +08:00
margin-left: 65rpx;
2024-07-01 10:06:13 +08:00
display: flex;
flex-wrap: nowrap;
align-items: center;
font-weight: 400;
font-size: 32rpx;
color: #808080;
2024-07-12 18:14:24 +08:00
2024-07-01 10:06:13 +08:00
.ipt_box {
display: flex;
align-items: center;
justify-content: center;
margin: 0 16rpx;
// width: 98rpx;
height: 88rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
border-radius: 20rpx 20rpx 20rpx 20rpx;
2024-07-03 18:03:01 +08:00
2024-07-01 10:06:13 +08:00
.ips {
2024-07-10 17:52:46 +08:00
// margin-left: 15rpx;
text-align: center;
2024-07-01 10:06:13 +08:00
width: 100rpx;
2024-07-03 18:03:01 +08:00
2024-07-01 10:06:13 +08:00
}
2024-07-03 18:03:01 +08:00
2024-07-01 10:06:13 +08:00
.my-placeholder {
font-weight: 400;
font-size: 32rpx;
color: #808080;
}
}
2024-07-03 18:03:01 +08:00
2024-07-01 10:06:13 +08:00
}
2024-06-21 18:04:01 +08:00
}
</style>