Browse Source

图片新闻

master
aBin 3 years ago
parent
commit
2821558389
  1. 2
      .drone.yml
  2. 6
      .env.development
  3. 10
      .env.production
  4. BIN
      dist.zip
  5. 11
      src/components/ListPage/ListPage.vue
  6. 2
      src/config/api.js
  7. 2
      src/views/FirstPages/FirstPage.vue
  8. 60
      src/views/NewPages/NewPages.vue

2
.drone.yml

@ -5,7 +5,7 @@ name: development
# 常量值 # 常量值
constants: constants:
- &DEVELOPMENT_HOST 10.119.190.12:8000 - &DEVELOPMENT_HOST 192.168.101.69:8000
- &DEVELOPMENT_CMD - &DEVELOPMENT_CMD
- npm config set registry http://registry.npm.taobao.org - npm config set registry http://registry.npm.taobao.org
- npm i - npm i

6
.env.development

@ -1,10 +1,10 @@
VUE_APP_MODE=development VUE_APP_MODE=development
VUE_APP_NODE_ENV=development VUE_APP_NODE_ENV=development
VUE_APP_SCENE=/datang/ VUE_APP_SCENE=/datang/
VUE_APP_BASE_URL=http://10.119.190.12:8000 VUE_APP_BASE_URL=http://test.tall.wiki
VUE_APP_API_URL=http://10.119.190.12:8000/datang/v1.0 VUE_APP_API_URL=http://test.tall.wiki/datang/v1.0
VUE_APP_PROXY_URL=/datang/v1.0 VUE_APP_PROXY_URL=/datang/v1.0
VUE_APP_PUBLIC_PATH=/datang VUE_APP_PUBLIC_PATH=/datang
VUE_APP_MSG_URL=wss://10.119.190.12:8000/websocket/message/v4.0/ws VUE_APP_MSG_URL=wss://test.tall.wiki/websocket/message/v4.0/ws
VUE_APP_TITLE=大唐 VUE_APP_TITLE=大唐
VUE_APP_DESCRIPTION=大唐 VUE_APP_DESCRIPTION=大唐

10
.env.production

@ -1,10 +1,10 @@
VUE_APP_MODE=production VUE_APP_MODE=production
VUE_APP_NODE_ENV=production VUE_APP_NODE_ENV=production
VUE_APP_SCENE=/datang/ VUE_APP_SCENE=/
VUE_APP_BASE_URL=http://10.119.190.12:8000 VUE_APP_BASE_URL=http://10.119.190.12:8000
VUE_APP_API_URL=http://10.119.190.12:8000/datang/v1.0 VUE_APP_API_URL=http://10.119.190.12:8000/v1.0
VUE_APP_PROXY_URL=/datang/v1.0 VUE_APP_PROXY_URL=/v1.0
VUE_APP_PUBLIC_PATH=/datang VUE_APP_PUBLIC_PATH=
VUE_APP_MSG_URL=wss://10.119.190.12:8000/websocket/message/v4.0/ws VUE_APP_MSG_URL=wss://192.168.101.69:8000/websocket/message/v4.0/ws
VUE_APP_TITLE=大唐 VUE_APP_TITLE=大唐
VUE_APP_DESCRIPTION=大唐 VUE_APP_DESCRIPTION=大唐

BIN
dist.zip

Binary file not shown.

11
src/components/ListPage/ListPage.vue

