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:
- &DEVELOPMENT_HOST 10.119.190.12:8000
- &DEVELOPMENT_HOST 192.168.101.69:8000
- &DEVELOPMENT_CMD
- npm config set registry http://registry.npm.taobao.org
- npm i

6
.env.development

@ -1,10 +1,10 @@
VUE_APP_MODE=development
VUE_APP_NODE_ENV=development
VUE_APP_SCENE=/datang/
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_BASE_URL=http://test.tall.wiki
VUE_APP_API_URL=http://test.tall.wiki/datang/v1.0
VUE_APP_PROXY_URL=/datang/v1.0
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_DESCRIPTION=大唐

10
.env.production

@ -1,10 +1,10 @@
VUE_APP_MODE=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_API_URL=http://10.119.190.12:8000/datang/v1.0
VUE_APP_PROXY_URL=/datang/v1.0
VUE_APP_PUBLIC_PATH=/datang
VUE_APP_MSG_URL=wss://10.119.190.12:8000/websocket/message/v4.0/ws
VUE_APP_API_URL=http://10.119.190.12:8000/v1.0
VUE_APP_PROXY_URL=/v1.0
VUE_APP_PUBLIC_PATH=
VUE_APP_MSG_URL=wss://192.168.101.69:8000/websocket/message/v4.0/ws
VUE_APP_TITLE=大唐
VUE_APP_DESCRIPTION=大唐

BIN
dist.zip

Binary file not shown.

11
src/components/ListPage/ListPage.vue

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

2
src/config/api.js

@ -22,7 +22,7 @@ export const getContent = params =>
// 查询图片新闻列表
export const getContentImg = params =>
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}`,
);

2
src/views/FirstPages/FirstPage.vue

@ -330,7 +330,7 @@ export default {
},
//
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() {

60
src/views/NewPages/NewPages.vue

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

Loading…
Cancel
Save