home.vue
13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
<template>
<div>
<div class="index_cont" v-show="see">
<div class="banner">
<div class="ban-tit"></div>
</div>
<div class="berth">
<h1 class="title">泊位分布</h1>
<div class="map" id="map"></div>
<div class="berth-num">
<p>区域泊位规划</p>
<ul class="berth-list">
<li v-for="(result,id) in resultMap" :key="id" >
<span class="fl">{{result.areaName}}</span>
<span class="fr">{{result.berthNum}}</span>
</li>
</ul>
</div>
</div>
<div class="news-wrap">
<h1 class="title">新闻中心</h1>
<div class="fl news-bg"></div>
<ul class="fl news-con">
<li class="clearfix" v-for="(news,id) in newsList" :key="id" @click="showNews(news.noticeId)">
<span class="ITD-hidden-nowrap ITD-common-color070">{{news.noticeTitle}}</span>
<span class="ITD-common-color050">{{news.effDate | string2Date(1)}}</span>
</li>
</ul>
<!--分页器-->
<i-pagination
:total="pageTotal"
:page="currentPage"
:limit="pageSize"
:layout="'total, prev, pager, next'"
:page-sizes="pageSizeS"
:hidden="false"
@pagination="handleSizeChange"
/>
</div>
</div>
<div class="news_cont" v-if="!see">
<div class="returnLastbtn" @click="backIndex()">返回</div>
<div v-html="newscontent"></div>
</div>
</div>
</template>
<script>
import {queryParkLotInfoByOrgId,queryNoticeForPage,queryNotice} from '@/api/park';
import pagination from '@/components/Pagination/index.vue'
import {string2Date} from '@/filters/index';
import parkIco from '../assets/home/parkIco.png'; //以import的方式导入图片文件
export default {
name: 'home',
components: {
'i-pagination': pagination,
// timeOneFormatter,
},
data() {
return {
parkList: [],
resultMap: [],
newsList: [],
//新闻详情开关
see:true,
/** 分页*/
currentPage: 1,
pageSize: 7,
pageSizeS: [8, 16],
pageTotal: 0,
//新闻详情
newscontent:'',
}
},
computed: {
/* hsgtotalSumAll() {
let hsgtotalSumAll = 0;
this.parkList.map((item) => {
if (item.plCountryName === '黄石港区') {
hsgtotalSumAll += item.plBerthNum;
}
});
return hsgtotalSumAll;
},*/
},
created() {
queryParkLotInfoByOrgId({
sysCode: '1001',
orgId: '10079',
plBusiType:'3',
}).then((response) => {
const mapDatas = response.data;
this.parkList = mapDatas;
this.baiduMap(mapDatas);
this.getAreaData(mapDatas);
})
},
mounted() {
this.getNoticeForPage();
},
methods: {
//泊位分布 list 区间---泊位数
getAreaData(arrayData) {
let berthMap = {};
let areaMap = {};
if (arrayData === null || arrayData === undefined || arrayData.length === 0) {
return resultMap;
}
arrayData.forEach((item,index)=>{
let plBerthNum = item.plBerthNum;
if(plBerthNum === undefined || plBerthNum === null){
plBerthNum = 0;
}
if(areaMap[item.plCountryId] === null || areaMap[item.plCountryId] === undefined){
areaMap[item.plCountryId] = item.plCountryName;
}
if(berthMap[item.plCountryId] === null || berthMap[item.plCountryId] === undefined){
berthMap[item.plCountryId] =plBerthNum;
}else{
berthMap[item.plCountryId] = berthMap[item.plCountryId]+plBerthNum;
}
});
for(let berthId in berthMap){
this.resultMap.push({
areaName:areaMap[berthId],
berthNum:berthMap[berthId]
})
}
},
//泊位分布 地图展示
baiduMap(mapDatas) {
if (mapDatas.length === 0) {
// 百度地图API功能
let map = new BMap.Map("map", {enableMapClick: false});
let point = new BMap.Point(115.078186, 30.232887);
map.centerAndZoom(point, 15);
map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
let top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角,添加比例尺
let top_left_navigation = new BMap.NavigationControl(); //左上角,添加默认缩放平移控件
let top_right_navigation = new BMap.NavigationControl({
anchor: BMAP_ANCHOR_TOP_RIGHT,
type: BMAP_NAVIGATION_CONTROL_SMALL
}); //右上角,仅包含平移和缩放按钮
map.addControl(top_left_control);
map.addControl(top_left_navigation);
map.addControl(top_right_navigation);
map.clearOverlays();
}
else {
// 百度地图API功能
let map = new BMap.Map("map", {enableMapClick: false});
let point = new BMap.Point(mapDatas[0].lonId, mapDatas[0].latId);
map.centerAndZoom(point, 18);
map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
let top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角,添加比例尺
let top_left_navigation = new BMap.NavigationControl(); //左上角,添加默认缩放平移控件
let top_right_navigation = new BMap.NavigationControl({
anchor: BMAP_ANCHOR_TOP_RIGHT,
type: BMAP_NAVIGATION_CONTROL_SMALL
}); //右上角,仅包含平移和缩放按钮
map.addControl(top_left_control);
map.addControl(top_left_navigation);
map.addControl(top_right_navigation);
map.clearOverlays();
let i = 0;
let points = [];
/* data.reduce((acc, character) => {
return character.name === '黄石港区' ? acc += character.num : acc
}, 0)*/
for (let item in mapDatas) {
(function (x) {
let itemthat = item;
//创建标注
let pt = new BMap.Point(mapDatas[item].lonId, mapDatas[item].latId);
points[i] = pt;
let myIcon = new BMap.Icon(parkIco,
new BMap.Size(29, 40), {
offset: new BMap.Size(10, 40),
textColor: '#fff'
});
let marker = new BMap.Marker(pt, {icon: myIcon});
// marker.setTop(true,27000000);
map.addOverlay(marker);
let myLabel;
marker.addEventListener("mouseover", (e) => {
map.removeOverlay(myLabel);
let that = this;
myLabel = new BMap.Label(
`<div class="dislog-wrap" title="${mapDatas[itemthat].plName}">${mapDatas[itemthat].plName}</div>`,
{
offset: new BMap.Size(40, 0), //label的偏移量,为了让label的中心显示在点上
position: pt
});
myLabel.setStyle({
color: "#fff",
fontSize: "14px",
//
whiteSpace: "nowrap",
height: "24px",
width: "auto",
textAlign: "center",
lineHeight: "24px",
padding: "0 8px",
border: "0",
backgroundColor: "#ff8600",
borderRadius: "10px",
zIndex: "1000"
}
);
marker.setLabel(myLabel)
marker.setTop(true, 27000000);
});
marker.addEventListener("mouseout", function (e) {
map.removeOverlay(myLabel);
});
i++;
})(i);
}
}
},
//新闻中心
getNoticeForPage(){
let req={
baseRequest:{
pageNum:this.currentPage,
pageSize:this.pageSize
},
sysCode: '1001',
noticeBigTypes: [100,200],
orgIds: [10079],
};
queryNoticeForPage(req).then((response) => {
this.pageTotal = response.data.total;
this.newsList = response.data.rows;
console.log(this.newsList)
})
},
// 获取子组件页码方法
handleSizeChange: function(pages) {
this.currentPage = pages.page;
this.pageSize = pages.limit;
this.getNoticeForPage();
},
//新闻详情
showNews (showNews) {
let noticeId=showNews;
queryNotice({
sysCode: '1001',
orgId: '10079',
noticeId:noticeId,
}).then((response) => {
scrollTo(0, 800);
this.see = false;
this.newscontent = response.data.noticeContent;
})
},
//返回首页
backIndex:function () {
this.see = true;
},
}
}
</script>
<style lang="scss">
.index_cont .banner {
background: url("../assets/home/hs_bannerico.jpg") no-repeat center center;
background-size: 100% 100%;
padding-top: 108px;
.ban-tit {
height: 80px;
width: 776px;
background: url("../assets/home/hs_banner_msg.png") no-repeat center center;
background-size: 100% 100%;
margin: 0 auto;
/*margin-top: 108px;*/
}
}
.index_cont .berth {
width: 1200px;
height: 823px;
padding: 50px 0;
position: relative;
margin: 0 auto;
}
.index_cont .map {
width: 1200px;
height: 600px;
}
.index_cont .berth-num {
width: 323px;
height: 368px;
position: absolute;
top: 200px;
right: 80px;
background: url("../assets/home/berth.png") no-repeat;
p {
padding-top: 20px;
font-size: 20px;
}
}
.index_cont .berth-list {
margin-top: 50px;
li {
height: 21px;
line-height: 21px;
font-size: 16px;
color: #314659;
padding: 0 40px 30px 60px;
background: url("../assets/home/berth-list.png") no-repeat 30px 0;
margin-bottom: 15px;
}
}
.index_cont .news-wrap {
width: 1200px;
margin: 0 auto;
padding: 50px 0;
overflow: hidden;
}
.index_cont .title {
padding-bottom: 50px;
font-size: 38px;
font-family: PingFangSC-Semibold;
font-weight: 600;
color: rgba(49, 70, 89, 1);
line-height: 46px;
}
.index_cont .news-bg {
width: 589px;
height: 341px;
margin-right: 45px;
background: url("../assets/home/newsBg.png") no-repeat;
}
.index_cont .news-con {
width: 535px;
height: 301px;
}
.index_cont .news-con > li {
cursor: pointer;
/*padding: 5px 0;*/
font-size: 16px;
color: #000;
height: 30px;
line-height: 30px;
border-bottom: 1px solid rgba(216, 216, 216, 1);
span:first-of-type{
float: left;
width: calc(100% - 80px);
display: inline-block;
vertical-align: middle;
font-size: 16px;
text-align: left;
}
span:nth-of-type(2){
font-size: 14px;
color: rgba(0,0,0,0.5);
float: right;
text-align: justify;
}
}
/*
.date {
width: 83px;
height: 83px;
margin-right: 20px;
background: #FF5656;
position: relative;
h3 {
padding-top: 15px;
font-size: 32px;
color: rgba(255, 255, 255, 1);
}
h5 {
font-size: 12px;
text-align: right;
padding-right: 10px;
color: #Fff;
}
&:before {
content: '';
position: absolute;
right: 14px;
bottom: 36px;
transform: rotate(-45deg);
width: 25px;
height: 1px;
background: rgba(255, 255, 255, 1)
}
}
.des h3 {
padding-bottom: 15px;
font-size: 20px;
color: #0D1A26;
cursor: pointer;
}
.des p {
width: 430px;
line-height: 22px;
color: #314659;
}*/
/*.index_cont .dislog-wrap {
height: 30px;
line-height: 30px;
width: 100%;
padding: 0 4px;
border-radius: 4px;
background-color: #3a8ee6;
color: #fff;
font-size: 14px;
text-align: center;
white-space: nowrap;
}*/
/*新闻内容 样式*/
.news_cont h1 {
font-size: 36px !important;
}
.news_cont h1,.news_cont h2,.news_cont h3,.news_cont h4,.news_cont h5,.news_cont h6 {
font-weight: 300 !important;
}
.news_cont h2 {
font-size: 36px !important;
}
.index_cont a {
text-shadow: none !important;
color: #337ab7 !important;
}
.news_cont{
padding: 20px;
}
.news_cont .returnLastbtn{
cursor: pointer;
width: 60px;
height: 24px;
text-align: center;
line-height: 22px;
background: #da2431 !important;
color: #fff !important;
border: 1px solid #da2431 !important;
border-radius: 4px!important;
box-sizing: border-box;
}
.news_cont #title p {
margin: 20px 0 !important;
text-align: center;
}
.news_cont #content p {
margin: 20px 0 !important;
text-align: left;
text-indent: 24px;
line-height:24px;
}
</style>