From 43d2dcd40e47e435f24982f3490a68d50c7c1c67 Mon Sep 17 00:00:00 2001 From: aBin Date: Tue, 22 Feb 2022 18:17:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=AB=99=E7=BB=86=E8=8A=82=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BayWindow/BayWindow.vue | 8 +- src/components/Carousel/Carousel.vue | 17 ++- src/components/Footer/Footer.vue | 12 +- src/components/HeadNav/HeadNav.vue | 24 +++- src/components/LeftNav/LeftNav.vue | 24 +++- src/components/LeftNav/title-bg.png | Bin 0 -> 22198 bytes src/components/ListPage/ListPage.vue | 65 +++++++---- src/components/Location/Location.vue | 44 +++++++- src/components/RichText/Relevant.vue | 38 +++++++ src/components/RichText/RichText.vue | 6 +- src/config/api.js | 10 +- src/router/index.js | 12 ++ src/store/modules/home/actions.js | 15 ++- src/views/FirstPages/FirstPage.vue | 47 +++++--- src/views/NewPages/NewPages.vue | 52 +++++++-- src/views/OtherPages/Department.vue | 15 ++- src/views/OtherPages/Information.vue | 15 ++- src/views/OtherPages/NoticeNotice.vue | 24 ++-- src/views/OtherPages/PartyBuilding.vue | 24 ++-- src/views/OtherPages/PilePages.vue | 133 ++++++++++++++++++++++ src/views/OtherPages/SafeProduction.vue | 24 ++-- src/views/OtherPages/Search.vue | 141 ++++++++++++++++++++++++ src/views/OtherPages/System.vue | 15 ++- 23 files changed, 656 insertions(+), 109 deletions(-) create mode 100644 src/components/LeftNav/title-bg.png create mode 100644 src/components/RichText/Relevant.vue create mode 100644 src/views/OtherPages/PilePages.vue create mode 100644 src/views/OtherPages/Search.vue diff --git a/src/components/BayWindow/BayWindow.vue b/src/components/BayWindow/BayWindow.vue index d45477f..6ba6b1c 100644 --- a/src/components/BayWindow/BayWindow.vue +++ b/src/components/BayWindow/BayWindow.vue @@ -2,7 +2,7 @@
-
+
{{ item }}
@@ -84,6 +84,12 @@ export default { close() { this.$emit('closeBay'); }, + openPage() { + this.$router.push({ + path: '/notice', + query: { code: '0505' }, + }); + }, }, }; diff --git a/src/components/Carousel/Carousel.vue b/src/components/Carousel/Carousel.vue index fe98118..e7af86a 100644 --- a/src/components/Carousel/Carousel.vue +++ b/src/components/Carousel/Carousel.vue @@ -2,7 +2,7 @@
- +
@@ -26,15 +26,28 @@ export default { return { imgList: [], str: '', + code: '0000', }; }, + watch: { + '$route.query.code'(val) { + console.log('val: ', val); + if (val) { + this.code = val; + } else { + this.code = '0000'; + } + this.getImg(); + }, + }, created() { + this.code = this.$route.query.code || '0000'; this.getImg(); }, methods: { async getImg() { try { - const params = { param: { showPage: '0000' } }; + const params = { param: { showPage: this.code } }; const res = await carouselQuery(params); const { data, code, msg } = res.data; this.imgList = [...data]; diff --git a/src/components/Footer/Footer.vue b/src/components/Footer/Footer.vue index a6bed02..99bf767 100644 --- a/src/components/Footer/Footer.vue +++ b/src/components/Footer/Footer.vue @@ -11,7 +11,7 @@
@@ -79,7 +79,6 @@ export default { async getData() { try { const res = await getLink(); - console.log(res.data.data); const { code, msg, data } = res.data; if (code === 200) { const obj = { @@ -93,6 +92,13 @@ export default { openPage(url) { window.open(url); }, + jumpPage(url, code) { + // this.$router.push({ + // path: url, + // query: { code }, + // }); + window.open(`http://${window.location.host}/${url}?code=${code}`); + }, }, }; diff --git a/src/components/HeadNav/HeadNav.vue b/src/components/HeadNav/HeadNav.vue index 51a9b70..7fdfdfd 100644 --- a/src/components/HeadNav/HeadNav.vue +++ b/src/components/HeadNav/HeadNav.vue @@ -396,6 +396,19 @@ export default { showPage: 0, }; }, + watch: { + '$route.path'(val) { + for (let i = 0; i < this.tabList.length; i++) { + const item = this.tabList[i]; + if (val === item.url) { + this.showPage = i; + return; + } else { + this.showPage = 99; + } + } + }, + }, created() { setTimeout(() => { for (let i = 0; i < this.tabList.length; i++) { @@ -406,8 +419,8 @@ export default { }, 100); }, methods: { - onSearch() { - console.log('点击了搜索按钮,但是没有搜索事件'); + onSearch(e) { + window.open(`http://${window.location.host}/search?text=${e}`); }, jumpPage(index, url, children) { if (this.showPage === index) { @@ -507,13 +520,16 @@ export default { color: #cc2626; } /deep/.ant-input-affix-wrapper:hover .ant-input:not(.ant-input-disabled) { - border-color: #d9d9d9; + border-color: #ae0002; border-right-width: 1px !important; } /deep/.ant-input:focus { - border-color: #d9d9d9; + border-color: #ae0002; border-right-width: 1px !important; outline: 0; box-shadow: 0 0 0 2px rgb(217 217 217 /20%); } +/* /deep/.ant-input { + border-color: #ae0002; +} */ diff --git a/src/components/LeftNav/LeftNav.vue b/src/components/LeftNav/LeftNav.vue index 3f31fb3..a5f3321 100644 --- a/src/components/LeftNav/LeftNav.vue +++ b/src/components/LeftNav/LeftNav.vue @@ -1,6 +1,6 @@ @@ -350,6 +355,20 @@ export default { }, ], }, + { + title: '首页专题', + url: '/pile', + children: [ + { + title: '光荣榜', + code: '9902', + }, + { + title: '今天我出镜', + code: '9903', + }, + ], + }, ], titleName: '', titleTwo: '', @@ -380,7 +399,26 @@ export default { } }, backFirst() { - // this.$router.push('/'); + this.$router.push('/'); + }, + backTitle() { + for (let i = 0; i < this.tabList.length; i++) { + const item = this.tabList[i]; + if (item.children && item.children.length) { + for (let k = 0; k < item.children.length; k++) { + const itemC = item.children[k]; + if (this.title === itemC.title && k !== 0) { + this.$router.push({ + path: this.tabList[i].url, + query: { + code: item.children[0].code, + }, + }); + return; + } + } + } + } }, }, }; diff --git a/src/components/RichText/Relevant.vue b/src/components/RichText/Relevant.vue new file mode 100644 index 0000000..13ab6ab --- /dev/null +++ b/src/components/RichText/Relevant.vue @@ -0,0 +1,38 @@ + + + diff --git a/src/components/RichText/RichText.vue b/src/components/RichText/RichText.vue index 3dc95f7..da0330e 100644 --- a/src/components/RichText/RichText.vue +++ b/src/components/RichText/RichText.vue @@ -3,9 +3,9 @@
diff --git a/src/config/api.js b/src/config/api.js index adba23a..ad87fa0 100644 --- a/src/config/api.js +++ b/src/config/api.js @@ -15,9 +15,13 @@ export const carouselQuery = params => axios.post(`${carousel}/query`, params); // 官网首页列表查询 export const getContent = params => axios.get( - `${content}/list?showPage=${params.showPage}& - year=${params.year}&showType=${params.showType}& - pageNum=${params.pageNum}&pageSize=${params.pageSize}`, + `${content}/list?showPage=${params.showPage}&year=${params.year}&showType=${params.showType}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`, + ); + +// 查询图片新闻列表 +export const getContentImg = params => + axios.get( + `${content}/list?showPage=0201&showPage=0202&showPage=0203&year=${params.year}&showType=${params.showType}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`, ); // 官网内容详情查询 diff --git a/src/router/index.js b/src/router/index.js index 338a784..4b83fc7 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -60,6 +60,18 @@ const routes = [ name: 'Department', component: () => import('@/views/OtherPages/Department.vue'), }, + // 首页其它 + { + path: '/pile', + name: 'PilePages', + component: () => import('@/views/OtherPages/PilePages.vue'), + }, + // 搜索界面 + { + path: '/search', + name: 'Search', + component: () => import('@/views/OtherPages/Search.vue'), + }, // // 关于我们界面 // { // path: '/About/Introduce', diff --git a/src/store/modules/home/actions.js b/src/store/modules/home/actions.js index fd987f9..b663196 100644 --- a/src/store/modules/home/actions.js +++ b/src/store/modules/home/actions.js @@ -1,6 +1,6 @@ import axios from 'axios'; import { message } from 'ant-design-vue'; -import { getContent, getDetail } from 'config/api'; +import { getContent, getDetail, getContentImg } from 'config/api'; const actions = { /** @@ -22,6 +22,19 @@ const actions = { message.error('提交失败'); } }, + async getContentImg({ commit, rootState }, param) { + try { + const res = await getContentImg(param); + const { data, code, msg } = res.data; + if (code === 200) { + return data; + } else { + message.error(msg); + } + } catch (error) { + message.error('提交失败'); + } + }, /** * 官网内容详情查询 * @param {any} commit diff --git a/src/views/FirstPages/FirstPage.vue b/src/views/FirstPages/FirstPage.vue index d5a2671..e33e1b4 100644 --- a/src/views/FirstPages/FirstPage.vue +++ b/src/views/FirstPages/FirstPage.vue @@ -62,6 +62,7 @@
+

@@ -147,20 +148,20 @@

-
+
专题报道
-
+
更多>
-
{{ item.title }}
+
{{ item.title }}
{{ $moment(item.publishTime).format('MM/DD') }}
@@ -171,13 +172,13 @@ 光荣榜
-
+
更多>
-
{{ item.title }}
+
{{ item.title }}
{{ $moment(item.publishTime).format('MM/DD') }}
@@ -188,13 +189,13 @@ 今天我出镜
-
+
更多>
-
{{ item.title }}
+
{{ item.title }}
{{ $moment(item.publishTime).format('MM/DD') }}
@@ -272,7 +273,7 @@ export default { this.getData('0202', 'ImgNews2', '1'); this.getData('0203', 'ImgNews3', '1'); this.getData('0210', 'sceneStyle', '1'); - this.getData('9901', 'specialList', '0'); + this.getData('0205', 'specialList', '0'); this.getData('9902', 'gloryList', '0'); this.getData('9903', 'exitList', '0'); this.getBayData(); @@ -298,12 +299,12 @@ export default { openPage(path, code, id) { window.open(`${window.location.href}${path}?code=${code}&introId=${id}`); }, + // 获取飘窗详情 async getBayData() { try { const res = await getBay(); const { code, msg, data } = res.data; if (code === 200) { - console.log(data); const obj = { title: data.code, content: JSON.parse(data.value), @@ -315,22 +316,40 @@ export default { } } catch (error) {} }, + // 关闭飘窗 closeBay() { this.content = null; }, + // 跳转其它 + jumpPage(url, code) { + // this.$router.push({ + // path: url, + // query: { code }, + // }); + window.open(`${window.location.href}${url}?code=${code}`); + }, + // 跳转文章详情 + jumpDetail(url, code, introId) { + // this.$router.push({ + // path: url, + // query: { code, introId }, + // }); + window.open(`${window.location.href}${url}?code=${code}&introId=${introId}`); + }, }, }; diff --git a/src/views/OtherPages/SafeProduction.vue b/src/views/OtherPages/SafeProduction.vue index d0e1932..6ac6a12 100644 --- a/src/views/OtherPages/SafeProduction.vue +++ b/src/views/OtherPages/SafeProduction.vue @@ -10,6 +10,9 @@
+
+ +
@@ -22,9 +25,10 @@ import LeftNav from '@/components/LeftNav/LeftNav.vue'; import ListPage from '@/components/ListPage/ListPage.vue'; import RichText from '@/components/RichText/RichText.vue'; import Location from '@/components/Location/Location.vue'; +import Relevant from '@/components/RichText/Relevant.vue'; export default { - components: { LeftNav, ListPage, Location, RichText }, + components: { LeftNav, ListPage, Location, RichText, Relevant }, data() { return { code: '0401', @@ -55,7 +59,7 @@ export default { }, ], }, - year: '2020', + year: '2022', content: {}, pageNum: 1, introId: '', @@ -69,17 +73,15 @@ export default { console.log('this.list.url: ', this.list.url); if (this.$route.path === this.list.url) { this.code = val; - for (let i = 0; i < this.list.children.length; i++) { - if (val === this.list.children[i].code) { - this.defaultTitle = this.list.children[i].title; - } - } + this.getDetault(val); this.getContentData(); + this.introContent = {}; } }, }, created() { this.code = this.$route.query.code; + this.getDetault(this.code); if (this.$route.query.introId) { this.introId = this.$route.query.introId; this.getIntroContent(); @@ -88,6 +90,14 @@ export default { }, methods: { ...mapActions('home', ['getContent', 'getDetail']), + // 获取默认显示标题 + getDetault(val) { + for (let i = 0; i < this.list.children.length; i++) { + if (val === this.list.children[i].code) { + this.defaultTitle = this.list.children[i].title; + } + } + }, async getContentData() { try { const param = { diff --git a/src/views/OtherPages/Search.vue b/src/views/OtherPages/Search.vue new file mode 100644 index 0000000..7e2d142 --- /dev/null +++ b/src/views/OtherPages/Search.vue @@ -0,0 +1,141 @@ + + + diff --git a/src/views/OtherPages/System.vue b/src/views/OtherPages/System.vue index 933573f..86dfeba 100644 --- a/src/views/OtherPages/System.vue +++ b/src/views/OtherPages/System.vue @@ -72,21 +72,26 @@ export default { '$route.query.code'(val) { if (this.$route.path === this.list.url) { this.code = val; - for (let i = 0; i < this.list.children.length; i++) { - if (val === this.list.children[i].code) { - this.defaultTitle = this.list.children[i].title; - } - } + this.getDetault(val); this.getData(this.code); } }, }, created() { this.code = this.$route.query.code; + this.getDetault(this.code); this.getData(this.code); }, methods: { ...mapActions('home', ['getDetail']), + // 获取默认显示标题 + getDetault(val) { + for (let i = 0; i < this.list.children.length; i++) { + if (val === this.list.children[i].code) { + this.defaultTitle = this.list.children[i].title; + } + } + }, async getData(showPage) { try { const param = {