2022-08-09 15:23:38 +08:00
|
|
|
<!-- 图层服务 -->
|
|
|
|
<template>
|
|
|
|
<div class="algorithm">
|
|
|
|
<div class="algorithm-class">
|
|
|
|
<div
|
|
|
|
v-for="(item, index) in dataList"
|
|
|
|
:key="`algorithm-${index}`"
|
|
|
|
class="algorithm-card"
|
|
|
|
>
|
|
|
|
<a-image
|
|
|
|
:src="algorithmCardPhoto(item.infoList)"
|
|
|
|
:width="525"
|
|
|
|
:height="275"
|
|
|
|
:fallback="imgSrc"
|
2022-08-09 16:27:04 +08:00
|
|
|
:preview="false"
|
2022-08-09 15:23:38 +08:00
|
|
|
></a-image>
|
|
|
|
|
|
|
|
<a-tooltip>
|
|
|
|
<template #title>{{ item.name }}</template>
|
2022-08-09 16:27:04 +08:00
|
|
|
<div class="algorithm-card-title" @click="detailFunction(item.id)">
|
|
|
|
<span>{{ item.name }}</span>
|
|
|
|
<span>{{ item.deptName }}</span>
|
|
|
|
</div>
|
2022-08-09 15:23:38 +08:00
|
|
|
</a-tooltip>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script setup>
|
|
|
|
import { pageWithAttrs } from '@/api/abilityStatistics'
|
2022-08-10 10:32:50 +08:00
|
|
|
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
2022-08-09 15:23:38 +08:00
|
|
|
const dataList = ref([])
|
2022-08-10 10:32:50 +08:00
|
|
|
let algorithmclass = null
|
2022-08-09 15:23:38 +08:00
|
|
|
const params = {
|
|
|
|
deptIds: [],
|
|
|
|
districtId: '',
|
|
|
|
infoList: [{ attrType: '组件类型', attrValue: '图层服务' }],
|
2022-08-15 18:08:12 +08:00
|
|
|
orderField: 'deptSort',
|
2022-08-09 15:23:38 +08:00
|
|
|
orderType: 'DESC',
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 9,
|
|
|
|
type: '组件服务',
|
|
|
|
}
|
|
|
|
const imgSrc = ref(require('@/assets/capacitySquare/algorithm-photo2.jpg'))
|
|
|
|
const dataLength = ref(true)
|
|
|
|
const isNoMore = ref(false)
|
|
|
|
const pageWithAttrsFunction = () => {
|
|
|
|
pageWithAttrs(params).then((res) => {
|
|
|
|
dataList.value = res.data.data.records
|
|
|
|
if (res.data.data.records.length < 9) {
|
|
|
|
dataLength.value = false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
pageWithAttrsFunction()
|
|
|
|
//图片显示
|
|
|
|
const algorithmCardPhoto = (List) => {
|
2022-08-10 11:53:19 +08:00
|
|
|
let url = ''
|
2022-08-09 15:23:38 +08:00
|
|
|
List.map((item) => {
|
|
|
|
if (item.attrType === '图层缩略图') {
|
2022-08-10 11:53:19 +08:00
|
|
|
url = item.attrValue
|
2022-08-09 15:23:38 +08:00
|
|
|
}
|
|
|
|
})
|
2022-08-10 11:53:19 +08:00
|
|
|
return url
|
2022-08-09 15:23:38 +08:00
|
|
|
}
|
2022-08-09 16:27:04 +08:00
|
|
|
//跳转详情页
|
|
|
|
const detailFunction = (id) => {
|
|
|
|
window.open(window.SITE_CONFIG.previewUrl + `#/details?id=${id}`)
|
|
|
|
}
|
2022-08-10 10:32:50 +08:00
|
|
|
const layerFunction = (e) => {
|
|
|
|
var scrollTop = e.currentTarget.scrollTop
|
|
|
|
var windowHeight = e.currentTarget.clientHeight
|
|
|
|
var scrollHeight = e.currentTarget.scrollHeight
|
|
|
|
console.log(scrollTop, windowHeight, scrollHeight, '123')
|
|
|
|
if (
|
|
|
|
scrollTop + windowHeight <= scrollHeight + 1 &&
|
|
|
|
scrollTop + windowHeight >= scrollHeight - 1
|
|
|
|
) {
|
|
|
|
// 当前滚动条已经触底
|
|
|
|
isNoMore.value = true
|
|
|
|
params.pageNum++
|
|
|
|
pageWithAttrs(params).then((res) => {
|
|
|
|
dataList.value.push(...res.data.data.records)
|
|
|
|
if (res.data.data.records.length < 9) {
|
|
|
|
dataLength.value = false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
isNoMore.value = false
|
|
|
|
}
|
|
|
|
}
|
2022-08-09 15:23:38 +08:00
|
|
|
onMounted(() => {
|
2022-08-10 10:32:50 +08:00
|
|
|
algorithmclass = document.querySelector('.algorithm-class')
|
2022-08-09 15:23:38 +08:00
|
|
|
if (dataLength.value) {
|
2022-08-09 16:27:04 +08:00
|
|
|
//监听滚动事件
|
2022-08-10 10:32:50 +08:00
|
|
|
algorithmclass.addEventListener('scroll', layerFunction, true)
|
2022-08-09 15:23:38 +08:00
|
|
|
}
|
|
|
|
})
|
2022-08-10 10:32:50 +08:00
|
|
|
onBeforeUnmount(() => {
|
|
|
|
algorithmclass.removeEventListener('scroll', layerFunction, true)
|
|
|
|
})
|
2022-08-09 15:23:38 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
.algorithm {
|
|
|
|
.algorithm-class {
|
2022-08-09 17:09:20 +08:00
|
|
|
margin-top: 0.6rem;
|
|
|
|
margin-bottom: 0.59rem;
|
2022-08-09 15:23:38 +08:00
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(3, 33%);
|
|
|
|
height: 8.8rem;
|
|
|
|
overflow: auto;
|
|
|
|
margin-left: 1.15rem;
|
|
|
|
margin-right: 0.15rem;
|
|
|
|
.algorithm-card {
|
|
|
|
height: 2.75rem;
|
2022-08-09 17:09:20 +08:00
|
|
|
width: 5.23rem;
|
2022-08-09 15:23:38 +08:00
|
|
|
background: url('~@/assets/capacitySquare/algorithm-bg.png') no-repeat;
|
2022-08-09 18:33:31 +08:00
|
|
|
background-size: 100% 100%;
|
|
|
|
margin-bottom: 0.4rem;
|
2022-08-09 15:23:38 +08:00
|
|
|
margin-right: 0.65rem;
|
|
|
|
position: relative;
|
|
|
|
:deep(.ant-image) {
|
|
|
|
img {
|
2022-08-09 17:09:20 +08:00
|
|
|
margin-top: 0.15rem;
|
2022-08-09 18:33:31 +08:00
|
|
|
height: 2.45rem;
|
2022-08-09 17:09:20 +08:00
|
|
|
width: 5.05rem;
|
|
|
|
margin-left: 0.1rem;
|
2022-08-09 15:23:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
.algorithm-card-photo {
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
background: url('~@/assets/capacitySquare/algorithm-photo.jpg')
|
|
|
|
no-repeat;
|
|
|
|
background-size: 100%;
|
|
|
|
}
|
|
|
|
.algorithm-card-title {
|
|
|
|
position: absolute;
|
|
|
|
height: 0.6rem;
|
2022-08-09 18:19:18 +08:00
|
|
|
margin-left: 0.08rem;
|
|
|
|
width: 97%;
|
2022-08-09 15:23:38 +08:00
|
|
|
color: #ffffff;
|
|
|
|
font-size: 0.22rem;
|
|
|
|
font-family: alibaba;
|
2022-08-09 18:33:31 +08:00
|
|
|
bottom: 0.15rem;
|
2022-08-09 15:23:38 +08:00
|
|
|
padding-left: 0.22rem;
|
|
|
|
background: url('~@/assets/capacitySquare/algorithm-title-bg.png')
|
|
|
|
no-repeat;
|
|
|
|
background-size: 100%;
|
2022-08-09 16:27:04 +08:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
span {
|
|
|
|
line-height: 0.24rem;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
span:last-child {
|
|
|
|
font-size: 0.14rem;
|
|
|
|
}
|
2022-08-09 15:23:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.algorithm-class::-webkit-scrollbar-track-piece {
|
|
|
|
background: #a5bcdb;
|
|
|
|
border-radius: 0.08rem;
|
|
|
|
}
|
|
|
|
.algorithm-class::-webkit-scrollbar-thumb {
|
|
|
|
height: 3.2rem;
|
|
|
|
background: linear-gradient(to bottom, #47d7f5, #3dc6e3);
|
|
|
|
}
|
|
|
|
.algorithm-class::-webkit-scrollbar {
|
|
|
|
height: 8.8rem;
|
|
|
|
width: 0.08rem;
|
|
|
|
border-radius: 0.08rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|