page.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. import React from 'react';
  2. import { Link } from 'react-router-dom';
  3. import './index.less';
  4. import Page from '@src/containers/Page';
  5. import Assets from '@src/components/Assets';
  6. import { getMap, formatPercent, formatDate } from '@src/services/Tools';
  7. import Footer from '../../../components/Footer';
  8. import { FaqModal, CommentModal, FinishModal, CourseNoteModal, AskCourseModal } from '../../../components/OtherModal';
  9. import { Contact, AnswerCarousel, Comment } from '../../../components/Other';
  10. import Tabs from '../../../components/Tabs';
  11. import { Icon as GIcon } from '../../../components/Icon';
  12. import Button from '../../../components/Button';
  13. import IconButton from '../../../components/IconButton';
  14. import UserTable from '../../../components/UserTable';
  15. import ProgressText from '../../../components/ProgressText';
  16. import { OpenText } from '../../../components/Open';
  17. import Video from '../../../components/Video';
  18. import { Main } from '../../../stores/main';
  19. import { Course } from '../../../stores/course';
  20. import { User } from '../../../stores/user';
  21. import { Order } from '../../../stores/order';
  22. import { Question } from '../../../stores/question';
  23. import { My } from '../../../stores/my';
  24. import { QrCodeAssets } from '../../../../Constant';
  25. export default class extends Page {
  26. initState() {
  27. this.columns = [
  28. {
  29. title: '学习内容',
  30. key: 'title',
  31. render: (text, record) => {
  32. const { no } = this.state;
  33. if (no === record.no) {
  34. // 当前正在
  35. }
  36. return `课时 ${record.no}: ${text}`;
  37. },
  38. },
  39. {
  40. title: '预习作业',
  41. key: 'paper',
  42. render: text => {
  43. text = text || {};
  44. const progress = text.report ? formatPercent(text.report.userNumber, text.report.questionNumber) : 0;
  45. const times = text.paper ? text.paper.resetTimes : 0;
  46. return (
  47. <div>
  48. <div className="v-a-m d-i-b">
  49. <ProgressText width={50} size="small" times={times} progress={progress} unit="次" />
  50. </div>
  51. {!text.report && (
  52. <IconButton
  53. className="m-l-2"
  54. type="start"
  55. tip="Start"
  56. onClick={() => {
  57. User.needLogin().then(() => {
  58. Question.startLink('preview', text);
  59. });
  60. }}
  61. />
  62. )}
  63. {text.report && !text.report.isFinish && (
  64. <IconButton
  65. className="m-l-2"
  66. type="continue"
  67. tip="Continue"
  68. onClick={() => {
  69. User.needLogin().then(() => {
  70. Question.continueLink('preview', text);
  71. });
  72. }}
  73. />
  74. )}
  75. {text.report && (
  76. <IconButton
  77. className="m-l-2"
  78. type="restart"
  79. tip="Restart"
  80. onClick={() => {
  81. User.needLogin().then(() => {
  82. Question.restart('preview', text);
  83. });
  84. }}
  85. />
  86. )}
  87. {text.report && !!text.report.isFinish && (
  88. <IconButton
  89. className="m-l-5"
  90. type="report"
  91. tip="Report"
  92. onClick={() => {
  93. User.needLogin().then(() => {
  94. Question.reportLink('preview', text);
  95. });
  96. }}
  97. />
  98. )}
  99. </div>
  100. );
  101. },
  102. },
  103. {
  104. title: '进度',
  105. key: 'progress',
  106. render: (text, record) => {
  107. const { paper = {} } = record;
  108. return `${paper.paper && paper.paper.finishTimes > 0 ? `${paper.paper.finishTimes}次+` : ''}${
  109. paper.report ? formatPercent(paper.report.userNumber, paper.report.questionNumber, false) : '0%'}`;
  110. },
  111. },
  112. {
  113. title: '最近学习',
  114. key: 'lastTime',
  115. render: (text, record) => {
  116. const { paper = {} } = record;
  117. return paper.report && formatDate(paper.report.updateTime, 'YYYY-MM-DD HH:mm:ss');
  118. },
  119. },
  120. {
  121. title: '笔记',
  122. key: 'note',
  123. render: (text, record) => {
  124. return <GIcon name="note" active={record.note} />;
  125. },
  126. },
  127. {
  128. title: '问答',
  129. key: 'ask',
  130. render: (text, record) => {
  131. return (
  132. <Link to={`/course/answer/${record.courseId}?tab=my&courseNoId=${record.id}`}>{`${record.answerNumber ||
  133. 0}/${record.askNumber || 0}`}</Link>
  134. );
  135. },
  136. },
  137. ];
  138. return {
  139. tab: '1',
  140. rightTab: '1',
  141. key: '1',
  142. add: false,
  143. list: [{ key: '1' }, { key: '2' }, { key: '3' }],
  144. data: {},
  145. position: 0,
  146. };
  147. }
  148. init() {
  149. Main.dataStruct().then(result => {
  150. const dataStructSelect = result.map(row => {
  151. return {
  152. title: `${row.titleZh}${row.titleEn}`,
  153. key: row.id,
  154. };
  155. });
  156. const dataStructMap = getMap(dataStructSelect, 'key');
  157. this.setState({ dataStructSelect, dataStructMap });
  158. });
  159. Main.getBase().then(result => {
  160. this.setState({ base: result });
  161. });
  162. }
  163. formatRecord(row) {
  164. row.paperMap = {};
  165. if (row.papers) {
  166. row.papers.forEach(paper => {
  167. if (paper.courseNo) row.paperMap[paper.courseNo] = paper;
  168. });
  169. }
  170. row.progressMap = {};
  171. if (row.progress) {
  172. row.progress.forEach(progress => {
  173. row.progressMap[progress.courseNoId] = progress;
  174. });
  175. }
  176. row.courseNoMap = {};
  177. row.courseTime = 0;
  178. if (row.courseNos) {
  179. row.courseNos.forEach(no => {
  180. row.courseNoMap[no.id] = no;
  181. row.courseTime += no.time;
  182. no.paper = row.paperMap[no.id];
  183. no.progress = row.progressMap[no.id];
  184. });
  185. }
  186. if (row.currentNo) {
  187. row.currentCourseNo = row.courseNoMap[row.currentNo];
  188. } else {
  189. row.currentNo = 0;
  190. }
  191. return row;
  192. }
  193. initData() {
  194. const { id } = this.params;
  195. Course.detail(id).then(result => {
  196. result = this.formatRecord(result);
  197. // result.have = true;
  198. // result.waters = ['高*', '152****4895'];
  199. this.setState({ data: result });
  200. // 选择课时
  201. if (this.state.search.no) {
  202. this.onChangeItem(this.state.search.no);
  203. } else {
  204. this.onChangeItem(1);
  205. }
  206. if (!result.have) {
  207. Course.trailView(id);
  208. }
  209. this.refreshNote();
  210. });
  211. Main.listComment({ page: 1, size: 100, channel: 'course-video', position: id }).then(result => {
  212. this.comments = result.list;
  213. this.setState({ comments: result.list });
  214. });
  215. }
  216. refreshAsk(position) {
  217. const { id } = this.params;
  218. const { item = {} } = this.state;
  219. Course.listAsk(Object.assign({ page: 1, size: 1000, courseId: id, courseNoId: item.id, position })).then(result => {
  220. this.setState({ asks: result.list });
  221. });
  222. }
  223. refreshNote() {
  224. const { id } = this.params;
  225. const { data } = this.state;
  226. if (!data.have) return;
  227. My.listCourseNote({ courseId: id, page: 1, size: data.courseNos.length })
  228. .then((result) => {
  229. this.noteMap = getMap(result.list, 'courseNoId');
  230. data.courseNos.forEach((row) => {
  231. const note = this.noteMap[row.id];
  232. if (note) row.note = true;
  233. });
  234. this.setState({ data });
  235. });
  236. }
  237. onChangeRightTab(rightTab) {
  238. this.setState({ rightTab });
  239. }
  240. onChangeTab(tab) {
  241. this.setState({ tab });
  242. }
  243. onChangeItem(key) {
  244. key = Number(key);
  245. this.changeQuery({ no: key });
  246. this.setState({ no: key });
  247. const { data, item } = this.state;
  248. const index = key - 1;
  249. const timelineSelect = [];
  250. const current = data.courseNos[index];
  251. if (current) {
  252. const max = current.time;
  253. let start = 0;
  254. let end = start + 5;
  255. while (start < max) {
  256. timelineSelect.push({
  257. title: `${start} - ${end}min`,
  258. key: `${start}`,
  259. });
  260. start += 5;
  261. end = Math.min(start + 5, max);
  262. }
  263. }
  264. // 切换播放,记录进度
  265. if (item) {
  266. this.updateProgress(item.id, this.lastSecond, item.time, true);
  267. }
  268. this.setState({ item: current, timelineSelect });
  269. }
  270. onTimeUpdate(second) {
  271. const { position, item = {}, data } = this.state;
  272. if (!data.have) {
  273. // 如果是试用,则按秒数增加
  274. second += (item.startTrail || 0) * 60;
  275. }
  276. const minute = parseInt(second / 60, 10);
  277. const nowPosition = parseInt(minute / 5, 10) * 5;
  278. if (nowPosition !== position) {
  279. this.refreshAsk(position);
  280. this.setState({ position: nowPosition });
  281. // 定时更新进度
  282. this.updateProgress(item.id, second, item.time);
  283. }
  284. this.lastSecond = second;
  285. this.showWater(second);
  286. }
  287. playVideo(second) {
  288. // 开始计时
  289. this.lastTime = new Date();
  290. this.showWater(second);
  291. }
  292. showWater(second, extend) {
  293. const { data, water = {} } = this.state;
  294. let { waters = [] } = data;
  295. waters = waters || [];
  296. if (!this.lastTime && water.show) {
  297. water.show = false;
  298. second -= 1;
  299. water.transition = '';
  300. } else if (!water.show) {
  301. water.show = true;
  302. water.transition = 'transform 1s linear 0s';
  303. }
  304. if (water.show) {
  305. water.opacity = 1;
  306. } else {
  307. water.opacity = 0;
  308. }
  309. if (extend) {
  310. Object.assign(water, extend);
  311. }
  312. const time = 15;
  313. const stop = 0;
  314. const times = (second / (time + stop));
  315. const index = parseInt(times % waters.length, 10);
  316. const current = (second % (time + stop));
  317. water.style = [2, 0, 2, 1][parseInt((times % 4), 10)] + 1;
  318. water.text = waters[[0, 1][index]];
  319. // console.log(water.show, current, current / 4, (current / 4) % 2);
  320. if (water.show) {
  321. water.opacity = (current / 4) % 2 > 1 ? 0 : 1;
  322. }
  323. // if (water.style % 2) {
  324. // water.transform = `translateX(${current * 100 / time}%)`;
  325. // } else {
  326. water.transform = `translateX(${100 - ((current - stop / 2) * 100 / time)}%)`;
  327. // }
  328. this.setState({ water });
  329. }
  330. onChangeProgress(second) {
  331. this.showWater(second - 1, this.lastTime ? { transition: '', opacity: 0 } : { transition: '', opacity: 0 });
  332. setTimeout(() => {
  333. this.showWater(second, this.lastTime ? { transition: 'transform 1s linear 0s', opacity: 1 } : { transition: '', opacity: 0 });
  334. }, 1);
  335. }
  336. pauseVideo(second) {
  337. // 停止计时
  338. const now = new Date();
  339. if (this.lastTime != null) {
  340. this.time += (now.getTime() - this.lastTime.getTime()) / 1000;
  341. }
  342. this.lastTime = null;
  343. this.showWater(second);
  344. }
  345. next() {
  346. const { data, item } = this.state;
  347. if (data.courseNos.length === item.no) {
  348. return;
  349. }
  350. this.onChangeItem(item.no + 1);
  351. }
  352. onVideoAction(key) {
  353. const { rightTab, showTab, showAsk, showNote, item = {} } = this.state;
  354. switch (key) {
  355. case 'ask':
  356. return this.setState({ showAsk: !showAsk });
  357. case 'note':
  358. return this.setState({ showNote: !showNote, note: this.noteMap ? this.noteMap[item.id] || {} : {} });
  359. case 'answer':
  360. return this.setState({ showTab: rightTab === '1' ? !showTab : true, rightTab: '1' });
  361. case 'list':
  362. return this.setState({ showTab: rightTab === '2' ? !showTab : true, rightTab: '2' });
  363. default:
  364. return '';
  365. }
  366. }
  367. updateProgress(courseNoId, currentTime, totalTime, record) {
  368. if (!this.lastTime) return;
  369. const { id } = this.params;
  370. const now = new Date();
  371. this.time += (now.getTime() - this.lastTime.getTime()) / 1000;
  372. this.lastTime = now;
  373. const progress = formatPercent(currentTime, totalTime);
  374. if (record || this.time > 600) {
  375. // 最长5分钟记录一次
  376. Course.noProgress(id, courseNoId, progress, this.time, courseNoId);
  377. this.time = 0;
  378. } else {
  379. Course.noProgress(id, courseNoId, progress, null, null);
  380. }
  381. }
  382. buy() {
  383. const { data } = this.state;
  384. User.needLogin().then(() => {
  385. Order.speedPay({ productType: 'course', productId: data.id }).then(result => {
  386. User.needPay(result).then(() => {
  387. this.refresh();
  388. });
  389. });
  390. });
  391. }
  392. add() {
  393. const { data } = this.state;
  394. User.needLogin().then(() => {
  395. Order.addCheckout({ productType: 'course', productId: data.id }).then(() => {
  396. this.setState({ add: true });
  397. });
  398. });
  399. }
  400. viewAsk(id) {
  401. Course.askView(id);
  402. }
  403. setVideo(video) {
  404. this.video = video;
  405. }
  406. renderView() {
  407. const { base = {}, data = {}, item = {}, add, rightTab, showTab, showAsk, showNote, dataStructMap = {}, showComment, comment = {}, showFaq, faq = {}, showFinish, note = {}, ask = {}, timelineSelect = [], water = {} } = this.state;
  408. const { courseNos = [] } = data;
  409. const { paper = {} } = item;
  410. return (
  411. <div>
  412. <div className="top content t-8">
  413. <Link to="/course">千行课堂</Link> > <Link to="/course/online?tab=single">全部课程</Link> > {data.parentStructId > 0 ? <Link to={`/course/online?tab=single&parentStructId=${(dataStructMap[data.parentStructId] || {}).key}`}>{(dataStructMap[data.parentStructId] || {}).title}</Link> : null}{data.parentStructId > 0 ? '> ' : ''}
  414. <Link to={`/course/online?tab=single&parentStructId=${(dataStructMap[data.parentStructId] || {}).key}&structId=${(dataStructMap[data.structId] || {}).key}`}>{(dataStructMap[data.structId] || {}).title}</Link> > <Link to={`/course/detail/${data.id}`}>{data.title}</Link> > <span className="t-1">课程详情</span>
  415. </div>
  416. <div className="center content">
  417. <div className="t-1 t-s-20">
  418. {data.title}
  419. <div className="action f-r">
  420. {!data.have && <Button className="m-r-1" radius size="lager" onClick={() => this.buy()}>
  421. 立即购买
  422. </Button>}
  423. {!data.have && <Button theme="default" radius size="lager" disabled={data.add || add} onClick={() => this.add()}>
  424. <Assets name="add" />
  425. </Button>}
  426. {data.have && <Button className="m-r-1" radius size="lager" onClick={() => linkTo('/my/course')}>
  427. 我的课程
  428. </Button>}
  429. </div>
  430. </div>
  431. <div className="t-2 m-b-1">授课老师:{data.teacher}</div>
  432. <div className={'detail'}>
  433. <div className="left">
  434. {data.have && <div hidden={(paper.paper && paper.paper.finishTimes > 0)} className="left-top">
  435. <span className="d-i-b m-r-1">预习作业</span>
  436. <span className="d-i-b m-r-2">
  437. <ProgressText width={480} size="small" progress={paper.report ? formatPercent(paper.report.userNumber, paper.report.questionNumber) : 0} />
  438. </span>
  439. <Button className="f-r" radius onClick={() => (paper.report ? Question.continueLink('preview', paper) : Question.startLink('preview', paper))}>
  440. 做题
  441. </Button>
  442. </div>}
  443. <div className="video-layout">
  444. {item.resource && <Video
  445. key={item.id}
  446. src={item.resource}
  447. width={750}
  448. height={467}
  449. ref={ref => this.setVideo(ref)}
  450. water={<div key={water.style} className={`video-water style-${water.style}`} style={{ ...water }}>{water.text}</div>}
  451. btnList={[
  452. { title: '提问', key: 'ask', show: data.have, active: showAsk, pause: true },
  453. {
  454. key: 'answer',
  455. render(active) {
  456. return <Assets name={active ? 'question_on' : 'question_off'} />;
  457. },
  458. full: true,
  459. show: true,
  460. active: showTab && rightTab === '1',
  461. },
  462. { title: '笔记', key: 'note', show: data.have, active: showNote, pause: true },
  463. { title: '课表', key: 'list', show: true, full: true, active: showTab && rightTab === '2' },
  464. ]}
  465. onPlay={(second) => this.playVideo(second)}
  466. onPause={(second) => this.pauseVideo(second)}
  467. onChangeProgress={(second) => this.onChangeProgress(second)}
  468. onNext={() => this.next()}
  469. onAction={key => this.onVideoAction(key)}
  470. onTimeUpdate={time => this.onTimeUpdate(time)}
  471. onFullChange={() => this.setState({ showTab: true, rightTab: '1' })}
  472. >
  473. <div hidden={!showTab} className="video-fixed tab-warpper">
  474. <Tabs
  475. type="division"
  476. theme="gray"
  477. space={2.5}
  478. active={rightTab}
  479. tabs={[{ title: '精选问答', key: '1' }, { title: '课时列表', key: '2' }]}
  480. onChange={key => this.onChangeRightTab(key)}
  481. />
  482. <div className="tab-body">{this[`renderRightTab${rightTab}`]()}</div>
  483. </div>
  484. </Video>}
  485. </div>
  486. </div>
  487. <div className={`detail-right ${data.have && !(item.paper && item.paper.finishTimes > 0) ? 'have' : ''} tab-warpper`}>
  488. <Tabs
  489. type="division"
  490. theme="gray"
  491. space={2.5}
  492. active={rightTab}
  493. tabs={[{ title: '精选问答', key: '1' }, { title: '课时列表', key: '2' }]}
  494. onChange={key => this.onChangeRightTab(key)}
  495. />
  496. <div className="tab-body">{this[`renderRightTab${rightTab}`]()}</div>
  497. </div>
  498. </div>
  499. {data.have && <UserTable columns={this.columns} list={courseNos} />}
  500. </div>
  501. <div hidden={data.have} className="bottom">
  502. <div className="content">{this.renderTab()}</div>
  503. </div>
  504. <Contact data={base.contact} />
  505. <Footer />
  506. <AskCourseModal getContainer={() => (showTab ? document.getElementById(this.video.state.id) : document.body)} show={showAsk} defaultData={ask} course={data} courseNo={item} selectList={timelineSelect} onConfirm={() => this.setState({ showAsk: false })} onCancel={() => this.setState({ showAsk: false })} />
  507. <CourseNoteModal getContainer={() => (showTab ? document.getElementById(this.video.state.id) : document.body)} show={showNote} defaultData={note} course={data} courseNos={courseNos} noteMap={this.noteMap} onConfirm={() => {
  508. this.setState({ showNote: false });
  509. this.refreshNote();
  510. }} onCancel={() => this.setState({ showNote: false })} />
  511. <CommentModal
  512. show={showComment}
  513. defaultData={comment}
  514. onConfirm={() => this.setState({ showComment: false, commnet: {}, showFinish: true })}
  515. onCancel={() => this.setState({ showComment: false, commnet: {} })}
  516. onClose={() => this.setState({ showComment: false, commnet: {} })}
  517. />
  518. <FaqModal show={showFaq} defaultData={faq} onCancel={() => this.setState({ showFaq: false, faq: {} })} onConfirm={() => this.setState({ showFaq: false, faq: {}, showFinish: true })} />
  519. <FinishModal
  520. getContainer={() => document.getElementById(this.video.state.id)}
  521. show={showFinish}
  522. onConfirm={() => this.setState({ showFinish: false })}
  523. />
  524. </div >
  525. );
  526. }
  527. renderRightTab1() {
  528. const { asks = [], data = {}, position } = this.state;
  529. return [
  530. <div className="all-answer">
  531. <span className="d-i-b b m-r-5" />
  532. <span className="d-i-b t-6">{position}:00~{position + 5}:00</span>
  533. <a className="f-r d-i-b t-4 c-p" href={`/course/answer/${data.id}`} target="_blank">全部问答 ></a>
  534. </div>,
  535. <div className="answer-layout">
  536. {asks.map(item => {
  537. return (
  538. <div className="answer-item">
  539. <div>
  540. <div className="small-tag">提问</div>
  541. </div>
  542. <div className="desc">
  543. <OpenText>{item.content}</OpenText>
  544. </div>
  545. {item.answerStatus > 0 && (
  546. <div>
  547. <div className="small-tag">回答</div>
  548. </div>
  549. )}
  550. {item.answerStatus > 0 && (
  551. <div className="desc">
  552. <OpenText onOpen={() => this.viewAsk(item.id)}>{item.answer}</OpenText>
  553. </div>
  554. )}
  555. </div>
  556. );
  557. })}
  558. </div>,
  559. ];
  560. }
  561. renderRightTab2() {
  562. const { data = {}, no } = this.state;
  563. const { courseNos = [] } = data;
  564. return (
  565. <div className="item-layout">
  566. {courseNos.map(item => {
  567. return (
  568. <div className={`item ${item.no === no ? 'active' : ''}`} onClick={() => this.onChangeItem(item.no)}>
  569. <span className="t-1">课时{item.no}</span>
  570. <span className="t-2">{item.title}</span>
  571. </div>
  572. );
  573. })}
  574. </div>
  575. );
  576. }
  577. renderTab() {
  578. const { tab } = this.state;
  579. return [
  580. <div className="bottom">
  581. <div className="content">
  582. <Tabs
  583. type="full"
  584. border
  585. active={tab}
  586. tabs={[
  587. { title: '课程介绍', key: '1' },
  588. { title: '授课大纲', key: '2' },
  589. { title: '小助手', key: '3' },
  590. { title: 'FAQs', key: '4' },
  591. { title: '优惠信息', key: '5' },
  592. { title: '学员评价', key: '6' },
  593. ]}
  594. onChange={key => this.onChangeTab(key)}
  595. />
  596. {this[`renderTab${tab}`]()}
  597. </div>
  598. </div>,
  599. ];
  600. }
  601. renderTab1() {
  602. const { data = {} } = this.state;
  603. return (
  604. <div className="tab-layout">
  605. <div className="tab-title">老师资历</div>
  606. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.teacherContent }} />
  607. <div className="tab-title">基本参数</div>
  608. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.baseContent }} />
  609. <div className="tab-title">授课重点</div>
  610. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.pointContent }} />
  611. <div className="tab-title">适合人群</div>
  612. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.crowdContent }} />
  613. </div>
  614. );
  615. }
  616. renderTab2() {
  617. const { data } = this.state;
  618. return (
  619. <div className="tab-layout">
  620. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.syllabusContent }} />
  621. </div>
  622. );
  623. }
  624. renderTab3() {
  625. return (
  626. <div className="tab-layout">
  627. <div className="qr-layout">
  628. <Assets name={QrCodeAssets} className="m-r-2 v-a-t" />
  629. <div className="p-l-1 d-i-b t-l">
  630. <div className="t-1">千行小助手:</div>
  631. <div className="t-1 m-b-2">1232104-310431</div>
  632. <div className="t-2 t-s-12">微信扫码添加千行小助手为好友,</div>
  633. <div className="t-2 t-s-12">咨询课程,了解更多信息</div>
  634. </div>
  635. </div>
  636. </div>
  637. );
  638. }
  639. renderTab4() {
  640. const { faqs, data = {} } = this.state;
  641. return (
  642. <div className="tab-layout">
  643. <AnswerCarousel
  644. hideBtn
  645. list={faqs}
  646. onFaq={() => User.needLogin().then(() => this.setState({ showFaq: true, faq: { channel: 'course-video', position: data.id } }))}
  647. />
  648. </div>
  649. );
  650. }
  651. renderTab5() {
  652. const { data = {} } = this.state;
  653. return (
  654. <div className="tab-layout">
  655. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.promoteContent }} />
  656. </div>
  657. );
  658. }
  659. renderTab6() {
  660. const { data = {}, comments = [] } = this.state;
  661. return (
  662. <div className="tab-layout">
  663. {data.have && <div className="m-b-1 t-r">
  664. <Button width={100} radius onClick={() => User.needLogin().then(() => this.setState({ showComment: true, comment: { channel: 'course-video', position: data.id } }))}>
  665. 写评论
  666. </Button>
  667. </div>}
  668. {(comments || []).map(item => {
  669. return <Comment data={item} />;
  670. })}
  671. </div>
  672. );
  673. }
  674. }