index.js 2.9 KB
Newer Older
zhanghaozhe committed
1 2 3 4
import React, { Component } from "react"
import { Toast } from "antd-mobile"
import { http } from "src/utils"
import "./index.scss"
FE committed
5 6

class ConfirmPhone extends Component {
FE committed
7
  continueBindPhone = () => {
zhanghaozhe committed
8 9 10
    const { data, successBindPhone } = this.props
    http
      .post(`${API.home}/sys/v2/user/bindMobile`, {
FE committed
11 12 13
        ...data,
        type: 1, // 1:绑定,2:修改绑定
        is_valid: 0, // is_valid	是否验证 1:验证(默认),0不验证
zhanghaozhe committed
14 15 16 17 18 19 20 21 22
      })
      .then((res) => {
        const { code, msg } = res.data
        if (code === 200) {
          successBindPhone()
        } else {
          Toast.info(msg, 2, null, false)
        }
      })
FE committed
23 24
  }

FE committed
25
  render() {
zhanghaozhe committed
26
    const { bindInfo = {}, desc, skip = "year", handleToCancle } = this.props
FE committed
27 28
    return (
      <div className="popup-bind" data-skip={skip}>
FE committed
29
        <h2 className="popup-bind__title">绑定手机号</h2>
zhanghaozhe committed
30 31 32 33 34 35 36
        {desc ? (
          <div className="popup-bind__desc">{desc}</div>
        ) : (
          <p className="popup-bind__desc">
            该手机号已绑定到以下账号,继续绑定将解除以下绑定状态
          </p>
        )}
FE committed
37
        <ul className="popup-bind__list">
zhanghaozhe committed
38
          {bindInfo["email"] && (
FE committed
39 40 41
            <li className="popup-bind__account">
              {/* 邮箱 */}
              <i className="popup-bind__icon" data-plat="mail"></i>
zhanghaozhe committed
42
              <p className="popup-bind__account--name">{bindInfo["email"]}</p>
FE committed
43
            </li>
zhanghaozhe committed
44 45
          )}
          {bindInfo["wechat_nickname"] && (
FE committed
46 47 48
            <li className="popup-bind__account">
              {/* wechat */}
              <i className="popup-bind__icon" data-plat="wachat"></i>
zhanghaozhe committed
49 50 51
              <p className="popup-bind__account--name">
                {bindInfo["wechat_nickname"]}
              </p>
FE committed
52
            </li>
zhanghaozhe committed
53 54
          )}
          {bindInfo["qq_nickname"] && (
FE committed
55 56 57
            <li className="popup-bind__account">
              {/* qq */}
              <i className="popup-bind__icon" data-plat="qq"></i>
zhanghaozhe committed
58 59 60
              <p className="popup-bind__account--name">
                {bindInfo["qq_nickname"]}
              </p>
FE committed
61
            </li>
zhanghaozhe committed
62 63
          )}
          {bindInfo["sina_nickname"] && (
FE committed
64 65 66
            <li className="popup-bind__account">
              {/* 微博 */}
              <i className="popup-bind__icon" data-plat="sina"></i>
zhanghaozhe committed
67 68 69
              <p className="popup-bind__account--name">
                {bindInfo["sina_nickname"]}
              </p>
FE committed
70
            </li>
zhanghaozhe committed
71
          )}
FE committed
72 73 74
        </ul>
        <div className="popup-bind__footer">
          <button
zhanghaozhe committed
75 76 77 78 79
            className="popup-bind__button popup-bind__button--cancle"
            onClick={handleToCancle}
          >
            取消
          </button>
FE committed
80
          <button
zhanghaozhe committed
81 82 83 84 85
            className="popup-bind__button popup-bind__button--confirm"
            onClick={this.continueBindPhone}
          >
            继续绑定
          </button>
FE committed
86 87 88 89 90 91
        </div>
      </div>
    )
  }
}

zhanghaozhe committed
92
export default ConfirmPhone