Browse Source

first commit

chengqian 10 months ago
parent
commit
51ed331ce8
4 changed files with 28 additions and 34 deletions
  1. 2 2
      server/config.yaml
  2. 0 1
      server/service/system/sys_user.go
  3. 1 1
      web/src/api/user.js
  4. 25 30
      web/src/view/login/index.vue

+ 2 - 2
server/config.yaml

@@ -123,9 +123,9 @@ mysql:
     prefix: ""
     port: "3306"
     config: charset=utf8mb4&parseTime=True&loc=Local
-    db-name: lc_finance
+    db-name: lc_veterans
     username: root
-    password: root
+    password: 123456
     path: 127.0.0.1
     engine: ""
     log-mode: error

+ 0 - 1
server/service/system/sys_user.go

@@ -73,7 +73,6 @@ func (userService *UserService) ChangePassword(u *system.SysUser, newPassword st
 	user.Password = utils.BcryptHash(newPassword)
 	err = global.GVA_DB.Save(&user).Error
 	return &user, err
-
 }
 
 //@author: [piexlmax](https://github.com/piexlmax)

+ 1 - 1
web/src/api/user.js

@@ -164,7 +164,7 @@ export const resetPassword = (data) => {
   })
 }
 
-//返回公钥
+// 返回公钥
 
 export const routerPublicKey = () => {
   return service({

+ 25 - 30
web/src/view/login/index.vue

@@ -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()