Commit 36fce773c317715d000db32cdd7c6059dbc72f1e

Authored by Andy
1 parent 8957e288

add 新闻中心请求后端动态显示 新闻详情页面展示

src/api/park.js
1 1 import request from '@/utils/request'
2 2  
3 3 /**
4   - * 获取车主账户
  4 + * 获取车场 泊位区间 泊位等信息
5 5 * @param param
6 6 */
7 7 export function queryParkLotInfoByOrgId(param) {
... ... @@ -11,3 +11,26 @@ export function queryParkLotInfoByOrgId(param) {
11 11 data:param
12 12 })
13 13 }
  14 +
  15 +/**
  16 + * 获取新闻中心信息
  17 + * @param param
  18 + */
  19 +export function queryNoticeForPage(param) {
  20 + return request({
  21 + url: 'http://sys.service.huangshiparking.com/sysNotice/queryNoticeForPage',
  22 + method: 'post',
  23 + data:param
  24 + })
  25 +}
  26 +/**
  27 + * 获取新闻中心信息
  28 + * @param param
  29 + */
  30 +export function queryNotice(param) {
  31 + return request({
  32 + url: 'http://sys.service.huangshiparking.com/sysNotice/queryNotice',
  33 + method: 'post',
  34 + data:param
  35 + })
  36 +}
... ...
src/assets/home/newsBg.png 0 → 100644

472 KB

src/assets/home/parkIco.png 0 → 100644

1.06 KB

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