feat: 同步今日小程序与后台迭代版本

集中提交今日 API、管理端、小程序与部署文档调整,确保 Gitea 主分支与本地最新开发版本一致。

Made-with: Cursor
This commit is contained in:
卡若
2026-04-20 11:07:55 +08:00
parent 7108f28280
commit ce55c48c64
180 changed files with 11659 additions and 6078 deletions

View File

@@ -2,7 +2,12 @@
const app = getApp()
const payment = require('../../utils/payment')
const { getTypeOnly } = require('../../utils/resultFormat')
const { isReportProfileComplete } = require('../../utils/phoneAuth.js')
const {
hasPhone,
bindPhoneByCode,
needsResultProfileGate,
navigateToCompleteProfileAfterPhoneIfNeeded
} = require('../../utils/phoneAuth.js')
const {
slicePreviewText,
slicePreviewList,
@@ -56,6 +61,7 @@ Page({
shareToken: '',
hasReloadedAfterPay: false,
fromShare: false,
hasPhone: false,
profileGate: false,
previewDiscDescription: '',
previewDiscStrengths: [],
@@ -202,19 +208,23 @@ Page({
},
onShow() {
this.setData({ hasPhone: hasPhone() })
if (this.data.testResultId && this.data.result) {
this._syncDiscGate()
} else if (!this.data.testResultId) {
const raw = wx.getStorageSync('discResult')
if (!raw) return
const r = withPercentagesInt(raw)
this.setData({ result: r, typeSummaryLine: getTypeOnly(raw, 'disc') })
this._syncDiscGate()
}
this._syncJourney()
if (this.data.testResultId) return
const raw = wx.getStorageSync('discResult')
if (!raw) return
const r = withPercentagesInt(raw)
this.setData({ result: r, typeSummaryLine: getTypeOnly(raw, 'disc') })
this._syncDiscGate()
},
_syncDiscGate() {
const r = this.data.result
const fromShare = !!this.data.fromShare
const profileGate = !fromShare && !isReportProfileComplete()
const profileGate = needsResultProfileGate(fromShare)
const desc = (r && r.description) || {}
const code = (r && (r.dominantType || r.disc)) || ''
this.setData({
@@ -239,10 +249,41 @@ Page({
wx.navigateTo({ url: '/pages/promo/index' })
},
onPhoneLoginForResultGate(e) {
const { code, errMsg } = e.detail || {}
if (errMsg && errMsg.indexOf('getPhoneNumber:fail') === 0) {
wx.showToast({ title: '需要授权手机号才能查看完整报告', icon: 'none' })
return
}
if (!code) {
wx.showToast({ title: '获取手机号失败', icon: 'none' })
return
}
bindPhoneByCode(code)
.then(() => {
this.setData({ hasPhone: hasPhone() })
if (this.data.testResultId) {
this._syncDiscGate()
} else {
const raw = wx.getStorageSync('discResult')
if (raw) {
const r = withPercentagesInt(raw)
this.setData({ result: r, typeSummaryLine: getTypeOnly(raw, 'disc') })
this._syncDiscGate()
}
}
navigateToCompleteProfileAfterPhoneIfNeeded()
})
.catch(() => {})
},
onTapReadFull() {
try { require('../../utils/analytics').track('tap_read_full', { type: 'disc' }) } catch (e) {}
if (this.data.profileGate) {
this.goCompleteProfile()
wx.showToast({
title: this.data.hasPhone ? '请先完善头像与昵称' : '请先点击下方「登录解锁全文」',
icon: 'none'
})
return
}
if (this.data.payInfo.requiresPayment && !this.data.payInfo.isPaid) {