|
@@ -20,7 +20,7 @@
|
|
|
>
|
|
|
</div>
|
|
|
<div class="mb-9">
|
|
|
- <p class="text-center text-4xl font-bold">龙弛财务</p>
|
|
|
+ <p class="text-center text-4xl font-bold">退伍军人后台管理</p>
|
|
|
</div>
|
|
|
<el-form
|
|
|
ref="loginForm"
|
|
@@ -88,15 +88,13 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import JSEncrypt from 'jsencrypt';
|
|
|
-import { captcha,routerPublicKey } from '@/api/user'
|
|
|
-import { checkDB } from '@/api/initdb'
|
|
|
+import JSEncrypt from 'jsencrypt'
|
|
|
+import { captcha, routerPublicKey } from '@/api/user'
|
|
|
+// import { checkDB } from '@/api/initdb'
|
|
|
import { reactive, ref, onMounted } from 'vue'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
import { useRouter } from 'vue-router'
|
|
@@ -106,6 +104,7 @@ defineOptions({
|
|
|
name: 'Login',
|
|
|
})
|
|
|
|
|
|
+// eslint-disable-next-line no-unused-vars
|
|
|
const router = useRouter()
|
|
|
// 验证函数
|
|
|
const checkUsername = (rule, value, callback) => {
|
|
@@ -149,8 +148,6 @@ const loginFormData = reactive({
|
|
|
openCaptcha: false,
|
|
|
})
|
|
|
|
|
|
-
|
|
|
-
|
|
|
const rules = reactive({
|
|
|
username: [{ validator: checkUsername, trigger: 'blur' }],
|
|
|
password: [{ validator: checkPassword, trigger: 'blur' }],
|
|
@@ -163,23 +160,21 @@ const rules = reactive({
|
|
|
})
|
|
|
|
|
|
const publicKey = ref()
|
|
|
-//获取公钥
|
|
|
+// 获取公钥
|
|
|
const queryPublicKey = async() => {
|
|
|
const req = await routerPublicKey()
|
|
|
publicKey.value = req.data.publicKey
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
const userStore = useUserStore()
|
|
|
-//登录
|
|
|
+// 登录
|
|
|
const login = async() => {
|
|
|
- //密码加密
|
|
|
- const instance = new JSEncrypt();
|
|
|
- instance.setPublicKey(publicKey.value);
|
|
|
+ // 密码加密
|
|
|
+ const instance = new JSEncrypt()
|
|
|
+ instance.setPublicKey(publicKey.value)
|
|
|
loginFormData.password = instance.encrypt(loginFormData.password)
|
|
|
|
|
|
const bool = await userStore.LoginIn(loginFormData)
|
|
|
- loginFormData.password = ""
|
|
|
+ loginFormData.password = ''
|
|
|
return bool
|
|
|
}
|
|
|
const submitForm = () => {
|
|
@@ -202,20 +197,20 @@ const submitForm = () => {
|
|
|
}
|
|
|
|
|
|
// 跳转初始化
|
|
|
-const checkInit = async() => {
|
|
|
- const res = await checkDB()
|
|
|
- if (res.code === 0) {
|
|
|
- if (res.data?.needInit) {
|
|
|
- userStore.NeedInit()
|
|
|
- router.push({ name: 'Init' })
|
|
|
- } else {
|
|
|
- ElMessage({
|
|
|
- type: 'info',
|
|
|
- message: '已配置数据库信息,无法初始化',
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+// const checkInit = async() => {
|
|
|
+// const res = await checkDB()
|
|
|
+// if (res.code === 0) {
|
|
|
+// if (res.data?.needInit) {
|
|
|
+// userStore.NeedInit()
|
|
|
+// router.push({ name: 'Init' })
|
|
|
+// } else {
|
|
|
+// ElMessage({
|
|
|
+// type: 'info',
|
|
|
+// message: '已配置数据库信息,无法初始化',
|
|
|
+// })
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
onMounted(() => {
|
|
|
queryPublicKey()
|