diff --git a/src/main.js b/src/main.js index dfd64f4f..dadcee1e 100644 --- a/src/main.js +++ b/src/main.js @@ -6,10 +6,10 @@ import store from '@/store' import App from '@/App.vue' import '@/utils/http.js' import commonMixin from '@/mixins/common' -import { cancelWithChange, noData, myHighLight } from '@/utils/tools' +import { cancelWithChange, noData, myHighLight,selectLoadMore } from '@/utils/tools' import { ClickOutside } from 'element-plus/lib/directives' import i18n from '@/i18n' -// import '@/mock/index.js' +//import '@/mock/index.js' import hljsVuePlugin from '@highlightjs/vue-plugin' import 'highlight.js/styles/color-brewer.css' import '@/assets/css/main.scss' // 样式入口 @@ -41,6 +41,7 @@ app.directive('ele-click-outside', ClickOutside) app.directive('cancel', cancelWithChange) app.directive('no-data', noData) app.directive('high-light', myHighLight) +app.directive('select-load-more', selectLoadMore) app.config.globalProperties.$_ = _ app.mixin(commonMixin) diff --git a/src/mock/location.js b/src/mock/location.js index c3b9ae0c..f812ce6d 100644 --- a/src/mock/location.js +++ b/src/mock/location.js @@ -7,9 +7,7 @@ if (openMock) { return { msg: 'success', code: 200, - data: { - list: data.map(d => ({ subscriberId: d, number: d })) - } + data: data.map(d => ({ subscriberId: d, number: d })) } }) Mock.mock(new RegExp(BASE_CONFIG.baseUrl + 'v1/locationIntelligence/map.*'), 'get', function (requestObj) { @@ -274,9 +272,7 @@ if (openMock) { msg: 'success', code: 200, data: { - result: { - values: lineData - } + result: lineData } } }) @@ -287,7 +283,7 @@ if (openMock) { msg: 'success', code: 200, data: { - total: 19366 + total: 16366 } } } else { @@ -295,7 +291,7 @@ if (openMock) { msg: 'success', code: 200, data: { - total: 16366 + total: 19366 } } } @@ -334,4 +330,110 @@ if (openMock) { } } }) + Mock.mock(new RegExp(BASE_CONFIG.baseUrl + 'v1/locationIntelligence/followed/subscribers.*'), 'get', function (requestObj) { + return { + msg: 'success', + code: 200, + data: { + list: [ + { + "subscriberId":111, + "group": "terrorist", + "info": "terrorist leader", + "location": "china", + "active": 1 + }, + { + "subscriberId":444, + "group": "terrorist", + "info": "terrorist leader", + "location": "china", + "active": 1 + }, + { + "subscriberId":555, + "group": "terrorist", + "info": "terrorist leader", + "location": "china", + "active": 0 + },{ + "subscriberId":666, + "group": "terrorist", + "info": "terrorist leader", + "location": "china", + "active": 1 + },{ + "subscriberId":777, + "group": "terrorist", + "info": "terrorist leader", + "location": "china", + "active": 0 + },{ + "subscriberId":888, + "group": "terrorist", + "info": "terrorist leader", + "location": "china", + "active": 1 + } + ] + } + } + }) + Mock.mock(new RegExp(BASE_CONFIG.baseUrl + 'v1/locationIntelligence/list.*'), 'get', function (requestObj) { + return { + msg: 'success', + code: 200, + data: { + total:1, + pageSize:20, + pageNo:1, + pages:1, + list: [ + { + "subscriberId":111, + "active": 1, + "phone_number": 18601680302, + "follow": 1 + }, + { + "subscriberId":222, + "active": 1, + "phone_number": 18601680303, + "follow": 0 + }, + { + "subscriberId":333, + "active": 0, + "phone_number": 18601680304, + "follow": 0 + },{ + "subscriberId":444, + "active": 1, + "phone_number": 18601680305, + "follow": 1 + },{ + "subscriberId":555, + "active": 0, + "phone_number": 18601680306, + "follow": 1 + },{ + "subscriberId":666, + "active": 1, + "phone_number": 18601680307, + "follow": 1 + },{ + "subscriberId":777, + "active": 1, + "phone_number": 18601680308, + "follow": 1 + },{ + "subscriberId":888, + "active": 1, + "phone_number": 18601680300, + "follow": 1 + } + ] + } + } + }) } diff --git a/src/utils/api.js b/src/utils/api.js index 7e5e7b6d..86b0ed06 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -358,8 +358,10 @@ export const api = { trend: apiVersion + '/locationIntelligence/active/trend', count: apiVersion + '/locationIntelligence/active/count', baseStation: apiVersion + '/locationIntelligence/baseStation', + list: apiVersion + '/locationIntelligence/list', followedSubscriber: apiVersion + '/locationIntelligence/followed/subscribers', - tracking: apiVersion + '/locationIntelligence/trace/tracking' + tracking: apiVersion + '/locationIntelligence/trace/tracking', + follow: apiVersion + '/locationIntelligence/follow' } } diff --git a/src/utils/tools.js b/src/utils/tools.js index c8238c26..3d758756 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -294,6 +294,33 @@ export const cancelWithChange = { } } +/* 滚动条指令 */ +export const selectLoadMore = { + mounted (el, binding) { + const selectDom = document.querySelector('.search-select .el-select-dropdown__wrap') + function loadMores() { + //判断是否到底 + const isBase = this.scrollHeight - this.scrollTop <= this.clientHeight + if(isBase) { + binding.value && binding.value() + } + } + //将获取到的dom和函数挂载到el-select上,实例销毁时好处理 + el.selectDomInfo = selectDom + el.selectLoadMore = loadMores + //监听滚动事件 + selectDom.addEventListener('scroll',loadMores.bind(selectDom)) + }, + unmounted (el, binding) { + // 解除事件监听 + if(el.selectLoadMore) { + el.selectDomInfo.removeEventListener('scroll', el.selectLoadMore) + delete el.selectDomInfo + delete el.selectLoadMore + } + } +} + function noDataDomFactory () { const noDataDom = document.createElement('div') noDataDom.setAttribute('class', 'no-data') diff --git a/src/views/location/Index.vue b/src/views/location/Index.vue index be58fe66..102c62cc 100644 --- a/src/views/location/Index.vue +++ b/src/views/location/Index.vue @@ -6,7 +6,42 @@
- + + + + {{ item.phoneNumber }} + + + + + + +
{{$t('locationIntelligence.activeSubscribers')}}
{{activeCount}}
-
-{{valueToRangeValue(activeCountChain, unitTypes.percent).join(' ')}}
+
{{activeCountChain === '-' ? '-' : (activeCountChain < 0 ? '-'+valueToRangeValue(Math.abs(activeCountChain), unitTypes.percent).join(' '): valueToRangeValue(activeCountChain, unitTypes.percent).join(' '))}}
-
Followed Subscribers
+
{{$t('location.followedSubscribers')}}
-