Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
a240c246
Commit
a240c246
authored
Apr 10, 2021
by
zhujian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'fix'
parent
080683db
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
40 deletions
+49
-40
src/core/function.js
+43
-35
src/modules/teach-tool/examination-manager/AddExam.tsx
+2
-2
src/modules/teach-tool/examination-manager/Index.tsx
+1
-1
src/modules/teach-tool/examination-manager/UserData.tsx
+3
-2
No files found.
src/core/function.js
View file @
a240c246
...
@@ -10,7 +10,7 @@ import React from 'react'
...
@@ -10,7 +10,7 @@ import React from 'react'
// 时间控件优化方法
// 时间控件优化方法
window
.
setCorrectDate
=
date
=>
{
window
.
setCorrectDate
=
date
=>
{
let
_date
=
date
;
let
_date
=
date
;
if
((
date
-
(
+
new
Date
())
<
30
*
60
*
1000
))
{
if
((
date
-
(
+
new
Date
())
<
30
*
60
*
1000
))
{
const
currentMinute
=
new
Date
().
getMinutes
();
const
currentMinute
=
new
Date
().
getMinutes
();
...
@@ -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
),
...
@@ -73,8 +73,8 @@ window.processMonthCourseDate = courseList => {
...
@@ -73,8 +73,8 @@ window.processMonthCourseDate = courseList => {
.
valueOf
())
.
valueOf
())
const
endDate
=
(
course
.
endDate
=
course
.
endDate
const
endDate
=
(
course
.
endDate
=
course
.
endDate
?
moment
(
parseInt
(
course
.
endDate
))
?
moment
(
parseInt
(
course
.
endDate
))
.
endOf
(
'day'
)
.
endOf
(
'day'
)
.
valueOf
()
.
valueOf
()
:
undefined
)
:
undefined
)
if
(
i
==
0
&&
Date
.
now
()
<
startDate
)
{
if
(
i
==
0
&&
Date
.
now
()
<
startDate
)
{
...
@@ -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
)
...
@@ -379,8 +379,8 @@ window.timeFormat = (time, defaultValue) => {
...
@@ -379,8 +379,8 @@ window.timeFormat = (time, defaultValue) => {
const
stringTime
=
time
const
stringTime
=
time
?
(
time
/
CONFIG
.
timeUnit
).
toFixed
(
2
)
?
(
time
/
CONFIG
.
timeUnit
).
toFixed
(
2
)
:
defaultValue
==
undefined
:
defaultValue
==
undefined
?
0
?
0
:
defaultValue
:
defaultValue
return
Number
(
stringTime
)
return
Number
(
stringTime
)
}
}
...
@@ -410,8 +410,8 @@ window.timeFormatSixty = (time, defaultValue) => {
...
@@ -410,8 +410,8 @@ window.timeFormatSixty = (time, defaultValue) => {
const
stringTime
=
time
const
stringTime
=
time
?
(
time
/
60
).
toFixed
(
2
)
?
(
time
/
60
).
toFixed
(
2
)
:
defaultValue
==
undefined
:
defaultValue
==
undefined
?
0
?
0
:
defaultValue
:
defaultValue
return
Number
(
stringTime
)
return
Number
(
stringTime
)
}
}
...
@@ -465,8 +465,8 @@ window.moneyFormat = (money, defaultValue) => {
...
@@ -465,8 +465,8 @@ window.moneyFormat = (money, defaultValue) => {
const
stringMoney
=
money
const
stringMoney
=
money
?
(
Math
.
round
(
money
)
/
CONFIG
.
moneyUnit
).
toFixed
(
2
)
?
(
Math
.
round
(
money
)
/
CONFIG
.
moneyUnit
).
toFixed
(
2
)
:
defaultValue
==
undefined
:
defaultValue
==
undefined
?
0
?
0
:
defaultValue
:
defaultValue
return
Number
(
stringMoney
)
return
Number
(
stringMoney
)
}
}
...
@@ -487,9 +487,9 @@ window.moneyFormatThousands = (number, places, symbol, thousand, decimal) => {
...
@@ -487,9 +487,9 @@ window.moneyFormatThousands = (number, places, symbol, thousand, decimal) => {
i
.
substr
(
j
).
replace
(
/
(\d{3})(?=\d)
/g
,
'$1'
+
thousand
)
+
i
.
substr
(
j
).
replace
(
/
(\d{3})(?=\d)
/g
,
'$1'
+
thousand
)
+
(
places
(
places
?
decimal
+
?
decimal
+
Math
.
abs
(
number
-
i
)
Math
.
abs
(
number
-
i
)
.
toFixed
(
places
)
.
toFixed
(
places
)
.
slice
(
2
)
.
slice
(
2
)
:
''
)
:
''
)
)
)
}
}
...
@@ -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
)}
`
}
/*
/*
获取日期相差多少天
获取日期相差多少天
* */
* */
...
@@ -666,7 +674,7 @@ window.getLeftExpiredDay = (expiredDate, minWarningDays, onlyShowTimeover) => {
...
@@ -666,7 +674,7 @@ window.getLeftExpiredDay = (expiredDate, minWarningDays, onlyShowTimeover) => {
}
}
// 处理月份
// 处理月份
window
.
handleMonth
=
(
num
)
=>
{
window
.
handleMonth
=
(
num
)
=>
{
var
result
=
''
var
result
=
''
if
(
num
<
12
)
{
if
(
num
<
12
)
{
result
=
`
${
num
}
个月`
result
=
`
${
num
}
个月`
...
@@ -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,20 +889,20 @@ window.convertBase64ToBlob = function(base64) {
...
@@ -881,20 +889,20 @@ 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
))
:
moment
().
dayOfYear
()
-
1
>
moment
(
parseInt
(
createTime
)).
dayOfYear
()
:
moment
().
dayOfYear
()
-
1
>
moment
(
parseInt
(
createTime
)).
dayOfYear
()
?
formatDate
(
'MM-DD H:i'
,
parseInt
(
createTime
))
?
formatDate
(
'MM-DD H:i'
,
parseInt
(
createTime
))
:
moment
().
dayOfYear
()
-
1
==
moment
(
parseInt
(
createTime
)).
dayOfYear
()
:
moment
().
dayOfYear
()
-
1
==
moment
(
parseInt
(
createTime
)).
dayOfYear
()
?
'昨天 '
+
formatDate
(
'H:i'
,
parseInt
(
createTime
))
?
'昨天 '
+
formatDate
(
'H:i'
,
parseInt
(
createTime
))
:
Math
.
floor
((
moment
().
valueOf
()
-
parseInt
(
createTime
))
/
1000
/
60
)
>
60
:
Math
.
floor
((
moment
().
valueOf
()
-
parseInt
(
createTime
))
/
1000
/
60
)
>
60
?
'今天'
+
formatDate
(
'H:i'
,
parseInt
(
createTime
))
?
'今天'
+
formatDate
(
'H:i'
,
parseInt
(
createTime
))
:
Math
.
floor
((
moment
().
valueOf
()
-
parseInt
(
createTime
))
/
1000
/
60
)
>
1
:
Math
.
floor
((
moment
().
valueOf
()
-
parseInt
(
createTime
))
/
1000
/
60
)
>
1
?
Math
.
floor
((
moment
().
valueOf
()
-
parseInt
(
createTime
))
/
1000
/
60
)
+
?
Math
.
floor
((
moment
().
valueOf
()
-
parseInt
(
createTime
))
/
1000
/
60
)
+
'分钟前'
'分钟前'
:
'刚刚'
:
'刚刚'
return
newTime
return
newTime
}
}
...
@@ -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
=
''
...
@@ -1121,7 +1129,7 @@ window.renderCourseName = (list) => {
...
@@ -1121,7 +1129,7 @@ window.renderCourseName = (list) => {
}
}
<
/div
>
<
/div
>
)
)
return
length
>
1
?
return
length
>
1
?
<
span
>
{
majorCourse
.
name
}
<
span
>
{
majorCourse
.
name
}
<
Popover
placement
=
"bottomLeft"
content
=
{
content
}
arrowPointAtCenter
>
<
Popover
placement
=
"bottomLeft"
content
=
{
content
}
arrowPointAtCenter
>
...
@@ -1130,7 +1138,7 @@ window.renderCourseName = (list) => {
...
@@ -1130,7 +1138,7 @@ window.renderCourseName = (list) => {
<
/span>
:
<
/span>
:
<
span
>
{
majorCourse
.
name
}
<
/span
>
<
span
>
{
majorCourse
.
name
}
<
/span
>
}
}
return
''
return
''
}
}
...
@@ -1145,13 +1153,13 @@ window.convertBase64UrlToBlob = (urlData) => {
...
@@ -1145,13 +1153,13 @@ 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
''
;
}
}
// 用户点击相应区域后不显示
// 用户点击相应区域后不显示
if
(
localStorage
.
getItem
(
itemName
)
===
'true'
)
{
if
(
localStorage
.
getItem
(
itemName
)
===
'true'
)
{
return
''
;
return
''
;
}
}
return
'new-icon'
return
'new-icon'
...
...
src/modules/teach-tool/examination-manager/AddExam.tsx
View file @
a240c246
...
@@ -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
(),
...
...
src/modules/teach-tool/examination-manager/Index.tsx
View file @
a240c246
...
@@ -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
/
100
0
}
分钟
</
span
>,
},
},
{
{
title
:
"及格分/总分"
,
title
:
"及格分/总分"
,
...
...
src/modules/teach-tool/examination-manager/UserData.tsx
View file @
a240c246
...
@@ -7,6 +7,7 @@ import moment from 'moment';
...
@@ -7,6 +7,7 @@ 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
...
@@ -147,7 +148,7 @@ function DataAnalysic(props: any) {
...
@@ -147,7 +148,7 @@ function DataAnalysic(props: any) {
dataIndex
:
"examDuration"
,
dataIndex
:
"examDuration"
,
sorter
:
true
,
sorter
:
true
,
sortOrder
:
field
===
"examDuration"
?
order
:
sortStatus
.
type
,
sortOrder
:
field
===
"examDuration"
?
order
:
sortStatus
.
type
,
render
:
(
text
:
any
)
=>
<
span
>
{
moment
(
text
).
format
(
"HH:mm:ss"
)
}
</
span
>,
render
:
(
text
:
any
)
=>
<
span
>
{
window
.
formatHourTime
(
text
)
}
</
span
>,
},
},
...
@@ -210,7 +211,7 @@ function DataAnalysic(props: any) {
...
@@ -210,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"
>
{
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
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment