147 lines
4.3 KiB
Vue
147 lines
4.3 KiB
Vue
<template>
|
|
<Cn-page :loading="loading">
|
|
<view class="mine" slot="body">
|
|
<view class="mine-nav" style="margin-top: 20rpx">
|
|
<view class="mine-nav-label">运行事件</view>
|
|
<switch style="transform: scale(0.8)" color="#376cf3" @change="change('runInfo')" :checked="config.runInfo === 1"/>
|
|
</view>
|
|
<view class="mine-nav" style="border-bottom: none">
|
|
<view class="mine-nav-label">暂态事件</view>
|
|
<switch style="transform: scale(0.8)" 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 style="transform: scale(0.8)" color="#376cf3" @change="change('harmonicInfo')" :checked="config.harmonicInfo === 1"/>
|
|
</view>
|
|
<view class="mine-nav" style="border-bottom: none">
|
|
<view class="mine-nav-label">设备告警</view>
|
|
<switch style="transform: scale(0.8)" color="#376cf3" @change="change('alarmInfo')" :checked="config.alarmInfo === 1"/>
|
|
</view>
|
|
</view>
|
|
</Cn-page>
|
|
</template>
|
|
|
|
<script>
|
|
import {queryUserPushConfig, updatePushConfig} from '@/common/api/mine'
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
loading: true,
|
|
config: {},
|
|
}
|
|
},
|
|
methods: {
|
|
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 'runInfo':
|
|
str = '运行事件'
|
|
break
|
|
case 'eventInfo':
|
|
str = '暂态事件'
|
|
break
|
|
case 'harmonicInfo':
|
|
str = '稳态事件'
|
|
break
|
|
case 'alarmInfo':
|
|
str = '设备告警'
|
|
break
|
|
}
|
|
this.$util.toast(`${str}推送${this.config[type] === 1 ? '开启' : '关闭'}成功`)
|
|
})
|
|
},
|
|
jump(type) {
|
|
switch (type) {
|
|
case 'changePwd':
|
|
uni.navigateTo({
|
|
url: `/pages/user/changePwd`,
|
|
})
|
|
break
|
|
case 'changePhone':
|
|
uni.navigateTo({
|
|
url: `/pages/user/changePhone`,
|
|
})
|
|
break
|
|
default:
|
|
uni.navigateTo({
|
|
url: `/pages/mine/${type}`,
|
|
})
|
|
break
|
|
}
|
|
},
|
|
},
|
|
onLoad() {
|
|
this.init()
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.mine {
|
|
.title {
|
|
padding: 0 20rpx;
|
|
font-size: 28rpx;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.mine-header {
|
|
padding: 200rpx 34rpx 34rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
background: $uni-theme-white;
|
|
margin-bottom: 20rpx;
|
|
box-shadow: 0 4rpx 8rpx #e7e7e74c;
|
|
|
|
.mine-header-head {
|
|
margin-right: 30rpx;
|
|
height: 128rpx;
|
|
width: 128rpx;
|
|
border-radius: $uni-theme-radius;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.mine-header-name {
|
|
margin-right: 30rpx;
|
|
flex: 1;
|
|
font-size: 36rpx;
|
|
color: #111;
|
|
font-weight: 700;
|
|
}
|
|
}
|
|
|
|
.mine-nav {
|
|
padding: 34rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
background: $uni-theme-white;
|
|
border-bottom: 1rpx solid #e8e8e8;
|
|
|
|
&-icon {
|
|
margin-right: 30rpx;
|
|
height: 44rpx;
|
|
width: 44rpx;
|
|
border-radius: $uni-theme-radius;
|
|
overflow: hidden;
|
|
}
|
|
|
|
&-label {
|
|
margin-right: 30rpx;
|
|
flex: 1;
|
|
font-size: 28rpx;
|
|
color: #111;
|
|
}
|
|
}
|
|
}
|
|
</style>
|