zhangxiao
2024-09-26 fa482274a588e97784c10099e45d030664aa4ceb
src/store/modules/user/index.ts
@@ -74,14 +74,20 @@
       
        const userInfo = {
          avatar: res.data.avatar,
          name: res.data.userName,
          name: res.data.loginName,
          email: res.data.email,
          role: res.data.roles[0].roleKey,
        };
        this.name=res.data.userName
     
        if(res.data?.roles.length>0)
            this.resources=res.data.roles[0].resources;
          //遍历roles
          for (const r of res.data.roles) {
            if (!(this.resources)) {
              this.resources = [];
            }
            this.resources = this.resources.concat(r.resources);
          }
            setUserInfo(JSON.stringify(userInfo));
            setUserResources(JSON.stringify(this.resources))
        for (const r of this.resources) {