zhouwx
6 小时以前 9e4ea4987852902539e91ec438150c1deaa89742
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,8 @@
      token: getToken(),
      id: '',
      name: '',
      companyId: null,
      companyName: '',
      avatar: '',
      roles: [],
      permissions: []
@@ -46,6 +49,8 @@
            }
            this.id = user.userId
            this.name = user.userName
            this.companyId = user.companyId
            this.companyName = user.companyName
            this.avatar = avatar
            Cookies.set('userInfo',JSON.stringify(user))
            resolve(res)