2022-06-20 18:38:56 +08:00
|
|
|
<!--
|
|
|
|
* @Author: hisense.gaoyuanwei
|
|
|
|
* @Date: 2022-06-20 10:12:22
|
2022-06-20 18:59:43 +08:00
|
|
|
* @LastEditors: hisense.liangjunhua
|
|
|
|
* @LastEditTime: 2022-06-20 18:58:56
|
2022-06-20 18:38:56 +08:00
|
|
|
* @Description: 业务组件详情页
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<div class="business-details" :class="{ fixed2: scrollTop >= 600 }">
|
|
|
|
<!-- 头部基本信息 -->
|
|
|
|
<business-top-details :dataList="dataList.data"></business-top-details>
|
|
|
|
<!-- 导航 -->
|
|
|
|
<business-navigation
|
|
|
|
:dataList="dataList.data"
|
|
|
|
:class="{ fixed: scrollTop >= 600 }"
|
|
|
|
:selectNow="selectNow"
|
|
|
|
></business-navigation>
|
|
|
|
<!-- 组件展示 -->
|
|
|
|
<business-presentation
|
|
|
|
:dataList="dataList.data"
|
|
|
|
id="business-presentation"
|
|
|
|
class="scrollBox"
|
|
|
|
></business-presentation>
|
2022-06-29 16:56:51 +08:00
|
|
|
<!-- 关联能力 -->
|
|
|
|
<business-associated-ability
|
|
|
|
:associatedComponents="associatedComponents"
|
|
|
|
id="business-associated-ability"
|
|
|
|
class="scrollBox"
|
|
|
|
></business-associated-ability>
|
2022-06-20 18:38:56 +08:00
|
|
|
<!-- 功能介绍-->
|
|
|
|
<business-function-intorduction
|
|
|
|
:dataList="dataList.data"
|
|
|
|
id="function-introduction"
|
|
|
|
class="scrollBox"
|
|
|
|
></business-function-intorduction>
|
|
|
|
<!-- 应用场景 -->
|
|
|
|
<business-application-scenarios
|
|
|
|
:dataList="dataList.data"
|
|
|
|
id="application-scenarios"
|
|
|
|
class="scrollBox"
|
|
|
|
></business-application-scenarios>
|
|
|
|
<!-- 应用案例 -->
|
|
|
|
<business-application-case
|
|
|
|
:dataList="dataList.data"
|
|
|
|
id="application-case"
|
|
|
|
class="scrollBox"
|
|
|
|
></business-application-case>
|
|
|
|
<!-- 使用方式 -->
|
|
|
|
<business-usage-mode
|
|
|
|
:dataList="dataList.data"
|
|
|
|
id="business-usage-mode"
|
|
|
|
class="scrollBox"
|
|
|
|
></business-usage-mode>
|
|
|
|
<!-- 常见问题-->
|
|
|
|
<business-common-problem
|
|
|
|
:dataList="dataList.data"
|
|
|
|
id="common-problem"
|
|
|
|
class="scrollBox"
|
|
|
|
></business-common-problem>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script setup>
|
|
|
|
import BusinessApplicationCase from '@/views/detailsAll/components/Business/BusinessApplicationCase.vue' // 应用案例
|
2022-06-29 16:56:51 +08:00
|
|
|
import BusinessAssociatedAbility from '@/views/detailsAll/components/Business/BusinessAssociatedAbility.vue'
|
2022-06-20 18:38:56 +08:00
|
|
|
import BusinessApplicationScenarios from '@/views/detailsAll/components/Business/BusinessApplicationScenarios.vue' // 应用场景
|
|
|
|
import BusinessFunctionIntorduction from '@/views/detailsAll/components/Business/BusinessFunctionIntorduction.vue' // 功能介绍
|
|
|
|
import BusinessTopDetails from '@/views/detailsAll/components/Business/BusinessTopDetails.vue' // 头部基本信息
|
|
|
|
import BusinessNavigation from '@/views/detailsAll/components/Business/BusinessNavigation.vue' //导航条
|
|
|
|
import BusinessPresentation from '@/views/detailsAll/components/Business/BusinessPresentation.vue' //组件展示
|
|
|
|
import BusinessUsageMode from '@/views/detailsAll/components/Business/BusinessUsageMode.vue' //使用方式
|
|
|
|
import BusinessCommonProblem from '@/views/detailsAll/components/Business/BusinessCommonProblem' //常见问题
|
|
|
|
import { ref, onMounted, onBeforeUnmount, reactive } from 'vue'
|
|
|
|
import { useRouter } from 'vue-router'
|
2022-06-29 16:56:51 +08:00
|
|
|
import { updateVisits, selectOne, queryPartAppByKeyId } from '@/api/home'
|
2022-06-20 18:38:56 +08:00
|
|
|
import mybus from '@/myplugins/mybus'
|
|
|
|
const router = useRouter()
|
|
|
|
const scrollTop = ref(0)
|
|
|
|
const domArr = ref([])
|
|
|
|
const selectNow = ref('')
|
|
|
|
const dataList = reactive({ data: {} })
|
|
|
|
const id = router.currentRoute.value.query.id
|
|
|
|
const obj = JSON.parse(window.sessionStorage.getItem('preview'))
|
2022-06-29 16:56:51 +08:00
|
|
|
const associatedComponents = ref([
|
|
|
|
{ type: '应用资源', dataList: [] },
|
|
|
|
{ type: '数据资源', dataList: [] },
|
|
|
|
{ type: '基础设施', dataList: [] },
|
|
|
|
])
|
2022-06-20 18:38:56 +08:00
|
|
|
document.documentElement.style.transition = 'all 0.3s ease'
|
|
|
|
document.documentElement.scrollTop = 0
|
|
|
|
document.body.style.transition = 'all 0.3s ease'
|
|
|
|
document.body.scrollTop = 0
|
|
|
|
mybus.on('flyToView', (id) => {
|
|
|
|
let top = document.querySelector('#' + id).offsetTop - 50
|
|
|
|
// console.log(top, document.querySelector('#' + id).offsetTop)
|
|
|
|
document.documentElement.scrollTop = top
|
|
|
|
document.body.scrollTop = top
|
|
|
|
})
|
|
|
|
onMounted(() => {
|
|
|
|
// console.clear()
|
|
|
|
window.addEventListener('scroll', () => {
|
|
|
|
domArr.value = document.querySelectorAll('.scrollBox')
|
|
|
|
scrollTop.value =
|
|
|
|
document.documentElement.scrollTop || document.body.scrollTop
|
|
|
|
for (let i = 0; i < domArr.value.length; i++) {
|
|
|
|
if (i === 0) {
|
|
|
|
if (scrollTop.value <= domArr.value[i + 1].offsetTop - 50) {
|
|
|
|
selectNow.value = domArr.value[i].id
|
|
|
|
}
|
|
|
|
} else if (i == domArr.value.length - 1) {
|
|
|
|
if (scrollTop.value >= domArr.value[i].offsetTop - 50) {
|
|
|
|
selectNow.value = domArr.value[i].id
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (
|
2022-06-20 18:59:43 +08:00
|
|
|
scrollTop.value >= domArr.value[i].offsetTop - 50 &&
|
|
|
|
scrollTop.value <= domArr.value[i + 1].offsetTop - 50
|
2022-06-20 18:38:56 +08:00
|
|
|
) {
|
|
|
|
selectNow.value = domArr.value[i].id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
const init = (id) => {
|
|
|
|
if (id) {
|
|
|
|
selectOne(id).then((res) => {
|
|
|
|
// console.clear()
|
|
|
|
dataList.data = res.data.data
|
|
|
|
console.log('初始化详情页=========================>', dataList.data)
|
|
|
|
const arrList = ref([])
|
|
|
|
arrList.value = JSON.parse(window.sessionStorage.getItem('visits'))
|
|
|
|
if (arrList.value && arrList.value.indexOf(id) === -1) {
|
|
|
|
arrList.value.push(id)
|
|
|
|
updateVisits({
|
|
|
|
id: res.data.data.id,
|
|
|
|
visits: res.data.data.visits || '0',
|
|
|
|
}).then(() => {
|
|
|
|
window.sessionStorage.setItem(
|
|
|
|
'visits',
|
|
|
|
JSON.stringify(arrList.value)
|
|
|
|
)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
2022-06-29 16:56:51 +08:00
|
|
|
associatedComponents.value.map((item, index) => {
|
|
|
|
let queryPartAppByKeyIdParams = {
|
|
|
|
keyId: id,
|
|
|
|
type: item.type,
|
|
|
|
}
|
|
|
|
queryPartAppByKeyId(queryPartAppByKeyIdParams).then((res) => {
|
|
|
|
associatedComponents.value[index].dataList = res.data.data
|
|
|
|
})
|
|
|
|
})
|
2022-06-20 18:38:56 +08:00
|
|
|
} else if (obj) {
|
|
|
|
dataList.data = obj
|
|
|
|
console.log('预览==============', obj)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
init(id)
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
mybus.off('flyToView')
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
|
|
.fixed {
|
|
|
|
position: fixed;
|
|
|
|
z-index: 2000;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
}
|
|
|
|
.fixed2 > div:nth-of-type(3) {
|
|
|
|
margin-top: 0.84rem;
|
|
|
|
}
|
|
|
|
</style>
|