+
-
+
@@ -57,13 +60,13 @@ export default {
needTagsView: (state) => state.settings.tagsView,
fixedHeader: (state) => state.settings.fixedHeader,
}),
- isEmbedded() {
- // 检查 URL 参数中是否有 embedded=true 或者当前处于 iframe 中
- return (
- // this.$route.query.embedded === "true" || window.self !== window.top
- false
- );
- },
+ // isEmbedded() {
+ // // 检查 URL 参数中是否有 embedded=true 或者当前处于 iframe 中
+ // return (
+ // // this.$route.query.embedded === "true" || window.self !== window.top
+ // false
+ // );
+ // },
classObj() {
return {
hideSidebar: !this.sidebar.opened,
diff --git a/ldlz-web/src/permission.js b/ldlz-web/src/permission.js
index 0a33fee..afa6029 100644
--- a/ldlz-web/src/permission.js
+++ b/ldlz-web/src/permission.js
@@ -12,26 +12,29 @@ const whiteList = ["/login", "/register", "/ywgllogin"];
router.beforeEach((to, from, next) => {
NProgress.start();
- // 如果是嵌入模式,尝试从父窗口获取 token
+ // 如果是嵌入模式,设置嵌入状态并尝试从父窗口获取 token
if (window.self !== window.top) {
+ // 设置嵌入模式状态
+ store.commit("app/SET_SIDEBAR_EMBEDDED", true);
try {
// 只有同源才能访问 window.parent.sessionStorage
const parentToken = window.parent.sessionStorage.getItem("Admin-Token");
if (parentToken && !getToken()) {
- store.commit("SET_TOKEN", parentToken);
+ store.commit("user/SET_TOKEN", parentToken);
setToken(parentToken);
}
} catch (e) {
const parentToken = localStorage.getItem("Admin-Token");
if (parentToken && !getToken()) {
- store.commit("SET_TOKEN", parentToken);
+ store.commit("user/SET_TOKEN", parentToken);
setToken(parentToken);
}
}
} else {
+ // 非嵌入模式,确保状态为 false
const parentToken = localStorage.getItem("Admin-Token");
if (parentToken && !getToken()) {
- store.commit("SET_TOKEN", parentToken);
+ store.commit("user/SET_TOKEN", parentToken);
setToken(parentToken);
}
}
diff --git a/ldlz-web/src/store/modules/app.js b/ldlz-web/src/store/modules/app.js
index 3e22d1c..469e001 100644
--- a/ldlz-web/src/store/modules/app.js
+++ b/ldlz-web/src/store/modules/app.js
@@ -1,66 +1,73 @@
-import Cookies from 'js-cookie'
+import Cookies from "js-cookie";
const state = {
sidebar: {
- opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
+ opened: Cookies.get("sidebarStatus")
+ ? !!+Cookies.get("sidebarStatus")
+ : true,
withoutAnimation: false,
- hide: false
+ hide: false,
+ isEmbedded: false, // 是否隐藏侧边栏和头部导航栏
},
- device: 'desktop',
- size: Cookies.get('size') || 'medium'
-}
+ device: "desktop",
+ size: Cookies.get("size") || "medium",
+};
const mutations = {
- TOGGLE_SIDEBAR: state => {
+ TOGGLE_SIDEBAR: (state) => {
if (state.sidebar.hide) {
return false;
}
- state.sidebar.opened = !state.sidebar.opened
- state.sidebar.withoutAnimation = false
+ state.sidebar.opened = !state.sidebar.opened;
+ state.sidebar.withoutAnimation = false;
if (state.sidebar.opened) {
- Cookies.set('sidebarStatus', 1)
+ Cookies.set("sidebarStatus", 1);
} else {
- Cookies.set('sidebarStatus', 0)
+ Cookies.set("sidebarStatus", 0);
}
},
CLOSE_SIDEBAR: (state, withoutAnimation) => {
- Cookies.set('sidebarStatus', 0)
- state.sidebar.opened = false
- state.sidebar.withoutAnimation = withoutAnimation
+ Cookies.set("sidebarStatus", 0);
+ state.sidebar.opened = false;
+ state.sidebar.withoutAnimation = withoutAnimation;
},
TOGGLE_DEVICE: (state, device) => {
- state.device = device
+ state.device = device;
},
SET_SIZE: (state, size) => {
- state.size = size
- Cookies.set('size', size)
+ state.size = size;
+ Cookies.set("size", size);
},
SET_SIDEBAR_HIDE: (state, status) => {
- state.sidebar.hide = status
- }
-}
+ state.sidebar.hide = status;
+ },
+ SET_SIDEBAR_EMBEDDED: (state, status) => {
+ console.log("status侧边栏隐藏状态", status);
+ state.sidebar.isEmbedded = status;
+ },
+};
const actions = {
toggleSideBar({ commit }) {
- commit('TOGGLE_SIDEBAR')
+ commit("TOGGLE_SIDEBAR");
},
closeSideBar({ commit }, { withoutAnimation }) {
- commit('CLOSE_SIDEBAR', withoutAnimation)
+ commit("CLOSE_SIDEBAR", withoutAnimation);
},
toggleDevice({ commit }, device) {
- commit('TOGGLE_DEVICE', device)
+ commit("TOGGLE_DEVICE", device);
},
setSize({ commit }, size) {
- commit('SET_SIZE', size)
+ commit("SET_SIZE", size);
},
toggleSideBarHide({ commit }, status) {
- commit('SET_SIDEBAR_HIDE', status)
- }
-}
+ commit("SET_SIDEBAR_HIDE", status);
+ },
+};
export default {
namespaced: true,
state,
mutations,
- actions
-}
+ actions,
+};
diff --git a/ldlz-web/src/store/modules/user.js b/ldlz-web/src/store/modules/user.js
index ce1e329..b25921f 100644
--- a/ldlz-web/src/store/modules/user.js
+++ b/ldlz-web/src/store/modules/user.js
@@ -1,114 +1,125 @@
-import { login, logout, getInfo,defaultLogin } from '@/api/login'
-import { getToken, setToken, removeToken } from '@/utils/auth'
+import { login, logout, getInfo, defaultLogin } from "@/api/login";
+import { getToken, setToken, removeToken } from "@/utils/auth";
const user = {
state: {
token: getToken(),
- id: '',
- name: '',
- avatar: '',
+ id: "",
+ name: "",
+ avatar: "",
roles: [],
- permissions: []
+ permissions: [],
},
mutations: {
SET_TOKEN: (state, token) => {
- state.token = token
+ state.token = token;
},
SET_ID: (state, id) => {
- state.id = id
+ state.id = id;
},
SET_NAME: (state, name) => {
- state.name = name
+ state.name = name;
},
SET_AVATAR: (state, avatar) => {
- state.avatar = avatar
+ state.avatar = avatar;
},
SET_ROLES: (state, roles) => {
- state.roles = roles
+ state.roles = roles;
},
SET_PERMISSIONS: (state, permissions) => {
- state.permissions = permissions
- }
+ state.permissions = permissions;
+ },
},
actions: {
// 登录
Login({ commit }, userInfo) {
- const username = userInfo.username.trim()
- const password = userInfo.password
- const code = userInfo.code
- const uuid = userInfo.uuid
+ const username = userInfo.username.trim();
+ const password = userInfo.password;
+ const code = userInfo.code;
+ const uuid = userInfo.uuid;
return new Promise((resolve, reject) => {
- login(username, password, code, uuid).then(res => {
- setToken(res.token)
- commit('SET_TOKEN', res.token)
- resolve()
- }).catch(error => {
- reject(error)
- })
- })
+ login(username, password, code, uuid)
+ .then((res) => {
+ setToken(res.token);
+ commit("SET_TOKEN", res.token);
+ resolve();
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
},
//默认跳转
DefaultLogin({ commit }, userInfo) {
-
return new Promise((resolve, reject) => {
- defaultLogin(userInfo.username,userInfo.token).then(res => {
- setToken(res.token)
- commit('SET_TOKEN', res.token)
- resolve()
- }).catch(error => {
- reject(error)
- })
- })
+ defaultLogin(userInfo.username, userInfo.token)
+ .then((res) => {
+ setToken(res.token);
+ commit("SET_TOKEN", res.token);
+ resolve();
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
},
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
- getInfo().then(res => {
- const user = res.user
- const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
- if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
- commit('SET_ROLES', res.roles)
- commit('SET_PERMISSIONS', res.permissions)
- } else {
- commit('SET_ROLES', ['ROLE_DEFAULT'])
- }
- commit('SET_ID', user.userId)
- commit('SET_NAME', user.userName)
- commit('SET_AVATAR', avatar)
- resolve(res)
- }).catch(error => {
- reject(error)
- })
- })
+ getInfo()
+ .then((res) => {
+ const user = res.user;
+ const avatar =
+ user.avatar == "" || user.avatar == null
+ ? require("@/assets/images/profile.jpg")
+ : process.env.VUE_APP_BASE_API + user.avatar;
+ if (res.roles && res.roles.length > 0) {
+ // 验证返回的roles是否是一个非空数组
+ commit("SET_ROLES", res.roles);
+ commit("SET_PERMISSIONS", res.permissions);
+ } else {
+ commit("SET_ROLES", ["ROLE_DEFAULT"]);
+ }
+ commit("SET_ID", user.userId);
+ commit("SET_NAME", user.userName);
+ commit("SET_AVATAR", avatar);
+ resolve(res);
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
},
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
- logout(state.token).then(() => {
- commit('SET_TOKEN', '')
- commit('SET_ROLES', [])
- commit('SET_PERMISSIONS', [])
- removeToken()
- resolve()
- }).catch(error => {
- reject(error)
- })
- })
+ logout(state.token)
+ .then(() => {
+ commit("SET_TOKEN", "");
+ commit("SET_ROLES", []);
+ commit("SET_PERMISSIONS", []);
+ removeToken();
+ resolve();
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
},
// 前端 登出
FedLogOut({ commit }) {
- return new Promise(resolve => {
- commit('SET_TOKEN', '')
- removeToken()
- resolve()
- })
- }
- }
-}
+ return new Promise((resolve) => {
+ commit("SET_TOKEN", "");
+ removeToken();
+ resolve();
+ });
+ },
+ },
+};
-export default user
+export default user;
diff --git a/ldlz-web/src/views/login.vue b/ldlz-web/src/views/login.vue
index 30ffd52..588bfc2 100644
--- a/ldlz-web/src/views/login.vue
+++ b/ldlz-web/src/views/login.vue
@@ -1,50 +1,93 @@
-
+
-
-
+
+
-
-
+
+
-
-
+
+
- 记住密码
-
-
+ 记住密码
+
+
登 录
登 录 中...
-
领导履职管理系统
- 立即注册
+
@@ -144,7 +198,7 @@ export default {
background-image: url("../assets/images/login-background.jpg");
background-repeat: no-repeat;
background-position: bottom;
- background-color: #F2F2F2;
+ background-color: #f2f2f2;
}
.title {
diff --git a/ldlz-web/src/views/ywgllogin.vue b/ldlz-web/src/views/ywgllogin.vue
index 4515b96..c743c7f 100644
--- a/ldlz-web/src/views/ywgllogin.vue
+++ b/ldlz-web/src/views/ywgllogin.vue
@@ -1,199 +1,196 @@
+ 立即注册
-
-
-
+
+
+
-
-
+#loader-wrapper .load_title span {
+ font-weight: normal;
+ font-style: italic;
+ font-size: 13px;
+ color: #fff;
+ opacity: 0.5;
+}
+
-
-
-
-
-
-
+ 正在加载系统资源,请耐心等待
-
+
+
+
+
正在加载系统资源,请耐心等待
+