|
|
|
@ -1,18 +1,21 @@ |
|
|
|
<script lang='ts' setup> |
|
|
|
import { useUserStore } from "@/store/modules/user" |
|
|
|
import { ref, watch } from 'vue' |
|
|
|
import { getUserDetail, getZxxyNavis, getTuijian } from '@/api/knowledge/index' |
|
|
|
import { getTuijian } from '@/api/knowledge/index' |
|
|
|
import KnowledgeContent from '@/views/knowledge/knowledge/components/KnowledgeContent.vue' |
|
|
|
import { UserQuery, UserDetail, NaviQuery, Navi, Graphicform, PageParam } from '@/api/knowledge/types' |
|
|
|
import { UserDetail, NaviQuery, Navi, Graphicform, PageParam, ShowTitle } from '@/api/knowledge/types' |
|
|
|
import { formatDate } from '@/api/knowledge/scroll' |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
import errimg from '@/assets/404_images/imgNotFound.png' |
|
|
|
import { useKnowledgeStore } from "@/store/modules/knowledge" |
|
|
|
|
|
|
|
const showArea = ref(true); |
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
|
liContent: { |
|
|
|
type: Object, |
|
|
|
|
|
|
|
}, |
|
|
|
routerUrl:{ |
|
|
|
routerUrl: { |
|
|
|
type: String, |
|
|
|
}, |
|
|
|
|
|
|
|
@ -27,14 +30,12 @@ const props = defineProps({ |
|
|
|
fatherisReady: { |
|
|
|
type: Number, |
|
|
|
default: 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
const userStore = useUserStore(); |
|
|
|
const { userKey, userToken } = userStore; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const userDetail = ref<UserDetail>({ |
|
|
|
//证件号码 |
|
|
|
idcardno: ["1", "2"], |
|
|
|
@ -51,15 +52,12 @@ const userDetail = ref<UserDetail>({ |
|
|
|
}); |
|
|
|
const tuijianPage = ref<Graphicform[]>(); |
|
|
|
|
|
|
|
/* const naviList = ref<Navi[]>(); */ |
|
|
|
/* //用户信息查询参数 |
|
|
|
const userQueryParam = reactive<UserQuery>({ |
|
|
|
userkey: userKey, |
|
|
|
usertoken: userToken, |
|
|
|
}); */ |
|
|
|
|
|
|
|
//navi查询参数 |
|
|
|
const naviQueryParam = reactive<NaviQuery>({ |
|
|
|
atParentId: "",//知识库 |
|
|
|
userkey: userKey, |
|
|
|
usertoken: userToken, |
|
|
|
}); |
|
|
|
const pageParamTuijian = reactive<PageParam>({ |
|
|
|
total: 0, |
|
|
|
@ -81,16 +79,8 @@ function errorImg(e: any) { |
|
|
|
//这一句没用,如果默认图片的路径错了还是会一直闪屏,在方法的前面加个.once只让它执行一次也没用 |
|
|
|
e.srcElement.onerror = null; //防止闪图 |
|
|
|
} |
|
|
|
onMounted(() => { |
|
|
|
|
|
|
|
//console.log(props.liContent?.gParentSun) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
watch(() => [props.fatherisReady, props.liContent,props.routerUrl], (newVal, oldVal) => { |
|
|
|
watch(() => [props.fatherisReady, props.liContent, props.routerUrl], (newVal, oldVal) => { |
|
|
|
//console.log(newVal, oldVal); // [11, 22], [1, 2] |
|
|
|
const routerUrl = oldVal[2] as String; |
|
|
|
const liContent = newVal[1] as any; |
|
|
|
@ -107,49 +97,37 @@ watch(() => [props.fatherisReady, props.liContent,props.routerUrl], (newVal, old |
|
|
|
} |
|
|
|
|
|
|
|
pageParamTuijian.gParentSun = liContent.atId; |
|
|
|
//console.log(pageParamTuijian.gParentSun) |
|
|
|
//推荐 |
|
|
|
if (props.liContent?.hasCard == true) { |
|
|
|
//console.log(props.liContent?.hasCard) |
|
|
|
getTuijian(pageParamTuijian) |
|
|
|
.then(({ data }) => { |
|
|
|
tuijianPage.value = data.list |
|
|
|
//console.log(tuijianPage.value) |
|
|
|
pageParamTuijian.page = data.pageNum |
|
|
|
pageParamTuijian.total = data.total |
|
|
|
if(pageParamTuijian.total>0){ |
|
|
|
if (pageParamTuijian.total > 0) { |
|
|
|
showCards.value = 1; |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}) |
|
|
|
const KnowledgeStore = useKnowledgeStore(); |
|
|
|
|
|
|
|
|
|
|
|
if (tuijianPage.value.length > 0) { |
|
|
|
//本标题下有数据 |
|
|
|
KnowledgeStore.$patch((state) => { |
|
|
|
state.knowledgeTitlesShow.push({ atIdAndGParentSun: liContent.atId, hasCard: true }) |
|
|
|
}) |
|
|
|
showArea.value = true; |
|
|
|
} else { |
|
|
|
KnowledgeStore.$patch((state) => { |
|
|
|
state.knowledgeTitlesShow.push({ atIdAndGParentSun: liContent.atId, hasCard: false }) |
|
|
|
|
|
|
|
/* watch(props.fatherisReady, (value) => { |
|
|
|
console.log(props); |
|
|
|
//childList.value = nweProps.listData |
|
|
|
let router = useRouter() |
|
|
|
let routerUrl = toRaw(router).currentRoute.value.fullPath |
|
|
|
console.log(routerUrl) |
|
|
|
if (routerUrl.endsWith("index")) {//此时页面为知识库 |
|
|
|
naviQueryParam.atParentId = '16213848089876281' |
|
|
|
pageParamTuijian.archivesTypeAtParentId = '16213848089876281' |
|
|
|
} else if (routerUrl.endsWith("news")) {//此时页面为新闻资讯 |
|
|
|
naviQueryParam.atParentId = '16213847972425134' |
|
|
|
pageParamTuijian.archivesTypeAtParentId = '16213847972425134' |
|
|
|
}) |
|
|
|
//showArea.value = false; |
|
|
|
} |
|
|
|
|
|
|
|
pageParamTuijian.gParentSun = props.liContent?.gParentSun; |
|
|
|
//推荐 |
|
|
|
getTuijian(pageParamTuijian) |
|
|
|
.then(({ data }) => { |
|
|
|
tuijianPage.value = data.list |
|
|
|
pageParamTuijian.page = data.pageNum |
|
|
|
pageParamTuijian.total = data.total |
|
|
|
console.log(tuijianPage.value) |
|
|
|
}); |
|
|
|
|
|
|
|
}) */ |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
function handleCurrentChange() { |
|
|
|
|
|
|
|
@ -158,8 +136,6 @@ function handleCurrentChange() { |
|
|
|
tuijianPage.value = data.list |
|
|
|
pageParamTuijian.page = data.pageNum |
|
|
|
pageParamTuijian.total = data.total |
|
|
|
|
|
|
|
console.log(tuijianPage.value) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@ -169,11 +145,12 @@ const showCards = ref(0) |
|
|
|
|
|
|
|
//dialog |
|
|
|
const cardContentSource = ref<Graphicform>({}); |
|
|
|
const showContentBox= ref(false); //详情弹窗 |
|
|
|
function showContentDialog(item:any){ |
|
|
|
const showContentBox = ref(false); //详情弹窗 |
|
|
|
function showContentDialog(item: any) { |
|
|
|
|
|
|
|
showContentBox.value = true; |
|
|
|
cardContentSource.value=item; |
|
|
|
cardContentSource.value = item; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -186,12 +163,12 @@ function showContentDialog(item:any){ |
|
|
|
<h3>{{ props.liContent?.atTitle }}</h3> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div v-show="!showCards" style="text-align: center;padding-top: 5%;" >暂无数据</div> |
|
|
|
<div v-show="!showCards" style="text-align: center;padding-top: 5%;">暂无数据</div> |
|
|
|
<div class="grid-tuijian" v-show="showCards"> |
|
|
|
|
|
|
|
|
|
|
|
<div v-for="(item, index) in tuijianPage" :key="index" class="tuijian-card" @click="showContentDialog(item)"> |
|
|
|
<img style="width: 140px; height: 126px;border-radius:8px;margin-top: 4px; margin-left: 4px;" |
|
|
|
<img style="width: 170px; height: 126px;border-radius:8px;margin-top: 4px; margin-left: 4px;" |
|
|
|
referrerpolicy="no-referrer" :src="item.gThumbnail" fit="fill" loading="lazy" @error="errorImg($event)" /> |
|
|
|
|
|
|
|
<div class="card-right"> |
|
|
|
@ -232,7 +209,7 @@ function showContentDialog(item:any){ |
|
|
|
.grid-tuijian { |
|
|
|
/* border-top: solid 1px; */ |
|
|
|
display: grid; |
|
|
|
grid-template-columns: repeat(auto-fill, 415px); |
|
|
|
grid-template-columns: repeat(auto-fill, 484px); |
|
|
|
gap: 10px; |
|
|
|
grid-auto-flow: row dense; |
|
|
|
|
|
|
|
@ -240,7 +217,7 @@ function showContentDialog(item:any){ |
|
|
|
|
|
|
|
.tuijian-card { |
|
|
|
display: flex; |
|
|
|
width: 412px; |
|
|
|
width: 481px; |
|
|
|
height: 140px; |
|
|
|
padding: 3px; |
|
|
|
border-radius: 8px; |
|
|
|
|