算法广场,GIS广场接口里联调

This commit is contained in:
guoyue 2022-10-25 17:51:39 +08:00
parent 79ee811854
commit 7ff2d13afe
4 changed files with 119 additions and 89 deletions

View File

@ -500,3 +500,12 @@ export function getMaxApplyNum(number) {
method: 'get',
})
}
// -广-广GIS广
export function getGisByArea(data) {
return request({
url: '/resource/getSquareList',
method: 'post',
data
})
}

View File

@ -9,10 +9,10 @@
</div>
<div class="bottom" v-show="selectFlag">
<span class="light"></span>
<div @click="getList('全市')">全市</div>
<div @click="getList('市级')">市级</div>
<div @click="getList('区级')">区级</div>
<div @click="getList('企业')">企业</div>
<div @click="changeDeptType('全市')">全市</div>
<div @click="changeDeptType('市级')">市级</div>
<div @click="changeDeptType('区级')">区级</div>
<div @click="changeDeptType('企业')">企业</div>
</div>
</div>
<div class="select">
@ -22,7 +22,7 @@
</div>
<div class="bottom" v-show="selectFlag2">
<span class="light"></span>
<div v-for="val in dictList" :key="val" @click="getList2(val)">
<div v-for="val in dictList" :key="val" @click="changeAreaFunction(val)">
{{ val }}
</div>
</div>
@ -47,11 +47,11 @@
</template>
<script setup>
import { getCategoryTreePage } from '@/api/personalCenter'
import { pageWithAttrs } from '@/api/abilityStatistics'
import { ref, onMounted, onBeforeUnmount } from 'vue'
import { getGisByArea } from '@/api/home'
import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue'
const type = ref(null)
const deptType = ref(null)
const typeName = ref('全市')
const typeName2 = ref('全部')
const dictList = ref([])
@ -71,25 +71,16 @@ getCategoryTreePage({
})
})
const params = {
deptIds: [],
districtId: '',
infoList: [{ attrType: '组件类型', attrValue: '智能算法' }],
orderField: 'pin_top',
orderType: 'DESC',
pageNum: 1,
pageSize: 9,
type: '组件服务',
type: '智能算法',
area: typeName2.value == '全部' ? '' : typeName2.value,
pageSize: 9 // 9
}
const getList2 = (val) => {
//
const changeAreaFunction = (val) => {
typeName2.value = val
if (val == '全部') {
params.infoList = [{ attrType: '组件类型', attrValue: '智能算法' }]
} else {
params.infoList = [
{ attrType: '组件类型', attrValue: '智能算法' },
{ attrType: '应用领域', attrValue: val },
]
}
params.area = typeName2.value == '全部' ? '' : typeName2.value;
selectFlag2.value = false
pageWithAttrsFunction()
}
@ -99,24 +90,20 @@ const dataLength = ref(true)
const isNoMore = ref(false)
let url = ref('')
const pageWithAttrsFunction = () => {
pageWithAttrs(params).then((res) => {
dataList.value = res.data.data.records
if (res.data.data.records.length < 9) {
getGisByArea(params).then((res) => {
dataList.value = res.data.data.list
if (res.data.data.list.length < 9) {
dataLength.value = false
}
})
}
pageWithAttrsFunction()
//
const algorithmCardPhoto = (List, item) => {
let obj = List.filter((item) => item.attrType === '应用场景')[0]
let _arr = List && item && List.filter((item) => item.attrType === '应用场景') || []
let obj = _arr[0]
if (obj && obj.attrValue != '') {
console.log(
item.name,
item.id,
obj.attrValue,
'----------------------------'
)
obj = JSON.parse(obj.attrValue)[0].img
}
return obj || ''
@ -137,9 +124,9 @@ const algorithmFunction = (e) => {
//
isNoMore.value = true
params.pageNum++
pageWithAttrs(params).then((res) => {
dataList.value.push(...res.data.data.records)
if (res.data.data.records.length < 9) {
getGisByArea(params).then((res) => {
dataList.value.push(...res.data.data.list)
if (res.data.data.list.length < 9) {
dataLength.value = false
}
})
@ -148,32 +135,52 @@ const algorithmFunction = (e) => {
}
}
const getList = (str) => {
//
const changeDeptType = (str) => {
if (str) {
algorithmclassDom.scrollTop = 0
if (algorithmclassDom) {
algorithmclassDom.scrollTop = 0;
}
switch (str) {
case '全市':
type.value = null
deptType.value = null
typeName.value = '全 市'
break
case '市级':
type.value = 2
deptType.value = 2
typeName.value = '市 级'
break
case '区级':
type.value = 3
deptType.value = 3
typeName.value = '区 级'
break
case '企业':
type.value = 4
deptType.value = 4
typeName.value = '企 业'
break
}
params.pageNum = 1
params.pageNum = 1;
params.deptType = deptType.value;
}
selectFlag.value = false
alert('调取接口')
// getData(str)
getData(str)
}
const getData = (str) => {
getGisByArea(params).then((res) => {
const resData = res.data.data || {}
if (resData.list.length > 0 && resData.list.length < 9) {
algorithmclassDom.removeEventListener('scroll', algorithmFunction, true)
}
dataList.value = resData.list || []
nextTick(() => {
algorithmclassDom = document.querySelector('.algorithm-box')
if (str && algorithmclassDom) {
algorithmclassDom.removeEventListener('scroll', algorithmFunction, true)
algorithmclassDom.addEventListener('scroll', algorithmFunction, true)
}
})
})
}
onMounted(() => {

View File

@ -121,16 +121,19 @@
type: type.value,
area: area.value,
}).then((res) => {
if (res.data.data.length < 9) {
console.log('res---应用广场--------->', res);
if (res.data.data.total.length < 9) {
dom.removeEventListener('scroll', viewMonitor, true)
}
res.data.data.map((val) => {
// appList
res.data.data.appList.map((val) => {
if (!val.pic) {
val.pic = require('@/assets/capacitySquare/yyzy.jpg')
}
val.pic2 = require('@/assets/capacitySquare/yyzy.jpg')
})
data.list.push(...res.data.data)
data.list.push(...res.data.data.appList)
selectFlag.value = false
nextTick(() => {
dom = document.querySelector('.item-box')

View File

@ -9,10 +9,10 @@
</div>
<div class="bottom" v-show="selectFlag">
<span class="light"></span>
<div @click="getList('全市')">全市</div>
<div @click="getList('市级')">市级</div>
<div @click="getList('区级')">区级</div>
<div @click="getList('企业')">企业</div>
<div @click="changeDeptType('全市')">全市</div>
<div @click="changeDeptType('市级')">市级</div>
<div @click="changeDeptType('区级')">区级</div>
<div @click="changeDeptType('企业')">企业</div>
</div>
</div>
<div class="select">
@ -22,7 +22,7 @@
</div>
<div class="bottom" v-show="selectFlag2">
<span class="light"></span>
<div v-for="val in dictList" :key="val" @click="getList2(val)">
<div v-for="val in dictList" :key="val" @click="changeAreaFunction(val)">
{{ val }}
</div>
</div>
@ -46,10 +46,10 @@
</template>
<script setup>
import { getCategoryTreePage } from '@/api/personalCenter'
import { pageWithAttrs } from '@/api/abilityStatistics'
import { ref, onMounted, onBeforeUnmount } from 'vue'
import { getGisByArea } from '@/api/home'
import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue'
const type = ref(null)
const deptType = ref(null)
const typeName = ref('全市')
const typeName2 = ref('全部')
const dictList = ref([])
@ -69,43 +69,35 @@ getCategoryTreePage({
})
})
const params = {
deptIds: [],
districtId: '',
infoList: [{ attrType: '组件类型', attrValue: '图层服务' }],
orderField: 'deptSort',
orderType: 'DESC',
pageNum: 1,
pageSize: 9,
type: '组件服务',
type: '图层服务',
area: typeName2.value == '全部' ? '' : typeName2.value,
pageSize: 9 // 9
}
const getList2 = (val) => {
//
const changeAreaFunction = (val) => {
typeName2.value = val
if (val == '全部') {
params.infoList = [{ attrType: '组件类型', attrValue: '图层服务' }]
} else {
params.infoList = [
{ attrType: '组件类型', attrValue: '图层服务' },
{ attrType: '应用领域', attrValue: val },
]
}
params.area = typeName2.value == '全部' ? '' : typeName2.value;
selectFlag2.value = false
pageWithAttrsFunction()
}
let algorithmclassDom = null
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) {
getGisByArea(params).then((res) => {
dataList.value = res.data.data.list
if (res.data.data.list.length < 9) {
dataLength.value = false
}
})
}
pageWithAttrsFunction()
//
const algorithmCardPhoto = (List) => {
const algorithmCardPhoto = (List = []) => {
let url = ''
List.map((item) => {
if (item.attrType === '图层缩略图') {
@ -119,32 +111,51 @@ const detailFunction = (id) => {
window.open(window.SITE_CONFIG.previewUrl + `#/details?id=${id}`)
}
const getList = (str) => {
const changeDeptType = (str) => {
if (str) {
if(algorithmclassDom) {
algorithmclassDom.scrollTop = 0
}
switch (str) {
case '全市':
type.value = null
deptType.value = null
typeName.value = '全 市'
break
case '市级':
type.value = 2
deptType.value = 2
typeName.value = '市 级'
break
case '区级':
type.value = 3
deptType.value = 3
typeName.value = '区 级'
break
case '企业':
type.value = 4
deptType.value = 4
typeName.value = '企 业'
break
}
params.pageNum = 1
params.pageNum = 1;
params.deptType = deptType.value;
}
selectFlag.value = false
alert('调取接口')
// getData(str)
getData(str)
}
const getData = (str) => {
getGisByArea(params).then((res) => {
const resData = res.data.data || {}
if (resData.list.length > 0 && resData.list.length < 9) {
algorithmclassDom.removeEventListener('scroll', algorithmFunction, true)
}
dataList.value = resData.list || []
nextTick(() => {
algorithmclassDom = document.querySelector('.algorithm-box')
if (str && algorithmclassDom) {
algorithmclassDom.removeEventListener('scroll', algorithmFunction, true)
algorithmclassDom.addEventListener('scroll', algorithmFunction, true)
}
})
})
}
const layerFunction = (e) => {
@ -159,9 +170,9 @@ const layerFunction = (e) => {
//
isNoMore.value = true
params.pageNum++
pageWithAttrs(params).then((res) => {
dataList.value.push(...res.data.data.records)
if (res.data.data.records.length < 9) {
getGisByArea(params).then((res) => {
dataList.value.push(...res.data.data.list)
if (res.data.data.list.length < 9) {
dataLength.value = false
}
})