hookehuyr

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

<!--
* @Date: 2024-10-18 12:06:09
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-05 10:15:58
* @LastEditTime: 2024-12-04 18:16:02
* @FilePath: /hager/src/views/news/detail.vue
* @Description: 文件描述
-->
......@@ -32,12 +32,23 @@ import hagerBox from '@/components/common/hagerBox';
import { getNewsDetailAPI } from "@/api/hager.js";
export default {
// TAG:配置页面meta和标题信息
metaInfo () {
return {
meta: [
{ name: 'keyword', content: this.keyword },
{ name: 'description', content: this.description
}]
}
},
components: { hagerBox },
mixins: [mixin.init],
data () {
return {
title: '获奖+1!海格电气荣获2023酒店文旅优秀国际标杆品牌',
content: '',
keyword: '',
description: '',
}
},
async mounted () {
......@@ -45,6 +56,8 @@ export default {
if (code) {
this.title = data.post_title;
this.content = data.product_advantages;
this.keyword = data.post_keyword;
this.description = data.post_description;
}
},
methods: {
......
......@@ -148,6 +148,15 @@ import { MessageBox, Message, Loading } from 'element-ui';
import { getProductInfoAPI, getUserInfoAPI, downEmailAPI, downZipAPI } from "@/api/hager.js";
export default {
// TAG:配置页面meta和标题信息
metaInfo () {
return {
meta: [
{ name: 'keyword', content: this.keyword },
{ name: 'description', content: this.description
}]
}
},
components: { hagerBox, hagerCarousel, hagerH1 },
mixins: [mixin.init],
data () {
......@@ -160,6 +169,8 @@ export default {
is_login: false,
is_enable: true, // 产品是否有效
is_file: false, // 是否有产品资料
keyword: '',
description: '',
}
},
computed: {
......@@ -245,6 +256,8 @@ export default {
const { code, data } = await getProductInfoAPI( { id: this.$route.query.id });
if (code) {
this.info = data;
this.keyword = data.post_keyword;
this.description = data.post_description;
// 产品是否可用
this.is_enable = data.product_status === 'publish' ? true : false;
if (this.info.file?.img) {
......
<!--
* @Date: 2024-10-18 12:06:09
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-04 11:18:56
* @LastEditTime: 2024-12-04 11:42:11
* @FilePath: /hager/src/views/solution/case.vue
* @Description: 文件描述
-->
......@@ -101,6 +101,15 @@ import hagerH1 from '@/components/common/hagerH1.vue';
import { getSolutionDetailAPI } from "@/api/hager.js";
export default {
// TAG:配置页面meta和标题信息
metaInfo () {
return {
meta: [
{ name: 'keyword', content: this.keyword },
{ name: 'description', content: this.description
}]
}
},
components: { hagerBox },
mixins: [mixin.init],
data () {
......@@ -142,6 +151,8 @@ export default {
top_banner: '',
text_img: '',
case_img: [],
keyword: '',
description: '',
}
},
computed: {
......@@ -161,6 +172,8 @@ export default {
this.top_banner = this.success_info.file?.top_img ? this.success_info.file?.top_img[0]['value'] : '';
this.text_img = data.file?.left_img ? data.file?.left_img[0]['value'] : '';
this.case_img = data.file?.img_list ? data.file?.img_list : [];
this.keyword = data.post_keyword;
this.description = data.post_description;
}
this.$nextTick(() => {
......