import NetWork from '../../base/NetWork';
import {Device} from '../../base/Device';
import {UAnimateContainer, UAnimate} from 'vue-wow'
/**
 * @author yeyuchao
 * @description join us.
 */
const screenHeight = window.screen.height;
const screenWidth = window.screen.width;
export default {
  data() {
    return {
      screenHeight:screenHeight,
      screenWidth:screenWidth,
      showJobList:false,
      jobIntroduce:[],
      jobList:[],
      deviceMobile:false,
      jobListHeight:""
    };
  },
  components: {
    UAnimateContainer,
    UAnimate
  },
  mounted() {
  },
  created() {
    if(!window.loadComplete){
      this.$router.push('/');
      return
    }
    window.itemType = 5;
    const device = new Device();
    if(device.phone){
      this.deviceMobile = true;
      this.jobListHeight = device.apple.phone?("calc(100vh - 190px)"):("calc(100vh - 130px)");
    }else {
      this.jobListHeight = "calc(100vh - 80px)";
    }
    this.getPageList();
  },
  methods:{
    /**
     * 设置表头的样式
     */
    tableHeaderColor({ row, column, rowIndex, columnIndex }){
      if (rowIndex === 0) {
        return 'background-color: #3FACBF;color: white'
      }
    },
    getTarget() {
      return this.$el;
    },
    navigateToJob(){
      // console.log("navigateToJob");
      this.showJobList = true;
    },
    getPageList(){
      const that = this;
      NetWork.fetchGet('listJob').then((res)=>{
        let response = res.data.result.list;
        for(let item of response){
          item.showJobDescription = false;
        }
        that.jobList = response;
        console.log("getPageList:"+JSON.stringify(that.jobList));
      }).catch((err)=>{
      })
    },
    openJobIntroduce(idx){
      this.jobList[idx].showJobDescription = !this.jobList[idx].showJobDescription
    },
    closeJobDescription(){
      this.showJobList = false;
    }
  }
};
