From 0d452dcd3e740bba9043431f63dbdc7ac5e855f2 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 9 Dec 2022 16:43:28 +0800 Subject: [PATCH] fix --- src/api/index.js | 2 +- src/const/modules.js | 130 +++++++++++----------- src/mixins/page/index.js | 48 +++++++- src/pages/article/add/index.vue | 58 ++++++++-- src/pages/article/list/index.vue | 2 +- src/pages/column/add/index.vue | 2 +- src/pages/column/list/index.vue | 2 +- src/pages/column/page/about.vue | 2 +- src/pages/column/page/application.vue | 14 +-- src/pages/column/page/careers.vue | 2 +- src/pages/column/page/edu.vue | 2 +- src/pages/column/page/home.vue | 14 +-- src/pages/column/page/news.vue | 32 +++--- src/pages/column/page/newsPress.vue | 2 +- src/pages/column/page/newsProcurement.vue | 2 +- src/pages/column/page/research.vue | 2 +- src/setting.js | 2 +- 17 files changed, 195 insertions(+), 123 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 759df7b..1c0eec9 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -17,7 +17,7 @@ export default { sendPhoneOrEmailCode: `iasf/sys/sendPhoneOrEmailCode`, updatePhoneOrEmail: `iasf/sys/updatePhoneOrEmail`, updateUserAvatars: `${host}iasf/sys/updateUserAvatars`, - staffTemplate: `https://31k70639y6.zicp.fun/用户导入模板.xlsx`, + staffTemplate: `http://192.168.31.136/用户导入模板.xlsx`, checkJobNumber: `iasf/sys/checkJobNumber`, checkUsername: `iasf/sys/checkUsername`, resetPwd: `iasf/sys/resetPwd`, diff --git a/src/const/modules.js b/src/const/modules.js index 8789fb8..67ff9f2 100644 --- a/src/const/modules.js +++ b/src/const/modules.js @@ -43,7 +43,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/about/1.png', + pic: 'http://192.168.31.136/images/about/1.png', title: 'ABOUT', link: { linkName: '无', @@ -92,7 +92,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/about/2.png', + pic: 'http://192.168.31.136/images/about/2.png', title: 'Our History', subTitle: 'Throughout the world, most of the top science and technology innovation centers are distributed', link: { @@ -446,7 +446,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/about/5.png', + pic: 'http://192.168.31.136/images/about/5.png', title: 'Strategic Plan', link: { linkName: '无', @@ -533,7 +533,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/about/6.png', + pic: 'http://192.168.31.136/images/about/6.png', title: 'Sun Dongbai', subTitle: 'Founder and 1st PRESIDENT OF THE INSTITUTE OF ADVANCED SCIENCE FACILITIES, SHENZHEN', link: { @@ -551,7 +551,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/about/7.png', + pic: 'http://192.168.31.136/images/about/7.png', title: 'Yang Xueming', subTitle: 'Vice President of the Institute of Advanced Scienc, Shenzhen', link: { @@ -569,7 +569,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/about/8.png', + pic: 'http://192.168.31.136/images/about/8.png', title: 'Ulf KALSSON', subTitle: 'The Chairman of Science and Technology Advisory Committee', link: { @@ -635,7 +635,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/about/9.png', + pic: 'http://192.168.31.136/images/about/9.png', title: 'Science and Technology', subTitle: '', link: { @@ -679,7 +679,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/about/10.png', + pic: 'http://192.168.31.136/images/about/10.png', title: 'User Committee', subTitle: '', link: { @@ -723,7 +723,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/about/11.png', + pic: 'http://192.168.31.136/images/about/11.png', title: 'Industry Advancement Committee', subTitle: '', link: { @@ -787,7 +787,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/about/12.png', + pic: 'http://192.168.31.136/images/about/12.png', title: 'Throughout the world, most of the top science and technology innovation centers are distributed', subTitle: '', link: { @@ -845,7 +845,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/careers/1.png', + pic: 'http://192.168.31.136/images/careers/1.png', title: 'CAREERS', link: { linkName: '无', @@ -889,7 +889,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/careers/2.png', + pic: 'http://192.168.31.136/images/careers/2.png', title: 'Research', link: { linkName: '无', @@ -932,7 +932,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/careers/3.png', + pic: 'http://192.168.31.136/images/careers/3.png', title: 'Engineering', link: { linkName: '无', @@ -975,7 +975,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/careers/4.png', + pic: 'http://192.168.31.136/images/careers/4.png', title: 'Management Staff', link: { linkName: '无', @@ -1018,7 +1018,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/careers/5.png', + pic: 'http://192.168.31.136/images/careers/5.png', title: 'Post-doc Programs', link: { linkName: '无', @@ -1098,7 +1098,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/careers/6.png', + pic: 'http://192.168.31.136/images/careers/6.png', title: 'IASF started its journey to chase light, push the boundaries forward, and discover the unknown.', link: { linkName: '无', @@ -1115,7 +1115,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/careers/7.png', + pic: 'http://192.168.31.136/images/careers/7.png', title: 'IASF started its journey to chase light, push the boundaries forward, and discover the unknown.', link: { linkName: '无', @@ -1132,7 +1132,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/careers/8.png', + pic: 'http://192.168.31.136/images/careers/8.png', title: 'IASF started its journey to chase light, push the boundaries forward, and discover the unknown.', link: { linkName: '无', @@ -1200,7 +1200,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/careers/9.png', + pic: 'http://192.168.31.136/images/careers/9.png', title: 'Benefits', subTitle: 'YOU ARE IN GOOD HANDS', link: { @@ -1218,7 +1218,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/careers/10.png', + pic: 'http://192.168.31.136/images/careers/10.png', title: 'Traineeships', subTitle: 'YOUR FUTURE STARTS HERE', link: { @@ -1236,7 +1236,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/careers/11.png', + pic: 'http://192.168.31.136/images/careers/11.png', title: 'Programs', subTitle: 'YOUR INSPIRATION HAS GREAT SUPPORTS', link: { @@ -1296,7 +1296,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/edu/1.png', + pic: 'http://192.168.31.136/images/edu/1.png', title: 'EDUCATION & COLLABORATION', link: { linkName: '无', @@ -1340,7 +1340,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/edu/2.png', + pic: 'http://192.168.31.136/images/edu/2.png', title: 'Partnership', link: { linkName: '无', @@ -1383,7 +1383,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/edu/2.png', + pic: 'http://192.168.31.136/images/edu/2.png', title: 'Programs', link: { linkName: '无', @@ -1469,7 +1469,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/edu/3.png', + pic: 'http://192.168.31.136/images/edu/3.png', title: 'community service', subTitle: 'IASF is driven to serve the Science and industry, and solve grand challenges.', link: { @@ -1487,7 +1487,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/edu/4.png', + pic: 'http://192.168.31.136/images/edu/4.png', title: 'community service', subTitle: 'IASF is driven to serve the Science and industry, and solve grand challenges.', link: { @@ -1505,7 +1505,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/edu/5.png', + pic: 'http://192.168.31.136/images/edu/5.png', title: 'community service', subTitle: 'IASF is driven to serve the Science and industry, and solve grand challenges.', link: { @@ -1565,7 +1565,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/home/1.png', + pic: 'http://192.168.31.136/images/home/1.png', title: 'HOME', link: { linkName: '无', @@ -1629,7 +1629,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/home/2.png', + pic: 'http://192.168.31.136/images/home/2.png', title: 'Shenzhen Innovation Lightsource Facility', link: { linkName: '无', @@ -1672,7 +1672,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/home/3.png', + pic: 'http://192.168.31.136/images/home/3.png', title: 'Shenzhen Soft X-ray Superconducting Free-electron Laser Facility ', link: { linkName: '无', @@ -1788,7 +1788,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/careers/6.png', + pic: 'http://192.168.31.136/images/careers/6.png', title: 'SHAO Jiahang, PH.D.', subTitle: '', link: { @@ -1806,7 +1806,7 @@ export default { des: '“..., The new facility (S3FEL) will provide the brightest soft X-ray laser to both scientific and industrial users worldwide, enabling applications that are beyond imagination, ...”…' }, { - pic: 'https://31k70639y6.zicp.fun/images/careers/7.png', + pic: 'http://192.168.31.136/images/careers/7.png', title: 'PENG Ziling, Ph.D.', subTitle: '', link: { @@ -1824,7 +1824,7 @@ export default { des: '“..., With so many young, professional, and passionate workmates, I treasure the moments we spent on fruitful discussions, brainstorming, teamworking, and the leisure activities on the Guangming farm just next to our worksite, ...”…' }, { - pic: 'https://31k70639y6.zicp.fun/images/careers/8.png', + pic: 'http://192.168.31.136/images/careers/8.png', title: 'CHEN Rikun, M.S.', subTitle: '', link: { @@ -2061,7 +2061,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/news/1.png', + pic: 'http://192.168.31.136/images/news/1.png', title: 'NEWS & EVENTS', link: { linkName: '无', @@ -2241,7 +2241,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/news/1.png', + pic: 'http://192.168.31.136/images/news/1.png', title: 'NEWS & EVENTS', link: { linkName: '无', @@ -2308,7 +2308,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/newsPress/1.png', + pic: 'http://192.168.31.136/images/newsPress/1.png', title: 'Reports', subTitle: 'IASF is driven to serve the Science and industry, and solve grand challenges.', link: { @@ -2326,7 +2326,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/newsPress/2.png', + pic: 'http://192.168.31.136/images/newsPress/2.png', title: 'Brochures', subTitle: 'IASF is driven to serve the Science and industry, and solve grand challenges.', link: { @@ -2344,7 +2344,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/newsPress/3.png', + pic: 'http://192.168.31.136/images/newsPress/3.png', title: 'Gallery', subTitle: 'IASF is driven to serve the Science and industry, and solve grand challenges.', link: { @@ -2404,7 +2404,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/news/1.png', + pic: 'http://192.168.31.136/images/news/1.png', title: 'NEWS & EVENTS', link: { linkName: '无', @@ -2471,7 +2471,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/newsProcurement/1.png', + pic: 'http://192.168.31.136/images/newsProcurement/1.png', title: 'Project ', subTitle: 'IASF is driven to serve the Science and industry, and solve grand challenges.', link: { @@ -2489,7 +2489,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/newsProcurement/2.png', + pic: 'http://192.168.31.136/images/newsProcurement/2.png', title: 'Goods', subTitle: 'IASF is driven to serve the Science and industry, and solve grand challenges.', link: { @@ -2507,7 +2507,7 @@ export default { isEnable: 1 }, { - pic: 'https://31k70639y6.zicp.fun/images/newsProcurement/3.png', + pic: 'http://192.168.31.136/images/newsProcurement/3.png', title: 'Service', subTitle: 'IASF is driven to serve the Science and industry, and solve grand challenges.', link: { @@ -2567,7 +2567,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/research/1.png', + pic: 'http://192.168.31.136/images/research/1.png', title: 'RESEARCH', link: { linkName: '无', @@ -2648,7 +2648,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/research/res1.png', + pic: 'http://192.168.31.136/images/research/res1.png', title: 'Physics', link: { linkName: '无', @@ -2664,7 +2664,7 @@ export default { des: 'Research Field Description', }, { - pic: 'https://31k70639y6.zicp.fun/images/research/res2.png', + pic: 'http://192.168.31.136/images/research/res2.png', title: 'Chemistry', link: { linkName: '无', @@ -2680,7 +2680,7 @@ export default { des: 'Research Field Description', }, { - pic: 'https://31k70639y6.zicp.fun/images/research/res3.png', + pic: 'http://192.168.31.136/images/research/res3.png', title: 'Biology', link: { linkName: '无', @@ -2696,7 +2696,7 @@ export default { des: 'Research Field Description', }, { - pic: 'https://31k70639y6.zicp.fun/images/research/res4.png', + pic: 'http://192.168.31.136/images/research/res4.png', title: 'Advanced Materials ', link: { linkName: '无', @@ -2712,7 +2712,7 @@ export default { des: 'Research Field Description', }, { - pic: 'https://31k70639y6.zicp.fun/images/research/res5.png', + pic: 'http://192.168.31.136/images/research/res5.png', title: 'Advanced Manufacturing', link: { linkName: '无', @@ -2787,7 +2787,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/research/3.png', + pic: 'http://192.168.31.136/images/research/3.png', title: 'Accelerator', link: { linkName: '无', @@ -2802,7 +2802,7 @@ export default { } }, { - pic: 'https://31k70639y6.zicp.fun/images/research/4.png', + pic: 'http://192.168.31.136/images/research/4.png', title: 'Physics', link: { linkName: '无', @@ -2817,7 +2817,7 @@ export default { } }, { - pic: 'https://31k70639y6.zicp.fun/images/research/5.png', + pic: 'http://192.168.31.136/images/research/5.png', title: 'Mechanical Engineering', link: { linkName: '无', @@ -2832,7 +2832,7 @@ export default { } }, { - pic: 'https://31k70639y6.zicp.fun/images/research/6.png', + pic: 'http://192.168.31.136/images/research/6.png', title: 'Digital Light-source', link: { linkName: '无', @@ -2847,7 +2847,7 @@ export default { } }, { - pic: 'https://31k70639y6.zicp.fun/images/research/7.png', + pic: 'http://192.168.31.136/images/research/7.png', title: 'Beam Lines', link: { linkName: '无', @@ -2862,7 +2862,7 @@ export default { } }, { - pic: 'https://31k70639y6.zicp.fun/images/research/8.png', + pic: 'http://192.168.31.136/images/research/8.png', title: 'End Stations', link: { linkName: '无', @@ -2943,7 +2943,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/research/12.png', + pic: 'http://192.168.31.136/images/research/12.png', title: '这里是标题一句话标题', link: { linkName: '无', @@ -2959,7 +2959,7 @@ export default { des: 'Online single-shot characterization of ultrafast pulses from high-gain free-electron lasers, Li Zeng,Chao Feng,Duan Gu,Xiaofan Wang,Kaiqing Zhang,Bo Liu,Zhentang Zhao,Fundamental Research', }, { - pic: 'https://31k70639y6.zicp.fun/images/research/13.png', + pic: 'http://192.168.31.136/images/research/13.png', title: '这里是标题一句话标题', link: { linkName: '无', @@ -2979,7 +2979,7 @@ export default { `, }, { - pic: 'https://31k70639y6.zicp.fun/images/research/14.png', + pic: 'http://192.168.31.136/images/research/14.png', title: '这里是标题一句话标题', link: { linkName: '无', @@ -3039,7 +3039,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/application/1.png', + pic: 'http://192.168.31.136/images/application/1.png', title: 'APPLICATION', link: { linkName: '无', @@ -3088,7 +3088,7 @@ export default { } ], form: { - pic: 'https://31k70639y6.zicp.fun/images/research/2.png', + pic: 'http://192.168.31.136/images/research/2.png', title: 'Why IASF?', subTitle: `IASF started its journey to chase light, The one that can drive innovation, @@ -3357,7 +3357,7 @@ export default { }, list: [ { - pic: 'https://31k70639y6.zicp.fun/images/research/3.png', + pic: 'http://192.168.31.136/images/application/3.png', title: 'Accelerator', link: { linkName: '无', @@ -3372,7 +3372,7 @@ export default { } }, { - pic: 'https://31k70639y6.zicp.fun/images/research/4.png', + pic: 'http://192.168.31.136/images/application/4.png', title: 'Physics', link: { linkName: '无', @@ -3387,7 +3387,7 @@ export default { } }, { - pic: 'https://31k70639y6.zicp.fun/images/research/5.png', + pic: 'http://192.168.31.136/images/application/5.png', title: 'Mechanical Engineering', link: { linkName: '无', @@ -3402,7 +3402,7 @@ export default { } }, { - pic: 'https://31k70639y6.zicp.fun/images/research/6.png', + pic: 'http://192.168.31.136/images/application/6.png', title: 'Digital Light-source', link: { linkName: '无', @@ -3417,7 +3417,7 @@ export default { } }, { - pic: 'https://31k70639y6.zicp.fun/images/research/7.png', + pic: 'http://192.168.31.136/images/application/7.png', title: 'Beam Lines', link: { linkName: '无', @@ -3432,7 +3432,7 @@ export default { } }, { - pic: 'https://31k70639y6.zicp.fun/images/research/8.png', + pic: 'http://192.168.31.136/images/application/8.png', title: 'End Stations', link: { linkName: '无', diff --git a/src/mixins/page/index.js b/src/mixins/page/index.js index 4be74ad..e9d1bee 100644 --- a/src/mixins/page/index.js +++ b/src/mixins/page/index.js @@ -1,7 +1,6 @@ import Module from '@/components/modules/module' import Setting from '@/setting' import Util from '@/libs/util' -import ColumnConst from '@/const/column' import { Loading } from 'element-ui' export default { data() { @@ -10,15 +9,33 @@ export default { site: this.$store.state.content.site, columnId: +this.$route.query.id, id: '', + originModules: [], diaVisible: false, curModule: 0, curListIndex: 0, curData: {}, + pass: false, } }, components: { Module, }, + // 页面离开的时候如果没有保存则提示 + beforeRouteLeave(to, from, next) { + // 更改了信息才需要提示 + if (!this.pass && this.originModules !== JSON.stringify(this.modules)) { + this.$confirm(`所填写内容暂未保存,是否保存?`, '提示', { + type: 'warning' + }).then(() => { + this.save(1, 1) + next() + }).catch(() => { + next() + }) + } else { + next() + } + }, mounted() { this.getInfo() }, @@ -49,7 +66,9 @@ export default { if (data.length) { const json = data[0] this.id = json.id - this.modules = JSON.parse(json[json.state ? 'theEditedJson' : 'jsonBeforeEditing']) + const str = json[json.state ? 'theEditedJson' : 'jsonBeforeEditing'] + this.originModules = str // 原始json,用以页面离开的时候判断是否需要提示保存 + this.modules = JSON.parse(str) console.log("🚀 ~ file: index.js ~ line 53 ~ this.$post ~ this.modules", this.modules) } }).catch(err => {}) @@ -101,13 +120,13 @@ export default { json: this.handleJson() }).then(res => { load.close() - window.open((Setting.isDev ? `http://${location.hostname}:8095` : 'https://31k70639y6.zicp.fun/front') + `/#/${this.$route.query.path}?id=${this.columnId}&preview=1&siteId=${this.$route.query.siteId}`) + window.open((Setting.isDev ? `http://${location.hostname}:8095` : 'http://192.168.31.136/front') + `/#/${this.$route.query.path}?id=${this.columnId}&preview=1&siteId=${this.$route.query.siteId}`) }).catch(err => { load.close() }) }, // 保存 - save(state) { + save(state, leave) { const json = this.handleJson() const data = { id: this.id, @@ -120,9 +139,26 @@ export default { } if (state) data.theEditedJson = json this.$post(this.api[this.id ? 'updatePage' : 'savePage'], data).then(res => { + this.originModules = json Util.successMsg((state ? '发布' : '保存') + '成功') - this.$router.back() + leave || this.$router.back() }).catch(err => {}) - } + }, + // 返回 + back() { + this.pass = true + // 更改了信息才需要提示 + if (this.originModules !== JSON.stringify(this.modules)) { + this.$confirm(`所填写内容暂未保存,是否保存?`, '提示', { + type: 'warning' + }).then(() => { + this.save(1) + }).catch(() => { + this.$router.back() + }) + } else { + this.$router.back() + } + }, } }; \ No newline at end of file diff --git a/src/pages/article/add/index.vue b/src/pages/article/add/index.vue index 6b967ba..992d523 100644 --- a/src/pages/article/add/index.vue +++ b/src/pages/article/add/index.vue @@ -174,7 +174,7 @@