feat: registration gravity from DB config instead of hardcoded
- Add registrationGravity to pricing config (default 50, adjustable via admin) - Inject PricingService into UserService, read config for all 4 registration paths - Expose registrationGravity in /member/plans response for frontend - Login page fetches dynamic value from API, replaces hardcoded '50' - Update user.vue gravity card copy
This commit is contained in:
@@ -65,6 +65,13 @@
|
||||
<view class="card" v-if="mainTab === 'register'">
|
||||
<text class="card-title">创建账号</text>
|
||||
<text class="card-sub">注册后享受 AI 面试模拟服务</text>
|
||||
<view class="promo-banner">
|
||||
<text class="promo-icon">🎁</text>
|
||||
<view class="promo-texts">
|
||||
<text class="promo-title">注册即送 {{ registrationGravity }} 引力值</text>
|
||||
<text class="promo-desc">免费体验 AI 面试模拟</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">邮箱</text>
|
||||
<input class="input" type="text" v-model="email" placeholder="请输入邮箱" />
|
||||
@@ -133,6 +140,7 @@ const agreed = ref(false)
|
||||
const mainTab = ref('login')
|
||||
const loginMode = ref('password') // 'password' | 'code'
|
||||
const isMp = ref(false)
|
||||
const registrationGravity = ref(50)
|
||||
|
||||
const email = ref('')
|
||||
const password = ref('')
|
||||
@@ -158,6 +166,17 @@ onMounted(() => {
|
||||
isMp.value = true
|
||||
mainTab.value = 'wechat'
|
||||
// #endif
|
||||
// 获取注册赠送引力值配置
|
||||
uni.request({
|
||||
url: api('/member/plans'),
|
||||
method: 'GET',
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200 && res.data?.registrationGravity) {
|
||||
registrationGravity.value = res.data.registrationGravity
|
||||
}
|
||||
},
|
||||
fail: () => {} // 使用默认值 50
|
||||
})
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => { if (timer) { clearTimeout(timer); timer = null } })
|
||||
@@ -355,6 +374,12 @@ const goPrivacy = () => uni.navigateTo({ url: '/pages/privacy/privacy' })
|
||||
.card-title { font-size: 30rpx; font-weight: 700; color: var(--color-text); display: block; }
|
||||
.card-sub { font-size: 22rpx; color: var(--color-text-tertiary); margin-top: 6rpx; margin-bottom: 24rpx; display: block; }
|
||||
|
||||
/* ===== Promo Banner ===== */
|
||||
.promo-banner { background: linear-gradient(135deg, #FEF3C7, #FDE68A); border-radius: var(--radius-md); padding: 20rpx 24rpx; margin-bottom: 24rpx; display: flex; align-items: center; gap: 16rpx; }
|
||||
.promo-icon { font-size: 36rpx; }
|
||||
.promo-title { font-size: 26rpx; font-weight: 700; color: #92400E; display: block; }
|
||||
.promo-desc { font-size: 22rpx; color: #B45309; display: block; margin-top: 4rpx; }
|
||||
|
||||
/* ===== Fields ===== */
|
||||
.field { margin-bottom: 20rpx; }
|
||||
.field-label { font-size: 22rpx; color: var(--color-text-secondary); margin-bottom: 8rpx; display: block; }
|
||||
|
||||
Reference in New Issue
Block a user