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

84 lines
1.7 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>
</view>
</template>
<script>
export default {
data() {
return {
1 month ago
checked: 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.city_hide = (data.cityHide == 0?true:false)
uni.setStorageSync("userInfo",data);
}else{
uni.showToast({
1 month ago
title: msg,
1 month ago
position: "bottom",
icon: "none",
})
}
},
async changeChecked(e) {
this.checked = e;
console.log(e)
const { code, data, msg } = await this.$api.privacyConfig({
"userId": uni.getStorageSync("userInfo").id,
"cityHide": this.checked?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;
.item{
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
box-sizing: border-box;
width: 100%;
height: 100rpx;
box-sizing: border-box;
font-weight: 500;
font-size: 30rpx;
color: #222222;
}
}
}
</style>