gaoluyang
2025-12-29 89469f566f4ad8602def16aef6744d205a3d20a8
src/store/modules/user.ts
@@ -1,11 +1,11 @@
import {logout, getInfo, loginCheckFactory} from "@/api/login";
import {logout, getInfo, login} from "@/api/login";
import { getToken, setToken, removeToken } from "@/utils/auth";
import defAva from "@/static/images/profile.jpg";
import { defineStore } from "pinia";
import config from '@/config.js'
export interface LoginForm {
  username: string;
  userName: string;
  password: string;
  factoryId: string;
}
@@ -26,12 +26,12 @@
  }),
  actions: {
    // 部门登录
    loginCheckFactory(userInfo: any) {
      const username = userInfo.username.trim()
    login(userInfo: any) {
      const userName = userInfo.userName
      const password = userInfo.password
      const factoryId = userInfo.factoryId
      return new Promise((resolve, reject) => {
        loginCheckFactory(username, password, factoryId).then((res: any) => {
        login(userName, password, factoryId).then((res: any) => {
          setToken(res.token)
          this.token = res.token
          resolve(null)