GithubHelp home page GithubHelp logo

beijingsubway's Introduction

北京地铁图

北京地铁图,基于svg开发,支持PC、移动端多种浏览器。 在这里插入图片描述


项目介绍

  • 技术点

1.node代理请求https://map.bjsubway.com/数据

app.use('/', proxy({
    target: 'https://map.bjsubway.com/',
    pathRewrite: {
        '^/apis': '' // 重写请求,比如我们源访问的是api/old-path,那么请求会被解析为/api/new-path
    },
    changeOrigin: true
}));

2.请求结果XML格式解析

$.ajax({
    url: "/apis/subwaymap/beijing.xml",
    dataType: 'xml',
    type: 'GET',
    timeout: 5000,
    success: function(data) {
        var ls = $(data).find("sw").children()
        ...
    })
});

3.gulp构建工具,文件打包

//监控文件变化
gulp.task('watch', function() {
    gulp.watch(["src/css/*.css", "src/js/*.js"], ['default']);
});

gulp.task('default', function(cb) {
    runSequence('other', ['css', 'js'], 'html')(cb);
})
  • 数据来源--北京地铁官网

项目安装

git clone https://github.com/StavinLi/beiJingSubway.git

项目运行

1.环境依赖 npm i 2.本地运行 npm run start 3.打包运行 npm run build

目录结构描述

├── Readme.md                   //help
├── dest                        //发布包
│   ├── css
│   ├── js                
│   └── *.html        
├── libs                        //第三方文件
├── node_modules                  
├── rev                         //静态版本json
├── src                         //开发包
└── gulpfile.js

更新记录

2018.12.06
    -  init commit
2018.12.07
    -  node 跨求请求xml
    -  跨域 pathRewrite
2018.12.10
    -  require("open") 本地运行打开新窗口
    -  西二旗坐标空格导致移动端显示错误
2018.12.19
    -  新增站点hover 信息
2018.12.20
    -  新增自定义线路
    -  修复少换乘切换相同换乘次数时,未综合考虑时间因素
    -  新增耗时、途径、换乘、票价
2018.12.21
    -  新增起止点转换
2019.9.6
    -  node 新增 设置证书免校验

总结注意

1.line 标签西二旗属性 lb="西二旗" x="757 " 其中x属性中空格在移动端造成坐标失效,解决办法: $(this).attr("x")*1

beijingsubway's People

Contributors

stavinli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.