跳转详情

master
fuxiaochun 2023-08-17 13:25:31 +08:00
parent 40c4bb38ce
commit 1fe539d5e5
3 changed files with 22 additions and 16 deletions

View File

@ -15,11 +15,11 @@
</div>
<ul class="menu">
<li :class="{ active: route.meta.group === 'home' }" @click="jump('/')"></li>
<li>AI助</li>
<li :class="{ active: route.meta.group === 'chat' }" @click="jump('/chat')">AI</li>
<li :class="{ active: route.meta.group === 'business' }" @click="jump('/business')">AI</li>
<li>AI传播</li>
<li>AI献策</li>
<li :class="{ active: route.meta.group === 'vip' }">会员服</li>
<li :class="{ active: route.meta.group === 'vip' }" @click="jump('/vip')"></li>
<li :class="{ active: route.meta.group === 'ucenter' }" @click="jump('/ucenter/userinfo')"></li>
<li @click="onLogout">退</li>
</ul>

View File

@ -51,6 +51,8 @@ const dataList = ref([]);
const placeholder = ref('');
const hasMore = ref(false);
console.log(props);
onMounted(()=>{
getList();
});
@ -81,10 +83,15 @@ const loadMore = ()=>{
const goDetail = (id) => {
let path = {
government: `/business/legal/policy/detail/${id}`, // -
business: `/business/insight/detail/${props.cid}/${id}`, //
policy: `/business/legal/policy/detail/${id}`, // -
};
router.push(path[props.type]);
if(path[props.type]){
router.push(path[props.type]);
}else{
console.log('无此类型详情页路由跳转配置:'+props.type);
}
};

View File

@ -3,17 +3,17 @@
</template>
<script setup>
import { ref, onBeforeMount, onMounted } from 'vue';
import { ref, onBeforeMount, onMounted, onUpdated } from 'vue';
import http from '@/io/http';
import { showToast } from 'vant';
import { useRoute } from 'vue-router';
import ArticleDetail from '@/components/ArticleDetail/index.vue';
const breadNav = [
const breadNav = ref([
{ path: '/', name: '首页' },
{ path: '/business', name: 'AI商情' },
{ path: '/business/insight', name: '行业洞察' },
];
]);
const route = useRoute();
const id = ref(route.params.id);
@ -22,18 +22,17 @@ onBeforeMount(()=>{
getDetail();
});
// const getCategories = () => {
// let params = { type_key: 'business' };
// http('/api/keywords', params, 'get').then(res => {
// category.value = res.data.filter(v => v.id == cid.value)[0];
// }).catch(err => {
// showToast(err.message);
// });
// };
const getDetail = () => {
http(`/api/article/${id.value}`, {}, 'get').then(res => {
console.log(res.data);
http(`/api/article/${id.value}`, {}, 'get', {isLoading: false}).then(res => {
let tempNav = [...breadNav.value];
let cid = res.data.category_id;
res.data.category_path.forEach(v=>{
if(v.id == cid){
tempNav.push({path: `/business/insight/category/${cid}`, name: v.name});
}
});
breadNav.value = tempNav;
}).catch(err => {
// showToast(err.message);
});