|
- <template>
- <div class="metadaily">
- <Swiper :banner-array="carouselList" />
- <div id="hot">
- <div class="content">
- <HotNews v-if="display" :list="hotnewsList" :type="1"/>
- </div>
- </div>
- <div class="gg" v-if="gg1.img" >
- <a :href="gg1.link" target="_blank">
- <img :src="gg1.img" alt="">
- </a>
- </div>
- <div id="daliay">
- <div class="content">
- <div class="htitle">
- <a class="tle">资讯</a>
- <el-button type="text" @click="routerTo(31)">MORE+</el-button>
- </div>
- <div id="hotList">
- <div class="list" v-for="(item, index) in zixun" :key="index" @click="routerToarticleDetails(item.detail)">
- <img :src="item.image">
- <div class="txt">
- <a class="title">{{ item.title }}</a>
- <a class="subtitle">{{ item.detailText }}</a>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="gg" v-if="gg2.img">
- <a :href="gg2.link" target="_blank">
- <img :src="gg2.img" alt="">
- </a>
- </div>
- <div id="wk">
- <div class="content">
- <div class="htitle">
- <a class="tle">深度</a>
- <div class="item">
- <a v-for="item in depth" :key="item" @click="changedepth(item)" :class="{ clk: depthitem === item }">{{ item }}</a>
- </div>
- <el-button type="text" @click="routerTo(32)">MORE+</el-button>
- </div>
- <div id="hotList">
- <div class="list" v-for="(item, index) in shendu" :key="index" @click="routerToarticleDetails(item.detail)">
- <img :src="item.image">
- <div class="txt">
- <a class="title">{{ item.title }}</a>
- <a class="subtitle">{{ item.detailText }}</a>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import Swiper from '@/components/swiper'
- import HotNews from '@/components/hotNews'
- import { guanggao, lunboList, hotNewsConfig, shendu, zixun, hotnews } from '@/api/metadaily.js'
- export default {
- name: 'metadaily',
- data () {
- return {
- information: ['XR', 'Web3', 'AI'],
- depth: ['XR', 'Web3', 'AI'],
- depthitem: 'XR',
- carouselList: [],
- hotnews: {},
- hotnewsList: [],
- shendu: [],
- zixun: [],
- gg1: {},
- gg2: {},
- display: 1
- }
- },
- components: {
- Swiper,
- HotNews
- },
- mounted () {
- this.gethotnewsConfig()
- this.getguanggao()
- this.getlunboList()
- this.gethotnews()
- this.getshendu()
- this.getzixun()
- },
- methods: {
- routerToarticleDetails (value) {
- localStorage.setItem('article', value)
- this.$router.push({ path: '/articleDetails' })
- },
- routerTo (type) {
- this.$router.push({ path: '/articleList', query: { type: 3, subType: type }}) // eslint-disable-line
- },
- changenews (item) {
- this.getzixun()
- },
- changedepth (item) {
- this.depthitem = item
- this.getshendu()
- },
- async getguanggao () {
- const { data: { code: ggm1, data: gg1 } } = await guanggao(1)
- const { data: { code: ggm2, data: gg2 } } = await guanggao(2)
-
- if (ggm1 === 200 && ggm2 === 200) {
- this.gg1 = {
- img: gg1.image,
- link: gg1.link
- }
- this.gg2 = {
- img: gg2.image,
- link: gg2.link
- }
- }
- },
- async getlunboList () {
- const { data: { code, data } } = await lunboList()
- if (code === 200) {
- this.carouselList = data.list
- }
- },
- async gethotnewsConfig () {
- const { data: { code, data: { display } } } = await hotNewsConfig()
- if (code === 200) {
- this.display = display
- }
- },
- async gethotnews () {
- this.hotnewsList = []
- const { data: { code, data } } = await hotnews()
- if (code === 200) {
- this.hotnewsList = data.list
- }
- },
- async getshendu () {
- const { data: { code, data } } = await shendu(1, 10, this.depthitem)
- if (code === 200) {
- this.shendu = data.list
- }
- },
- async getzixun () {
- const { data: { code, data } } = await zixun(1, 10)
- if (code === 200) {
- this.zixun = data.list
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .metadaily{
- background: #E3E5EA;
- }
- .el-carousel__item{
- background-size: 100%;
- background-repeat: no-repeat;
- display: flex;
- justify-content: center;
- align-items: flex-end;
- #txt {
- display: flex;
- flex-direction: column;
- margin-bottom: 50px;
- color: #FFFFFF;
- .title {
- font-size: 36px;
- font-weight: bold;
- text-align: center;
- margin-bottom: 15px;
-
- }
- .subtitle {
- font-size: 16px;
- font-weight: 400;
- opacity: 0.5;
- text-align: center;
- }
- }
- }
- .lunbo {
- background-size: auto;
- background-position: center;
- }
- #hot, #wk {
- width: 100%;
- background: #E3E5EA;
- display: flex;
- align-items: center;
- flex-direction: column;
- justify-content: center;
- //padding-top: 30px;;
- padding-bottom: 30px;
- .content {
- width: 1200px;
- height: 90%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .top, .bottom {
- width: 100%;
- }
- .bottom {
- min-height: 120px;
- background-image: url('../../assets/bottom.png');
- background-size: 100% 100%;
- }
- }
- }
- #hot {
- padding: 0;
- .content {
- margin-top: 30px;
- }
- }
- #wk {
- .content {
- background-color: #FFFFFF;
- }
- }
- #wk, #daliay {
- .content {
- width: 1200px;
- margin: 0 auto;
- background: #fff;
- }
- .content, .top {
- display: flex;
- align-items: center;
- position: relative;
- flex-direction: column;
-
- .htitle {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 93%;
- margin-bottom: 20px;
- .item {
- width: 15%;
- display: flex;
- justify-content: space-between;
- a {
- font-size: 18px;
- line-height: 48px;
- cursor: pointer;
- z-index: 99;
- }
- .clk {
- font-weight: bold;
- color: #07CAAF;
- }
- }
- .tle {
- z-index: 9;
- font-size: 26px;
- font-weight: bold;
- color: #00161C;
- line-height: 48px;
- display: inline-block;
- position: relative;
- text-decoration: none; /* 移除默认的下划线 */
- }
- .tle::after {
- content: '';
- position: absolute;
- left: -5px;
- bottom: 10px;
- width: 110%;
- height: 6px; /* 横线高度为文字高度的一半 */
- background-color: #07CAAF;; /* 横线颜色与文字颜色相同 */
- z-index: -1;
- }
- .el-button {
- font-size: 16px;
- font-weight: bold;
- color: #07CAAF;
- line-height: 48px;
- z-index: 999;
- }
- }
- #hotList {
- //height: 90%;
- //width: 95%;
- display: flex;
- flex-wrap: wrap;
- //justify-content: space-between;
- align-items: center;
- .list {
- display: flex;
- //width: 50%;
- z-index: 999;
- flex-direction: row !important;
- //align-items: center;
- justify-content: center;
- //margin-bottom: 30px;
- width: 500px !important;
- margin: 0 40px 34px 33px;
-
- .txt {
- display: flex;
- flex-direction: column;
- margin-left: 22px;
- align-items: center;
- //justify-content: space-between;
- width: 60%;
- .title {
- text-align: left;
- width: 100%;
- font-size: 18px;
- font-weight: bold;
- color: #010101;
- //line-height: 48px;
- }
- .subtitle{
- //height: 90%;
- display: inline-block;
- text-align: left;
- width: 100%;
- font-size: 14px;
- font-weight: 400;
- color: #000000;
- line-height: 24px;
- margin-top: 10px;
- display: -webkit-box; /* Safari */
- -webkit-line-clamp: 3; /* Safari and Chrome */
- -webkit-box-orient: vertical; /* Safari and Chrome */
- overflow: hidden;
- }
- }
- img {
- width: 200px ;
- height: 150px;
- border-radius: 10px;
- }
- }
- }
- }
- .content::after {
- content: '';
- width: 100%;
- height: 100%;
- position: absolute;
- background-image: url('../../assets/cartxt.png');
- background-position: 100% 0; /* 调整这些值来改变显示的部分 */
- background-size: 10% 50%; /* 使用 'cover' 或 'contain',或者设置具体尺寸 */
- background-repeat: no-repeat;
- }
- }
- #daliay {
- margin-bottom: 30px;
- }
- .gg {
- margin: 0 auto;
- margin-bottom: 30px;
- width: 1200px;
- img {
- width: 100%;
- }
- }
-
- </style>
|