514607a8 by zhangmeng

H5适配

1 parent 9f35509e
1 <template> 1 <template>
2 <el-dialog v-model="show" :title="language==0?'快捷注册':'Quick Login'" close-icon="CircleClose" 2 <el-dialog
3 width="480" :append-to-body="true" destroy-on-close @close="close"> 3 v-model="show" :append-to-body="true" :title="language==0?'快捷注册':'Quick Login'"
4 close-icon="CircleClose" destroy-on-close style="max-width: 480px;min-width: 350px"
5 @close="close"
6 >
4 <div> 7 <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"> 8 <el-form
9 :label-position="language==0?'right':'top'" :label-width="language==0?80:150" class="d-form" size="large"
10 style="max-width: 500px;margin: auto"
11 >
6 <el-form-item :label="language==0?'邮箱':'E-mail'" required> 12 <el-form-item :label="language==0?'邮箱':'E-mail'" required>
7 <el-input type="text" v-model="form.account" @change="resetCode" @blur="verifyCode" 13 <el-input v-model="form.account" type="text" @blur="verifyCode" @change="resetCode" />
8 /> 14 <div v-if="language==0" class="tip">
9 <div class="tip" v-if="language==0">
10 (请填写正确的邮箱信息,邮箱信息在注册完成后无法修改。 15 (请填写正确的邮箱信息,邮箱信息在注册完成后无法修改。
11 该邮箱后续会作为您登录的账户, 16 该邮箱后续会作为您登录的账户,
12 并接收报名审核结果、支付账单、签证邀请函等相关信息。) 17 并接收报名审核结果、支付账单、签证邀请函等相关信息。)
13 </div> 18 </div>
14 <div v-else class="tip"> 19 <div v-else class="tip">
15 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. 20 Please fill in the correct email, which cannot be changed after the registration is completed. The email
21 will be used as your login account and to receive relevant information including results of registration
22 review, payment bills, visa invitation letters, etc.
16 </div> 23 </div>
17 </el-form-item> 24 </el-form-item>
18 <el-form-item :label="language==0?'验证码':'Code'" required> 25 <el-form-item :label="language==0?'验证码':'Code'" required>
19 <el-input v-model="form.code"> 26 <el-input v-model="form.code">
20 <template #append> 27 <template #append>
21 <el-button type="primary" plain style="width: 110px" @click="sendsmsMsg"> 28 <el-button plain style="width: 110px" type="primary" @click="sendsmsMsg">
22 <count-down v-if="counting" v-slot="{ totalSeconds }" :time="60000" @end="counting=false"> 29 <count-down v-if="counting" v-slot="{ totalSeconds }" :time="60000" @end="counting=false">
23 {{ totalSeconds }} {{ language == 0 ? '秒' : 's' }} 30 {{ totalSeconds }} {{ language == 0 ? '秒' : 's' }}
24 </count-down> 31 </count-down>
...@@ -28,43 +35,53 @@ ...@@ -28,43 +35,53 @@
28 </el-button> 35 </el-button>
29 </template> 36 </template>
30 </el-input> 37 </el-input>
31 <div class="vcodeBox" :style="isShow?'height:240px':'height:0'"> 38 <div :style="isShow?'height:240px':'height:0'" class="vcodeBox">
32 <Vcode :show="isShow" :successText="successVcode" :failText="failVcode" :slider-text="sliderText" 39 <Vcode
33 type="inside" @success="codeSuccess"></Vcode> 40 :fail-text="failVcode" :show="isShow" :slider-text="sliderText" :success-text="successVcode"
41 type="inside" @success="codeSuccess"
42 />
34 </div> 43 </div>
35 </el-form-item> 44 </el-form-item>
36 <el-form-item :label="language==0?'密码':'Password'" required> 45 <el-form-item :label="language==0?'密码':'Password'" required>
37 <el-input type="password" show-password v-model="form.password" 46 <el-input
38 :placeholder="language==0?'6-16位密码。区分大小写':''"/> 47 v-model="form.password" :placeholder="language==0?'6-16位密码。区分大小写':''" show-password
48 type="password"
49 />
39 </el-form-item> 50 </el-form-item>
40 <el-form-item :label="language==0?'确认密码':'Confirm Password'" required> 51 <el-form-item :label="language==0?'确认密码':'Confirm Password'" required>
41 <el-input type="password" show-password v-model="form.password2" @blur="vconfirmPassword" 52 <el-input
42 :placeholder="language==0?'再次输入密码':''"/> 53 v-model="form.password2" :placeholder="language==0?'再次输入密码':''" show-password type="password"
54 @blur="vconfirmPassword"
55 />
43 </el-form-item> 56 </el-form-item>
44 </el-form> 57 </el-form>
45 58
46 </div> 59 </div>
47 <template #footer> 60 <template #footer>
48 <div class="dialog-footer text-center"> 61 <div class="dialog-footer text-center">
49 <el-button type="primary" class="btn-lineG w200px" round @click="register">{{language==0?'登录':'Confirm'}}</el-button> 62 <el-button class="btn-lineG w200px" round type="primary" @click="register">
50 <div class="text-primary underline mt20 pointer" @click="goLogin">{{language==0?'已有账号去登录':'Already have an account? Login'}}</div> 63 {{ language == 0 ? '登录' : 'Confirm' }}
51 64 </el-button>
65 <div class="text-primary underline mt20 pointer" @click="goLogin">
66 {{ language == 0 ? '已有账号去登录' : 'Already have an account? Login' }}
67 </div>
68
52 </div> 69 </div>
53 </template> 70 </template>
54 </el-dialog> 71 </el-dialog>
55 </template> 72 </template>
56 73
57 <script setup> 74 <script setup>
58 import {reactive, toRefs} from 'vue' 75 import { reactive, toRefs } from 'vue'
59 import Vcode from "vue3-puzzle-vcode" 76 import Vcode from 'vue3-puzzle-vcode'
60 import {ElMessage} from 'element-plus' 77 import { ElMessage } from 'element-plus'
61 import CountDown from '@chenfengyuan/vue-countdown' 78 import CountDown from '@chenfengyuan/vue-countdown'
62 import {getCaptchaSms} from "@/apiPc/match"; 79 import { getCaptchaSms } from '@/apiPc/match'
63 import {onMounted} from "@vue/runtime-core"; 80 import { onMounted } from '@vue/runtime-core'
64 import {useStorage} from "@vueuse/core/index"; 81 import { useStorage } from '@vueuse/core/index'
65 import {vistorRegister} from "@/apiPc/common"; 82 import { vistorRegister } from '@/apiPc/common'
66 import {setToken} from "@/utils/auth"; 83 import { setToken } from '@/utils/auth'
67 import useUserStore from "@/store/modules/user"; 84 import useUserStore from '@/store/modules/user'
68 85
69 const language = useStorage('language', 0) 86 const language = useStorage('language', 0)
70 87
...@@ -77,9 +94,9 @@ const data = reactive({ ...@@ -77,9 +94,9 @@ const data = reactive({
77 failVcode: '验证失败,请重试', 94 failVcode: '验证失败,请重试',
78 successVcode: '验证通过!', 95 successVcode: '验证通过!',
79 sliderText: '拖动滑块完成拼图', 96 sliderText: '拖动滑块完成拼图',
80 show:false 97 show: false
81 }) 98 })
82 const {isShow, isCodeTrue, counting, form, activeStep, failVcode, successVcode, sliderText,show} = toRefs(data) 99 const { isShow, isCodeTrue, counting, form, activeStep, failVcode, successVcode, sliderText, show } = toRefs(data)
83 const emit = defineEmits(['submit']) 100 const emit = defineEmits(['submit'])
84 onMounted(() => { 101 onMounted(() => {
85 if (language.value == 1) { 102 if (language.value == 1) {
...@@ -113,7 +130,7 @@ function sendsmsMsg() { ...@@ -113,7 +130,7 @@ function sendsmsMsg() {
113 return 130 return
114 } 131 }
115 if (counting.value) { 132 if (counting.value) {
116 return 133
117 } else { 134 } else {
118 isShow.value = true 135 isShow.value = true
119 } 136 }
...@@ -124,29 +141,31 @@ function verifyCode() { ...@@ -124,29 +141,31 @@ function verifyCode() {
124 return 141 return
125 } 142 }
126 if (form.value.account.indexOf('@') > -1) { 143 if (form.value.account.indexOf('@') > -1) {
127 //邮箱 144 // 邮箱
128 } 145 }
129 } 146 }
130 147
131 function codeSuccess(msg) { 148 function codeSuccess(msg) {
132 console.log('验证通过' + msg); 149 console.log('验证通过' + msg)
133 isShow.value = false 150 isShow.value = false
134 getCaptchaSms({account: form.value.account}).then(res => { 151 getCaptchaSms({ account: form.value.account }).then(res => {
135 counting.value = true 152 counting.value = true
136 isCodeTrue.value = true 153 isCodeTrue.value = true
137 ElMessage.success(language.value == 0 ? '发送成功,请关注邮箱邮件' :'Send success, please check your email') 154 ElMessage.success(language.value == 0 ? '发送成功,请关注邮箱邮件' : 'Send success, please check your email')
138 }) 155 })
139 } 156 }
140 157
141 function resetCode() { 158 function resetCode() {
142 isCodeTrue.value = false 159 isCodeTrue.value = false
143 } 160 }
161
144 function goLogin() { 162 function goLogin() {
145 show.value = false 163 show.value = false
146 useUserStore().setReLogin() 164 useUserStore().setReLogin()
147 } 165 }
166
148 function register() { 167 function register() {
149 //游客注册 168 // 游客注册
150 if (!form.value.account) { 169 if (!form.value.account) {
151 if (language.value == 0) { 170 if (language.value == 0) {
152 ElMessage.warning('请填写邮箱') 171 ElMessage.warning('请填写邮箱')
...@@ -164,29 +183,33 @@ function register() { ...@@ -164,29 +183,33 @@ function register() {
164 return 183 return
165 } 184 }
166 if (!form.value.password) { 185 if (!form.value.password) {
167 ElMessage.warning(language.value == 0?'请输入密码':'Please enter password') 186 ElMessage.warning(language.value == 0 ? '请输入密码' : 'Please enter password')
168 return 187 return
169 } 188 }
170 if (!form.value.password2) { 189 if (!form.value.password2) {
171 ElMessage.warning(language.value == 0?'请再次输入密码':'Please enter password') 190 ElMessage.warning(language.value == 0 ? '请再次输入密码' : 'Please enter password')
172 return 191 return
173 } 192 }
174 delete form.value.password2 193 delete form.value.password2
175 vistorRegister(form.value).then(res=>{ 194 vistorRegister(form.value).then(res => {
176 setToken(res.data.token) 195 setToken(res.data.token)
177 emit('submitForm') 196 emit('submitForm')
178 }) 197 })
179 } 198 }
199
180 const vconfirmPassword = () => { 200 const vconfirmPassword = () => {
181 if (form.value.password !== form.value.password2) { 201 if (form.value.password !== form.value.password2) {
182 ElMessage.warning(language.value == 0 ? '两次输入的密码不一致' :'The two passwords entered are inconsistent') 202 ElMessage.warning(language.value == 0 ? '两次输入的密码不一致' : 'The two passwords entered are inconsistent')
183 } 203 }
184 } 204 }
205
185 function close() { 206 function close() {
186 show.value = false 207 show.value = false
187 } 208 }
188 </script> 209 </script>
189 210
190 <style scoped lang="scss"> 211 <style lang="scss" scoped>
191 .tip{line-height: 1.6} 212 .tip {
213 line-height: 1.6
214 }
192 </style> 215 </style>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!