import http from "../../common/public";
const sysConfig = require("../../../config/sysConfig");
const apiUrl = sysConfig.xcApiUrlPre;
const state = {
manager: JSON.parse(localStorage.getItem("managerStore")) || false
};
const mutations = {
FLAG_DEVICE: (state, manager) => {
localStorage.setItem('managerStore', JSON.stringify(manager))
state.manager = manager;
}
};
const actions = {
isManager({ commit }) {
return new Promise((resolve, reject) => {
let tenderProjectId = sysConfig.tenderProjectId();
if (!tenderProjectId) {
tenderProjectId = "";
}
http
.requestQuickGet(
apiUrl +
"/notice/isManager?projectId=" +
tenderProjectId
)
.then(res => {
if (res.success) {
commit("FLAG_DEVICE", true)
}else {
commit("FLAG_DEVICE", false);
}
resolve();
});
});
}
};
export default {
namespaced: true,
state,
mutations,
actions
};
把它放到localStorage里面就可以啦。但是要注意退出登录时清除localStorage.setItem(“myInfo”,"")。下一次来的时候重新覆盖。