Commit d4af0e59 authored by 陈珠河's avatar 陈珠河

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

parent 5b4d5a02
...@@ -9,9 +9,15 @@ axios.defaults.withCredentials = true; ...@@ -9,9 +9,15 @@ axios.defaults.withCredentials = true;
// 设置全局的请求次数,请求的间隙 // 设置全局的请求次数,请求的间隙
axios.defaults.retry = 0; axios.defaults.retry = 0;
axios.defaults.retryDelay = 1000; 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; const config = err.config;
// If config does not exist or the retry option is not set, reject // If config does not exist or the retry option is not set, reject
if (!config || !config.retry) return Promise.reject(err); if (!config || !config.retry) return Promise.reject(err);
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
}, },
"dependencies": { "dependencies": {
"core-js": "^2.6.5", "core-js": "^2.6.5",
"smart-charts": "^1.0.0-alpha", "smart-charts": "^1.0.0",
"smart-web": "^2.2.4", "smart-web": "^2.3.0",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-progressbar": "^0.7.5", "vue-progressbar": "^0.7.5",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
......
...@@ -12,6 +12,7 @@ axios.defaults.retry = 1; ...@@ -12,6 +12,7 @@ axios.defaults.retry = 1;
axios.defaults.retryDelay = 1000; axios.defaults.retryDelay = 1000;
// 设置defaults.baseURL // 设置defaults.baseURL
axios.defaults.baseURL = _config.baseUrl; axios.defaults.baseURL = _config.baseUrl;
axios.defaults.headers.common['auth-token'] = window.localStorage.getItem('south-samrtweb-token') || '';
// 请求超时拦截,重新请求 // 请求超时拦截,重新请求
axios.interceptors.response.use(function(response) { axios.interceptors.response.use(function(response) {
...@@ -24,17 +25,10 @@ axios.interceptors.response.use(function(response) { ...@@ -24,17 +25,10 @@ axios.interceptors.response.use(function(response) {
message: '请求服务好像出错了,' + status message: '请求服务好像出错了,' + status
}); });
return Promise.reject(response); return Promise.reject(response);
}/* else if (data.status === 2) { } else if (response.data.data && response.data.data.hasOwnProperty('token')) {
Message({ window.localStorage.setItem('south-samrtweb-token', response.data.data.token);
type: 'error', axios.defaults.headers.common['auth-token'] = window.localStorage.getItem('south-samrtweb-token') || '';
message: '请求服务后台处理出现了错误' }
});
} else if (data.status === 1) {
Message({
type: 'warning',
message: '请求服务处理出现了异常,' + data.message
});
} */
return Promise.resolve(response); return Promise.resolve(response);
}, function axiosRetryInterceptor(err) { }, function axiosRetryInterceptor(err) {
......
...@@ -3,5 +3,10 @@ export default [ ...@@ -3,5 +3,10 @@ export default [
path: 'businessConfiguration', path: 'businessConfiguration',
name: 'businessConfiguration', name: 'businessConfiguration',
component: () => import('@/views/businessConfig/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