hookehuyr

✨ feat: 新增相关详情页的key,description字段,seo显示

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-11-05 10:15:58 4 + * @LastEditTime: 2024-12-04 18:16:02
5 * @FilePath: /hager/src/views/news/detail.vue 5 * @FilePath: /hager/src/views/news/detail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -32,12 +32,23 @@ import hagerBox from '@/components/common/hagerBox'; ...@@ -32,12 +32,23 @@ import hagerBox from '@/components/common/hagerBox';
32 import { getNewsDetailAPI } from "@/api/hager.js"; 32 import { getNewsDetailAPI } from "@/api/hager.js";
33 33
34 export default { 34 export default {
35 + // TAG:配置页面meta和标题信息
36 + metaInfo () {
37 + return {
38 + meta: [
39 + { name: 'keyword', content: this.keyword },
40 + { name: 'description', content: this.description
41 + }]
42 + }
43 + },
35 components: { hagerBox }, 44 components: { hagerBox },
36 mixins: [mixin.init], 45 mixins: [mixin.init],
37 data () { 46 data () {
38 return { 47 return {
39 title: '获奖+1!海格电气荣获2023酒店文旅优秀国际标杆品牌', 48 title: '获奖+1!海格电气荣获2023酒店文旅优秀国际标杆品牌',
40 content: '', 49 content: '',
50 + keyword: '',
51 + description: '',
41 } 52 }
42 }, 53 },
43 async mounted () { 54 async mounted () {
...@@ -45,6 +56,8 @@ export default { ...@@ -45,6 +56,8 @@ export default {
45 if (code) { 56 if (code) {
46 this.title = data.post_title; 57 this.title = data.post_title;
47 this.content = data.product_advantages; 58 this.content = data.product_advantages;
59 + this.keyword = data.post_keyword;
60 + this.description = data.post_description;
48 } 61 }
49 }, 62 },
50 methods: { 63 methods: {
......
...@@ -148,6 +148,15 @@ import { MessageBox, Message, Loading } from 'element-ui'; ...@@ -148,6 +148,15 @@ import { MessageBox, Message, Loading } from 'element-ui';
148 import { getProductInfoAPI, getUserInfoAPI, downEmailAPI, downZipAPI } from "@/api/hager.js"; 148 import { getProductInfoAPI, getUserInfoAPI, downEmailAPI, downZipAPI } from "@/api/hager.js";
149 149
150 export default { 150 export default {
151 + // TAG:配置页面meta和标题信息
152 + metaInfo () {
153 + return {
154 + meta: [
155 + { name: 'keyword', content: this.keyword },
156 + { name: 'description', content: this.description
157 + }]
158 + }
159 + },
151 components: { hagerBox, hagerCarousel, hagerH1 }, 160 components: { hagerBox, hagerCarousel, hagerH1 },
152 mixins: [mixin.init], 161 mixins: [mixin.init],
153 data () { 162 data () {
...@@ -160,6 +169,8 @@ export default { ...@@ -160,6 +169,8 @@ export default {
160 is_login: false, 169 is_login: false,
161 is_enable: true, // 产品是否有效 170 is_enable: true, // 产品是否有效
162 is_file: false, // 是否有产品资料 171 is_file: false, // 是否有产品资料
172 + keyword: '',
173 + description: '',
163 } 174 }
164 }, 175 },
165 computed: { 176 computed: {
...@@ -245,6 +256,8 @@ export default { ...@@ -245,6 +256,8 @@ export default {
245 const { code, data } = await getProductInfoAPI( { id: this.$route.query.id }); 256 const { code, data } = await getProductInfoAPI( { id: this.$route.query.id });
246 if (code) { 257 if (code) {
247 this.info = data; 258 this.info = data;
259 + this.keyword = data.post_keyword;
260 + this.description = data.post_description;
248 // 产品是否可用 261 // 产品是否可用
249 this.is_enable = data.product_status === 'publish' ? true : false; 262 this.is_enable = data.product_status === 'publish' ? true : false;
250 if (this.info.file?.img) { 263 if (this.info.file?.img) {
......
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-04 11:18:56 4 + * @LastEditTime: 2024-12-04 11:42:11
5 * @FilePath: /hager/src/views/solution/case.vue 5 * @FilePath: /hager/src/views/solution/case.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -101,6 +101,15 @@ import hagerH1 from '@/components/common/hagerH1.vue'; ...@@ -101,6 +101,15 @@ import hagerH1 from '@/components/common/hagerH1.vue';
101 import { getSolutionDetailAPI } from "@/api/hager.js"; 101 import { getSolutionDetailAPI } from "@/api/hager.js";
102 102
103 export default { 103 export default {
104 + // TAG:配置页面meta和标题信息
105 + metaInfo () {
106 + return {
107 + meta: [
108 + { name: 'keyword', content: this.keyword },
109 + { name: 'description', content: this.description
110 + }]
111 + }
112 + },
104 components: { hagerBox }, 113 components: { hagerBox },
105 mixins: [mixin.init], 114 mixins: [mixin.init],
106 data () { 115 data () {
...@@ -142,6 +151,8 @@ export default { ...@@ -142,6 +151,8 @@ export default {
142 top_banner: '', 151 top_banner: '',
143 text_img: '', 152 text_img: '',
144 case_img: [], 153 case_img: [],
154 + keyword: '',
155 + description: '',
145 } 156 }
146 }, 157 },
147 computed: { 158 computed: {
...@@ -161,6 +172,8 @@ export default { ...@@ -161,6 +172,8 @@ export default {
161 this.top_banner = this.success_info.file?.top_img ? this.success_info.file?.top_img[0]['value'] : ''; 172 this.top_banner = this.success_info.file?.top_img ? this.success_info.file?.top_img[0]['value'] : '';
162 this.text_img = data.file?.left_img ? data.file?.left_img[0]['value'] : ''; 173 this.text_img = data.file?.left_img ? data.file?.left_img[0]['value'] : '';
163 this.case_img = data.file?.img_list ? data.file?.img_list : []; 174 this.case_img = data.file?.img_list ? data.file?.img_list : [];
175 + this.keyword = data.post_keyword;
176 + this.description = data.post_description;
164 } 177 }
165 178
166 this.$nextTick(() => { 179 this.$nextTick(() => {
......