审核模式优化
This commit is contained in:
@@ -58,8 +58,8 @@ App({
|
||||
defaultEnterpriseId: null,
|
||||
// API 基础地址:默认走线上;本机/内网调试可在开发者工具执行
|
||||
// wx.setStorageSync('apiBaseOverride', 'https://你的调试域名') 后重启小程序
|
||||
//apiBase: 'https://mbtiapi.quwanzhi.com',
|
||||
apiBase: 'http://mbti.com',
|
||||
apiBase: 'https://mbtiapi.quwanzhi.com',
|
||||
//apiBase: 'http://mbti.com',
|
||||
// VIP信息
|
||||
vipInfo: null,
|
||||
// 测试次数
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// 自定义 TabBar:完全由后台配置驱动
|
||||
// 数据来源:app.globalData.tabBar.items(GET /api/mp/tabbar)
|
||||
// 兜底:首页 · 拍摄(第2项凸起) · 神仙AI · 我
|
||||
// 兜底(无后台配置或不足 2 项时):仅首页 + 我;拍摄 / 神仙 AI 默认不展示,由超管 TabBar 配置显式开启
|
||||
|
||||
const { isAuditHideAiMode, shouldHideTabBarHighlightFab } = require('../utils/miniprogramAuditGate.js')
|
||||
|
||||
const DEFAULT_ITEMS = [
|
||||
{ pagePath: 'pages/index/index', text: '首页', iconKey: 'home', iconUrl: '', highlight: false },
|
||||
{ pagePath: 'pages/index/camera', text: '拍摄', iconKey: 'camera', iconUrl: '', highlight: true },
|
||||
{ pagePath: 'pages/ai-chat/index', text: '神仙AI', iconKey: 'ai', iconUrl: '', iconUrlActive: '', highlight: false },
|
||||
{ pagePath: 'pages/profile/index', text: '我', iconKey: 'profile', iconUrl: '', highlight: false }
|
||||
]
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
const gaokaoApi = require('../../utils/gaokao')
|
||||
const app = getApp()
|
||||
const { isAuditHideAiMode, redirectIfMiniprogramAudit } = require('../../utils/miniprogramAuditGate.js')
|
||||
|
||||
/** 科类/选科备选项:首项为占位,不可作为有效保存值 */
|
||||
const SUBJECT_PLACEHOLDER = '请选择科类/选科'
|
||||
@@ -119,7 +121,18 @@ Page({
|
||||
|
||||
/** 每次页面展示拉取(含从上级页返回),避免栈内页面不触发 onLoad 时看不到已保存内容 */
|
||||
onShow() {
|
||||
this.loadFormFromServer()
|
||||
const run = () => {
|
||||
if (isAuditHideAiMode(app.globalData)) {
|
||||
redirectIfMiniprogramAudit('版本审核中暂不可用')
|
||||
return
|
||||
}
|
||||
this.loadFormFromServer()
|
||||
}
|
||||
if (app.getRuntimeConfig) {
|
||||
app.getRuntimeConfig().finally(run)
|
||||
} else {
|
||||
run()
|
||||
}
|
||||
},
|
||||
|
||||
loadFormFromServer() {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
const gaokaoApi = require('../../utils/gaokao')
|
||||
const app = getApp()
|
||||
const { isAuditHideAiMode, redirectIfMiniprogramAudit } = require('../../utils/miniprogramAuditGate.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -16,7 +18,18 @@ Page({
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.refreshStatus()
|
||||
const run = () => {
|
||||
if (isAuditHideAiMode(app.globalData)) {
|
||||
redirectIfMiniprogramAudit('版本审核中暂不可用')
|
||||
return
|
||||
}
|
||||
this.refreshStatus()
|
||||
}
|
||||
if (app.getRuntimeConfig) {
|
||||
app.getRuntimeConfig().finally(run)
|
||||
} else {
|
||||
run()
|
||||
}
|
||||
},
|
||||
|
||||
refreshStatus() {
|
||||
|
||||
@@ -13,6 +13,7 @@ const inviteCodeGate = require('../../utils/inviteCodeGate.js')
|
||||
const { openTimelineShareHint } = require('../../utils/resultProfileGate.js')
|
||||
const { computeJourney, markShared } = require('../../utils/gaokaoJourneyState.js')
|
||||
const { getEnterpriseIdForApiPayload } = require('../../utils/enterpriseContext.js')
|
||||
const { isAuditHideAiMode, redirectIfMiniprogramAudit } = require('../../utils/miniprogramAuditGate.js')
|
||||
|
||||
/** GET /api/test/detail | share-detail 返回体 -> mergeApiReport 入参 */
|
||||
function mapTestDetailToReportPayload(detail) {
|
||||
@@ -241,55 +242,60 @@ Page({
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
try {
|
||||
wx.showShareMenu({ withShareTicket: true, menus: ['shareAppMessage', 'shareTimeline'] })
|
||||
} catch (e) {}
|
||||
const bootstrap = () => {
|
||||
if (isAuditHideAiMode(app.globalData)) {
|
||||
redirectIfMiniprogramAudit('版本审核中暂不可用')
|
||||
return
|
||||
}
|
||||
try {
|
||||
wx.showShareMenu({ withShareTicket: true, menus: ['shareAppMessage', 'shareTimeline'] })
|
||||
} catch (e) {}
|
||||
|
||||
const fromShareFs = options && (String(options.fs) === '1' || options.from === 'share')
|
||||
const sid = options && options.id != null && options.id !== '' ? String(options.id) : ''
|
||||
const st = options && options.st ? String(options.st).trim() : ''
|
||||
const fromShareFs = options && (String(options.fs) === '1' || options.from === 'share')
|
||||
const sid = options && options.id != null && options.id !== '' ? String(options.id) : ''
|
||||
const st = options && options.st ? String(options.st).trim() : ''
|
||||
|
||||
if (sid && st) {
|
||||
this.setData({ fromShare: true })
|
||||
this.loadShareDetail(sid, st)
|
||||
return
|
||||
if (sid && st) {
|
||||
this.setData({ fromShare: true })
|
||||
this.loadShareDetail(sid, st)
|
||||
return
|
||||
}
|
||||
|
||||
const ec =
|
||||
typeof this.getOpenerEventChannel === 'function' ? this.getOpenerEventChannel() : null
|
||||
if (ec && typeof ec.once === 'function') {
|
||||
ec.once('gaokaoAnalyzeReport', (payload) => {
|
||||
if (payload && payload.report) {
|
||||
this.applyPayloadOnly({
|
||||
id: payload.id,
|
||||
createdAt: payload.createdAt || 0,
|
||||
overview: payload.overview || '',
|
||||
report: payload.report
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const pendingAnalyze = options && String(options.pendingAnalyze) === '1'
|
||||
if (pendingAnalyze) {
|
||||
// 等 runtime 后再跑;用微任务启动分析,避免原 onReady 与异步 onLoad 竞态
|
||||
setTimeout(() => this.beginAnalyzeFlow(), 0)
|
||||
return
|
||||
}
|
||||
|
||||
const rid = options && options.id != null ? parseInt(String(options.id), 10) : 0
|
||||
this._detailReportId = rid > 0 && !Number.isNaN(rid) ? rid : 0
|
||||
if (fromShareFs) {
|
||||
this.setData({ fromShare: true })
|
||||
}
|
||||
|
||||
const delay = options && options.fromAnalyze === '1' ? 400 : 0
|
||||
setTimeout(() => this.load(), delay)
|
||||
}
|
||||
|
||||
const ec =
|
||||
typeof this.getOpenerEventChannel === 'function' ? this.getOpenerEventChannel() : null
|
||||
if (ec && typeof ec.once === 'function') {
|
||||
ec.once('gaokaoAnalyzeReport', (payload) => {
|
||||
if (payload && payload.report) {
|
||||
this.applyPayloadOnly({
|
||||
id: payload.id,
|
||||
createdAt: payload.createdAt || 0,
|
||||
overview: payload.overview || '',
|
||||
report: payload.report
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const pendingAnalyze = options && String(options.pendingAnalyze) === '1'
|
||||
if (pendingAnalyze) {
|
||||
this._pendingAnalyze = true
|
||||
return
|
||||
}
|
||||
|
||||
const rid = options && options.id != null ? parseInt(String(options.id), 10) : 0
|
||||
this._detailReportId = rid > 0 && !Number.isNaN(rid) ? rid : 0
|
||||
if (fromShareFs) {
|
||||
this.setData({ fromShare: true })
|
||||
}
|
||||
|
||||
const delay = options && options.fromAnalyze === '1' ? 400 : 0
|
||||
setTimeout(() => this.load(), delay)
|
||||
},
|
||||
|
||||
onReady() {
|
||||
if (this._pendingAnalyze) {
|
||||
this._pendingAnalyze = false
|
||||
this.beginAnalyzeFlow()
|
||||
if (app.getRuntimeConfig) {
|
||||
app.getRuntimeConfig().then(bootstrap).catch(bootstrap)
|
||||
} else {
|
||||
bootstrap()
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// pages/history/index.js - 测试历史记录(一次拉取全部,时间行右侧展示企业名)
|
||||
const app = getApp()
|
||||
const { getEffectiveEnterpriseId } = require('../../utils/enterpriseContext.js')
|
||||
const { isAuditHideAiMode } = require('../../utils/miniprogramAuditGate.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -106,7 +107,10 @@ Page({
|
||||
if (res.statusCode === 200 && res.data && res.data.data) {
|
||||
const payload = res.data.data
|
||||
const rawList = payload.list || []
|
||||
const formatted = this.formatList(rawList)
|
||||
let formatted = this.formatList(rawList)
|
||||
if (isAuditHideAiMode(app.globalData)) {
|
||||
formatted = formatted.filter((it) => String(it.type || it.testType || '').toLowerCase() !== 'gaokao')
|
||||
}
|
||||
const total = typeof payload.total === 'number' ? payload.total : formatted.length
|
||||
const hasMore = !!payload.hasMore
|
||||
if (append) {
|
||||
|
||||
@@ -9,8 +9,10 @@ Page({
|
||||
permSbti: true,
|
||||
permPdp: true,
|
||||
permDisc: true,
|
||||
/** 高考志愿任务中心;企业关闭 gaokao 时隐藏 */
|
||||
/** 高考志愿任务中心;企业关闭 gaokao 或审核/提审时隐藏 */
|
||||
permGaokao: true,
|
||||
/** 与 permAiHub 同源:用于简介文案不提及高考/神仙 AI */
|
||||
auditHideAiFeatures: false,
|
||||
/** AI 对话(神仙 AI);企业关闭 aiHub 时隐藏 */
|
||||
permAiHub: true,
|
||||
/** 四类问卷入口均被企业权限关闭时提示 */
|
||||
@@ -45,7 +47,7 @@ Page({
|
||||
const permSbti = !p || p.sbti !== false
|
||||
const permPdp = !p || p.pdp !== false
|
||||
const permDisc = !p || p.disc !== false
|
||||
const permGaokao = !p || p.gaokao !== false
|
||||
const permGaokao = (!p || p.gaokao !== false) && !hideAi
|
||||
const permAiHub = (!p || p.aiHub !== false) && !hideAi
|
||||
this.setData({
|
||||
permFace,
|
||||
@@ -55,6 +57,7 @@ Page({
|
||||
permDisc,
|
||||
permGaokao,
|
||||
permAiHub,
|
||||
auditHideAiFeatures: hideAi,
|
||||
allTestsDisabled: p && !permMbti && !permSbti && !permPdp && !permDisc && !permGaokao
|
||||
})
|
||||
},
|
||||
@@ -84,6 +87,10 @@ Page({
|
||||
},
|
||||
|
||||
goGaokaoHub() {
|
||||
if (isAuditHideAiMode(app.globalData)) {
|
||||
wx.showToast({ title: '版本审核中暂不可用', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!this.data.permGaokao) {
|
||||
wx.showToast({ title: '当前企业未开放高考志愿功能', icon: 'none' })
|
||||
return
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<view class="container">
|
||||
<view class="card intro-card">
|
||||
<text class="intro-title">选择一项详细性格测试</text>
|
||||
<text class="intro-desc">问卷测评、高考志愿规划与 AI 对话 / 拍照面相分项进入,完成后可获得对应报告</text>
|
||||
<text class="intro-desc" wx:if="{{auditHideAiFeatures}}">问卷测评与拍照面相分项进入,完成后可获得对应报告</text>
|
||||
<text class="intro-desc" wx:else>问卷测评、高考志愿规划与 AI 对话 / 拍照面相分项进入,完成后可获得对应报告</text>
|
||||
</view>
|
||||
|
||||
<view class="card entry-card" bindtap="goMBTI" wx:if="{{permMbti}}">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* 超管审核相关:隐藏神仙 AI Tab/入口;提审模式下另由后端/各页关闭虚拟商品与「了解自己」深度套餐。
|
||||
* - miniprogramAuditMode:提审专用(含虚拟支付合规)
|
||||
* - maintenanceMode / reviewMode:面相审核(用户口语「审核模式」常指其一)
|
||||
* - 高考志愿:与 isAuditHideAiMode 一致时在 test-select 隐藏入口,高考各页跳转回首页;后端见 audit_mode_blocks_gaokao_api
|
||||
*/
|
||||
|
||||
/** 临时:为 true 时在客户端忽略审核/提审隐藏逻辑。平时必须为 false,由 runtime 与后端 miniprogramAuditMode 等决定展示 */
|
||||
|
||||
Reference in New Issue
Block a user