LoginCard.vue 7.9 KB
Newer Older
LiangLiu's avatar
LiangLiu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script setup>
import { useI18n } from 'vue-i18n'
const { t, locale } = useI18n()
import {    // 登录相关
            loginWithGitHub,
            loginWithGoogle,
            loginWithSms,
            phoneNumber,
            verifyCode,
            smsCountdown,
            showSmsForm,
            sendSmsCode,
            handleLoginCallback,
            handlePhoneEnter,
            handleVerifyCodeEnter,
            toggleSmsLogin,
            isLoggedIn,
            loginLoading,
            isLoading,
            initLoading,
            downloadLoading} from '../utils/other'
import { ref } from 'vue';
import { useRouter } from 'vue-router'
const router = useRouter();

</script>

<template>
LiangLiu's avatar
LiangLiu committed
29
30
31
32
33
34
35
36
            <!-- Apple 极简风格登录卡片 -->
            <div class="w-full max-w-xl mx-auto">
                <div class="bg-white/85 dark:bg-[#1e1e1e]/85 backdrop-blur-[40px] backdrop-saturate-[180%] border border-black/10 dark:border-white/10 rounded-3xl shadow-[0_20px_60px_rgba(0,0,0,0.15)] dark:shadow-[0_20px_60px_rgba(0,0,0,0.5)] px-14 py-16 sm:px-12 sm:py-14">
                    <!-- Logo和标题 - Apple 风格 -->
                    <div class="text-center mb-12">
                        <div class="flex items-center justify-center gap-3 mb-5">
                            <i class="fas fa-film text-4xl text-[color:var(--brand-primary)] dark:text-[color:var(--brand-primary-light)]"></i>
                            <h1 class="text-4xl font-semibold text-[#1d1d1f] dark:text-[#f5f5f7] tracking-tight">LightX2V</h1>
LiangLiu's avatar
LiangLiu committed
37
                        </div>
LiangLiu's avatar
LiangLiu committed
38
                        <p class="text-base text-[#86868b] dark:text-[#98989d] tracking-tight">{{ t('loginSubtitle') }}</p>
LiangLiu's avatar
LiangLiu committed
39
                    </div>
LiangLiu's avatar
LiangLiu committed
40
41
42
43

                    <!-- 表单区域 -->
                    <div class="space-y-6">
                        <!-- 手机号输入框 - Apple 风格 -->
LiangLiu's avatar
LiangLiu committed
44
      <div>
LiangLiu's avatar
LiangLiu committed
45
46
47
48
49
50
51
52
53
54
                            <label for="phoneNumber" class="block text-sm font-medium text-[#1d1d1f] dark:text-[#f5f5f7] mb-3 text-left tracking-tight">{{ t('phoneNumber') }}</label>
                            <input
                                v-model="phoneNumber"
                                type="tel"
                                name="phoneNumber"
                                required
                                maxlength="11"
                                @keyup.enter="handlePhoneEnter"
                                class="block w-full rounded-xl bg-white/80 dark:bg-[#2c2c2e]/80 backdrop-blur-[20px] border border-black/8 dark:border-white/8 px-5 py-4 text-[15px] text-[#1d1d1f] dark:text-[#f5f5f7] placeholder-[#86868b] dark:placeholder-[#98989d] transition-all duration-200 hover:bg-white dark:hover:bg-[#3a3a3c] hover:border-black/12 dark:hover:border-white/12 focus:outline-none focus:border-[color:var(--brand-primary)]/50 dark:focus:border-[color:var(--brand-primary-light)]/60 focus:shadow-[0_4px_16px_rgba(var(--brand-primary-rgb),0.12)] dark:focus:shadow-[0_4px_16px_rgba(var(--brand-primary-light-rgb),0.2)] tracking-tight"
                            />
LiangLiu's avatar
LiangLiu committed
55
56
      </div>

LiangLiu's avatar
LiangLiu committed
57
                        <!-- 验证码输入框 - Apple 风格 -->
LiangLiu's avatar
LiangLiu committed
58
      <div>
LiangLiu's avatar
LiangLiu committed
59
60
                            <div class="flex items-center justify-between mb-3">
                                <label for="verifyCode" class="block text-sm font-medium text-[#1d1d1f] dark:text-[#f5f5f7] tracking-tight">{{ t('verifyCode') }}</label>
LiangLiu's avatar
LiangLiu committed
61
62
            <button
                @click="sendSmsCode"
LiangLiu's avatar
LiangLiu committed
63
                                    class="text-sm font-medium text-[color:var(--brand-primary)] dark:text-[color:var(--brand-primary-light)] hover:text-[color:var(--brand-primary)]/80 dark:hover:text-[color:var(--brand-primary-light)]/80 transition-colors tracking-tight"