@ -1,6 +1,6 @@
<template> <template>
<div style="position:relative;min-height: 500px;"> <div style="position:relative">
<div class="year-box" v-if="code !== 'search'"> <div class="year-box" v-if="code !== 'search' && yearList.length > 1">
<span <span
:class="item && item.year && year - 0 === item.year - 0 ? 'active' : ''" :class="item && item.year && year - 0 === item.year - 0 ? 'active' : ''"
v-for="item in yearList" v-for="item in yearList"
@ -79,20 +79,21 @@ export default {
if (this.code !== 'search') { if (this.code !== 'search') {
this.getYear(); this.getYear();
} }
if (this.content.list.length === 1) { if (this.content && this.content.list && this.content.list.length === 1) {
this.openPage(this.content.list[0].introId); this.openPage(this.content.list[0].introId);
} }
}, },
methods: { methods: {
onChange(pageNumber) { onChange(pageNumber) {
this.$emit('getData', pageNumber); this.$emit('getData', pageNumber, this.code);
}, },
openPage(id) { openPage(id) {
console.log('window.location.href: ', window.location.href);
window.open(`${window.location.href}&introId=${id}`); window.open(`${window.location.href}&introId=${id}`);
}, },
changeYear(year) { changeYear(year) {
this.year = year; this.year = year;
this.$emit('changeYear', year); this.$emit('changeYear', year, this.code);
}, },
async getYear() { async getYear() {
try { try {

2
src/config/api.js

@ -22,7 +22,7 @@ export const getContent = params =>
// 查询图片新闻列表 // 查询图片新闻列表
export const getContentImg = params => export const getContentImg = params =>
axios.get( axios.get(
`${content}/list?showPage=0201&showPage=0202&showPage=0203&year=${params.year}&showType=${params.showType} `${content}/list?showPage=${params.showPage}&year=${params.year}&showType=${params.showType}
&pageNum=${params.pageNum}&pageSize=${params.pageSize}`, &pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
); );

2
src/views/FirstPages/FirstPage.vue

@ -330,7 +330,7 @@ export default {
}, },
// //
openPage(path, code, id) { openPage(path, code, id) {
window.open(`${window.location.href}${path}?code=${code}&introId=${id}`); window.open(`${window.location.href}${path}?code=${code}` + (id ? `&introId=${id}` : ''));
}, },
// //
async getBayData() { async getBayData() {

60
src/views/NewPages/NewPages.vue

@ -7,7 +7,19 @@
<div class="flex-1 flex-column"> <div class="flex-1 flex-column">
<Location :title="defaultTitle" /> <Location :title="defaultTitle" />
<div class="content-detail p-4" :style="{ 'min-height': list.children.length * 56 + 'px' }"> <div class="content-detail p-4" :style="{ 'min-height': list.children.length * 56 + 'px' }">
<ListPage v-if="!introId" :code="code" @changeYear="changeYear" :content="content" @getData="getData" /> <template v-if="!introId">
<template v-if="code !== '0204'">
<ListPage :code="code" @changeYear="changeYear" :content="content" @getData="getData" />
</template>
<template v-else>
<h3>集团新闻</h3>
<ListPage :code="code" @changeYear="changeYear" :content="content1" @getData="getData" />
<h3>省公司新闻</h3>
<ListPage :code="code" @changeYear="changeYear" :content="content2" @getData="getData" />
<h3>公司新闻</h3>
<ListPage :code="code" @changeYear="changeYear" :content="content3" @getData="getData" />
</template>
</template>
<RichText v-else :rich-obj="introContent" /> <RichText v-else :rich-obj="introContent" />
</div> </div>
<div v-if="introContent.relations && introContent.relations.length" class="content-detail p-4"> <div v-if="introContent.relations && introContent.relations.length" class="content-detail p-4">
@ -81,6 +93,9 @@ export default {
}, },
year: '2022', year: '2022',
content: {}, content: {},
content1: {},
content2: {},
content3: {},
pageNum: 1, pageNum: 1,
introId: '', introId: '',
introContent: {}, introContent: {},
@ -93,7 +108,13 @@ export default {
this.code = val; this.code = val;
this.getType(this.code); this.getType(this.code);
this.getDetault(val); this.getDetault(val);
if (this.code === '0204') {
this.getContentData('0201');
this.getContentData('0202');
this.getContentData('0203');
} else {
this.getContentData(); this.getContentData();
}
this.introContent = {}; this.introContent = {};
} }
}, },
@ -106,7 +127,13 @@ export default {
this.introId = this.$route.query.introId; this.introId = this.$route.query.introId;
this.getIntroContent(); this.getIntroContent();
} }
if (this.code === '0204') {
this.getContentData('0201');
this.getContentData('0202');
this.getContentData('0203');
} else {
this.getContentData(); this.getContentData();
}
}, },
methods: { methods: {
...mapActions('home', ['getContent', 'getDetail', 'getContentImg']), ...mapActions('home', ['getContent', 'getDetail', 'getContentImg']),
@ -128,24 +155,35 @@ export default {
} }
} }
}, },
async getContentData() { async getContentData(showPage) {
try { try {
let param = { let param = {
showPage: this.code, showPage: showPage || this.code,
year: this.year, year: this.year,
showType: this.showType, showType: this.showType,
pageNum: this.pageNum, pageNum: this.pageNum,
pageSize: 10, pageSize: 10,
}; };
let data = null; let data = null;
let data1 = null;
let data2 = null;
let data3 = null;
if (this.showType === '1' && this.code === '0204') { if (this.showType === '1' && this.code === '0204') {
param.pageSize = 12; param.pageSize = 16;
data = await this.getContentImg(param); if (showPage === '0201') {
data1 = await this.getContentImg(param);
this.content1 = data1;
} else if (showPage === '0202') {
data2 = await this.getContentImg(param);
this.content2 = data2;
} else if (showPage === '0203') {
data3 = await this.getContentImg(param);
this.content3 = data3;
}
} else { } else {
data = await this.getContent(param); data = await this.getContent(param);
console.log('data: ', data);
}
this.content = data; this.content = data;
}
} catch (error) {} } catch (error) {}
}, },
// //
@ -165,14 +203,14 @@ export default {
this.code = code; this.code = code;
this.introId = ''; this.introId = '';
}, },
changeYear(year) { changeYear(year, code) {
this.year = year; this.year = year;
this.getContentData(); this.getContentData(code);
}, },
getData(pageNum) { getData(pageNum, code) {
console.log('pageNum: ', pageNum); console.log('pageNum: ', pageNum);
this.pageNum = pageNum; this.pageNum = pageNum;
this.getContentData(); this.getContentData(code);
}, },
}, },
}; };

Loading…
Cancel
Save