chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
// pages/my-counseling/my-counseling.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "我的咨询"
|
||||
}
|
||||
@@ -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') : ''; }
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
<view class="container">
|
||||
<view class="empty" wx:if="{{list.length === 0}}">
|
||||
<text>暂无咨询记录</text>
|
||||
<button class="go-btn" bindtap="goToIntro">去申请咨询</button>
|
||||
</view>
|
||||
<view class="card" wx:for="{{list}}" wx:key="id" bindtap="goToDetail" data-id="{{item.id}}">
|
||||
<view class="card-header">
|
||||
<text class="card-title">{{item.serviceTypeName}}</text>
|
||||
<text class="card-status status-{{item.status}}">{{statusLabel(item.status)}}</text>
|
||||
</view>
|
||||
<view class="card-body">
|
||||
<text class="card-summary" wx:if="{{item.userRequestSummary}}">{{item.userRequestSummary}}</text>
|
||||
<text class="card-time" wx:if="{{item.scheduledStartAt}}">预约时间:{{formatTime(item.scheduledStartAt)}}</text>
|
||||
</view>
|
||||
<view class="card-footer">
|
||||
<text class="card-date">{{formatDate(item.createdAt)}}</text>
|
||||
<text class="arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,19 @@
|
||||
.container { padding: 24rpx; }
|
||||
.empty { text-align: center; padding: 80rpx 0; color: #999; }
|
||||
.go-btn { margin-top: 24rpx; background: #FF6B6B; color: #fff; border-radius: 44rpx; font-size: 28rpx; }
|
||||
.card { background: #fff; border-radius: 16rpx; padding: 24rpx; margin-bottom: 20rpx; box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.05); }
|
||||
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12rpx; }
|
||||
.card-title { font-size: 32rpx; font-weight: bold; color: #333; }
|
||||
.card-status { font-size: 24rpx; padding: 4rpx 16rpx; border-radius: 20rpx; }
|
||||
.status-pending { background: #fff3e0; color: #e65100; }
|
||||
.status-assigned { background: #e3f2fd; color: #1565c0; }
|
||||
.status-scheduled { background: #e8f5e9; color: #2e7d32; }
|
||||
.status-in_progress { background: #fce4ec; color: #c62828; }
|
||||
.status-completed { background: #f3e5f5; color: #6a1b9a; }
|
||||
.status-cancelled { background: #f5f5f5; color: #999; }
|
||||
.card-body { margin-bottom: 12rpx; }
|
||||
.card-summary { font-size: 26rpx; color: #666; display: block; }
|
||||
.card-time { font-size: 24rpx; color: #999; margin-top: 8rpx; display: block; }
|
||||
.card-footer { display: flex; justify-content: space-between; align-items: center; }
|
||||
.card-date { font-size: 24rpx; color: #bbb; }
|
||||
.arrow { font-size: 28rpx; color: #ccc; }
|
||||
Reference in New Issue
Block a user