Commit fcb2e688 by guomingpang

Merge branch 'dev' of…

Merge branch 'dev' of ssh://xmgit.ixm5.cn:10022/xiaomai-cloud-class/xiaomai-cloud-class-web into dev
parents 6ab27653 ba4d4067
......@@ -109,7 +109,7 @@
"start:dev1": "cross-env DEPLOY_ENV=dev node scripts/start.js",
"start:rc": "cross-env DEPLOY_ENV=rc node scripts/start.js",
"start:gray": "cross-env DEPLOY_ENV=gray node scripts/start.js",
"build:dev": "cross-env DEPLOY_ENV=dev node scripts/build.js",
"build:dev": "cross-env DEPLOY_ENV=dev node --max_old_space_size=4096 scripts/build.js",
"build:dev1": "cross-env DEPLOY_ENV=dev node scripts/build.js",
"build:rc": "cross-env DEPLOY_ENV=rc node scripts/build.js",
"build:gray": "cross-env DEPLOY_ENV=gray node scripts/build.js",
......
......@@ -3,6 +3,7 @@ import "./HomeTip.less"
import { VersionContext } from "@/store/context";
import ContactWidget from '@/components/ContactWidget';
import { Carousel } from "antd";
import moment from "moment";
export default function HomeTip() {
......@@ -43,7 +44,7 @@ export default function HomeTip() {
{
tipType === 2 && (
<div className="content">
<span className="icon iconfont" style={{color:"#FF4F4F",marginRight:"8px"}}>&#xe61d;</span>版本到期提醒:当前企业购买的小麦企学院服务已于{expirationTime}到期,到期后仍可访问,但功能不可使用,建议尽快续费购买哦~
<span className="icon iconfont" style={{color:"#FF4F4F",marginRight:"8px"}}>&#xe61d;</span>版本到期提醒:当前企业购买的小麦企学院服务已于{moment(versionInfo?.validEndTimeST).format("YYYY-MM-DD HH:mm:ss")}到期,到期后仍可访问,但功能不可使用,建议尽快续费购买哦~
<ContactWidget placement="bottom" trigger="hover"><div className="renew-btn">立即续费</div></ContactWidget>
</div>
)
......
......@@ -76,6 +76,8 @@ const App: React.FC = (props: any) => {
surplusDayTime: version.surplusDayTime,
validEndTime: moment(version.validEndTime).format('YYYY-MM-DD'),
validStartTime: moment(version.validStartTime).format('YYYY-MM-DD'),
validEndTimeST: version.validEndTime,
validStartTimeST: version.validStartTime,
whetherReachUserNum: version.whetherReachUserNum,
};
setVersionInfo(versioninfo)
......
......@@ -85,7 +85,7 @@ function ExpirationPopover(props) {
<div className="title">{props.surplusDayTime === 0 ? "服务已到期":"服务到期提醒"}</div>
{
showType === 3 ? (
<div className="tip-text">当前企业购买的小麦企学院服务已于<span style={{color:"#FF4F4F"}}>{moment(props.endTime).format("YYYY-MM-DD")}</span>到期,到期后仍可访问,但功能不可使用,建议尽快续费购买哦~</div>
<div className="tip-text">当前企业购买的小麦企学院服务已于<span style={{color:"#FF4F4F"}}>{moment(props.endTime).format("YYYY-MM-DD HH:mm:ss")}</span>到期,到期后仍可访问,但功能不可使用,建议尽快续费购买哦~</div>
) : (
<div className="tip-text">当前企业购买的小麦企学院服务 <span style={{color:"#FF4F4F"}}>仅剩{props.surplusDayTime}</span>(于<span>{moment(props.endTime).format("YYYY-MM-DD")}</span>到期),为了不影响使用,建议尽快续费购买哦~</div>
)
......
......@@ -157,11 +157,13 @@
// }
.version-info {
position: absolute;
height: 74px;
height: 84px;
bottom: 0;
width: 100%;
cursor: pointer;
z-index: -1;
z-index: 10;
padding-top: 10px;
background-color: white;
.row-1 {
width: fit-content;
font-size: 14px;
......
......@@ -64,7 +64,7 @@ function VersionPanel(props: any) {
<div className='widget' style={{ marginBottom: '16px', width: '212px' }}>
<div className='lable'>有效起止日期</div>
<div className='lable-text'>
{versionInfo?.validStartTime}~{versionInfo?.validEndTime}
{versionInfo?.validStartTimeST === versionInfo?.validEndTimeST ? "-" : `${versionInfo?.validStartTime}~${versionInfo?.validEndTime}`}
</div>
</div>
<div className='widget' style={{ marginRight: '26px', marginBottom: '8px', width: '70px' }}>
......
/*
* @Author: yuananting
* @Date: 2021-03-27 16:15:13
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-28 15:44:38
* @LastEditors: yuananting
* @LastEditTime: 2021-07-01 16:44:39
* @Description: 助学工具-新建/复制/编辑试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -22,6 +22,7 @@ import _ from 'underscore';
import { Route, withRouter } from 'react-router-dom';
import * as paperEmpty from '../../lottie/paperEmpty/data.json';
import AddExam from '@/modules/teach-tool/examination-manager/AddExam';
import BatchScore from './components/BatchScore';
const questionTypeEnum = {
SINGLE_CHOICE: '单选题',
......@@ -60,6 +61,7 @@ class OperatePaper extends Component {
selectQuestionModal: null,
paperPreviewModal: null,
quickSortModalVisible: false, // 快捷排序弹窗显隐
batchSetScoreVisible: false, //批量设置题型分数
selectQuestionList: [],
currentOperate: '',
currentNav: '',
......@@ -85,6 +87,38 @@ class OperatePaper extends Component {
typeKey: 'INDEFINITE_CHOICE',
},
],
scoreRule: [
{
typeKey: 'SINGLE_CHOICE',
score: 2,
portionScore: 0,
totalQuestion: 0,
},
{
typeKey: 'MULTI_CHOICE',
score: 2,
portionScore: 0,
totalQuestion: 0,
},
{
typeKey: 'JUDGE',
score: 2,
portionScore: 0,
totalQuestion: 0,
},
{
typeKey: 'GAP_FILLING',
score: 2,
portionScore: 0,
totalQuestion: 0,
},
{
typeKey: 'INDEFINITE_CHOICE',
score: 2,
portionScore: 0,
totalQuestion: 0,
},
],
};
}
......@@ -95,10 +129,10 @@ class OperatePaper extends Component {
this.setState({ currentOperate: 'new', currentNav: '新建试卷' });
break;
case 'edit':
this.setState({ currentOperate: 'edit', currentNav: '编辑试卷' }, () => this.queryPaperDetail());
this.setState({ currentOperate: 'edit', currentNav: '编辑试卷' }, () => this.queryPaperDetail('edit'));
break;
case 'copy':
this.setState({ currentOperate: 'copy', currentNav: '复制试卷' }, () => this.queryPaperDetail());
this.setState({ currentOperate: 'copy', currentNav: '复制试卷' }, () => this.queryPaperDetail('copy'));
break;
}
}
......@@ -122,7 +156,7 @@ class OperatePaper extends Component {
};
// 编辑/复制试卷时获取相应试卷详情
queryPaperDetail = async () => {
queryPaperDetail = async (flag) => {
this.setState({ loading: true });
const { currentOperate } = this.state;
let query = {
......@@ -130,6 +164,7 @@ class OperatePaper extends Component {
source: 0,
userId: User.getStoreUserId(),
tenantId: User.getStoreId(),
flag: flag === 'copy',
};
const res = await AidToolService.queryPaperDetail(query);
const { result } = res;
......@@ -190,6 +225,29 @@ class OperatePaper extends Component {
}, 0);
const passScore = Math.round(totalScore * formData.passRate * 0.01);
let _scorerule = _.map(this.state.scoreRule, (item) => {
switch (item.typeKey) {
case 'SINGLE_CHOICE':
item.totalQuestion = singleQuestion.length;
break;
case 'MULTI_CHOICE':
item.totalQuestion = multiQuestion.length;
break;
case 'JUDGE':
item.totalQuestion = judgeQuestion.length;
break;
case 'GAP_FILLING':
item.totalQuestion = gapQuestion.length;
break;
case 'INDEFINITE_CHOICE':
item.totalQuestion = indefiniteQuestion.length;
break;
default:
item.totalQuestion = 0;
break;
}
return item;
});
this.setState({
formData: {
...formData,
......@@ -207,6 +265,7 @@ class OperatePaper extends Component {
questionCnt: _selectQuestionList.length,
totalScore,
},
scoreRule: _scorerule,
});
};
......@@ -217,9 +276,11 @@ class OperatePaper extends Component {
<SelectQuestionModal
getSelectedQuestion={selectQuestionList}
setSelectedQuestion={(list) => {
//按分数规则给每一题重新设置分数(只对新增题目有效)
let _list = this.setScoreByRule(list);
this.setState({ selectQuestionModal: null }, () => {
this.setFormData(list);
this.quickSorter(list, sorterMethod, sorterBy);
this.setFormData(_list);
this.quickSorter(_list, sorterMethod, sorterBy);
});
}}
close={() => {
......@@ -232,6 +293,25 @@ class OperatePaper extends Component {
this.setState({ selectQuestionModal: m });
};
setScoreByRule = (list) => {
//按批量设置分数规则给每一题重新设置分数(只对新增题目有效)
return _.map(list, (item) => {
let exist = _.find(this.state.selectQuestionList, (q) => {
return q.questionId === item.questionId;
});
if (exist) {
return item;
}
let rule = _.find(this.state.scoreRule, (g) => {
return g.typeKey === item.questionType;
});
if (rule) {
item.score = rule.score;
item.portionScore = rule.portionScore;
}
return item;
});
};
// 移动已选题目
handleMoveItem = (index, moveLength) => {
const selectQuestionList = [...this.state.selectQuestionList];
......@@ -505,6 +585,7 @@ class OperatePaper extends Component {
max={100}
value={record.score || 2}
onChange={(value) => {
value = Math.round(value);
const _selectQuestionList = [...selectQuestionList];
this.setState(
{
......@@ -531,6 +612,7 @@ class OperatePaper extends Component {
max={record.score - 1}
value={record.portionScore || 0}
onChange={(value) => {
value = Math.round(value);
const _selectQuestionList = [...selectQuestionList];
this.setState(
{
......@@ -586,6 +668,72 @@ class OperatePaper extends Component {
return columns;
};
//
onBatchScoreOK = (rules) => {
this.setState(
{
batchSetScoreVisible: false,
scoreRule: rules,
},
() => {
let questionList = _.map(this.state.selectQuestionList, (item) => {
let rule = _.find(this.state.scoreRule, (s) => {
return s.typeKey === item.questionType;
});
if (rule) {
item.score = rule.score;
item.portionScore = rule.portionScore;
}
return item;
});
// 各类型题目总分值
const { formData, scoreRule } = this.state;
const { singleChoiceCnt, multiChoiceCnt, judgeCnt, gapFillingCnt, indefiniteChoiceCnt } = formData;
const singleChoiceScore =
singleChoiceCnt *
scoreRule.find((item) => {
return item.typeKey === 'SINGLE_CHOICE';
}).score;
const multiChoiceScore =
multiChoiceCnt *
scoreRule.find((item) => {
return item.typeKey === 'MULTI_CHOICE';
}).score;
const judgeScore =
judgeCnt *
scoreRule.find((item) => {
return item.typeKey === 'JUDGE';
}).score;
const gapFillingScore =
gapFillingCnt *
scoreRule.find((item) => {
return item.typeKey === 'GAP_FILLING';
}).score;
const indefiniteChoiceScore =
indefiniteChoiceCnt *
scoreRule.find((item) => {
return item.typeKey === 'INDEFINITE_CHOICE';
}).score;
const totalScore = questionList.reduce((prev, cur) => {
return prev + Number(cur.score) || 0;
}, 0);
const passScore = Math.round(totalScore * formData.passRate * 0.01);
this.setState({
selectQuestionList:questionList,
formData: {
...formData,
singleChoiceScore,
multiChoiceScore,
judgeScore,
gapFillingScore,
indefiniteChoiceScore,
totalScore,
passScore,
}
})
message.success("设置成功")
})
}
// 上下移题型
handleMoveTypeSorter = (index, moveLength) => {
const sorterTypeList = [...this.state.sorterTypeList];
......@@ -723,6 +871,7 @@ class OperatePaper extends Component {
max={100}
value={passRate}
onChange={(value) => {
value = Math.round(value);
this.setState(
{
formData: {
......@@ -756,6 +905,15 @@ class OperatePaper extends Component {
}}>
快捷排序
</Button>
<Button
className='choose-btn'
onClick={() => {
this.setState({
batchSetScoreVisible: true,
});
}}>
批量设置分数
</Button>
</Space>
{questionCnt > 0 && (
<div className='paper-info-tip' style={{ margin: '0 auto 12px' }}>
......@@ -831,6 +989,13 @@ class OperatePaper extends Component {
/>
)}
</Modal>
{/* 批量设置分数规则 */}
<BatchScore
visible={this.state.batchSetScoreVisible}
onOK={this.onBatchScoreOK}
onCancel={() => this.setState({ batchSetScoreVisible: false })}
rules={this.state.scoreRule}
/>
</div>
<Route
path={`${match.url}/exam-operate-page`}
......
.batchscore {
.content {
.item {
display: flex;
width: 612px;
height: 48px;
background: #F7F8F9;
font-size: 14px;
line-height: 48px;
font-weight: 400;
color: #333333;
padding-left: 16px;
.type {
width: 112px;
}
.score {
margin-left: 8px;
margin-right: 29px;
width: 258px;
}
}
.item:not(:last-of-type) {
margin-bottom: 8px;
}
}
}
\ No newline at end of file
import React, { useEffect, useState} from "react";
import { Modal, Button, InputNumber } from 'antd';
import "./BatchScore.less"
import _ from "underscore";
interface Rule {
typeKey: "GAP_FILLING"|"INDEFINITE_CHOICE"| "JUDGE"|"MULTI_CHOICE"|"SINGLE_CHOICE",
score: number,
portionScore: number,
totalQuestion: number,
}
interface BatchScoreProps {
visible:boolean,
rules: Rule[],
onOK: (rules:Rule[]) => void,
onCancel: () => void,
}
export default function BatchScore(props:BatchScoreProps) {
const [rules, setRules] = useState<Rule[]>(_.sortBy(props.rules,"typeKey"))
const [singleCount, setSingleCount] = useState<number[]>([0])
const [multiCount, setMultiCount] = useState<number[]>([0])
const [judgeCount, setJudgeCount] = useState<number[]>([0])
const [gapCount, setgapCount] = useState<number[]>([0])
const [indefiniteCount, setIndefiniteCount] = useState<number[]>([0])
useEffect(()=> {
_.map(props.rules,(item)=> {
//更新分数统计
switch(item.typeKey) {
case "SINGLE_CHOICE":
setSingleCount([item.totalQuestion,item.totalQuestion*item.score])
break;
case "MULTI_CHOICE":
setMultiCount([item.totalQuestion,item.totalQuestion*item.score])
break;
case "JUDGE":
setJudgeCount([item.totalQuestion,item.totalQuestion*item.score])
break;
case "GAP_FILLING":
setgapCount([item.totalQuestion,item.totalQuestion*item.score])
break;
case "INDEFINITE_CHOICE":
setIndefiniteCount([item.totalQuestion,item.totalQuestion*item.score])
break;
default:
break;
}
})
},[props.rules,rules])
if (!props.visible) {
return ("")
}
function onOk() {
props.onOK(rules)
}
function onCancel() {
props.onCancel()
}
const inputNumberStyle = {width:"57px",margin:"0 8px"}
return (
<Modal
className="batchscore"
title="批量设置分数"
onCancel={onCancel}
onOk={onOk}
visible={props.visible}
maskClosable={false}
width={660}
>
<div className="content">
<div className="item">
<span className="type">【单选题】</span>
<span className="score">每题
<InputNumber
min={1}
max={100}
value={rules[4].score}
defaultValue={rules[4].score}
style={inputNumberStyle}
onChange={(v)=> {
v = Math.round(v)
let _rules = [...rules]
rules[4].score = v
setRules(_rules)
}}
/>
</span>
<span className="total"><span style={{color:"#2966FF"}}>{singleCount[0]}</span>题,合计<span style={{color:"#2966FF"}}>{singleCount[1]}</span></span>
</div>
<div className="item">
<span className="type">【多选题】</span>
<span className="score">每题
<InputNumber
min={1}
max={100}
defaultValue={rules[3].score}
value={rules[3].score}
style={inputNumberStyle}
onChange={(v)=> {
v = Math.round(v)
let _r = [...rules]
_r[3].score = v
setRules(_r)
}}
/>
分,漏选得
<InputNumber
min={0}
max={rules[3].score}
defaultValue={rules[3].portionScore}
style={inputNumberStyle}
onChange={(v)=> {
v = Math.round(v)
let _r = [...rules]
_r[3].portionScore = v
setRules(_r)
}}
/>
</span>
<span className="total"><span style={{color:"#2966FF"}}>{multiCount[0]}</span>题,合计<span style={{color:"#2966FF"}}>{multiCount[1]}</span></span>
</div>
<div className="item">
<span className="type">【不定项选择题】</span>
<span className="score">每题
<InputNumber
min={0}
defaultValue={rules[1].score}
value={rules[1].score}
style={inputNumberStyle}
onChange={(v)=> {
v = Math.round(v)
let _r = [...rules]
_r[1].score = v
setRules(_r)
}}
/>
分,漏选得
<InputNumber
min={0}
defaultValue={rules[1].portionScore}
value={rules[1].score}
style={inputNumberStyle}
onChange={(v)=> {
v = Math.round(v)
let _r = [...rules]
_r[1].portionScore = v
setRules(_r)
}}
/></span>
<span className="total"><span style={{color:"#2966FF"}}>{indefiniteCount[0]}</span>题,合计<span style={{color:"#2966FF"}}>{indefiniteCount[1]}</span></span>
</div>
<div className="item">
<span className="type">【判断题】</span>
<span className="score">每题
<InputNumber
min={0}
defaultValue={rules[2].score}
value={rules[2].score}
style={inputNumberStyle}
onChange={(v)=> {
v = Math.round(v)
let _r = [...rules]
_r[2].score = v
setRules(_r)
}}
/>
</span>
<span className="total"><span style={{color:"#2966FF"}}>{judgeCount[0]}</span>题,合计<span style={{color:"#2966FF"}}>{judgeCount[1]}</span></span>
</div>
<div className="item">
<span className="type">【填空题】</span>
<span className="score">每题
<InputNumber
min={0}
defaultValue={rules[0].score}
value={rules[0].score}
style={inputNumberStyle}
onChange={(v)=> {
v = Math.round(v)
let _r = [...rules]
_r[0].score = v
setRules(_r)
}}
/>
分,半对得<InputNumber
min={0}
max={rules[0].score}
defaultValue={rules[0].portionScore}
value={rules[0].portionScore}
style={inputNumberStyle}
onChange={(v)=> {
v = Math.round(v)
let _r = [...rules]
_r[0].portionScore = v
setRules(_r)
}}
/>
</span>
<span className="total"><span style={{color:"#2966FF"}}>{gapCount[0]}</span>题,合计<span style={{color:"#2966FF"}}>{gapCount[1]}</span></span>
</div>
</div>
</Modal>
)
}
\ No newline at end of file
......@@ -16,6 +16,8 @@ export interface VersionInfo {
userNum: number; //限制人数
validEndTime: string;
validStartTime: string;
validEndTimeST: number;
validStartTimeST: number;
whetherReachUserNum: boolean;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment