<!--
 * @ Author: linqiurong
 * @ Create Time: 2020-09-10 14:31:25
 * @ Modified by: linqiurong
 * @ Modified time: 2021-02-08 14:57:56
 * @ Description: 主要入口
 -->

<template>
  <div id="app">
   <component :is="componentName" ></component>
  </div>
</template>

<script>
import Demo from './components/Demo'
import EginMap from './components/Map'
import Main from './components/Main'
import { getToken } from "./api/arcgis.js"
export default {
  name: 'App',
  components: {
    // Demo,
    EginMap,
    Demo,
    Main
  },
  data() {
    return {
      // componentName: 'Demo', // Demo EginMap
      componentName: 'EginMap',
      // componentName: Main
    } 

  },
  created() {
    this.getToken()
  },
  methods: {
    getToken() {
      //
      let data = {
        username: 'clone' ,
        password: 'egin123456',
        expiration: 3 ,// minutes
        clientid:"ref.http://", // 请求链接
        f: "pjson"
      }
      getToken(data).then((res)=>{
        console.log(res)
        let {token ,expires} = res.data
        if (!token) {
          //
          console.log("get token error: ",res)
        }

        console.log('token:',token, 'expires:',expires)
      })
    }
  }

}
</script>

<style>

</style>
