修改代码

This commit is contained in:
ival 2019-11-12 14:16:11 +08:00
parent 79219792c9
commit 0b47562cca
2 changed files with 48 additions and 43 deletions

View File

@ -7,7 +7,7 @@
<script> <script>
import { handleToken } from '@/utils/auth'; import { handleToken } from '@/utils/auth';
import { creatSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp'; import { creatSubscribe, clearSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import DeomonTopic from '@/views/demonstration/deomonTopic'; import DeomonTopic from '@/views/demonstration/deomonTopic';
import WindowResizeHandler from '@/mixin/WindowResizeHandler'; import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
@ -53,6 +53,7 @@ export default {
}, },
methods: { methods: {
async pageDestory() { async pageDestory() {
this.unSubscribe();
const token = handleToken(); const token = handleToken();
Cookies.remove('UserDesignName'); Cookies.remove('UserDesignName');
Cookies.remove('UserDesignToken'); Cookies.remove('UserDesignToken');
@ -77,6 +78,10 @@ export default {
} }
}); });
}, },
unSubscribe() {
clearSubscribe(perpetualTopic);
clearSubscribe(commonTopic);
},
subscribeMessage(res) { subscribeMessage(res) {
if (this.$refs.deomonTopic) { if (this.$refs.deomonTopic) {
this.$refs.deomonTopic.doShow(res); this.$refs.deomonTopic.doShow(res);

View File

@ -11,7 +11,7 @@ const BASE_API = getBaseUrl();
const service = axios.create({ const service = axios.create({
baseURL: BASE_API, // api的base_url baseURL: BASE_API, // api的base_url
withCredentials: true, // 跨域请求时是否需要使用凭证 withCredentials: true, // 跨域请求时是否需要使用凭证
timeout: 60000 // 请求超时时间 timeout: 600000 // 请求超时时间
}); });
// request拦截器 // request拦截器