提交 196a040f authored 作者: lihuihui's avatar lihuihui

update

上级 45940ef6
<template> <template>
<div> <div class="link-content">
<template v-if="item.news"> <template v-if="item.news">
<nuxt-link <a
v-if="typeof item.news.data.source == 'string'" :target="item.news.data.uri !== '' ? '_blank' : '_self'"
:target="item.news.data.source !== '' ? '_blank' : '_self'" :href="item.news.data.uri !== '' ? item.news.data.uri : `${item.news.path}/${item.news.data.id}`">
:to="item.news.data.source !== '' ? item.news.data.source : `${item.news.path}/${item.news.data.id}`">
<slot /> <slot />
</nuxt-link> </a>
</template> </template>
<template v-else> <template v-else>
<nuxt-link <nuxt-link
...@@ -22,3 +21,8 @@ export default { ...@@ -22,3 +21,8 @@ export default {
props: { item: { type: Object } } props: { item: { type: Object } }
} }
</script> </script>
<style lang="scss" scoped>
.link-content{
height: 100%;
}
</style>
...@@ -3,34 +3,27 @@ ...@@ -3,34 +3,27 @@
<div v-swiper:mySwiper="swiperOption" ref="mySwiper"> <div v-swiper:mySwiper="swiperOption" ref="mySwiper">
<div class="swiper-wrapper"> <div class="swiper-wrapper">
<div class="swiper-slide" v-for="(item, index) in listData" :key="index"> <div class="swiper-slide" v-for="(item, index) in listData" :key="index">
<app-link :item="{ <template v-if="item.uri">
news: { <a :href="item.uri" target="_black">
data: item, <img :src="item.web_img_uri" />
path: '/news/hot' </a>
} </template>
}"> <template v-else>
<img :src="item.photo_uri" /> <img :src="item.web_img_uri" />
</app-link> </template>
</div> </div>
</div> </div>
<!-- <div class="swiper-pagination swiper-pagination-bullets"></div> -->
</div> </div>
<div class="prev-button"></div> <div class="prev-button"></div>
<div class="next-button"></div> <div class="next-button"></div>
</div> </div>
</template> </template>
<script> <script>
import AppLink from '@/components/Link'
const _this = this
export default { export default {
name: 'banner', name: 'banner',
components: {
AppLink
},
data() { data() {
return { return {
listData: [], listData: [],
// 轮播图配置信息, 更多请参考 swiper.js 中文网,上面很详细。
swiperOption: { swiperOption: {
speed: 400, speed: 400,
autoplay: true, autoplay: true,
...@@ -46,15 +39,8 @@ export default { ...@@ -46,15 +39,8 @@ export default {
} }
}, },
async fetch() { async fetch() {
const params = { const params = { project_id: process.env.projectId, type_tag: 'ad_banner' }
page: 1, this.listData = await this.$axios.get('/api/cms/api/v1/advertisements', { params }).then(res => res.data.data)
per_page: 100,
type: 69,
project_id: process.env.projectId
}
this.listData = await this.$axios.get('/api/zws/v1/cms/news', { params }).then(res => {
return res
})
}, },
computed: { computed: {
swiper() { swiper() {
...@@ -63,9 +49,6 @@ export default { ...@@ -63,9 +49,6 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
// openPage(path) {
// path !== '' && window.open(path)
// }
swiperStop() { swiperStop() {
this.swiper.autoplay.stop() this.swiper.autoplay.stop()
}, },
......
<template> <template>
<div class="news-content-box"> <div class="news-content-box">
<m-title :data="titleParams" /> <m-title :data="titleParams" />
<div class="content-box"> <div class="content-box" v-if="Object.keys(listData.first).length">
<div class="news-left"> <div class="news-left">
<app-link :item="{ <app-link :item="{ news: { data: listData.first, path: '/news/hot' } }">
news: { <img :src="listData.first.web_img_uri" alt="" />
data: listData.first,
path: '/news/hot'
}
}">
<img :src="listData.first.photo_uri" alt="" />
<div class="mantle-box"> <div class="mantle-box">
<div class="tit">{{ listData.first.title }}</div> <div class="tit">{{ listData.first.title }}</div>
<div class="con-txt">{{ listData.first.summary }}</div> <div class="con-txt">{{ listData.first.abstract }}</div>
</div> </div>
</app-link> </app-link>
</div> </div>
<ul class="news-right"> <ul class="news-right">
<li v-for="(item, index) in listData.list" :key="index"> <li v-for="(item, index) in listData.list" :key="index">
<app-link :item="{ <app-link :item="{ news: { data: listData.first, path: '/news/hot' } }">
news: { <div class="time">{{ formatDate(item.start_time) }}</div>
data: listData.first,
path: '/news/hot'
}
}">
<div class="time">{{ item.created_time }}</div>
<div class="news-r-title">{{ item.title }}</div> <div class="news-r-title">{{ item.title }}</div>
<div class="del">{{ item.summary }}</div> <div class="del">{{ item.abstract }}</div>
</app-link> </app-link>
</li> </li>
</ul> </ul>
...@@ -43,14 +33,9 @@ export default { ...@@ -43,14 +33,9 @@ export default {
AppLink AppLink
}, },
async fetch() { async fetch() {
const params = { const params = { project_id: process.env.projectId, type_tag: 'article_news_hot', page: 1, limit: 4 }
page: 1, await this.$axios.get('/api/cms/api/v1/articles', { params }).then(res => {
per_page: 4, this.data = res.data.data || []
type: 80,
project_id: process.env.projectId
}
await this.$axios.get('/api/zws/v1/cms/news', { params }).then(res => {
this.data = res || []
}) })
}, },
data() { data() {
...@@ -59,10 +44,7 @@ export default { ...@@ -59,10 +44,7 @@ export default {
titleParams: { titleParams: {
name: '最新动态', name: '最新动态',
more: { more: {
path: '/news/hot', path: '/news/hot'
query: {
type: 80
}
} }
} }
} }
...@@ -74,6 +56,11 @@ export default { ...@@ -74,6 +56,11 @@ export default {
} }
}, },
methods: { methods: {
formatDate(value) {
const date = new Date(value * 1000)
console.log(date.getMonth())
return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate()
},
goPage(item) { goPage(item) {
if (item.source === '') { if (item.source === '') {
this.$router.push({ this.$router.push({
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
path: '/news/hot' path: '/news/hot'
} }
}"> }">
<img :src="item.photo_uri" /> <img :src="item.web_img_uri" />
<div class="text">{{ item.title }}</div> <div class="text">{{ item.title }}</div>
</app-link> </app-link>
</div> </div>
...@@ -57,15 +57,8 @@ export default { ...@@ -57,15 +57,8 @@ export default {
} }
}, },
async fetch() { async fetch() {
const params = { const params = { project_id: process.env.projectId, type_tag: 'article_publish_class' }
page: 1, this.listData = await this.$axios.get('/api/cms/api/v1/articles', { params }).then(res => res.data.data)
per_page: 100,
type: 72,
project_id: process.env.projectId
}
this.listData = await this.$axios.get('/api/zws/v1/cms/news', { params }).then(res => {
return res
})
}, },
computed: { computed: {
swiper() { swiper() {
...@@ -84,18 +77,6 @@ export default { ...@@ -84,18 +77,6 @@ export default {
}, },
swiperStart() { swiperStart() {
this.swiper.autoplay.start() this.swiper.autoplay.start()
},
goPage(item) {
if (item.source === '') {
this.$router.push({
path: '/news/hot-detail',
query: {
id: item.id
}
})
} else {
window.open(item.source)
}
} }
} }
} }
......
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
<div class="banner-box" @mouseenter="swiperStop" @mouseleave="swiperStart"> <div class="banner-box" @mouseenter="swiperStop" @mouseleave="swiperStart">
<div v-swiper:mySwiper="swiperOption" ref="mySwiper"> <div v-swiper:mySwiper="swiperOption" ref="mySwiper">
<div class="swiper-wrapper"> <div class="swiper-wrapper">
<div class="swiper-slide" v-for="(item, index) in listData" :key="index" @click="goPage(item)"> <div class="swiper-slide" v-for="(item, index) in listData" :key="index">
<app-link :item="{ <app-link :item="{
news: { news: {
data: item, data: item,
path: '/news/hot' path: '/news/hot'
} }
}"> }">
<img :src="item.photo_uri" /> <img :src="item.web_img_uri" />
</app-link> </app-link>
</div> </div>
</div> </div>
...@@ -130,15 +130,8 @@ export default { ...@@ -130,15 +130,8 @@ export default {
} }
}, },
async fetch() { async fetch() {
const params = { const params = { project_id: process.env.projectId, type_tag: 'kelley_alumni_share' }
page: 1, this.listData = await this.$axios.get('/api/cms/api/v1/articles', { params }).then(res => res.data.data)
per_page: 100,
type: 81,
project_id: process.env.projectId
}
this.listData = await this.$axios.get('/api/zws/v1/cms/news', { params }).then(res => {
return res
})
}, },
computed: { computed: {
swiper() { swiper() {
...@@ -178,19 +171,7 @@ export default { ...@@ -178,19 +171,7 @@ export default {
this.swiper.autoplay.stop() this.swiper.autoplay.stop()
}, },
swiperStart() { swiperStart() {
// this.swiper.autoplay.start() this.swiper.autoplay.start()
},
goPage(item) {
if (item.source === '') {
this.$router.push({
path: '/alumni/detail',
query: {
id: item.id
}
})
} else {
window.open(item.source)
}
} }
} }
} }
......
...@@ -22,13 +22,7 @@ export default { ...@@ -22,13 +22,7 @@ export default {
data() { data() {
return { return {
titleParams: { titleParams: {
name: '项目特色', name: '项目特色'
more: {
path: '/',
query: {
id: 1
}
}
}, },
data: [ data: [
{ {
......
...@@ -2,14 +2,28 @@ ...@@ -2,14 +2,28 @@
<div class="news-content-box"> <div class="news-content-box">
<ul class="list-content"> <ul class="list-content">
<template v-for="(item, index) in data"> <template v-for="(item, index) in data">
<li @click="handleClick(item)" :key="index"> <template v-if="item.uri">
<img :src="item.photo_uri" alt="" /> <a :href="item.uri" target="_black" :key="index">
<li>
<img :src="item.web_img_uri" alt="" />
<div class="right-con"> <div class="right-con">
<div class="time">{{ item.created_time }}</div> <div class="time">{{ formatDate(item.start_time) }}</div>
<div class="title">{{ item.title }}</div> <div class="title">{{ item.title }}</div>
<div class="text">{{ item.summary }}</div> <div class="text">{{ item.abstract }}</div>
</div> </div>
</li> </li>
</a>
</template>
<template v-else>
<li :key="index" @click="handleClick(item)">
<img :src="item.web_img_uri" alt="" />
<div class="right-con">
<div class="time">{{ formatDate(item.start_time) }}</div>
<div class="title">{{ item.title }}</div>
<div class="text">{{ item.abstract }}</div>
</div>
</li>
</template>
</template> </template>
</ul> </ul>
</div> </div>
...@@ -27,13 +41,17 @@ export default { ...@@ -27,13 +41,17 @@ export default {
} }
}, },
methods: { methods: {
formatDate(value) {
const date = new Date(value * 1000)
console.log(date.getMonth())
return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate()
},
handleClick(item) { handleClick(item) {
if (item.source) {
window.open(item.source)
} else {
this.$emit('onClick', item) this.$emit('onClick', item)
} }
} },
mounted() {
console.log(this.data)
} }
} }
</script> </script>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
path: '/news/hot' path: '/news/hot'
} }
}"> }">
<img :src="item.photo_uri" alt="" /> <img :src="item.web_img_uri" alt="" />
<div class="dec">{{ item.title }}</div> <div class="dec">{{ item.title }}</div>
</app-link> </app-link>
</li> </li>
...@@ -35,19 +35,16 @@ export default { ...@@ -35,19 +35,16 @@ export default {
} }
}, },
async fetch() { async fetch() {
this.data = await this.$axios.get(`/api/zws/v1/cms/news/${this.$route.params.id}`).then(res => {
return res
})
const params = { const params = {
project_id: process.env.projectId,
type_tag: 'article_news_hot',
is_recommend: 1,
page: 1, page: 1,
per_page: 100, limit: 3
type: 80,
project_id: process.env.projectId
} }
this.listData = await this.$axios.get('/api/zws/v1/cms/news', { params }).then(res => { this.listData = await this.$axios.get('/api/cms/api/v1/articles', { params }).then(res => {
return res.filter((item, index) => { console.log(res.data.data)
return index < 3 return res.data.data
})
}) })
}, },
methods: { methods: {
......
...@@ -6,7 +6,7 @@ let config = {} ...@@ -6,7 +6,7 @@ let config = {}
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
config = { config = {
env: { env: {
projectId: '1001', projectId: '6800243768751554560',
baseURL: 'https://project-api.ezijing.com', baseURL: 'https://project-api.ezijing.com',
loginURL: 'https://login.ezijing.com/auth' loginURL: 'https://login.ezijing.com/auth'
}, },
...@@ -15,7 +15,7 @@ if (process.env.NODE_ENV === 'production') { ...@@ -15,7 +15,7 @@ if (process.env.NODE_ENV === 'production') {
} else { } else {
config = { config = {
env: { env: {
projectId: '1001', projectId: '6800243768751554560',
baseURL: 'https://project-api.ezijing.com', baseURL: 'https://project-api.ezijing.com',
loginURL: 'https://login.ezijing.com/auth' loginURL: 'https://login.ezijing.com/auth'
}, },
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="el-icon-arrow-left"></div> <div class="el-icon-arrow-left"></div>
<div class="text">返回</div> <div class="text">返回</div>
</div> </div>
<div class="times">{{ data.created_time }}</div> <div class="times">{{ formatDate(data.start_time) }}</div>
<div class="titles">{{ data.title }}</div> <div class="titles">{{ data.title }}</div>
<div class="article-content" v-html="data.content"></div> <div class="article-content" v-html="data.content"></div>
<recommend /> <recommend />
...@@ -44,29 +44,16 @@ export default { ...@@ -44,29 +44,16 @@ export default {
} }
}, },
async fetch() { async fetch() {
this.data = await this.$axios.get(`/api/zws/v1/cms/news/${this.$route.params.id}`).then(res => { this.data = await this.$axios.get(`/api/cms/api/v1/article/${this.$route.params.id}/detail`).then(res => {
return res return res.data
})
const params = {
page: 1,
per_page: 100,
type: 74,
project_id: 1013
}
this.listData = await this.$axios.get('/api/zws/v1/cms/news', { params }).then(res => {
return res.filter((item, index) => {
return index < 3
})
}) })
}, },
mounted() {}, mounted() {},
methods: { methods: {
goPage(item) { formatDate(value) {
if (item.source) { const date = new Date(value * 1000)
window.open(item.source) console.log(date.getMonth())
} else { return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate()
this.$router.push({ name: 'alumni-sharing-id', params: { id: item.id } })
}
} }
} }
} }
......
...@@ -15,15 +15,8 @@ export default { ...@@ -15,15 +15,8 @@ export default {
newsItem newsItem
}, },
async fetch() { async fetch() {
const params = { const params = { project_id: process.env.projectId, type_tag: 'kelley_alumni_share' }
page: 1, this.newsList = await this.$axios.get('/api/cms/api/v1/articles', { params }).then(res => res.data.data)
per_page: 100,
type: this.$route.query.type || 80,
project_id: process.env.projectId
}
this.newsList = await this.$axios.get('/api/zws/v1/cms/news', { params }).then(res => {
return res
})
}, },
data() { data() {
return { return {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="el-icon-arrow-left"></div> <div class="el-icon-arrow-left"></div>
<div class="text">返回</div> <div class="text">返回</div>
</div> </div>
<div class="times">{{ data.created_time }}</div> <div class="times">{{ formatDate(data.start_time) }}</div>
<div class="titles">{{ data.title }}</div> <div class="titles">{{ data.title }}</div>
<div class="article-content" v-html="data.content"></div> <div class="article-content" v-html="data.content"></div>
<recommend /> <recommend />
...@@ -44,22 +44,16 @@ export default { ...@@ -44,22 +44,16 @@ export default {
} }
}, },
async fetch() { async fetch() {
this.data = await this.$axios.get(`/api/zws/v1/cms/news/${this.$route.params.id}`).then(res => { this.data = await this.$axios.get(`/api/cms/api/v1/article/${this.$route.params.id}/detail`).then(res => {
return res return res.data
})
const params = {
page: 1,
per_page: 100,
type: 80,
project_id: process.env.projectId
}
this.listData = await this.$axios.get('/api/zws/v1/cms/news', { params }).then(res => {
return res.filter((item, index) => {
return index < 3
})
}) })
}, },
methods: { methods: {
formatDate(value) {
const date = new Date(value * 1000)
console.log(date.getMonth())
return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate()
},
goPage(item) { goPage(item) {
if (item.source) { if (item.source) {
window.open(item.source) window.open(item.source)
......
...@@ -15,15 +15,8 @@ export default { ...@@ -15,15 +15,8 @@ export default {
newsItem newsItem
}, },
async fetch() { async fetch() {
const params = { const params = { project_id: process.env.projectId, type_tag: this.$route.query.type || 'article_news_hot' }
page: 1, this.newsList = await this.$axios.get('/api/cms/api/v1/articles', { params }).then(res => res.data.data)
per_page: 100,
type: this.$route.query.type || 80,
project_id: process.env.projectId
}
this.newsList = await this.$axios.get('/api/zws/v1/cms/news', { params }).then(res => {
return res
})
}, },
data() { data() {
return { return {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="el-icon-arrow-left"></div> <div class="el-icon-arrow-left"></div>
<div class="text">返回</div> <div class="text">返回</div>
</div> </div>
<div class="times">{{ data.created_time }}</div> <div class="times">{{ formatDate(data.start_time) }}</div>
<div class="titles">{{ data.title }}</div> <div class="titles">{{ data.title }}</div>
<div class="article-content" v-html="data.content"></div> <div class="article-content" v-html="data.content"></div>
<recommend /> <recommend />
...@@ -45,29 +45,16 @@ export default { ...@@ -45,29 +45,16 @@ export default {
} }
}, },
async fetch() { async fetch() {
this.data = await this.$axios.get(`/api/zws/v1/cms/news/${this.$route.query.id}`).then(res => { this.data = await this.$axios.get(`/api/cms/api/v1/article/${this.$route.params.id}/detail`).then(res => {
return res return res.data
})
const params = {
page: 1,
per_page: 100,
type: 53,
project_id: process.env.projectId
}
this.listData = await this.$axios.get('/api/zws/v1/cms/news', { params }).then(res => {
return res.filter((item, index) => {
return index < 3
})
}) })
}, },
mounted() {}, mounted() {},
methods: { methods: {
goPage(item) { formatDate(value) {
if (item.source) { const date = new Date(value * 1000)
window.open(item.source) console.log(date.getMonth())
} else { return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate()
this.$router.push({ name: 'news-interview-id', params: { id: item.id } })
}
} }
} }
} }
......
...@@ -16,15 +16,8 @@ export default { ...@@ -16,15 +16,8 @@ export default {
newsItem newsItem
}, },
async fetch() { async fetch() {
const params = { const params = { project_id: process.env.projectId, type_tag: 'kelley_interview' }
page: 1, this.newsList = await this.$axios.get('/api/cms/api/v1/articles', { params }).then(res => res.data.data)
per_page: 100,
type: this.$route.query.type || 53,
project_id: 1013
}
this.newsList = await this.$axios.get('/api/zws/v1/cms/news', { params }).then(res => {
return res
})
}, },
data() { data() {
return { return {
......
...@@ -14,9 +14,33 @@ const httpRequest = axios.create({ ...@@ -14,9 +14,33 @@ const httpRequest = axios.create({
// 请求拦截 // 请求拦截
httpRequest.interceptors.request.use( httpRequest.interceptors.request.use(
function(config) { function(config) {
if (config.headers['Content-Type'] === 'application/x-www-form-urlencoded') { const defaultParams = {
config.data = qs.stringify(config.data) timestamp: parseInt(Date.now() / 1000),
nonce: Math.random()
.toString(36)
.slice(-8)
} }
// 接口请求参数
let params = config.params || config.data
// 排序
function alphabeticalSort(a, b) {
return a.localeCompare(b)
}
params = Object.assign({}, defaultParams, params)
const str = qs.stringify(Object.assign({}, params, { salt: 'n7xAav2tSjn9Ysnr' }), { sort: alphabeticalSort })
const strs = qs.parse(str)
Object.keys(strs).map(item => {
strs[item] = Array.isArray(strs[item]) ? JSON.stringify(strs[item]) : strs[item]
})
params.signature = 'UG7wBenexQhiuD2wpCwuxkU0jqcj006d'
if (config.method === 'post') {
config.data = params
} else {
config.params = params
}
// if (config.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
// config.data = qs.stringify(config.data)
// }
if (config.headers['Content-Type'] === 'multipart/form-data') { if (config.headers['Content-Type'] === 'multipart/form-data') {
const form = new window.FormData() const form = new window.FormData()
for (const key in config.data) { for (const key in config.data) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论