page.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  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 { QrCode } 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. this.refreshNote();
  207. });
  208. Main.listComment({ page: 1, size: 100, channel: 'course-video', position: id }).then(result => {
  209. this.comments = result.list;
  210. this.setState({ comments: result.list });
  211. });
  212. }
  213. refreshAsk(position) {
  214. const { id } = this.params;
  215. const { item = {} } = this.state;
  216. Course.listAsk(Object.assign({ page: 1, size: 1000, courseId: id, courseNoId: item.id, position })).then(result => {
  217. this.setState({ asks: result.list });
  218. });
  219. }
  220. refreshNote() {
  221. const { id } = this.params;
  222. const { data } = this.state;
  223. if (!data.have) return;
  224. My.listCourseNote({ courseId: id, page: 1, size: data.courseNos.length })
  225. .then((result) => {
  226. this.noteMap = getMap(result.list, 'courseNoId');
  227. data.courseNos.forEach((row) => {
  228. const note = this.noteMap[row.id];
  229. if (note) row.note = true;
  230. });
  231. this.setState({ data });
  232. });
  233. }
  234. onChangeRightTab(rightTab) {
  235. this.setState({ rightTab });
  236. }
  237. onChangeTab(tab) {
  238. this.setState({ tab });
  239. }
  240. onChangeItem(key) {
  241. key = Number(key);
  242. this.changeQuery({ no: key });
  243. this.setState({ no: key });
  244. const { data, item } = this.state;
  245. const index = key - 1;
  246. const timelineSelect = [];
  247. const current = data.courseNos[index];
  248. if (current) {
  249. const max = current.time;
  250. let start = 0;
  251. let end = start + 5;
  252. while (start < max) {
  253. timelineSelect.push({
  254. title: `${start} - ${end}min`,
  255. key: `${start}`,
  256. });
  257. start += 5;
  258. end = Math.min(start + 5, max);
  259. }
  260. }
  261. // 切换播放,记录进度
  262. if (item) {
  263. this.updateProgress(item.id, this.lastSecond, item.time, true);
  264. }
  265. this.setState({ item: current, timelineSelect });
  266. }
  267. onTimeUpdate(second) {
  268. const { position, item = {}, data } = this.state;
  269. if (!data.have) {
  270. // 如果是试用,则按秒数增加
  271. second += (item.startTrail || 0) * 60;
  272. }
  273. const minute = parseInt(second / 60, 10);
  274. const nowPosition = parseInt(minute / 5, 10) * 5;
  275. if (nowPosition !== position) {
  276. this.refreshAsk(position);
  277. this.setState({ position: nowPosition });
  278. // 定时更新进度
  279. this.updateProgress(item.id, second, item.time);
  280. }
  281. this.lastSecond = second;
  282. this.showWater(second);
  283. }
  284. playVideo(second) {
  285. // 开始计时
  286. this.lastTime = new Date();
  287. this.showWater(second);
  288. }
  289. showWater(second, extend) {
  290. const { data, water = {} } = this.state;
  291. const { waters = [] } = data;
  292. if (!this.lastTime && water.show) {
  293. water.show = false;
  294. second -= 1;
  295. water.transition = '';
  296. } else if (!water.show) {
  297. water.show = true;
  298. water.transition = 'transform 1s linear 0s';
  299. }
  300. if (water.show) {
  301. water.opacity = 1;
  302. } else {
  303. water.opacity = 0;
  304. }
  305. if (extend) {
  306. Object.assign(water, extend);
  307. }
  308. const time = 15;
  309. const stop = 0;
  310. const times = (second / (time + stop));
  311. const index = parseInt(times % waters.length, 10);
  312. const current = (second % (time + stop));
  313. water.style = [2, 0, 2, 1][parseInt((times % 4), 10)] + 1;
  314. water.text = waters[[0, 1][index]];
  315. // console.log(water.show, current, current / 4, (current / 4) % 2);
  316. if (water.show) {
  317. water.opacity = (current / 4) % 2 > 1 ? 0 : 1;
  318. }
  319. // if (water.style % 2) {
  320. // water.transform = `translateX(${current * 100 / time}%)`;
  321. // } else {
  322. water.transform = `translateX(${100 - ((current - stop / 2) * 100 / time)}%)`;
  323. // }
  324. this.setState({ water });
  325. }
  326. onChangeProgress(second) {
  327. this.showWater(second - 1, this.lastTime ? { transition: '', opacity: 0 } : { transition: '', opacity: 0 });
  328. setTimeout(() => {
  329. this.showWater(second, this.lastTime ? { transition: 'transform 1s linear 0s', opacity: 1 } : { transition: '', opacity: 0 });
  330. }, 1);
  331. }
  332. pauseVideo(second) {
  333. // 停止计时
  334. const now = new Date();
  335. if (this.lastTime != null) {
  336. this.time += (now.getTime() - this.lastTime.getTime()) / 1000;
  337. }
  338. this.lastTime = null;
  339. this.showWater(second);
  340. }
  341. next() {
  342. const { data, item } = this.state;
  343. if (data.courseNos.length === item.no) {
  344. return;
  345. }
  346. this.onChangeItem(item.no + 1);
  347. }
  348. onVideoAction(key) {
  349. const { rightTab, showTab, showAsk, showNote, item = {} } = this.state;
  350. switch (key) {
  351. case 'ask':
  352. return this.setState({ showAsk: !showAsk });
  353. case 'note':
  354. return this.setState({ showNote: !showNote, note: this.noteMap ? this.noteMap[item.id] || {} : {} });
  355. case 'answer':
  356. return this.setState({ showTab: rightTab === '1' ? !showTab : true, rightTab: '1' });
  357. case 'list':
  358. return this.setState({ showTab: rightTab === '2' ? !showTab : true, rightTab: '2' });
  359. default:
  360. return '';
  361. }
  362. }
  363. updateProgress(courseNoId, currentTime, totalTime, record) {
  364. if (!this.lastTime) return;
  365. const { id } = this.params;
  366. const now = new Date();
  367. this.time += (now.getTime() - this.lastTime.getTime()) / 1000;
  368. this.lastTime = now;
  369. const progress = formatPercent(currentTime, totalTime);
  370. if (record || this.time > 600) {
  371. // 最长5分钟记录一次
  372. Course.noProgress(id, courseNoId, progress, this.time, courseNoId);
  373. this.time = 0;
  374. } else {
  375. Course.noProgress(id, courseNoId, progress, null, null);
  376. }
  377. }
  378. buy() {
  379. const { data } = this.props;
  380. User.needLogin().then(() => {
  381. Order.speedPay({ productType: 'course', productId: data.id }).then(result => {
  382. User.needPay(result).then(() => {
  383. this.refresh();
  384. });
  385. });
  386. });
  387. }
  388. add() {
  389. const { data } = this.props;
  390. User.needLogin().then(() => {
  391. Order.addCheckout({ productType: 'course', productId: data.id }).then(() => {
  392. this.setState({ add: true });
  393. });
  394. });
  395. }
  396. viewAsk(id) {
  397. Course.askView(id);
  398. }
  399. setVideo(video) {
  400. this.video = video;
  401. }
  402. renderView() {
  403. const { base = {}, data = {}, item = {}, add, rightTab, showTab, showAsk, showNote, dataStructMap = {}, showComment, comment = {}, showFaq, faq = {}, showFinish, note = {}, ask = {}, timelineSelect = [], water = {} } = this.state;
  404. const { courseNos = [] } = data;
  405. return (
  406. <div>
  407. <div className="top content t-8">
  408. 千行课堂 > 全部课程 > {data.parentStructId > 0 ? `${(dataStructMap[data.parentStructId] || {}).title} >` : ''}{' '}
  409. {(dataStructMap[data.structId] || {}).title} > {data.title} > <span className="t-1">课程详情</span>
  410. </div>
  411. <div className="center content">
  412. <div className="t-1 t-s-20">
  413. {data.title}
  414. <div className="action f-r">
  415. {!data.have && <Button className="m-r-1" radius size="lager" onClick={() => this.buy()}>
  416. 立即购买
  417. </Button>}
  418. {!data.have && <Button theme="default" radius size="lager" disabled={data.add || add} onClick={() => this.add()}>
  419. <Assets name="add" />
  420. </Button>}
  421. {data.have && <Button className="m-r-1" radius size="lager" onClick={() => linkTo('/my/course')}>
  422. 我的课程
  423. </Button>}
  424. </div>
  425. </div>
  426. <div className="t-2 m-b-1">授课老师:{data.teacher}</div>
  427. <div className={'detail'}>
  428. <div className="left">
  429. {data.have && <div hidden={(item.paper && item.paper.finishTimes > 0)} className="left-top">
  430. <span className="d-i-b m-r-1">预习作业</span>
  431. <span className="d-i-b m-r-2">
  432. <ProgressText width={480} size="small" progress={item.report ? formatPercent(item.report.userNumber, item.report.questionNumber) : 0} />
  433. </span>
  434. <Button className="f-r" radius onClick={() => (item.report ? Question.continueLink('preview', item) : Question.startLink('preview', item))}>
  435. 做题
  436. </Button>
  437. </div>}
  438. <div className="video-layout">
  439. {item && <Video
  440. key={item.id}
  441. src={item.resource || '/1.mp4'}
  442. width={750}
  443. height={467}
  444. ref={ref => this.setVideo(ref)}
  445. water={<div key={water.style} className={`video-water style-${water.style}`} style={{ ...water }}>{water.text}</div>}
  446. btnList={[
  447. { title: '提问', key: 'ask', show: data.have, active: showAsk, pause: true },
  448. {
  449. key: 'answer',
  450. render(active) {
  451. return <Assets name={active ? 'question_on' : 'question_off'} />;
  452. },
  453. full: true,
  454. show: true,
  455. active: showTab && rightTab === '1',
  456. },
  457. { title: '笔记', key: 'note', show: data.have, active: showNote, pause: true },
  458. { title: '课表', key: 'list', show: true, full: true, active: showTab && rightTab === '2' },
  459. ]}
  460. onPlay={(second) => this.playVideo(second)}
  461. onPause={(second) => this.pauseVideo(second)}
  462. onChangeProgress={(second) => this.onChangeProgress(second)}
  463. onNext={() => this.next()}
  464. onAction={key => this.onVideoAction(key)}
  465. onTimeUpdate={time => this.onTimeUpdate(time)}
  466. onFullChange={() => this.setState({ showTab: true, rightTab: '1' })}
  467. >
  468. <div hidden={!showTab} className="video-fixed tab-warpper">
  469. <Tabs
  470. type="division"
  471. theme="gray"
  472. space={2.5}
  473. active={rightTab}
  474. tabs={[{ title: '精选问答', key: '1' }, { title: '课时列表', key: '2' }]}
  475. onChange={key => this.onChangeRightTab(key)}
  476. />
  477. <div className="tab-body">{this[`renderRightTab${rightTab}`]()}</div>
  478. </div>
  479. </Video>}
  480. </div>
  481. </div>
  482. <div className={`detail-right ${data.have && !(item.paper && item.paper.finishTimes > 0) ? 'have' : ''} tab-warpper`}>
  483. <Tabs
  484. type="division"
  485. theme="gray"
  486. space={2.5}
  487. active={rightTab}
  488. tabs={[{ title: '精选问答', key: '1' }, { title: '课时列表', key: '2' }]}
  489. onChange={key => this.onChangeRightTab(key)}
  490. />
  491. <div className="tab-body">{this[`renderRightTab${rightTab}`]()}</div>
  492. </div>
  493. </div>
  494. {data.have && <UserTable columns={this.columns} list={courseNos} />}
  495. </div>
  496. <div hidden={data.have} className="bottom">
  497. <div className="content">{this.renderTab()}</div>
  498. </div>
  499. <Contact data={base.contact} />
  500. <Footer />
  501. <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 })} />
  502. <CourseNoteModal getContainer={() => (showTab ? document.getElementById(this.video.state.id) : document.body)} show={showNote} defaultData={note} course={data} courseNos={courseNos} noteMap={this.noteMap} onConfirm={() => {
  503. this.setState({ showNote: false });
  504. this.refreshNote();
  505. }} onCancel={() => this.setState({ showNote: false })} />
  506. <CommentModal
  507. show={showComment}
  508. defaultData={comment}
  509. onConfirm={() => this.setState({ showComment: false, commnet: {}, showFinish: true })}
  510. onCancel={() => this.setState({ showComment: false, commnet: {} })}
  511. onClose={() => this.setState({ showComment: false, commnet: {} })}
  512. />
  513. <FaqModal show={showFaq} defaultData={faq} onCancel={() => this.setState({ showFaq: false, faq: {} })} onConfirm={() => this.setState({ showFaq: false, faq: {}, showFinish: true })} />
  514. <FinishModal
  515. getContainer={() => document.getElementById(this.video.state.id)}
  516. show={showFinish}
  517. onConfirm={() => this.setState({ showFinish: false })}
  518. />
  519. </div >
  520. );
  521. }
  522. renderRightTab1() {
  523. const { asks = [], data = {}, position } = this.state;
  524. return [
  525. <div className="all-answer">
  526. <span className="d-i-b b m-r-5" />
  527. <span className="d-i-b t-6">{position}:00~{position + 5}:00</span>
  528. <a className="f-r d-i-b t-4 c-p" href={`/course/answer/${data.id}`} target="_blank">全部问答 ></a>
  529. </div>,
  530. <div className="answer-layout">
  531. {asks.map(item => {
  532. return (
  533. <div className="answer-item">
  534. <div>
  535. <div className="small-tag">提问</div>
  536. </div>
  537. <div className="desc">
  538. <OpenText>{item.content}</OpenText>
  539. </div>
  540. {item.answerStatus > 0 && (
  541. <div>
  542. <div className="small-tag">回答</div>
  543. </div>
  544. )}
  545. {item.answerStatus > 0 && (
  546. <div className="desc">
  547. <OpenText onOpen={() => this.viewAsk(item.id)}>{item.answer}</OpenText>
  548. </div>
  549. )}
  550. </div>
  551. );
  552. })}
  553. </div>,
  554. ];
  555. }
  556. renderRightTab2() {
  557. const { data = {}, no } = this.state;
  558. const { courseNos = [] } = data;
  559. return (
  560. <div className="item-layout">
  561. {courseNos.map(item => {
  562. return (
  563. <div className={`item ${item.no === no ? 'active' : ''}`} onClick={() => this.onChangeItem(item.no)}>
  564. <span className="t-1">课时{item.no}</span>
  565. <span className="t-2">{item.title}</span>
  566. </div>
  567. );
  568. })}
  569. </div>
  570. );
  571. }
  572. renderTab() {
  573. const { tab } = this.state;
  574. return [
  575. <div className="bottom">
  576. <div className="content">
  577. <Tabs
  578. type="full"
  579. border
  580. active={tab}
  581. tabs={[
  582. { title: '课程介绍', key: '1' },
  583. { title: '授课大纲', key: '2' },
  584. { title: '小助手', key: '3' },
  585. { title: 'FAQs', key: '4' },
  586. { title: '优惠信息', key: '5' },
  587. { title: '学员评价', key: '6' },
  588. ]}
  589. onChange={key => this.onChangeTab(key)}
  590. />
  591. {this[`renderTab${tab}`]()}
  592. </div>
  593. </div>,
  594. ];
  595. }
  596. renderTab1() {
  597. const { data = {} } = this.state;
  598. return (
  599. <div className="tab-layout">
  600. <div className="tab-title">老师资历</div>
  601. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.teacherContent }} />
  602. <div className="tab-title">基本参数</div>
  603. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.baseContent }} />
  604. <div className="tab-title">授课重点</div>
  605. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.pointContent }} />
  606. <div className="tab-title">适合人群</div>
  607. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.crowdContent }} />
  608. </div>
  609. );
  610. }
  611. renderTab2() {
  612. const { data } = this.state;
  613. return (
  614. <div className="tab-layout">
  615. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.syllabusContent }} />
  616. </div>
  617. );
  618. }
  619. renderTab3() {
  620. return (
  621. <div className="tab-layout">
  622. <div className="qr-layout">
  623. <Assets name={QrCode} className="m-r-2 v-a-t" />
  624. <div className="p-l-1 d-i-b t-l">
  625. <div className="t-1">千行小助手:</div>
  626. <div className="t-1 m-b-2">1232104-310431</div>
  627. <div className="t-2 t-s-12">微信扫码添加千行小助手为好友,</div>
  628. <div className="t-2 t-s-12">咨询课程,了解更多信息</div>
  629. </div>
  630. </div>
  631. </div>
  632. );
  633. }
  634. renderTab4() {
  635. const { faqs, data = {} } = this.state;
  636. return (
  637. <div className="tab-layout">
  638. <AnswerCarousel
  639. hideBtn
  640. list={faqs}
  641. onFaq={() => User.needLogin().then(() => this.setState({ showFaq: true, faq: { channel: 'course-video', position: data.id } }))}
  642. />
  643. </div>
  644. );
  645. }
  646. renderTab5() {
  647. const { data = {} } = this.state;
  648. return (
  649. <div className="tab-layout">
  650. <div className="tab-desc" dangerouslySetInnerHTML={{ __html: data.promoteContent }} />
  651. </div>
  652. );
  653. }
  654. renderTab6() {
  655. const { data = {}, comments = [] } = this.state;
  656. return (
  657. <div className="tab-layout">
  658. {data.have && <div className="m-b-1 t-r">
  659. <Button width={100} radius onClick={() => User.needLogin().then(() => this.setState({ showComment: true, comment: { channel: 'course-video', position: data.id } }))}>
  660. 写评论
  661. </Button>
  662. </div>}
  663. {(comments || []).map(item => {
  664. return <Comment data={item} />;
  665. })}
  666. </div>
  667. );
  668. }
  669. }