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

update

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