diff --git a/src/components/editor.js b/src/components/editor.js index a105970..e1c046b 100644 --- a/src/components/editor.js +++ b/src/components/editor.js @@ -7,7 +7,7 @@ export default { //skin:'oxide-dark', language: 'zh_CN', 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 | \ styleselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | \ table image media charmap emoticons hr pagebreak insertdatetime print preview | fullscreen | indent2em formatpainter | paragraphspacing', diff --git a/src/mixins/page/index.js b/src/mixins/page/index.js index f0e44b6..5d828d3 100644 --- a/src/mixins/page/index.js +++ b/src/mixins/page/index.js @@ -1,6 +1,7 @@ import Module from '@/components/modules/module' import Setting from '@/setting' import Util from '@/libs/util' +import _ from 'lodash' import { Loading } from 'element-ui' export default { data () { diff --git a/src/pages/article/add/editor.js b/src/pages/article/add/editor.js index e538971..f2ecbec 100644 --- a/src/pages/article/add/editor.js +++ b/src/pages/article/add/editor.js @@ -8,7 +8,7 @@ export default { //skin:'oxide-dark', language: 'zh_CN', 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 | \ styleselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | \ table image media charmap emoticons hr pagebreak insertdatetime print preview | fullscreen | indent2em formatpainter', diff --git a/src/pages/column/add/index.vue b/src/pages/column/add/index.vue index 68ef5ec..d521ff7 100644 --- a/src/pages/column/add/index.vue +++ b/src/pages/column/add/index.vue @@ -170,6 +170,7 @@ import { mapState } from 'vuex' import Cropper from '@/components/img-upload/Cropper' import Axios from 'axios' import Modules from '@/const/modules' +import _ from 'lodash' export default { data () { return { @@ -299,7 +300,6 @@ export default { if (this.submiting) { next() } else { - const { id } = this.form const { updateTime } = this // 更改了信息才需要提示 if (updateTime > 1) { @@ -654,7 +654,6 @@ export default { this.updateFile(form, data) // 栏目类型选择了长页栏目,才需要保存长页 form.typeId === 3 && this.savePage(data) - // return Util.successMsg("创建成功") next ? next() : this.$router.back() }).catch(err => { @@ -666,11 +665,9 @@ export default { async savePage (columnId) { const { listStyleId } = this.form 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要给字符串(新增给数组) if (data.length) module = JSON.stringify(module) - console.log(111, Modules, module, Modules['iasf']) - // debugger if (module) { await this.$post(this.api[data.length ? 'updatePage' : 'savePage'], { id: data.length ? data[0].id : '', diff --git a/src/pages/column/list/index.vue b/src/pages/column/list/index.vue index 8190d27..5a4ab8e 100644 --- a/src/pages/column/list/index.vue +++ b/src/pages/column/list/index.vue @@ -406,7 +406,7 @@ export default { } else { this.$post(this.api.saveStyle, this.form).then(res => { 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 => { }) } diff --git a/src/pages/column/page/about.vue b/src/pages/column/page/about.vue index 1928d2b..d772e85 100644 --- a/src/pages/column/page/about.vue +++ b/src/pages/column/page/about.vue @@ -208,7 +208,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.about + modules: _.cloneDeep(Modules.about) } }, mounted () { }, diff --git a/src/pages/column/page/aboutNew.vue b/src/pages/column/page/aboutNew.vue index 4f11830..07f8998 100644 --- a/src/pages/column/page/aboutNew.vue +++ b/src/pages/column/page/aboutNew.vue @@ -176,7 +176,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.about + modules: _.cloneDeep(Modules.about) } }, mounted () { }, diff --git a/src/pages/column/page/aboutUs.vue b/src/pages/column/page/aboutUs.vue index 1333820..0aac026 100644 --- a/src/pages/column/page/aboutUs.vue +++ b/src/pages/column/page/aboutUs.vue @@ -185,7 +185,7 @@ export default { data () { return { isImg: Util.isImg, - modules: Modules.aboutUs, + modules: _.cloneDeep(Modules.aboutUs), } }, components: { diff --git a/src/pages/column/page/application.vue b/src/pages/column/page/application.vue index 218ec37..29a0d3e 100644 --- a/src/pages/column/page/application.vue +++ b/src/pages/column/page/application.vue @@ -158,7 +158,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.application + modules: _.cloneDeep(Modules.application) } }, mounted () { }, diff --git a/src/pages/column/page/careers.vue b/src/pages/column/page/careers.vue index 45930d2..3b97b38 100644 --- a/src/pages/column/page/careers.vue +++ b/src/pages/column/page/careers.vue @@ -124,7 +124,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.careers + modules: _.cloneDeep(Modules.careers) } }, mounted () { }, diff --git a/src/pages/column/page/contactUs.vue b/src/pages/column/page/contactUs.vue index 042135f..53d4b02 100644 --- a/src/pages/column/page/contactUs.vue +++ b/src/pages/column/page/contactUs.vue @@ -59,7 +59,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.contactUs + modules: _.cloneDeep(Modules.contactUs) } }, mounted () { }, diff --git a/src/pages/column/page/devHistory.vue b/src/pages/column/page/devHistory.vue index ba1a763..109f515 100644 --- a/src/pages/column/page/devHistory.vue +++ b/src/pages/column/page/devHistory.vue @@ -51,7 +51,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.devHistory + modules: _.cloneDeep(Modules.devHistory) } }, mounted () { }, diff --git a/src/pages/column/page/deviceIntroBeam.vue b/src/pages/column/page/deviceIntroBeam.vue index f8a1804..c703b73 100644 --- a/src/pages/column/page/deviceIntroBeam.vue +++ b/src/pages/column/page/deviceIntroBeam.vue @@ -69,7 +69,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.deviceIntroBeam + modules: _.cloneDeep(Modules.deviceIntroBeam) } }, mounted () { }, diff --git a/src/pages/column/page/deviceIntroLayout.vue b/src/pages/column/page/deviceIntroLayout.vue index 8e9fd67..7f86f35 100644 --- a/src/pages/column/page/deviceIntroLayout.vue +++ b/src/pages/column/page/deviceIntroLayout.vue @@ -67,7 +67,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.deviceIntroLayout + modules: _.cloneDeep(Modules.deviceIntroLayout) } }, mounted () { }, diff --git a/src/pages/column/page/deviceIntroLinear.vue b/src/pages/column/page/deviceIntroLinear.vue index 40ffb8a..44c60f7 100644 --- a/src/pages/column/page/deviceIntroLinear.vue +++ b/src/pages/column/page/deviceIntroLinear.vue @@ -69,7 +69,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.deviceIntroLinear + modules: _.cloneDeep(Modules.deviceIntroLinear) } }, mounted () { }, diff --git a/src/pages/column/page/edu.vue b/src/pages/column/page/edu.vue index ec7a427..5f146ca 100644 --- a/src/pages/column/page/edu.vue +++ b/src/pages/column/page/edu.vue @@ -76,7 +76,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.edu + modules: _.cloneDeep(Modules.edu) } }, mounted () { }, diff --git a/src/pages/column/page/estate/event/index.vue b/src/pages/column/page/estate/event/index.vue index 4aaaa4b..60ea891 100644 --- a/src/pages/column/page/estate/event/index.vue +++ b/src/pages/column/page/estate/event/index.vue @@ -36,7 +36,8 @@
@@ -71,7 +72,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules['estate/event'], + modules: _.cloneDeep(Modules['estate/event']), active: 0, tabs: ['大事记'], curYear: 0 diff --git a/src/pages/column/page/estate/index/index.vue b/src/pages/column/page/estate/index/index.vue index af52c57..2c0b5b1 100644 --- a/src/pages/column/page/estate/index/index.vue +++ b/src/pages/column/page/estate/index/index.vue @@ -231,7 +231,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules['estate/index'] + modules: _.cloneDeep(Modules['estate/index']) } }, mounted () { }, diff --git a/src/pages/column/page/estate/location/index.vue b/src/pages/column/page/estate/location/index.vue index c14a152..a276419 100644 --- a/src/pages/column/page/estate/location/index.vue +++ b/src/pages/column/page/estate/location/index.vue @@ -73,7 +73,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules['estate/location'], + modules: _.cloneDeep(Modules['estate/location']), active: 0, tabs: ['地理位置'] } diff --git a/src/pages/column/page/estate/orgSetup/index.vue b/src/pages/column/page/estate/orgSetup/index.vue index a83ee00..90011c7 100644 --- a/src/pages/column/page/estate/orgSetup/index.vue +++ b/src/pages/column/page/estate/orgSetup/index.vue @@ -55,7 +55,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules['estate/orgSetup'], + modules: _.cloneDeep(Modules['estate/orgSetup']), active: 0, tabs: ['机构设置'] } diff --git a/src/pages/column/page/estate/survey/index.vue b/src/pages/column/page/estate/survey/index.vue index da1da1c..da2a7b2 100644 --- a/src/pages/column/page/estate/survey/index.vue +++ b/src/pages/column/page/estate/survey/index.vue @@ -54,7 +54,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules['estate/survey'], + modules: _.cloneDeep(Modules['estate/survey']), active: 0, tabs: ['产业光源概况'] } diff --git a/src/pages/column/page/exp.vue b/src/pages/column/page/exp.vue index ec9b342..6c9013e 100644 --- a/src/pages/column/page/exp.vue +++ b/src/pages/column/page/exp.vue @@ -85,7 +85,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.exp, + modules: _.cloneDeep(Modules.exp), Util } }, diff --git a/src/pages/column/page/governance.vue b/src/pages/column/page/governance.vue index bba4a65..7dcf96d 100644 --- a/src/pages/column/page/governance.vue +++ b/src/pages/column/page/governance.vue @@ -65,7 +65,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.governance, + modules: _.cloneDeep(Modules.governance), curYear: 0 } }, diff --git a/src/pages/column/page/home.vue b/src/pages/column/page/home.vue index 51b4b28..40804c8 100644 --- a/src/pages/column/page/home.vue +++ b/src/pages/column/page/home.vue @@ -212,7 +212,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.home + modules: _.cloneDeep(Modules.home) } }, mounted () { }, diff --git a/src/pages/column/page/iasf.vue b/src/pages/column/page/iasf.vue index 23d1694..656ec63 100644 --- a/src/pages/column/page/iasf.vue +++ b/src/pages/column/page/iasf.vue @@ -239,7 +239,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.iasf, + modules: _.cloneDeep(Modules.iasf), articles: [], articles1: [], articles2: [], diff --git a/src/pages/column/page/index.vue b/src/pages/column/page/index.vue index e69fe59..882284d 100644 --- a/src/pages/column/page/index.vue +++ b/src/pages/column/page/index.vue @@ -48,7 +48,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.index + modules: _.cloneDeep(Modules.index) } }, mounted () { }, diff --git a/src/pages/column/page/industrial.vue b/src/pages/column/page/industrial.vue index a9b13a0..adb49ce 100644 --- a/src/pages/column/page/industrial.vue +++ b/src/pages/column/page/industrial.vue @@ -162,7 +162,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.industrial + modules: _.cloneDeep(Modules.industrial) } }, mounted () { }, diff --git a/src/pages/column/page/lightSources.vue b/src/pages/column/page/lightSources.vue index f7368b3..709674c 100644 --- a/src/pages/column/page/lightSources.vue +++ b/src/pages/column/page/lightSources.vue @@ -131,7 +131,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.lightSources, + modules: _.cloneDeep(Modules.lightSources), active: 0, tabs: [ { diff --git a/src/pages/column/page/member.vue b/src/pages/column/page/member.vue index 8f29509..a53915f 100644 --- a/src/pages/column/page/member.vue +++ b/src/pages/column/page/member.vue @@ -57,7 +57,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.member, + modules: _.cloneDeep(Modules.member), } }, mounted () { }, diff --git a/src/pages/column/page/mission.vue b/src/pages/column/page/mission.vue index d58dba8..c3366cb 100644 --- a/src/pages/column/page/mission.vue +++ b/src/pages/column/page/mission.vue @@ -75,7 +75,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.mission + modules: _.cloneDeep(Modules.mission) } }, mounted () { }, diff --git a/src/pages/column/page/news.vue b/src/pages/column/page/news.vue index b48c119..8de869b 100644 --- a/src/pages/column/page/news.vue +++ b/src/pages/column/page/news.vue @@ -249,7 +249,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.news, + modules: _.cloneDeep(Modules.news), tabs: [ { id: 1, diff --git a/src/pages/column/page/newsPress.vue b/src/pages/column/page/newsPress.vue index 58e89be..45d1243 100644 --- a/src/pages/column/page/newsPress.vue +++ b/src/pages/column/page/newsPress.vue @@ -54,7 +54,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.newsPress + modules: _.cloneDeep(Modules.newsPress) } }, mounted () { }, diff --git a/src/pages/column/page/newsProcurement.vue b/src/pages/column/page/newsProcurement.vue index 0ea54a7..9880b9a 100644 --- a/src/pages/column/page/newsProcurement.vue +++ b/src/pages/column/page/newsProcurement.vue @@ -54,7 +54,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.newsProcurement + modules: _.cloneDeep(Modules.newsProcurement) } }, mounted () { }, diff --git a/src/pages/column/page/org.vue b/src/pages/column/page/org.vue index ad1083d..8a86126 100644 --- a/src/pages/column/page/org.vue +++ b/src/pages/column/page/org.vue @@ -48,7 +48,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.org + modules: _.cloneDeep(Modules.org) } }, mounted () { }, diff --git a/src/pages/column/page/overview.vue b/src/pages/column/page/overview.vue index 3df4174..e485d49 100644 --- a/src/pages/column/page/overview.vue +++ b/src/pages/column/page/overview.vue @@ -150,7 +150,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.overview + modules: _.cloneDeep(Modules.overview) } }, mounted () { }, diff --git a/src/pages/column/page/overviewDevHistory.vue b/src/pages/column/page/overviewDevHistory.vue index 5d28c4a..98415de 100644 --- a/src/pages/column/page/overviewDevHistory.vue +++ b/src/pages/column/page/overviewDevHistory.vue @@ -74,7 +74,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.overviewDevHistory, + modules: _.cloneDeep(Modules.overviewDevHistory), active: 0, tabs: ['发展历程'], curYear: 0 diff --git a/src/pages/column/page/overviewIntro.vue b/src/pages/column/page/overviewIntro.vue index 1324b55..8dcc24c 100644 --- a/src/pages/column/page/overviewIntro.vue +++ b/src/pages/column/page/overviewIntro.vue @@ -62,7 +62,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.overviewIntro, + modules: _.cloneDeep(Modules.overviewIntro), active: 0, tabs: ['S³FEL介绍'] } diff --git a/src/pages/column/page/overviewLocation.vue b/src/pages/column/page/overviewLocation.vue index 5fc188d..8748fdf 100644 --- a/src/pages/column/page/overviewLocation.vue +++ b/src/pages/column/page/overviewLocation.vue @@ -46,7 +46,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.overviewLocation, + modules: _.cloneDeep(Modules.overviewLocation), active: 0, tabs: ['地理位置'] } diff --git a/src/pages/column/page/overviewSetup.vue b/src/pages/column/page/overviewSetup.vue index 3cd0726..b33435c 100644 --- a/src/pages/column/page/overviewSetup.vue +++ b/src/pages/column/page/overviewSetup.vue @@ -54,7 +54,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.overviewSetup, + modules: _.cloneDeep(Modules.overviewSetup), active: 0, tabs: ['机构设置'] } diff --git a/src/pages/column/page/overviewTrailer.vue b/src/pages/column/page/overviewTrailer.vue index f4479a8..c17f1d2 100644 --- a/src/pages/column/page/overviewTrailer.vue +++ b/src/pages/column/page/overviewTrailer.vue @@ -50,7 +50,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.overviewTrailer, + modules: _.cloneDeep(Modules.overviewTrailer), active: 0, tabs: ['S³FEL宣传片'] } diff --git a/src/pages/column/page/research.vue b/src/pages/column/page/research.vue index 9586f07..3606757 100644 --- a/src/pages/column/page/research.vue +++ b/src/pages/column/page/research.vue @@ -93,7 +93,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.research + modules: _.cloneDeep(Modules.research) } }, mounted () { }, diff --git a/src/pages/column/page/researchNew.vue b/src/pages/column/page/researchNew.vue index b39eab9..77f3d20 100644 --- a/src/pages/column/page/researchNew.vue +++ b/src/pages/column/page/researchNew.vue @@ -73,7 +73,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.research + modules: _.cloneDeep(Modules.research) } }, mounted () { }, diff --git a/src/pages/column/page/researchTeam.vue b/src/pages/column/page/researchTeam.vue index 914b786..dca901a 100644 --- a/src/pages/column/page/researchTeam.vue +++ b/src/pages/column/page/researchTeam.vue @@ -59,7 +59,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.researchTeam, + modules: _.cloneDeep(Modules.researchTeam), title: '' } }, diff --git a/src/pages/column/page/science.vue b/src/pages/column/page/science.vue index 906b62b..057836c 100644 --- a/src/pages/column/page/science.vue +++ b/src/pages/column/page/science.vue @@ -63,7 +63,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.science + modules: _.cloneDeep(Modules.science) } }, mounted () { }, diff --git a/src/pages/column/page/scientific.vue b/src/pages/column/page/scientific.vue index 2cf553b..e7f085d 100644 --- a/src/pages/column/page/scientific.vue +++ b/src/pages/column/page/scientific.vue @@ -70,7 +70,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.scientific + modules: _.cloneDeep(Modules.scientific) } }, mounted () { }, diff --git a/src/pages/column/page/sfel.vue b/src/pages/column/page/sfel.vue index c4e944f..1733dce 100644 --- a/src/pages/column/page/sfel.vue +++ b/src/pages/column/page/sfel.vue @@ -362,7 +362,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.sfel + modules: _.cloneDeep(Modules.sfel) } }, mounted () { }, diff --git a/src/pages/column/page/sfelNew.vue b/src/pages/column/page/sfelNew.vue index 49252da..d0af3a7 100644 --- a/src/pages/column/page/sfelNew.vue +++ b/src/pages/column/page/sfelNew.vue @@ -241,7 +241,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.sfel + modules: _.cloneDeep(Modules.sfel) } }, mounted () { }, diff --git a/src/pages/column/page/shop.vue b/src/pages/column/page/shop.vue index 7bab520..479bc2f 100644 --- a/src/pages/column/page/shop.vue +++ b/src/pages/column/page/shop.vue @@ -67,7 +67,7 @@ export default { data () { return { isImg: Util.isImg, - modules: Modules.shop + modules: _.cloneDeep(Modules.shop) } }, mounted () { }, diff --git a/src/pages/column/page/singlePage.vue b/src/pages/column/page/singlePage.vue index 00ac2a0..298b0be 100644 --- a/src/pages/column/page/singlePage.vue +++ b/src/pages/column/page/singlePage.vue @@ -125,7 +125,7 @@ export default { data () { return { isImg: Util.isImg, - modules: Modules.singlePage, + modules: _.cloneDeep(Modules.singlePage), articles: [], articles1: [], } diff --git a/src/pages/column/page/speech.vue b/src/pages/column/page/speech.vue index 9a0858a..bc68d88 100644 --- a/src/pages/column/page/speech.vue +++ b/src/pages/column/page/speech.vue @@ -51,7 +51,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.speech + modules: _.cloneDeep(Modules.speech) } }, mounted () { }, diff --git a/src/pages/column/page/talent.vue b/src/pages/column/page/talent.vue index 8d78563..52f2a23 100644 --- a/src/pages/column/page/talent.vue +++ b/src/pages/column/page/talent.vue @@ -101,7 +101,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.talent + modules: _.cloneDeep(Modules.talent) } }, mounted () { }, diff --git a/src/pages/column/page/talentCenter.vue b/src/pages/column/page/talentCenter.vue index c51bb38..ff65ade 100644 --- a/src/pages/column/page/talentCenter.vue +++ b/src/pages/column/page/talentCenter.vue @@ -105,7 +105,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.talentCenter + modules: _.cloneDeep(Modules.talentCenter) } }, mounted () { }, diff --git a/src/pages/column/page/talentCentre.vue b/src/pages/column/page/talentCentre.vue index 505f871..bd73dc2 100644 --- a/src/pages/column/page/talentCentre.vue +++ b/src/pages/column/page/talentCentre.vue @@ -85,7 +85,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.talentCentre, + modules: _.cloneDeep(Modules.talentCentre), defaultProps: { value: 'id', label: 'title' diff --git a/src/pages/column/page/team.vue b/src/pages/column/page/team.vue index 1adf89b..b89f1d8 100644 --- a/src/pages/column/page/team.vue +++ b/src/pages/column/page/team.vue @@ -50,7 +50,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.team + modules: _.cloneDeep(Modules.team) } }, mounted () { }, diff --git a/src/pages/column/page/userSharing.vue b/src/pages/column/page/userSharing.vue index 65eea0e..2aef17b 100644 --- a/src/pages/column/page/userSharing.vue +++ b/src/pages/column/page/userSharing.vue @@ -73,7 +73,7 @@ export default { mixins: [mixins], data () { return { - modules: Modules.userSharing + modules: _.cloneDeep(Modules.userSharing) } }, mounted () { }, diff --git a/src/plugins/requests/index.js b/src/plugins/requests/index.js index ddc36cc..b151708 100644 --- a/src/plugins/requests/index.js +++ b/src/plugins/requests/index.js @@ -1,7 +1,7 @@ import axios from 'axios' import Util from '@/libs/util' import Setting from '@/setting' -import store from '@/store' +import Store from '@/store' import Router from '@/router' 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.interceptors.request.use(config => { - let token = Util.local.get(Setting.tokenKey); - if (token) config.headers.token = token + let token = Util.local.get(Setting.tokenKey) + if (token) { + config.headers.token = token + Store.state.user.userId || Store.dispatch('user/logout') + } return config; }, err => { Util.errorMsg({ - message: "退出登陆", + message: '退出登陆', onClose: function () { - store.dispatch('user/logout') + Store.dispatch('user/logout') } }); return Promise.reject(err); @@ -37,7 +40,7 @@ service.interceptors.response.use( } else if (code === 401) { Util.errorMsg(res.msg) setTimeout(() => { - store.dispatch('user/logout') + Store.dispatch('user/logout') }, 1000) return Promise.reject(res) } else if (code == 300) { @@ -61,14 +64,14 @@ service.interceptors.response.use( case 401: Util.errorMsg("登录过期,请重新登录") setTimeout(() => { - store.dispatch('user/logout') + Store.dispatch('user/logout') }, 1000) break // 403 token过期 case 403: Util.errorMsg("登录过期,请重新登录") setTimeout(() => { - store.dispatch('user/logout') + Store.dispatch('user/logout') }, 1000) break // 其他错误,直接抛出错误提示 diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a6000c1..57bae9e 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,40 +1,39 @@ import Setting from '@/setting' import util from '@/libs/util' -import addRoutes from '@/libs/route/addRoutes' /** * 用户信息 * */ export default { - namespaced: true, - state: { - avatar: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png", - userId: '', - userName: '', - crumbs: '' + namespaced: true, + state: { + avatar: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png", + userId: '', + userName: '', + crumbs: '' + }, + mutations: { + setAvatar: (state, avatar) => { + state.avatar = avatar }, - mutations: { - setAvatar: (state, avatar) => { - state.avatar = avatar - }, - setUserId: (state, userId) => { - state.userId = userId - }, - setUserName: (state, userName) => { - state.userName = userName - }, - setCrumbs: (state, crumbs) => { - state.crumbs = crumbs - } + setUserId: (state, userId) => { + state.userId = userId }, - actions: { - logout({ commit, state, dispatch }) { - return new Promise((resolve, reject) => { - util.local.remove(Setting.storeKey) - util.local.remove(Setting.tokenKey) - location.reload() - resolve() - }) - } + setUserName: (state, userName) => { + state.userName = userName + }, + setCrumbs: (state, crumbs) => { + state.crumbs = crumbs + } + }, + actions: { + logout ({ commit, state, dispatch }) { + return new Promise((resolve, reject) => { + util.local.remove(Setting.storeKey) + util.local.remove(Setting.tokenKey) + location.reload() + resolve() + }) } + } }; \ No newline at end of file