Commit 6f43031a by yuananting

fix:试卷考试名称40字限制

parent 9ba1d8c7
......@@ -13,6 +13,7 @@
.form{
margin-top: 12px;
width: 1000px;
overflow-y: scroll;
.title{
font-size: 16px;
font-family: PingFangSC-Medium, PingFang SC;
......
......@@ -130,6 +130,11 @@ function AddExam(props: any) {
return
}
if (param.examName && param.examName.length > 40) {
message.warning('考试名称最多40字');
return
}
if (!paperId) {
message.warning('请选择试卷');
return
......@@ -273,8 +278,8 @@ function AddExam(props: any) {
layout="horizontal"
>
<Form.Item label="考试名称"
validateStatus={(check && !examName) ? 'error' : ''}
help={check && !examName && '请选择课程'}
validateStatus={(check && (!examName ? '请输入考试名称' : (examName.length > 40) && '考试名称最多40字')) ? 'error' : ''}
help={check && (!examName ? '请输入考试名称' : (examName.length > 40) && '考试名称最多40字')}
required>
<Input placeholder='请输入考试名称(40字以内)' maxLength={40} value={examName} onChange={(e) => {
......
......@@ -33,7 +33,7 @@ function PreviewModal(props: any) {
<div className="phone">
<div className="content">
<div className="topContent">
<div className="title" style={{ fontSize: props.info.examName.length > 24 ? 13 : 22 ,marginTop: 20}}>{props.info.examName || ' '}</div>
<div className="title" style={{ fontSize: props.info.examName.length > 24 ? 13 : 22 ,marginTop: 20 }}>{(props.info.examName.length > 40 ? props.info.examName.substring(0, 40) : props.info.examName) || ' '}</div>
{
props.info.examStartTime && <div className="time">{moment(props.info.examStartTime).format("YYYY-MM-DD HH:mm")}~{moment(props.info.examEndTime).format("YYYY-MM-DD HH:mm")}</div>
}
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-27 16:15:13
* @LastEditors: yuananting
* @LastEditTime: 2021-06-01 11:31:41
* @LastEditTime: 2021-06-01 17:07:30
* @Description: 助学工具-新建/复制/编辑试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -325,6 +325,10 @@ class OperatePaper extends Component {
if (this.checkExist(paperName)) {
return "该试卷名称已存在";
}
if (paperName && paperName.length > 40) {
return "试卷名称最多40字";
}
};
// 保存试卷
......@@ -337,7 +341,8 @@ class OperatePaper extends Component {
if (
!formData.passRate ||
!formData.paperName ||
this.checkExist(formData.paperName)
this.checkExist(formData.paperName) ||
(formData.paperName && formData.paperName.length > 40)
) {
return;
}
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-27 11:15:03
* @LastEditors: yuananting
* @LastEditTime: 2021-04-15 13:22:10
* @LastEditTime: 2021-06-01 17:28:21
* @Description: 助学工具-试卷-预览试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -284,7 +284,7 @@ class PreviewPaperModal extends Component {
footer={null}
onCancel={this.props.close}
>
{paperName && <div className="paper-title">{paperName}</div>}
{paperName && <div className="paper-title">{paperName.length > 40 ? paperName.substring(0, 40) : paperName}</div>}
{questionList && questionList.length > 0 ? (
<div className="question-list-box">
{_.map(questionList, (questionItem, questionIndex) => {
......
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