|
@@ -0,0 +1,75 @@
|
|
|
+<template>
|
|
|
+ <index-card title="高考资讯" sub-title="最新、最全的高考资讯" more-text="更多" @more="handleMore">
|
|
|
+ <el-tabs v-model="activeName" type="card" @tab-click="handleTabChanged">
|
|
|
+ <el-tab-pane v-for="type in newsTypes" :key="type" :name="type" :label="type">
|
|
|
+ <el-row>
|
|
|
+ <el-col v-for="news in getSafeNews(type)" :key="news.id" :span="12">
|
|
|
+ <div class="fx-row fx-sta-cen pr30 pf f-333" style="line-height: 35px">
|
|
|
+ <i class="el-icon-alarm-clock"></i>
|
|
|
+ <span class="ml10">{{ news.sendDate }}</span>
|
|
|
+ <span class="ml10 fx-1 text-ellipsis" :title="news.title">{{ news.title }}</span>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </index-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import IndexCard from '@/views/index/components/index-card'
|
|
|
+import loginCheckMixin from '@/views/components/blocks/index-login-interceptor-mixin'
|
|
|
+import transferMixin from '@/components/mx-transfer-mixin'
|
|
|
+import * as career from '@/api/webApi/career-news'
|
|
|
+
|
|
|
+export default {
|
|
|
+ mixins: [transferMixin, loginCheckMixin],
|
|
|
+ name: 'index-card-news',
|
|
|
+ components: { IndexCard },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ morePath: '/fuzhu/newGaokaoNews',
|
|
|
+ newsTypes: [],
|
|
|
+ activeName: '',
|
|
|
+ newsCache: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getTypes()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getTypes() {
|
|
|
+ career.typesNoToken().then(res => {
|
|
|
+ this.newsTypes = res.rows.map(i => i.label)
|
|
|
+ this.activeName = this.newsTypes.first()
|
|
|
+ this.getList(this.activeName)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleTabChanged() {
|
|
|
+ this.getList(this.activeName)
|
|
|
+ },
|
|
|
+ getList(type) {
|
|
|
+ if (!type) return
|
|
|
+ if (this.newsCache.hasOwnProperty(type)) return
|
|
|
+ career.listNoToken({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ type: type
|
|
|
+ }).then(res => {
|
|
|
+ this.$set(this.newsCache, type, res.rows)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getSafeNews(type) {
|
|
|
+ return this.newsCache[type] || []
|
|
|
+ },
|
|
|
+ async handleMore() {
|
|
|
+ await this.loginCheck()
|
|
|
+ this.transferTo(this.morePath)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|