Merge branch 'master' of https://gitea.hmily.club/haitu/aigc-h5
commit
34d87f99b9
|
|
@ -34,8 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="detail">
|
<template v-if="detail">
|
||||||
<AiAssistantFolat></AiAssistantFolat>
|
<AiAssistantFolat :content="detail.content"></AiAssistantFolat>
|
||||||
<AiAssistant :content="detail.content"></AiAssistant>
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -47,7 +46,6 @@ import { showToast } from 'vant';
|
||||||
import { useRouter, useRoute } from 'vue-router';
|
import { useRouter, useRoute } from 'vue-router';
|
||||||
import { DateFormat } from '@/utils/format.js';
|
import { DateFormat } from '@/utils/format.js';
|
||||||
import AiAssistantFolat from '@/views/chat/components/ai-assistant-float.vue';
|
import AiAssistantFolat from '@/views/chat/components/ai-assistant-float.vue';
|
||||||
import AiAssistant from '@/views/chat/components/ai-assistant.vue'
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: {type: [Number, String], required: true },
|
id: {type: [Number, String], required: true },
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ const userInfo = useUserInfo();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const authModal = useAuthModal();
|
const authModal = useAuthModal();
|
||||||
|
const timer = ref(0);
|
||||||
|
|
||||||
const showMenu = ref(false);
|
const showMenu = ref(false);
|
||||||
|
|
||||||
|
|
@ -70,8 +71,38 @@ onMounted(()=>{
|
||||||
if (userInfoData.id) {
|
if (userInfoData.id) {
|
||||||
userInfo.updateUserInfo(userInfoData);
|
userInfo.updateUserInfo(userInfoData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let authData = localCache.get('auth') || {};
|
||||||
|
if (authData.expires_time) {
|
||||||
|
checkToken();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const checkToken = () => {
|
||||||
|
let diffTime = 1000 * 60 * 10; // 10mins
|
||||||
|
let nowTime = Date.now();
|
||||||
|
let authData = localCache.get('auth') || {};
|
||||||
|
let overTime = authData.expires_time || nowTime;
|
||||||
|
if (overTime - nowTime <= diffTime) {
|
||||||
|
clearTimeout(timer.value);
|
||||||
|
flushtoken();
|
||||||
|
} else {
|
||||||
|
timer.value = setTimeout(checkToken, 300000); //300000
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const flushtoken = () => {
|
||||||
|
http('/api/auth/refresh', {}).then(res => {
|
||||||
|
let nowTime = Date.now();
|
||||||
|
let overTime = nowTime + res.data.expires_in * 1000;
|
||||||
|
let authData = { ...res.data, expires_time: overTime };
|
||||||
|
localCache.set('auth', authData);
|
||||||
|
checkToken();
|
||||||
|
}).catch(err => {
|
||||||
|
showToast(err.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const toggleMenu = ()=>{
|
const toggleMenu = ()=>{
|
||||||
showMenu.value = !showMenu.value;
|
showMenu.value = !showMenu.value;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ const router = createRouter({
|
||||||
component: () => import("@/views/business/insight/list.vue"),
|
component: () => import("@/views/business/insight/list.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'business/insight/detail/:cid/:id',
|
path: 'business/insight/detail/:id',
|
||||||
name: 'insightDetail',
|
name: 'insightDetail',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'AI商情-行业洞察',
|
title: 'AI商情-行业洞察',
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@
|
||||||
<template v-if="dataList.length > 0">
|
<template v-if="dataList.length > 0">
|
||||||
<ul>
|
<ul>
|
||||||
<li :key="item.id" v-for="item in dataList" @click="goDetail(item.id)">
|
<li :key="item.id" v-for="item in dataList" @click="goDetail(item.id)">
|
||||||
<img :src="item.cover" :alt="item.title">
|
<div class="img">
|
||||||
|
<img :src="item.cover" :alt="item.title">
|
||||||
|
</div>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<h2>{{ item.title }}</h2>
|
<h2>{{ item.title }}</h2>
|
||||||
<span>{{ DateFormat(new Date(item.published_at * 1000), 'yyyy.MM.dd') }}</span>
|
<span>{{ DateFormat(new Date(item.published_at * 1000), 'yyyy.MM.dd') }}</span>
|
||||||
|
|
@ -51,8 +53,6 @@ const dataList = ref([]);
|
||||||
const placeholder = ref('');
|
const placeholder = ref('');
|
||||||
const hasMore = ref(false);
|
const hasMore = ref(false);
|
||||||
|
|
||||||
console.log(props);
|
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
|
@ -84,7 +84,7 @@ const loadMore = ()=>{
|
||||||
const goDetail = (id) => {
|
const goDetail = (id) => {
|
||||||
let path = {
|
let path = {
|
||||||
government: `/business/macroeconomics/detail/${id}`, // 宏观正经-内容详情页
|
government: `/business/macroeconomics/detail/${id}`, // 宏观正经-内容详情页
|
||||||
business: `/business/insight/detail/${props.cid}/${id}`, // 行业洞察详情页
|
business: `/business/insight/detail/${id}`, // 行业洞察详情页
|
||||||
policy: `/business/legal/policy/detail/${id}`, // 法律法规-政策解读详情页
|
policy: `/business/legal/policy/detail/${id}`, // 法律法规-政策解读详情页
|
||||||
};
|
};
|
||||||
if(path[props.type]){
|
if(path[props.type]){
|
||||||
|
|
@ -114,11 +114,19 @@ const goDetail = (id) => {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
color: #333;
|
color: #333;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
img{
|
.img{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 264px;
|
height: 264px;
|
||||||
display: block;
|
|
||||||
background-color: #666;
|
background-color: #666;
|
||||||
|
overflow: hidden;
|
||||||
|
img{
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
background-color: #666;
|
||||||
|
&[src='']{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.title{
|
.title{
|
||||||
height: 80px;
|
height: 80px;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue