123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <template>
- <view>
- <navbar :config="config" backColor="#999999"></navbar>
- <view class="box">
- <view>消息免打扰</view>
- <view><u-switch active-color="rgb(60,189,209)" size="32" v-model="messageConfig" @change="updateMessageConfig"></u-switch></view>
- </view>
- <view class="tig">*开启后,所有应用消息将不再提醒,仅可通过消息中心查看</view>
- </view>
- </template>
- <script>
- import {
- myUserInfo
- } from "@/api/government.js"
- export default {
- data() {
- return {
- config: {
- back: true, //false是tolbar页面 是则不写
- title: '消息设置',
- color: '#000',
- //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
- // backgroundColor: [0, '#2cba28'],
- },
- messageConfig: false
- }
- },
- onLoad(options) {
- this.getUserData()
- },
- methods:{
- getUserData() {
- myUserInfo().then(res => {
- this.messageConfig = res.data.messageConfig
- })
- },
- // 修改消息免打扰配置
- updateMessageConfig(){
- uni.showLoading({
- title: '修改中',
- mask: true
- });
- this.$yghttp.post('/user/updateMessageConfig',{messageConfig:this.messageConfig}).then(res=>{
- uni.showToast({
- title: '修改成功!',
- icon: 'success',
- duration: 1000
- })
- this.getUserData()
- })
- }
- }
- }
- </script>
- <style>
- page {
- background-color: #F8F8F8;
- }
- </style>
- <style lang="scss" scoped>
- .box {
- padding: 40rpx 30rpx;
- background: #fff;
- border-radius: 20rpx;
- display: flex;
- justify-content: space-between;
- margin: 20rpx 30rpx;
- >view {
- font-size: 30rpx;
- }
- }
- .tig{
- font-size: 24rpx;
- color: #999999;
- margin: 20rpx 30rpx;
- }
- </style>
|