|
@@ -2,19 +2,22 @@ import React, { Component } from 'react';
|
|
|
import Cropper from 'react-cropper';
|
|
|
import 'cropperjs/dist/cropper.css';
|
|
|
import './index.less';
|
|
|
-import { Checkbox } from 'antd';
|
|
|
+import { Checkbox, Icon } from 'antd';
|
|
|
import FileUpload from '@src/components/FileUpload';
|
|
|
import Assets from '@src/components/Assets';
|
|
|
import scale from '@src/services/Scale';
|
|
|
import { asyncSMessage } from '@src/services/AsyncTools';
|
|
|
import { SelectInput, VerificationInput, Input } from '../Login';
|
|
|
-import { MobileArea } from '../../../Constant';
|
|
|
+import { MobileArea, TextbookFeedbackTarget } from '../../../Constant';
|
|
|
import Invite from '../Invite';
|
|
|
import Modal from '../Modal';
|
|
|
import { Common } from '../../stores/common';
|
|
|
import { User } from '../../stores/user';
|
|
|
import { My } from '../../stores/my';
|
|
|
import Select from '../Select';
|
|
|
+import { formatDate, getMap } from '../../../../src/services/Tools';
|
|
|
+
|
|
|
+const TextbookFeedbackTargetMap = getMap(TextbookFeedbackTarget, 'value', 'label');
|
|
|
|
|
|
export class BindPhone extends Component {
|
|
|
constructor(props) {
|
|
@@ -425,7 +428,7 @@ export class EditAvatar extends Component {
|
|
|
};
|
|
|
} else {
|
|
|
const img = new Image();
|
|
|
- img.onload = function() {
|
|
|
+ img.onload = function () {
|
|
|
const canvas = document.createElement('canvas');
|
|
|
canvas.height = img.height;
|
|
|
canvas.width = img.width;
|
|
@@ -543,8 +546,31 @@ export class InviteModal extends Component {
|
|
|
|
|
|
// 模考选择下载
|
|
|
export class DownloadModal extends Component {
|
|
|
+ constructor(props) {
|
|
|
+ super(props);
|
|
|
+ this.state = { checkMap: {} };
|
|
|
+ }
|
|
|
+
|
|
|
+ onConfirm() {
|
|
|
+ const { onConfirm, data } = this.props;
|
|
|
+ if (onConfirm) onConfirm();
|
|
|
+ const { checkMap } = this.state;
|
|
|
+ Object.keys(checkMap).forEach(key => {
|
|
|
+ if (!checkMap[key]) return;
|
|
|
+ const link = data[`${key}`];
|
|
|
+ if (link) {
|
|
|
+ openLink(link);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.setState({ checkList: [] });
|
|
|
+ }
|
|
|
+
|
|
|
render() {
|
|
|
- const { show, onConfirm, onCancel } = this.props;
|
|
|
+ const { show, data = {}, onCancel } = this.props;
|
|
|
+ const { checkMap = {} } = this.state;
|
|
|
+ const quantVersion = data.quantVersion || 0;
|
|
|
+ const irVersion = data.irVersion || 0;
|
|
|
+ const rcVersion = data.rcVersion || 0;
|
|
|
return (
|
|
|
<Modal
|
|
|
className="download-modal"
|
|
@@ -552,27 +578,36 @@ export class DownloadModal extends Component {
|
|
|
width={570}
|
|
|
title="下载"
|
|
|
confirmText="下载"
|
|
|
- onConfirm={onConfirm}
|
|
|
+ onConfirm={() => this.onConfirm()}
|
|
|
onCancel={onCancel}
|
|
|
>
|
|
|
<div className="download-modal-wrapper">
|
|
|
<div className="t-2 t-s-18 m-b-1">请选择下载科目</div>
|
|
|
<div className="m-b-1">
|
|
|
- <div className="t-2 t-s-16">
|
|
|
- <Checkbox />
|
|
|
- <span className="m-l-5">数学</span>
|
|
|
- <span className="t-8">(版本7 最后更新:2019-07-16 11:41:13)</span>
|
|
|
- </div>
|
|
|
- <div className="t-2 t-s-16">
|
|
|
- <Checkbox />
|
|
|
- <span className="m-l-5">数学</span>
|
|
|
- <span className="t-8">(版本7 最后更新:2019-07-16 11:41:13)</span>
|
|
|
- </div>
|
|
|
- <div className="t-2 t-s-16">
|
|
|
- <Checkbox />
|
|
|
+ {quantVersion > 0 && <div className="t-2 t-s-16">
|
|
|
+ <Checkbox checked={checkMap.quant} onChange={() => {
|
|
|
+ checkMap.quant = !checkMap.quant;
|
|
|
+ this.setState({ checkMap });
|
|
|
+ }} />
|
|
|
<span className="m-l-5">数学</span>
|
|
|
- <span className="t-8">(版本7 最后更新:2019-07-16 11:41:13)</span>
|
|
|
- </div>
|
|
|
+ <span className="t-8">(版本{quantVersion} 最后更新:{formatDate(data.quantTime, 'YYYY-MM-DD HH:mm:ss')})</span>
|
|
|
+ </div>}
|
|
|
+ {irVersion > 0 && <div className="t-2 t-s-16">
|
|
|
+ <Checkbox checked={checkMap.ir} onChange={() => {
|
|
|
+ checkMap.ir = !checkMap.ir;
|
|
|
+ this.setState({ checkMap });
|
|
|
+ }} />
|
|
|
+ <span className="m-l-5">逻辑</span>
|
|
|
+ <span className="t-8">(版本{irVersion} 最后更新:{formatDate(data.irTime, 'YYYY-MM-DD HH:mm:ss')})</span>
|
|
|
+ </div>}
|
|
|
+ {rcVersion > 0 && <div className="t-2 t-s-16">
|
|
|
+ <Checkbox checked={checkMap.rc} onChange={() => {
|
|
|
+ checkMap.rc = !checkMap.rc;
|
|
|
+ this.setState({ checkMap });
|
|
|
+ }} />
|
|
|
+ <span className="m-l-5">阅读</span>
|
|
|
+ <span className="t-8">(版本{rcVersion} 最后更新:{formatDate(data.rcTime, 'YYYY-MM-DD HH:mm:ss')})</span>
|
|
|
+ </div>}
|
|
|
</div>
|
|
|
</div>
|
|
|
</Modal>
|
|
@@ -583,7 +618,7 @@ export class DownloadModal extends Component {
|
|
|
// 模考开通确认
|
|
|
export class OpenConfirmModal extends Component {
|
|
|
render() {
|
|
|
- const { show, onConfirm, onCancel } = this.props;
|
|
|
+ const { show, onConfirm, onCancel, data = {} } = this.props;
|
|
|
return (
|
|
|
<Modal
|
|
|
className="open-confirm-modal"
|
|
@@ -596,8 +631,8 @@ export class OpenConfirmModal extends Component {
|
|
|
onCancel={onCancel}
|
|
|
>
|
|
|
<div className="open-confirm-modal-wrapper m-b-2">
|
|
|
- <div className="t-2 t-s-18">您正在开通「千行CAT模考」。</div>
|
|
|
- <div className="t-2 t-s-18">模考有效期至:2019-11-17</div>
|
|
|
+ <div className="t-2 t-s-18">您正在开通「{data.title}」。</div>
|
|
|
+ <div className="t-2 t-s-18">模考有效期至:{data.endTime && formatDate(data.endTime, 'YYYY-MM-DD')}</div>
|
|
|
</div>
|
|
|
</Modal>
|
|
|
);
|
|
@@ -629,16 +664,33 @@ export class RestartConfirmModal extends Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export class CheckErrorModal extends Component {
|
|
|
+export class FeedbackErrorDataModal extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
- this.state = { data: { position: [] } };
|
|
|
+ this.state = { data: { position: ['', '', ''] } };
|
|
|
+ }
|
|
|
+
|
|
|
+ componentWillReceiveProps(nextProps) {
|
|
|
+ if (nextProps.defaultData) {
|
|
|
+ this.setState({ data: Object.assign({}, nextProps.defaultData, this.state.data) });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
onConfirm() {
|
|
|
const { onConfirm } = this.props;
|
|
|
- if (onConfirm) onConfirm(this.state.data);
|
|
|
- this.setState({ data: { position: [] } });
|
|
|
+ const { data } = this.state;
|
|
|
+ console.log(data, this.props);
|
|
|
+ if (!data.content || !data.originContent) return;
|
|
|
+ My.addFeedbackErrorData(
|
|
|
+ data.dataId,
|
|
|
+ data.title,
|
|
|
+ data.position.join(','),
|
|
|
+ data.originContent,
|
|
|
+ data.content,
|
|
|
+ ).then(() => {
|
|
|
+ if (onConfirm) onConfirm();
|
|
|
+ this.setState({ data: { position: ['', '', ''] } });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
onCancel() {
|
|
@@ -719,16 +771,32 @@ export class CheckErrorModal extends Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export class QuestionModal extends Component {
|
|
|
+export class AskCourseModal extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
- this.state = { data: {} };
|
|
|
+ this.state = { data: { position: [] } };
|
|
|
+ }
|
|
|
+
|
|
|
+ componentWillReceiveProps(nextProps) {
|
|
|
+ if (nextProps.defaultData) {
|
|
|
+ this.setState({ data: Object.assign({}, nextProps.defaultData, this.state.data) });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
onConfirm() {
|
|
|
- const { onConfirm } = this.props;
|
|
|
- if (onConfirm) onConfirm(this.state.data);
|
|
|
- this.setState({ data: {} });
|
|
|
+ const { course, courseNo, onConfirm } = this.props;
|
|
|
+ const { data } = this.state;
|
|
|
+ if (!data.position || !data.originContent || !data.content) return;
|
|
|
+ My.addCourseAsk(
|
|
|
+ course.id,
|
|
|
+ courseNo.id,
|
|
|
+ data.position.join(','),
|
|
|
+ data.originContent,
|
|
|
+ data.content,
|
|
|
+ ).then(() => {
|
|
|
+ if (onConfirm) onConfirm();
|
|
|
+ this.setState({ data: { position: [] } });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
onCancel() {
|
|
@@ -738,7 +806,7 @@ export class QuestionModal extends Component {
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
- const { show, selectList } = this.props;
|
|
|
+ const { show, selectList, courseNo } = this.props;
|
|
|
const { data } = this.state;
|
|
|
return (
|
|
|
<Modal
|
|
@@ -751,7 +819,7 @@ export class QuestionModal extends Component {
|
|
|
onCancel={() => this.onCancel()}
|
|
|
>
|
|
|
<div className="t-2 m-b-1 t-s-16">
|
|
|
- 针对<span className="t-4">课时1</span>的 <Select theme="white" list={selectList} />
|
|
|
+ 针对<span className="t-4">课时{courseNo.no}</span>的 <Select theme="white" list={selectList} />
|
|
|
进行提问.
|
|
|
</div>
|
|
|
<div className="t-2 t-s-16">老师讲解的内容是:</div>
|
|
@@ -782,16 +850,30 @@ export class QuestionModal extends Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export class NoteModal extends Component {
|
|
|
+export class CourseNoteModal extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.state = { data: {} };
|
|
|
}
|
|
|
|
|
|
+ componentWillReceiveProps(nextProps) {
|
|
|
+ if (nextProps.defaultData) {
|
|
|
+ this.setState({ data: Object.assign({}, nextProps.defaultData, this.state.data) });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
onConfirm() {
|
|
|
- const { onConfirm } = this.props;
|
|
|
- if (onConfirm) onConfirm(this.state.data);
|
|
|
- this.setState({ data: {} });
|
|
|
+ const { course, onConfirm } = this.props;
|
|
|
+ const { data } = this.state;
|
|
|
+ if (!data.content) return;
|
|
|
+ My.updateCourseNote(
|
|
|
+ course.id,
|
|
|
+ data.courseNoId,
|
|
|
+ data.content,
|
|
|
+ ).then(() => {
|
|
|
+ if (onConfirm) onConfirm();
|
|
|
+ this.setState({ data: {} });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
onCancel() {
|
|
@@ -801,7 +883,7 @@ export class NoteModal extends Component {
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
- const { show, selectList } = this.props;
|
|
|
+ const { show, course = {}, courseNos = [] } = this.props;
|
|
|
const { data } = this.state;
|
|
|
return (
|
|
|
<Modal
|
|
@@ -813,16 +895,19 @@ export class NoteModal extends Component {
|
|
|
onCancel={() => this.onCancel()}
|
|
|
>
|
|
|
<div className="t-2 m-b-1 t-s-16">
|
|
|
- OG20 刷题 语文 SC
|
|
|
- <Select theme="white" list={selectList} />
|
|
|
+ {course.title}
|
|
|
+ <Select theme="white" value={data.courseNoId} list={courseNos} onChange={(item) => {
|
|
|
+ data.courseNoId = item.id;
|
|
|
+ this.setState({ data });
|
|
|
+ }} />
|
|
|
</div>
|
|
|
<textarea
|
|
|
- value={data.originContent}
|
|
|
+ value={data.content}
|
|
|
className="b-c-1 w-10 p-10"
|
|
|
rows={10}
|
|
|
placeholder={'写下笔记,方便以后复习。'}
|
|
|
onChange={e => {
|
|
|
- data.originContent = e.target.value;
|
|
|
+ data.content = e.target.value;
|
|
|
this.setState({ data });
|
|
|
}}
|
|
|
/>
|
|
@@ -831,3 +916,153 @@ export class NoteModal extends Component {
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+export class TextbookFeedbackModal extends Component {
|
|
|
+ constructor(props) {
|
|
|
+ super(props);
|
|
|
+ this.state = { data: {} };
|
|
|
+ }
|
|
|
+
|
|
|
+ componentWillReceiveProps(nextProps) {
|
|
|
+ if (nextProps.defaultData) {
|
|
|
+ this.setState({ data: Object.assign({}, nextProps.defaultData, this.state.data) });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ onConfirm() {
|
|
|
+ const { onConfirm } = this.props;
|
|
|
+ const { data } = this.state;
|
|
|
+ if (!data.content) return;
|
|
|
+ if (data.target !== 'new' && !data.no) return;
|
|
|
+ My.addTextbookFeedback(data.questionSubject, data.target, data.no, data.content).then(() => {
|
|
|
+ if (onConfirm) onConfirm();
|
|
|
+ this.setState({ data: {} });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ onCancel() {
|
|
|
+ const { onCancel } = this.props;
|
|
|
+ if (onCancel) onCancel();
|
|
|
+ this.setState({ data: {} });
|
|
|
+ }
|
|
|
+
|
|
|
+ render() {
|
|
|
+ const { show } = this.props;
|
|
|
+ const { data } = this.state;
|
|
|
+ return (
|
|
|
+ <Modal
|
|
|
+ show={show}
|
|
|
+ title="反馈"
|
|
|
+ width={630}
|
|
|
+ onConfirm={() => this.onConfirm()}
|
|
|
+ onCancel={() => this.onCancel()}
|
|
|
+ >
|
|
|
+ <div className="t-2 t-s-16 m-b-1">
|
|
|
+ 机经类别: <Select
|
|
|
+ value={data.questionSubject}
|
|
|
+ theme="white"
|
|
|
+ list={[{ title: '数学机经', key: 'quant' }, { title: '逻辑机经', key: 'rc' }, { title: '阅读机经', key: 'ir' }]}
|
|
|
+ onChange={(value) => {
|
|
|
+ data.questionSubject = value;
|
|
|
+ this.setState({ data });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ 反馈类型: <Select
|
|
|
+ value={data.target}
|
|
|
+ theme="white"
|
|
|
+ list={TextbookFeedbackTarget}
|
|
|
+ onChange={(value) => {
|
|
|
+ data.target = value;
|
|
|
+ this.setState({ data });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <span hidden={data.target === 'new'}> 题号是 <input value={data.no} style={{ width: 80 }} className="m-l-1 b-c-1 t-c" onChange={e => {
|
|
|
+ data.no = e.target.value;
|
|
|
+ this.setState({ data });
|
|
|
+ }} />
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div className="t-2 t-s-16">{TextbookFeedbackTargetMap[data.target]}:</div>
|
|
|
+ <textarea
|
|
|
+ value={data.content}
|
|
|
+ className="b-c-1 w-10 p-10"
|
|
|
+ rows={10}
|
|
|
+ placeholder={TextbookFeedbackTargetMap[data.target]}
|
|
|
+ onChange={e => {
|
|
|
+ data.content = e.target.value;
|
|
|
+ this.setState({ data });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <div className="b-b m-t-2" />
|
|
|
+ </Modal>
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class CommentModal extends Component {
|
|
|
+ constructor(props) {
|
|
|
+ super(props);
|
|
|
+ this.state = { data: {} };
|
|
|
+ }
|
|
|
+
|
|
|
+ onConfirm() {
|
|
|
+ const { onConfirm } = this.props;
|
|
|
+ const { data } = this.state;
|
|
|
+ if (!data.content) return;
|
|
|
+ My.addComment(data.channel, data.position, data.content).then(() => {
|
|
|
+ if (onConfirm) onConfirm();
|
|
|
+ this.setState({ data: {} });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ onCancel() {
|
|
|
+ const { onCancel } = this.props;
|
|
|
+ if (onCancel) onCancel();
|
|
|
+ this.setState({ data: {} });
|
|
|
+ }
|
|
|
+
|
|
|
+ render() {
|
|
|
+ const { show } = this.props;
|
|
|
+ const { data } = this.state;
|
|
|
+ return (
|
|
|
+ <Modal
|
|
|
+ show={show}
|
|
|
+ title="评价"
|
|
|
+ onConfirm={() => this.onConfirm()}
|
|
|
+ onCancel={() => this.onCancel()}
|
|
|
+ >
|
|
|
+ <textarea
|
|
|
+ value={data.content}
|
|
|
+ className="b-c-1 w-10 p-10"
|
|
|
+ rows={6}
|
|
|
+ placeholder="您的看法对我们来说很重要!"
|
|
|
+ onChange={e => {
|
|
|
+ data.content = e.target.value;
|
|
|
+ this.setState({ data });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <div className="b-b m-t-2" />
|
|
|
+ </Modal>
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class FinishModal extends Component {
|
|
|
+ render() {
|
|
|
+ const { show, onConfirm } = this.props;
|
|
|
+ return (
|
|
|
+ <Modal
|
|
|
+ show={show}
|
|
|
+ title="提交成功"
|
|
|
+ confirmText="好的,知道了"
|
|
|
+ btnAlign="center"
|
|
|
+ onConfirm={() => onConfirm()}
|
|
|
+ >
|
|
|
+ <div className="t-2 t-s-18">
|
|
|
+ <Icon type="check" className="t-5 m-r-5" />
|
|
|
+ 您的每一次反馈都是千行进步的动力。
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|