连云港陪玩陪聊
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

108 lines
2.4 KiB

3 months ago
<template>
<view class="yinsi">
<view class="content">
<view class="item">
<view class="a">新消息提示音</view>
1 month ago
<u-switch active-color="#000000" v-model="checked" @change="changeChecked()"></u-switch>
3 months ago
</view>
<view class="item">
<view class="a">新消息震动</view>
1 month ago
<u-switch active-color="#000000" v-model="checked1" @change="changeChecked1()"></u-switch>
3 months ago
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
1 month ago
checked: false,
checked1: false
3 months ago
};
1 month ago
},
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({
1 month ago
title: msg,
1 month ago
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
})
}
}
3 months ago
}
}
</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>