登录处理

This commit is contained in:
2025-12-30 22:54:57 -08:00
parent a9cbd2b921
commit ab5de5e0f5
7 changed files with 51 additions and 13 deletions
+22 -2
View File
@@ -106,18 +106,38 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, onMounted, watch } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import type { LocationQueryValue } from 'vue-router'
import LoginFormModal from './components/LoginFormModal.vue'
import DownloadButton from './components/DownloadButton.vue'
import Logo from './logo.svg?component'
import MobileLogo from './mobile-logo.svg?component'
import ScreenshotMobile from './screenshot-mobile.png'
import ScreenshotDesktop from './screenshot-desktop.png'
import { AppleIcon, MonitorIcon, SmartphoneIcon, LocateFixedIcon } from 'lucide-vue-next'
const route = useRoute()
const router = useRouter()
const loginModalRef = ref<InstanceType<typeof LoginFormModal> | null>(null)
const openLoginModal = () => {
loginModalRef.value?.show()
}
onMounted(() => {
if (route.query.login === 'true') {
openLoginModal()
router.replace({ query: { ...route.query, login: undefined } })
}
})
watch(
() => route.query.login,
(newVal) => {
if (newVal === 'true') {
openLoginModal()
router.replace({ query: { ...route.query, login: undefined } })
}
},
)
</script>
+2 -3
View File
@@ -12,7 +12,7 @@
</div>
</div>
<div class="mb-5 px-[20px] text-white">
<DeviceList :devices="devices" />
<DeviceList :devices="devices" @refresh="emit('refresh')" />
</div>
</div>
<div>
@@ -78,7 +78,7 @@ const props = defineProps<{
selectedPlan: any
}>()
const emit = defineEmits(['select-plan', 'pay'])
const emit = defineEmits(['select-plan', 'pay', 'refresh'])
// --- Handlers ---
const handlePlanSelect = (id: string) => {
@@ -127,7 +127,6 @@ const expireDateInfo = computed(() => {
function logout() {
router.push('/')
localStorage.removeItem('Authorization')
toast.success('退出成功')
}
</script>
+2 -3
View File
@@ -12,7 +12,7 @@
</div>
<div class="mb-5 pr-[25px] pl-[21px] text-white">
<DeviceList :devices="devices" />
<DeviceList :devices="devices" @refresh="emit('refresh')" />
</div>
<div class="overflow-hidden rounded-4xl bg-[#A8FF53]">
<div class="pt-7">
@@ -65,7 +65,7 @@ const props = defineProps<{
selectedPlan: any
}>()
const emit = defineEmits(['select-plan', 'pay'])
const emit = defineEmits(['select-plan', 'pay', 'refresh'])
// --- Handlers ---
const handlePlanSelect = (id: string) => {
@@ -114,7 +114,6 @@ const expireDateInfo = computed(() => {
function logout() {
router.push('/')
localStorage.removeItem('Authorization')
toast.success('退出成功')
}
</script>
+2 -1
View File
@@ -34,6 +34,7 @@
:selected-plan="activePlan"
@select-plan="handlePlanSelect"
@pay="handlePay"
@refresh="init"
/>
</div>
<div class="container mx-auto hidden flex-1 items-center justify-center md:flex">
@@ -47,6 +48,7 @@
:selected-plan="activePlan"
@select-plan="handlePlanSelect"
@pay="handlePay"
@refresh="init"
/>
</div>
</div>
@@ -157,7 +159,6 @@ function init() {
// 用户信息 & 设备列表
request.get('/api/v1/public/user/info').then((res: any) => {
devices.value = res.user_devices
const emailInfo = res.auth_methods?.find((item: any) => item.auth_type === 'email')
if (emailInfo) {
userSubInfo.value.email = emailInfo.auth_identifier