<template>

  <div class="container-fluid mt-1">
    <div class="card">
      <div class="row">
        <div class="col-1">选择服务器</div>
        <div class="col-2">
          <el-select v-model="serverselected" placeholder="选择服务器">
            <el-option v-for="item in servers" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </div>
        <div class="col-1">玩家唯一ID</div>
        <div class="col-2">
          <el-input v-model="puid" placeholder="玩家唯一ID"></el-input>
        </div>
      </div>
      <el-button round type="primary" class="btn-block" v-on:click="ontest">测试</el-button>
    </div>
  </div>



  <!-- <div class="container-fluid mt-1">
    <div class="container-fluid mt-1">
      <div class="row bg-white">
        <div class="col-2 p-3 bg-primary text-white">选择服务器</div>
        <div class="col-3 p-3 bg-primary text-white">
          <select v-model="serveradd" name="server">
            <option value="http://localhost:9002/api/gm/action">本机</option>
            <option value="http://localhost:9002/api/gm/action">内网测试服</option>
            <option value="http://localhost:9002/api/gm/action">审核服</option>
          </select>
        </div>
        <div class="col-2 p-3 bg-info text-white">玩家唯一ID</div>
        <div class="col-3 p-3 bg-info text-white">
          <input v-model="puid" placeholder="玩家唯一ID......">
        </div>
      </div>
    </div>

    <div class="container-fluid mt-1">
      <div class="row">
        <div class="col-3 card">
          <div class="card-body">
            <div class="d-grid">
              <button type="button" class="btn btn-primary btn-block mt-1">货币添加</button>
            </div>
            <div class="d-grid">
              <button type="button" class="btn btn-primary btn-block mt-1">货币添加</button>
            </div>
            <div class="d-grid">
              <button type="button" class="btn btn-primary btn-block mt-1">货币添加</button>
            </div>
          </div>
        </div>
        <div class="col-3 p-3 bg-primary text-white">选择服务器</div>
        <div class="col-3 p-3 bg-dark text-white"></div>
        <div class="col-3 p-3 bg-dark text-white"></div>
      </div>
    </div>
  </div> -->

  <div id="output">
    选择的网站是: {{ serverselected }} puid: {{ puid }}
  </div>
</template>

<script>
import axios from 'axios';
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  data() {
    return {
      servers: [{
        value: 'http://localhost:9002/api/gm/action',
        label: '本机'
      }, {
        value: 'http://172.10.10.18:9002/api/gm/action',
        label: '内网测试服'
      }, {
        value: 'http://152.136.44.171:40002/api/gm/action',
        label: '审核服'
      }],
      serverselected: '',
      input1: '',
      puid: '',
    }
  },
  methods: {
    ontest: function (event) {
      axios.post(this.serverselected, {
        Action: '服务器操作',      
        Args: ["服务器信息"] 
      })
        .then(function (response) {
          console.log(response);
        })
        .catch(function (error) {
          console.log(error);
        });
    },
  }
}
</script>
