From c9522f8e246e75f47f303c16df6483253614b727 Mon Sep 17 00:00:00 2001 From: xingyy <373639591@qq.com> Date: Thu, 8 Aug 2024 17:07:42 +0800 Subject: [PATCH] 123 --- src/api/auth/index.js | 15 ++++- src/assets/image/sc@2x.png | Bin 0 -> 535 bytes src/store/auth/index.js | 85 +++++++++++++++++++++++++++- src/views/login/size1440/index.vue | 11 ++-- src/views/login/size375/index.vue | 6 +- src/views/signup/size1920/index.vue | 19 ++++++- src/views/signup/size375/index.vue | 76 +++++++++++++------------ 7 files changed, 161 insertions(+), 51 deletions(-) create mode 100644 src/assets/image/sc@2x.png diff --git a/src/api/auth/index.js b/src/api/auth/index.js index 40b97e8..f4c57df 100644 --- a/src/api/auth/index.js +++ b/src/api/auth/index.js @@ -1,9 +1,22 @@ import request from '@/service/index.js' export const sendCode = (data) => { - console.log('schildrenchildrenendCode') return request({ url: '/api/children/competition/sendCode', method: 'POST', data, }) } +export const loginRegister = (data) => { + return request({ + url: '/api/children/competition/login/register', + method: 'POST', + data, + }) +} +export const competitionApply = (data) => { + return request({ + url: '/api/children/competition/apply', + method: 'POST', + data, + }) +} diff --git a/src/assets/image/sc@2x.png b/src/assets/image/sc@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..dae00bbb520a9b2c93044dfc1cc11b6bfa0c3e99 GIT binary patch literal 535 zcmV+y0_gpTP)Px$(Md!>R9HvtSUpn0Koovos2mHqfzUx{xPfp2Ie|&K#7a&8p1_iHNxT5wKsW(f zBtu7TAQt{K@SG&Z0Zq*AkVYq4?!Nc-%lE#W?6)AnpL_>G#$46MD zENpn&U)shjuW;LP1_~+Dm<#4Gu=VD_AllaLl|p=zFielWt#ylvs+Jdm=rjQWBd{+b zCUZw26RPR105n7kMscd?jR6`ZzAwa_dpc(6Kz0ODjJbs_ESk zC_Z{1I!m`;qIucdW!7g}?`dL}6@Q`?>O~f0Ui}J0%H-c+Lbco}nCb+2@F)5({Q}wf zgEWzsT-Ll$JIdOuVj|U0#YDwK#K7)9sM18GiT|ew)pXYYPMG;Qu=Ot&COd!7>5#p~ z<;7PZq>gCX<0xsv+vd_X!m?TsJuQHhMdBuD9!#`e<{dNgAOM}G_KgX-##b5~cmP7` zV?BSO>6su}rqioIxtHERGT}SRKMc;E3zsY|5}xJKGhJ5vG_{ + + const router = useRouter(); const token = useStorage('token', '', localStorage) const telNum =ref('') const code=ref('') + const countdown = ref(0); + const isCountingDown = ref(false); + const showTextCode=computed(()=>{ + return isCountingDown.value ? `${countdown.value}s` : '获取验证码' + }) + const genderOptions=ref([ + {text:'男',value:'男'}, + {text:'女',value:'女'} + ]) + + const formData=ref({ + name:'', + age:'', + gender:'', + works:[ + { + picUrl: "", //作品图片url + workName: "", //作品名称 + length: undefined, //长度 + wide:undefined//宽度 + } + ] + }) + const clickAddWorks=()=>{ + formData.value.works.push({ + picUrl: "", //作品图片url + workName: "", //作品名称 + length: undefined, //长度 + wide:undefined//宽度 + }) + } + const removeWorks=(index)=>{ + formData.value.works.splice(index,1) + } + const clickApply=async ()=>{ + const data={ + ...formData.value + } + const res=await competitionApply(data) + if(res.status===0){ + message.success('报名成功') + } + } + let timer = null; + const clickLogin=async ()=>{ + const data={ + telNum:telNum.value, + code:code.value + } + const res=await loginRegister(data) + if(res.status===0){ + message.success('登录成功') + token.value=res.data.token + router.push('/signup') + } + } const clickSendCode=async ()=>{ + if (isCountingDown.value) return; + if (!code.value){ + message.warning('请输入验证码') + return + } if (!telNum.value){ message.warning('请输入手机号') return @@ -16,10 +80,27 @@ export const useAuth=createGlobalState(()=>{ } const res=await sendCode(data) if (res.status===0){ + countdown.value = 60; + isCountingDown.value = true; message.success('发送成功') + timer = setInterval(() => { + if (countdown.value > 0) { + countdown.value -= 1; + } else { + clearInterval(timer); + isCountingDown.value = false; + } + }, 1000); } } return { + removeWorks, + clickAddWorks, + genderOptions, + formData, + clickApply, + clickLogin, + showTextCode, code, clickSendCode, telNum, diff --git a/src/views/login/size1440/index.vue b/src/views/login/size1440/index.vue index 3e21c83..482d6cd 100644 --- a/src/views/login/size1440/index.vue +++ b/src/views/login/size1440/index.vue @@ -1,5 +1,6 @@