Merge branch 'hi-ucs-dev' of http://192.168.124.50:3000/wuhongjian/hi-ucs into hi-ucs-dev
This commit is contained in:
commit
2fe6aed0df
|
@ -28,7 +28,7 @@
|
|||
</template>
|
||||
<script setup>
|
||||
import { pageWithAttrs } from '@/api/abilityStatistics'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
||||
const dataList = ref([])
|
||||
const params = {
|
||||
deptIds: [],
|
||||
|
@ -40,6 +40,7 @@
|
|||
pageSize: 9,
|
||||
type: '组件服务',
|
||||
}
|
||||
let algorithmclass = null
|
||||
const imgSrc = ref(require('@/assets/capacitySquare/algorithm-photo.jpg'))
|
||||
const dataLength = ref(true)
|
||||
const isNoMore = ref(false)
|
||||
|
@ -55,44 +56,54 @@
|
|||
pageWithAttrsFunction()
|
||||
//图片显示
|
||||
const algorithmCardPhoto = (List) => {
|
||||
List.map((item) => {
|
||||
if (item.attrType === '图层缩略图') {
|
||||
url.value = item.attrValue
|
||||
}
|
||||
})
|
||||
let obj = List.filter((item) => item.attrType === '图层缩略图')[0]
|
||||
if (obj) {
|
||||
List.map((item) => {
|
||||
if (item.attrType === '图层缩略图') {
|
||||
url.value = item.attrValue
|
||||
}
|
||||
})
|
||||
} else {
|
||||
url.value = '@/assets/capacitySquare/algorithm-photo.jpg'
|
||||
}
|
||||
return url.value
|
||||
}
|
||||
//跳转详情页
|
||||
const detailFunction = (id) => {
|
||||
window.open(window.SITE_CONFIG.previewUrl + `#/details?id=${id}`)
|
||||
}
|
||||
onMounted(() => {
|
||||
const algorithmclass = document.querySelector('.algorithm-class')
|
||||
if (dataLength.value) {
|
||||
//监听滚动事件
|
||||
algorithmclass.addEventListener('scroll', (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
|
||||
const algorithmFunction = (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
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
algorithmclass = document.querySelector('.algorithm-class')
|
||||
if (dataLength.value) {
|
||||
//监听滚动事件
|
||||
algorithmclass.addEventListener('scroll', algorithmFunction, true)
|
||||
}
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
algorithmclass.removeEventListener('scroll', algorithmFunction, true)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
</template>
|
||||
<script setup>
|
||||
import { pageWithAttrs } from '@/api/abilityStatistics'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
||||
const dataList = ref([])
|
||||
let algorithmclass = null
|
||||
const params = {
|
||||
deptIds: [],
|
||||
districtId: '',
|
||||
|
@ -66,33 +67,37 @@
|
|||
const detailFunction = (id) => {
|
||||
window.open(window.SITE_CONFIG.previewUrl + `#/details?id=${id}`)
|
||||
}
|
||||
onMounted(() => {
|
||||
const algorithmclass = document.querySelector('.algorithm-class')
|
||||
if (dataLength.value) {
|
||||
//监听滚动事件
|
||||
algorithmclass.addEventListener('scroll', (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
|
||||
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
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
algorithmclass = document.querySelector('.algorithm-class')
|
||||
if (dataLength.value) {
|
||||
//监听滚动事件
|
||||
algorithmclass.addEventListener('scroll', layerFunction, true)
|
||||
}
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
algorithmclass.removeEventListener('scroll', layerFunction, true)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue