zhouwx
2025-07-15 4fe6c5ac4bc2b7fa9c9c71bb52d9df3e8b13bd7c
src/store/modules/user.js
@@ -2,6 +2,7 @@
import { getToken, setToken, removeToken } from '@/utils/auth'
import defAva from '@/assets/images/profile.jpg'
import Cookies from "js-cookie";
import { defineStore } from 'pinia'
import {getUserById} from "@/api/onlineEducation/user";
const useUserStore = defineStore(
  'user',
@@ -10,6 +11,7 @@
      token: getToken(),
      id: '',
      name: '',
      companyId: null,
      avatar: '',
      roles: [],
      permissions: []
@@ -46,6 +48,7 @@
            }
            this.id = user.userId
            this.name = user.userName
            this.companyId = user.companyId
            this.avatar = avatar
            Cookies.set('userInfo',JSON.stringify(user))
            resolve(res)