diff --git a/packages/blog-view/src/components/old/base/MyArticalCard.vue b/packages/blog-view/src/components/old/base/MyArticalCard.vue index b419c8b5cb75edfa1e337145b267ab0a9038ab55..b8b97a69d318765c38ee794cc2d0fc3c13ce9ccf 100644 --- a/packages/blog-view/src/components/old/base/MyArticalCard.vue +++ b/packages/blog-view/src/components/old/base/MyArticalCard.vue @@ -9,7 +9,7 @@
{{username}}
-
{{date}}
+
{{date}}
{ const date = new Date(item.article.datetime) - let nowtime = this.$moment(date).format('YYYY-MM-DD hh:mm:ss') + let nowtime = this.$moment(date).format('YYYY-MM-DD HH:mm:ss') let time = this.setTime(nowtime) return { time: time, @@ -145,7 +145,7 @@ export default { setTime (date) { console.log(date) const nowdate = new Date() - let time = this.$moment(nowdate).format('YYYY-MM-DD hh:mm:ss') + let time = this.$moment(nowdate).format('YYYY-MM-DD HH:mm:ss') let newyear = this.$moment(nowdate).format('YYYY') let oldyear = this.$moment(date).format('YYYY') let oldManth = this.$moment(date).format('MM') @@ -157,18 +157,18 @@ export default { } if (newyear == oldyear) { if (oldManth < newManth) { - return this.$moment(date).format('MM-DD') + return this.$moment(date).format('MM-DD HH:mm') } else{ if (oldDay < newDay) { let diffvalue = newDay - oldDay if (diffvalue <= 1) { - return '昨日' + return `昨日${this.$moment(date).format('HH:mm')}` } else { - return this.$moment(date).format('MM-DD') + return this.$moment(date).format('MM-DD HH:mm') } } else if (oldDay == newDay) { - // return `今日${this.$moment(date).format('hh:mm')}` - return `今日` + return `今日${this.$moment(date).format('HH:mm')}` + // return `今日` } } } diff --git a/packages/blog-view/src/pages/Home.vue b/packages/blog-view/src/pages/Home.vue index 09cd6a5e46bb9b6d3512e1389b2e2d7391364a2c..d9523aef1797ad11ec39ed1b40c0c9c2f1e78af7 100644 --- a/packages/blog-view/src/pages/Home.vue +++ b/packages/blog-view/src/pages/Home.vue @@ -91,7 +91,7 @@ export default { if (data.code === 200) { this.topiclist = data.data.map(item => { const date = new Date(item.article.datetime) - let nowtime = this.$moment(date).format('YYYY-MM-DD hh:mm:ss') + let nowtime = this.$moment(date).format('YYYY-MM-DD HH:mm:ss') let time = this.setTime(nowtime) return { time: time, @@ -111,7 +111,7 @@ export default { // 获取时间 setTime (date) { const nowdate = new Date() - let time = this.$moment(nowdate).format('YYYY-MM-DD hh:mm:ss') + let time = this.$moment(nowdate).format('YYYY-MM-DD HH:mm:ss') let newyear = this.$moment(nowdate).format('YYYY') let oldyear = this.$moment(date).format('YYYY') let oldManth = this.$moment(date).format('MM') @@ -123,18 +123,18 @@ export default { } if (newyear == oldyear) { if (oldManth < newManth) { - return this.$moment(date).format('MM-DD') + return this.$moment(date).format('MM-DD HH:mm') } else { if (oldDay < newDay) { let diffvalue = newDay - oldDay if (diffvalue <= 1) { - return '昨日' + return `昨日${this.$moment(date).format('HH:mm')}` } else { - return this.$moment(date).format('MM-DD') + return this.$moment(date).format('MM-DD HH:mm') } } else if (oldDay == newDay) { - // return `今日${this.$moment(date).format('hh:mm')}` - return `今日` + return `今日${this.$moment(date).format('HH:mm')}` + // return `今日` } } }