提交 c0a7e73b authored 作者: lihuihui's avatar lihuihui

修改需求

上级 9ec67063
...@@ -5,4 +5,5 @@ export default class ArticleAction { ...@@ -5,4 +5,5 @@ export default class ArticleAction {
getArticle (obj) { return articleApi.getArticle(obj).then(res => res) } getArticle (obj) { return articleApi.getArticle(obj).then(res => res) }
getArticleDetail (id) { return articleApi.getArticleDetail(id).then(res => res) } getArticleDetail (id) { return articleApi.getArticleDetail(id).then(res => res) }
formCommit (data) { return articleApi.formCommit(data).then(res => res) } formCommit (data) { return articleApi.formCommit(data).then(res => res) }
getBanner (obj) { return articleApi.getBanner(obj).then(res => res) }
} }
...@@ -8,4 +8,6 @@ export default class ScoreAPI extends BaseAPI { ...@@ -8,4 +8,6 @@ export default class ScoreAPI extends BaseAPI {
// 获取文章详情 // 获取文章详情
getArticleDetail = (id) => this.get(`/microservices/api/article/${id}/info`) getArticleDetail = (id) => this.get(`/microservices/api/article/${id}/info`)
formCommit = (data) => this.post('/microservices/api/form/commit', data) formCommit = (data) => this.post('/microservices/api/form/commit', data)
// 获取轮播
getBanner = (obj = {}) => this.get('/microservices/api/carousel/list', obj, {})
} }
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
<swiper ref="mySwiper" :options="swiperOptions" class="item-swiper"> <swiper ref="mySwiper" :options="swiperOptions" class="item-swiper">
<swiper-slide v-for="(item, index) in swiperList" :key="index"> <swiper-slide v-for="(item, index) in swiperList" :key="index">
<!-- <router-link :to="`/news/detail?id=${item.id}&type=home`"> --> <!-- <router-link :to="`/news/detail?id=${item.id}&type=home`"> -->
<img :src="item" alt="" /> <a :href="item.url" target="_blank" v-if="item.image_info">
<img :src="item.image_info.full_path" alt="" />
</a>
<!-- </router-link> --> <!-- </router-link> -->
</swiper-slide> </swiper-slide>
</swiper> </swiper>
...@@ -44,10 +46,17 @@ export default { ...@@ -44,10 +46,17 @@ export default {
} }
} }
}, },
created() {
action.articleAction.getAllClassify({ tag: 'carousel-category' }).then(response => {
const findId = response.data[0].children.find(item => {
return item.display_name === '轮播1'
})
action.articleAction.getBanner({ category_id: findId.id }).then(res => {
this.swiperList = res.data
})
})
},
mounted() { mounted() {
// action.articleAction.getAllClassify({ tag: 'carousel-category' }).then(response => {
// console.log(response, '123=321')
// })
// if (!Object.keys(this.$store.state.classify).length) { // if (!Object.keys(this.$store.state.classify).length) {
// setTimeout(() => { // setTimeout(() => {
// this.articleClassify = this.$store.state.classify // this.articleClassify = this.$store.state.classify
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论