Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cs_vsofpm
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuhao
cs_vsofpm
Commits
69eb3fb3
Commit
69eb3fb3
authored
May 24, 2023
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export
parent
c22e9350
Pipeline
#3440
passed with stages
in 3 minutes and 29 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
75 deletions
+117
-75
index.jsx
src/pages/checkhomework/index.jsx
+48
-30
index.jsx
src/pages/record/index.jsx
+25
-5
request.js
src/utils/request.js
+44
-40
No files found.
src/pages/checkhomework/index.jsx
View file @
69eb3fb3
import
AutoTable
from
"@/components/AutoTable"
;
import
DraggableDialog
from
"@/components/DraggableDialog"
;
import
ImportExcel
from
"@/components/ImportExcel"
;
import
InitForm
from
"@/components/InitForm"
;
import
PremButton
from
"@/components/PremButton"
;
import
SplitDesc
from
"@/components/SplitDesc"
;
...
...
@@ -14,7 +13,9 @@ import "./index.less";
function
Checkhomework
()
{
const
actionRef
=
useRef
(),
actionRefs
=
useRef
();
formRef
=
useRef
(),
actionRefs
=
useRef
(),
formRefs
=
useRef
();
const
[
dialogprops
,
setdialogprops
]
=
useState
({
open
:
false
,
});
...
...
@@ -64,7 +65,7 @@ function Checkhomework() {
btn=
{
{
size
:
"small"
,
variant
:
"text"
,
color
:
"inherit"
,
color
:
"inherit"
,
onClick
:
()
=>
{
setdialogprops
({
open
:
true
,
...
...
@@ -90,7 +91,12 @@ function Checkhomework() {
{
title
:
"实验名称"
,
dataIndex
:
"experimentName"
,
key
:
"experimentName"
},
{
title
:
"分数"
,
dataIndex
:
"score"
,
key
:
"score"
,
hideInSearch
:
true
},
{
title
:
"权重"
,
dataIndex
:
"weight"
,
key
:
"weight"
,
hideInSearch
:
true
},
{
title
:
"分数(权重)"
,
dataIndex
:
"scoreWeight"
,
key
:
"scoreWeight"
,
hideInSearch
:
true
},
{
title
:
"分数(权重)"
,
dataIndex
:
"scoreWeight"
,
key
:
"scoreWeight"
,
hideInSearch
:
true
,
},
{
title
:
"提交时间"
,
dataIndex
:
"finishTime"
,
...
...
@@ -148,7 +154,12 @@ function Checkhomework() {
{
title
:
"实验名称"
,
dataIndex
:
"experimentName"
,
key
:
"experimentName"
},
{
title
:
"分数"
,
dataIndex
:
"score"
,
key
:
"score"
,
hideInSearch
:
true
},
{
title
:
"权重"
,
dataIndex
:
"weight"
,
key
:
"weight"
,
hideInSearch
:
true
},
{
title
:
"分数(权重)"
,
dataIndex
:
"scoreWeight"
,
key
:
"scoreWeight"
,
hideInSearch
:
true
},
{
title
:
"分数(权重)"
,
dataIndex
:
"scoreWeight"
,
key
:
"scoreWeight"
,
hideInSearch
:
true
,
},
{
title
:
"提交时间"
,
dataIndex
:
"finishTime"
,
...
...
@@ -183,6 +194,7 @@ function Checkhomework() {
<
Box
boxShadow=
{
"0 0 18px #f0f0f0"
}
borderRadius=
{
2
}
>
<
AutoTable
actionRef=
{
actionRefs
}
formRef=
{
formRefs
}
scroll=
{
{
x
:
1366
}
}
columns=
{
[
...
columes
,
...
...
@@ -207,6 +219,7 @@ function Checkhomework() {
<
Box
boxShadow=
{
"0 0 18px #f0f0f0"
}
borderRadius=
{
2
}
>
<
AutoTable
actionRef=
{
actionRef
}
formRef=
{
formRef
}
scroll=
{
{
x
:
1366
}
}
columns=
{
[...
columns
]
}
extraparams=
{
{
type
:
"1"
}
}
...
...
@@ -283,9 +296,9 @@ function Checkhomework() {
},
[
{
title
:
"实验时长"
,
dataIndex
:
"useTime"
,
key
:
"useTime"
title
:
"实验时长"
,
dataIndex
:
"useTime"
,
key
:
"useTime"
,
},
{
title
:
"批阅状态"
,
...
...
@@ -345,28 +358,33 @@ function Checkhomework() {
mt=
{
0
}
>
<
Typography
variant=
"h5"
>
作业批阅
</
Typography
>
{
active
===
"1"
?
(
<
Stack
spacing=
{
2
}
direction=
"row"
>
<
ImportExcel
></
ImportExcel
>
<
PremButton
btn=
{
{
variant
:
"contained"
,
onClick
:
(
e
)
=>
{
e
.
stopPropagation
();
setdialogprops
({
open
:
true
,
defaultFormValue
:
{},
title
:
"新增学生"
,
});
},
}
}
>
新增学生
</
PremButton
>
</
Stack
>
)
:
(
<
Box
height=
{
36
}
/>
)
}
<
Stack
spacing=
{
2
}
direction=
"row"
>
<
PremButton
btn=
{
{
variant
:
"contained"
,
onClick
:
async
(
e
)
=>
{
e
.
stopPropagation
();
if
(
active
===
"1"
){
let
formval
=
formRef
?.
current
.
getFieldsValue
()
const
params
=
{
...
formval
,
type
:
active
}
await
doFetch
({
url
:
"/studentExperiment/exportByLoginTeacher"
,
params
});
}
else
{
let
formval
=
formRefs
?.
current
.
getFieldsValue
();
const
params
=
{
...
formval
,
type
:
active
}
await
doFetch
({
url
:
"/studentExperiment/exportByLoginTeacher"
,
params
});
}
},
}
}
>
导出
</
PremButton
>
</
Stack
>
</
Box
>
<
Tabs
...
...
src/pages/record/index.jsx
View file @
69eb3fb3
import
AutoTable
from
"@/components/AutoTable"
;
import
ImportExcel
from
"@/components/ImportExcel
"
;
import
PremButton
from
"@/components/PremButton
"
;
import
{
doFetch
}
from
"@/utils/doFetch"
;
import
{
Box
,
Container
,
Stack
,
Typography
}
from
"@mui/material"
;
import
{
useRequest
}
from
"ahooks"
;
...
...
@@ -11,7 +11,8 @@ import "./index.less";
const
formatter
=
(
value
)
=>
<
CountUp
end=
{
value
}
separator=
","
decimals=
{
2
}
/>;
function
Record
()
{
const
actionRef
=
useRef
();
const
actionRef
=
useRef
(),
formRef
=
useRef
();
const
[
params
,
setparams
]
=
useState
({});
const
{
runAsync
,
data
,
loading
}
=
useRequest
(
...
...
@@ -124,20 +125,39 @@ function Record() {
</Box>
</Box>
<Stack spacing={2} direction="row">
<ImportExcel></ImportExcel>
<PremButton
btn={{
variant: "contained",
onClick: async (e) => {
e.stopPropagation();
let formval = formRef?.current.getFieldsValue();
const param = {
...formval,
...params,
};
await doFetch({
url: "/studentExperiment/scoreReportExport",
params: param,
});
},
}}
>
导出
</PremButton>
</Stack>
</Box>
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}>
<AutoTable
actionRef={actionRef}
formRef={formRef}
scroll={{ x: 1366 }}
columns={[...columns]}
dataSource={data?.list ?? []}
onValuesChange={(changedValues, values) => {
setparams(
s=>
({
setparams(
(s) =>
({
...values,
trainId:
s.trainId
trainId:
s.trainId,
}));
}}
></AutoTable>
...
...
src/utils/request.js
View file @
69eb3fb3
...
...
@@ -3,26 +3,26 @@
* request 网络请求工具
* 更详细的 api 文档: https://github.com/umijs/umi-request
*/
import
{
history
}
from
'@umijs/max'
;
import
{
message
}
from
'antd'
;
import
{
extend
}
from
'umi-request'
;
import
{
history
}
from
"@umijs/max"
;
import
{
message
}
from
"antd"
;
import
{
extend
}
from
"umi-request"
;
const
codeMessage
=
{
200
:
'服务器成功返回请求的数据。'
,
201
:
'新建或修改数据成功。'
,
202
:
'一个请求已经进入后台排队(异步任务)。'
,
204
:
'删除数据成功。'
,
400
:
'发出的请求有错误,服务器没有进行新建或修改数据的操作。'
,
401
:
'用户没有权限(令牌、用户名、密码错误)。'
,
403
:
'用户得到授权,但是访问是被禁止的。'
,
404
:
'发出的请求针对的是不存在的记录,服务器没有进行操作。'
,
406
:
'请求的格式不可得。'
,
410
:
'请求的资源被永久删除,且不会再得到的。'
,
422
:
'当创建一个对象时,发生一个验证错误。'
,
500
:
'服务器发生错误,请检查服务器。'
,
502
:
'网关错误。'
,
503
:
'服务不可用,服务器暂时过载或维护。'
,
504
:
'网关超时。'
,
200
:
"服务器成功返回请求的数据。"
,
201
:
"新建或修改数据成功。"
,
202
:
"一个请求已经进入后台排队(异步任务)。"
,
204
:
"删除数据成功。"
,
400
:
"发出的请求有错误,服务器没有进行新建或修改数据的操作。"
,
401
:
"用户没有权限(令牌、用户名、密码错误)。"
,
403
:
"用户得到授权,但是访问是被禁止的。"
,
404
:
"发出的请求针对的是不存在的记录,服务器没有进行操作。"
,
406
:
"请求的格式不可得。"
,
410
:
"请求的资源被永久删除,且不会再得到的。"
,
422
:
"当创建一个对象时,发生一个验证错误。"
,
500
:
"服务器发生错误,请检查服务器。"
,
502
:
"网关错误。"
,
503
:
"服务不可用,服务器暂时过载或维护。"
,
504
:
"网关超时。"
,
};
/**
* 异常处理程序
...
...
@@ -58,20 +58,20 @@ const request = extend({
prefix
:
REACT_APP_URL
,
//前缀代理 tasks.nangaoyun.com
errorHandler
,
// 默认错误处理
credentials
:
'include'
,
// 默认请求是否带上cookie
credentials
:
"include"
,
// 默认请求是否带上cookie
});
// request拦截器, 改变url 或 options.
request
.
interceptors
.
request
.
use
(
async
(
url
,
options
)
=>
{
let
token
=
localStorage
.
getItem
(
'TOKENES'
);
let
token
=
localStorage
.
getItem
(
"TOKENES"
);
if
(
token
)
{
const
headers
=
options
.
type
==
'form'
options
.
type
==
"form"
?
{
token
:
token
,
token
:
token
,
}
:
{
'Content-Type'
:
'application/json'
,
"Content-Type"
:
"application/json"
,
token
:
token
,
};
return
{
...
...
@@ -83,32 +83,36 @@ request.interceptors.request.use(async (url, options) => {
// response拦截器, 处理response
request
.
interceptors
.
response
.
use
(
async
(
response
,
options
)
=>
{
if
(
options
.
url
===
'/webtool/download'
)
{
if
(
options
.
url
==
"/studentExperiment/exportByLoginTeacher"
||
options
?.
url
==
"/studentExperiment/scoreReportExport"
)
{
const
data
=
await
response
.
clone
().
blob
();
let
blobUrl
=
window
.
URL
.
createObjectURL
(
data
);
const
a
=
document
.
createElement
(
'a'
);
a
.
style
.
display
=
'none'
;
let
pathname
=
'项目_'
+
options
.
params
.
filename
+
'_任务列表'
;
a
.
download
=
pathname
+
'.xls'
;
const
a
=
document
.
createElement
(
"a"
);
a
.
style
.
display
=
"none"
;
let
temp
=
response
.
headers
.
get
(
"Content-Disposition"
).
split
(
";"
)[
1
].
split
(
"="
)[
1
]
||
""
;
let
fileDefaultName
=
decodeURI
(
temp
);
let
pathname
=
"表格"
;
a
.
download
=
fileDefaultName
||
pathname
+
".xls"
;
a
.
href
=
blobUrl
;
a
.
click
();
a
.
remove
();
return
;
}
const
data
=
await
response
.
clone
().
json
();
// 详情返回的response处理
if
(
data
?.
code
!==
"0000"
)
{
if
(
data
?.
error
||
data
?.
code
===
-
1
)
{
console
.
log
(
location
.
origin
);
// localStorage.removeItem('TOKENES');
//history.replace('/user/login');
}
else
{
}
else
{
const
data
=
await
response
.
clone
().
json
();
// 详情返回的response处理
if
(
data
?.
code
!=
"0000"
)
{
message
.
destroy
();
message
.
error
(
data
?.
msg
);
message
.
warn
(
data
?.
msg
);
if
(
data
?.
code
==
"0001"
&&
window
.
location
.
href
.
indexOf
(
"login"
)
==
-
1
)
{
localStorage
.
clear
();
history
.
replace
(
"/user/login"
);
}
}
}
return
response
;
});
...
...
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