diff --git a/uniapp/pages/assessment/info/index.vue b/uniapp/pages/assessment/info/index.vue index f35b9f9..ccf1532 100644 --- a/uniapp/pages/assessment/info/index.vue +++ b/uniapp/pages/assessment/info/index.vue @@ -15,7 +15,7 @@ import { onLoad, onUnload } from '@dcloudio/uni-app' import { useUserStore } from '@/store/user.js' import { useAuth } from '@/composables/useAuth.js' import { usePayment } from '@/composables/usePayment.js' -import { getIntro, verifyInviteCode, getPendingRecord } from '@/api/assessment.js' +import { getIntro, verifyInviteCode } from '@/api/assessment.js' import { createOrder } from '@/api/order.js' import { isPhone } from '@/utils/validate.js' import Navbar from '@/components/Navbar/index.vue' @@ -64,21 +64,6 @@ function getEducationStageValue(label) { return map[label] || 1 } -/** - * 数值转学业阶段文本 - */ -function getEducationStageLabel(value) { - const map = { 1: '小学及以下', 2: '初中', 3: '高中', 4: '大专' } - return map[value] || '' -} - -/** - * 数值转性别文本 - */ -function getGenderLabel(value) { - return value === 1 ? '男' : value === 2 ? '女' : '' -} - // 选择器索引 const genderIndex = ref(-1) const ageIndex = ref(-1) @@ -95,10 +80,6 @@ const inviteLoading = ref(false) // 页面加载状态 const pageLoading = ref(true) -// 进行中的测评记录 -const pendingRecord = ref(null) -const showPendingPopup = ref(false) - // 本地缓存 key const STORAGE_KEY = 'assessment_info_form' @@ -177,16 +158,10 @@ const isFormComplete = computed(() => { ) }) -/** - * 是否处于继续上次测评模式 - */ -const isContinueMode = computed(() => pendingRecord.value !== null) - /** * 底部按钮文案 */ const payBtnText = computed(() => { - if (isContinueMode.value) return '开始答题' return `支付¥${introData.value.price || 20}元开始测评` }) @@ -212,56 +187,6 @@ async function loadIntro() { } } -/** - * 检查是否有进行中的测评记录 - */ -async function checkPendingRecord() { - if (!userStore.isLoggedIn) return - - try { - const res = await getPendingRecord(typeId.value) - if (res && res.code === 0 && res.data) { - pendingRecord.value = res.data - showPendingPopup.value = true - } - } catch (error) { - console.error('查询进行中测评记录失败:', error) - } -} - -/** - * 用户选择继续上次测评 - */ -function handleContinuePending() { - showPendingPopup.value = false - const record = pendingRecord.value - - // 回填个人信息到表单 - formData.value.name = record.name || '' - formData.value.phone = record.phone || '' - formData.value.gender = getGenderLabel(record.gender) - formData.value.age = record.age ? `${record.age}岁` : '' - formData.value.educationStage = getEducationStageLabel(record.educationStage) - formData.value.province = record.province || '' - formData.value.city = record.city || '' - formData.value.district = record.district || '' - - // 同步选择器索引 - genderIndex.value = record.gender === 1 ? 0 : record.gender === 2 ? 1 : -1 - ageIndex.value = record.age ? record.age - 10 : -1 - const eduIdx = educationOptions.indexOf(getEducationStageLabel(record.educationStage)) - educationIndex.value = eduIdx >= 0 ? eduIdx : -1 - regionValue.value = [record.province || '', record.city || '', record.district || ''] -} - -/** - * 用户选择不继续上次测评 - */ -function handleDismissPending() { - showPendingPopup.value = false - pendingRecord.value = null -} - /** 性别选择 */ function onGenderChange(e) { genderIndex.value = e.detail.value @@ -334,19 +259,9 @@ function buildAssessmentInfo() { } } -/** 支付测评 / 继续上次测评 */ +/** 支付测评 */ async function handlePayAssessment() { if (!checkLogin()) return - - // 继续上次测评模式:直接跳转答题页 - if (isContinueMode.value) { - clearFormStorage() - uni.redirectTo({ - url: `/pages/assessment/questions/index?typeId=${typeId.value}&recordId=${pendingRecord.value.recordId}` - }) - return - } - if (!validateForm()) return try { @@ -459,8 +374,6 @@ onLoad((options) => { } loadIntro() - // 检查是否有进行中的测评 - checkPendingRecord() }) /** 页面卸载时保存 */ @@ -490,7 +403,7 @@ onUnload(() => { - {{ isContinueMode ? '您有一次未完成的测评,信息已自动填充' : '正式测评前,请先填写您的基本信息' }} + 正式测评前,请先填写您的基本信息 @@ -503,7 +416,6 @@ onUnload(() => { placeholder-class="input-placeholder" v-model="formData.name" maxlength="20" - :disabled="isContinueMode" /> @@ -518,7 +430,6 @@ onUnload(() => { placeholder-class="input-placeholder" v-model="formData.phone" maxlength="11" - :disabled="isContinueMode" /> @@ -526,7 +437,7 @@ onUnload(() => { *性别 - + {{ formData.gender || '请选择' }} @@ -539,7 +450,7 @@ onUnload(() => { *年龄 - + {{ formData.age || '请选择' }} @@ -552,7 +463,7 @@ onUnload(() => { *学业阶段 - + {{ formData.educationStage || '请选择' }} @@ -565,7 +476,7 @@ onUnload(() => { *所在城市 - + @@ -592,41 +503,14 @@ onUnload(() => { - + 邀请码免费测评 - + {{ payBtnText }} - - - - - 提示 - - × - - - - 您有一次未完成的测评,是否继续上次的测评? - - 姓名:{{ pendingRecord?.name }} - 手机号:{{ pendingRecord?.phone }} - - - - - 重新开始 - - - 继续测评 - - - - - @@ -866,10 +750,6 @@ onUnload(() => { &:active { opacity: 0.8; } - - &.btn-full { - flex: 1; - } } // ========== 弹窗通用 ========== @@ -975,38 +855,6 @@ onUnload(() => { } } -// ========== 进行中测评弹窗 ========== -.pending-msg { - font-size: $font-size-md; - color: $text-color; - text-align: center; - margin-bottom: $spacing-lg; -} - -.pending-info { - display: flex; - flex-direction: column; - gap: $spacing-sm; - padding: $spacing-md $spacing-lg; - background-color: $bg-gray; - border-radius: $border-radius-md; - - text { - font-size: $font-size-sm; - color: $text-secondary; - } -} - -.pending-footer { - display: flex; - gap: $spacing-md; - - .popup-btn-outline, - .popup-btn { - flex: 1; - } -} - // ========== 邀请码输入 ========== .invite-input { width: 100%; diff --git a/uniapp/pages/index/index.vue b/uniapp/pages/index/index.vue index eda96ad..1f522a2 100644 --- a/uniapp/pages/index/index.vue +++ b/uniapp/pages/index/index.vue @@ -90,8 +90,7 @@ - - +