page.js 25 KB

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