1
0

index.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. import React, { Component } from 'react';
  2. import './index.less';
  3. import { Popover } from 'antd';
  4. import { Carousel } from 'antd-mobile';
  5. import Assets from '@src/components/Assets';
  6. import { formatDate } from '@src/services/Tools';
  7. import Button from '../Button';
  8. import Tabs from '../Tabs';
  9. import { User } from '../../stores/user';
  10. export class CommentFalls extends Component {
  11. componentDidMount() {
  12. this.createLayout();
  13. }
  14. componentWillReceiveProps(nextProps) {
  15. if ((nextProps.list || []).length !== (this.props.list || []).length) {
  16. this.needUpdate = true;
  17. }
  18. }
  19. componentDidUpdate() {
  20. if (this.needUpdate) {
  21. this.createLayout();
  22. this.needUpdate = false;
  23. }
  24. }
  25. createLayout() {
  26. const msnry = new Masonry('.comment-falls', {
  27. itemSelector: '.grid-item',
  28. });
  29. msnry.layout();
  30. }
  31. render() {
  32. const { list = [] } = this.props;
  33. return (<div className="comment-falls-wrap">
  34. <div className="comment-falls">
  35. {list.map(row => {
  36. return (
  37. <div className="grid-item">
  38. <div className="item">
  39. <div className="item-header">
  40. <Assets className="avatar" src={row.user ? row.user.avatar : row.avatar} />
  41. <div className="name">{row.user ? row.user.nickname : row.nickname}</div>
  42. <div className="date">{formatDate(row.createTime, 'YYYY年MM月DD日')}</div>
  43. </div>
  44. <div className="item-body">{row.content}</div>
  45. </div>
  46. </div>
  47. );
  48. })}
  49. </div>
  50. </div>
  51. );
  52. }
  53. }
  54. export class AnswerCarousel extends Component {
  55. constructor(props) {
  56. super(props);
  57. this.state = { index: 1 };
  58. }
  59. onNext() {
  60. const index = this.state.index + 1;
  61. const { list = [] } = this.props;
  62. if (index >= list.length - 1) return;
  63. this.setState({ index });
  64. }
  65. onPrev() {
  66. const index = this.state.index - 1;
  67. if (index < 1) return;
  68. this.setState({ index });
  69. }
  70. render() {
  71. const { onFaq, tabActive, tabs = [], onTabChange } = this.props;
  72. const { index } = this.state;
  73. const { list = [], hideBtn = false } = this.props;
  74. return (
  75. <div className="other-answer-carousel">
  76. <div className="body">
  77. {tabs.length > 0 && (
  78. <Tabs
  79. type="tag"
  80. theme="white"
  81. tabs={tabs}
  82. space={6}
  83. width={86}
  84. active={tabActive}
  85. onChange={key => onTabChange && onTabChange(key)}
  86. />
  87. )}
  88. {list.length > 0 && (
  89. <Carousel selectedIndex={index} cellSpacing={40} dots={false} slideWidth={'350px'}>
  90. {list.map(item => {
  91. return (
  92. <div className="item">
  93. <div className="item-block">
  94. <Assets name="question" />
  95. {item.content}
  96. </div>
  97. <div className="item-block">
  98. <Assets name="answer" />
  99. {item.answer}
  100. </div>
  101. </div>
  102. );
  103. })}
  104. </Carousel>
  105. )}
  106. {!tabs && <div className="fixed" />}
  107. <Assets name="footer_next_highlight_1" className="next c-p" onClick={() => this.onNext()} />
  108. <Assets name="footer_previous_highlight_1" className="prev c-p" onClick={() => this.onPrev()} />
  109. </div>
  110. {!hideBtn && (
  111. <Button size="lager" radius onClick={() => User.needLogin().then(() => onFaq())}>
  112. <Assets name="kf" className="m-r-5" />
  113. 立即咨询
  114. </Button>
  115. )}
  116. </div>
  117. );
  118. }
  119. }
  120. export class Consultation extends Component {
  121. render() {
  122. const { data = {} } = this.props;
  123. return (
  124. <div className="other-consultation">
  125. <div className="list">
  126. <div className="item">
  127. <Assets name="call" />
  128. </div>
  129. <div className="item">
  130. <Assets name="mail" />
  131. </div>
  132. <div className="item">
  133. <Assets name="wechat_1" />
  134. </div>
  135. </div>
  136. <div className="line" />
  137. <div className="list">
  138. <div className="item">
  139. <div className="t-1 t-s-16 m-b-10">电话咨询</div>
  140. <div className="t-1 t-s-16 t-w-b">{data.phone}</div>
  141. </div>
  142. <div className="item">
  143. <div className="t-1 t-s-16 m-b-10">邮件咨询</div>
  144. <div className="t-1 t-s-16 t-w-b">{data.email}</div>
  145. </div>
  146. <div className="item">
  147. <div className="t-1 t-s-16 m-b-10">微信咨询</div>
  148. <div className="t-1 t-s-16 t-w-b">
  149. <Popover content={<Assets src={data.wechatImage} />}>
  150. <span>
  151. <Assets className="m-l-1" name="erweima" />
  152. </span>
  153. </Popover>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. );
  159. }
  160. }
  161. export class Contact extends Component {
  162. render() {
  163. const { data = {} } = this.props;
  164. return (
  165. <div className="other-contact">
  166. <div className="body">
  167. <div className="step-list">
  168. <div className="step">
  169. <div className="title">工作机会</div>
  170. <Assets name="logo2" />
  171. </div>
  172. <div className="step" style={{ paddingLeft: 80 }}>
  173. <div className="title">联系我们</div>
  174. <div className="desc">
  175. <Assets name="white_tel" className="m-r-5" />
  176. {data.phone}
  177. </div>
  178. <div className="desc">
  179. <Assets name="white_mail" className="m-r-5" />
  180. {data.email}
  181. </div>
  182. <div className="desc">
  183. <Assets name="white_wechat" className="m-r-5" />
  184. {data.wechat}
  185. </div>
  186. </div>
  187. <div className="step" style={{ paddingLeft: 140 }}>
  188. <div className="title">关注我们</div>
  189. <div className="qrcode">
  190. <Assets src={data.wechatImage} />
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. </div>
  196. );
  197. }
  198. }
  199. export class Comment extends Component {
  200. render() {
  201. const { data } = this.props;
  202. return (
  203. <div className="comment-item">
  204. <Assets className="avatar m-r-1" src={data.user ? data.user.avatar : data.avatar} />
  205. <div className="d-i-b">
  206. <div className="t-1 t-s-18">{data.user ? data.user.nickname : data.nickname}</div>
  207. <div className="t-3">{formatDate(data.createTime, 'YYYY-MM-DD')}</div>
  208. </div>
  209. <div className="t-1 t-s-18 m-t-1">{data.content}</div>
  210. </div>
  211. );
  212. }
  213. }