66 class =" login-tabbar__item"
77 :class =" { 'login-tabbar__item--active': loginMode === 'phone' }"
88 @click =" toggleLoginMode('phone')"
9- >
10- 手机号登录
11- </li >
9+ >手机号登录</li >
1210 <li
1311 class =" login-tabbar__item"
1412 @click =" toggleLoginMode('email')"
1513 :class =" { 'login-tabbar__item--active': loginMode === 'email' }"
16- >
17- 邮箱登录
18- </li >
14+ >邮箱登录</li >
1915 </ul >
2016
2117 <ul class =" login-form-content" >
2218 <li class =" login-form-content__phone" v-if =" loginMode === 'phone'" >
2319 <el-form :model =" phoneForm" key =" phone" >
2420 <el-form-item >
25- <el-input
26- v-model =" phoneForm.phone"
27- placeholder =" 输入手机号"
28- class =" input-with-select"
29- >
30- <el-select
31- slot =" prepend"
32- v-model =" selectedCountry"
33- placeholder =" 请选择"
34- >
35- <el-option value =" disabled" disabled
36- >选择国家和地区</el-option
37- >
21+ <el-input v-model =" phoneForm.phone" placeholder =" 输入手机号" class =" input-with-select" >
22+ <el-select slot =" prepend" v-model =" selectedCountry" placeholder =" 请选择" >
23+ <el-option value =" disabled" disabled >选择国家和地区</el-option >
3824 <hr class =" input-with-select__divider" />
3925 <el-option
4026 :value =" `+${item.val}`"
4127 v-for =" item in mobileCode"
4228 :key =" item.id"
43- >{{ item.country }} +{{ item.val }}</el-option
44- >
29+ >{{ item.country }} +{{ item.val }}</el-option >
4530 </el-select >
4631 </el-input >
4732 </el-form-item >
5338 </el-form >
5439 </li >
5540 <li class =" login-form-content__email" v-else >
56- <el-form
57- key =" email"
58- :rules =" emailFormRules"
59- :model =" emailForm"
60- ref =" emailForm"
61- >
41+ <el-form key =" email" :rules =" emailFormRules" :model =" emailForm" ref =" emailForm" >
6242 <el-form-item ref =" emailFormItem" prop =" email" >
6343 <el-input
6444 @blur =" onEmailInputBlur"
6545 @focus =" clearEmailValidation"
6646 v-model =" emailForm.email"
6747 placeholder =" 请输入邮箱"
48+ autocomplete =" on"
6849 ></el-input >
6950 </el-form-item >
7051 <el-form-item prop =" password" ref =" passFormItem" >
9071 </li >
9172 </ul >
9273 <div class =" login__button" >
93- <bytedance-button @click =" handlerLogin" type =" primary" size =" large"
94- >登录</bytedance-button
95- >
74+ <bytedance-button :loading =" loading" @click =" handlerLogin" type =" primary" size =" large" >登录</bytedance-button >
9675 </div >
9776 </div >
9877 </div >
10180import {
10281 fetchLoginByEmail ,
10382 fetchCommonSettings ,
104- fetchEmailRegisterStatus ,
83+ fetchEmailRegisterStatus
10584} from " @/helper/requestWithToken.js" ;
10685import store from " @/store/index.js" ;
10786
108-
10987export default {
88+ name: " user" ,
11089 data () {
11190 const self = this ;
11291 const validator = async (rule , val , cb , source , opt ) => {
@@ -117,7 +96,7 @@ export default {
11796 if (triggerType === " submit" ) return ;
11897 try {
11998 var result = await fetchEmailRegisterStatus ({
120- email: self .emailForm .email ,
99+ email: self .emailForm .email
121100 });
122101 } catch (error) {
123102 throw error;
@@ -131,43 +110,44 @@ export default {
131110 {
132111 required: true ,
133112 trigger: " blur" ,
134- message: " 邮箱不能为空" ,
113+ message: " 邮箱不能为空"
135114 },
136115 {
137116 type: " email" ,
138117 trigger: " blur" ,
139- message: " 邮箱格式不正确" ,
118+ message: " 邮箱格式不正确"
140119 },
141120 {
142121 validator,
143- trigger: " blur" ,
144- },
122+ trigger: " blur"
123+ }
145124 ];
146125 return {
147126 emailFormRules: {
148127 email: mutipleEmailRules,
149128 password: {
150129 required: true ,
151- message: " 密码不能为空" ,
152- },
130+ message: " 密码不能为空"
131+ }
153132 },
154133 loginMode: " email" ,
155134 mobileCode: [],
156135 phoneForm: {
157136 verifyCode: " " ,
158- phone: " " ,
137+ phone: " "
159138 },
160139 emailForm: {
161140 email: " " ,
162- password: " " ,
141+ password: " "
163142 },
164143 passwordInputType: " password" ,
165144 selectedCountry: " " ,
145+ loading: false
166146 };
167147 },
168148
169149 created () {
170- fetchCommonSettings ().then (( response ) => {
150+ fetchCommonSettings ().then (response => {
171151 this .mobileCode = response .data .mobile_code ;
172152 });
173153 },
@@ -195,11 +175,15 @@ export default {
195175 } catch (error) {
196176 return ;
197177 }
178+ this .loading = true ;
198179 try {
199180 await store .requestUserInfo ();
200181 } catch (error) {
182+ this .loading = false ;
183+
201184 return error;
202185 }
186+ this .loading = false ;
203187
204188 this .$router .push (" /" );
205189 },
@@ -216,8 +200,8 @@ export default {
216200 togglePasswordInputType () {
217201 this .passwordInputType =
218202 this .passwordInputType === " password" ? " text" : " password" ;
219- },
220- },
203+ }
204+ }
221205};
222206 </script >
223207<style lang="less">
0 commit comments