Browse Source

时间格式化

lrf 8 months ago
parent
commit
adc4df7f44
2 changed files with 8 additions and 4 deletions
  1. 7 3
      src/views/detail/news.vue
  2. 1 1
      src/views/one/index.vue

+ 7 - 3
src/views/detail/news.vue

@@ -3,8 +3,8 @@
     <el-col :span="24" class="one" v-loading="loading">
       <div class="w_1300">
         <el-col :span="24" class="one_1">
-          <h2 class="name">双高新闻资讯</h2>
-          <h5 class="remark">跟紧政策指引方向 &nbsp;&nbsp;&nbsp; 抓牢各地双高机遇</h5>
+          <!-- <h2 class="name">双高新闻资讯</h2> -->
+          <!-- <h5 class="remark">跟紧政策指引方向 &nbsp;&nbsp;&nbsp; 抓牢各地双高机遇</h5> -->
           <div class="search">
             <el-input v-model="searchForm.title" size="large" placeholder="请输入关键字" :suffix-icon="Search">
               <template #append>
@@ -38,7 +38,7 @@
                     <div v-html="removeHtmlStyle(item.content)"></div>
                   </el-col>
                   <el-col :span="24" class="right_3">
-                    {{ item.time || '暂无' }}
+                    {{ getDate(item.time) || '暂无' }}
                   </el-col>
                 </el-col>
               </el-col>
@@ -91,6 +91,7 @@
 
 <script setup>
 // 接口
+import moment from 'moment'
 import { NewsStore } from '@/store/api/platform/news'
 import { AchievementStore } from '@/store/api/platform/achievement'
 import { ProjectStore } from '@/store/api/platform/project'
@@ -196,6 +197,9 @@ const sizeChange = (limits) => {
 const getUrl = (item) => {
   if (item && item.length > 0) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
 }
+const getDate = (item) => {
+  if (item && moment(item).isValid()) return moment(item).format('YYYY-MM-DD')
+}
 </script>
 <style scoped lang="scss">
 .main {

+ 1 - 1
src/views/one/index.vue

@@ -26,7 +26,7 @@
         <div class="two_1" @click="toComon('/thr', '1')">
           <el-image class="image" :src="bg_4" fit="fill" />
           <div class="content">
-            <div class="name">需库</div>
+            <div class="name">需库</div>
             <div class="english">DEMAND LIBRARY</div>
           </div>
         </div>