-
维护模式
-
开启后前台将显示维护页面
+
审核模式
+
开启后测试结果需管理员审核通过才可展示
diff --git a/api/app/controller/api/AppConfig.php b/api/app/controller/api/AppConfig.php
index d4cdd0d..beb2923 100644
--- a/api/app/controller/api/AppConfig.php
+++ b/api/app/controller/api/AppConfig.php
@@ -103,6 +103,16 @@ class AppConfig extends BaseController
}
$siteTitle = $miniprogramName !== '' ? $miniprogramName : ($siteName !== '' ? $siteName : '神仙团队AI性格测试');
+ // 审核模式(原 maintenanceMode):开启后首页展示「开始性格测试」并跳转 test-select
+ $maintenanceMode = false;
+ $systemRow = Db::name('system_config')->where('key', 'system')->find();
+ if ($systemRow && !empty($systemRow['value'])) {
+ $sysVal = is_string($systemRow['value']) ? json_decode($systemRow['value'], true) : $systemRow['value'];
+ if (is_array($sysVal) && !empty($sysVal['maintenanceMode'])) {
+ $maintenanceMode = true;
+ }
+ }
+
// 小程序文案配置(分析中提示、按钮、报告标题等)
$textConfig = [
'analyzingTitle' => '正在分析中',
@@ -144,6 +154,7 @@ class AppConfig extends BaseController
'miniprogramName' => $miniprogramName,
'siteTitle' => $siteTitle,
'textConfig' => $textConfig,
+ 'maintenanceMode' => $maintenanceMode,
]);
}
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 27b3684..18196ab 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -8,6 +8,7 @@ App({
token: null,
siteTitle: '神仙团队AI性格测试',
textConfig: null, // 从 /api/config/runtime 动态加载:analyzingTitle, startButtonText, reportTitle, aiAnalysisText 等
+ maintenanceMode: undefined, // 审核模式,undefined=未加载,等 getRuntimeConfig 后再决定,避免 tabBar 闪烁
// 当前使用范围:personal 个人版 / enterprise 企业版(影响定价与 enterpriseId 写入)
appScope: 'personal',
// 扫码进入企业页时 scene 解析出的企业ID(e_123),提交测试/分析时优先使用
@@ -35,10 +36,11 @@ App({
// 静默登录获取openId
this.silentLogin()
- // 预加载站点/小程序名称(供导航栏展示)
+ // 预加载站点/小程序名称、审核模式(供导航栏展示)
this.getRuntimeConfig().then((cfg) => {
- if (cfg && cfg.siteTitle) {
- this.globalData.siteTitle = cfg.siteTitle
+ if (cfg) {
+ if (cfg.siteTitle) this.globalData.siteTitle = cfg.siteTitle
+ if (cfg.maintenanceMode !== undefined) this.globalData.maintenanceMode = !!cfg.maintenanceMode
}
}).catch(() => {})
},
@@ -332,6 +334,7 @@ App({
const data = res.data.data || {}
if (data.siteTitle) this.globalData.siteTitle = data.siteTitle
if (data.textConfig) this.globalData.textConfig = data.textConfig
+ if (data.maintenanceMode !== undefined) this.globalData.maintenanceMode = !!data.maintenanceMode
resolve(data)
} else {
reject(new Error(res.data && res.data.message ? res.data.message : '获取配置失败'))
diff --git a/miniprogram/custom-tab-bar/index.js b/miniprogram/custom-tab-bar/index.js
index dc50193..ced1b39 100644
--- a/miniprogram/custom-tab-bar/index.js
+++ b/miniprogram/custom-tab-bar/index.js
@@ -2,6 +2,7 @@
Component({
data: {
selected: 0,
+ maintenanceMode: true, // 默认隐藏,等配置加载后再决定是否显示,避免闪烁或残留
list: [
{ pagePath: '/pages/index/index', text: '首页', textKey: 'home', icon: 'home' },
{ pagePath: '/pages/index/camera', text: '查看报告', textKey: 'camera', icon: 'camera' },
@@ -33,6 +34,9 @@ Component({
const url = currentPage.route
let selected = 0
+ // 未加载配置时视为审核模式(隐藏按钮),避免残留或闪烁
+ const gd = getApp().globalData || {}
+ const maintenanceMode = gd.maintenanceMode === false ? false : true
if (url === 'pages/index/index' || url === 'pages/enterprise/index') {
selected = 0
@@ -42,7 +46,7 @@ Component({
selected = 2
}
- this.setData({ selected })
+ this.setData({ selected, maintenanceMode })
} catch (error) {
console.error('updateSelected error:', error)
// 默认选中第一个
diff --git a/miniprogram/custom-tab-bar/index.wxml b/miniprogram/custom-tab-bar/index.wxml
index 9bc06e8..6ccc171 100644
--- a/miniprogram/custom-tab-bar/index.wxml
+++ b/miniprogram/custom-tab-bar/index.wxml
@@ -12,6 +12,7 @@
首页
{
- if (cfg && cfg.siteTitle) {
- app.globalData.siteTitle = cfg.siteTitle
- this.setData({ siteTitle: cfg.siteTitle })
+ if (cfg) {
+ if (cfg.siteTitle) {
+ app.globalData.siteTitle = cfg.siteTitle
+ this.setData({ siteTitle: cfg.siteTitle })
+ }
+ const maintenanceMode = !!(cfg.maintenanceMode)
+ if (cfg.maintenanceMode !== undefined) app.globalData.maintenanceMode = maintenanceMode
+ this.setData({
+ startButtonEnterprise: maintenanceMode ? '开始性格测试' : (cfg.textConfig && cfg.textConfig.startButtonEnterprise || '开始面部测试'),
+ aiAnalysisText: (cfg.textConfig && cfg.textConfig.aiAnalysisText) || '智能分析',
+ maintenanceMode
+ })
}
}).catch(() => {})
return
@@ -98,13 +110,14 @@ Page({
app.globalData.siteTitle = cfg.siteTitle
this.setData({ siteTitle: cfg.siteTitle })
}
- if (cfg.textConfig) {
- app.globalData.textConfig = cfg.textConfig
- this.setData({
- startButtonEnterprise: cfg.textConfig.startButtonEnterprise || '开始面部测试',
- aiAnalysisText: cfg.textConfig.aiAnalysisText || '智能分析'
- })
- }
+ if (cfg.textConfig) app.globalData.textConfig = cfg.textConfig
+ const maintenanceMode = !!(cfg && cfg.maintenanceMode)
+ if (cfg.maintenanceMode !== undefined) app.globalData.maintenanceMode = maintenanceMode
+ this.setData({
+ startButtonEnterprise: maintenanceMode ? '开始性格测试' : (cfg.textConfig && cfg.textConfig.startButtonEnterprise || '开始面部测试'),
+ aiAnalysisText: (cfg.textConfig && cfg.textConfig.aiAnalysisText) || '智能分析',
+ maintenanceMode
+ })
}
if ((cfg && cfg.pricingType) !== 'enterprise' && !app.globalData.enterpriseIdFromScene) {
redirectBack()
@@ -136,14 +149,17 @@ Page({
onShow() {
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- this.getTabBar().setData({ selected: 0 })
+ const tabBar = this.getTabBar()
+ tabBar.setData({ selected: 0, maintenanceMode: !!getApp().globalData.maintenanceMode })
}
try { getApp().globalData.appScope = 'enterprise' } catch (e) {}
const gd = getApp().globalData
+ const maintenanceMode = !!(gd.maintenanceMode)
this.setData({
siteTitle: gd.siteTitle || '神仙团队AI性格测试',
- startButtonEnterprise: (gd.textConfig && gd.textConfig.startButtonEnterprise) || '开始面部测试',
- aiAnalysisText: (gd.textConfig && gd.textConfig.aiAnalysisText) || '智能分析'
+ startButtonEnterprise: maintenanceMode ? '开始性格测试' : ((gd.textConfig && gd.textConfig.startButtonEnterprise) || '开始面部测试'),
+ aiAnalysisText: (gd.textConfig && gd.textConfig.aiAnalysisText) || '智能分析',
+ maintenanceMode
})
},
@@ -154,8 +170,12 @@ Page({
})
},
- // 开始AI面部测试(先校验是否已上传简历,再跳转相机)
+ // 开始AI面部测试(先校验是否已上传简历,再跳转相机);审核模式下直接跳转 test-select
startAITest() {
+ if (this.data.maintenanceMode) {
+ wx.navigateTo({ url: '/pages/test-select/index' })
+ return
+ }
const eid = (app.globalData && app.globalData.enterpriseIdFromScene) || (app.globalData && app.globalData.userInfo && app.globalData.userInfo.enterpriseId) || (wx.getStorageSync('userInfo') || {}).enterpriseId || null
const query = eid ? `?enterpriseId=${eid}&pageSize=1` : '?pageSize=1'
request({
diff --git a/miniprogram/pages/enterprise/index.wxml b/miniprogram/pages/enterprise/index.wxml
index 033a726..c594b79 100644
--- a/miniprogram/pages/enterprise/index.wxml
+++ b/miniprogram/pages/enterprise/index.wxml
@@ -33,13 +33,13 @@
1
STEP1
- 拍摄照片
+ {{maintenanceMode ? '选择测试' : '拍摄照片'}}
2
STEP2
- {{aiAnalysisText || '智能分析'}}
+ {{maintenanceMode ? '回答题目' : (aiAnalysisText || '智能分析')}}
diff --git a/miniprogram/pages/enterprise/index.wxss b/miniprogram/pages/enterprise/index.wxss
index 1617328..11e2d83 100644
--- a/miniprogram/pages/enterprise/index.wxss
+++ b/miniprogram/pages/enterprise/index.wxss
@@ -9,7 +9,8 @@
display: flex;
flex-direction: column;
box-sizing: border-box;
- padding-bottom: calc(100rpx + env(safe-area-inset-bottom) + 40rpx);
+ /* 底部留足空间,避免开始按钮遮挡 tabBar 中间浮起圆钮(上浮 56rpx) */
+ padding-bottom: calc(156rpx + env(safe-area-inset-bottom) + 40rpx);
}
/* 背景装饰圆形 */
diff --git a/miniprogram/pages/index/camera.js b/miniprogram/pages/index/camera.js
index 5420d82..a478794 100644
--- a/miniprogram/pages/index/camera.js
+++ b/miniprogram/pages/index/camera.js
@@ -1,6 +1,6 @@
// pages/index/camera.js - 面相分析拍照页,拍完后上传到服务器再跳转结果页
const app = getApp()
-const { hasPhone, bindPhoneByCode, ensureProfileCompleteAndRedirect } = require('../../utils/phoneAuth.js')
+const { hasPhone, bindPhoneByCode } = require('../../utils/phoneAuth.js')
Page({
data: {
@@ -29,10 +29,8 @@ Page({
},
onShow() {
- if (!ensureProfileCompleteAndRedirect()) return
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- this.getTabBar().setData({ selected: 1 })
- }
+ const tabBar = typeof this.getTabBar === 'function' && this.getTabBar()
+ if (tabBar) tabBar.setData({ selected: 1, maintenanceMode: !!app.globalData.maintenanceMode })
this.setData({ needPhoneAuth: !hasPhone() })
const tc = app.globalData.textConfig
if (tc && tc.aiAnalysisText) {
@@ -115,14 +113,8 @@ Page({
})
},
- // 完成拍照:先上传 3 张图到服务器,拿到 URL 后再跳转结果页
+ // 完成拍照:先上传 3 张图到服务器,拿到 URL 后再跳转结果页(不强制完善资料)
completeCapture() {
- if (!ensureProfileCompleteAndRedirect()) return
- if (!hasPhone()) {
- wx.showToast({ title: '请先授权手机号', icon: 'none' })
- this.setData({ needPhoneAuth: true })
- return
- }
const photos = this.data.photos
if (!photos || photos.length === 0) {
wx.showToast({ title: '请先拍摄照片', icon: 'none' })
diff --git a/miniprogram/pages/index/camera.wxml b/miniprogram/pages/index/camera.wxml
index 259ce7c..1afd3dd 100644
--- a/miniprogram/pages/index/camera.wxml
+++ b/miniprogram/pages/index/camera.wxml
@@ -59,11 +59,4 @@
-
-
- 为保障服务与联系,请先授权手机号。
-
-
diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js
index c89d965..8e30888 100644
--- a/miniprogram/pages/index/index.js
+++ b/miniprogram/pages/index/index.js
@@ -9,7 +9,8 @@ Page({
showEnterpriseEntry: false,
siteTitle: '神仙团队AI性格测试',
startButtonText: '开始面相测试',
- aiAnalysisText: '智能分析'
+ aiAnalysisText: '智能分析',
+ maintenanceMode: false
},
onLoad(options) {
@@ -23,13 +24,15 @@ Page({
const userInfo = getApp().globalData.userInfo || wx.getStorageSync('userInfo') || {}
const gd = getApp().globalData
+ const maintenanceMode = !!(gd.maintenanceMode)
this.setData({
statusBarHeight: statusBarHeightRpx,
navbarHeight: navbarHeightRpx,
showEnterpriseEntry: userInfo.hasEnterprise === true,
siteTitle: gd.siteTitle || '神仙团队AI性格测试',
- startButtonText: (gd.textConfig && gd.textConfig.startButtonText) || '开始面相测试',
- aiAnalysisText: (gd.textConfig && gd.textConfig.aiAnalysisText) || '智能分析'
+ startButtonText: maintenanceMode ? '开始性格测试' : ((gd.textConfig && gd.textConfig.startButtonText) || '开始面相测试'),
+ aiAnalysisText: (gd.textConfig && gd.textConfig.aiAnalysisText) || '智能分析',
+ maintenanceMode
})
// 预加载站点名称与文案配置
app.getRuntimeConfig().then((cfg) => {
@@ -40,11 +43,16 @@ Page({
}
if (cfg.textConfig) {
getApp().globalData.textConfig = cfg.textConfig
- this.setData({
- startButtonText: cfg.textConfig.startButtonText || '开始面相测试',
- aiAnalysisText: cfg.textConfig.aiAnalysisText || '智能分析'
- })
}
+ const maintenanceMode = !!(cfg && cfg.maintenanceMode)
+ if (cfg.maintenanceMode !== undefined) getApp().globalData.maintenanceMode = maintenanceMode
+ this.setData({
+ startButtonText: maintenanceMode ? '开始性格测试' : (cfg.textConfig && cfg.textConfig.startButtonText || '开始面相测试'),
+ aiAnalysisText: (cfg.textConfig && cfg.textConfig.aiAnalysisText) || '智能分析',
+ maintenanceMode
+ })
+ const tabBar = typeof this.getTabBar === 'function' && this.getTabBar()
+ if (tabBar) tabBar.setData({ maintenanceMode })
}
}).catch(() => {})
// ── 解析入参(兼容扫码 scene / 分享链接 options)──
@@ -83,19 +91,20 @@ Page({
},
onShow() {
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- this.getTabBar().setData({ selected: 0 })
- }
+ const tabBar = typeof this.getTabBar === 'function' && this.getTabBar()
+ if (tabBar) tabBar.setData({ selected: 0, maintenanceMode: !!getApp().globalData.maintenanceMode })
// 个人版首页:固定 scope=personal,并清除企业来源上下文
try {
getApp().globalData.appScope = 'personal'
getApp().globalData.enterpriseIdFromScene = null
} catch (e) {}
const gd = getApp().globalData
+ const maintenanceMode = !!(gd.maintenanceMode)
this.setData({
siteTitle: gd.siteTitle || '神仙团队AI性格测试',
- startButtonText: (gd.textConfig && gd.textConfig.startButtonText) || '开始面相测试',
- aiAnalysisText: (gd.textConfig && gd.textConfig.aiAnalysisText) || '智能分析'
+ startButtonText: maintenanceMode ? '开始性格测试' : ((gd.textConfig && gd.textConfig.startButtonText) || '开始面相测试'),
+ aiAnalysisText: (gd.textConfig && gd.textConfig.aiAnalysisText) || '智能分析',
+ maintenanceMode
})
const userInfo = getApp().globalData.userInfo || wx.getStorageSync('userInfo') || {}
this.setData({ showEnterpriseEntry: userInfo.hasEnterprise === true })
@@ -117,9 +126,13 @@ Page({
}
},
- // 开始拍照(个人版入口:强制本次链路为个人定价)
+ // 开始拍照(个人版入口:强制本次链路为个人定价);审核模式下跳转 test-select
startCamera() {
try { getApp().globalData.appScope = 'personal' } catch (e) {}
+ if (this.data.maintenanceMode) {
+ wx.navigateTo({ url: '/pages/test-select/index' })
+ return
+ }
wx.switchTab({
url: '/pages/index/camera'
})
diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml
index 58dfd1f..662ed80 100644
--- a/miniprogram/pages/index/index.wxml
+++ b/miniprogram/pages/index/index.wxml
@@ -33,13 +33,13 @@
1
STEP1
- 拍摄照片
+ {{maintenanceMode ? '选择测试' : '拍摄照片'}}
2
STEP2
- {{aiAnalysisText || '智能分析'}}
+ {{maintenanceMode ? '回答题目' : (aiAnalysisText || '智能分析')}}
@@ -54,8 +54,6 @@
{{startButtonText || '开始面相测试'}}
-
人工智能生成
-
diff --git a/miniprogram/pages/index/index.wxss b/miniprogram/pages/index/index.wxss
index 76bb48e..4747df2 100644
--- a/miniprogram/pages/index/index.wxss
+++ b/miniprogram/pages/index/index.wxss
@@ -9,7 +9,8 @@
display: flex;
flex-direction: column;
box-sizing: border-box;
- padding-bottom: calc(100rpx + env(safe-area-inset-bottom) + 40rpx);
+ /* 底部留足空间,避免开始按钮遮挡 tabBar 中间浮起圆钮(上浮 56rpx) */
+ padding-bottom: calc(156rpx + env(safe-area-inset-bottom) + 40rpx);
}
/* 背景装饰圆形(与企业版一致) */
@@ -260,14 +261,6 @@
font-weight: 600;
}
-.ai-generated-tip {
- text-align: center;
- font-size: 24rpx;
- color: #9CA3AF;
- margin-top: 24rpx;
- margin-bottom: 16rpx;
-}
-
/* 确保底部导航显示 */
custom-tab-bar {
position: fixed;
diff --git a/miniprogram/pages/index/result.js b/miniprogram/pages/index/result.js
index 419239c..c7d9feb 100644
--- a/miniprogram/pages/index/result.js
+++ b/miniprogram/pages/index/result.js
@@ -1,7 +1,7 @@
// pages/index/result.js - AI分析结果页(按旧版模板重构)
const app = getApp()
const payment = require('../../utils/payment')
-const { hasPhone, bindPhoneByCode, ensureProfileCompleteAndRedirect } = require('../../utils/phoneAuth.js')
+const { hasPhone, bindPhoneByCode, isProfileComplete } = require('../../utils/phoneAuth.js')
Page({
data: {
@@ -50,6 +50,7 @@ Page({
hasReloadedAfterPay: false,
// 是否已在本地拥有手机号(决定是否还需要弹出微信手机号授权)
hasPhone: false,
+ isProfileComplete: false,
analyzingTitle: '正在分析中',
reportTitle: '分析报告',
aiAnalysisText: '智能分析'
@@ -134,8 +135,7 @@ Page({
},
onShow() {
- if (!ensureProfileCompleteAndRedirect()) return
- this.setData({ hasPhone: hasPhone() })
+ this.setData({ hasPhone: hasPhone(), isProfileComplete: isProfileComplete() })
const tc = app.globalData.textConfig
if (tc) {
this.setData({
@@ -324,7 +324,8 @@ Page({
requiresPayment: needPay,
isPaid: !!detailPayload.isPaid,
amountYuan: needPay ? amountYuan : 0
- }
+ },
+ isProfileComplete: isProfileComplete()
})
return
}
@@ -363,12 +364,15 @@ Page({
})
},
+ goToCompleteProfile() {
+ wx.navigateTo({ url: '/pages/user-profile/index' })
+ },
+
// 解锁完整报告:发起人脸测试付费
unlockFullReport() {
- const { payInfo, testResultId, hasReloadedAfterPay } = this.data
- if (!payInfo.requiresPayment || payInfo.isPaid) {
- return
- }
+ const { payInfo, testResultId, hasReloadedAfterPay, isProfileComplete } = this.data
+ if (!isProfileComplete) return
+ if (!payInfo.requiresPayment || payInfo.isPaid) return
app.ensureLogin().then((logged) => {
if (!logged) {
@@ -402,14 +406,13 @@ Page({
// AI结果页付费按钮:就地触发微信手机号授权,然后调用 unlockFullReport
onGetPhoneNumberForFacePay(e) {
- if (!ensureProfileCompleteAndRedirect()) return
const { code, errMsg } = e.detail || {}
if (errMsg && errMsg.indexOf('getPhoneNumber:fail') === 0) {
- if (!hasPhone()) {
+ if (hasPhone()) {
+ this.unlockFullReport()
+ } else {
wx.showToast({ title: '需要授权手机号才能继续', icon: 'none' })
- return
}
- this.unlockFullReport()
return
}
if (!code) {
diff --git a/miniprogram/pages/index/result.wxml b/miniprogram/pages/index/result.wxml
index a81af27..88c26a5 100644
--- a/miniprogram/pages/index/result.wxml
+++ b/miniprogram/pages/index/result.wxml
@@ -111,36 +111,45 @@
-
-
+
+
完整版性格深度解析
解锁后将展示完整报告内容
-
-
-
-
- 一次性解锁本次{{reportTitle || '分析报告'}},永久保存在「历史记录」中
+ 完善资料
+
+
+
+
+
+ 解锁完整报告
+ ¥{{payInfo.amountYuan || 0}} / 次
+
+
+ 一次性解锁本次{{reportTitle || '分析报告'}},永久保存在「历史记录」中
-
+
@@ -298,7 +307,5 @@
返回首页
-
- 人工智能生成
diff --git a/miniprogram/pages/index/result.wxss b/miniprogram/pages/index/result.wxss
index 21131fc..2efea3f 100644
--- a/miniprogram/pages/index/result.wxss
+++ b/miniprogram/pages/index/result.wxss
@@ -670,14 +670,6 @@
color: #374151;
}
-.ai-generated-tip {
- text-align: center;
- font-size: 24rpx;
- color: #9CA3AF;
- margin-top: 24rpx;
- padding-bottom: 40rpx;
-}
-
/* ========== 操作按钮 ========== */
.action-section {
margin-top: 16rpx;
diff --git a/miniprogram/pages/index/upload.js b/miniprogram/pages/index/upload.js
index 6287649..bd76190 100644
--- a/miniprogram/pages/index/upload.js
+++ b/miniprogram/pages/index/upload.js
@@ -1,6 +1,6 @@
// pages/index/camera.js - 面相分析拍照页,拍完后上传到服务器再跳转结果页
const app = getApp()
-const { hasPhone, bindPhoneByCode, ensureProfileCompleteAndRedirect } = require('../../utils/phoneAuth.js')
+const { hasPhone, bindPhoneByCode } = require('../../utils/phoneAuth.js')
Page({
data: {
@@ -34,7 +34,6 @@ Page({
},
onShow() {
- if (!ensureProfileCompleteAndRedirect()) return
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({ selected: 1 })
}
@@ -163,9 +162,8 @@ Page({
})
},
- // 完成拍照:先上传 3 张图到服务器,拿到 URL 后再跳转结果页
+ // 完成拍照:先上传 3 张图到服务器,拿到 URL 后再跳转结果页(不强制完善资料)
completeCapture() {
- if (!ensureProfileCompleteAndRedirect()) return
const urls = (this.data.uploadedUrls || []).filter(Boolean)
if (!urls.length) {
wx.showToast({ title: '请先上传至少一张照片', icon: 'none' })
diff --git a/miniprogram/pages/profile/index.js b/miniprogram/pages/profile/index.js
index 2608062..b55c913 100644
--- a/miniprogram/pages/profile/index.js
+++ b/miniprogram/pages/profile/index.js
@@ -50,9 +50,8 @@ Page({
this.loadData()
}
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- this.getTabBar().setData({ selected: 2 })
- }
+ const tabBar = typeof this.getTabBar === 'function' && this.getTabBar()
+ if (tabBar) tabBar.setData({ selected: 2, maintenanceMode: !!app.globalData.maintenanceMode })
},
/** 先确保登录完成(静默登录),再刷新页面数据 */
diff --git a/miniprogram/pages/purchase/index.js b/miniprogram/pages/purchase/index.js
index ee6cb7b..f0ea413 100644
--- a/miniprogram/pages/purchase/index.js
+++ b/miniprogram/pages/purchase/index.js
@@ -1,7 +1,7 @@
// pages/purchase/index.js - 开通会员(深度服务价格:个人/企业区分,类目由后端配置可新增)
const app = getApp()
const payment = require('../../utils/payment')
-const { hasPhone, bindPhoneByCode, ensureProfileCompleteAndRedirect } = require('../../utils/phoneAuth.js')
+const { hasPhone, bindPhoneByCode } = require('../../utils/phoneAuth.js')
Page({
data: {
@@ -27,7 +27,6 @@ Page({
},
onShow() {
- if (!ensureProfileCompleteAndRedirect()) return
this.setData({ hasPhone: hasPhone() })
},
@@ -82,9 +81,8 @@ Page({
this.handlePurchase(tab, index)
},
- // 实际执行购买/咨询逻辑(已确保有手机号)
+ // 实际执行购买/咨询逻辑(不强制完善资料)
handlePurchase(tab, index) {
- if (!ensureProfileCompleteAndRedirect()) return
if (index === undefined || index === null) return
const list = tab === 'enterprise' ? this.data.enterpriseCategories : this.data.personalCategories
const category = list[index]
diff --git a/miniprogram/pages/result/disc.js b/miniprogram/pages/result/disc.js
index 301dfb7..2e48138 100644
--- a/miniprogram/pages/result/disc.js
+++ b/miniprogram/pages/result/disc.js
@@ -1,6 +1,7 @@
// pages/result/disc.js - DISC结果页(支持付费墙 + 历史详情拉取)
const app = getApp()
const payment = require('../../utils/payment')
+const { isProfileComplete } = require('../../utils/phoneAuth.js')
function toIntPercent(v) {
if (v == null) return 0
@@ -32,7 +33,14 @@ Page({
],
payInfo: { requiresPayment: false, isPaid: false, amountYuan: 0 },
testResultId: null,
- hasReloadedAfterPay: false
+ hasReloadedAfterPay: false,
+ isProfileComplete: false,
+ maintenanceMode: false
+ },
+
+ onShow() {
+ const maintenanceMode = !!(getApp().globalData && getApp().globalData.maintenanceMode)
+ this.setData({ isProfileComplete: isProfileComplete(), maintenanceMode })
},
onLoad(options) {
@@ -77,7 +85,8 @@ Page({
isPaid,
amountYuan: needPaymentToUnlock ? amountYuan : 0
}
- this.setData({ payInfo })
+ const maintenanceMode = !!(getApp().globalData && getApp().globalData.maintenanceMode)
+ this.setData({ payInfo, isProfileComplete: isProfileComplete(), maintenanceMode })
} else {
wx.showToast({ title: res.data?.message || '加载失败', icon: 'none' })
}
@@ -101,8 +110,13 @@ Page({
.catch(() => this.setData({ payInfo: { requiresPayment: false, isPaid: false, amountYuan: 0 } }))
},
+ goToCompleteProfile() {
+ wx.navigateTo({ url: '/pages/user-profile/index' })
+ },
+
unlockFullReport() {
- const { payInfo, testResultId, hasReloadedAfterPay } = this.data
+ const { payInfo, testResultId, hasReloadedAfterPay, isProfileComplete } = this.data
+ if (!isProfileComplete) return
if (!payInfo.requiresPayment || payInfo.isPaid) return
app.ensureLogin && app.ensureLogin().then((logged) => {
if (!logged) { wx.showToast({ title: '请先登录', icon: 'none' }); return }
diff --git a/miniprogram/pages/result/disc.wxml b/miniprogram/pages/result/disc.wxml
index a3a7797..dca2692 100644
--- a/miniprogram/pages/result/disc.wxml
+++ b/miniprogram/pages/result/disc.wxml
@@ -9,7 +9,7 @@
{{result.description.description}}
-
+
完整DISC报告
@@ -18,14 +18,25 @@
• 职业匹配建议
-
+
+ 完善资料
+
+
解锁完整报告
¥{{payInfo.amountYuan}} / 次
-
+
DISC得分详情
-
+
主要性格特征分析
优势
@@ -57,7 +68,7 @@
-
+
职业匹配度分析
diff --git a/miniprogram/pages/result/mbti.js b/miniprogram/pages/result/mbti.js
index a921b35..70551e6 100644
--- a/miniprogram/pages/result/mbti.js
+++ b/miniprogram/pages/result/mbti.js
@@ -1,7 +1,7 @@
// pages/result/mbti.js - MBTI结果页(支持付费墙 + 历史详情拉取)
const app = getApp()
const payment = require('../../utils/payment')
-const { hasPhone, bindPhoneByCode, ensureProfileCompleteAndRedirect } = require('../../utils/phoneAuth.js')
+const { hasPhone, bindPhoneByCode, isProfileComplete } = require('../../utils/phoneAuth.js')
Page({
data: {
@@ -22,7 +22,9 @@ Page({
},
testResultId: null,
hasReloadedAfterPay: false,
- hasPhone: false
+ hasPhone: false,
+ isProfileComplete: false,
+ maintenanceMode: false
},
onLoad(options) {
@@ -46,8 +48,8 @@ Page({
},
onShow() {
- if (!ensureProfileCompleteAndRedirect()) return
- this.setData({ hasPhone: hasPhone() })
+ const maintenanceMode = !!(getApp().globalData && getApp().globalData.maintenanceMode)
+ this.setData({ hasPhone: hasPhone(), isProfileComplete: isProfileComplete(), maintenanceMode })
},
loadDetail(id) {
@@ -77,7 +79,8 @@ Page({
isPaid,
amountYuan: needPaymentToUnlock ? amountYuan : 0
}
- this.setData({ payInfo })
+ const maintenanceMode = !!(getApp().globalData && getApp().globalData.maintenanceMode)
+ this.setData({ payInfo, isProfileComplete: isProfileComplete(), maintenanceMode })
} else {
wx.showToast({ title: res.data?.message || '加载失败', icon: 'none' })
}
@@ -157,16 +160,20 @@ Page({
})
},
+ // 完善资料:用户点击后手动跳转,不强制
+ goToCompleteProfile() {
+ wx.navigateTo({ url: '/pages/user-profile/index' })
+ },
+
// 付费解锁按钮:就地触发微信手机号授权,然后调用 unlockFullReport
onGetPhoneNumberForMbtiPay(e) {
- if (!ensureProfileCompleteAndRedirect()) return
const { code, errMsg } = e.detail || {}
if (errMsg && errMsg.indexOf('getPhoneNumber:fail') === 0) {
- if (!hasPhone()) {
+ if (hasPhone()) {
+ this.unlockFullReport()
+ } else {
wx.showToast({ title: '需要授权手机号才能继续', icon: 'none' })
- return
}
- this.unlockFullReport()
return
}
if (!code) {
diff --git a/miniprogram/pages/result/mbti.wxml b/miniprogram/pages/result/mbti.wxml
index 8c3932e..fee9687 100644
--- a/miniprogram/pages/result/mbti.wxml
+++ b/miniprogram/pages/result/mbti.wxml
@@ -10,8 +10,8 @@
{{mbtiDesc.description}}
-
-
+
+
完整性格分析
@@ -20,29 +20,38 @@
• 职业匹配与人际关系建议
-
-
-
-
+ 完善资料
+
+
+
+
+
+ 解锁完整报告
+ ¥{{payInfo.amountYuan}} / 次
+
+
-
+
{{item.left}}
@@ -59,7 +68,7 @@
-
+
性格特征分析
优势
@@ -78,7 +87,7 @@
-
+
职业匹配度分析
@@ -86,7 +95,7 @@
-
+
人际关系分析
{{mbtiDesc.relationships}}
diff --git a/miniprogram/pages/result/pdp.js b/miniprogram/pages/result/pdp.js
index 51ae737..f5860c6 100644
--- a/miniprogram/pages/result/pdp.js
+++ b/miniprogram/pages/result/pdp.js
@@ -1,6 +1,7 @@
// pages/result/pdp.js - PDP结果页(支持付费墙 + 历史详情拉取)
const app = getApp()
const payment = require('../../utils/payment')
+const { isProfileComplete } = require('../../utils/phoneAuth.js')
const PDP_KEYS = ['Tiger', 'Peacock', 'Koala', 'Owl', 'Chameleon']
@@ -32,7 +33,14 @@ Page({
],
payInfo: { requiresPayment: false, isPaid: false, amountYuan: 0 },
testResultId: null,
- hasReloadedAfterPay: false
+ hasReloadedAfterPay: false,
+ isProfileComplete: false,
+ maintenanceMode: false
+ },
+
+ onShow() {
+ const maintenanceMode = !!(getApp().globalData && getApp().globalData.maintenanceMode)
+ this.setData({ isProfileComplete: isProfileComplete(), maintenanceMode })
},
onLoad(options) {
@@ -77,7 +85,8 @@ Page({
isPaid,
amountYuan: needPaymentToUnlock ? amountYuan : 0
}
- this.setData({ payInfo })
+ const maintenanceMode = !!(getApp().globalData && getApp().globalData.maintenanceMode)
+ this.setData({ payInfo, isProfileComplete: isProfileComplete(), maintenanceMode })
} else {
wx.showToast({ title: res.data?.message || '加载失败', icon: 'none' })
}
@@ -101,8 +110,13 @@ Page({
.catch(() => this.setData({ payInfo: { requiresPayment: false, isPaid: false, amountYuan: 0 } }))
},
+ goToCompleteProfile() {
+ wx.navigateTo({ url: '/pages/user-profile/index' })
+ },
+
unlockFullReport() {
- const { payInfo, testResultId, hasReloadedAfterPay } = this.data
+ const { payInfo, testResultId, hasReloadedAfterPay, isProfileComplete } = this.data
+ if (!isProfileComplete) return
if (!payInfo.requiresPayment || payInfo.isPaid) return
app.ensureLogin && app.ensureLogin().then((logged) => {
if (!logged) { wx.showToast({ title: '请先登录', icon: 'none' }); return }
diff --git a/miniprogram/pages/result/pdp.wxml b/miniprogram/pages/result/pdp.wxml
index 523da7d..f528d0a 100644
--- a/miniprogram/pages/result/pdp.wxml
+++ b/miniprogram/pages/result/pdp.wxml
@@ -10,7 +10,7 @@
{{result.description.description}}
-
+
完整PDP报告
@@ -19,14 +19,25 @@
• 推荐职业
-
+
+ 完善资料
+
+
解锁完整报告
¥{{payInfo.amountYuan}} / 次
-
+
PDP得分详情
-
+
性格特征
优势
@@ -58,12 +69,12 @@
-
+
团队角色
{{result.description.teamRole}}
-
+
推荐职业