处理管理员端直接访问

dev
许宏杰 1 year ago
parent e36ee3fa73
commit 08b10cfa3f

@ -6,7 +6,7 @@ ENV = 'development'
# 苏州园区志愿服务活动区块链平台/开发环境
# VUE_APP_BASE_API = 'https://vue.ruoyi.vip/prod-api'
VUE_APP_BASE_API = 'http://39.101.188.84:9034'
VUE_APP_BASE_API = 'http://localhost:9034/api/'
# VUE_APP_BASE_API = 'http:///192.168.0.119:9034'
# 路由懒加载

@ -7,4 +7,4 @@ ENV = 'production'
# 苏州园区志愿服务活动区块链平台/生产环境
# VUE_APP_BASE_API = 'http://39.101.188.84:9034/api'
VUE_APP_BASE_API = 'http://192.114.0.243/api'
VUE_APP_BASE_API = 'https://zyzqkl.sipac.gov.cn/api'

@ -129,7 +129,7 @@ aside {
width: 100%;
background: #fff;
box-shadow: 0px 0px 15px 0px rgba(229, 212, 212, 0.58);
border-radius: 8px 8px 0 0px;
border-radius: 8px;
overflow-y: auto;
}

@ -1,9 +1,12 @@
<template>
<div class="my-container">
<MyHead />
<div class="app-main">
<div class="left-sidebar">
<sidebar v-if="!sidebar.hide" class="sidebar-container" />
<MyHead v-if="isMenuHeader" />
<div
class="app-main"
:style="{ height: isMenuHeader ? 'calc(100% - 60px)' : '100%' }"
>
<div class="left-sidebar" v-if="isMenuHeader">
<sidebar class="sidebar-container" />
</div>
<div class="right-page">
<app-main />
@ -50,7 +53,7 @@ import {
import ResizeMixin from "./mixin/ResizeHandler";
import { mapState } from "vuex";
import variables from "@/assets/styles/variables.scss";
import { mapGetters } from "vuex";
export default {
name: "Layout",
components: {
@ -64,6 +67,7 @@ export default {
},
mixins: [ResizeMixin],
computed: {
...mapGetters(["isMenuHeader"]),
...mapState({
theme: (state) => state.settings.theme,
sideTheme: (state) => state.settings.sideTheme,
@ -101,7 +105,7 @@ export default {
width: 100%;
.app-main {
height: calc(100% - 60px);
// height: calc(100% - 60px);
display: flex;
.left-sidebar {
@ -112,7 +116,7 @@ export default {
}
.right-page {
background: #f5f5f5;
padding: 13px 13px 0 13px;
padding: 13px;
height: 100%;
flex: 1;
overflow: hidden;

@ -8,7 +8,17 @@ import { isRelogin } from "@/utils/request";
NProgress.configure({ showSpinner: false });
const whiteList = ["/login", "/register", "/3dmodel"];
const whiteList = [
"/login",
"/register",
"/3dmodel",
"/volunteer/userbq/bqhsj",
"/volunteer/userbq/dictGl",
"/volunteer/hdtj/hdGl",
"/volunteer/yzczs/ycxzsff",
"/volunteer/gxhzs/gxhzsgl",
"/volunteer/gxhzs/gxhzsff",
];
router.beforeEach((to, from, next) => {
NProgress.start();
@ -19,6 +29,8 @@ router.beforeEach((to, from, next) => {
next({ path: "/" });
NProgress.done();
} else {
let isTrue = whiteList.some((item) => item == to.path);
store.commit("SET_IS_MENU_HEADER", !isTrue);
if (store.getters.roles.length === 0) {
isRelogin.show = true;
// 判断当前用户是否已拉取完user_info信息
@ -43,13 +55,26 @@ router.beforeEach((to, from, next) => {
}
}
} else {
// 没有token
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next();
let { isFromVolunteer, tel } = to.query;
if (tel) {
// store
// .dispatch("Login", {
// username: "15937192537",
// password: "123456",
// })
// .then(() => {
// store.commit("SET_IS_MENU_HEADER", false);
// });
} else {
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`); // 否则全部重定向到登录页
NProgress.done();
if (whiteList.indexOf(to.path) !== -1) {
store.commit("SET_IS_MENU_HEADER", false); //不显示左侧菜单,头部标题
// 没有token
// 在免登录白名单,直接进入
next();
} else {
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`); // 否则全部重定向到登录页
NProgress.done();
}
}
}
});

@ -17,5 +17,6 @@ const getters = {
defaultRoutes: (state) => state.permission.defaultRoutes,
sidebarRouters: (state) => state.permission.sidebarRouters,
integral: (state) => state.permission.integral,
isMenuHeader: (state) => state.user.isMenuHeader,
};
export default getters;

@ -9,9 +9,13 @@ const user = {
avatar: "",
roles: [],
permissions: [],
isMenuHeader: true, //是否显示左边菜单和头部标题
},
mutations: {
SET_IS_MENU_HEADER: (state, isTrue) => {
state.isMenuHeader = isTrue;
},
SET_TOKEN: (state, token) => {
state.token = token;
},

@ -25,7 +25,8 @@ module.exports = {
// 部署生产环境和开发环境下的URL。
// 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.NODE_ENV === "production" ? "/demo/volunteer" : "/",
// publicPath: process.env.NODE_ENV === "production" ? "/demo/volunteer" : "/",
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
// 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist
outputDir: "dist",
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)

Loading…
Cancel
Save