|
@@ -1,21 +1,10 @@
|
|
|
<template>
|
|
|
<div class="contentBody">
|
|
|
- <van-list
|
|
|
- v-model="loading"
|
|
|
- :finished="finished"
|
|
|
- finished-text="没有更多了"
|
|
|
- @load="onLoad"
|
|
|
- >
|
|
|
+ <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
|
|
|
<template>
|
|
|
<van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
|
|
|
<van-swipe-item v-for="(item, index) in swiperList" :key="index">
|
|
|
- <van-image
|
|
|
- width="100%"
|
|
|
- height="100%"
|
|
|
- fit="cover"
|
|
|
- :src="item.url"
|
|
|
- :show-error="true"
|
|
|
- />
|
|
|
+ <van-image width="100%" height="100%" fit="cover" :src="item.url" :show-error="true" />
|
|
|
</van-swipe-item>
|
|
|
</van-swipe>
|
|
|
</template>
|
|
@@ -27,20 +16,18 @@
|
|
|
<div slot="default" class="contentItemDiv" v-if="contentItem">
|
|
|
<div class="contentItemTitleTitleRow">
|
|
|
<div class="contentItemTitle">{{ contentItem.name }}</div>
|
|
|
- <div v-if="contentItem.isNeedStudyToday" class="contentItemstates">
|
|
|
- 今日必学
|
|
|
- </div>
|
|
|
+ <div v-if="contentItem.isNeedStudyToday" class="contentItemstates">今日必学</div>
|
|
|
</div>
|
|
|
<div class="contentItemDescription">
|
|
|
<div class="contentItemDescriptionTime">
|
|
|
{{
|
|
|
- formateDatesFun(contentItem.createdTime) ||
|
|
|
- contentItem.createdTime
|
|
|
+ formateDatesFun(contentItem.createdTime) ||
|
|
|
+ contentItem.createdTime
|
|
|
}}
|
|
|
</div>
|
|
|
<div class="contentItemDescriptionStudyNeedTime">
|
|
|
所需学习时间:{{
|
|
|
- getTimeHoursMinuteSecondsFun(contentItem.readTimeInSec)
|
|
|
+ getTimeHoursMinuteSecondsFun(contentItem.readTimeInSec)
|
|
|
}}
|
|
|
</div>
|
|
|
</div>
|
|
@@ -68,23 +55,15 @@ export default {
|
|
|
computed: {},
|
|
|
created() {
|
|
|
this.getNewsfeed();
|
|
|
- this.checkTodabTag();
|
|
|
},
|
|
|
mounted() {},
|
|
|
watch: {},
|
|
|
methods: {
|
|
|
- checkTodabTag(tags) {
|
|
|
- let current = new Date();
|
|
|
- let todayStr = current.toLocaleDateString().replace(/\//g, "");
|
|
|
- console.log(todayStr);
|
|
|
- },
|
|
|
// 查询子目录
|
|
|
getNewsfeed() {
|
|
|
this.$_http
|
|
|
.get(this.$_API.JTXT_GET_NEWSFEED)
|
|
|
.then(res => {
|
|
|
- console.log("--newsfeed-");
|
|
|
- console.log(res);
|
|
|
this.formatNeedStudyTodayFun(res.data);
|
|
|
this.finished = true;
|
|
|
})
|
|
@@ -94,10 +73,18 @@ export default {
|
|
|
},
|
|
|
// 判断是否今日必学
|
|
|
formatNeedStudyTodayFun(datas) {
|
|
|
+ let date = new Date();
|
|
|
+ let year = date.getFullYear();
|
|
|
+ let month = date.getMonth() + 1;
|
|
|
+ month = month >= 10 ? "" + month : "0" + month;
|
|
|
+ let day = date.getDate();
|
|
|
+ let todayStr = year + month + day;
|
|
|
datas.forEach(item => {
|
|
|
- if (item && item.tags.length > 0) {
|
|
|
- item.isNeedStudyToday = true;
|
|
|
- }
|
|
|
+ item.tags.forEach(itemChild => {
|
|
|
+ if (itemChild === todayStr) {
|
|
|
+ item.isNeedStudyToday = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
this.contentList = datas;
|
|
|
},
|