连云港陪玩陪聊
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chunwan/pages/users/notice/index.vue

107 lines
2.4 KiB

<template>
<view class="yinsi">
<view class="content">
<view class="item">
<view class="a">新消息提示音</view>
<u-switch active-color="#000000" v-model="checked" @change="changeChecked()"></u-switch>
</view>
<view class="item">
<view class="a">新消息震动</view>
<u-switch active-color="#000000" v-model="checked1" @change="changeChecked1()"></u-switch>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
checked: false,
checked1: false
};
},
onLoad() {
this.getUserInfo();
},
methods: {
//查询个人信息
async getUserInfo() {
const { code, data , msg } = await this.$api.findUserInfo({userId: uni.getStorageSync("userInfo").id});
if(code == 200){
this.checked = (data.msgVoice == 1?true:false)
this.checked1 = (data.msgShock == 1?true:false)
uni.setStorageSync("userInfo",data);
}else{
uni.showToast({
title: msg,
position: "bottom",
icon: "none",
})
}
},
async changeChecked(e) {
const { code, data, msg } = await this.$api.privacyConfig({
"userId": uni.getStorageSync("userInfo").id,
"msgVoice": this.checked?1:0 //新消息提示音:0未开启1开启
});
if(code == 200){
uni.showToast({
title: "修改成功"
})
}else{
uni.showToast({
icon: "none",
position: "bottom",
title: msg
})
}
},
async changeChecked1(e) {
const { code, data, msg } = await this.$api.privacyConfig({
"userId": uni.getStorageSync("userInfo").id,
"msgShock": this.checked1?1:0 //新消息震动:0未开启1开启
});
if(code == 200){
uni.showToast({
title: "修改成功"
})
}else{
uni.showToast({
icon: "none",
position: "bottom",
title: msg
})
}
}
}
}
</script>
<style scoped lang="scss">
.yinsi{
padding: 0 25rpx;
overflow: hidden;
.content{
background: #FFFFFF;
border-radius: 20rpx;
margin-top: 20rpx;
padding: 0 20rpx;
.item{
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
width: 100%;
height: 100rpx;
border-top: 1px solid #EAEAEA;
font-weight: 500;
font-size: 30rpx;
color: #222222;
&:first-child{
border-top-color: #FFFFFF;
}
}
}
}
</style>