chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
const app = getApp<{ globalData: { apiBase: string; token: string } }>();
|
||||
|
||||
Page({
|
||||
data: { list: [] as any[] },
|
||||
|
||||
onLoad() { this.loadList(); },
|
||||
onShow() { this.loadList(); },
|
||||
|
||||
async loadList() {
|
||||
try {
|
||||
const res = await wx.request({
|
||||
url: `${app.globalData.apiBase}/counseling/services`,
|
||||
header: { 'Authorization': `Bearer ${app.globalData.token}` }
|
||||
});
|
||||
if (res.statusCode === 200 && res.data.success) {
|
||||
const typeMap: Record<string, string> = {
|
||||
relationship_guidance: '恋爱困惑指导', emotional_support: '情感支持',
|
||||
premarital_guidance: '婚前辅导', anti_fraud_guidance: '婚恋反诈指导'
|
||||
};
|
||||
const list = (res.data.data || []).map((item: any) => ({ ...item, serviceTypeName: typeMap[item.serviceType] || item.serviceType }));
|
||||
this.setData({ list });
|
||||
}
|
||||
} catch (e) { console.error(e); }
|
||||
},
|
||||
|
||||
goToDetail(e: any) { wx.navigateTo({ url: `/pages/counseling-detail/counseling-detail?id=${e.currentTarget.dataset.id}` }); },
|
||||
goToIntro() { wx.navigateTo({ url: '/pages/counseling-intro/counseling-intro' }); },
|
||||
statusLabel(s: string) {
|
||||
const m: Record<string, string> = { pending: '待处理', assigned: '已分配', scheduled: '已排期', in_progress: '咨询中', completed: '已完成', cancelled: '已取消', closed: '已关闭' };
|
||||
return m[s] || s;
|
||||
},
|
||||
formatTime(t: string) { return t ? new Date(t).toLocaleString('zh-CN') : ''; },
|
||||
formatDate(t: string) { return t ? new Date(t).toLocaleDateString('zh-CN') : ''; }
|
||||
});
|
||||
Reference in New Issue
Block a user