chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* 隐私设置页 U43
|
||||
*/
|
||||
const api = require('../../utils/api');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
visibleInRecommendations: true,
|
||||
allowActivityInvitation: true,
|
||||
showLastOnline: false,
|
||||
saving: false
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.loadSettings();
|
||||
},
|
||||
|
||||
async loadSettings() {
|
||||
try {
|
||||
const token = wx.getStorageSync('accessToken');
|
||||
const res = await api.get('/account/privacy-settings', {}, { Authorization: `Bearer ${token}` });
|
||||
this.setData({
|
||||
visibleInRecommendations: res.visibleInRecommendations !== false,
|
||||
allowActivityInvitation: res.allowActivityInvitation !== false,
|
||||
showLastOnline: res.showLastOnline === true
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
},
|
||||
|
||||
onVisibleChange(e) {
|
||||
this.setData({ visibleInRecommendations: e.detail.value });
|
||||
},
|
||||
|
||||
onActivityInvitationChange(e) {
|
||||
this.setData({ allowActivityInvitation: e.detail.value });
|
||||
},
|
||||
|
||||
onShowLastOnlineChange(e) {
|
||||
this.setData({ showLastOnline: e.detail.value });
|
||||
},
|
||||
|
||||
async saveSettings() {
|
||||
this.setData({ saving: true });
|
||||
try {
|
||||
const token = wx.getStorageSync('accessToken');
|
||||
await api.put('/account/privacy-settings', {
|
||||
visibleInRecommendations: this.data.visibleInRecommendations,
|
||||
allowActivityInvitation: this.data.allowActivityInvitation,
|
||||
showLastOnline: this.data.showLastOnline
|
||||
}, { Authorization: `Bearer ${token}` });
|
||||
wx.showToast({ title: '保存成功', icon: 'success' });
|
||||
} catch (err) {
|
||||
wx.showToast({ title: '保存失败', icon: 'none' });
|
||||
} finally {
|
||||
this.setData({ saving: false });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "隐私设置",
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<!-- 隐私设置页 U43 -->
|
||||
<view class="page">
|
||||
<view class="header">
|
||||
<text class="title">隐私设置</text>
|
||||
</view>
|
||||
|
||||
<view class="section">
|
||||
<view class="setting-item">
|
||||
<view class="setting-info">
|
||||
<text class="setting-name">在推荐中可见</text>
|
||||
<text class="setting-desc">开启后您的资料将进入系统推荐池</text>
|
||||
</view>
|
||||
<switch color="#E96B6B" checked="{{visibleInRecommendations}}" bindchange="onVisibleChange" />
|
||||
</view>
|
||||
|
||||
<view class="setting-item">
|
||||
<view class="setting-info">
|
||||
<text class="setting-name">允许活动邀请</text>
|
||||
<text class="setting-desc">允许工作人员邀请您参加线下活动</text>
|
||||
</view>
|
||||
<switch color="#E96B6B" checked="{{allowActivityInvitation}}" bindchange="onActivityInvitationChange" />
|
||||
</view>
|
||||
|
||||
<view class="setting-item">
|
||||
<view class="setting-info">
|
||||
<text class="setting-name">显示最近上线</text>
|
||||
<text class="setting-desc">对方可以看到您最近一次上线时间</text>
|
||||
</view>
|
||||
<switch color="#E96B6B" checked="{{showLastOnline}}" bindchange="onShowLastOnlineChange" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button class="btn-save" bindtap="saveSettings" loading="{{saving}}">保存设置</button>
|
||||
</view>
|
||||
@@ -0,0 +1,62 @@
|
||||
.page {
|
||||
padding: 32rpx;
|
||||
background: #FFF8F7;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #1A1A1A;
|
||||
}
|
||||
|
||||
.section {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx 28rpx;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.setting-item:last-child { border-bottom: none; }
|
||||
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.setting-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #1A1A1A;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.setting-desc {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.btn-save {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
background: #E96B6B;
|
||||
color: #fff;
|
||||
border-radius: 44rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user