倒计时修改
Showing
2 changed files
with
67 additions
and
37 deletions
This diff is collapsed.
Click to expand it.
| 1 | <template> | 1 | <template> |
| 2 | <el-dialog v-model="show" :title="language==0?'注册':'Login'" close-icon="CircleClose" | 2 | <el-dialog v-model="show" :append-to-body="true" :title="language==0?'注册':'Login'" |
| 3 | width="480" :append-to-body="true" destroy-on-close @close="close" center> | 3 | center close-icon="CircleClose" destroy-on-close width="480" @close="close"> |
| 4 | <div> | 4 | <div> |
| 5 | <el-form class="d-form" size="large" :label-width="language==0?80:150" :label-position="language==0?'right':'top'" style="max-width: 500px;margin: auto"> | 5 | <el-form :label-position="language==0?'right':'top'" :label-width="language==0?80:150" class="d-form" size="large" |
| 6 | <!-- <div style="display: flex;gap: 20px;">--> | 6 | style="max-width: 500px;margin: auto"> |
| 7 | <el-form-item :label="language==0?'姓':'Last Name'" required style="width: 100%;"> | 7 | <!-- <div style="display: flex;gap: 20px;">--> |
| 8 | <el-input type="text" v-model="form.lastName" :placeholder="language==0?'请输入您的姓':'Please enter your last name'"/> | 8 | <el-form-item :label="language==0?'姓':'Last Name'" required style="width: 100%;"> |
| 9 | </el-form-item> | 9 | <el-input v-model="form.lastName" :placeholder="language==0?'请输入您的姓':'Please enter your last name'" |
| 10 | <el-form-item :label="language==0?'名':'First Name'" required style="width: 100%;"> | 10 | type="text"/> |
| 11 | <el-input type="text" v-model="form.firstName" :placeholder="language==0?'请输入您的名':'Please enter your first name'"/> | 11 | </el-form-item> |
| 12 | </el-form-item> | 12 | <el-form-item :label="language==0?'名':'First Name'" required style="width: 100%;"> |
| 13 | <!-- </div>--> | 13 | <el-input v-model="form.firstName" :placeholder="language==0?'请输入您的名':'Please enter your first name'" |
| 14 | type="text"/> | ||
| 15 | </el-form-item> | ||
| 16 | <!-- </div>--> | ||
| 14 | <el-form-item :label="language==0?'邮箱':'E-mail'" required> | 17 | <el-form-item :label="language==0?'邮箱':'E-mail'" required> |
| 15 | <el-input type="text" v-model="form.account" @change="resetCode" @blur="verifyCode" | 18 | <el-input v-model="form.account" type="text" @blur="verifyCode" @change="resetCode" |
| 16 | /> | 19 | /> |
| 17 | <div class="tip" v-if="language==0"> | 20 | <div v-if="language==0" class="tip"> |
| 18 | (请填写正确的邮箱信息,邮箱信息在注册完成后无法修改。 | 21 | (请填写正确的邮箱信息,邮箱信息在注册完成后无法修改。 |
| 19 | 该邮箱后续会作为您登录的账户, | 22 | 该邮箱后续会作为您登录的账户, |
| 20 | 并接收报名审核结果、支付账单、签证邀请函等相关信息。) | 23 | 并接收报名审核结果、支付账单、签证邀请函等相关信息。) |
| 21 | </div> | 24 | </div> |
| 22 | <div v-else class="tip"> | 25 | <div v-else class="tip"> |
| 23 | Please fill in the correct email, which cannot be changed after the registration is completed. The email will be used as your login account and to receive relevant information including results of registration review, payment bills, visa invitation letters, etc. | 26 | Please fill in the correct email, which cannot be changed after the registration is completed. The email |
| 27 | will be used as your login account and to receive relevant information including results of registration | ||
| 28 | review, payment bills, visa invitation letters, etc. | ||
| 24 | </div> | 29 | </div> |
| 25 | </el-form-item> | 30 | </el-form-item> |
| 26 | <el-form-item :label="language==0?'验证码':'Code'" required> | 31 | <el-form-item :label="language==0?'验证码':'Code'" required> |
| 27 | <el-input v-model="form.code"> | 32 | <el-input v-model="form.code"> |
| 28 | <template #append> | 33 | <template #append> |
| 29 | <el-button type="primary" plain style="width: 110px" @click="sendsmsMsg"> | 34 | <el-button class="codeBtn" plain style="width: 110px" type="primary" @click="sendsmsMsg"> |
| 30 | <count-down v-if="counting" v-slot="{ totalSeconds }" :time="60000" @end="counting=false"> | 35 | <count-down v-if="counting" v-slot="{ totalSeconds }" :time="60000" @end="counting=false"> |
| 31 | {{ totalSeconds }} {{ language == 0 ? '秒' : 's' }} | 36 | {{ totalSeconds }} {{ language == 0 ? '秒' : 's' }} |
| 32 | </count-down> | 37 | </count-down> |
| ... | @@ -36,8 +41,8 @@ | ... | @@ -36,8 +41,8 @@ |
| 36 | </el-button> | 41 | </el-button> |
| 37 | </template> | 42 | </template> |
| 38 | </el-input> | 43 | </el-input> |
| 39 | <div class="vcodeBox" :style="isShow?'height:240px':'height:0'"> | 44 | <div :style="isShow?'height:240px':'height:0'" class="vcodeBox"> |
| 40 | <Vcode :show="isShow" :successText="successVcode" :failText="failVcode" :slider-text="sliderText" | 45 | <Vcode :failText="failVcode" :show="isShow" :slider-text="sliderText" :successText="successVcode" |
| 41 | type="inside" @success="codeSuccess"></Vcode> | 46 | type="inside" @success="codeSuccess"></Vcode> |
| 42 | </div> | 47 | </div> |
| 43 | </el-form-item> | 48 | </el-form-item> |
| ... | @@ -48,22 +53,24 @@ | ... | @@ -48,22 +53,24 @@ |
| 48 | </el-option> | 53 | </el-option> |
| 49 | </el-select> | 54 | </el-select> |
| 50 | </el-form-item> | 55 | </el-form-item> |
| 51 | 56 | ||
| 52 | <el-form-item :label="language==0?'密码':'Password'" required> | 57 | <el-form-item :label="language==0?'密码':'Password'" required> |
| 53 | <el-input type="password" show-password v-model="form.password" | 58 | <el-input v-model="form.password" :placeholder="language==0?'6-16位密码。区分大小写':''" show-password |
| 54 | :placeholder="language==0?'6-16位密码。区分大小写':''"/> | 59 | type="password"/> |
| 55 | </el-form-item> | 60 | </el-form-item> |
| 56 | <el-form-item :label="language==0?'确认密码':'Confirm Password'" required> | 61 | <el-form-item :label="language==0?'确认密码':'Confirm Password'" required> |
| 57 | <el-input type="password" show-password v-model="form.password2" @blur="vconfirmPassword" | 62 | <el-input v-model="form.password2" :placeholder="language==0?'再次输入密码':''" show-password type="password" |
| 58 | :placeholder="language==0?'再次输入密码':''"/> | 63 | @blur="vconfirmPassword"/> |
| 59 | </el-form-item> | 64 | </el-form-item> |
| 60 | </el-form> | 65 | </el-form> |
| 61 | 66 | ||
| 62 | </div> | 67 | </div> |
| 63 | <template #footer> | 68 | <template #footer> |
| 64 | <div class="dialog-footer text-center"> | 69 | <div class="dialog-footer text-center"> |
| 65 | <a class="btn-black w200px" @click="register">{{language==0?'登录':'Confirm'}}</a> | 70 | <a class="btn-black w200px" @click="register">{{ language == 0 ? '登录' : 'Confirm' }}</a> |
| 66 | <div class="text-primary underline mt20 pointer" @click="goLogin">{{language==0?'已有账号去登录':'Already have an account? Login'}}</div> | 71 | <div class="text-primary underline mt20 pointer" @click="goLogin"> |
| 72 | {{ language == 0 ? '已有账号去登录' : 'Already have an account? Login' }} | ||
| 73 | </div> | ||
| 67 | </div> | 74 | </div> |
| 68 | </template> | 75 | </template> |
| 69 | </el-dialog> | 76 | </el-dialog> |
| ... | @@ -92,10 +99,21 @@ const data = reactive({ | ... | @@ -92,10 +99,21 @@ const data = reactive({ |
| 92 | failVcode: '验证失败,请重试', | 99 | failVcode: '验证失败,请重试', |
| 93 | successVcode: '验证通过!', | 100 | successVcode: '验证通过!', |
| 94 | sliderText: '拖动滑块完成拼图', | 101 | sliderText: '拖动滑块完成拼图', |
| 95 | show:false, | 102 | show: false, |
| 96 | associationList:[] | 103 | associationList: [] |
| 97 | }) | 104 | }) |
| 98 | const {isShow, isCodeTrue, counting, form, activeStep, failVcode, successVcode, sliderText,show,associationList} = toRefs(data) | 105 | const { |
| 106 | isShow, | ||
| 107 | isCodeTrue, | ||
| 108 | counting, | ||
| 109 | form, | ||
| 110 | activeStep, | ||
| 111 | failVcode, | ||
| 112 | successVcode, | ||
| 113 | sliderText, | ||
| 114 | show, | ||
| 115 | associationList | ||
| 116 | } = toRefs(data) | ||
| 99 | const emit = defineEmits(['submit']) | 117 | const emit = defineEmits(['submit']) |
| 100 | onMounted(() => { | 118 | onMounted(() => { |
| 101 | if (language.value == 1) { | 119 | if (language.value == 1) { |
| ... | @@ -106,7 +124,7 @@ onMounted(() => { | ... | @@ -106,7 +124,7 @@ onMounted(() => { |
| 106 | getAssociationList() | 124 | getAssociationList() |
| 107 | }) | 125 | }) |
| 108 | const getAssociationList = () => { | 126 | const getAssociationList = () => { |
| 109 | getAssociation().then(res=>{ | 127 | getAssociation().then(res => { |
| 110 | associationList.value = res.data | 128 | associationList.value = res.data |
| 111 | }) | 129 | }) |
| 112 | } | 130 | } |
| ... | @@ -136,7 +154,7 @@ function sendsmsMsg() { | ... | @@ -136,7 +154,7 @@ function sendsmsMsg() { |
| 136 | return | 154 | return |
| 137 | } | 155 | } |
| 138 | if (counting.value) { | 156 | if (counting.value) { |
| 139 | return | 157 | |
| 140 | } else { | 158 | } else { |
| 141 | isShow.value = true | 159 | isShow.value = true |
| 142 | } | 160 | } |
| ... | @@ -157,17 +175,19 @@ function codeSuccess(msg) { | ... | @@ -157,17 +175,19 @@ function codeSuccess(msg) { |
| 157 | getCaptchaSms({account: form.value.account}).then(res => { | 175 | getCaptchaSms({account: form.value.account}).then(res => { |
| 158 | counting.value = true | 176 | counting.value = true |
| 159 | isCodeTrue.value = true | 177 | isCodeTrue.value = true |
| 160 | ElMessage.success(language.value == 0 ? '发送成功,请关注邮箱邮件' :'Send success, please check your email') | 178 | ElMessage.success(language.value == 0 ? '发送成功,请关注邮箱邮件' : 'Send success, please check your email') |
| 161 | }) | 179 | }) |
| 162 | } | 180 | } |
| 163 | 181 | ||
| 164 | function resetCode() { | 182 | function resetCode() { |
| 165 | isCodeTrue.value = false | 183 | isCodeTrue.value = false |
| 166 | } | 184 | } |
| 185 | |||
| 167 | function goLogin() { | 186 | function goLogin() { |
| 168 | show.value = false | 187 | show.value = false |
| 169 | useUserStore().setReLogin() | 188 | useUserStore().setReLogin() |
| 170 | } | 189 | } |
| 190 | |||
| 171 | function register() { | 191 | function register() { |
| 172 | //游客注册 | 192 | //游客注册 |
| 173 | if (!form.value.account) { | 193 | if (!form.value.account) { |
| ... | @@ -187,29 +207,39 @@ function register() { | ... | @@ -187,29 +207,39 @@ function register() { |
| 187 | return | 207 | return |
| 188 | } | 208 | } |
| 189 | if (!form.value.password) { | 209 | if (!form.value.password) { |
| 190 | ElMessage.warning(language.value == 0?'请输入密码':'Please enter password') | 210 | ElMessage.warning(language.value == 0 ? '请输入密码' : 'Please enter password') |
| 191 | return | 211 | return |
| 192 | } | 212 | } |
| 193 | if (!form.value.password2) { | 213 | if (!form.value.password2) { |
| 194 | ElMessage.warning(language.value == 0?'请再次输入密码':'Please enter password') | 214 | ElMessage.warning(language.value == 0 ? '请再次输入密码' : 'Please enter password') |
| 195 | return | 215 | return |
| 196 | } | 216 | } |
| 197 | delete form.value.password2 | 217 | delete form.value.password2 |
| 198 | vistorRegister(form.value).then(res=>{ | 218 | vistorRegister(form.value).then(res => { |
| 199 | setToken(res.data.token) | 219 | setToken(res.data.token) |
| 200 | emit('submitForm') | 220 | emit('submitForm') |
| 201 | }) | 221 | }) |
| 202 | } | 222 | } |
| 223 | |||
| 203 | const vconfirmPassword = () => { | 224 | const vconfirmPassword = () => { |
| 204 | if (form.value.password !== form.value.password2) { | 225 | if (form.value.password !== form.value.password2) { |
| 205 | ElMessage.warning(language.value == 0 ? '两次输入的密码不一致' :'The two passwords entered are inconsistent') | 226 | ElMessage.warning(language.value == 0 ? '两次输入的密码不一致' : 'The two passwords entered are inconsistent') |
| 206 | } | 227 | } |
| 207 | } | 228 | } |
| 229 | |||
| 208 | function close() { | 230 | function close() { |
| 209 | show.value = false | 231 | show.value = false |
| 210 | } | 232 | } |
| 211 | </script> | 233 | </script> |
| 212 | 234 | ||
| 213 | <style scoped lang="scss"> | 235 | <style lang="scss" scoped> |
| 214 | .tip{line-height: 1.6} | 236 | .tip { |
| 237 | line-height: 1.6 | ||
| 238 | } | ||
| 239 | |||
| 240 | .codeBtn { | ||
| 241 | background-color: #0540EC !important; | ||
| 242 | color: #fff !important; | ||
| 243 | |||
| 244 | } | ||
| 215 | </style> | 245 | </style> | ... | ... |
-
Please register or sign in to post a comment