<template>
  <div class="login-container">
    <div class="login-weaper  animated bounceInDown" style="width: 550px !important;;height: 300px;margin-top: -15%">
      <div class="login-border" style="margin-left: -30px;">
        <div class="login-main" style="width: 100px;margin: auto;margin-top: 5%"></div>
        <div class="login-main" style="width: 400px;margin: auto;margin-top: 8%">
          <span style="font-size: 20px;font-weight: bold;margin-bottom: 50px;margin-left:110px;color: #000000;">营销行为信息化管控系统-证据链查询</span>
          <div style="display:flex;align-items: center;">
            <span style="color:#000000;width:80px;margin-top:25px;">积分包</span>
            <el-input placeholder=" 这里输入众包任务名称，多个请用 空格 隔开 " v-model="packageIds" class="input-with-select" style="width: 400px;margin-top:25px;">
              <el-button slot="append" icon="el-icon-search" @click="getInfoByPackageIds"></el-button>
            </el-input>
          </div>
          <div style="display:flex;align-items: center;">
            <span style="color:#000000;width:80px;margin-top:50px;">项&nbsp;&nbsp;&nbsp;&nbsp;目</span>
            <el-input placeholder=" 这里输入项目任务名称，多个请用 空格 隔开 " v-model="hcpId" class="input-with-select" style="width: 400px;margin-top:50px;">
              <el-button slot="append" icon="el-icon-search" @click="goHcp"></el-button>
            </el-input>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import {fetchList} from '@/api/admin/tenant';

export default {
  name: 'Login',
  data() {
    return {
      packageIds: '',
      hcpId: ''
    };
  },
  mounted() {},
  methods: {
    getInfoByPackageIds() {
      if (undefined == this.packageIds || '' == this.packageIds) {
        this.$message.error('积分包名称不能为空');
        return false;
      }
      window.location.href = '/#/h5/packageList?id=' + this.packageIds;
    },

    // 根据项目名称跳转到对应的cso页面
    goHcp() {
      if (!this.hcpId) {
        this.$message.error('积分包名称不能为空');
        return false;
      }
      var url = window.location.href;
      // 本地
      let baseURL = 'http://192.168.0.107:8080';
      //  demo 环境跳转测试环境
      if (url.includes('pre') || url.includes('demo')) {
        baseURL = 'https://hcpdev.yaoyi.net';
      }
      // 生产环境跳转生产环境
      if (url.includes('c.yaoyi.net') || url.includes('api.yaoyi.net')) {
        baseURL = 'https://hcp.yaoyi.net';
      }
      window.location.href = baseURL + '/#/h5/packageList?id=' + this.hcpId;
    }
  }
};
</script>
