支持设置默认企业
This commit is contained in:
@@ -13,6 +13,8 @@ App({
|
||||
appScope: 'personal',
|
||||
// 扫码进入企业页时 scene 解析出的企业ID(e_123),提交测试/分析时优先使用
|
||||
enterpriseIdFromScene: null,
|
||||
// 超管配置的默认企业 ID(无 scene/eid 等入口参数时回落)
|
||||
defaultEnterpriseId: null,
|
||||
// API基础地址(开发时用本地,生产环境替换为实际域名)
|
||||
apiBase: 'https://mbtiapi.quwanzhi.com',
|
||||
//apiBase: 'http://mbti.com',
|
||||
@@ -41,6 +43,11 @@ App({
|
||||
if (cfg) {
|
||||
if (cfg.siteTitle) this.globalData.siteTitle = cfg.siteTitle
|
||||
if (cfg.maintenanceMode !== undefined) this.globalData.maintenanceMode = !!cfg.maintenanceMode
|
||||
if (cfg.defaultEnterpriseId != null && Number(cfg.defaultEnterpriseId) > 0) {
|
||||
this.globalData.defaultEnterpriseId = Number(cfg.defaultEnterpriseId)
|
||||
} else {
|
||||
this.globalData.defaultEnterpriseId = null
|
||||
}
|
||||
}
|
||||
}).catch(() => {})
|
||||
},
|
||||
@@ -275,20 +282,16 @@ App({
|
||||
})
|
||||
},
|
||||
|
||||
// 保存测试结果
|
||||
// 保存测试结果
|
||||
saveTestResult(type, result) {
|
||||
const { getEnterpriseIdForApiPayload } = require('./utils/enterpriseContext.js')
|
||||
const key = `${type}Result`
|
||||
wx.setStorageSync(key, result)
|
||||
this.globalData[key] = result
|
||||
|
||||
// 同步到服务器(需携带 token,后端从 JWT 解析 userId)
|
||||
if (this.globalData.token) {
|
||||
const scope = this.globalData.appScope || 'personal'
|
||||
const storedUser = wx.getStorageSync('userInfo') || null
|
||||
const enterpriseId =
|
||||
scope === 'enterprise'
|
||||
? (this.globalData.enterpriseIdFromScene || (this.globalData.userInfo && this.globalData.userInfo.enterpriseId) || (storedUser && storedUser.enterpriseId) || null)
|
||||
: null
|
||||
const enterpriseId = getEnterpriseIdForApiPayload()
|
||||
wx.request({
|
||||
url: `${this.globalData.apiBase}/api/test/submit`,
|
||||
method: 'POST',
|
||||
@@ -301,7 +304,7 @@ App({
|
||||
answers: result.answers || [],
|
||||
result: result,
|
||||
userId: this.globalData.userInfo?.id ?? this.globalData.openId,
|
||||
enterpriseId: enterpriseId || undefined,
|
||||
enterpriseId: enterpriseId != null ? enterpriseId : undefined,
|
||||
testDuration: result.testDuration || 0,
|
||||
timestamp: new Date().toISOString()
|
||||
}
|
||||
@@ -335,6 +338,11 @@ App({
|
||||
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
|
||||
if (data.defaultEnterpriseId != null && Number(data.defaultEnterpriseId) > 0) {
|
||||
this.globalData.defaultEnterpriseId = Number(data.defaultEnterpriseId)
|
||||
} else {
|
||||
this.globalData.defaultEnterpriseId = null
|
||||
}
|
||||
resolve(data)
|
||||
} else {
|
||||
reject(new Error(res.data && res.data.message ? res.data.message : '获取配置失败'))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// pages/enterprise/index.js - 企业版首页
|
||||
const app = getApp()
|
||||
const { request } = require('../../utils/request')
|
||||
const { getEffectiveEnterpriseId } = require('../../utils/enterpriseContext.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -70,9 +71,9 @@ Page({
|
||||
maintenanceMode
|
||||
})
|
||||
|
||||
// 未绑定企业的用户:若从邀请码扫码进入(有 enterpriseIdFromScene)也允许使用企业版
|
||||
// 未绑定企业的用户:扫码带 eid 或超管配置了默认企业时也允许使用企业版
|
||||
const userInfo = app.globalData.userInfo || wx.getStorageSync('userInfo') || {}
|
||||
const fromInvite = !!app.globalData.enterpriseIdFromScene
|
||||
const fromInvite = !!app.globalData.enterpriseIdFromScene || !!(app.globalData.defaultEnterpriseId && Number(app.globalData.defaultEnterpriseId) > 0)
|
||||
const redirectBack = () => {
|
||||
wx.showToast({ title: '您尚未绑定任何企业,无法使用企业版', icon: 'none', duration: 2500 })
|
||||
setTimeout(() => wx.switchTab({ url: '/pages/index/index' }), 600)
|
||||
@@ -119,7 +120,7 @@ Page({
|
||||
maintenanceMode
|
||||
})
|
||||
}
|
||||
if ((cfg && cfg.pricingType) !== 'enterprise' && !app.globalData.enterpriseIdFromScene) {
|
||||
if ((cfg && cfg.pricingType) !== 'enterprise' && !app.globalData.enterpriseIdFromScene && !(app.globalData.defaultEnterpriseId && Number(app.globalData.defaultEnterpriseId) > 0)) {
|
||||
redirectBack()
|
||||
return
|
||||
}
|
||||
@@ -176,7 +177,7 @@ Page({
|
||||
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 eid = getEffectiveEnterpriseId()
|
||||
const query = eid ? `?enterpriseId=${eid}&pageSize=1` : '?pageSize=1'
|
||||
request({
|
||||
url: '/api/enterprise/resume-uploads' + query,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// pages/enterprise/resume-history.js - 简历上传记录(历史)
|
||||
const app = getApp()
|
||||
const { getEffectiveEnterpriseId } = require('../../utils/enterpriseContext.js')
|
||||
const { request } = require('../../utils/request')
|
||||
|
||||
Page({
|
||||
@@ -21,7 +22,7 @@ Page({
|
||||
|
||||
loadList() {
|
||||
this.setData({ loading: true })
|
||||
const eid = (app.globalData && app.globalData.enterpriseIdFromScene) || (app.globalData && app.globalData.userInfo && app.globalData.userInfo.enterpriseId) || (wx.getStorageSync('userInfo') || {}).enterpriseId || null
|
||||
const eid = getEffectiveEnterpriseId()
|
||||
const query = eid ? `?enterpriseId=${eid}&pageSize=100` : '?pageSize=100'
|
||||
request({
|
||||
url: '/api/enterprise/resume-uploads' + query,
|
||||
@@ -48,7 +49,7 @@ Page({
|
||||
},
|
||||
|
||||
uploadResume() {
|
||||
const eid = (app.globalData && app.globalData.enterpriseIdFromScene) || (app.globalData && app.globalData.userInfo && app.globalData.userInfo.enterpriseId) || (wx.getStorageSync('userInfo') || {}).enterpriseId || null
|
||||
const eid = getEffectiveEnterpriseId()
|
||||
wx.chooseMessageFile({
|
||||
count: 1,
|
||||
type: 'file',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// pages/history/index.js - 测试历史记录(一次拉取全部,时间行右侧展示企业名)
|
||||
const app = getApp()
|
||||
const { getEffectiveEnterpriseId } = require('../../utils/enterpriseContext.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -15,10 +16,7 @@ Page({
|
||||
const gd = app.globalData || {}
|
||||
const storedUser = wx.getStorageSync('userInfo') || null
|
||||
const scope = gd.appScope || 'personal'
|
||||
const enterpriseId = gd.enterpriseIdFromScene
|
||||
|| (gd.userInfo && gd.userInfo.enterpriseId)
|
||||
|| (storedUser && storedUser.enterpriseId)
|
||||
|| null
|
||||
const enterpriseId = getEffectiveEnterpriseId()
|
||||
return scope === 'enterprise' || !!enterpriseId
|
||||
},
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
const app = getApp()
|
||||
const payment = require('../../utils/payment')
|
||||
const { hasPhone, bindPhoneByCode, isProfileComplete } = require('../../utils/phoneAuth.js')
|
||||
const { getEnterpriseIdForApiPayload } = require('../../utils/enterpriseContext.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -182,12 +183,8 @@ Page({
|
||||
this.setData({ progress: Math.floor(progress), analyzingTip: tips[tipIndex] })
|
||||
}, 200)
|
||||
|
||||
// 调用后端API:appScope='enterprise' 时才传 enterpriseId,个人版不传
|
||||
const userInfo = app.globalData.userInfo || wx.getStorageSync('userInfo') || {}
|
||||
const scope = (app.globalData && app.globalData.appScope) || 'personal'
|
||||
const enterpriseId = scope === 'enterprise'
|
||||
? (app.globalData.enterpriseIdFromScene || userInfo.enterpriseId || null)
|
||||
: null
|
||||
// 个人版入口不带企业参数;企业版才回落绑定/默认企业
|
||||
const enterpriseId = getEnterpriseIdForApiPayload()
|
||||
wx.request({
|
||||
url: `${app.globalData.apiBase}/api/analyze`,
|
||||
method: 'POST',
|
||||
@@ -198,7 +195,7 @@ Page({
|
||||
data: {
|
||||
photoUrls: photos,
|
||||
userId: app.globalData.openId || '',
|
||||
...(enterpriseId ? { enterpriseId: Number(enterpriseId) } : {})
|
||||
...(enterpriseId != null ? { enterpriseId: Number(enterpriseId) } : {})
|
||||
},
|
||||
success: (res) => {
|
||||
clearInterval(timer)
|
||||
|
||||
@@ -53,98 +53,108 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 性格类型分析卡片 -->
|
||||
<view class="card personality-card" wx:if="{{!hasError}}">
|
||||
<text class="card-title">性格类型分析</text>
|
||||
<!-- 报告预览区:未解锁时整区加盖高遮罩,避免概述/盖洛普等全文外露 -->
|
||||
<view class="report-gate-wrap" wx:if="{{!hasError}}">
|
||||
<view
|
||||
class="card personality-card {{(!isProfileComplete || (isProfileComplete && payInfo.requiresPayment && !payInfo.isPaid)) ? 'personality-card--locked' : ''}}"
|
||||
>
|
||||
<text class="card-title">性格类型分析</text>
|
||||
|
||||
<!-- MBTI类型 -->
|
||||
<view class="personality-type">
|
||||
<text class="type-code">{{result.mbti}}</text>
|
||||
<text class="type-name">{{result.title}}</text>
|
||||
<text class="type-desc">{{result.summary}}</text>
|
||||
</view>
|
||||
|
||||
<!-- PDP和DISC -->
|
||||
<view class="type-details">
|
||||
<view class="type-box pdp-box">
|
||||
<text class="type-label">PDP主性格</text>
|
||||
<text class="type-value">{{result.pdp || '--'}}</text>
|
||||
<text class="type-sub" wx:if="{{result.pdpAux}}">辅助: {{result.pdpAux}}</text>
|
||||
<view class="personality-type">
|
||||
<text class="type-code">{{result.mbti}}</text>
|
||||
<text class="type-name">{{result.title}}</text>
|
||||
<text class="type-desc">{{result.summary}}</text>
|
||||
</view>
|
||||
<view class="type-box disc-box">
|
||||
<text class="type-label">DISC类型</text>
|
||||
<text class="type-value">{{result.disc || '--'}}型</text>
|
||||
<text class="type-sub" wx:if="{{result.discAux}}">辅助: {{result.discAux}}</text>
|
||||
|
||||
<view class="type-details">
|
||||
<view class="type-box pdp-box">
|
||||
<text class="type-label">PDP主性格</text>
|
||||
<text class="type-value">{{result.pdp || '--'}}</text>
|
||||
<text class="type-sub" wx:if="{{result.pdpAux}}">辅助: {{result.pdpAux}}</text>
|
||||
</view>
|
||||
<view class="type-box disc-box">
|
||||
<text class="type-label">DISC类型</text>
|
||||
<text class="type-value">{{result.disc || '--'}}型</text>
|
||||
<text class="type-sub" wx:if="{{result.discAux}}">辅助: {{result.discAux}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="advantages-box" wx:if="{{result.traits.length > 0}}">
|
||||
<text class="advantages-label">主要优势</text>
|
||||
<view class="advantages-list">
|
||||
<view class="advantage-item" wx:for="{{result.traits}}" wx:key="*this">
|
||||
<view class="advantage-dot"></view>
|
||||
<text class="advantage-text">{{item}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="next-btn" bindtap="goToMBTI">
|
||||
<text class="next-btn-text">下一步:详细性格测试 →</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 主要优势 -->
|
||||
<view class="advantages-box" wx:if="{{result.traits.length > 0}}">
|
||||
<text class="advantages-label">主要优势</text>
|
||||
<view class="advantages-list">
|
||||
<view class="advantage-item" wx:for="{{result.traits}}" wx:key="*this">
|
||||
<view class="advantage-dot"></view>
|
||||
<text class="advantage-text">{{item}}</text>
|
||||
<view
|
||||
class="card report-gate-teaser {{(!isProfileComplete || (isProfileComplete && payInfo.requiresPayment && !payInfo.isPaid)) ? 'report-gate-teaser--locked' : ''}}"
|
||||
wx:if="{{result.summary}}"
|
||||
>
|
||||
<text class="card-title">性格概述</text>
|
||||
<text class="card-text">{{result.summary}}</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="card gallup-card report-gate-teaser {{(!isProfileComplete || (isProfileComplete && payInfo.requiresPayment && !payInfo.isPaid)) ? 'report-gate-teaser--locked' : ''}}"
|
||||
wx:if="{{result.gallupTop3.length > 0}}"
|
||||
>
|
||||
<text class="card-title">盖洛普前三大优势</text>
|
||||
<view class="gallup-list">
|
||||
<view class="gallup-item" wx:for="{{result.gallupTop3}}" wx:key="*this">
|
||||
<text class="gallup-rank">{{index + 1}}</text>
|
||||
<text class="gallup-text">{{item}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="next-btn" bindtap="goToMBTI">
|
||||
<text class="next-btn-text">下一步:详细性格测试 →</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 性格概述 -->
|
||||
<view class="card" wx:if="{{!hasError && result.summary}}">
|
||||
<text class="card-title">性格概述</text>
|
||||
<text class="card-text">{{result.summary}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 盖洛普前三大优势(付费后/免费皆展示,有数据才显示) -->
|
||||
<view class="card gallup-card" wx:if="{{!hasError && result.gallupTop3.length > 0}}">
|
||||
<text class="card-title">盖洛普前三大优势</text>
|
||||
<view class="gallup-list">
|
||||
<view class="gallup-item" wx:for="{{result.gallupTop3}}" wx:key="*this">
|
||||
<text class="gallup-rank">{{index + 1}}</text>
|
||||
<text class="gallup-text">{{item}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 付费解锁:未完善资料显示「完善资料」;已完善且有价格显示「解锁完整报告」;已完善且无价格则不显示 -->
|
||||
<view class="card paywall-card" wx:if="{{!hasError && (!isProfileComplete || (isProfileComplete && payInfo.requiresPayment && !payInfo.isPaid))}}">
|
||||
<view class="paywall-content">
|
||||
<text class="paywall-fake-title">完整版性格深度解析</text>
|
||||
<text class="paywall-tip">解锁后将展示完整报告内容</text>
|
||||
<!-- 未完善资料:用户点击后手动跳转 -->
|
||||
<view
|
||||
class="paywall-btn"
|
||||
wx:if="{{!isProfileComplete}}"
|
||||
bindtap="goToCompleteProfile"
|
||||
>
|
||||
<text class="paywall-btn-main">完善资料</text>
|
||||
</view>
|
||||
<!-- 已完善资料且有价格:解锁按钮 -->
|
||||
<block wx:elif="{{isProfileComplete && payInfo.requiresPayment && !payInfo.isPaid}}">
|
||||
<button
|
||||
class="paywall-btn"
|
||||
wx:if="{{!hasPhone}}"
|
||||
open-type="getPhoneNumber"
|
||||
bindgetphonenumber="onGetPhoneNumberForFacePay"
|
||||
>
|
||||
<text class="paywall-btn-main">解锁完整报告</text>
|
||||
<text class="paywall-btn-price">¥{{payInfo.amountYuan || 0}} / 次</text>
|
||||
</button>
|
||||
<view
|
||||
class="paywall-btn"
|
||||
wx:elif="{{hasPhone}}"
|
||||
bindtap="unlockFullReport"
|
||||
>
|
||||
<text class="paywall-btn-main">解锁完整报告</text>
|
||||
<text class="paywall-btn-price">¥{{payInfo.amountYuan || 0}} / 次</text>
|
||||
<!-- 全幅遮罩 + 底部操作(覆盖性格概述、盖洛普等主要预览,仅留顶部少量「悬念」) -->
|
||||
<view
|
||||
class="report-gate-overlay"
|
||||
wx:if="{{!isProfileComplete || (isProfileComplete && payInfo.requiresPayment && !payInfo.isPaid)}}"
|
||||
>
|
||||
<view class="report-gate-gradient"></view>
|
||||
<!-- 底部白区内:标题 + 说明 + 按钮作为一组上下居中 -->
|
||||
<view class="report-gate-cta-wrap">
|
||||
<view class="report-gate-panel">
|
||||
<text class="paywall-fake-title">完整版性格深度解析</text>
|
||||
<text class="paywall-tip">解锁后将展示完整报告内容</text>
|
||||
<view
|
||||
class="paywall-btn paywall-btn-inline"
|
||||
wx:if="{{!isProfileComplete}}"
|
||||
bindtap="goToCompleteProfile"
|
||||
>
|
||||
<text class="paywall-btn-main">完善资料</text>
|
||||
</view>
|
||||
<block wx:elif="{{isProfileComplete && payInfo.requiresPayment && !payInfo.isPaid}}">
|
||||
<button
|
||||
class="paywall-btn paywall-btn-inline"
|
||||
wx:if="{{!hasPhone}}"
|
||||
open-type="getPhoneNumber"
|
||||
bindgetphonenumber="onGetPhoneNumberForFacePay"
|
||||
>
|
||||
<text class="paywall-btn-main">解锁完整报告</text>
|
||||
<text class="paywall-btn-price">¥{{payInfo.amountYuan || 0}} / 次</text>
|
||||
</button>
|
||||
<view
|
||||
class="paywall-btn paywall-btn-inline"
|
||||
wx:elif="{{hasPhone}}"
|
||||
bindtap="unlockFullReport"
|
||||
>
|
||||
<text class="paywall-btn-main">解锁完整报告</text>
|
||||
<text class="paywall-btn-price">¥{{payInfo.amountYuan || 0}} / 次</text>
|
||||
</view>
|
||||
</block>
|
||||
<text class="paywall-tip paywall-tip-panel" wx:if="{{isProfileComplete}}">一次性解锁本次{{reportTitle || '分析报告'}},永久保存在「历史记录」中</text>
|
||||
</view>
|
||||
</block>
|
||||
<text class="paywall-tip" wx:if="{{isProfileComplete}}">一次性解锁本次{{reportTitle || '分析报告'}},永久保存在「历史记录」中</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -273,6 +273,156 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.paywall-tip-panel {
|
||||
margin-top: 16rpx;
|
||||
padding: 0 8rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* ========== 报告预览门禁(人脸分析报告):整区遮罩 + 预览截断 ========== */
|
||||
.report-gate-wrap {
|
||||
position: relative;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.report-gate-overlay {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 20;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
align-items: stretch;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 占据遮罩下半区,组内标题/说明/按钮垂直居中,避免贴底留白过大 */
|
||||
.report-gate-cta-wrap {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
/* 占遮罩层约一半高度,保证内部 flex 垂直居中真正留白上下对称 */
|
||||
height: 48%;
|
||||
min-height: 400rpx;
|
||||
max-height: 640rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: stretch;
|
||||
/* 整体上移,避免贴底 */
|
||||
margin-bottom: 96rpx;
|
||||
padding: 16rpx 0 calc(20rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.report-gate-gradient {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
pointer-events: none;
|
||||
/* 高透明白雾,避免大块灰底发闷 */
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(255, 255, 255, 0) 0%,
|
||||
rgba(255, 255, 255, 0.22) 10%,
|
||||
rgba(255, 255, 255, 0.48) 28%,
|
||||
rgba(255, 255, 255, 0.72) 48%,
|
||||
rgba(255, 255, 255, 0.88) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.report-gate-panel {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 20rpx 20rpx 8rpx;
|
||||
flex-shrink: 0;
|
||||
background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.5) 18%, rgba(255, 255, 255, 0.96) 55%);
|
||||
}
|
||||
|
||||
.report-gate-panel .paywall-fake-title {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.report-gate-panel .paywall-tip {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 遮罩内主按钮:不再用绝对定位贴底,避免区域过矮 */
|
||||
.paywall-btn-inline {
|
||||
position: relative !important;
|
||||
left: auto !important;
|
||||
right: auto !important;
|
||||
bottom: auto !important;
|
||||
width: 90% !important;
|
||||
max-width: 640rpx;
|
||||
margin: 28rpx auto 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.report-gate-panel .paywall-btn-inline::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* 未解锁:限制概述与盖洛普可见行数 */
|
||||
.report-gate-teaser--locked .card-text {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 5;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.report-gate-teaser--locked .gallup-list {
|
||||
max-height: 96rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.report-gate-teaser--locked .gallup-list::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 48rpx;
|
||||
background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff);
|
||||
}
|
||||
|
||||
/* 未解锁:压缩首屏性格区可读内容 */
|
||||
.personality-card--locked .type-desc {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.personality-card--locked .advantages-box {
|
||||
max-height: 140rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.personality-card--locked .advantages-box::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 56rpx;
|
||||
background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff);
|
||||
}
|
||||
|
||||
.personality-card--locked .next-btn {
|
||||
opacity: 0.45;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* ========== 性格类型卡片 ========== */
|
||||
.personality-card {
|
||||
text-align: center;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const { getApiBase } = require('../../utils/request')
|
||||
const { getEffectiveEnterpriseId } = require('../../utils/enterpriseContext.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -21,9 +22,7 @@ Page({
|
||||
const token = wx.getStorageSync('token') || gd.token || ''
|
||||
const scope = gd.appScope || 'personal'
|
||||
// 企业 ID:按优先级取 scene > globalData.userInfo > storage.userInfo
|
||||
const eid = scope === 'enterprise'
|
||||
? (gd.enterpriseIdFromScene || (gd.userInfo && gd.userInfo.enterpriseId) || storedUser.enterpriseId || null)
|
||||
: null
|
||||
const eid = scope === 'enterprise' ? getEffectiveEnterpriseId() : null
|
||||
let url = apiBase.replace(/\/$/, '') + '/api/distribution/poster'
|
||||
if (eid) url += `?eid=${eid}&scope=enterprise`
|
||||
else if (scope === 'enterprise') url += '?scope=enterprise' // 企业模式但 eid 未知,后端从 DB 取
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const app = getApp()
|
||||
const payment = require('../../utils/payment')
|
||||
const { request } = require('../../utils/request')
|
||||
const { getEffectiveEnterpriseId } = require('../../utils/enterpriseContext.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -29,15 +30,31 @@ Page({
|
||||
app.globalData.enterpriseIdFromScene = enterpriseId
|
||||
}
|
||||
|
||||
const resolveEnterpriseId = () => {
|
||||
if (enterpriseId > 0) return enterpriseId
|
||||
return getEffectiveEnterpriseId() || 0
|
||||
}
|
||||
|
||||
this.setData({
|
||||
enterpriseId,
|
||||
enterpriseId: resolveEnterpriseId(),
|
||||
enterpriseName: (app.globalData.userInfo && app.globalData.userInfo.enterpriseName) || '',
|
||||
amountFen,
|
||||
amountYuan
|
||||
})
|
||||
|
||||
app.ensureLogin()
|
||||
.then((ok) => {
|
||||
if (!ok) {
|
||||
wx.showToast({ title: '请先登录', icon: 'none' })
|
||||
return Promise.reject(new Error('no login'))
|
||||
}
|
||||
return app.getRuntimeConfig().catch(() => {})
|
||||
})
|
||||
.then(() => {
|
||||
const finalEid = resolveEnterpriseId()
|
||||
if (finalEid > 0 && enterpriseId <= 0) {
|
||||
this.setData({ enterpriseId: finalEid })
|
||||
}
|
||||
if (enterpriseId > 0) {
|
||||
request({
|
||||
url: '/api/enterprise/bind',
|
||||
@@ -52,9 +69,7 @@ Page({
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
wx.showToast({ title: '请先登录', icon: 'none' })
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
|
||||
submitRecharge() {
|
||||
|
||||
@@ -187,11 +187,11 @@
|
||||
}
|
||||
|
||||
.paywall-card { margin-top: 24rpx; border-radius: 24rpx; overflow: hidden; }
|
||||
.paywall-content { position: relative; }
|
||||
.paywall-blur { padding: 32rpx 24rpx 140rpx; border-radius: 24rpx; background: rgba(255,255,255,0.7); backdrop-filter: blur(18rpx); }
|
||||
.paywall-mask { position: absolute; left: 0; top: 0; right: 0; bottom: 0; border-radius: 24rpx; background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(245,245,245,0.98)); pointer-events: none; }
|
||||
.paywall-content { position: relative; min-height: 360rpx; }
|
||||
.paywall-blur { padding: 32rpx 24rpx 200rpx; border-radius: 24rpx; background: rgba(255,255,255,0.97); backdrop-filter: blur(6rpx); }
|
||||
.paywall-mask { position: absolute; left: 0; top: 0; right: 0; bottom: 0; border-radius: 24rpx; z-index: 1; background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.28) 38%, rgba(255,255,255,0.58) 100%); pointer-events: none; }
|
||||
.paywall-fake-title { display: block; font-size: 30rpx; font-weight: 600; color: #444; margin-bottom: 16rpx; }
|
||||
.paywall-fake-line { display: block; font-size: 26rpx; color: #888; line-height: 1.8; }
|
||||
.paywall-btn { position: absolute; left: 5%; right: 5%; width: 90%; bottom: 56rpx; padding: 20rpx 0; border-radius: 999rpx; background: linear-gradient(135deg, #3B82F6 0%, #60a5fa 100%); box-shadow: 0 8rpx 24rpx rgba(59,130,246,0.35); display: flex; flex-direction: row; align-items: baseline; justify-content: center; gap: 12rpx; }
|
||||
.paywall-btn { position: absolute; left: 5%; right: 5%; width: 90%; bottom: 132rpx; z-index: 3; padding: 20rpx 0; border-radius: 999rpx; background: linear-gradient(135deg, #3B82F6 0%, #60a5fa 100%); box-shadow: 0 8rpx 24rpx rgba(59,130,246,0.35); display: flex; flex-direction: row; align-items: baseline; justify-content: center; gap: 12rpx; }
|
||||
.paywall-btn-main { font-size: 30rpx; color: #fff; font-weight: 600; }
|
||||
.paywall-btn-price { font-size: 24rpx; color: #ffe5f0; }
|
||||
|
||||
@@ -205,27 +205,36 @@
|
||||
border-radius: 24rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.paywall-content { position: relative; }
|
||||
.paywall-content { position: relative; min-height: 360rpx; }
|
||||
.paywall-blur {
|
||||
padding: 32rpx 24rpx 140rpx;
|
||||
padding: 32rpx 24rpx 200rpx;
|
||||
border-radius: 24rpx;
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
backdrop-filter: blur(18rpx);
|
||||
background: rgba(255, 255, 255, 0.97);
|
||||
backdrop-filter: blur(6rpx);
|
||||
}
|
||||
.paywall-mask {
|
||||
position: absolute;
|
||||
left: 0; top: 0; right: 0; bottom: 0;
|
||||
border-radius: 24rpx;
|
||||
background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(245,245,245,0.98));
|
||||
z-index: 1;
|
||||
/* 更轻的白纱,底部也保持通透 */
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(255, 255, 255, 0.08) 0%,
|
||||
rgba(255, 255, 255, 0.28) 38%,
|
||||
rgba(255, 255, 255, 0.58) 100%
|
||||
);
|
||||
pointer-events: none;
|
||||
}
|
||||
.paywall-fake-title { display: block; font-size: 30rpx; font-weight: 600; color: #444; margin-bottom: 16rpx; }
|
||||
.paywall-fake-line { display: block; font-size: 26rpx; color: #888; line-height: 1.8; }
|
||||
.paywall-btn {
|
||||
position: absolute;
|
||||
left: 5%; right: 5%;
|
||||
left: 5%;
|
||||
right: 5%;
|
||||
width: 90%;
|
||||
bottom: 56rpx;
|
||||
bottom: 132rpx;
|
||||
z-index: 3;
|
||||
padding: 20rpx 0;
|
||||
border-radius: 999rpx;
|
||||
background: linear-gradient(135deg, #FF6B8A 0%, #ff8fa3 100%);
|
||||
|
||||
@@ -201,11 +201,11 @@
|
||||
}
|
||||
|
||||
.paywall-card { margin-top: 24rpx; border-radius: 24rpx; overflow: hidden; }
|
||||
.paywall-content { position: relative; }
|
||||
.paywall-blur { padding: 32rpx 24rpx 140rpx; border-radius: 24rpx; background: rgba(255,255,255,0.7); backdrop-filter: blur(18rpx); }
|
||||
.paywall-mask { position: absolute; left: 0; top: 0; right: 0; bottom: 0; border-radius: 24rpx; background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(245,245,245,0.98)); pointer-events: none; }
|
||||
.paywall-content { position: relative; min-height: 360rpx; }
|
||||
.paywall-blur { padding: 32rpx 24rpx 200rpx; border-radius: 24rpx; background: rgba(255,255,255,0.97); backdrop-filter: blur(6rpx); }
|
||||
.paywall-mask { position: absolute; left: 0; top: 0; right: 0; bottom: 0; border-radius: 24rpx; z-index: 1; background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.28) 38%, rgba(255,255,255,0.58) 100%); pointer-events: none; }
|
||||
.paywall-fake-title { display: block; font-size: 30rpx; font-weight: 600; color: #444; margin-bottom: 16rpx; }
|
||||
.paywall-fake-line { display: block; font-size: 26rpx; color: #888; line-height: 1.8; }
|
||||
.paywall-btn { position: absolute; left: 5%; right: 5%; width: 90%; bottom: 56rpx; padding: 20rpx 0; border-radius: 999rpx; background: linear-gradient(135deg, #F59E0B 0%, #fbbf24 100%); box-shadow: 0 8rpx 24rpx rgba(245,158,11,0.35); display: flex; flex-direction: row; align-items: baseline; justify-content: center; gap: 12rpx; }
|
||||
.paywall-btn { position: absolute; left: 5%; right: 5%; width: 90%; bottom: 132rpx; z-index: 3; padding: 20rpx 0; border-radius: 999rpx; background: linear-gradient(135deg, #F59E0B 0%, #fbbf24 100%); box-shadow: 0 8rpx 24rpx rgba(245,158,11,0.35); display: flex; flex-direction: row; align-items: baseline; justify-content: center; gap: 12rpx; }
|
||||
.paywall-btn-main { font-size: 30rpx; color: #fff; font-weight: 600; }
|
||||
.paywall-btn-price { font-size: 24rpx; color: #ffe5f0; }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// pages/result/resume.js - 简历综合分析结果页
|
||||
const app = getApp()
|
||||
const payment = require('../../utils/payment')
|
||||
const { getEnterpriseIdForApiPayload } = require('../../utils/enterpriseContext.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -111,13 +112,7 @@ Page({
|
||||
const apiBase = (app.globalData && app.globalData.apiBase) || wx.getStorageSync('apiBase') || ''
|
||||
const token = (app.globalData && app.globalData.token) || wx.getStorageSync('token') || ''
|
||||
|
||||
// 获取 enterpriseId
|
||||
const gd = app.globalData || {}
|
||||
const storedUser = wx.getStorageSync('userInfo') || null
|
||||
const enterpriseId = gd.enterpriseIdFromScene
|
||||
|| (gd.userInfo && gd.userInfo.enterpriseId)
|
||||
|| (storedUser && storedUser.enterpriseId)
|
||||
|| null
|
||||
const enterpriseId = getEnterpriseIdForApiPayload()
|
||||
|
||||
const postData = {}
|
||||
if (this.data.fileUrl) postData.fileUrl = this.data.fileUrl
|
||||
|
||||
52
miniprogram/utils/enterpriseContext.js
Normal file
52
miniprogram/utils/enterpriseContext.js
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* 小程序企业上下文:显式入口参数 > 用户绑定企业 > 超管配置的默认企业
|
||||
*/
|
||||
|
||||
/**
|
||||
* 企业版落地页、分享带 eid、充值等:完整回落链
|
||||
* @returns {number|null}
|
||||
*/
|
||||
function getEffectiveEnterpriseId() {
|
||||
const app = getApp()
|
||||
const gd = app.globalData || {}
|
||||
const fromScene = gd.enterpriseIdFromScene
|
||||
if (fromScene != null && Number(fromScene) > 0) {
|
||||
return Number(fromScene)
|
||||
}
|
||||
const u = gd.userInfo || wx.getStorageSync('userInfo') || {}
|
||||
const bound = u.enterpriseId
|
||||
if (bound != null && Number(bound) > 0) {
|
||||
return Number(bound)
|
||||
}
|
||||
const def = gd.defaultEnterpriseId
|
||||
if (def != null && Number(def) > 0) {
|
||||
return Number(def)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交给后端的 enterpriseId(analyze、test/submit、支付创建订单、简历分析等)
|
||||
* - 个人版 Tab(appScope=personal):仅传递「本次入口携带的 eid」(enterpriseIdFromScene),
|
||||
* 不因「已绑定企业」或「超管默认企业」带参,避免个人入口却走企业定价/落库企业字段。
|
||||
* - 企业版(appScope=enterprise):与 getEffectiveEnterpriseId 一致。
|
||||
* @returns {number|null}
|
||||
*/
|
||||
function getEnterpriseIdForApiPayload() {
|
||||
const app = getApp()
|
||||
const gd = app.globalData || {}
|
||||
const scope = gd.appScope || 'personal'
|
||||
if (scope === 'personal') {
|
||||
const fromScene = gd.enterpriseIdFromScene
|
||||
if (fromScene != null && Number(fromScene) > 0) {
|
||||
return Number(fromScene)
|
||||
}
|
||||
return null
|
||||
}
|
||||
return getEffectiveEnterpriseId()
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getEffectiveEnterpriseId,
|
||||
getEnterpriseIdForApiPayload
|
||||
}
|
||||
@@ -2,6 +2,13 @@
|
||||
// 微信支付工具类 - 复刻自Soul项目
|
||||
|
||||
const app = getApp()
|
||||
const { getEnterpriseIdForApiPayload } = require('./enterpriseContext.js')
|
||||
|
||||
/** 创建订单时传给后端的 enterpriseId(0 表示无企业上下文);与个人/企业 Tab 一致 */
|
||||
function enterpriseIdForOrder() {
|
||||
const eid = getEnterpriseIdForApiPayload()
|
||||
return eid != null && Number(eid) > 0 ? Number(eid) : 0
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成符合微信规则的订单号
|
||||
@@ -364,6 +371,7 @@ function purchaseByPricing(productType, description, extra, maybeFail) {
|
||||
description,
|
||||
productType,
|
||||
testResultId,
|
||||
enterpriseId: enterpriseIdForOrder(),
|
||||
success,
|
||||
fail
|
||||
})
|
||||
@@ -486,6 +494,7 @@ function purchasePersonalDeepService(arg1, arg2, arg3) {
|
||||
description: desc,
|
||||
productType: 'deep_personal',
|
||||
deepProductId,
|
||||
enterpriseId: enterpriseIdForOrder(),
|
||||
success,
|
||||
fail
|
||||
})
|
||||
@@ -502,6 +511,7 @@ function purchaseTeamDeepService(success, fail) {
|
||||
amount: 0,
|
||||
description: '团队深度服务(团队画像+策略)',
|
||||
productType: 'deep_team',
|
||||
enterpriseId: enterpriseIdForOrder(),
|
||||
success,
|
||||
fail
|
||||
})
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* 接收方(落地页 onLoad options)直接读 options.uid / options.eid
|
||||
*/
|
||||
|
||||
const { getEffectiveEnterpriseId } = require('./enterpriseContext.js')
|
||||
|
||||
function getApp_() {
|
||||
try { return getApp() } catch (e) { return null }
|
||||
}
|
||||
@@ -24,9 +26,7 @@ function buildShareQuery() {
|
||||
const parts = []
|
||||
if (uid) parts.push('uid=' + uid)
|
||||
if (scope === 'enterprise') {
|
||||
const eid = (app && app.globalData && app.globalData.enterpriseIdFromScene)
|
||||
|| userInfo.enterpriseId
|
||||
|| ''
|
||||
const eid = getEffectiveEnterpriseId() || ''
|
||||
if (eid) parts.push('eid=' + eid)
|
||||
}
|
||||
return parts.join('&')
|
||||
|
||||
Reference in New Issue
Block a user