chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
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
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <meta http-equiv="Cache-Control" content="no-cache"/>
    <title>{yun:}$title{/yun}</title>
    <meta name="keywords" content="{yun:}$keywords{/yun},wap"/>
    <meta name="description" content="{yun:}$description{/yun}"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width" initial-scale="1"/>
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=no, width=device-width"/>
    <script src="{yun:}$wap_style{/yun}/js/flexible.js?v={yun:}$config.cachecode{/yun}"></script>
    <link rel="stylesheet" href="{yun:}$config.sy_weburl{/yun}/app/template/wap/css/css.css?v={yun:}$config.cachecode{/yun}" type="text/css"/>
    <link rel="stylesheet" href="{yun:}$config.sy_weburl{/yun}/app/template/wap/css/job.css?v={yun:}$config.cachecode{/yun}" type="text/css"/>
    <link rel="stylesheet" href="{yun:}$config.sy_weburl{/yun}/app/template/wap/css/map.css?v={yun:}$config.cachecode{/yun}" type="text/css"/>
    <link href="{yun:}$config_wapdomain{/yun}/js/vant/lib/index.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" />
    <link rel="stylesheet"
        href="{yun:}$config.sy_weburl{/yun}/app/template/wap/css/base.css?v={yun:}$config.cachecode{/yun}"
        type="text/css" />
 
</head>
 
<body>
<header>
    <div class="headerpx"  >
        <div class="headerpx_bg {yun:}if $tplmoblie.color{/yun}bg{yun:}$tplmoblie.color{/yun}{yun:}/if{/yun}">
            <a class="hd-lbtn" href="javascript:goBack();"><i class="headerpx_top_l"></i></a>
            <div class="headerpx_h1">{yun:}$headertitle{/yun}</div>
        </div>
    </div>
</header>
<div id="loading">
    <i class="loading_icon"></i>
</div>
 
<div class="yun_map_tit">
    <ul>
        <li>
            <a href="{yun:}url m=wap c=map x=$smarty.get.x y=$smarty.get.y{/yun}">列表</a>
        </li>
        <li class="yun_map_cur">
            <a href="{yun:}url m=wap c=map a=maplist x=$smarty.get.x y=$smarty.get.y{/yun}" class="">地图</a>
        </li>
    </ul>
</div>
<div id="allmap"></div>
<input type="hidden" name="x" id="mapx" value="{yun:}$mapx{/yun}"/>
<input type="hidden" name="y" id="mapy" value="{yun:}$mapy{/yun}"/>
<!--左面-->
<div id="map-controls">
    <button id="show-company-list"><i class="map_list map_iconfont_search_map "></i></button>
    <button id="my-location"><i class="map_jz_list map_iconfont_search_map_nav "></i></button>
</div>
<!--右面放大缩小-->
<!--公司-->
<!--下面公司-->
<div id="company-panel-controls" style="display:none;">
    <span id="company-panel-close" class="icon close" style="display: none;"></span>
    <span id="company-panel-refresh">换一批<span class="icon refresh"></span><i class="iconfont map_iconfont_search_map_nav_hyh" style="font-size:16px; margin-left:5px;"></i></span>
</div>
<div id="company-panel" style="display:none;">
    <div id="company-list" style="margin-left: 0; width:100%;"></div>
    <ul id="company-indicator"></ul>
    <span id="company-list-prev" class="icon prev"><i class="iconfont company-listicon"></i></span>
    <span id="company-list-next" class="icon next"><i class="iconfont company-listicon"></i></span>
</div>
<style type="text/css">
    #allmap {
        width: 100%;
        height: 87%;
        overflow: hidden;
        margin: 0;
        font-family: "微软雅黑";
        position: absolute;
    }
</style>
    {yun:}include file="$wapstyle/publichtm/public_js.htm"{/yun}
 
