-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b676923
commit 3c38d52
Showing
5 changed files
with
169 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<template> | ||
<div class="active"> | ||
{{ state.status }} | ||
<i v-if="state.activating" class="el-icon-loading"></i> | ||
<div> | ||
<el-button class="btn" size="small" v-if="state.valid" @click="router.replace('/')"> 返回首页 </el-button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { onBeforeMount, onMounted, reactive } from "vue"; | ||
import { activateAccount } from "@/api/login"; | ||
import { useRoute, useRouter } from "vue-router"; | ||
const router = useRouter(); | ||
const route = useRoute(); | ||
const requestId = route.params.id as string; | ||
// State | ||
const state = reactive({ | ||
status: "激活中...", | ||
activating: true, | ||
valid: false, | ||
}); | ||
// Lifecycle | ||
onBeforeMount(() => { | ||
if (route.params.id) { | ||
router.push("/"); | ||
} | ||
}); | ||
onMounted(async () => await activateAccoutn()); | ||
// Methods | ||
const activateAccoutn = async () => { | ||
try { | ||
const res: any = await activateAccount(requestId); | ||
state.activating = false; | ||
if (!res || res.code === -1) { | ||
state.status = res.msg; | ||
return; | ||
} | ||
state.status = "激活成功!回到首页登陆"; | ||
state.activating = false; | ||
state.valid = true; | ||
} catch (err) { | ||
state.status = "网络错误, 请稍后再试."; | ||
} | ||
}; | ||
</script> | ||
<style lang="scss" scoped> | ||
.active { | ||
margin-top: 20px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 600px; | ||
.btn { | ||
background: #f2f3f7; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<template> | ||
<div class="error"> | ||
<div class="title">404</div> | ||
<div class="content">Not Found</div> | ||
<el-button size="small" link @click="router.replace('/')"> 返回主页 </el-button> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useRouter } from "vue-router"; | ||
const router = useRouter(); | ||
</script> | ||
<style lang="scss" scoped> | ||
.error { | ||
display: flex; | ||
height: 600px; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
.title { | ||
font-size: 40px; | ||
margin-bottom: 10px; | ||
} | ||
.content { | ||
font-size: 24px; | ||
margin-bottom: 10px; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<template> | ||
<div class="staging"> | ||
<div class="title">Hi, {{ name }}:</div> | ||
<div class="content"> | ||
<p>感谢你注册About Life! 我们发送了激活邮件到你的邮箱: {{ email }}.</p> | ||
<p>请前往你的邮箱激活账户, 激活账户就可以正常登陆About Life啦!</p> | ||
</div> | ||
<div class="footer">--- About Life</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { onBeforeMount } from "vue"; | ||
import { useRouter } from "vue-router"; | ||
const props = defineProps({ | ||
email: { | ||
type: String, | ||
required: true, | ||
}, | ||
name: { | ||
type: String, | ||
required: true, | ||
}, | ||
}); | ||
const router = useRouter(); | ||
onBeforeMount(() => { | ||
if (!props.name || !props.email) { | ||
router.push("/"); | ||
} | ||
}); | ||
</script> | ||
<style lang="scss" scoped> | ||
.staging { | ||
margin-top: 20px; | ||
.title { | ||
font-size: 18px; | ||
text-align: left; | ||
color: #d9d9d9; | ||
} | ||
.content { | ||
margin-top: 10px; | ||
p { | ||
margin-top: 5px; | ||
} | ||
} | ||
.footer { | ||
text-align: right; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters