长页默认数据深拷贝

master
yujialong 2 months ago
parent 6193ddd2d9
commit 6f4d5c8432
  1. 2
      src/components/editor.js
  2. 1
      src/mixins/page/index.js
  3. 2
      src/pages/article/add/editor.js
  4. 7
      src/pages/column/add/index.vue
  5. 2
      src/pages/column/list/index.vue
  6. 2
      src/pages/column/page/about.vue
  7. 2
      src/pages/column/page/aboutNew.vue
  8. 2
      src/pages/column/page/aboutUs.vue
  9. 2
      src/pages/column/page/application.vue
  10. 2
      src/pages/column/page/careers.vue
  11. 2
      src/pages/column/page/contactUs.vue
  12. 2
      src/pages/column/page/devHistory.vue
  13. 2
      src/pages/column/page/deviceIntroBeam.vue
  14. 2
      src/pages/column/page/deviceIntroLayout.vue
  15. 2
      src/pages/column/page/deviceIntroLinear.vue
  16. 2
      src/pages/column/page/edu.vue
  17. 5
      src/pages/column/page/estate/event/index.vue
  18. 2
      src/pages/column/page/estate/index/index.vue
  19. 2
      src/pages/column/page/estate/location/index.vue
  20. 2
      src/pages/column/page/estate/orgSetup/index.vue
  21. 2
      src/pages/column/page/estate/survey/index.vue
  22. 2
      src/pages/column/page/exp.vue
  23. 2
      src/pages/column/page/governance.vue
  24. 2
      src/pages/column/page/home.vue
  25. 2
      src/pages/column/page/iasf.vue
  26. 2
      src/pages/column/page/index.vue
  27. 2
      src/pages/column/page/industrial.vue
  28. 2
      src/pages/column/page/lightSources.vue
  29. 2
      src/pages/column/page/member.vue
  30. 2
      src/pages/column/page/mission.vue
  31. 2
      src/pages/column/page/news.vue
  32. 2
      src/pages/column/page/newsPress.vue
  33. 2
      src/pages/column/page/newsProcurement.vue
  34. 2
      src/pages/column/page/org.vue
  35. 2
      src/pages/column/page/overview.vue
  36. 2
      src/pages/column/page/overviewDevHistory.vue
  37. 2
      src/pages/column/page/overviewIntro.vue
  38. 2
      src/pages/column/page/overviewLocation.vue
  39. 2
      src/pages/column/page/overviewSetup.vue
  40. 2
      src/pages/column/page/overviewTrailer.vue
  41. 2
      src/pages/column/page/research.vue
  42. 2
      src/pages/column/page/researchNew.vue
  43. 2
      src/pages/column/page/researchTeam.vue
  44. 2
      src/pages/column/page/science.vue
  45. 2
      src/pages/column/page/scientific.vue
  46. 2
      src/pages/column/page/sfel.vue
  47. 2
      src/pages/column/page/sfelNew.vue
  48. 2
      src/pages/column/page/shop.vue
  49. 2
      src/pages/column/page/singlePage.vue
  50. 2
      src/pages/column/page/speech.vue
  51. 2
      src/pages/column/page/talent.vue
  52. 2
      src/pages/column/page/talentCenter.vue
  53. 2
      src/pages/column/page/talentCentre.vue
  54. 2
      src/pages/column/page/team.vue
  55. 2
      src/pages/column/page/userSharing.vue
  56. 19
      src/plugins/requests/index.js
  57. 3
      src/store/modules/user.js

@ -7,7 +7,7 @@ export default {
//skin:'oxide-dark', //skin:'oxide-dark',
language: 'zh_CN', language: 'zh_CN',
language_url: './styles/tinymce/langs/zh_CN.js', language_url: './styles/tinymce/langs/zh_CN.js',
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern help emoticons autosave autoresize formatpainter paragraphspacing', plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern help emoticons autoresize formatpainter paragraphspacing',
toolbar: 'code undo redo restoredraft | cut copy pastetext | forecolor backcolor headings fontsize lineHeight bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify | \ toolbar: 'code undo redo restoredraft | cut copy pastetext | forecolor backcolor headings fontsize lineHeight bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify | \
styleselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | \ styleselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | \
table image media charmap emoticons hr pagebreak insertdatetime print preview | fullscreen | indent2em formatpainter | paragraphspacing', table image media charmap emoticons hr pagebreak insertdatetime print preview | fullscreen | indent2em formatpainter | paragraphspacing',

@ -1,6 +1,7 @@
import Module from '@/components/modules/module' import Module from '@/components/modules/module'
import Setting from '@/setting' import Setting from '@/setting'
import Util from '@/libs/util' import Util from '@/libs/util'
import _ from 'lodash'
import { Loading } from 'element-ui' import { Loading } from 'element-ui'
export default { export default {
data () { data () {

@ -8,7 +8,7 @@ export default {
//skin:'oxide-dark', //skin:'oxide-dark',
language: 'zh_CN', language: 'zh_CN',
language_url: './styles/tinymce/langs/zh_CN.js', language_url: './styles/tinymce/langs/zh_CN.js',
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern help emoticons autosave autoresize formatpainter', plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern help emoticons autoresize formatpainter',
toolbar: 'code undo redo restoredraft | cut copy pastetext | forecolor backcolor headings fontsize lineHeight bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify | \ toolbar: 'code undo redo restoredraft | cut copy pastetext | forecolor backcolor headings fontsize lineHeight bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify | \
styleselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | \ styleselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | \
table image media charmap emoticons hr pagebreak insertdatetime print preview | fullscreen | indent2em formatpainter', table image media charmap emoticons hr pagebreak insertdatetime print preview | fullscreen | indent2em formatpainter',

@ -170,6 +170,7 @@ import { mapState } from 'vuex'
import Cropper from '@/components/img-upload/Cropper' import Cropper from '@/components/img-upload/Cropper'
import Axios from 'axios' import Axios from 'axios'
import Modules from '@/const/modules' import Modules from '@/const/modules'
import _ from 'lodash'
export default { export default {
data () { data () {
return { return {
@ -299,7 +300,6 @@ export default {
if (this.submiting) { if (this.submiting) {
next() next()
} else { } else {
const { id } = this.form
const { updateTime } = this const { updateTime } = this
// //
if (updateTime > 1) { if (updateTime > 1) {
@ -654,7 +654,6 @@ export default {
this.updateFile(form, data) this.updateFile(form, data)
// //
form.typeId === 3 && this.savePage(data) form.typeId === 3 && this.savePage(data)
// return
Util.successMsg("创建成功") Util.successMsg("创建成功")
next ? next() : this.$router.back() next ? next() : this.$router.back()
}).catch(err => { }).catch(err => {
@ -666,11 +665,9 @@ export default {
async savePage (columnId) { async savePage (columnId) {
const { listStyleId } = this.form const { listStyleId } = this.form
const { data } = await this.$post(`${this.api.findPage}?columnId=${columnId}`) const { data } = await this.$post(`${this.api.findPage}?columnId=${columnId}`)
let module = Modules[this.pageStyle.find(e => e.id == listStyleId).path] // module.js let module = _.cloneDeep(Modules[this.pageStyle.find(e => e.id == listStyleId).path]) // module.js
// json // json
if (data.length) module = JSON.stringify(module) if (data.length) module = JSON.stringify(module)
console.log(111, Modules, module, Modules['iasf'])
// debugger
if (module) { if (module) {
await this.$post(this.api[data.length ? 'updatePage' : 'savePage'], { await this.$post(this.api[data.length ? 'updatePage' : 'savePage'], {
id: data.length ? data[0].id : '', id: data.length ? data[0].id : '',

@ -406,7 +406,7 @@ export default {
} else { } else {
this.$post(this.api.saveStyle, this.form).then(res => { this.$post(this.api.saveStyle, this.form).then(res => {
this.$post(`${this.api.searchAllBySite}?siteId=${this.siteId}`).then(({ data }) => { this.$post(`${this.api.searchAllBySite}?siteId=${this.siteId}`).then(({ data }) => {
this.form = data[0] if (data.length) this.form = data[0]
}).catch(res => { }) }).catch(res => { })
}).catch(res => { }) }).catch(res => { })
} }

@ -208,7 +208,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.about modules: _.cloneDeep(Modules.about)
} }
}, },
mounted () { }, mounted () { },

@ -176,7 +176,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.about modules: _.cloneDeep(Modules.about)
} }
}, },
mounted () { }, mounted () { },

@ -185,7 +185,7 @@ export default {
data () { data () {
return { return {
isImg: Util.isImg, isImg: Util.isImg,
modules: Modules.aboutUs, modules: _.cloneDeep(Modules.aboutUs),
} }
}, },
components: { components: {

@ -158,7 +158,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.application modules: _.cloneDeep(Modules.application)
} }
}, },
mounted () { }, mounted () { },

@ -124,7 +124,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.careers modules: _.cloneDeep(Modules.careers)
} }
}, },
mounted () { }, mounted () { },

@ -59,7 +59,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.contactUs modules: _.cloneDeep(Modules.contactUs)
} }
}, },
mounted () { }, mounted () { },

@ -51,7 +51,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.devHistory modules: _.cloneDeep(Modules.devHistory)
} }
}, },
mounted () { }, mounted () { },

@ -69,7 +69,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.deviceIntroBeam modules: _.cloneDeep(Modules.deviceIntroBeam)
} }
}, },
mounted () { }, mounted () { },

@ -67,7 +67,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.deviceIntroLayout modules: _.cloneDeep(Modules.deviceIntroLayout)
} }
}, },
mounted () { }, mounted () { },

@ -69,7 +69,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.deviceIntroLinear modules: _.cloneDeep(Modules.deviceIntroLinear)
} }
}, },
mounted () { }, mounted () { },

@ -76,7 +76,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.edu modules: _.cloneDeep(Modules.edu)
} }
}, },
mounted () { }, mounted () { },

@ -36,7 +36,8 @@
<div v-if="modules[1].list.length" class="event"> <div v-if="modules[1].list.length" class="event">
<ul class="time"> <ul class="time">
<template v-for="(item, i) in modules[1].list"> <template v-for="(item, i) in modules[1].list">
<li v-if="item.isEnable" :key="i" :class="{ active: curYear == i }" @click="yearClick(i)">{{ item.title }} <li v-if="item.isEnable" :key="i" :class="{ active: curYear == i }" @click="yearClick(i)">{{ item.title
}}
</li> </li>
</template> </template>
</ul> </ul>
@ -71,7 +72,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules['estate/event'], modules: _.cloneDeep(Modules['estate/event']),
active: 0, active: 0,
tabs: ['大事记'], tabs: ['大事记'],
curYear: 0 curYear: 0

@ -231,7 +231,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules['estate/index'] modules: _.cloneDeep(Modules['estate/index'])
} }
}, },
mounted () { }, mounted () { },

@ -73,7 +73,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules['estate/location'], modules: _.cloneDeep(Modules['estate/location']),
active: 0, active: 0,
tabs: ['地理位置'] tabs: ['地理位置']
} }

@ -55,7 +55,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules['estate/orgSetup'], modules: _.cloneDeep(Modules['estate/orgSetup']),
active: 0, active: 0,
tabs: ['机构设置'] tabs: ['机构设置']
} }

@ -54,7 +54,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules['estate/survey'], modules: _.cloneDeep(Modules['estate/survey']),
active: 0, active: 0,
tabs: ['产业光源概况'] tabs: ['产业光源概况']
} }

@ -85,7 +85,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.exp, modules: _.cloneDeep(Modules.exp),
Util Util
} }
}, },

@ -65,7 +65,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.governance, modules: _.cloneDeep(Modules.governance),
curYear: 0 curYear: 0
} }
}, },

@ -212,7 +212,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.home modules: _.cloneDeep(Modules.home)
} }
}, },
mounted () { }, mounted () { },

@ -239,7 +239,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.iasf, modules: _.cloneDeep(Modules.iasf),
articles: [], articles: [],
articles1: [], articles1: [],
articles2: [], articles2: [],

