Compare commits
2 Commits
dc1ad04ccf
...
3b68a6af49
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b68a6af49 | ||
|
|
29f80a48ef |
@@ -11,13 +11,19 @@
|
|||||||
<a-col :span="16" class="modal-value">{{ item.value }}</a-col>
|
<a-col :span="16" class="modal-value">{{ item.value }}</a-col>
|
||||||
</template>
|
</template>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
<div class="actions">
|
||||||
|
<a-button size="large" @click="handleLogout">退出登录</a-button>
|
||||||
|
</div>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
import { useDialog } from '@/utils/useDialog';
|
import { useDialog } from '@/utils/useDialog';
|
||||||
import { useRealTime } from '@/utils/dateUtils';
|
import { useRealTime } from '@/utils/dateUtils';
|
||||||
|
import { Modal } from 'ant-design-vue';
|
||||||
|
import { removeToken } from '@/utils/auth';
|
||||||
|
|
||||||
// 实时时间
|
// 实时时间
|
||||||
const { currentTime } = useRealTime('HH:mm:ss');
|
const { currentTime } = useRealTime('HH:mm:ss');
|
||||||
@@ -38,6 +44,21 @@ const modalItems = ref([
|
|||||||
{ label: '内存使用', value: '2.1GB / 8GB' }
|
{ label: '内存使用', value: '2.1GB / 8GB' }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const handleLogout = () => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '确认退出登录?',
|
||||||
|
onOk() {
|
||||||
|
removeToken();
|
||||||
|
return router.push(`/login`);
|
||||||
|
},
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
|
onCancel() {},
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
show,
|
show,
|
||||||
hide
|
hide
|
||||||
@@ -73,4 +94,15 @@ defineExpose({
|
|||||||
color: $text-light;
|
color: $text-light;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
margin: 20px 0 10px;
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.ant-btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -23,7 +23,7 @@ const loading = ref(false)
|
|||||||
const captchaLoading = ref(false)
|
const captchaLoading = ref(false)
|
||||||
|
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
const rules: Record<string, Rule[]> = {
|
const rules: Record<string, Rule[]> = reactive({
|
||||||
username: [
|
username: [
|
||||||
{ required: true, message: '请输入用户名', trigger: 'change' }
|
{ required: true, message: '请输入用户名', trigger: 'change' }
|
||||||
],
|
],
|
||||||
@@ -33,7 +33,7 @@ const rules: Record<string, Rule[]> = {
|
|||||||
code: [
|
code: [
|
||||||
{ required: true, message: '请输入验证码', trigger: 'change' }
|
{ required: true, message: '请输入验证码', trigger: 'change' }
|
||||||
]
|
]
|
||||||
}
|
})
|
||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
const refreshCaptcha = async () => {
|
const refreshCaptcha = async () => {
|
||||||
@@ -67,7 +67,7 @@ const handleLogin = async () => {
|
|||||||
setToken(res.token)
|
setToken(res.token)
|
||||||
// 可以在这里保存用户信息到store
|
// 可以在这里保存用户信息到store
|
||||||
// 跳转到主页
|
// 跳转到主页
|
||||||
router.push('/')
|
router.push('/lms')
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg || '登录失败')
|
message.error(res.msg || '登录失败')
|
||||||
// 登录失败后重新获取验证码
|
// 登录失败后重新获取验证码
|
||||||
|
|||||||
Reference in New Issue
Block a user