diff --git a/pages/auth/index.vue b/pages/auth/index.vue index 3b8afd0..282c772 100644 --- a/pages/auth/index.vue +++ b/pages/auth/index.vue @@ -103,7 +103,7 @@ import { reactive, ref, computed, onMounted ,onUnmounted ,inject} from 'vue'; import { onLoad } from '@dcloudio/uni-app'; import { storeToRefs } from 'pinia'; import useUserStore from '@/stores/useUserStore'; - +import { playTextDirectly } from '@/hook/useTTSPlayer-all-in-one'; const { $api ,navBack} = inject('globalFunction'); const { isMiniProgram } = storeToRefs(useUserStore()); @@ -127,7 +127,7 @@ const codeBtnText = ref('发送验证码'); // 认证状态 const authStatus = ref(null); -// 计算属性 + const canSendCode = computed(() => { return codeCountdown.value === 0 && formData.value.phone.length === 11 && !phoneError.value; }); @@ -138,6 +138,7 @@ const canSubmit = computed(() => { }); + // 身份证输入处理 const onIdCardInput = (e) => { formData.value.idCard = e.detail.value.toUpperCase(); @@ -305,10 +306,8 @@ const sendCode = async () => { // 发送成功提示 showAuthStatus('success', '验证码已发送至您的手机'); - - if (isMachineEnv.value) { - playTextDirectly('验证码已发送,请注意查收'); - } + playTextDirectly('验证码已发送,请注意查收'); + } catch (error) { // 发送失败,重置倒计时 @@ -319,10 +318,7 @@ const sendCode = async () => { // 错误提示 showAuthStatus('error', '验证码发送失败,请重试'); - - if (isMachineEnv.value) { - playTextDirectly('验证码发送失败'); - } + playTextDirectly('验证码发送失败'); } }; @@ -393,11 +389,7 @@ const submitAuth = async () => { // 认证成功 showAuthStatus('success', '身份认证成功'); - - // 语音提示 - if (isMachineEnv.value) { - playTextDirectly('身份认证成功'); - } + playTextDirectly('身份认证成功'); // 保存认证信息到store useUserStore().getUserResume().then(()=>{ @@ -421,19 +413,11 @@ const submitAuth = async () => { } showAuthStatus('error', errorMsg); - - // 语音提示 - if (isMachineEnv.value) { - playTextDirectly(errorMsg); - } + playTextDirectly(errorMsg); } }; -// TTS语音播放(假设已引入) -const playTextDirectly = (text) => { - // 这里调用TTS功能 - console.log('TTS播放:', text); -}; + // 组件卸载时清理定时器 onUnmounted(() => {