chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
// pages/premarital-request/premarital-request.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "申请婚前辅导"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
const app = getApp<{ globalData: { apiBase: string; token: string } }>();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
name: '', phone: '', hasCompanion: false, companionName: '',
|
||||
preferredTime: '', summary: '', submitting: false
|
||||
},
|
||||
onNameInput(e: any) { this.setData({ name: e.detail.value }); },
|
||||
onPhoneInput(e: any) { this.setData({ phone: e.detail.value }); },
|
||||
onCompanionChange(e: any) { this.setData({ hasCompanion: e.detail.value }); },
|
||||
onCompanionNameInput(e: any) { this.setData({ companionName: e.detail.value }); },
|
||||
onTimeInput(e: any) { this.setData({ preferredTime: e.detail.value }); },
|
||||
onSummaryInput(e: any) { this.setData({ summary: e.detail.value }); },
|
||||
|
||||
async onSubmit() {
|
||||
const { name, phone, hasCompanion, companionName, preferredTime, summary } = this.data;
|
||||
if (!name || !phone) 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: 'premarital_guidance',
|
||||
preferredTime,
|
||||
userRequestSummary: summary || `申请人:${name},电话:${phone}${hasCompanion ? `,伴侣:${companionName}` : ''}`,
|
||||
requestSource: 'user_self'
|
||||
}
|
||||
});
|
||||
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,32 @@
|
||||
<view class="container">
|
||||
<view class="form-section">
|
||||
<view class="form-group">
|
||||
<text class="label">您的姓名</text>
|
||||
<input class="input" placeholder="请输入姓名" value="{{name}}" bindinput="onNameInput" />
|
||||
</view>
|
||||
<view class="form-group">
|
||||
<text class="label">联系方式</text>
|
||||
<input class="input" placeholder="请输入手机号" value="{{phone}}" bindinput="onPhoneInput" />
|
||||
</view>
|
||||
<view class="form-group">
|
||||
<text class="label">是否邀请伴侣参与</text>
|
||||
<switch checked="{{hasCompanion}}" bindchange="onCompanionChange" />
|
||||
<text class="switch-hint" wx:if="{{hasCompanion}}">伴侣将同步收到服务通知</text>
|
||||
</view>
|
||||
<view class="form-group" wx:if="{{hasCompanion}}">
|
||||
<text class="label">伴侣姓名(选填)</text>
|
||||
<input class="input" placeholder="伴侣姓名" value="{{companionName}}" bindinput="onCompanionNameInput" />
|
||||
</view>
|
||||
<view class="form-group">
|
||||
<text class="label">期望时间</text>
|
||||
<input class="input" placeholder="如:本周末下午" value="{{preferredTime}}" bindinput="onTimeInput" />
|
||||
</view>
|
||||
<view class="form-group">
|
||||
<text class="label">补充说明(选填)</text>
|
||||
<textarea class="textarea" placeholder="如有特殊需求请在此说明" value="{{summary}}" bindinput="onSummaryInput" maxlength="300" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button class="submit-btn" bindtap="onSubmit" loading="{{submitting}}">提交申请</button>
|
||||
<text class="tip">婚前辅导为公益免费服务,工作人员将在3个工作日内与您联系</text>
|
||||
</view>
|
||||
@@ -0,0 +1,10 @@
|
||||
.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; }
|
||||
.input { font-size: 30rpx; color: #333; }
|
||||
.textarea { font-size: 30rpx; color: #333; width: 100%; height: 120rpx; }
|
||||
.switch-hint { font-size: 24rpx; color: #FF6B6B; margin-left: 12rpx; }
|
||||
.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