import Taro, { Component } from '@tarojs/taro'
import { WebView } from '@tarojs/components'
// import { contractUser, contractCheck } from '@/services/project'

export default class Panorama extends Component {
  state = {}
  // tk = undefined
  // tk2 = undefined
  componentWillMount() {
    // const { from = '', id: raiseRecordId, consultantName, consultantId } = this.$router.params
    // if (from == 'raiseProfile') {
    //   console.log('！！！！')
    //   this.tk = setInterval(() => {
    //     contractUser({ raiseRecordId, showToast: false }).then(res => {
    //       console.log(res, res.status, '每5秒请求一次！！！！')
    //       if (res.status != 0 && res.status != 1) {
    //         const { id } = this.$router.params
    //         clearInterval(this.tk)
    //         Taro.navigateTo({
    //           url: `/onlineSelling/pages/raiseMoney/Certification?id=${res.raiseRecordId || id}&consultantName=${encodeURIComponent(consultantName)}&consultantId=${consultantId}`
    //         })
    //       }
    //     })
    //   }, 5000)
    // }
    // if (from == 'contractManual') {
    //   console.log('contractManual！！！！')
    //   this.tk2 = setInterval(() => {
    //     contractCheck({ raiseRecordId, showToast: false }).then(res => {
    //       console.log(res, res.status, 'contractManual每5秒请求一次！！！')
    //       if (res.status != 0) {
    //         clearInterval(this.tk2)
    //         Taro.navigateTo({
    //           url: `/onlineSelling/pages/raiseMoney/signResult?status=${res.status}&id=${raiseRecordId}&consultantName=${encodeURIComponent(consultantName)}&consultantId=${consultantId}`
    //         })
    //       }
    //     })
    //   }, 5000)
    // }
  }
  // componentDidHide() {
  //   if (this.tk) {
  //     clearInterval(this.tk)
  //   }
  //   if (this.tk2) {
  //     clearInterval(this.tk2)
  //   }
  // }
  // componentWillUnmount() {
  //   if (this.tk) {
  //     clearInterval(this.tk)
  //   }
  //   if (this.tk2) {
  //     clearInterval(this.tk2)
  //   }
  // }

  render() {
    const url = decodeURIComponent(this.$router.params.url)

    return (
      <WebView src={url} />
    )
  }
}
