chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
// pages/counseling-request/counseling-request.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "申请咨询"
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
const app = getApp<{ globalData: { apiBase: string; token: string } }>();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
serviceType: '',
|
||||
serviceTypeLabel: '',
|
||||
modes: ['线上视频', '线下面谈', '电话沟通'],
|
||||
pModeIndex: 0,
|
||||
preferredTime: '',
|
||||
summary: '',
|
||||
submitting: false
|
||||
},
|
||||
|
||||
onLoad(options: any) {
|
||||
if (options.type) {
|
||||
const typeMap: Record<string, string> = {
|
||||
relationship_guidance: '恋爱困惑指导',
|
||||
emotional_support: '情感支持',
|
||||
premarital_guidance: '婚前辅导',
|
||||
anti_fraud_guidance: '婚恋反诈指导'
|
||||
};
|
||||
this.setData({ serviceType: options.type, serviceTypeLabel: typeMap[options.type] || options.type });
|
||||
}
|
||||
},
|
||||
|
||||
onModeChange(e: any) {
|
||||
this.setData({ pModeIndex: e.detail.value });
|
||||
},
|
||||
|
||||
onTimeInput(e: any) { this.setData({ preferredTime: e.detail.value }); },
|
||||
onSummaryInput(e: any) { this.setData({ summary: e.detail.value }); },
|
||||
|
||||
async onSubmit() {
|
||||
const { serviceType, pModeIndex, preferredTime, summary } = this.data;
|
||||
if (!serviceType) return wx.showToast({ title: '请选择服务类型', icon: 'none' });
|
||||
this.setData({ submitting: true });
|
||||
try {
|
||||
await wx.request({
|
||||
url: `${app.globalData.apiBase}/counseling/services`,
|
||||
method: 'POST',
|
||||
header: { 'Authorization': `Bearer ${app.globalData.token}`, 'Content-Type': 'application/json' },
|
||||
data: { serviceType, preferredServiceMode: this.data.modes[pModeIndex], preferredTime, userRequestSummary: summary }
|
||||
});
|
||||
wx.showToast({ title: '申请已提交', icon: 'success' });
|
||||
setTimeout(() => wx.redirectTo({ url: '/pages/my-counseling/my-counseling' }), 1500);
|
||||
} catch (e) {
|
||||
wx.showToast({ title: '提交失败,请重试', icon: 'none' });
|
||||
} finally {
|
||||
this.setData({ submitting: false });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
<view class="container">
|
||||
<view class="form-section">
|
||||
<view class="form-group">
|
||||
<text class="label">服务类型</text>
|
||||
<text class="value">{{serviceTypeLabel}}</text>
|
||||
</view>
|
||||
<view class="form-group">
|
||||
<text class="label">沟通方式</text>
|
||||
<picker mode="selector" range="{{modes}}" bindchange="onModeChange">
|
||||
<view class="picker-value">{{modes[pModeIndex] || '请选择'}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="form-group">
|
||||
<text class="label">期望时间</text>
|
||||
<input class="input" placeholder="如:工作日晚上7点后" value="{{preferredTime}}" bindinput="onTimeInput" />
|
||||
</view>
|
||||
<view class="form-group">
|
||||
<text class="label">问题描述</text>
|
||||
<textarea class="textarea" placeholder="请简要描述您的需求(选填)" value="{{summary}}" bindinput="onSummaryInput" maxlength="500" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button class="submit-btn" bindtap="onSubmit" loading="{{submitting}}">提交申请</button>
|
||||
<text class="tip">提交后工作人员将在1-3个工作日内与您联系</text>
|
||||
</view>
|
||||
@@ -0,0 +1,11 @@
|
||||
.container { padding: 24rpx; }
|
||||
.form-section { background: #fff; border-radius: 16rpx; padding: 24rpx; }
|
||||
.form-group { padding: 20rpx 0; border-bottom: 1rpx solid #f5f5f5; }
|
||||
.form-group:last-child { border-bottom: none; }
|
||||
.label { font-size: 28rpx; color: #666; display: block; margin-bottom: 12rpx; }
|
||||
.value { font-size: 30rpx; color: #333; }
|
||||
.picker-value { font-size: 30rpx; color: #333; }
|
||||
.input { font-size: 30rpx; color: #333; }
|
||||
.textarea { font-size: 30rpx; color: #333; width: 100%; height: 160rpx; }
|
||||
.submit-btn { margin-top: 40rpx; background: linear-gradient(135deg, #FF6B6B, #EE5A24); color: #fff; border: none; border-radius: 44rpx; font-size: 32rpx; }
|
||||
.tip { display: block; text-align: center; font-size: 24rpx; color: #999; margin-top: 20rpx; }
|
||||
Reference in New Issue
Block a user