index.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. import React, { Component } from 'react';
  2. import './index.less';
  3. import FileUpload from '@src/components/FileUpload';
  4. import Assets from '@src/components/Assets';
  5. import { SelectInput, VerificationInput, Input } from '../Login';
  6. import { MobileArea } from '../../../Constant';
  7. import Invite from '../Invite';
  8. import Modal from '../Modal';
  9. export class BindPhone extends Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = { step: 0, data: {} };
  13. this.stepProp = {
  14. 0: {
  15. title: '绑定手机',
  16. onConfirm: () => this.onNext(),
  17. },
  18. 1: {
  19. title: '绑定手机',
  20. onConfirm: props.onConfirm,
  21. onCancel: props.onCancel,
  22. confirmText: '提交',
  23. },
  24. };
  25. }
  26. onNext() {
  27. this.setState({ step: 1 });
  28. }
  29. render() {
  30. const { show } = this.props;
  31. const { step } = this.state;
  32. return (
  33. <Modal className="bind-phone-modal" show={show} width={630} {...this.stepProp[step]}>
  34. <div className="bind-phone-modal-wrapper">{this[`renderStep${step}`]()}</div>
  35. </Modal>
  36. );
  37. }
  38. renderStep0() {
  39. return (
  40. <div className="step-0-layout">
  41. 已绑定手机 13123123123123
  42. <a onClick={() => this.onNext()}>修改</a>
  43. </div>
  44. );
  45. }
  46. renderStep1() {
  47. return (
  48. <div className="step-1-layout">
  49. <div className="label">手机号</div>
  50. <div className="input-layout">
  51. <SelectInput
  52. placeholder="请输入手机号"
  53. selectValue={this.state.data.area}
  54. select={MobileArea}
  55. value={this.state.data.mobile}
  56. error={this.state.mobileError}
  57. onSelect={value => {
  58. this.changeData('area', value);
  59. this.validMobile(true);
  60. }}
  61. onChange={e => {
  62. this.changeData('mobile', e.target.value);
  63. this.validMobile(true);
  64. }}
  65. />
  66. <VerificationInput
  67. placeholder="请输入验证码"
  68. value={this.state.data.mobileVerifyCode}
  69. error={this.state.validError}
  70. onSend={() => {
  71. return this.sendValid();
  72. }}
  73. onChange={e => {
  74. this.changeData('mobileVerifyCode', e.target.value);
  75. }}
  76. />
  77. </div>
  78. </div>
  79. );
  80. }
  81. }
  82. export class BindEmail extends Component {
  83. constructor(props) {
  84. super(props);
  85. this.state = { step: 0, data: {} };
  86. this.stepProp = {
  87. 0: {
  88. title: '绑定手机',
  89. onConfirm: () => this.onNext(),
  90. },
  91. 1: {
  92. title: '绑定手机',
  93. onConfirm: props.onConfirm,
  94. onCancel: props.onCancel,
  95. confirmText: '提交',
  96. },
  97. };
  98. }
  99. onNext() {
  100. this.setState({ step: 1 });
  101. }
  102. render() {
  103. const { show } = this.props;
  104. const { step } = this.state;
  105. return (
  106. <Modal className="bind-email-modal" show={show} width={630} {...this.stepProp[step]}>
  107. <div className="bind-email-modal-wrapper">{this[`renderStep${step}`]()}</div>
  108. </Modal>
  109. );
  110. }
  111. renderStep0() {
  112. return (
  113. <div className="step-0-layout">
  114. 已绑定邮箱 13123123123123
  115. <a onClick={() => this.onNext()}>修改</a>
  116. </div>
  117. );
  118. }
  119. renderStep1() {
  120. return (
  121. <div className="step-1-layout">
  122. <div className="label">邮箱地址</div>
  123. <div className="input-layout">
  124. <Input
  125. placeholder="请输入邮箱"
  126. value={this.state.data.mobile}
  127. error={this.state.mobileError}
  128. onChange={e => {
  129. this.changeData('mobile', e.target.value);
  130. this.validMobile(true);
  131. }}
  132. />
  133. </div>
  134. </div>
  135. );
  136. }
  137. }
  138. export class EditInfo extends Component {
  139. constructor(props) {
  140. super(props);
  141. this.state = { data: {} };
  142. }
  143. render() {
  144. const { show, onCancel, onConfirm } = this.props;
  145. return (
  146. <Modal
  147. className="edit-info-modal"
  148. show={show}
  149. width={630}
  150. title="修改资料"
  151. confirmText="保存"
  152. onCancel={onCancel}
  153. onConfirm={onConfirm}
  154. >
  155. <div className="edit-info-modal-wrapper">
  156. <div className="edit-info-modal-block">
  157. <div className="label">昵称</div>
  158. <div className="input-layout">
  159. <Input
  160. placeholder="2-20位,不可使用特殊字符。"
  161. value={this.state.data.mobile}
  162. error={this.state.mobileError}
  163. onChange={e => {
  164. this.changeData('mobile', e.target.value);
  165. this.validMobile(true);
  166. }}
  167. />
  168. </div>
  169. </div>
  170. <div className="edit-info-modal-block">
  171. <div className="label">头像</div>
  172. <div className="input-layout">
  173. <FileUpload />
  174. </div>
  175. </div>
  176. </div>
  177. </Modal>
  178. );
  179. }
  180. }
  181. export class RealAuth extends Component {
  182. constructor(props) {
  183. super(props);
  184. this.state = { data: {} };
  185. }
  186. render() {
  187. const { show, onConfirm } = this.props;
  188. return (
  189. <Modal
  190. className="real-auth-modal"
  191. show={show}
  192. width={630}
  193. title="实名认证"
  194. confirmText="好的,知道了"
  195. btnAlign="center"
  196. onConfirm={onConfirm}
  197. >
  198. <div className="real-auth-modal-wrapper">
  199. <div className="real-auth-text">
  200. <div className="t1">完成实名认证即可领取:</div>
  201. <div className="t2">6个月VIP权限 和 5折机经优惠劵。</div>
  202. <div className="t3">扫码关注公众号,点击“我的-实名认证”</div>
  203. </div>
  204. <div className="real-auth-qrcode">
  205. <Assets name="qrcode" />
  206. </div>
  207. </div>
  208. </Modal>
  209. );
  210. }
  211. }
  212. export class EditAvatar extends Component {
  213. constructor(props) {
  214. super(props);
  215. this.state = { data: {} };
  216. }
  217. render() {
  218. const { show, onConfirm, onCancel } = this.props;
  219. return (
  220. <Modal
  221. className="edit-avatar-modal"
  222. show={show}
  223. width={630}
  224. title="调整头像"
  225. confirmText="保存头像"
  226. onConfirm={onConfirm}
  227. onCancel={onCancel}
  228. >
  229. <div className="edit-avatar-modal-wrapper">
  230. <div className="edit-avatar-o">
  231. <Assets name="qrcode" />
  232. </div>
  233. <div className="edit-avatar-r">
  234. <div className="text">头像预览</div>
  235. <Assets name="qrcode" />
  236. </div>
  237. </div>
  238. </Modal>
  239. );
  240. }
  241. }
  242. export class InviteModal extends Component {
  243. constructor(props) {
  244. super(props);
  245. this.state = { data: {} };
  246. }
  247. render() {
  248. const { show, onClose } = this.props;
  249. return (
  250. <Modal className="invite-modal" show={show} width={630} title="邀请好友" onClose={onClose}>
  251. <div className="invite-modal-wrapper">
  252. <div className="tip">每邀请一位小伙伴加入“千行GMAT”, 您的VIP权限会延长7天,可累加 无上限!赶紧行动吧~</div>
  253. <Invite />
  254. </div>
  255. </Modal>
  256. );
  257. }
  258. }