Commit 1e9b34d8 by yuananting

Merge branch 'feature/yuananting/20210327/test-paper' of…

Merge branch 'feature/yuananting/20210327/test-paper' of https://xmgit.ixm5.cn/xiaomai-cloud-class/xiaomai-cloud-class-web into feature/yuananting/20210327/test-paper
parents 4a65aacb 1f9a932d
...@@ -33,7 +33,7 @@ if (!Number.prototype.toFixedCorrect) { ...@@ -33,7 +33,7 @@ if (!Number.prototype.toFixedCorrect) {
window.processMonthCourseDate = courseList => { window.processMonthCourseDate = courseList => {
if (Array.isArray(courseList) && courseList.length > 0) { if (Array.isArray(courseList) && courseList.length > 0) {
// 因为所购买的时间不可能有重叠,先排序 // 因为所购买的时间不可能有重叠,先排序
courseList = courseList.sort(function(now, next) { courseList = courseList.sort(function (now, next) {
return parseInt(now.startDate) - parseInt(next.startDate) return parseInt(now.startDate) - parseInt(next.startDate)
}) })
...@@ -41,7 +41,7 @@ window.processMonthCourseDate = courseList => { ...@@ -41,7 +41,7 @@ window.processMonthCourseDate = courseList => {
let sumDays = 0, let sumDays = 0,
finishDays = 0, finishDays = 0,
givingDays = 0 givingDays = 0
courseList.forEach(function(item) { courseList.forEach(function (item) {
if (item.endDate != item.purchaseEndDate) { if (item.endDate != item.purchaseEndDate) {
givingDays += moment(parseInt(item.endDate)).diff( givingDays += moment(parseInt(item.endDate)).diff(
parseInt(item.purchaseEndDate), parseInt(item.purchaseEndDate),
...@@ -327,7 +327,7 @@ window.getRequest = () => { ...@@ -327,7 +327,7 @@ window.getRequest = () => {
return theRequest return theRequest
} }
window.getParameterByName = function(name) { window.getParameterByName = function (name) {
name = name.replace(/[\\[]/, '\\[').replace(/[\]]/, '\\]') name = name.replace(/[\\[]/, '\\[').replace(/[\]]/, '\\]')
const regex = new RegExp('[\\?&]' + name + '=([^&#]*)') const regex = new RegExp('[\\?&]' + name + '=([^&#]*)')
const results = regex.exec(window.location.href) const results = regex.exec(window.location.href)
...@@ -344,7 +344,7 @@ window.getUrlParam = function () { ...@@ -344,7 +344,7 @@ window.getUrlParam = function () {
return isNaN(param) ? '' : str; return isNaN(param) ? '' : str;
} }
window.getStringParamete = function(string, name) { window.getStringParamete = function (string, name) {
const theRequest = {} const theRequest = {}
if (string.indexOf('?') != -1) { if (string.indexOf('?') != -1) {
const str = string.substr(1) const str = string.substr(1)
...@@ -530,6 +530,14 @@ window.getMonthLastDate = timestamp => { ...@@ -530,6 +530,14 @@ window.getMonthLastDate = timestamp => {
return time return time
} }
window.formatHourTime = (timestr) => {
const h = Math.floor(timestr / 1000 / 60 / 60);
const m = Math.floor((timestr - h * 1000 * 60 * 60) / 1000 / 60);
const s = Math.floor((timestr - h * 1000 * 60 * 60 - m * 1000 * 60) / 1000);
return `${h > 9 ? h : ('0' + h)}:${m > 9 ? m : ('0' + m)}:${s > 9 ? s : ('0' + s)}`
}
/* /*
获取日期相差多少天 获取日期相差多少天
* */ * */
...@@ -832,7 +840,7 @@ window.getNumberInput = (str, ret = 1) => { ...@@ -832,7 +840,7 @@ window.getNumberInput = (str, ret = 1) => {
return str * ret return str * ret
} }
window.removeNull = function(param) { window.removeNull = function (param) {
if (!param) { if (!param) {
return return
} }
...@@ -853,7 +861,7 @@ window.removeNull = function(param) { ...@@ -853,7 +861,7 @@ window.removeNull = function(param) {
} }
} }
window.convertBase64ToBlob = function(base64) { window.convertBase64ToBlob = function (base64) {
var base64Arr = base64.split(',') var base64Arr = base64.split(',')
var imgtype = '' var imgtype = ''
var base64String = '' var base64String = ''
...@@ -881,7 +889,7 @@ window.convertBase64ToBlob = function(base64) { ...@@ -881,7 +889,7 @@ window.convertBase64ToBlob = function(base64) {
return new Blob([bytesCode], { type: imgtype }) return new Blob([bytesCode], { type: imgtype })
} }
window.formatMsgCreateTime = function(createTime) { window.formatMsgCreateTime = function (createTime) {
const newTime = const newTime =
moment().year() > moment(parseInt(createTime)).year() moment().year() > moment(parseInt(createTime)).year()
? formatDate('YYYY-MM-DD H:i', parseInt(createTime)) ? formatDate('YYYY-MM-DD H:i', parseInt(createTime))
...@@ -1070,7 +1078,7 @@ window.getMoneyFormatYuan = (price) => { ...@@ -1070,7 +1078,7 @@ window.getMoneyFormatYuan = (price) => {
// 处理定价标准 仅订单详情,打印收据预览可用 // 处理定价标准 仅订单详情,打印收据预览可用
window.formatPriceStandard = (info) => { window.formatPriceStandard = (info) => {
let { quantityUnit, specName, commoditySpecs, purchaseItemType, unitPriceAfterDiscount,specCurrentPrice } = info let { quantityUnit, specName, commoditySpecs, purchaseItemType, unitPriceAfterDiscount, specCurrentPrice } = info
let newCommoditySpecs = JSON.parse(commoditySpecs || '[]') || {} let newCommoditySpecs = JSON.parse(commoditySpecs || '[]') || {}
let { containQuantity, unitPrice, measurementUnits } = newCommoditySpecs let { containQuantity, unitPrice, measurementUnits } = newCommoditySpecs
let content = '' let content = ''
...@@ -1145,9 +1153,9 @@ window.convertBase64UrlToBlob = (urlData) => { ...@@ -1145,9 +1153,9 @@ window.convertBase64UrlToBlob = (urlData) => {
} }
// 小麦秀 new 标签显示 // 小麦秀 new 标签显示
window.XMShowClassName = (date,itemName) => { window.XMShowClassName = (date, itemName) => {
// 超过时间不显示 // 超过时间不显示
if (new Date().getTime() > date ) { if (new Date().getTime() > date) {
return ''; return '';
} }
// 用户点击相应区域后不显示 // 用户点击相应区域后不显示
......
...@@ -82,7 +82,7 @@ function AddExam(props: any) { ...@@ -82,7 +82,7 @@ function AddExam(props: any) {
setPassRate(result.passRate * 100) setPassRate(result.passRate * 100)
setNeedPhone(result.needPhone) setNeedPhone(result.needPhone)
setExamDesc(result.examDesc) setExamDesc(result.examDesc)
setExamDuration(result.examDuration) setExamDuration(result.examDuration / 60 / 1000 as any)
setAnswerAnalysis(result.answerAnalysis) setAnswerAnalysis(result.answerAnalysis)
setNeedOptionDisorder(result.needOptionDisorder) setNeedOptionDisorder(result.needOptionDisorder)
setPassScore(result.passScore) setPassScore(result.passScore)
...@@ -113,7 +113,7 @@ function AddExam(props: any) { ...@@ -113,7 +113,7 @@ function AddExam(props: any) {
resultContent, resultContent,
answerAnalysis, answerAnalysis,
resultShow, resultShow,
examDuration, examDuration: (examDuration || 0) * 60 * 1000,
passScore, passScore,
tenantId: User.getStoreId(), tenantId: User.getStoreId(),
userId: User.getStoreUserId(), userId: User.getStoreUserId(),
......
...@@ -36,7 +36,7 @@ function ExamData(props: any) { ...@@ -36,7 +36,7 @@ function ExamData(props: any) {
}; };
const userTypeEnum = { const userTypeEnum = {
WE_COM: '企业微信', WORK_WE_CHAT: '企业微信',
WE_CHAT: '微信' WE_CHAT: '微信'
} }
...@@ -176,7 +176,8 @@ function ExamData(props: any) { ...@@ -176,7 +176,8 @@ function ExamData(props: any) {
console.log(filters.questionType) console.log(filters.questionType)
if (filters.questionType) { if (filters.questionType) {
console.log(233232) console.log(233232)
_query.questionType = filters.questionType _query.questionType = filters.questionType;
_query.currrent =1;
} else { } else {
delete _query.questionType delete _query.questionType
} }
......
...@@ -87,7 +87,7 @@ function ExaminationManager(props: any) { ...@@ -87,7 +87,7 @@ function ExaminationManager(props: any) {
{ {
title: "考试时长", title: "考试时长",
dataIndex: "examDuration", dataIndex: "examDuration",
render: (text: any) => <span>{text || 0}分钟</span>, render: (text: any) => <span>{(text || 0)/60/1000}分钟</span>,
}, },
{ {
title: "及格分/总分", title: "及格分/总分",
......
...@@ -2,12 +2,12 @@ import React, { useState, useRef, useEffect } from 'react' ...@@ -2,12 +2,12 @@ import React, { useState, useRef, useEffect } from 'react'
import Service from "@/common/js/service"; import Service from "@/common/js/service";
import { PageControl } from "@/components"; import { PageControl } from "@/components";
import { Input, Select, Tooltip, Table, Button } from 'antd'; import { Input, Select, Tooltip, Table, Button } from 'antd';
import dealTimeDuration from "../utils/dealTimeDuration";
import User from "@/common/js/user"; import User from "@/common/js/user";
import moment from 'moment'; import moment from 'moment';
import './userData.less' import './userData.less'
const { Search } = Input; const { Search } = Input;
const { Option } = Select; const { Option } = Select;
declare var window: any;
interface sortType { interface sortType {
type: "ascend" | "descend" | null | undefined type: "ascend" | "descend" | null | undefined
...@@ -30,7 +30,7 @@ function DataAnalysic(props: any) { ...@@ -30,7 +30,7 @@ function DataAnalysic(props: any) {
const [order, setOrder] = useState(sortStatus.type); const [order, setOrder] = useState(sortStatus.type);
const userTypeEnum = { const userTypeEnum = {
WE_COM: '企业微信', WORK_WE_CHAT: '企业微信',
WE_CHAT: '微信' WE_CHAT: '微信'
} }
...@@ -64,8 +64,8 @@ function DataAnalysic(props: any) { ...@@ -64,8 +64,8 @@ function DataAnalysic(props: any) {
descend: 'ACCURACY_DESC' descend: 'ACCURACY_DESC'
}, },
userDuration: { userDuration: {
ascend: 'PASS_CNT_ASC', ascend: 'USER_DURATION_ASC',
descend: 'CREATED_DESC' descend: 'USER_DURATION_DESC'
}, },
} }
...@@ -117,7 +117,7 @@ function DataAnalysic(props: any) { ...@@ -117,7 +117,7 @@ function DataAnalysic(props: any) {
{ {
title: "用户", title: "用户",
dataIndex: "userName", dataIndex: "userName",
render: (text: any, record: any) => <span>{text}<span style={{ color: record.userSource === 'WE_COM' ? 'rgba(255, 157, 20, 1)' : 'rgba(29, 204, 101, 1)' }} >@{(userTypeEnum as any)[record.userSource]}</span></span>, render: (text: any, record: any) => <span>{text}<span style={{ color: record.userSource === 'WORK_WE_CHAT' ? 'rgba(255, 157, 20, 1)' : 'rgba(29, 204, 101, 1)' }} >@{(userTypeEnum as any)[record.userSource]}</span></span>,
}, },
{ {
title: "手机号", title: "手机号",
...@@ -148,7 +148,7 @@ function DataAnalysic(props: any) { ...@@ -148,7 +148,7 @@ function DataAnalysic(props: any) {
dataIndex: "userDuration", dataIndex: "userDuration",
sorter: true, sorter: true,
sortOrder: field === "userDuration" ? order : sortStatus.type, sortOrder: field === "userDuration" ? order : sortStatus.type,
render: (text: any) => <span>{dealTimeDuration(Number(text))}</span>, render: (text: any) => <span>{window.formatHourTime(text)} </span>,
}, },
...@@ -211,7 +211,7 @@ function DataAnalysic(props: any) { ...@@ -211,7 +211,7 @@ function DataAnalysic(props: any) {
<div className="subTitle">平均分</div> <div className="subTitle">平均分</div>
</div> </div>
<div className="item"> <div className="item">
<div className="num">{dealTimeDuration(useData.averageDuration || 0)}</div> <div className="num"> {window.formatHourTime(useData.averageDuration || 0)} </div>
<div className="percent"></div> <div className="percent"></div>
<div className="subTitle">平均用时</div> <div className="subTitle">平均用时</div>
</div> </div>
......
/*
* @Author: 吴文洁
* @Date: 2020-08-20 14:51:18
* @LastEditors: yuananting
* @LastEditTime: 2021-04-10 15:29:16
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
const dealTimeDuration = (msTime) => {
let time = msTime / 1000;
let hour =
Math.floor(time / 60 / 60) % 24 > 9
? Math.floor(time / 60 / 60) % 24
: "0" + (Math.floor(time / 60 / 60) % 24);
let minute =
Math.floor(time / 60) % 60 > 9
? Math.floor(time / 60) % 60
: "0" + (Math.floor(time / 60) % 60);
let second =
time % 60 > 9 ? Math.round(time % 60) : "0" + Math.round(time % 60);
return `${hour}:${minute}:${second}`;
}
export default dealTimeDuration;
\ No newline at end of file
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