BUG修改

This commit is contained in:
a0049873 2022-10-27 11:44:25 +08:00
parent 4930027d67
commit f36e2bbffc
1 changed files with 289 additions and 264 deletions

View File

@ -22,16 +22,29 @@
</div> </div>
<div class="bottom" v-show="selectFlag2"> <div class="bottom" v-show="selectFlag2">
<span class="light"></span> <span class="light"></span>
<div v-for="val in dictList" :key="val" @click="changeAreaFunction(val)"> <div
v-for="val in dictList"
:key="val"
@click="changeAreaFunction(val)"
>
{{ val }} {{ val }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="algorithm-class"> <div class="algorithm-class">
<div v-for="(item, index) in dataList" :key="`algorithm-${index}`" class="algorithm-card"> <div
<a-image :src="item.pic" :width="525" :height="275" :fallback="imgSrc" v-for="(item, index) in dataList"
:preview="false"></a-image> :key="`algorithm-${index}`"
class="algorithm-card"
>
<a-image
:src="item.pic || imgSrc"
:width="525"
:height="275"
:fallback="imgSrc"
:preview="false"
></a-image>
<a-tooltip> <a-tooltip>
<template #title>{{ item.name }}</template> <template #title>{{ item.name }}</template>
@ -45,67 +58,67 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { getCategoryTreePage } from '@/api/personalCenter' import { getCategoryTreePage } from '@/api/personalCenter'
import { getGisByArea } from '@/api/home' import { getGisByArea } from '@/api/home'
import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue' import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue'
const deptType = ref(null) const deptType = ref(null)
const typeName = ref('全市') const typeName = ref('全市')
const typeName2 = ref('全部') const typeName2 = ref('全部')
const dictList = ref([]) const dictList = ref([])
const dataList = ref([]) const dataList = ref([])
const selectFlag2 = ref(false) const selectFlag2 = ref(false)
const selectFlag = ref(false) const selectFlag = ref(false)
getCategoryTreePage({ getCategoryTreePage({
page: 1, page: 1,
limit: 99, limit: 99,
dictTypeId: '1513712507692818433', dictTypeId: '1513712507692818433',
}).then((res) => { }).then((res) => {
dictList.value = ['全部'] dictList.value = ['全部']
res.data.data.list.map((val) => { res.data.data.list.map((val) => {
// if (val.dictLabel !== '') { // if (val.dictLabel !== '') {
dictList.value.push(val.dictLabel) dictList.value.push(val.dictLabel)
// } // }
}) })
}) })
const params = { const params = {
pageNum: 1, pageNum: 1,
type: '图层服务', type: '图层服务',
area: typeName2.value == '全部' ? '' : typeName2.value, area: typeName2.value == '全部' ? '' : typeName2.value,
pageSize: 9 // 9 pageSize: 9, // 9
} }
// //
const changeAreaFunction = (val) => { const changeAreaFunction = (val) => {
params.pageNum = 1; params.pageNum = 1
typeName2.value = val typeName2.value = val
params.area = typeName2.value == '全部' ? '' : typeName2.value; params.area = typeName2.value == '全部' ? '' : typeName2.value
selectFlag2.value = false selectFlag2.value = false
pageWithAttrsFunction() pageWithAttrsFunction()
} }
let algorithmclassDom = null let algorithmclassDom = null
const imgSrc = ref(require('@/assets/capacitySquare/algorithm-photo2.jpg')) const imgSrc = ref(require('@/assets/capacitySquare/algorithm-photo2.jpg'))
const dataLength = ref(true) const dataLength = ref(true)
const isNoMore = ref(false) const isNoMore = ref(false)
const pageWithAttrsFunction = () => { const pageWithAttrsFunction = () => {
getGisByArea(params).then((res) => { getGisByArea(params).then((res) => {
dataList.value = res.data.data.list dataList.value = res.data.data.list
if (res.data.data.list.length < 9) { if (res.data.data.list.length < 9) {
dataLength.value = false dataLength.value = false
} }
}) })
} }
pageWithAttrsFunction() pageWithAttrsFunction()
// //
const detailFunction = (id) => { const detailFunction = (id) => {
window.open(window.SITE_CONFIG.previewUrl + `#/details?id=${id}`) window.open(window.SITE_CONFIG.previewUrl + `#/details?id=${id}`)
} }
const changeDeptType = (str) => { const changeDeptType = (str) => {
if (str) { if (str) {
if(algorithmclassDom) { if (algorithmclassDom) {
algorithmclassDom.scrollTop = 0 algorithmclassDom.scrollTop = 0
} }
switch (str) { switch (str) {
@ -126,37 +139,45 @@ const changeDeptType = (str) => {
typeName.value = '企 业' typeName.value = '企 业'
break break
} }
params.pageNum = 1; params.pageNum = 1
if(deptType.value !== null && deptType.value !== undefined) { if (deptType.value !== null && deptType.value !== undefined) {
params.deptType = deptType.value; params.deptType = deptType.value
}else { } else {
if(Object.keys(params).includes('deptType')) { if (Object.keys(params).includes('deptType')) {
delete params.deptType delete params.deptType
} }
} }
} }
selectFlag.value = false selectFlag.value = false
getData(str) getData(str)
} }
const getData = (str) => { const getData = (str) => {
getGisByArea(params).then((res) => { getGisByArea(params).then((res) => {
const resData = res.data.data || {} const resData = res.data.data || {}
if (resData.list.length > 0 && resData.list.length < 9 && algorithmclassDom) { if (
resData.list.length > 0 &&
resData.list.length < 9 &&
algorithmclassDom
) {
algorithmclassDom.removeEventListener('scroll', algorithmFunction, true) algorithmclassDom.removeEventListener('scroll', algorithmFunction, true)
} }
dataList.value = resData.list || [] dataList.value = resData.list || []
nextTick(() => { nextTick(() => {
algorithmclassDom = document.querySelector('.algorithm-box') algorithmclassDom = document.querySelector('.algorithm-box')
if (str && algorithmclassDom) { if (str && algorithmclassDom) {
algorithmclassDom.removeEventListener('scroll', algorithmFunction, true) algorithmclassDom.removeEventListener(
'scroll',
algorithmFunction,
true
)
algorithmclassDom.addEventListener('scroll', algorithmFunction, true) algorithmclassDom.addEventListener('scroll', algorithmFunction, true)
} }
}) })
}) })
} }
const layerFunction = (e) => { const layerFunction = (e) => {
var scrollTop = e.currentTarget.scrollTop var scrollTop = e.currentTarget.scrollTop
var windowHeight = e.currentTarget.clientHeight var windowHeight = e.currentTarget.clientHeight
var scrollHeight = e.currentTarget.scrollHeight var scrollHeight = e.currentTarget.scrollHeight
@ -177,21 +198,21 @@ const layerFunction = (e) => {
} else { } else {
isNoMore.value = false isNoMore.value = false
} }
} }
onMounted(() => { onMounted(() => {
algorithmclassDom = document.querySelector('.algorithm-class') algorithmclassDom = document.querySelector('.algorithm-class')
if (dataLength.value) { if (dataLength.value) {
// //
algorithmclassDom.addEventListener('scroll', layerFunction, true) algorithmclassDom.addEventListener('scroll', layerFunction, true)
} }
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
algorithmclassDom.removeEventListener('scroll', layerFunction, true) algorithmclassDom.removeEventListener('scroll', layerFunction, true)
}) })
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.algorithm { .algorithm {
.select { .select {
margin: 0.1rem 0 0.1rem 0.2rem; margin: 0.1rem 0 0.1rem 0.2rem;
color: #fff; color: #fff;
@ -216,7 +237,8 @@ onBeforeUnmount(() => {
position: absolute; position: absolute;
top: 0.4rem; top: 0.4rem;
left: 1.52rem; left: 1.52rem;
background: url('~@/assets/capacitySquare/select-light1.png') no-repeat; background: url('~@/assets/capacitySquare/select-light1.png')
no-repeat;
background-size: 100%; background-size: 100%;
} }
} }
@ -237,11 +259,12 @@ onBeforeUnmount(() => {
position: absolute; position: absolute;
top: -0.08rem; top: -0.08rem;
left: -0.3rem; left: -0.3rem;
background: url('~@/assets/capacitySquare/select-light2.png') no-repeat; background: url('~@/assets/capacitySquare/select-light2.png')
no-repeat;
background-size: 100%; background-size: 100%;
} }
&>div { & > div {
width: 1.8rem; width: 1.8rem;
height: 0.4rem; height: 0.4rem;
line-height: 0.4rem; line-height: 0.4rem;
@ -249,7 +272,7 @@ onBeforeUnmount(() => {
border-top: 1px solid #aed5ff; border-top: 1px solid #aed5ff;
} }
&>div:nth-of-type(1) { & > div:nth-of-type(1) {
border: none; border: none;
} }
} }
@ -286,7 +309,8 @@ onBeforeUnmount(() => {
.algorithm-card-photo { .algorithm-card-photo {
height: 100%; height: 100%;
width: 100%; width: 100%;
background: url('~@/assets/capacitySquare/algorithm-photo.jpg') no-repeat; background: url('~@/assets/capacitySquare/algorithm-photo.jpg')
no-repeat;
background-size: 100%; background-size: 100%;
} }
@ -300,7 +324,8 @@ onBeforeUnmount(() => {
font-family: alibaba; font-family: alibaba;
bottom: 0.15rem; bottom: 0.15rem;
padding-left: 0.22rem; padding-left: 0.22rem;
background: url('~@/assets/capacitySquare/algorithm-title-bg.png') no-repeat; background: url('~@/assets/capacitySquare/algorithm-title-bg.png')
no-repeat;
background-size: 100%; background-size: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -336,5 +361,5 @@ onBeforeUnmount(() => {
width: 0.08rem; width: 0.08rem;
border-radius: 0.08rem; border-radius: 0.08rem;
} }
} }
</style> </style>