mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 11:26:45 +08:00
feat:合并
This commit is contained in:
77
src/App.vue
77
src/App.vue
@@ -1,27 +1,27 @@
|
||||
<template>
|
||||
<div id="container" v-if="!isLogin">
|
||||
<nav-top />
|
||||
<nav-top/>
|
||||
<div style="display: flex">
|
||||
<nav-left />
|
||||
<nav-left/>
|
||||
<div style="flex: 1; display: flex; flex-direction: column; width: 0">
|
||||
<open-pages />
|
||||
<bread-crumb />
|
||||
<open-pages/>
|
||||
<bread-crumb/>
|
||||
<main>
|
||||
<a-config-provider :locale="zhCN">
|
||||
<router-view />
|
||||
<router-view/>
|
||||
</a-config-provider>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="container" v-if="isLogin">
|
||||
<router-view />
|
||||
<router-view/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { computed, defineComponent, ref, watch } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useStore } from "vuex";
|
||||
import {computed, defineComponent, ref, watch} from "vue";
|
||||
import {useRouter, useRoute} from "vue-router";
|
||||
import {useStore} from "vuex";
|
||||
import NavLeft from "@/components/NavLeft";
|
||||
import NavTop from "@/components/NavTop";
|
||||
import OpenPages from "@/components/OpenPages";
|
||||
@@ -29,6 +29,7 @@ import BreadCrumb from "@/components/BreadCrumb";
|
||||
import zhCN from "ant-design-vue/es/locale/zh_CN";
|
||||
import * as api from "./api/index1";
|
||||
import * as api1 from "@/api/index1";
|
||||
import * as api2 from "@/api/index";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -49,16 +50,17 @@ export default defineComponent({
|
||||
});
|
||||
|
||||
watch(
|
||||
() => route.path,
|
||||
() => {
|
||||
route.path === "/login" && (isLogin.value = true);
|
||||
}
|
||||
() => route.path,
|
||||
() => {
|
||||
route.path === "/login" && (isLogin.value = true);
|
||||
}
|
||||
);
|
||||
|
||||
const currentRouteName = computed(() => route.name);
|
||||
|
||||
function init() {
|
||||
console.log(store);
|
||||
getUserInfo();
|
||||
initDict("faceclassPic");
|
||||
initDict("faceclassClass");
|
||||
initDict("faceclassScene");
|
||||
@@ -70,25 +72,30 @@ export default defineComponent({
|
||||
getOrgTree();
|
||||
}
|
||||
|
||||
async function getUserInfo() {
|
||||
const userInfo = await api2.userInfo()
|
||||
store.commit("SET_USER", userInfo);
|
||||
}
|
||||
|
||||
async function initDict(key) {
|
||||
let list = localStorage.getItem(key);
|
||||
if (list) {
|
||||
store.commit("SET_DICT", { key, data: JSON.parse(list) });
|
||||
store.commit("SET_DICT", {key, data: JSON.parse(list)});
|
||||
return;
|
||||
}
|
||||
list = await getDictList(key);
|
||||
localStorage.setItem(key, JSON.stringify(list));
|
||||
store.commit("SET_DICT", { key, data: list });
|
||||
store.commit("SET_DICT", {key, data: list});
|
||||
}
|
||||
|
||||
const getDictList = (param) =>
|
||||
api1
|
||||
.getDict({
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
setCode: param,
|
||||
})
|
||||
.then((res) => res.data.data.rows);
|
||||
api1
|
||||
.getDict({
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
setCode: param,
|
||||
})
|
||||
.then((res) => res.data.data.rows);
|
||||
|
||||
//获取组织树
|
||||
const getOrgTree = () => {
|
||||
@@ -104,18 +111,18 @@ export default defineComponent({
|
||||
pageSize: 20,
|
||||
};
|
||||
api
|
||||
.getOrgInfo(obj)
|
||||
.then((res) => {
|
||||
console.log("组织树获取成功", res);
|
||||
if (res.data.code === 200) {
|
||||
// state.treeData = res.data.data;
|
||||
localStorage.setItem("orgtreeList", JSON.stringify(res.data.data));
|
||||
store.commit("getOrgtreeList", res.data.data);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("组织树获取失败", err);
|
||||
});
|
||||
.getOrgInfo(obj)
|
||||
.then((res) => {
|
||||
console.log("组织树获取成功", res);
|
||||
if (res.data.code === 200) {
|
||||
// state.treeData = res.data.data;
|
||||
localStorage.setItem("orgtreeList", JSON.stringify(res.data.data));
|
||||
store.commit("getOrgtreeList", res.data.data);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("组织树获取失败", err);
|
||||
});
|
||||
};
|
||||
|
||||
init();
|
||||
@@ -134,7 +141,7 @@ export default defineComponent({
|
||||
// font-family: MicrosoftYaHei, Microsoft YaHei, Avenir, Helvetica, Arial,
|
||||
// sans-serif;
|
||||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
|
||||
Microsoft YaHei, Arial, sans-serif;
|
||||
Microsoft YaHei, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
color: #2c3e50;
|
||||
|
||||
Reference in New Issue
Block a user