72 lines
1.6 KiB
JavaScript
72 lines
1.6 KiB
JavaScript
/**
|
|
* 账号受限页 U48
|
|
* 展示当前限制状态、原因,以及申诉入口
|
|
*/
|
|
const api = require('../../utils/api');
|
|
|
|
Page({
|
|
data: {
|
|
hasRestriction: false,
|
|
accountStatus: 'normal',
|
|
actions: [],
|
|
canAppeal: false,
|
|
appealEnabled: false,
|
|
loading: true
|
|
},
|
|
|
|
onLoad() {
|
|
this.loadStatus();
|
|
},
|
|
|
|
onShow() {
|
|
this.loadStatus();
|
|
},
|
|
|
|
async loadStatus() {
|
|
this.setData({ loading: true });
|
|
try {
|
|
const token = wx.getStorageSync('accessToken');
|
|
const res = await api.get('/appeals/account-status', {}, {
|
|
Authorization: `Bearer ${token}`
|
|
});
|
|
this.setData({
|
|
hasRestriction: res.hasRestriction,
|
|
accountStatus: res.accountStatus,
|
|
actions: res.actions || [],
|
|
canAppeal: res.canAppeal,
|
|
appealEnabled: res.appealEnabled,
|
|
loading: false
|
|
});
|
|
} catch (err) {
|
|
console.error(err);
|
|
this.setData({ loading: false });
|
|
}
|
|
},
|
|
|
|
goAppeal(e) {
|
|
const action = e.currentTarget.dataset.action;
|
|
wx.navigateTo({
|
|
url: `/pages/appeal/appeal?type=${action.appealType}&actionId=${action.id}`
|
|
});
|
|
},
|
|
|
|
goHelp() {
|
|
wx.navigateTo({ url: '/pages/help-center/help-center' });
|
|
},
|
|
|
|
statusText(s) {
|
|
const map = { banned: '已封禁', suspended: '临时暂停', limited: '功能限制' };
|
|
return map[s] || s;
|
|
},
|
|
|
|
actionTypeText(t) {
|
|
const map = { ban: '永久封禁', feature_limit: '功能限制', temporary_suspend: '临时暂停', warning: '警告' };
|
|
return map[t] || t;
|
|
},
|
|
|
|
formatTime(t) {
|
|
if (!t) return '-';
|
|
return new Date(t).toLocaleDateString('zh-CN');
|
|
}
|
|
});
|