修复打包后静态页面加载异常
This commit is contained in:
parent
5b18172896
commit
41ca4e938d
@ -69,9 +69,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
// 可以直接访问的静态数据
|
// 可以直接访问的静态数据
|
||||||
web.ignoring()
|
web.ignoring()
|
||||||
.antMatchers("/")
|
.antMatchers("/")
|
||||||
.antMatchers("/css/**")
|
.antMatchers("/static/**")
|
||||||
.antMatchers("/img/**")
|
|
||||||
.antMatchers("/fonts/**")
|
|
||||||
.antMatchers("/index.html")
|
.antMatchers("/index.html")
|
||||||
.antMatchers("/doc.html") // "/webjars/**", "/swagger-resources/**", "/v3/api-docs/**"
|
.antMatchers("/doc.html") // "/webjars/**", "/swagger-resources/**", "/v3/api-docs/**"
|
||||||
.antMatchers("/webjars/**")
|
.antMatchers("/webjars/**")
|
||||||
@ -100,6 +98,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.cors().and().csrf().disable();
|
http.cors().and().csrf().disable();
|
||||||
|
// 设置允许添加静态文件
|
||||||
|
http.headers().contentTypeOptions().disable();
|
||||||
http.authorizeRequests()
|
http.authorizeRequests()
|
||||||
// 放行接口
|
// 放行接口
|
||||||
.antMatchers("/api/user/login","/index/hook/**").permitAll()
|
.antMatchers("/api/user/login","/index/hook/**").permitAll()
|
||||||
|
@ -64,8 +64,8 @@ const devWebpackConfig = merge(baseWebpackConfig, {
|
|||||||
to: config.dev.assetsSubDirectory,
|
to: config.dev.assetsSubDirectory,
|
||||||
ignore: ['.*']
|
ignore: ['.*']
|
||||||
},
|
},
|
||||||
{ from: 'node_modules/@easydarwin/easywasmplayer/libDecoder.wasm'},
|
{ from: 'node_modules/@easydarwin/easywasmplayer/libDecoder.wasm', to: 'static/'},
|
||||||
{ from: 'node_modules/@easydarwin/easywasmplayer/EasyWasmPlayer.js', to: 'js/'}
|
{ from: 'node_modules/@easydarwin/easywasmplayer/EasyWasmPlayer.js', to: 'static/js/'}
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@ -46,7 +46,7 @@ const webpackConfig = merge(baseWebpackConfig, {
|
|||||||
filename: utils.assetsPath('css/[name].[contenthash].css'),
|
filename: utils.assetsPath('css/[name].[contenthash].css'),
|
||||||
// Setting the following option to `false` will not extract CSS from codesplit chunks.
|
// Setting the following option to `false` will not extract CSS from codesplit chunks.
|
||||||
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
||||||
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
||||||
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
||||||
allChunks: true,
|
allChunks: true,
|
||||||
}),
|
}),
|
||||||
@ -115,8 +115,8 @@ const webpackConfig = merge(baseWebpackConfig, {
|
|||||||
to: config.build.assetsSubDirectory,
|
to: config.build.assetsSubDirectory,
|
||||||
ignore: ['.*']
|
ignore: ['.*']
|
||||||
},
|
},
|
||||||
{ from: 'node_modules/@easydarwin/easywasmplayer/libDecoder.wasm'},
|
{ from: 'node_modules/@easydarwin/easywasmplayer/libDecoder.wasm', to: 'static/'},
|
||||||
{ from: 'node_modules/@easydarwin/easywasmplayer/EasyWasmPlayer.js', to: 'js/'}
|
{ from: 'node_modules/@easydarwin/easywasmplayer/EasyWasmPlayer.js', to: 'static/js/'}
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@ -51,7 +51,7 @@ module.exports = {
|
|||||||
|
|
||||||
// Paths
|
// Paths
|
||||||
assetsRoot: path.resolve(__dirname, '../../src/main/resources/static/'),
|
assetsRoot: path.resolve(__dirname, '../../src/main/resources/static/'),
|
||||||
assetsSubDirectory: '.',
|
assetsSubDirectory: './static',
|
||||||
assetsPublicPath: '/',
|
assetsPublicPath: '/',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
<title>国标28181</title>
|
<title>国标28181</title>
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css">
|
<link rel="stylesheet" type="text/css" href="./static/css/font-awesome.min.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/login.css">
|
<link rel="stylesheet" type="text/css" href="./static/css/login.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript" src="./js/EasyWasmPlayer.js"></script>
|
<script type="text/javascript" src="./static/js/EasyWasmPlayer.js"></script>
|
||||||
<script type="text/javascript" src="/static/js/ZLMRTCClient.js"></script>
|
<script type="text/javascript" src="./static/js/ZLMRTCClient.js"></script>
|
||||||
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=rk73w8dv1rkE4UdZsataG68VarhYQzrx&s=1"></script>
|
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=rk73w8dv1rkE4UdZsataG68VarhYQzrx&s=1"></script>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<!-- built files will be auto injected -->
|
<!-- built files will be auto injected -->
|
||||||
|
@ -21,6 +21,7 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
if(!this.$cookies.get("session")){
|
if(!this.$cookies.get("session")){
|
||||||
//如果没有登录状态则跳转到登录页
|
//如果没有登录状态则跳转到登录页
|
||||||
|
console.log("33333333")
|
||||||
this.$router.push('/login');
|
this.$router.push('/login');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -42,6 +43,7 @@ export default {
|
|||||||
//cookie操作方法在源码里有或者参考网上的即可
|
//cookie操作方法在源码里有或者参考网上的即可
|
||||||
if(!this.$cookies.get("session")){
|
if(!this.$cookies.get("session")){
|
||||||
//如果没有登录状态则跳转到登录页
|
//如果没有登录状态则跳转到登录页
|
||||||
|
console.log("222222222")
|
||||||
this.$router.push('/login');
|
this.$router.push('/login');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -41,16 +41,17 @@ Vue.prototype.$notify = Notification;
|
|||||||
axios.defaults.baseURL = (process.env.NODE_ENV === 'development') ? process.env.BASE_API : "";
|
axios.defaults.baseURL = (process.env.NODE_ENV === 'development') ? process.env.BASE_API : "";
|
||||||
|
|
||||||
// api 返回401自动回登陆页面
|
// api 返回401自动回登陆页面
|
||||||
axios.interceptors.response.use(function (response) {
|
// axios.interceptors.response.use(function (response) {
|
||||||
// 对响应数据做点什么
|
// // 对响应数据做点什么
|
||||||
return response;
|
// return response;
|
||||||
}, function (error) {
|
// }, function (error) {
|
||||||
// 对响应错误做点什么
|
// // 对响应错误做点什么
|
||||||
if (error.response.status === 401) {
|
// if (error.response.status === 401) {
|
||||||
router.push('/login');
|
// console.log((1111))
|
||||||
}
|
// router.push('/login');
|
||||||
return Promise.reject(error);
|
// }
|
||||||
});
|
// return Promise.reject(error);
|
||||||
|
// });
|
||||||
|
|
||||||
Vue.prototype.$cookies.config(60*30);
|
Vue.prototype.$cookies.config(60*30);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user