@ -48,7 +48,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.index modules: _.cloneDeep(Modules.index)
} }
}, },
mounted () { }, mounted () { },

@ -162,7 +162,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.industrial modules: _.cloneDeep(Modules.industrial)
} }
}, },
mounted () { }, mounted () { },

@ -131,7 +131,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.lightSources, modules: _.cloneDeep(Modules.lightSources),
active: 0, active: 0,
tabs: [ tabs: [
{ {

@ -57,7 +57,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.member, modules: _.cloneDeep(Modules.member),
} }
}, },
mounted () { }, mounted () { },

@ -75,7 +75,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.mission modules: _.cloneDeep(Modules.mission)
} }
}, },
mounted () { }, mounted () { },

@ -249,7 +249,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.news, modules: _.cloneDeep(Modules.news),
tabs: [ tabs: [
{ {
id: 1, id: 1,

@ -54,7 +54,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.newsPress modules: _.cloneDeep(Modules.newsPress)
} }
}, },
mounted () { }, mounted () { },

@ -54,7 +54,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.newsProcurement modules: _.cloneDeep(Modules.newsProcurement)
} }
}, },
mounted () { }, mounted () { },

@ -48,7 +48,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.org modules: _.cloneDeep(Modules.org)
} }
}, },
mounted () { }, mounted () { },

@ -150,7 +150,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.overview modules: _.cloneDeep(Modules.overview)
} }
}, },
mounted () { }, mounted () { },

@ -74,7 +74,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.overviewDevHistory, modules: _.cloneDeep(Modules.overviewDevHistory),
active: 0, active: 0,
tabs: ['发展历程'], tabs: ['发展历程'],
curYear: 0 curYear: 0

@ -62,7 +62,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.overviewIntro, modules: _.cloneDeep(Modules.overviewIntro),
active: 0, active: 0,
tabs: ['S³FEL介绍'] tabs: ['S³FEL介绍']
} }

@ -46,7 +46,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.overviewLocation, modules: _.cloneDeep(Modules.overviewLocation),
active: 0, active: 0,
tabs: ['地理位置'] tabs: ['地理位置']
} }

@ -54,7 +54,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.overviewSetup, modules: _.cloneDeep(Modules.overviewSetup),
active: 0, active: 0,
tabs: ['机构设置'] tabs: ['机构设置']
} }

@ -50,7 +50,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.overviewTrailer, modules: _.cloneDeep(Modules.overviewTrailer),
active: 0, active: 0,
tabs: ['S³FEL宣传片'] tabs: ['S³FEL宣传片']
} }

@ -93,7 +93,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.research modules: _.cloneDeep(Modules.research)
} }
}, },
mounted () { }, mounted () { },

@ -73,7 +73,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.research modules: _.cloneDeep(Modules.research)
} }
}, },
mounted () { }, mounted () { },

@ -59,7 +59,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.researchTeam, modules: _.cloneDeep(Modules.researchTeam),
title: '' title: ''
} }
}, },

@ -63,7 +63,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.science modules: _.cloneDeep(Modules.science)
} }
}, },
mounted () { }, mounted () { },

@ -70,7 +70,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.scientific modules: _.cloneDeep(Modules.scientific)
} }
}, },
mounted () { }, mounted () { },

@ -362,7 +362,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.sfel modules: _.cloneDeep(Modules.sfel)
} }
}, },
mounted () { }, mounted () { },

@ -241,7 +241,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.sfel modules: _.cloneDeep(Modules.sfel)
} }
}, },
mounted () { }, mounted () { },

@ -67,7 +67,7 @@ export default {
data () { data () {
return { return {
isImg: Util.isImg, isImg: Util.isImg,
modules: Modules.shop modules: _.cloneDeep(Modules.shop)
} }
}, },
mounted () { }, mounted () { },

@ -125,7 +125,7 @@ export default {
data () { data () {
return { return {
isImg: Util.isImg, isImg: Util.isImg,
modules: Modules.singlePage, modules: _.cloneDeep(Modules.singlePage),
articles: [], articles: [],
articles1: [], articles1: [],
} }

@ -51,7 +51,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.speech modules: _.cloneDeep(Modules.speech)
} }
}, },
mounted () { }, mounted () { },