LiangLiu's avatar
LiangLiu committed
64
65
66
67
68
                :disabled="!phoneNumber || smsCountdown > 0 || loginLoading"
            >
                {{ smsCountdown > 0 ? `${smsCountdown}s` : t('sendSmsCode') }}
            </button>
        </div>
LiangLiu's avatar
LiangLiu committed
69
70
71
72
73
74
75
76
77
                            <input
                                v-model="verifyCode"
                                type="text"
                                name="verifyCode"
                                required
                                maxlength="6"
                                @keyup.enter="handleVerifyCodeEnter"
                                class="block w-full rounded-xl bg-white/80 dark:bg-[#2c2c2e]/80 backdrop-blur-[20px] border border-black/8 dark:border-white/8 px-5 py-4 text-[15px] text-[#1d1d1f] dark:text-[#f5f5f7] placeholder-[#86868b] dark:placeholder-[#98989d] transition-all duration-200 hover:bg-white dark:hover:bg-[#3a3a3c] hover:border-black/12 dark:hover:border-white/12 focus:outline-none focus:border-[color:var(--brand-primary)]/50 dark:focus:border-[color:var(--brand-primary-light)]/60 focus:shadow-[0_4px_16px_rgba(var(--brand-primary-rgb),0.12)] dark:focus:shadow-[0_4px_16px_rgba(var(--brand-primary-light-rgb),0.2)] tracking-tight"
                            />
LiangLiu's avatar
LiangLiu committed
78
79
      </div>

LiangLiu's avatar
LiangLiu committed
80
81
82
83
84
85
86
                        <!-- 登录按钮 - Apple 风格 -->
                        <div class="pt-4">
                            <button
                                @click="loginWithSms"
                                :disabled="!phoneNumber || !verifyCode || loginLoading"
                                class="w-full rounded-full bg-[color:var(--brand-primary)] dark:bg-[color:var(--brand-primary-light)] border-0 px-6 py-4 text-base font-semibold text-white hover:scale-[1.02] hover:shadow-[0_8px_24px_rgba(var(--brand-primary-rgb),0.35)] dark:hover:shadow-[0_8px_24px_rgba(var(--brand-primary-light-rgb),0.4)] active:scale-100 transition-all duration-200 ease-out disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100 disabled:hover:shadow-none tracking-tight"
                            >
LiangLiu's avatar
LiangLiu committed
87
88
89
90
91
            {{ loginLoading ? t('loginLoading') : t('login') }}
        </button>
      </div>
    </div>

LiangLiu's avatar
LiangLiu committed
92
93
94
95
96
97
98
99
                    <!-- 分隔线 - Apple 风格 -->
                    <div class="relative my-10">
                        <div class="absolute inset-0 flex items-center">
                            <div class="w-full border-t border-black/8 dark:border-white/8"></div>
                        </div>
                        <div class="relative flex justify-center">
                            <span class="bg-white/95 dark:bg-[#1e1e1e]/95 px-4 text-sm text-[#86868b] dark:text-[#98989d] tracking-tight">{{ t('orLoginWith') }}</span>
                        </div>
LiangLiu's avatar
LiangLiu committed
100
101
                    </div>

LiangLiu's avatar
LiangLiu committed
102
103
104
105
106
107
108
109
110
                    <!-- 第三方登录按钮 - Apple 风格 -->
                    <div class="flex justify-center gap-5">
                        <button
                            @click="loginWithGitHub"
                            class="w-14 h-14 flex items-center justify-center bg-white dark:bg-[#3a3a3c] border border-black/8 dark:border-white/8 rounded-full text-[#1d1d1f] dark:text-[#f5f5f7] hover:scale-110 hover:shadow-[0_4px_12px_rgba(0,0,0,0.1)] dark:hover:shadow-[0_4px_12px_rgba(0,0,0,0.3)] active:scale-100 transition-all duration-200"
                            :disabled="loginLoading"
                            :title="t('loginWithGitHub')"
                        >
                            <i class="fab fa-github text-2xl"></i>
LiangLiu's avatar
LiangLiu committed
111
112
                        </button>

LiangLiu's avatar
LiangLiu committed
113
114
115
116
117
118
119
                        <button
                            @click="loginWithGoogle"
                            class="w-14 h-14 flex items-center justify-center bg-white dark:bg-[#3a3a3c] border border-black/8 dark:border-white/8 rounded-full text-[#1d1d1f] dark:text-[#f5f5f7] hover:scale-110 hover:shadow-[0_4px_12px_rgba(0,0,0,0.1)] dark:hover:shadow-[0_4px_12px_rgba(0,0,0,0.3)] active:scale-100 transition-all duration-200"
                            :disabled="loginLoading"
                            :title="t('loginWithGoogle')"
                        >
                            <i class="fab fa-google text-2xl"></i>
LiangLiu's avatar
LiangLiu committed
120
121
122
123
124
                        </button>
                    </div>
                </div>
            </div>
</template>