import * as React from 'react'; import './index.scss'; import Header from '&/components/common/componentHeader' import HonourRule from './honourRule' import { getApiUrl, getBSGlobal, taker, getUserInfo } from '&/helper' import ScrollWrap from '&/components/common/scrollWrap' import CommonMount from '@beisen/common-mount'; // import Footer from '&/components/common/componentFooter' import Increate from '&/components/common/increate' interface Prop{ } export default class HonourCard extends React.Component{ async componentWillMount(){ const url = getApiUrl(`proxy/getUpaas?metaname=Meeting&funname=GetPersonalCreditInfoDynamic&ownerId=${getUserInfo().Id}`); const res = await taker(url); const resJson = JSON.parse(res); this.setState({score:resJson.CurrentCredit,order:resJson.Rank}) } scores = [70,85,95,100,102,104,108,116,132,164,228,228]; days = [3,4,5,6,7,8,9,10,11,12,13,14]; popArea = new CommonMount({ containerId: 'pop-area', // 容器ID follow: true, // 是否滚动跟随,默认true fixed: true// 定位:fixed,false时为absolute }) first:boolean state={ popShow:false, score:0, order:1 } container = document.body; showPop=(e:React.MouseEvent)=>{ if(this.first) return; this.first = true; let relativeTop = document.body.clientHeight - 230; let style = {left:(e.clientX+15),top:(e.clientY-relativeTop)}; let triangleStyle = {left:-8,top:210,boxShadow:'5px 5px 20px 0 rgba(0, 0, 0, 0.1)'} if(e.clientX + 320 > document.body.clientWidth){ // 越界了 style = {left:(e.clientX-340),top:(e.clientY-relativeTop)}; triangleStyle={left:308,top:210,boxShadow:'-5px -5px 20px 0 rgba(0, 0, 0, 0.1)'} } const rule =
this.popArea.renderDom( 'pop-area-mount', // wrap's classname/id-name rule, // content dom this.container, // 滚动跟随节点 [ this.container, //挂载节点 { // 挂载元素宽高 {width: '', height: ''} width: this.container.clientWidth, height: 455 } ] ); } hidePop=()=>{ this.popArea && this.popArea.unmountBox(); this.first = false; } getTarScore = () => { const {score} = this.state; let tarScore = this.scores.filter((s,k)=> s > score); return tarScore[0]; } getTarDayIndex=(tarScore:number)=>{ const index = this.scores.findIndex((s,k)=>s ==tarScore) return index } handleClick=()=>{ const url = `${getBSGlobal('apiPath')}/${getBSGlobal('loginUserInfo').Id}/ITalentHome#widget%2Fitalent%3FiTalentFrameType%3Diframe%26iTalentFrame%3Dhttp%253A%252F%252F${getBSGlobal('apiPath')}%252F100000%252Fmeeting%253Ftenant_id%253D${getBSGlobal('tenantInfo').Id}%2526user_id%253D${getBSGlobal('loginUserInfo').Id}%2526app_id%253D1025%2526time_stamp%253D${Date.now()}%2523%252FScheduleMeeting%253Fshadow_context%253D%257BappModel%253A%2522italent%2522%252Cuppid%253A%2522%2522%257D%26`; window.open(url) } render(){ const {score,order} = this.state; const tarScore = this.getTarScore(); const tarDayIndex = tarScore ? this.getTarDayIndex(tarScore): -1; //