@ -101,7 +101,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.talent modules: _.cloneDeep(Modules.talent)
} }
}, },
mounted () { }, mounted () { },

@ -105,7 +105,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.talentCenter modules: _.cloneDeep(Modules.talentCenter)
} }
}, },
mounted () { }, mounted () { },

@ -85,7 +85,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.talentCentre, modules: _.cloneDeep(Modules.talentCentre),
defaultProps: { defaultProps: {
value: 'id', value: 'id',
label: 'title' label: 'title'

@ -50,7 +50,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.team modules: _.cloneDeep(Modules.team)
} }
}, },
mounted () { }, mounted () { },

@ -73,7 +73,7 @@ export default {
mixins: [mixins], mixins: [mixins],
data () { data () {
return { return {
modules: Modules.userSharing modules: _.cloneDeep(Modules.userSharing)
} }
}, },
mounted () { }, mounted () { },

@ -1,7 +1,7 @@
import axios from 'axios' import axios from 'axios'
import Util from '@/libs/util' import Util from '@/libs/util'
import Setting from '@/setting' import Setting from '@/setting'
import store from '@/store' import Store from '@/store'
import Router from '@/router' import Router from '@/router'
const service = axios.create({ const service = axios.create({
@ -14,14 +14,17 @@ service.defaults.headers['X-Content-Type-Options'] = 'nosniff'
service.defaults.headers['Content-Security-Policy'] = 'script-src "self"; object-src "none";style-src cdn.example.org third-party.org; child-src https:' service.defaults.headers['Content-Security-Policy'] = 'script-src "self"; object-src "none";style-src cdn.example.org third-party.org; child-src https:'
// 请求拦截器 // 请求拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
let token = Util.local.get(Setting.tokenKey); let token = Util.local.get(Setting.tokenKey)
if (token) config.headers.token = token if (token) {
config.headers.token = token
Store.state.user.userId || Store.dispatch('user/logout')
}
return config; return config;
}, err => { }, err => {
Util.errorMsg({ Util.errorMsg({
message: "退出登陆", message: '退出登陆',
onClose: function () { onClose: function () {
store.dispatch('user/logout') Store.dispatch('user/logout')
} }
}); });
return Promise.reject(err); return Promise.reject(err);
@ -37,7 +40,7 @@ service.interceptors.response.use(
} else if (code === 401) { } else if (code === 401) {
Util.errorMsg(res.msg) Util.errorMsg(res.msg)
setTimeout(() => { setTimeout(() => {
store.dispatch('user/logout') Store.dispatch('user/logout')
}, 1000) }, 1000)
return Promise.reject(res) return Promise.reject(res)
} else if (code == 300) { } else if (code == 300) {
@ -61,14 +64,14 @@ service.interceptors.response.use(
case 401: case 401:
Util.errorMsg("登录过期,请重新登录") Util.errorMsg("登录过期,请重新登录")
setTimeout(() => { setTimeout(() => {
store.dispatch('user/logout') Store.dispatch('user/logout')
}, 1000) }, 1000)
break break
// 403 token过期 // 403 token过期
case 403: case 403:
Util.errorMsg("登录过期,请重新登录") Util.errorMsg("登录过期,请重新登录")
setTimeout(() => { setTimeout(() => {
store.dispatch('user/logout') Store.dispatch('user/logout')
}, 1000) }, 1000)
break break
// 其他错误,直接抛出错误提示 // 其他错误,直接抛出错误提示

@ -1,6 +1,5 @@
import Setting from '@/setting' import Setting from '@/setting'
import util from '@/libs/util' import util from '@/libs/util'
import addRoutes from '@/libs/route/addRoutes'
/** /**
* 用户信息 * 用户信息
@ -28,7 +27,7 @@ export default {
} }
}, },
actions: { actions: {
logout({ commit, state, dispatch }) { logout ({ commit, state, dispatch }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
util.local.remove(Setting.storeKey) util.local.remove(Setting.storeKey)
util.local.remove(Setting.tokenKey) util.local.remove(Setting.tokenKey)

Loading…
Cancel
Save