首页修改
This commit is contained in:
@@ -1,35 +1,66 @@
|
||||
<template>
|
||||
<view :loading="loading">
|
||||
<view class="mine">
|
||||
<Cn-page :loading="loading">
|
||||
<view class="mine" slot="body">
|
||||
<view class="mine-nav" style="margin-top: 20rpx">
|
||||
<view class="mine-nav-label">稳态越限</view>
|
||||
<switch color="#376cf3" />
|
||||
<switch color="#376cf3" @change="change('dataInfo')" :checked="config.dataInfo === 1"/>
|
||||
</view>
|
||||
<view class="mine-nav" style="border-bottom: none">
|
||||
<view class="mine-nav-label">暂态事件</view>
|
||||
<switch color="#376cf3" />
|
||||
<switch color="#376cf3" @change="change('eventInfo')" :checked="config.eventInfo === 1"/>
|
||||
</view>
|
||||
<view class="mine-nav" style="border-bottom: none">
|
||||
<view class="mine-nav-label">设备状态</view>
|
||||
<switch color="#376cf3" />
|
||||
<switch color="#376cf3" @change="change('deviceInfo')" :checked="config.deviceInfo === 1"/>
|
||||
</view>
|
||||
<view class="mine-nav" style="border-bottom: none">
|
||||
<view class="mine-nav-label">设备消息</view>
|
||||
<switch color="#376cf3" />
|
||||
<switch color="#376cf3" @change="change('systemInfo')" :checked="config.systemInfo === 1"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</Cn-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {queryUserPushConfig, updatePushConfig} from '@/common/api/mine'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
loading: true,
|
||||
config: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {},
|
||||
init() {
|
||||
queryUserPushConfig().then(res => {
|
||||
this.config = res.data
|
||||
console.log(this.config)
|
||||
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
change(type) {
|
||||
this.config[type] = this.config[type] === 1 ? 0 : 1
|
||||
updatePushConfig(this.config).then(res => {
|
||||
let str = ''
|
||||
switch (type){
|
||||
case 'dataInfo':
|
||||
str = '稳态越限'
|
||||
break
|
||||
case 'eventInfo':
|
||||
str = '暂态事件'
|
||||
break
|
||||
case 'deviceInfo':
|
||||
str = '设备状态'
|
||||
break
|
||||
case 'systemInfo':
|
||||
str = '设备消息'
|
||||
break
|
||||
}
|
||||
this.$util.toast(`${str}推送${this.config[type] === 1 ? '开启' : '关闭'}成功`)
|
||||
})
|
||||
},
|
||||
jump(type) {
|
||||
switch (type) {
|
||||
case 'changePwd':
|
||||
@@ -63,6 +94,7 @@ export default {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.mine-header {
|
||||
padding: 200rpx 34rpx 34rpx;
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user