chore: update experience index and documentation for various roles
- Added recent experience entries for roles including Assistant, Mini Program Developer, Backend Engineer, Product Manager, Software Tester, and Team. - Enhanced documentation structure in the development assistant's experience list and project index. - Updated role-flow control documentation to reflect new methodologies and programming thinking. - Improved error handling in the mini program and backend API for better user feedback during operations. Made-with: Cursor
This commit is contained in:
@@ -692,7 +692,11 @@ Page({
|
||||
wx.showToast({ title: res.error || '加入失败', icon: 'none' })
|
||||
}
|
||||
} catch (e) {
|
||||
wx.showToast({ title: '网络异常,请重试', icon: 'none' })
|
||||
const resp = e && e.response
|
||||
wx.showToast({
|
||||
title: (resp && (resp.message || resp.error)) || (e && e.message) || '网络异常,请重试',
|
||||
icon: 'none',
|
||||
})
|
||||
} finally {
|
||||
this.setData({ isJoining: false })
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* 联系导师按钮 → 弹出 v2 弹窗(选择咨询项目)
|
||||
*/
|
||||
const app = getApp()
|
||||
const soulBridge = require('../../utils/soulBridge')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -79,6 +80,11 @@ Page({
|
||||
this.setData({ selectedType: item.type, selectedAmount: item.price })
|
||||
},
|
||||
|
||||
_consultationTypeLabel(t) {
|
||||
const m = { single: '单次咨询', half_year: '半年咨询', year: '年度咨询' }
|
||||
return m[t] || '咨询'
|
||||
},
|
||||
|
||||
async onConfirmConsult() {
|
||||
const { mentor, selectedType } = this.data
|
||||
const userId = app.globalData.userInfo?.id
|
||||
@@ -94,22 +100,57 @@ Page({
|
||||
method: 'POST',
|
||||
data: { userId, consultationType: selectedType },
|
||||
})
|
||||
if (res?.success && res.data) {
|
||||
this.setData({ showConsultModal: false, creating: false })
|
||||
wx.showToast({ title: '预约创建成功', icon: 'success' })
|
||||
// TODO: 调起支付 productType: mentor_consultation, productId: res.data.id
|
||||
if (!res?.success || !res.data) {
|
||||
wx.showToast({ title: res?.error || '创建失败', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ showConsultModal: false })
|
||||
const consult = res.data
|
||||
const openId = await app.ensurePayOpenId()
|
||||
if (!openId) {
|
||||
wx.showModal({
|
||||
title: '预约成功',
|
||||
content: '请联系客服完成后续对接',
|
||||
title: '无法拉起支付',
|
||||
content: '未获取到微信支付标识,请完全关闭小程序后重新进入,或退出账号重新登录。',
|
||||
showCancel: false,
|
||||
})
|
||||
} else {
|
||||
wx.showToast({ title: res?.error || '创建失败', icon: 'none' })
|
||||
return
|
||||
}
|
||||
wx.showLoading({ title: '正在拉起支付...', mask: true })
|
||||
try {
|
||||
const label = this._consultationTypeLabel(selectedType)
|
||||
const payRes = await app.request('/api/miniprogram/pay', {
|
||||
method: 'POST',
|
||||
data: {
|
||||
openId,
|
||||
userId,
|
||||
productType: 'mentor_consultation',
|
||||
productId: String(consult.id),
|
||||
amount: Number(consult.amount),
|
||||
description: `导师咨询 · ${(mentor && mentor.name) || '导师'}(${label})`,
|
||||
referralCode: soulBridge.getReferralCodeForPay(app) || undefined,
|
||||
},
|
||||
})
|
||||
if (payRes?.success && payRes.data?.payParams) {
|
||||
try {
|
||||
await soulBridge.requestWxJsapiPayment(payRes.data.payParams)
|
||||
await soulBridge.syncOrderStatusQuery(app, payRes.data.orderSn)
|
||||
wx.showToast({ title: '支付成功', icon: 'success' })
|
||||
} catch (pe) {
|
||||
const msg = pe && pe.errMsg ? String(pe.errMsg) : ''
|
||||
if (msg.indexOf('cancel') !== -1) wx.showToast({ title: '支付取消', icon: 'none' })
|
||||
else wx.showToast({ title: '支付未完成', icon: 'none' })
|
||||
}
|
||||
} else {
|
||||
wx.showToast({ title: payRes?.error || '获取支付参数失败', icon: 'none' })
|
||||
}
|
||||
} finally {
|
||||
wx.hideLoading()
|
||||
}
|
||||
} catch (e) {
|
||||
wx.showToast({ title: '创建失败', icon: 'none' })
|
||||
wx.showToast({ title: (e && e.message) || '操作失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ creating: false })
|
||||
}
|
||||
this.setData({ creating: false })
|
||||
},
|
||||
|
||||
goBack() {
|
||||
|
||||
Reference in New Issue
Block a user