import React, { Component } from 'react';
import './TPMIndex.css';

const $ = window.$;

$(window).resize(function () {
  rightSlider();
});

$(window).scroll(function () {
  if ($(".gotop").length > 0) {
    if ($(document).scrollTop() > 0) {
      $(".-task-sidebar .gotop").show();
      $(".gotop").click(function () {
        $("html,body").scrollTop(0);
      });
    }
    if ($(document).scrollTop() == 0) {
      $(".-task-sidebar .gotop").hide();
    }
  }
});

function rightSlider() {
  var poi = parseInt((parseInt($(window).width()) - 1200) / 2) - 81;
  // console.log(parseInt($(window).width())+"  "+poi);
  if (poi > 0) {
    $(".-task-sidebar").css("right", poi);
  } else {
    $(".-task-sidebar").css("right", "0px");
  }
  $(".-task-sidebar").show();
}


class SiderBar extends Component {
  constructor(props) {
    super(props)

  }

  render() {
    return (

      <div className={"-task-sidebar"} >

        {this.props.mygetHelmetapi && this.props.mygetHelmetapi.main_site === true ? <div>

          <div className="gotop" title="返回顶部">
            <a>
              <i className="iconfont icon-shangjiantou color-white"></i>
            </a>
          </div>

          <div className="feedback" title="意见反馈">
            <a target="_blank" className="color_white" href="/help/feedback">
              <i className="iconfont icon-yijianfankui color-white font-22"></i>
            </a>
          </div>

          <div className="scan pr" title="微信扫一扫">
            <span className="inline erweima"><i className="iconfont icon-erweima color-white font-22 fl"></i></span>
          </div>


          <div className="consult" title='在线咨询'>
            <a target="_blank" className="color_white" href="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd">
              <i className="iconfont icon-qqzaixianzixun color-white font-22"></i>
            </a>
          </div>


        </div> : ""}
      </div>
    );
  }
}

export default SiderBar;
