yxh
yxh
7 天以前 8022f7036945b75f82f2dfc43055623f81ed98f6
src/store/modules/user.js
@@ -1,6 +1,8 @@
import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import {  Message } from 'element-ui'
import { listOrganization } from "@/api/project/organization";
const user = {
@@ -11,7 +13,9 @@
    code: '',
    msg: '',
    roles: [],
    permissions: []
    permissions: [],
    organization:[],
    addressArray:[],
  },
  mutations: {
@@ -33,8 +37,14 @@
    SET_ROLES: (state, roles) => {
      state.roles = roles
    },
     SET_addressArray: (state, addressArray) => {
      state.addressArray = addressArray
    },
    SET_PERMISSIONS: (state, permissions) => {
      state.permissions = permissions
    },
    SET_organization: (state, organization) => {
      state.organization = organization
    }
  },
@@ -45,8 +55,10 @@
      const password = userInfo.password
      const code = userInfo.code
      const uuid = userInfo.uuid
      const authCode = userInfo.authCode
      console.log(authCode,'authCode');
      return new Promise((resolve, reject) => {
        login(username, password, code, uuid).then(res => {
        login(username, password, code, uuid, authCode).then(res => {
          console.log(res,'log');
          setToken(res.token)
          commit('SET_TOKEN', res.token)
@@ -84,7 +96,7 @@
        })
      })
    },
    // 退出系统
    LogOut({ commit, state }) {
      return new Promise((resolve, reject) => {
@@ -99,6 +111,21 @@
        })
      })
    },
    // 拿取机构信息
    getdataList({commit}){
      return new Promise((resolve, reject) => {
        listOrganization({
          organizationtype: 4, //传入的类型
          pageNum: 1,
          pageSize: 100000
        }).then((res) => {
          commit('SET_organization', res.rows)
          resolve()
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 前端 登出
    FedLogOut({ commit }) {