Compare commits

..

2 Commits

Author SHA1 Message Date
fuxiaochun 8bf6756bb0 Merge branch 'master' of https://gitea.hmily.club/haitu/aigc-h5 2023-08-21 22:42:00 +08:00
fuxiaochun fe4d094b17 优化title 2023-08-21 22:41:51 +08:00
4 changed files with 47 additions and 9 deletions

View File

@ -42,12 +42,15 @@
</template>
<script setup>
import { ref, onBeforeMount, onMounted } from 'vue';
import { ref, onBeforeMount, onMounted, onBeforeUnmount } from 'vue';
import http from '@/io/http';
import { showToast } from 'vant';
import { useRouter, useRoute } from 'vue-router';
import { DateFormat } from '@/utils/format.js';
import AiAssistantFolat from '@/views/chat/components/ai-assistant-float.vue';
import { useWebsite } from '@/stores/website';
const website = useWebsite();
const props = defineProps({
id: {type: [Number, String], required: true },
@ -68,10 +71,14 @@ onMounted(() => {
props.isRecommend && getRecommendList();
});
onBeforeUnmount(()=>{
website.setPageTitle();
});
const getDetail = () => {
http(`/api/article/${id.value}`, {}, 'get').then(res => {
detail.value = res.data;
// website.setPageTitle(res.data.title);
}).catch(err => {
showToast(err.message);
if(err.status == 1001){

View File

@ -78,7 +78,7 @@ const router = createRouter({
path: "/business/macroeconomics/detail/:id",
name: "MacroeconomicsDetail",
meta: {
title: "宏观政经",
title: "内容详情",
group: 'business'
},
component: () => import("@/views/business/macroeconomics/detail.vue"),
@ -114,7 +114,7 @@ const router = createRouter({
path: 'business/insight/detail/:id',
name: 'insightDetail',
meta: {
title: '行业洞察',
title: '内容详情',
group: 'business'
},
component: () => import("@/views/business/insight/detail.vue"),
@ -141,7 +141,7 @@ const router = createRouter({
path: 'business/legal/policy/detail/:id',
name: 'policyDetail',
meta: {
title: '政策解读',
title: '内容详情',
group: 'business'
},
component: () => import("@/views/business/legal/policyDetail.vue"),
@ -159,7 +159,7 @@ const router = createRouter({
path: 'business/legal/country/detail/:id',
name: 'countryDetail',
meta: {
title: '国别地区指南',
title: '国家地区指南详情',
group: 'business'
},
component: () => import("@/views/business/legal/countryInfo.vue"),

View File

@ -42,17 +42,19 @@
</template>
<div class="loadingBox" v-else>...</div>
</div>
<!-- <AiAssistant></AiAssistant> -->
<template v-if="aiContent">
<AiAssistantFolat :content="aiContent"></AiAssistantFolat>
</template>
</div>
</template>
<script setup>
import { ref, onBeforeMount, onMounted } from 'vue';
import { ref, onBeforeMount, onMounted, computed } from 'vue';
import http from '@/io/http';
import { showToast } from 'vant';
import { useRouter, useRoute } from 'vue-router';
import { DateFormat } from '@/utils/format.js';
// import AiAssistant from '@/views/chat/components/ai-assistant.vue';
import AiAssistantFolat from '@/views/chat/components/ai-assistant-float.vue';
const router = useRouter();
const route = useRoute();
@ -67,6 +69,20 @@ onMounted(() => {
getDetail();
});
const aiContent = computed(() => {
let contentText = '';
if (Array.isArray(curSectionData.value) && curSectionData.value.length) {
curSectionData.value.forEach(v => {
if (v.type == 'image') {
contentText += `<img src="${v.value}">`;
} else if (v.type == 'text') {
contentText += `<p>${v.value}</p>`;
}
});
}
return contentText;
});
const getDetail = () => {
http(`/api/country/${id.value}`, {}, 'get').then(res => {
detail.value = res.data;

View File

@ -13,11 +13,12 @@
</template>
<script setup>
import { ref, onBeforeMount, onMounted, onUpdated, watch } from 'vue';
import { ref, onBeforeMount, onMounted, onUpdated, watch, onBeforeUnmount } from 'vue';
import http from '@/io/http';
import { showToast } from 'vant';
import { useRouter, useRoute } from 'vue-router';
import CardList from '../components/CategoryCardList.vue';
import { useWebsite } from '@/stores/website';
const router = useRouter()
const route = useRoute()
@ -25,12 +26,14 @@ const parent_id = ref(route.params.pid);
const cid = ref(0);
const banner = ref();
const categories = ref([]);
const website = useWebsite();
const type = ref('government')
onBeforeMount(() => {
getBanner();
getCategories();
getCategoryInfo();
});
const getBanner = () => {
@ -51,6 +54,18 @@ const getCategories = () => {
});
};
const getCategoryInfo = ()=>{
http('/api/keywords/'+parent_id.value, {}, 'get').then(res => {
website.setPageTitle(res.data.name);
}).catch(err => {
showToast(err.message);
});
};
onBeforeUnmount(()=>{
website.setPageTitle('');
});
const changeCategory = (val) => {
cid.value = val;
};