<script src="{yun:}$config.sy_weburl{/yun}/app/template/wap/js/prefixfree.min.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script type="text/javascript" src="{yun:}$config.mapurl{/yun}"></script>
<script type="text/javascript">
    var wapurl = '{yun:}url m=wap{/yun}';
    var x = $("#mapx").val();
    var y = $("#mapy").val();
    var configx = parseFloat("{yun:}$config.map_x{/yun}");
    var configy = parseFloat("{yun:}$config.map_y{/yun}");
    var map = new BMap.Map("allmap");
    if (x > 0 && y > 0) {
        var point = new BMap.Point(x, y);
    } else {
        if (configx > 0 && configy > 0) {
            var point = new BMap.Point(configx, configy);
        } else {
            var point = new BMap.Point(116.39131928, 39.90793074);
        }
    }
    var map_zoom = 15; //3---18                           //设置地图初始缩放级别
    map.centerAndZoom(point, map_zoom); //设置中心点和地图缩放级别
    var company_list_index = 0; //1-10
    var company_list_index_max = 9;
    var res;
    var mk_list = new Array();
    var pagecount = 1;
    var page = 1;
    var location_r = {
        x: '',
        y: ''
    };
    var u = navigator.userAgent, osname = null;
    if (u.indexOf('Android') > -1 || u.indexOf('Adr') > -1) {
        osname = 'Android';
    } else if (!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
        osname = 'iOS';
    }
 
    setTimeout(function(){
        $('#loading').hide(0);
    },1000);
 
    $(function () {
        if (x > 0 && y > 0) {
            get_com_list(page, x, y);
        } else {
            get_current_loaction(page);
        }
        $('#my-location').click(function () {
            get_current_loaction(1);
        });
        $('#company-panel-refresh').click(function () {
            get_com_list((page < pagecount) ? ++page : pagecount, x, y);
        });
    });
 
    function show_info_window(marker) {
        var i = marker.tag;
        var joblist_html = '';
        var joblist_length = 0;
        if (res.list[i].joblist.length > 0) {
            for (var j = 0; j < res.list[i].joblist.length; j++) {
                joblist_html += '<li><a href="' + res.list[i].joblist[j].joburl + '">' + res.list[i].joblist[j].name + '</a></li>';
            }
            joblist_length = res.list[i].joblist.length;
        }
        var info_html = ' <div class="map_company">' + '<div class="map_company_cont">' + '<ul class="map_company_post">' + joblist_html + '</ul>' + '<div class="map_company_xq"><a href="' + res.list[i].comurl + '">查看详情>></a></div>' + '</div>' + '</div>';
        var infoWindow = new BMap.InfoWindow(info_html, {
            title: '<div class="map_company_h1"><a style="color:#000;" href="' + res.list[i].comurl + '">' + res.list[i].com_name + '</a></div>',
            width: 100,
            height: 20 * joblist_length + 90
        });
        marker.openInfoWindow(infoWindow);
    }
 
    function get_current_loaction(page) {
        var geolocation = new BMap.Geolocation();
        geolocation.getCurrentPosition(function (r) {
            if (this.getStatus() == BMAP_STATUS_SUCCESS) {
                x = r.point.lng;
                y = r.point.lat;
                var local_point = new BMap.Point(x, y);
                map.centerAndZoom(local_point, 15);
                map.panTo(local_point);
                get_com_list(page, x, y);
                location_r.x = x;
                location_r.y = y;
                $('#mapx').val(x);
                $('#mapy').val(y);
                $.post(wapurl + 'index.php?c=job&a=distance', {
                    x: r.point.lng,
                    y: r.point.lat
                }, function (data) {
                })
            } else {
                alert('failed' + this.getStatus());
            }
        }, {
            enableHighAccuracy: true
        });
    }
 
    function get_com_list(page, x, y) {
        var map = new BMap.Map("allmap");
        map.centerAndZoom(new BMap.Point(x, y), 13);
        var top_right_navigation = new BMap.NavigationControl({
            anchor: BMAP_ANCHOR_BOTTOM_RIGHT,
            type: BMAP_NAVIGATION_CONTROL_SMALL,
            offset: new BMap.Size(0, 105)
        });
        map.addControl(top_right_navigation);
        var localcenter = null;
        $.post('index.php?c=map&a=comlist', {
            x: x,
            y: y,
            page: page
        }, function (data) {
            if (data) {
                res = eval('(' + data + ')');
                pagecount = res.pagecount;
                var company_indicator_html = '';
                var company_list_html = '';
                if (res.list.length > 0) {
                    location_r.x = res.list[0].x;
                    location_r.y = res.list[0].y;
                    var info_point = new BMap.Point(res.list[0].x, res.list[0].y);
                    map.centerAndZoom(info_point, 15);
                    map.panTo(info_point);
                    for (var i = 0; i < res.list.length; i++) {
                        info_point = new BMap.Point(res.list[i].x, res.list[i].y);
                        var mk = new BMap.Marker(info_point);
                        mk.tag = i;
                        mk.addEventListener("click", function () {
                            show_info_window(this);
                        });
 
                        company_indicator_html += '<li ' + (i == 0 ? 'class="current"' : '') + ' style="width: 10%;"></li>';
                        company_list_html += '<div class="company-info" style="width: ' + document.body.clientWidth + 'px;">' +
                            '<h3 class="company-title"><a href="' + res.list[i].comurl + '">' + res.list[i].com_name + '</a></h3>' +
                            '</div>  ';
                        mk_list[i] = mk;
                        map.addOverlay(mk);
                    }
                    $('#company-panel-controls').show();
                    $('#company-panel').show();
                } else {
                    showToast('您的附近没有相关职位!', 2);
                    $('#company-panel-controls').hide();
                    $('#company-panel').hide();
                    var info_point = new BMap.Point(x, y);
                    var mk = new BMap.Marker(info_point);
                    map.addOverlay(mk);
                    map.panTo(info_point);
                }
                company_list_index_max = res.list.length;
                $('#company-indicator').html(company_indicator_html);
                $('#company-list').html(company_list_html);
                $('#company-list').width(document.body.clientWidth * res.list.length);
                localcenter = map.getCenter();
            }
        });
        if (osname == 'Android') {
            var xArr = [];//存放横坐标
            var yArr = [];//存放纵坐标
            map.addEventListener("touchstart", function (e) {
                //手指触摸屏幕的时候清空两个数组
                xArr.length = 0;
                yArr.length = 0;
            });
            map.addEventListener("touchmove", function (e) {
                //如果滑动了屏幕,xArr和yArr将各存入两个坐标值,即始末坐标值
                xArr.push(e.targetTouches[0].pageX);
                yArr.push(e.targetTouches[0].pageY);
            });
            map.addEventListener('touchend', function (e) {
                var far;
                var flag = true;
                //计算平移距离,区分滑动事件和点击事件
                if ((xArr.length > 1) && (yArr.length > 1)) {
                    var lastx = xArr.length - 1;
                    var lasty = yArr.length - 1;
                    far = (Math.abs(xArr[0] - xArr[lastx])) ^ 2 + (Math.abs(yArr[0] - yArr[lasty])) ^ 2;
                    if (far > 0) {
                        flag = false;
                    }
                }
                setTimeout(function () {
                    var nowcenter = map.getCenter();
                    if (nowcenter.lat != localcenter.lat && nowcenter.lng != localcenter.lng) {
                        localcenter = nowcenter;
                        flag = false;
                    }
                    if (flag) {
                        if (!e.overlay) {
                            showConfirm('您确定查找该地区附近的职位吗?', function(){
                                setTimeout(function () {
                                    location.href = wapurl + "index.php?c=map&x=" + e.point.lng + "&y=" + e.point.lat + "";
                                }, 0);
                            });
                        }
                    }
                }, 300);
            });
        } else {
            var click = 1;
            map.addEventListener("touchstart", function (e) {
                click = 1;
            });
            map.addEventListener("touchmove", function (e) {
                click = 0;
            });
            map.addEventListener('touchend', function (e) {
                if (click == 1) {
                    if (!e.overlay) {
                        showConfirm('您确定查找该地区附近的职位吗?', function(){
                            setTimeout(function () {
                                location.href = wapurl + "index.php?c=map&x=" + e.point.lng + "&y=" + e.point.lat + "";
                            }, 0);
                        });
                    }
                }
            });
        }
    }
</script>
</body>
 
</html>