var amapFile = require('../../utils/amap-wx.js');
var QQMapWX = require('../../utils/qqmap-wx-jssdk.js');   
var app = getApp();

Page({
  data:{
    location_table:[{
      name:"中国民航大学",
      longitude: 117.35002,
      latitude: 39.11198,
    },{
      name:"中国民航大学北苑南门",
      longitude: 117.34731127236174,
      latitude: 39.10971874275899,
    },{
      name:"中国民航大学北苑西门",
      longitude: 117.34878648731993,
      latitude: 39.11463444059635,
    },{
      name:"中国民航大学北苑北门",
      longitude: 117.3517905614166,
      latitude: 39.11623685901714,
    },{
      name:"中国民航大学北苑操场",
      longitude: 117.35193003628538,
      latitude: 39.11286133256378,
    },{
      name:"中国民航大学北苑体育场",
      longitude: 117.35319067452238,
      latitude: 39.11298620078748,
    },{
      name:"中国民航大学北苑游泳馆",
      longitude: 117.35225190136717,
      latitude: 39.113331668385676,
    },{
      name:"中国民航大学北教一",
      longitude: 117.34819103691862,
      latitude: 39.111167265141056,
    },{
      name:"中国民航大学北教四",
      longitude: 117.35005785439299,
      latitude: 39.11041387072548,
    },{
      name:"中国民航大学北教五",
      longitude: 117.348979606369,
      latitude: 39.110580367422955,
    },{
      name:"中国民航大学北二十一宿舍楼",
      longitude: 117.3529251358299,
      latitude: 39.111835323611125,
    },{
      name:"中国民航大学北一食堂",
      longitude: 117.351141466835,
      latitude: 39.11229109820452,
    },{
      name:"中国民航大学北四食堂",
      longitude: 117.34990228627012,
      latitude: 39.11351064491374,
    },{
      name:"中国民航大学北五食堂",
      longitude: 117.35222507927702,
      latitude: 39.114359736647195,
    },{
      name:"中国民航大学北苑礼堂",
      longitude: 117.34922100518034,
      latitude: 39.11285300801614,
    },{
      name:"中国民航大学文化艺术教育中心",
      longitude: 117.35004712555693,
      latitude: 39.11260327087659,
    },{
      name:"中国民航大学北区实验大楼",
      longitude: 117.35049773667143,
      latitude: 39.111554365211944,
    },{
      name:"中国民航大学南一教学楼",
      longitude: 117.35323358986662,
      latitude: 39.10597242612648,
    },{
      name:"中国民航大学南二教学楼",
      longitude: 117.35212851975248,
      latitude: 39.10647610917062,
    },{
      name:"中国民航大学南三教学楼",
      longitude: 117.35269714806364,
      latitude: 39.10509825692947,
    },{
      name:"中国民航大学南四教学楼",
      longitude: 117.35289563153074,
      latitude: 39.104253216397744,
    },{
      name:"中国民航大学南五教学楼",
      longitude: 117.35373784516142,
      latitude: 39.10181794441759,
    },{
      name:"中国民航大学南三教学楼",
      longitude: 117.35483755085752,
      latitude: 39.1078414467564,
    },{
      name:"中国民航大学南苑北门",
      longitude: 117.35484023306654,
      latitude: 39.10783936546857,
    },{
      name:"中国民航大学南苑体育馆",
      longitude: 117.35579778168486,
      latitude: 39.10689653606183,
    },{
      name:"中国民航大学南苑图书馆",
      longitude: 117.35313703034208,
      latitude: 39.10710050464082,
    },{
      name:"中国民航大学南苑田径场西",
      longitude: 117.3557870528488,
      latitude: 39.104977537473204,
    },{
      name:"中国民航大学南苑田径场东",
      longitude: 117.35731054756926,
      latitude: 39.105185674336425,
    },{
      name:"中国民航大学南苑篮球场",
      longitude: 117.3557870528488,
      latitude: 39.1060598424514,
    },{
      name:"中国民航大学南苑排球场",
      longitude: 117.35521842453764,
      latitude: 39.10398679758133,
    },{
      name:"中国民航大学南苑网球场",
      longitude: 117.35609818909452,
      latitude: 39.10344563125516,
    },{
      name:"中国民航大学南苑羽乒馆",
      longitude: 117.35184957001493,
      latitude: 39.105310556161044,
    },{
      name:"中国民航大学南苑明德馆",
      longitude: 117.35486437294767,
      latitude: 39.10133087992974,
    },{
      name:"中国民航大学南一食堂",
      longitude: 117.35289026711271,
      latitude: 39.10357884181467,
    },{
      name:"中国民航大学南二食堂",
      longitude: 117.35157598469542,
      latitude: 39.1017846409744,
    },{
      name:"中国民航大学南三食堂",
      longitude: 117.35169400189207,
      latitude: 39.10357467898941,
    },{
      name:"中国民航大学南一宿舍楼",
      longitude: 117.3534642598419,
      latitude: 39.10355386485458,
    },{
      name:"中国民航大学南苑菜鸟驿站",
      longitude: 117.35596944306181,
      latitude: 39.10322500071765,
    }],
    src: {
      longitude: 1.1,
      latitude: 1.1,
    },
    des: {
      longitude: 1.1,
      latitude: 1.1,
    },
    src_location: "",
    des_location: "",
    // 初始展示时的经纬度
    longitude: 117.35002,
    latitude: 39.11198,
    // 初始的缩放比例
    scale:15,
    // 统一设置地图
    setting : {
      skew: 0,
      rotate: 0,
      showLocation: false,
      showScale: false,
      subKey: '',
      layerStyle: 1,
      enableZoom: true,
      enableScroll: true,
      enableRotate: false,
      showCompass: false,
      enable3D: false,
      enableOverlooking: false,
      enableSatellite: false,
      enableTraffic: false,
    },
    // 初始化显示地标
    markers:[{
      //id: 1,
      longitude: 117.35002,
      latitude: 39.11198,
      title:"中国民航大学",
      iconPath:"../../images/tag.png",
      width: 20,
      height: 30
    }],
    // 显示按钮是否被点击
    type_door: "type",
    type_mess: "type",
    type_bathroom: "type",
    type_print_shop: "type",
    type_supermarket: "type",
    type_post_station: "type",
    type_library: "type",
    type_barber_shop: "type",
    type_playground: "type",
    type_gymnasium: "type",
    type_cancel: "type",
    distance: '',
    cost: '',
    polyline: []
    },

  // 界面出现即执行      
  onLoad:function(options){
      this.setData({
        // 仅设置的属性会生效，其它的不受影响
        setting: {
          // 展示目前位置
          showLocation: true,
          // 右上角指南针
          showCompass: true,
          // 左下角比例尺
          showScale: true,
          enable3D: true,
          //enableTraffic: true
        }
      })
  },

  // 输入框获取出发地
  getSrc_location: function(event){
    this.setData({
      src_location: event.detail.value
    })
    console.log("获取出发地调用成功", event)
    // 对内部使用变量重新赋值，否则无法使用
    let location_table = this.data.location_table
    let src_location = this.data.src_location
    var that = this;
    var qqmapsdk = new QQMapWX({
          key: 'MVJBZ-KOICX-B6W4G-TH5QR-MKW2E-5YBJA'                      //必需，自己申请
    })
    // geoCoder 根据地址获取经纬度
    qqmapsdk.geocoder({
      address: this.data.src_location,                     //需要转换为经纬度的地址
      success: function (res) {               //返回的数据里面有该地址的经纬度
        console.log("qqmapsdk.geocoder 接口调用成功返回的回调", res)
        that.data.src.longitude = res.result.location.lng;
        that.data.src.latitude = res.result.location.lat;
      },
      fail: function (res) {
        console.log("qqmapsdk.geocoder 接口调用失败返回的回调,准备查询本地映射表", res)
        // 查询映射表
        // let location = app.globalData.location
        // let location = this.data.location
        let i
        let length = location_table.length
        for (i=0; i<length; i++){
          if (src_location==location_table[i].name){
            console.log("本地映射表地理编码匹配成功", location_table[i].longitude, location_table[i].latitude)
            that.data.src.longitude = location_table[i].longitude
            that.data.src.latitude = location_table[i].latitude
            break;
          }
        }
      },
      complete: function (res) {
        // console.log(“complete”); 
      }
    });
  },

  // 输入框获取目的地
  getDes_location: function(event){
      this.setData({
        des_location: event.detail.value
      })
      console.log("获取目的地调用成功", event)
      // 对内部使用变量重新赋值，否则无法使用
      let location_table = this.data.location_table
      let des_location = this.data.des_location
      var that = this;

      var qqmapsdk = new QQMapWX({
            key: 'MVJBZ-KOICX-B6W4G-TH5QR-MKW2E-5YBJA'                      //必需，自己申请
      })
      // geoCoder 根据地址获取经纬度
      qqmapsdk.geocoder({
        address: this.data.des_location,                     //需要转换为经纬度的地址
        success: function (res) {               //返回的数据里面有该地址的经纬度
          console.log("qqmapsdk.geocoder 接口调用成功返回的回调", res)
          that.data.des.longitude = res.result.location.lng;
          that.data.des.latitude = res.result.location.lat;
        },
        fail: function (res) {
          console.log("qqmapsdk.geocoder 接口调用失败返回的回调，准备查询本地映射表", res)
          // 查询映射表
          // let location = app.globalData.location
          // let location = this.data.location
          let i
          let length = location_table.length
          for (i=0; i<length; i++){
            if (des_location==location_table[i].name){
              console.log("本地映射表地理编码匹配成功", location_table[i].name, location_table[i].longitude, location_table[i].latitude)
              that.data.des.longitude = location_table[i].longitude
              that.data.des.latitude = location_table[i].latitude
              break;
            }
          }
        },
        complete: function (res) {
          // console.log(“complete”); 
        }
      });
  },
  
  // 获取驾车路线  // https://apis.map.qq.com
  getCarRoute: function(){
        this.setData({
            markers: [{
              iconPath: "../../images/src.jpeg",
              longitude: this.data.src.longitude,
              latitude: this.data.src.latitude,
              // longitude: 117.3573534629135,
              // latitude: 39.10519399980569,
              width: 23,
              height: 33
            },{
              iconPath: "../../images/destination.jpeg",
              longitude: this.data.des.longitude,
              latitude: this.data.des.latitude,
              // longitude: 117.35190857861326,
              // latitude: 39.112844683451186,
              width: 24,
              height: 34
            }],
        })
        // https://restapi.amap.com
      var that = this;
      // var key = config.Config.key;
      var key = '78a99442f6e5cad3bfb832e33bdcf629';
      var myAmapFun = new amapFile.AMapWX({key: '78a99442f6e5cad3bfb832e33bdcf629'});
      myAmapFun.getDrivingRoute({
        origin: this.data.src.longitude + ',' + this.data.src.latitude,
        destination: this.data.des.longitude + ',' + this.data.des.latitude,
        // origin: '117.3573534629135,39.10519399980569',
        // destination: '117.35190857861326,39.112844683451186',
        success: function(data){
          console.log("开始导航", data, data.paths)
          var points = [];
          if(data.paths && data.paths[0] && data.paths[0].steps){
            var steps = data.paths[0].steps;
            for(var i = 0; i < steps.length; i++){
              var poLen = steps[i].polyline.split(';');
              for(var j = 0;j < poLen.length; j++){
                points.push({
                  longitude: parseFloat(poLen[j].split(',')[0]),
                  latitude: parseFloat(poLen[j].split(',')[1])
                })
              } 
            }
          }
          that.setData({
            polyline: [{
              points: points,
              color: "#0091ff",
              width: 6
            }]
          });
          if(data.paths[0] && data.paths[0].distance){
            that.setData({
              distance: data.paths[0].distance + '米'
            });
          }
          if(data.taxi_cost){
            that.setData({
              cost: '打车约' + parseInt(data.taxi_cost) + '元'
            });
          }
            
        },
        fail: function(info){
  
        }
      })
  },
  getRideRoute:function(){
      this.setData({
        markers: [{
          iconPath: "../../images/src.jpeg",
          longitude: this.data.src.longitude,
          latitude: this.data.src.latitude,
          width: 23,
          height: 33
        },{
          iconPath: "../../images/destination.jpeg",
          longitude: this.data.des.longitude,
          latitude: this.data.des.latitude,
          width: 24,
          height: 34
        }],
    })
    //     var that = this;
    // var key = config.Config.key;
    // var myAmapFun = new amapFile.AMapWX({key: '高德Key'});
    var that = this;
    var key = '78a99442f6e5cad3bfb832e33bdcf629';
    var myAmapFun = new amapFile.AMapWX({key: '78a99442f6e5cad3bfb832e33bdcf629'});
    myAmapFun.getRidingRoute({
      origin: this.data.src.longitude + ',' + this.data.src.latitude,
      destination: this.data.des.longitude + ',' + this.data.des.latitude,
      // origin: '117.3573534629135,39.10519399980569',
      // destination: '117.35190857861326,39.112844683451186',
      success: function(data){
        console.log(data)
        var points = [];
        if(data.paths && data.paths[0] && data.paths[0].rides){
          var steps = data.paths[0].rides;
          for(var i = 0; i < steps.length; i++){
            var poLen = steps[i].polyline.split(';');
            for(var j = 0;j < poLen.length; j++){
              points.push({
                longitude: parseFloat(poLen[j].split(',')[0]),
                latitude: parseFloat(poLen[j].split(',')[1])
              })
            } 
          }
        }
        that.setData({
          polyline: [{
            points: points,
            color: "#0091ff",
            width: 6
          }]
        });
        if(data.paths[0] && data.paths[0].distance){
          that.setData({
            distance: data.paths[0].distance + '米'
          });
        }
        if(data.taxi_cost){
          that.setData({
            cost: '打车约' + parseInt(data.taxi_cost) + '元'
          });
        }
      },
      fail: function(info){   

      }
    })
  },
  getWalkRoute: function(){
      this.setData({
        markers: [{
          iconPath: "../../images/src.jpeg",
          longitude: this.data.src.longitude,
          latitude: this.data.src.latitude,
          width: 23,
          height: 33
        },{
          iconPath: "../../images/destination.jpeg",
          longitude: this.data.des.longitude,
          latitude: this.data.des.latitude,
          width: 24,
          height: 34
        }],
    })
        // var that = this;
        // var key = config.Config.key;
        // var myAmapFun = new amapFile.AMapWX({key: '高德Key'});
        var that = this;
        var key = '78a99442f6e5cad3bfb832e33bdcf629';
        var myAmapFun = new amapFile.AMapWX({key: '78a99442f6e5cad3bfb832e33bdcf629'});
        myAmapFun.getWalkingRoute({
          origin: this.data.src.longitude + ',' + this.data.src.latitude,
          destination: this.data.des.longitude + ',' + this.data.des.latitude,
          // origin: '117.3573534629135,39.10519399980569',
          // destination: '117.35190857861326,39.112844683451186',
          success: function(data){
            
            var points = [];
            if(data.paths && data.paths[0] && data.paths[0].steps){
              var steps = data.paths[0].steps;
              for(var i = 0; i < steps.length; i++){
                var poLen = steps[i].polyline.split(';');
                for(var j = 0;j < poLen.length; j++){
                  points.push({
                    longitude: parseFloat(poLen[j].split(',')[0]),
                    latitude: parseFloat(poLen[j].split(',')[1])
                  })
                } 
              }
            }
            that.setData({
              polyline: [{
                points: points,
                color: "#0091ff",
                width: 6
              }]
            });
            if(data.paths[0] && data.paths[0].distance){
              that.setData({
                distance: data.paths[0].distance + '米'
              });
            }
            if(data.paths[0] && data.paths[0].duration){
              that.setData({
                cost: parseInt(data.paths[0].duration/60) + '分钟'
            });
          }
            
        },
        fail: function(info){
    
        }
      })
  },

    
  goDetail: function(){
    wx.navigateTo({
      url: '../navigation_car_detail/navigation_car'
    })
  },

  // 天气
  getWeather: function() {
    wx.navigateTo({
      url: '../getWeather/getWeather'
    })
  },

  /*************************地标按钮响应函数**************************/
  // 校门响应函数
  cauc_door: function (e) {
      this.setData({
        type_door: "chouse_type",
        type_mess: "type",
        type_bathroom: "type",
        type_print_shop: "type",
        type_supermarket: "type",
        type_post_station: "type",
        type_library: "type",
        type_barber_shop: "type",
        type_playground: "type",
        type_gymnasium: "type",
        markers: [{
          longitude: 117.354843,
          latitude: 39.107841,
          title:"南校区北门",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        },{
          longitude: 117.34879721615599,
          latitude: 39.11463027842158,
          title:"北校区西门",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        },{
          longitude: 117.34675873730467,
          latitude: 39.1119622748226,
          title:"北校区西1门",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        },{
          longitude: 117.3471610686569,
          latitude: 39.112449265854906,
          title:"北校区西2门",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        },{
          longitude: 117.34930147145079,
          latitude: 39.114875846215504,
          title:"北校区东南门",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        },{
          longitude: 117.35180129025267,
          latitude: 39.11623685900147,
          title:"北校区东南门",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        }]
    })},
  // 食堂响应函数
  cauc_mess_hall: function (e) {
      this.setData({
        type_door: "type",
        type_mess: "chouse_type",
        type_bathroom: "type",
        type_print_shop: "type",
        type_supermarket: "type",
        type_post_station: "type",
        type_library: "type",
        type_barber_shop: "type",
        type_playground: "type",
        type_gymnasium: "type",
          longitude: 117.35002,
          latitude: 39.11198,
          markers: [
          //   {
          //   longitude: 117.4,
          //   latitude: 39.111,
          //   title:"北一食堂",
          //   iconPath:"../../images/caucLocation.png",
          //   width: 20,
          //   height: 30
          // },
          {
            longitude: 117.35101272080229,
            latitude: 39.11235353283619,
            title:"北二食堂",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          },
          // {
          //   longitude: 117.4,
          //   latitude: 39.111,
          //   title:"北三食堂",
          //   iconPath:"../../images/caucLocation.png",
          //   width: 20,
          //   height: 30
          // },
          {
            longitude: 117.34989692185209,
            latitude: 39.1135189693791,
            title:"北四食堂",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          },{
            longitude: 117.35221435044096,
            latitude: 39.11435973663358,
            title:"北五食堂",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          },{
            longitude: 117.35288490269468,
            latitude: 39.10358300464356,
            title:"南一食堂",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          },{
            longitude: 117.35156525585936,
            latitude: 39.10178464097705,
            title:"南二食堂",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          },{
            longitude: 117.35166181538389,
            latitude: 39.10359549312345,
            title:"南三食堂",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          }]
      })
  },
  // 浴室响应函数
  cauc_bathroom: function (e) {
      this.setData({
        type_door: "type",
        type_mess: "type",
        type_bathroom: "chouse_type",
        type_print_shop: "type",
        type_supermarket: "type",
        type_post_station: "type",
        type_library: "type",
        type_barber_shop: "type",
        type_playground: "type",
        type_gymnasium: "type",
          longitude: 117.35002,
          latitude: 39.11198,
        markers: [{
          longitude: 117.35336770031736,
          latitude: 39.11121305128611,
          title:"北苑浴室",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        },{
          longitude: 117.35172082398222,
          latitude: 39.1032499778015,
          title:"南苑浴室",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        }]
      })
  },
  // 打印店响应函数
  cauc_print_shop: function (e) {
      this.setData({
        type_door: "type",
        type_mess: "type",
        type_bathroom: "type",
        type_print_shop: "chouse_type",
        type_supermarket: "type",
        type_post_station: "type",
        type_library: "type",
        type_barber_shop: "type",
        type_playground: "type",
        type_gymnasium: "type", 
          longitude: 117.35002,
          latitude: 39.11198,
        markers: [{
          longitude: 117.35359837029264,
          latitude: 39.111046556072324,
          title:"北苑2楼打印店",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        },{
          longitude: 117.35132385704802,
          latitude: 39.10350807373537,
          title:"南苑1楼打印店",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        }]
      })
  },
  // 超市
  cauc_supermarket: function (e) {
      this.setData({
        type_door: "type",
        type_mess: "type",
        type_bathroom: "type",
        type_print_shop: "type",
        type_supermarket: "chouse_type",
        type_post_station: "type",
        type_library: "type",
        type_barber_shop: "type",
        type_playground: "type",
        type_gymnasium: "type",  
          longitude: 117.35002,
          latitude: 39.11198,
        markers: [{
          longitude: 117.35348035309599,
          latitude: 39.11097163310499,
          title:"北苑便利店",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        },{
          longitude: 117.35284735176847,
          latitude: 39.10347477108574,
          title:"南一食堂一楼便利店",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        },{
          longitude: 117.35272933457182,
          latitude: 39.1032416521003,
          title:"南苑便利店1",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        },{
          longitude: 117.35230554554747,
          latitude: 39.103237489254305,
          title:"南苑便利店2",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        }]
      })
  },
  // 菜鸟驿站
  cauc_post_station: function (e) {
      this.setData({
        type_door: "type",
        type_mess: "type",
        type_bathroom: "type",
        type_print_shop: "type",
        type_supermarket: "type",
        type_post_station: "chouse_type",
        type_library: "type",
        type_barber_shop: "type",
        type_playground: "type",
        type_gymnasium: "type",  
          longitude: 117.35002,
          latitude: 39.11198,
        markers: [{
          longitude: 117.35325504753874,
          latitude: 39.111046556074136,
          title:"北苑菜鸟驿站",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        },{
          longitude: 117.35596407864378,
          latitude: 39.10323332641014,
          title:"南一食堂一楼便利店",
          iconPath:"../../images/tag.png",
          width: 20,
          height: 30
        }]
      })
  },
  // 图书馆
  cauc_library: function (e) {
        this.setData({
          type_door: "type",
          type_mess: "type",
          type_bathroom: "type",
          type_print_shop: "type",
          type_supermarket: "type",
          type_post_station: "type",
          type_library: "chouse_type",
          type_barber_shop: "type",
          type_playground: "type",
          type_gymnasium: "type",
            longitude: 117.35002,
            latitude: 39.11198,
          markers: [{
            longitude: 117.35484827969358,
            latitude: 39.10131839105389,
            title:"南苑新图书馆（明德馆）",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          },{
            longitude: 117.35314775917814,
            latitude: 39.107108829881625,
            title:"南苑老图书馆",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          }]
        })
  },
  // 理发店
  cauc_barber_shop: function (e) {
        this.setData({
          type_door: "type",
          type_mess: "type",
          type_bathroom: "type",
          type_print_shop: "type",
          type_supermarket: "type",
          type_post_station: "type",
          type_library: "type",
          type_barber_shop: "chouse_type",
          type_playground: "type",
          type_gymnasium: "type",
            longitude: 117.35002,
            latitude: 39.11198,
          markers: [{
            longitude: 117.35343207333372,
            latitude: 39.11102574414913,
            title:"北苑2楼理发店",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          },{
            longitude: 117.3506372115402,
            latitude: 39.10327495486333,
            title:"南苑理发店",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          }]
        })
  },
  // 操场
  cauc_playground: function (e) {
        this.setData({
          type_door: "type",
          type_mess: "type",
          type_bathroom: "type",
          type_print_shop: "type",
          type_supermarket: "type",
          type_post_station: "type",
          type_library: "type",
          type_barber_shop: "type",
          type_playground: "chouse_type",
          type_gymnasium: "type",  
            longitude: 117.35002,
            latitude: 39.11198,
          markers: [{
            longitude: 117.35190857861326,
            latitude: 39.112844683451186,
            title:"北苑田径场",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          },{
            longitude: 117.35190857861326,
            latitude: 39.112844683451186,
            title:"南苑西田径场",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          },{
            longitude: 117.3573534629135,
            latitude: 39.10519399980569,
            title:"南苑东田径场",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          }]
        })
  },
  // 体育馆
  cauc_gymnasium: function (e) {
        this.setData({
          type_door: "type",
          type_mess: "type",
          type_bathroom: "type",
          type_print_shop: "type",
          type_supermarket: "type",
          type_post_station: "type",
          type_library: "type",
          type_barber_shop: "type",
          type_playground: "type",
          type_gymnasium: "chouse_type", 
            longitude: 117.35002,
            latitude: 39.11198,
          markers: [{
            longitude: 117.35586215470121,
            latitude: 39.10690486133047,
            title:"北苑田径场",
            iconPath:"../../images/tag.png",
            width: 20,
            height: 30
          }]
        })
  },
})

