wangguoyu 1 неделя назад
Родитель
Сommit
9b17309543
1 измененных файлов с 26 добавлено и 6 удалено
  1. 26 6
      pages/index.vue

+ 26 - 6
pages/index.vue

@@ -144,16 +144,16 @@
               <img v-else :src="newImage" alt="默认新闻"/>
                 <h4 @click="checkInfo(topCarousels[0])">{{ topCarousels[0].title }}<i></i></h4>
                 <div><b>{{ topCarousels[0].yyyy }}</b><span>{{ topCarousels[0].mmdd }}</span></div>
-                <p>{{ topCarousels[0].intro }}</p>
+                <p v-html="topCarousels[0].content"></p>
             </div>
             <div class="industry-information-right">
               <ul>
                 <li v-for="(item, index) in topCarousels" v-if="index >= 1">
                   <h4 @click="checkInfo(item)">
-                    <a style="display: none" :href="`${baseUrl}/news/${item.code}`"></a>
+                    <a style="display: none" :href="`${baseUrl}/news/${item.id}`"></a>
                     <span>{{ item.yyyy }}</span>{{ item.title }}
                   </h4>
-                  <p><span>{{ item.mmdd}}</span>{{ item.intro }}</p>
+                  <p><span>{{ item.mmdd}}</span><span v-html="item.content"></span></p>
                 </li>
               </ul>
             </div>
@@ -185,16 +185,36 @@
       store.commit('setActiveNav', '/');
 
       let [res1, res2] = await Promise.all([
-                                             await $axios.$post(`/client/web/news/list`, { 'page': 1,'size':6 }).then(res => {
+                                             await $axios.$post(`/common/client/web/news/list`, { 'page': 1,'size':6 }).then(res => {
                                                return res;
                                              }),
-                                             await $axios.$post(`/client/web/home/list`, {}).then(res => {
+                                             await $axios.$post(`/common/client/web/home/list`, {}).then(res => {
                                                return res;
                                              }),
                                            ]);
+
+      console.log(res1.data);
+      console.log(res2.data);
+
+
+      // 处理新闻数据,添加 yyyy 和 mmdd 字段
+      const processedNews = (res1.data?.data || []).map(item => {
+        // 从 createDate 中提取年份和月日
+        const dateStr = item.createDate || '';
+        const dateParts = dateStr.split('-');
+
+        return {
+          ...item,
+          // 提取年份:2026
+          yyyy: dateParts[0] || '',
+          // 提取月日:01-04
+          mmdd: dateParts.length > 1 ? `${dateParts[1]}-${dateParts[2] || ''}` : '',
+        };
+      });
+
       return {
 
-         topCarousels: res1.data||[],
+          topCarousels: processedNews||[],
          bannerList: res2.data||[],
          bannerDefault:require(`~/static/images/website/banner/cx-banner-index.png`),
       };