123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- import React, { Component } from 'react';
- import './index.less';
- import { Popover } from 'antd';
- import { Carousel } from 'antd-mobile';
- import Assets from '@src/components/Assets';
- import { formatDate } from '@src/services/Tools';
- import Button from '../Button';
- import Tabs from '../Tabs';
- import { User } from '../../stores/user';
- export class CommentFalls extends Component {
- componentDidMount() {
- this.createLayout();
- }
- componentWillReceiveProps(nextProps) {
- if ((nextProps.list || []).length !== (this.props.list || []).length) {
- this.needUpdate = true;
- }
- }
- componentDidUpdate() {
- if (this.needUpdate) {
- this.createLayout();
- this.needUpdate = false;
- }
- }
- createLayout() {
- const msnry = new Masonry('.comment-falls', {
- itemSelector: '.grid-item',
- });
- msnry.layout();
- }
- render() {
- const { list = [] } = this.props;
- return (<div className="comment-falls-wrap">
- <div className="comment-falls">
- {list.map(row => {
- return (
- <div className="grid-item">
- <div className="item">
- <div className="item-header">
- <Assets className="avatar" src={row.user ? row.user.avatar : row.avatar} />
- <div className="name">{row.user ? row.user.nickname : row.nickname}</div>
- <div className="date">{formatDate(row.createTime, 'YYYY年MM月DD日')}</div>
- </div>
- <div className="item-body">{row.content}</div>
- </div>
- </div>
- );
- })}
- </div>
- </div>
- );
- }
- }
- export class AnswerCarousel extends Component {
- constructor(props) {
- super(props);
- this.state = { index: 1 };
- }
- onNext() {
- const index = this.state.index + 1;
- const { list = [] } = this.props;
- if (index >= list.length - 1) return;
- this.setState({ index });
- }
- onPrev() {
- const index = this.state.index - 1;
- if (index < 1) return;
- this.setState({ index });
- }
- render() {
- const { onFaq, tabActive, tabs = [], onTabChange } = this.props;
- const { index } = this.state;
- const { list = [], hideBtn = false } = this.props;
- return (
- <div className="other-answer-carousel">
- <div className="body">
- {tabs.length > 0 && (
- <Tabs
- type="tag"
- theme="white"
- tabs={tabs}
- space={6}
- width={86}
- active={tabActive}
- onChange={key => onTabChange && onTabChange(key)}
- />
- )}
- {list.length > 0 && (
- <Carousel selectedIndex={index} cellSpacing={40} dots={false} slideWidth={'350px'}>
- {list.map(item => {
- return (
- <div className="item">
- <div className="item-block">
- <Assets name="question" />
- {item.content}
- </div>
- <div className="item-block">
- <Assets name="answer" />
- {item.answer}
- </div>
- </div>
- );
- })}
- </Carousel>
- )}
- {!tabs && <div className="fixed" />}
- <Assets name="footer_next_highlight_1" className="next c-p" onClick={() => this.onNext()} />
- <Assets name="footer_previous_highlight_1" className="prev c-p" onClick={() => this.onPrev()} />
- </div>
- {!hideBtn && (
- <Button size="lager" radius onClick={() => User.needLogin().then(() => onFaq())}>
- <Assets name="kf" className="m-r-5" />
- 立即咨询
- </Button>
- )}
- </div>
- );
- }
- }
- export class Consultation extends Component {
- render() {
- const { data = {} } = this.props;
- return (
- <div className="other-consultation">
- <div className="list">
- <div className="item">
- <Assets name="call" />
- </div>
- <div className="item">
- <Assets name="mail" />
- </div>
- <div className="item">
- <Assets name="wechat_1" />
- </div>
- </div>
- <div className="line" />
- <div className="list">
- <div className="item">
- <div className="t-1 t-s-16 m-b-10">电话咨询</div>
- <div className="t-1 t-s-16 t-w-b">{data.phone}</div>
- </div>
- <div className="item">
- <div className="t-1 t-s-16 m-b-10">邮件咨询</div>
- <div className="t-1 t-s-16 t-w-b">{data.email}</div>
- </div>
- <div className="item">
- <div className="t-1 t-s-16 m-b-10">微信咨询</div>
- <div className="t-1 t-s-16 t-w-b">
- <Popover content={<Assets src={data.wechatImage} />}>
- <span>
- <Assets className="m-l-1" name="erweima" />
- </span>
- </Popover>
- </div>
- </div>
- </div>
- </div>
- );
- }
- }
- export class Contact extends Component {
- render() {
- const { data = {} } = this.props;
- return (
- <div className="other-contact">
- <div className="body">
- <div className="step-list">
- <div className="step">
- <div className="title">工作机会</div>
- <Assets name="logo2" />
- </div>
- <div className="step" style={{ paddingLeft: 80 }}>
- <div className="title">联系我们</div>
- <div className="desc">
- <Assets name="white_tel" className="m-r-5" />
- {data.phone}
- </div>
- <div className="desc">
- <Assets name="white_mail" className="m-r-5" />
- {data.email}
- </div>
- <div className="desc">
- <Assets name="white_wechat" className="m-r-5" />
- {data.wechat}
- </div>
- </div>
- <div className="step" style={{ paddingLeft: 140 }}>
- <div className="title">关注我们</div>
- <div className="qrcode">
- <Assets src={data.wechatImage} />
- </div>
- </div>
- </div>
- </div>
- </div>
- );
- }
- }
- export class Comment extends Component {
- render() {
- const { data } = this.props;
- return (
- <div className="comment-item">
- <Assets className="avatar m-r-1" src={data.user ? data.user.avatar : data.avatar} />
- <div className="d-i-b">
- <div className="t-1 t-s-18">{data.user ? data.user.nickname : data.nickname}</div>
- <div className="t-3">{formatDate(data.createTime, 'YYYY-MM-DD')}</div>
- </div>
- <div className="t-1 t-s-18 m-t-1">{data.content}</div>
- </div>
- );
- }
- }
|