feat:登录页面
This commit is contained in:
109
src/pages/Login/user-register-success/index.vue
Normal file
109
src/pages/Login/user-register-success/index.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<script setup lang="ts">
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import {
|
||||
RESULT_PAGE_CONFIG,
|
||||
RESULT_REDIRECT_DELAY,
|
||||
type ResultPageType,
|
||||
} from '@/types/result-page'
|
||||
|
||||
const pageType = ref<ResultPageType>('register')
|
||||
const countdown = ref(RESULT_REDIRECT_DELAY / 1000)
|
||||
let timer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
const pageConfig = computed(() => RESULT_PAGE_CONFIG[pageType.value])
|
||||
|
||||
const title = computed(() => pageConfig.value.title)
|
||||
|
||||
const subtitle = computed(() => `${countdown.value}秒后自动跳转至${pageConfig.value.subtitleTarget}`)
|
||||
|
||||
onLoad((options) => {
|
||||
const type = options?.type
|
||||
if (type === 'resetPassword' || type === 'reset-password') {
|
||||
pageType.value = 'resetPassword'
|
||||
return
|
||||
}
|
||||
if (type === 'loginFailed') {
|
||||
pageType.value = 'loginFailed'
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
timer = setInterval(() => {
|
||||
countdown.value -= 1
|
||||
if (countdown.value <= 0) {
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
uni.redirectTo({
|
||||
url: pageConfig.value.redirectUrl,
|
||||
})
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="result-page">
|
||||
<view class="result-page__content">
|
||||
<image
|
||||
class="result-page__icon"
|
||||
:src="pageConfig.icon"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<text class="result-page__title">
|
||||
{{ title }}
|
||||
</text>
|
||||
<text class="result-page__subtitle">
|
||||
{{ subtitle }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.result-page {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.result-page__content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0 64rpx;
|
||||
}
|
||||
|
||||
.result-page__icon {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
.result-page__title {
|
||||
margin-top: 48rpx;
|
||||
font-size: 40rpx;
|
||||
font-weight: 700;
|
||||
color: $color-text-primary;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
.result-page__subtitle {
|
||||
margin-top: 24rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user