hookehuyr

feat(news): 添加新闻标题英文显示支持

在新闻详情页添加英文标题显示字段,并调整样式间距
1 <!-- 1 <!--
2 * @Date: 2024-10-18 12:06:09 2 * @Date: 2024-10-18 12:06:09
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-16 10:15:10 4 + * @LastEditTime: 2025-08-06 09:55:51
5 * @FilePath: /hager/src/views/news/detail.vue 5 * @FilePath: /hager/src/views/news/detail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
21 </hager-box> 21 </hager-box>
22 <hager-box> 22 <hager-box>
23 <div class="news-title">{{ title }}</div> 23 <div class="news-title">{{ title }}</div>
24 + <div class="news-title-en">{{ title_en }}</div>
24 <div :class="['news-content', is_xs ? 'xs' : '']" v-html="content"></div> 25 <div :class="['news-content', is_xs ? 'xs' : '']" v-html="content"></div>
25 </hager-box> 26 </hager-box>
26 </div> 27 </div>
...@@ -46,6 +47,7 @@ export default { ...@@ -46,6 +47,7 @@ export default {
46 data () { 47 data () {
47 return { 48 return {
48 title: '获奖+1!海格电气荣获2023酒店文旅优秀国际标杆品牌', 49 title: '获奖+1!海格电气荣获2023酒店文旅优秀国际标杆品牌',
50 + title_en: '',
49 content: '', 51 content: '',
50 keyword: '', 52 keyword: '',
51 description: '', 53 description: '',
...@@ -55,6 +57,7 @@ export default { ...@@ -55,6 +57,7 @@ export default {
55 const { code, data } = await getNewsDetailAPI({ id: this.$route.params.id }); 57 const { code, data } = await getNewsDetailAPI({ id: this.$route.params.id });
56 if (code) { 58 if (code) {
57 this.title = data.post_title; 59 this.title = data.post_title;
60 + this.title_en = data.post_title_en;
58 this.content = data.product_advantages; 61 this.content = data.product_advantages;
59 this.keyword = data.post_keyword ? data.post_keyword : 'hager 海格电气 新闻'; 62 this.keyword = data.post_keyword ? data.post_keyword : 'hager 海格电气 新闻';
60 this.description = data.post_description ? data.post_description : data.post_title; 63 this.description = data.post_description ? data.post_description : data.post_title;
...@@ -89,7 +92,15 @@ export default { ...@@ -89,7 +92,15 @@ export default {
89 text-align: center; 92 text-align: center;
90 font-size: 1.75rem; 93 font-size: 1.75rem;
91 font-weight: bold; 94 font-weight: bold;
92 - margin: 3rem 0; 95 + margin: 3rem 0 0 0;
96 + }
97 +
98 + .news-title-en {
99 + color: @primary-color;
100 + text-align: center;
101 + font-size: 1.2rem;
102 + font-weight: bold;
103 + margin: 0 0 2rem 0;
93 } 104 }
94 105
95 :deep(.news-content) { 106 :deep(.news-content) {
......