Selaa lähdekoodia

修改时间显示

jwyu 2 vuotta sitten
vanhempi
commit
9b0b04edd4

+ 1 - 1
mixin/index.js

@@ -50,7 +50,7 @@ module.exports = {
      * 报告时间格式化
      */
     formatReportTime(e){
-      return moment(e).format('YYYY-MM-DD HH:mm:ss')
+      return moment(e).format('YYYY.MM.DD HH:mm')
     }
 
   },

+ 1 - 1
pages-report/reportList.vue

@@ -11,7 +11,7 @@
     </van-sticky>
     <view class="report-empty-box" v-if="finished&&list.length==0">
       <image :src="globalImgUrls.chartEmpty" mode="widthFix" />
-      <view>找不到对应报告,试试别的搜索词吧</view>
+      <view>{{searchVal?'找不到对应报告,试试别的搜索词吧':'暂无报告'}}</view>
     </view>
     <view class="report-list-wrap" :style="{paddingBottom:showAudioPop&&'90px'}" v-else>
       <view class="flex item" v-for="item in list" :key="item.report_id" @click="goReportDetail(item)">

+ 8 - 1
pages-report/search.vue

@@ -23,7 +23,7 @@
                         <text v-if="item.classify_name_first">#{{item.classify_name_first}}</text>
                         <text v-if="item.classify_name_second">#{{item.classify_name_second}}</text>
                     </view>
-                    <view class="time">{{item.publish_time|formatReportTime}}</view>
+                    <view class="time">{{getReportListTime(item.publish_time)}}</view>
                 </view>
             </view>
         </view>
@@ -31,6 +31,8 @@
 </template>
 
 <script>
+const moment=require('@/utils/moment-with-locales.min')
+moment.locale('zh-cn');
 import searchBox from './components/searchBox.vue'
 import {apiReportSearch} from '@/api/report'
 export default {
@@ -88,6 +90,10 @@ export default {
             }else{
                 uni.navigateTo({url:'/pages-report/reportDetail?reportId='+item.report_id})
             }
+        },
+
+        getReportListTime(e){
+            return moment(e).format('YYYY年MM月DD日 HH:mm')
         }
     }
 }
@@ -132,6 +138,7 @@ page{
         }
         .bot{
             justify-content: space-between;
+            align-items: flex-end;
             .time{
                 flex-shrink: 0;
                 color: #999999;

+ 1 - 0
pages-report/specialColumn/detail.vue

@@ -286,6 +286,7 @@ page{
                 .tips{
                     color: #666666;
                     margin-bottom: 10rpx;
+                    min-height: 38rpx;
                 }
                 .time{
                     color: #666666;

+ 11 - 1
pages/report/report.vue

@@ -35,7 +35,7 @@
     </view>
     <view class="list-wrap" v-else>
       <view class="list-item" v-for="item in list" :key="item.date">
-        <view class="time">{{item.date}}</view>
+        <view class="time">{{getReportListDate(item.date)}}</view>
         <view class="content-list">
           <view class="content-item" v-for="citem in item.sub_list" :key="citem.report_id">
             <view class="content-box" @click="goDetail(citem)">
@@ -256,6 +256,16 @@ export default {
           this.authData.show=false
         }
       });
+    },
+
+    //设置列表日期显示
+    getReportListDate(e){
+      const isSameYear=moment(e).isSame(new Date(), 'year');
+      if(isSameYear){//今年
+        return moment(e).format('MM.DD')+' '+ moment(e).format('ddd')
+      }else{
+        return moment(e).format('YY.MM.DD')+' '+moment(e).format('ddd')
+      }
     }
   }
 }