Commit bb311198 authored by 曾沂轮's avatar 曾沂轮

Merge branch 'feature-addAnounceAndStyleLogin' into 'master'

Feat: 添加公告模块并调整登陆授权方式

See merge request !4
parents 5b4d5a02 d4af0e59
......@@ -9,9 +9,15 @@ axios.defaults.withCredentials = true;
// 设置全局的请求次数,请求的间隙
axios.defaults.retry = 0;
axios.defaults.retryDelay = 1000;
axios.defaults.headers.common['auth-token'] = window.localStorage.getItem('south-samrtweb-token') || '';
// 请求超时拦截,重新请求
axios.interceptors.response.use(undefined, function axiosRetryInterceptor(err) {
axios.interceptors.response.use(function(response) {
if (response.status === 200 && response.data.data && response.data.data.hasOwnProperty('token')) {
window.localStorage.setItem('south-samrtweb-token', response.data.data.token);
axios.defaults.headers.common['auth-token'] = window.localStorage.getItem('south-samrtweb-token') || '';
}
}, function axiosRetryInterceptor(err) {
const config = err.config;
// If config does not exist or the retry option is not set, reject
if (!config || !config.retry) return Promise.reject(err);
......
......@@ -12,8 +12,8 @@
},
"dependencies": {
"core-js": "^2.6.5",
"smart-charts": "^1.0.0-alpha",
"smart-web": "^2.2.4",
"smart-charts": "^1.0.0",
"smart-web": "^2.3.0",
"vue": "^2.6.10",
"vue-progressbar": "^0.7.5",
"vue-router": "^3.1.3",
......
......@@ -12,6 +12,7 @@ axios.defaults.retry = 1;
axios.defaults.retryDelay = 1000;
// 设置defaults.baseURL
axios.defaults.baseURL = _config.baseUrl;
axios.defaults.headers.common['auth-token'] = window.localStorage.getItem('south-samrtweb-token') || '';
// 请求超时拦截,重新请求
axios.interceptors.response.use(function(response) {
......@@ -24,17 +25,10 @@ axios.interceptors.response.use(function(response) {
message: '请求服务好像出错了,' + status
});
return Promise.reject(response);
}/* else if (data.status === 2) {
Message({
type: 'error',
message: '请求服务后台处理出现了错误'
});
} else if (data.status === 1) {
Message({
type: 'warning',
message: '请求服务处理出现了异常,' + data.message
});
} */
} else if (response.data.data && response.data.data.hasOwnProperty('token')) {
window.localStorage.setItem('south-samrtweb-token', response.data.data.token);
axios.defaults.headers.common['auth-token'] = window.localStorage.getItem('south-samrtweb-token') || '';
}
return Promise.resolve(response);
}, function axiosRetryInterceptor(err) {
......
......@@ -3,5 +3,10 @@ export default [
path: 'businessConfiguration',
name: 'businessConfiguration',
component: () => import('@/views/businessConfig/businessConfiguration'),
},
{
path: 'announce',
name: 'announce',
component: () => import('@/views/businessConfig/announce')
}
];
<template>
<sw-announce></sw-announce>
</template>
<script>
import SwAnnounce from 'smart-web/packages/announce';
import 'smart-web/packages/styles/src/announce.scss';
export default {
name: 'announce',
components: {
SwAnnounce
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment