LoginDialog.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. <template>
  2. <el-dialog
  3. v-model="dialogVisible"
  4. :title="''"
  5. width="420px"
  6. center
  7. custom-class="login-dialog"
  8. :close-on-click-modal="false"
  9. :close-on-press-escape="false"
  10. >
  11. <!-- 登录标题 -->
  12. <div class="login-header">
  13. <h2 class="login-title">{{ $t('common.login') }}</h2>
  14. <!-- <p class="login-subtitle">请登录您的账号</p> -->
  15. </div>
  16. <el-tabs v-model="activeTab" @tab-change="handleTabChange" class="login-tabs">
  17. <el-tab-pane :label="$t('login.smsLogin')" name="sms">
  18. <el-form ref="smsFormRef" :model="smsForm" :rules="smsRules" label-width="0">
  19. <el-form-item prop="account" class="login-form-item">
  20. <el-input
  21. v-model="smsForm.account"
  22. :placeholder="$t('login.placeholderPhoneOrEmail')"
  23. prefix-icon="User"
  24. clearable
  25. class="login-input"
  26. />
  27. </el-form-item>
  28. <el-form-item prop="smsCode" class="login-form-item">
  29. <el-input
  30. v-model="smsForm.verifyCode"
  31. :placeholder="$t('login.placeholderCaptcha')"
  32. prefix-icon="Message"
  33. clearable
  34. class="login-input"
  35. >
  36. <template #append>
  37. <el-button
  38. :disabled="smsCountdown > 0"
  39. @click="sendSmsCode"
  40. style="width:140px"
  41. :class="{'countdown-btn': smsCountdown > 0}"
  42. size="small"
  43. >
  44. {{ smsCountdown > 0 ? `${smsCountdown}s` : $t('login.sendCaptcha') }}
  45. </el-button>
  46. </template>
  47. </el-input>
  48. </el-form-item>
  49. <el-form-item class="login-form-item">
  50. <el-button
  51. type="primary"
  52. @click="handleSmsLogin"
  53. :loading="loading"
  54. class="login-button"
  55. size="large"
  56. >
  57. {{ $t('common.login') }}
  58. </el-button>
  59. </el-form-item>
  60. </el-form>
  61. </el-tab-pane>
  62. <el-tab-pane :label="$t('login.passwordLogin')" name="password">
  63. <el-form ref="passwordFormRef" :model="passwordForm" :rules="passwordRules" label-width="0">
  64. <el-form-item prop="account" class="login-form-item">
  65. <el-input
  66. v-model="passwordForm.account"
  67. :placeholder="$t('login.placeholderAccount')"
  68. prefix-icon="User"
  69. clearable
  70. class="login-input"
  71. />
  72. </el-form-item>
  73. <el-form-item prop="password" class="login-form-item">
  74. <el-input
  75. v-model="passwordForm.password"
  76. type="password"
  77. :placeholder="$t('login.placeholderPassword')"
  78. prefix-icon="Lock"
  79. show-password
  80. class="login-input"
  81. />
  82. </el-form-item>
  83. <!-- 增加动态验证码图片 -->
  84. <el-form-item prop="captcha" class="login-form-item">
  85. <el-input
  86. v-model="passwordForm.captcha"
  87. :placeholder="$t('login.placeholderCaptcha')"
  88. prefix-icon="Lock"
  89. class="login-input"
  90. >
  91. <template #append>
  92. <img :src="captchaImg" alt="验证码" class="captcha-img" @click="getCaptchaFn">
  93. </template>
  94. </el-input>
  95. </el-form-item>
  96. <el-form-item class="login-form-item remember-item">
  97. <!-- <el-checkbox v-model="passwordForm.remember" class="remember-checkbox">
  98. <span class="remember-text">记住密码</span>
  99. </el-checkbox> -->
  100. <el-link type="primary" href="#" :underline="false" class="forgot-link" @click="activeTab = 'reset'">{{ $t('login.forgetPassword') }} ?</el-link>
  101. </el-form-item>
  102. <el-form-item class="login-form-item">
  103. <el-button
  104. type="primary"
  105. @click="handlePasswordLogin"
  106. :loading="loading"
  107. class="login-button"
  108. size="large"
  109. >
  110. {{ $t('common.login') }}
  111. </el-button>
  112. </el-form-item>
  113. </el-form>
  114. </el-tab-pane>
  115. <el-tab-pane :label="$t('login.resetPassword')" name="reset">
  116. <el-form ref="resetFormRef" :model="resetForm" :rules="resetRules" label-width="0">
  117. <el-form-item prop="account" class="login-form-item">
  118. <el-input
  119. v-model="resetForm.account"
  120. :placeholder="$t('login.placeholderPhoneOrEmail')"
  121. prefix-icon="User"
  122. clearable
  123. class="login-input"
  124. />
  125. </el-form-item>
  126. <el-form-item prop="smsCode" class="login-form-item">
  127. <el-input
  128. v-model="resetForm.verifyCode"
  129. :placeholder="$t('login.placeholderCaptcha')"
  130. prefix-icon="Message"
  131. clearable
  132. class="login-input"
  133. >
  134. <template #append>
  135. <el-button
  136. :disabled="passwordresetCountdown > 0"
  137. @click="sendPasswordresetCode"
  138. style="width:140px"
  139. :class="{'countdown-btn': passwordresetCountdown > 0}"
  140. size="small"
  141. >
  142. {{ passwordresetCountdown > 0 ? `${passwordresetCountdown}s` : $t('login.sendCaptcha') }}
  143. </el-button>
  144. </template>
  145. </el-input>
  146. </el-form-item>
  147. <el-form-item prop="newPassword" class="login-form-item">
  148. <el-input
  149. v-model="resetForm.newPassword"
  150. :placeholder="$t('login.placeholderNewPassword')"
  151. prefix-icon="Lock"
  152. show-password
  153. class="login-input"
  154. />
  155. </el-form-item>
  156. <el-form-item prop="confirmPassword" class="login-form-item">
  157. <el-input
  158. v-model="resetForm.confirmPassword"
  159. :placeholder="$t('login.placeholderConfirmPassword')"
  160. prefix-icon="Lock"
  161. show-password
  162. class="login-input"
  163. />
  164. </el-form-item>
  165. <el-form-item class="login-form-item">
  166. <el-button
  167. type="primary"
  168. @click="handleResetPassword"
  169. :loading="loading"
  170. class="login-button"
  171. size="large"
  172. >
  173. {{ $t('common.login') }}
  174. </el-button>
  175. </el-form-item>
  176. </el-form>
  177. </el-tab-pane>
  178. </el-tabs>
  179. <!-- 其他登录方式 -->
  180. <div class="other-login">
  181. <div class="divider">
  182. <span class="divider-text">{{ $t('login.otherLogin') }}</span>
  183. </div>
  184. <div class="social-login">
  185. <el-button
  186. type="default"
  187. @click="handleWechatLogin"
  188. class="social-btn wechat-btn"
  189. >
  190. <img :src="WeChatIcon" alt="微信登录" style="width: 24px; height: 24px;">
  191. </el-button>
  192. <el-button
  193. type="default"
  194. @click="handleQqLogin"
  195. class="social-btn qq-btn"
  196. >
  197. <img :src="QQIcon" alt="微信登录" style="width: 24px; height: 24px;">
  198. </el-button>
  199. </div>
  200. </div>
  201. <div class="flex-center mt20">
  202. <div>
  203. <span class="gray999">{{ $t('login.loginAgreement') }}</span>
  204. <span class="cursor-pointer link"
  205. @click="router.push({name:'Agreement',query:{type:'privacy_policy'}});dialogVisible=false;">
  206. 《{{ $t('agreement.privacy_policy') }}》
  207. </span>
  208. </div>
  209. </div>
  210. <!-- 注册链接 -->
  211. <!-- <div class="register-link">
  212. <span>还没有账号?</span>
  213. <el-link type="primary" href="#" :underline="false">立即注册</el-link>
  214. </div> -->
  215. </el-dialog>
  216. </template>
  217. <script setup>
  218. import { ref, reactive, watch, computed } from 'vue'
  219. import { ElMessage } from 'element-plus'
  220. import DGTMessage from '@/utils/message'
  221. import QQIcon from '@/assets/imgs/QQ.png'
  222. import WeChatIcon from '@/assets/imgs/WeChat.png'
  223. import { getCaptcha, loginUsername, loginPhone, loginEmail, getSmsCode, getEmailCode, resetPassword, getPasswordresetCode } from '@/api/auth.js'
  224. import { useAppStore } from '@/pinia/appStore'
  225. const appStore = useAppStore();
  226. import { useRoute, useRouter } from 'vue-router'
  227. const route = useRoute()
  228. const router = useRouter()
  229. import { useI18n } from 'vue-i18n'
  230. const { t } = useI18n()
  231. // 正则表达式
  232. const PHONE_REGEX = /^1[3-9]\d{9}$/;
  233. const EMAIL_REGEX = /^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+$/;
  234. const isPasswordPhone = computed(() => {
  235. return PHONE_REGEX.test(passwordForm.account);
  236. });
  237. const isPasswordEmail = computed(() => {
  238. return EMAIL_REGEX.test(passwordForm.account);
  239. });
  240. const emit = defineEmits(['login-success'])
  241. // 对话框可见性
  242. const dialogVisible = ref(false)
  243. // 验证码图片
  244. const captchaImg = ref('')
  245. const open = () => {
  246. dialogVisible.value = true;
  247. appStore.showLoginDialog = false;
  248. getCaptchaFn()
  249. }
  250. const getCaptchaFn = async (type) => {
  251. try {
  252. const res = await getCaptcha()
  253. passwordForm.uuid = res.data?.uuid;
  254. if (res.data?.img.startsWith('data:image')) {
  255. captchaImg.value = res.data?.img;
  256. } else {
  257. captchaImg.value = 'data:image/jpeg;base64,' + res.data?.img;
  258. }
  259. } catch (error) {
  260. ElMessage.error(error.message || '验证码获取失败')
  261. }
  262. }
  263. // 当前激活的标签页
  264. const activeTab = ref('sms')
  265. // 密码登录表单
  266. const passwordForm = reactive({
  267. account: '13925214105',//
  268. password: 'zhangning13Z',//
  269. captcha: '',
  270. uuid: ''
  271. })
  272. // 短信登录表单
  273. const smsForm = reactive({
  274. account: '',
  275. verifyCode: ''
  276. })
  277. // 重置密码表单
  278. const resetForm = reactive({
  279. account: '',
  280. verifyCode: '',
  281. newPassword: '',
  282. confirmPassword: ''
  283. })
  284. // 表单引用
  285. const passwordFormRef = ref(null)
  286. const smsFormRef = ref(null)
  287. const resetFormRef = ref(null)
  288. // 加载状态
  289. const loading = ref(false)
  290. // 验证码倒计时
  291. const smsCountdown = ref(0)
  292. const passwordresetCountdown = ref(0)
  293. const emailCountdown = ref(0)
  294. // 表单验证规则
  295. const passwordRules = reactive({
  296. account: [
  297. { required: true, message: t('login.placeholderAccount'), trigger: 'blur' },
  298. { validator: (val) => isPasswordPhone.value || isPasswordEmail.value, message: t('login.placeholderPhoneOrEmailTip'), trigger: 'blur' }
  299. ],
  300. password: [
  301. { required: true, message: t('login.placeholderPassword'), trigger: 'blur' },
  302. { min: 6, message: t('login.passwordMinLength'), trigger: 'blur' }
  303. ],
  304. captcha: [
  305. { required: true, message: t('login.placeholderCaptcha'), trigger: 'blur' }
  306. ]
  307. })
  308. const smsRules = reactive({
  309. account: [
  310. { required: true, message: t('login.placeholderPhoneOrEmail'), trigger: 'blur' },
  311. { validator: (rule, val) => PHONE_REGEX.test(val) || EMAIL_REGEX.test(val), message: t('login.placeholderPhoneOrEmailTip'), trigger: 'blur' }
  312. ],
  313. verifyCode: [
  314. { required: true, message: t('login.placeholderCaptcha'), trigger: 'blur' },
  315. // { min: 6, max: 6, message: '验证码长度为6个字符', trigger: 'blur' }
  316. ]
  317. })
  318. // 重置密码表单验证规则
  319. const resetRules = reactive({
  320. account: [
  321. { required: true, message: t('login.placeholderPhoneOrEmail'), trigger: 'blur' },
  322. { validator: (rule, val) => PHONE_REGEX.test(val) || EMAIL_REGEX.test(val), message: t('login.placeholderPhoneOrEmailTip'), trigger: 'blur' }
  323. ],
  324. verifyCode: [
  325. { required: true, message: t('login.placeholderCaptcha'), trigger: 'blur' },
  326. // { min: 6, max: 6, message: '验证码长度为6个字符', trigger: 'blur' }
  327. ],
  328. newPassword: [
  329. { required: true, message: t('login.placeholderNewPassword'), trigger: 'blur' },
  330. { min: 6, message: t('login.passwordMinLength'), trigger: 'blur' }
  331. ],
  332. confirmPassword: [
  333. { required: true, message: t('login.placeholderConfirmPassword'), trigger: 'blur' },
  334. { validator: (rule, val) => val === resetForm.newPassword, message: t('login.passwordNotSame'), trigger: 'blur' }
  335. ]
  336. })
  337. // 处理标签页切换
  338. const handleTabChange = () => {
  339. // 切换标签页时重置表单
  340. if (activeTab.value === 'password') {
  341. passwordFormRef.value?.resetFields()
  342. } else if (activeTab.value === 'sms') {
  343. smsFormRef.value?.resetFields()
  344. }
  345. }
  346. // 发送短信验证码
  347. const sendSmsCode = async () => {
  348. if (!smsForm.account) {
  349. ElMessage.warning(t('login.placeholderPhoneOrEmail'))
  350. return
  351. }
  352. // 验证手机号格式
  353. if (!PHONE_REGEX.test(smsForm.account) && !EMAIL_REGEX.test(smsForm.account)) {
  354. ElMessage.warning(t('login.placeholderPhoneOrEmailTip'))
  355. return
  356. }
  357. let res = null;
  358. if(PHONE_REGEX.test(smsForm.account)){
  359. res = await getSmsCode({
  360. phone: smsForm.account
  361. })
  362. } else if (EMAIL_REGEX.test(smsForm.account)){
  363. res = await getEmailCode({
  364. email: smsForm.account
  365. })
  366. }
  367. if(res.code !== 200){
  368. return
  369. }
  370. // 模拟发送验证码
  371. ElMessage.success(t('login.captchaSendSuccess'))
  372. // 开始倒计时
  373. smsCountdown.value = 60
  374. const timer = setInterval(() => {
  375. smsCountdown.value--
  376. if (smsCountdown.value <= 0) {
  377. clearInterval(timer)
  378. }
  379. }, 1000)
  380. }
  381. // 发送邮箱验证码
  382. const sendEmailCode = () => {
  383. if (!emailForm.email) {
  384. ElMessage.warning('请先输入邮箱')
  385. return
  386. }
  387. // 模拟发送验证码
  388. ElMessage.success(t('login.captchaSendSuccess'))
  389. // 开始倒计时
  390. emailCountdown.value = 60
  391. const timer = setInterval(() => {
  392. emailCountdown.value--
  393. if (emailCountdown.value <= 0) {
  394. clearInterval(timer)
  395. }
  396. }, 1000)
  397. }
  398. // 密码登录
  399. const handlePasswordLogin = () => {
  400. passwordFormRef.value?.validate(async (valid) => {
  401. if (valid) {
  402. loading.value = true
  403. const params = {};
  404. // 根据账号类型决定参数名
  405. if (isPasswordPhone.value) {
  406. params['phone'] = passwordForm.account;
  407. } else if (isPasswordEmail.value) {
  408. params['email'] = passwordForm.account;
  409. }
  410. params['password'] = passwordForm.password;
  411. params['captcha'] = passwordForm.captcha;
  412. params['uuid'] = passwordForm.uuid;
  413. const res = await loginUsername(params);
  414. loading.value = false
  415. if (res.code === 200) {
  416. ElMessage.success(t('login.loginSuccess'))
  417. // emit('login-success', { type: 'password', userInfo: passwordForm })
  418. dialogVisible.value = false;
  419. // 登录成功后,将token存储到localStorage
  420. setToken(res.token);
  421. //刷新当前页
  422. // window.location.reload();
  423. }
  424. }
  425. })
  426. }
  427. // 短信登录
  428. const handleSmsLogin = () => {
  429. smsFormRef.value?.validate(async(valid) => {
  430. if (valid) {
  431. loading.value = true
  432. const params = {};
  433. let res = {};
  434. params['code'] = smsForm.verifyCode;
  435. // 根据账号类型决定参数名
  436. if (PHONE_REGEX.test(smsForm.account)) {
  437. params['phone'] = smsForm.account;
  438. res = await loginPhone(params);
  439. } else if (EMAIL_REGEX.test(smsForm.account)) {
  440. params['email'] = smsForm.account;
  441. res = await loginEmail(params);
  442. }
  443. loading.value = false
  444. if (res.code === 200) {
  445. ElMessage.success(t('login.loginSuccess'))
  446. // emit('login-success', { type: 'sms', userInfo: smsForm })
  447. dialogVisible.value = false;
  448. // 登录成功后,将token存储到localStorage
  449. setToken(res.token);
  450. //刷新当前页
  451. // window.location.reload();
  452. }
  453. }
  454. })
  455. }
  456. // 发送重置密码验证码
  457. const sendPasswordresetCode = async () => {
  458. if (!resetForm.account) {
  459. ElMessage.warning(t('login.placeholderPhoneOrEmail'))
  460. return
  461. }
  462. // 验证手机号格式
  463. if (!PHONE_REGEX.test(resetForm.account) && !EMAIL_REGEX.test(resetForm.account)) {
  464. ElMessage.warning(t('login.placeholderPhoneOrEmailTip'))
  465. return
  466. }
  467. let res = await getPasswordresetCode({
  468. account: resetForm.account
  469. })
  470. if(res.code !== 200){
  471. return
  472. }
  473. // 模拟发送验证码
  474. ElMessage.success(t('login.captchaSendSuccess'))
  475. // 开始倒计时
  476. passwordresetCountdown.value = 60
  477. const timer = setInterval(() => {
  478. passwordresetCountdown.value--
  479. if (passwordresetCountdown.value <= 0) {
  480. clearInterval(timer)
  481. }
  482. }, 1000)
  483. }
  484. // 重置密码
  485. const handleResetPassword = () => {
  486. resetFormRef.value?.validate(async (valid) => {
  487. if (valid) {
  488. loading.value = true
  489. const res = await resetPassword(resetForm);
  490. loading.value = false
  491. if (res.code === 200) {
  492. ElMessage.success('密码重置成功')
  493. activeTab.value = 'password';
  494. }
  495. }
  496. })
  497. }
  498. const setToken = (token) => {
  499. appStore.UPDATE_TOKEN(token);
  500. //获取当前路由 ,路由是/learn-note
  501. console.log(route.path)
  502. // if(
  503. // route.path.startsWith('/learn-note') ||
  504. // route.path.startsWith('/mibi-shop')
  505. // ){
  506. // // 刷新当前页
  507. // window.location.reload();
  508. // }
  509. window.location.reload();
  510. }
  511. // 微信登录
  512. const handleWechatLogin = () => {
  513. ElMessage.info('微信登录功能开发中')
  514. }
  515. // QQ登录
  516. const handleQqLogin = () => {
  517. ElMessage.info('QQ登录功能开发中')
  518. }
  519. defineExpose({
  520. open
  521. })
  522. </script>
  523. <style scoped lang="scss">
  524. /* 登录对话框容器 */
  525. .login-dialog {
  526. .el-dialog__header {
  527. padding: 0;
  528. }
  529. .el-dialog__body {
  530. padding: 20px 30px 30px;
  531. }
  532. .el-dialog__footer {
  533. display: none;
  534. }
  535. }
  536. /* 登录标题 */
  537. .login-header {
  538. text-align: center;
  539. margin-bottom: 30px;
  540. }
  541. .login-title {
  542. font-size: 24px;
  543. font-weight: 600;
  544. color: #303133;
  545. margin-bottom: 8px;
  546. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  547. -webkit-background-clip: text;
  548. -webkit-text-fill-color: transparent;
  549. background-clip: text;
  550. }
  551. .login-subtitle {
  552. font-size: 14px;
  553. color: #909399;
  554. }
  555. /* 标签页 */
  556. .login-tabs {
  557. margin-bottom: 20px;
  558. .el-tabs__nav {
  559. justify-content: center;
  560. }
  561. .el-tabs__item {
  562. font-size: 15px;
  563. color: #606266;
  564. padding: 0 20px;
  565. }
  566. .el-tabs__item.is-active {
  567. color: #667eea;
  568. font-weight: 500;
  569. }
  570. .el-tabs__active-bar {
  571. background-color: #667eea;
  572. height: 3px;
  573. }
  574. }
  575. /* 表单样式 */
  576. .login-form-item {
  577. margin-bottom: 20px;
  578. }
  579. /* 输入框样式 */
  580. .login-input {
  581. height: 48px;
  582. border-radius: 24px;
  583. // border: 1px solid #e4e7ed;
  584. transition: all 0.3s ease;
  585. font-size: 15px;
  586. &:hover {
  587. // border-color: #667eea;
  588. // box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
  589. }
  590. &.is-focus {
  591. // border-color: #667eea;
  592. // box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
  593. }
  594. .el-input__wrapper {
  595. box-shadow: none;
  596. background-color: #fafafa;
  597. border-radius: 24px;
  598. }
  599. .el-input__inner {
  600. background-color: transparent;
  601. border: none;
  602. height: 48px;
  603. line-height: 48px;
  604. }
  605. }
  606. /* 记住密码和忘记密码 */
  607. .remember-item {
  608. display: flex;
  609. justify-content: space-between;
  610. align-items: center;
  611. margin-bottom: 25px;
  612. }
  613. .remember-checkbox {
  614. .el-checkbox__input.is-checked .el-checkbox__inner {
  615. background-color: #667eea;
  616. border-color: #667eea;
  617. }
  618. .el-checkbox__input.is-checked + .el-checkbox__label {
  619. color: #667eea;
  620. }
  621. }
  622. .remember-text {
  623. font-size: 14px;
  624. color: #606266;
  625. }
  626. .forgot-link {
  627. font-size: 14px;
  628. color: #667eea;
  629. transition: color 0.3s ease;
  630. &:hover {
  631. color: #5366d1;
  632. }
  633. }
  634. /* 登录按钮 */
  635. .login-button {
  636. width: 100%;
  637. height: 48px;
  638. border-radius: 24px;
  639. font-size: 16px;
  640. font-weight: 500;
  641. border: none;
  642. transition: all 0.3s ease;
  643. &:hover {
  644. transform: translateY(-2px);
  645. box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
  646. }
  647. &:active {
  648. transform: translateY(0);
  649. }
  650. }
  651. /* 其他登录方式 */
  652. .other-login {
  653. margin-top: 30px;
  654. }
  655. .divider {
  656. position: relative;
  657. text-align: center;
  658. margin-bottom: 20px;
  659. &::before, &::after {
  660. content: '';
  661. position: absolute;
  662. top: 50%;
  663. width: 40%;
  664. height: 1px;
  665. background-color: #ebeef5;
  666. }
  667. &::before {
  668. left: 0;
  669. }
  670. &::after {
  671. right: 0;
  672. }
  673. }
  674. .divider-text {
  675. display: inline-block;
  676. padding: 0 20px;
  677. font-size: 13px;
  678. color: #909399;
  679. background-color: #fff;
  680. }
  681. /* 社交登录按钮 */
  682. .social-login {
  683. display: flex;
  684. justify-content: center;
  685. gap: 20px;
  686. }
  687. .social-btn {
  688. width: 44px;
  689. height: 44px;
  690. border-radius: 50%;
  691. transition: all 0.3s ease;
  692. border: 1px solid #e4e7ed;
  693. &:hover {
  694. transform: translateY(-3px);
  695. box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  696. }
  697. }
  698. .wechat-btn {
  699. color: #67c23a;
  700. &:hover {
  701. border-color: #67c23a;
  702. background-color: rgba(103, 194, 58, 0.05);
  703. }
  704. }
  705. .qq-btn {
  706. color: #409eff;
  707. &:hover {
  708. border-color: #409eff;
  709. background-color: rgba(64, 158, 255, 0.05);
  710. }
  711. }
  712. /* 注册链接 */
  713. .register-link {
  714. text-align: center;
  715. margin-top: 25px;
  716. font-size: 14px;
  717. color: #606266;
  718. .el-link {
  719. margin-left: 5px;
  720. color: #667eea;
  721. font-weight: 500;
  722. &:hover {
  723. color: #5366d1;
  724. }
  725. }
  726. }
  727. /* 验证码按钮 */
  728. .countdown-btn {
  729. background-color: #f5f7fa;
  730. color: #909399;
  731. border-color: #e4e7ed;
  732. &:hover {
  733. background-color: #e4e7ed;
  734. border-color: #dcdfe6;
  735. }
  736. }
  737. /* 响应式设计 */
  738. @media (max-width: 768px) {
  739. .login-dialog {
  740. width: 90% !important;
  741. margin: 0 auto;
  742. .el-dialog__body {
  743. padding: 20px;
  744. }
  745. }
  746. .login-title {
  747. font-size: 22px;
  748. }
  749. .login-input,
  750. .login-button {
  751. height: 44px;
  752. }
  753. }
  754. </style>