提交 a4f75e05 authored 作者: 刘旭's avatar 刘旭

修改bug

上级 4ed03d72
...@@ -7,6 +7,7 @@ export {} ...@@ -7,6 +7,7 @@ export {}
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
ElAlert: typeof import('element-plus/es')['ElAlert']
ElAside: typeof import('element-plus/es')['ElAside'] ElAside: typeof import('element-plus/es')['ElAside']
ElButton: typeof import('element-plus/es')['ElButton'] ElButton: typeof import('element-plus/es')['ElButton']
ElCol: typeof import('element-plus/es')['ElCol'] ElCol: typeof import('element-plus/es')['ElCol']
......
<template> <template>
<div class="container"> <div class="container">
<el-alert
title="账号密码暂时无效,点击登录即可"
type="warning"
class="alert"
:closable="false"
center
/>
<form action="#" class="login-form"> <form action="#" class="login-form">
<el-form class="login-container" label-position="left" label-width="0px"> <el-form class="login-container" label-position="left" label-width="0px">
<h2 class="login_title">系统登录</h2> <h2 class="login_title">系统登录</h2>
...@@ -21,7 +29,17 @@ ...@@ -21,7 +29,17 @@
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" style="width: 120px" @click="login">登录</el-button> <div class="login-btn">
<el-button type="primary" style="width: 120px" @click="login">登录</el-button>
<el-upload
:action="action"
:show-file-list="false"
:on-success="onUpload"
style="margin-bottom: 20px"
>
<el-button v-if="flag" type="primary" style="margin-left: 20px">新增租户</el-button>
</el-upload>
</div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</form> </form>
...@@ -33,21 +51,40 @@ import { useTenantStore } from '@/stores/modules/tenant' ...@@ -33,21 +51,40 @@ import { useTenantStore } from '@/stores/modules/tenant'
const tenantStore = useTenantStore() const tenantStore = useTenantStore()
const action = '/admin/api/lic/info/file/import'
const loginForm = ref({ const loginForm = ref({
username: '', username: '',
password: '' password: ''
}) })
const flag = ref(false)
const router = useRouter() const router = useRouter()
const onUpload = async (res: any) => {
try {
if (res.code === 200) {
router.push('/tenant')
flag.value = false
ElMessage.success('导入成功')
} else ElMessage.error(res.msg)
} finally {
await tenantStore.initTenantList()
}
}
const login = () => { const login = () => {
tenantStore.initTenantList().then(() => { tenantStore.initTenantList().then(() => {
router.push('/tenant') if (tenantStore.getTenantList.length) router.push('/tenant')
else {
ElMessage.error('租户不存在,请先导入租户信息')
flag.value = true
}
}) })
} }
</script> </script>
<style scoped> <style scoped>
.container { .container {
position: relative;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
display: flex; display: flex;
...@@ -55,6 +92,10 @@ const login = () => { ...@@ -55,6 +92,10 @@ const login = () => {
justify-content: center; justify-content: center;
background-color: #0000001f; background-color: #0000001f;
} }
.alert {
position: absolute;
top: 2%;
}
.login-form { .login-form {
width: 240px; width: 240px;
...@@ -142,4 +183,8 @@ h2 { ...@@ -142,4 +183,8 @@ h2 {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.login-btn {
display: flex;
}
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论