page.js 24 KB

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