mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 19:36:46 +08:00
-- 取消localstory缓存
This commit is contained in:
31
src/App.vue
31
src/App.vue
@@ -30,6 +30,7 @@ import zhCN from "ant-design-vue/es/locale/zh_CN";
|
|||||||
import * as api from "./api/index1";
|
import * as api from "./api/index1";
|
||||||
import * as api1 from "@/api/index1";
|
import * as api1 from "@/api/index1";
|
||||||
import * as api2 from "@/api/index";
|
import * as api2 from "@/api/index";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
NavLeft,
|
NavLeft,
|
||||||
@@ -54,6 +55,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
const currentRouteName = computed(() => route.name);
|
const currentRouteName = computed(() => route.name);
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
console.log(store);
|
console.log(store);
|
||||||
getUserInfo();
|
getUserInfo();
|
||||||
@@ -68,6 +70,7 @@ export default defineComponent({
|
|||||||
getMemberInfo();
|
getMemberInfo();
|
||||||
getOrgTree();
|
getOrgTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getMemberInfo() {
|
async function getMemberInfo() {
|
||||||
const list = localStorage.getItem("memberInitInfo");
|
const list = localStorage.getItem("memberInitInfo");
|
||||||
if (list) {
|
if (list) {
|
||||||
@@ -80,20 +83,26 @@ export default defineComponent({
|
|||||||
store.commit("SET_MEMBER_INFO", memberInitInfo);
|
store.commit("SET_MEMBER_INFO", memberInitInfo);
|
||||||
localStorage.setItem("memberInitInfo", JSON.stringify(memberInitInfo));
|
localStorage.setItem("memberInitInfo", JSON.stringify(memberInitInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getUserInfo() {
|
async function getUserInfo() {
|
||||||
const userInfo = await api2.userInfo();
|
const userInfo = await api2.userInfo();
|
||||||
store.commit("SET_USER", userInfo);
|
store.commit("SET_USER", userInfo);
|
||||||
}
|
}
|
||||||
async function initDict(key) {
|
|
||||||
let list = localStorage.getItem(key);
|
async function initDict(key, localStory = false) {
|
||||||
|
let list;
|
||||||
|
if (localStory) {
|
||||||
|
list = localStorage.getItem(key);
|
||||||
if (list) {
|
if (list) {
|
||||||
store.commit("SET_DICT", {key, data: JSON.parse(list)});
|
store.commit("SET_DICT", {key, data: JSON.parse(list)});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
list = await getDictList(key);
|
list = await getDictList(key);
|
||||||
localStorage.setItem(key, JSON.stringify(list));
|
localStory && localStorage.setItem(key, JSON.stringify(list));
|
||||||
store.commit("SET_DICT", {key, data: list});
|
store.commit("SET_DICT", {key, data: list});
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDictList = (param) =>
|
const getDictList = (param) =>
|
||||||
api1
|
api1
|
||||||
.getDict({
|
.getDict({
|
||||||
@@ -109,25 +118,16 @@ export default defineComponent({
|
|||||||
store.commit("getOrgtreeList", JSON.parse(orgtreeList));
|
store.commit("getOrgtreeList", JSON.parse(orgtreeList));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let obj = {
|
api.getOrgInfo({
|
||||||
keyWord: "",
|
keyWord: "",
|
||||||
id: -1,
|
id: -1,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
};
|
})
|
||||||
api
|
|
||||||
.getOrgInfo(obj)
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log("组织树获取成功", res);
|
|
||||||
if (res.data.code === 200) {
|
|
||||||
// state.treeData = res.data.data;
|
|
||||||
localStorage.setItem("orgtreeList", JSON.stringify(res.data.data));
|
localStorage.setItem("orgtreeList", JSON.stringify(res.data.data));
|
||||||
store.commit("getOrgtreeList", res.data.data);
|
store.commit("getOrgtreeList", res.data.data);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
|
||||||
console.log("组织树获取失败", err);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
init();
|
init();
|
||||||
return {
|
return {
|
||||||
@@ -150,6 +150,7 @@ export default defineComponent({
|
|||||||
color: #2c3e50;
|
color: #2c3e50;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#container {
|
#container {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -158,6 +159,7 @@ export default defineComponent({
|
|||||||
min-width: 1000px;
|
min-width: 1000px;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
background-color: rgba(245, 247, 250, 1);
|
background-color: rgba(245, 247, 250, 1);
|
||||||
|
|
||||||
main {
|
main {
|
||||||
height: 0;
|
height: 0;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
@@ -173,6 +175,7 @@ export default defineComponent({
|
|||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.07);
|
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.07);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @media screen and (max-width: 1366px) {
|
// @media screen and (max-width: 1366px) {
|
||||||
// .cmMain {
|
// .cmMain {
|
||||||
// width: 750px;
|
// width: 750px;
|
||||||
|
|||||||
Reference in New Issue
Block a user