Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
campSite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨梦雪
campSite
Commits
7ac47adc
Commit
7ac47adc
authored
Dec 17, 2021
by
杨梦雪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11
parent
a3ca3264
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
555 additions
and
372 deletions
+555
-372
src/assets/scss/homework/refer.scss
src/assets/scss/homework/refer.scss
+49
-8
src/main.js
src/main.js
+4
-1
src/request/index/certificate.js
src/request/index/certificate.js
+26
-0
src/request/index/homework.js
src/request/index/homework.js
+12
-2
src/request/index/network.js
src/request/index/network.js
+38
-8
src/router/index/camp.js
src/router/index/camp.js
+8
-8
src/store/common.js
src/store/common.js
+10
-0
src/views/index/camp/Certificate.vue
src/views/index/camp/Certificate.vue
+1
-0
src/views/index/camp/Homework.vue
src/views/index/camp/Homework.vue
+48
-29
src/views/index/camp/Index.vue
src/views/index/camp/Index.vue
+11
-11
src/views/index/camp/homework/refer.vue
src/views/index/camp/homework/refer.vue
+348
-305
No files found.
src/assets/scss/homework/refer.scss
View file @
7ac47adc
...
...
@@ -3,14 +3,8 @@
display
:
flex
;
}
.referHome
{
padding
:
20px
;
.lf
{
float
:
left
;
}
.rt
{
float
:
right
;
}
::v-deep
.readForm
{
flex
:
1
;
...
...
@@ -119,7 +113,54 @@
}
}
}
.image_add
{
position
:
relative
;
margin-top
:
24px
;
.image_in
{
.limit_10
{
display
:
none
;
}
.el-upload-list--picture-card
{
.item_img
{
width
:
100%
;
}
}
}
//去除upload组件过渡效果 css
.el-upload-list__item
{
transition
:
none
!
important
;
.is-ready
{
display
:
none
;
}
div
{
height
:
100%
;
}
}
.el-upload--picture-card
{
display
:
inline-block
;
}
.el-upload
{
position
:
relative
;
.el-icon-circle-plus
{
font-size
:
52px
;
color
:
var
(
--
color
);
position
:
absolute
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
}
i
{
font-size
:
22px
;
color
:
#ffffff
;
}
.text
{
font-size
:
14px
;
color
:
#a7a2a6
;
text-align
:
center
;
}
}
.upload_box
{
.img_list
{
position
:
relative
;
...
...
src/main.js
View file @
7ac47adc
...
...
@@ -7,12 +7,15 @@ import store from './store'
import
ElementUI
from
'
element-ui
'
import
'
element-ui/lib/theme-chalk/index.css
'
import
'
@/assets/scss/index.scss
'
import
{
download
,
upload
}
from
"
r/index/network.js
"
;
Vue
.
config
.
productionTip
=
false
Vue
.
use
(
ElementUI
)
Vue
.
prototype
.
download
=
download
Vue
.
prototype
.
upload
=
upload
Vue
.
prototype
.
$errorScroll
=
function
errorScroll
(
callback
)
{
this
.
$nextTick
(()
=>
{
...
...
src/request/index/certificate.js
0 → 100644
View file @
7ac47adc
/* eslint-disable */
import
{
request
}
from
'
./network
'
import
store
from
'
@/store
'
// 添加地址
export
function
setAddress
(
data
)
{
data
[
'
identity
'
]
=
store
.
state
.
indexIdentity
;
return
request
({
method
:
'
post
'
,
url
:
'
/web/download/setAddress
'
,
params
:
data
})
}
// 获取地址
export
function
getAddress
(
data
)
{
data
[
'
identity
'
]
=
store
.
state
.
indexIdentity
;
return
request
({
method
:
'
post
'
,
url
:
'
/web/download/getAddress
'
,
params
:
data
})
}
src/request/index/homework.js
View file @
7ac47adc
...
...
@@ -24,14 +24,24 @@ export function downloadTeacherWork(data) {
})
}
// 获取学生上传作业的oss
export
function
getPostWorkStudent
(
data
)
{
export
function
PostWorkStudentOss
(
data
)
{
data
[
'
identity
'
]
=
store
.
state
.
indexIdentity
;
return
request
({
method
:
'
post
'
,
url
:
'
/web/download/getPostWorkStudent
'
,
params
:
data
data
})
}
//删除图片
export
function
delPic
(
data
)
{
data
[
'
identity
'
]
=
store
.
state
.
indexIdentity
;
return
request
({
method
:
'
post
'
,
url
:
'
/web/download/delPic
'
,
params
:
data
})
}
// 获取学生提交营地作业
export
function
getStudentWork
(
data
)
{
data
[
'
identity
'
]
=
store
.
state
.
indexIdentity
;
...
...
src/request/index/network.js
View file @
7ac47adc
/* eslint-disable */
import
axios
from
'
axios
'
import
store
from
'
@/store
'
import
qs
from
'
qs
'
import
{
tansParams
}
from
'
@/store/common.js
'
import
{
SERVER_URL
,
DEVELOPMENT_SERVER_URL
...
...
@@ -28,6 +30,7 @@ const instance = axios.create({
instance
.
interceptors
.
request
.
use
(
(
config
)
=>
{
if
(
config
.
method
===
"
post
"
&&
!
config
.
notQs
)
{
console
.
log
(
config
)
config
.
data
=
qs
.
stringify
(
config
.
data
);
}
if
(
config
.
url
.
indexOf
(
SERVER_URL
)
===
-
1
)
{
...
...
@@ -50,14 +53,6 @@ instance.interceptors.request.use(
return
Promise
.
reject
(
error
);
}
);
// instance.interceptors.response.use(
// (response) => {
// return response.data;
// },
// (error) => {
// return Promise.reject(error);
// }
// );
export
default
instance
;
...
...
@@ -338,6 +333,41 @@ export function upload(url, data = {}) {
);
});
}
// 通用下载方法
export
function
download
(
url
,
params
,
filename
)
{
console
.
log
(
url
,
params
,
filename
)
return
instance
.
post
(
url
,
params
,
{
transformRequest
:
[
params
=>
{
return
tansParams
(
params
);
}
],
headers
:
{
"
Content-Type
"
:
"
application/x-www-form-urlencoded
"
},
responseType
:
"
blob
"
})
.
then
(
data
=>
{
const
content
=
data
;
console
.
log
(
content
)
const
blob
=
new
Blob
([
content
]);
if
(
"
download
"
in
document
.
createElement
(
"
a
"
))
{
const
elink
=
document
.
createElement
(
"
a
"
);
elink
.
download
=
filename
;
elink
.
style
.
display
=
"
none
"
;
elink
.
href
=
URL
.
createObjectURL
(
blob
);
document
.
body
.
appendChild
(
elink
);
elink
.
click
();
URL
.
revokeObjectURL
(
elink
.
href
);
document
.
body
.
removeChild
(
elink
);
}
else
{
navigator
.
msSaveBlob
(
blob
,
filename
);
}
})
.
catch
(
r
=>
{
console
.
error
(
r
);
});
}
// 合并多个请求
export
function
allRequest
(
arrRequest
)
{
return
axios
.
all
(
arrRequest
)
...
...
src/router/index/camp.js
View file @
7ac47adc
...
...
@@ -15,14 +15,14 @@ export default [{
}
},
{
path
:
'
/homework/refer
'
,
name
:
'
homework-refer
'
,
component
:
()
=>
import
(
'
v/index/camp/homework/refer.vue
'
),
meta
:
{
title
:
'
提交作业
'
},
},
//
{
//
path: '/homework/refer',
//
name: 'homework-refer',
//
component: () => import('v/index/camp/homework/refer.vue'),
//
meta: {
//
title: '提交作业'
//
},
//
},
{
path
:
'
/certificate
'
,
name
:
'
index-certificate
'
,
...
...
src/store/common.js
0 → 100644
View file @
7ac47adc
export
function
tansParams
(
params
)
{
let
result
=
''
Object
.
keys
(
params
).
forEach
((
key
)
=>
{
if
(
!
Object
.
is
(
params
[
key
],
undefined
)
&&
!
Object
.
is
(
params
[
key
],
null
)
&&
!
Object
.
is
(
JSON
.
stringify
(
params
[
key
]),
'
{}
'
))
{
result
+=
encodeURIComponent
(
key
)
+
'
=
'
+
encodeURIComponent
(
params
[
key
])
+
'
&
'
}
})
return
result
}
\ No newline at end of file
src/views/index/camp/Certificate.vue
View file @
7ac47adc
...
...
@@ -132,6 +132,7 @@
<
script
>
/* eslint-disable */
import
{
getProAndCity
,
getSchool
}
from
"
r/index/signUp
"
;
import
{
setAddress
}
from
"
r/index/certificate
"
;
import
validator
from
"
common/validator
"
;
export
default
{
...
...
src/views/index/camp/Homework.vue
View file @
7ac47adc
...
...
@@ -3,14 +3,14 @@
<div
class=
"title"
>
<div
class=
"homework_titile"
>
营地作业
</div>
</div>
<
!--
<div
class=
"empty_conten
t"
>
<
div
class=
"empty_content"
v-if=
"!this.homeworkLis
t"
>
<div>
<img
src=
"@/assets/img/homework/homework.png"
alt=
""
/>
</div>
<p>
同学你好,老师暂未发布作业
</p>
<p>
请于2021年XX年XX月XX日 前往网站查看作业
</p>
</div>
-->
</div>
<div
class=
"home_content"
>
<div
class=
"each_content"
v-for=
"item in homeworkList"
:key=
"item.id"
>
<div
class=
"top flex"
>
...
...
@@ -36,18 +36,33 @@
<div>
<el-pagination
layout=
"prev, pager, next"
:total=
"50"
>
</el-pagination>
</div>
<!-- 下载作业 -->
<refer
:dialogVisibleFu=
"dialogVisibleFu"
:work_contexts=
"work_context"
:enclosure_urls=
"enclosure_url"
:work_nums=
"work_num"
@
closeDialog=
"closeDialog"
></refer>
</div>
</
template
>
<
script
>
/* eslint-disable */
import
refer
from
"
v/index/camp/homework/refer
"
;
import
{
getTeacherWork
}
from
"
r/index/homework
"
;
import
Bus
from
"
config/bus.js
"
;
export
default
{
name
:
"
homework
"
,
components
:
{
refer
,
},
data
()
{
return
{
homeworkList
:
{},
dialogVisibleFu
:
false
,
work_context
:
""
,
enclosure_url
:
""
,
work_num
:
0
,
};
},
created
()
{
...
...
@@ -55,15 +70,19 @@ export default {
},
watch
:
{},
methods
:
{
// 子组件触发,关闭确认报名弹框
closeDialog
(
val
,
type
)
{
this
.
dialogVisibleFu
=
val
;
// if (type) {
// clearInterval(this.timer);
// }
},
toRefer
(
item
)
{
// console.log(val,'val')
let
code
=
this
.
$store
.
state
.
indexIdentity
;
this
.
$router
.
push
(
"
/homework/refer?code=
"
+
code
);
this
.
$emit
(
"
torefer
"
,
3
);
window
.
localStorage
.
setItem
(
"
work_context
"
+
code
,
item
.
work_context
);
window
.
localStorage
.
setItem
(
"
enclosure_url
"
+
code
,
item
.
enclosure_url
);
// Bus.$emit("work_context", item.work_context);
// Bus.$emit("enclosure_url", item.enclosure_url);
this
.
dialogVisibleFu
=
true
;
// console.log(item.work_num,'val')
this
.
work_context
=
item
.
work_context
;
this
.
enclosure_url
=
item
.
enclosure_url
;
this
.
work_num
=
item
.
work_num
;
},
getTeacherWork
()
{
getTeacherWork
({
page
:
1
}).
then
((
res
)
=>
{
...
...
@@ -90,25 +109,25 @@ export default {
// width: 856px;
// 空状态
//
.title {
//
padding: 50px;
//
.homework_titile {
//
font-size: 24px;
//
font-weight: 500;
//
color: #1b1419;
//
line-height: 24px;
//
margin-bottom: 40px;
//
text-align: center;
//
}
//
}
.title
{
padding
:
50px
;
.homework_titile
{
font-size
:
24px
;
font-weight
:
500
;
color
:
#1b1419
;
line-height
:
24px
;
margin-bottom
:
40px
;
text-align
:
center
;
}
}
//
.content_empty {
//
padding-bottom: 200px;
//
p,
//
div {
//
text-align: center;
//
}
//
}
.content_empty
{
padding-bottom
:
200px
;
p
,
div
{
text-align
:
center
;
}
}
// 有作业时候F
.title
{
...
...
src/views/index/camp/Index.vue
View file @
7ac47adc
...
...
@@ -32,12 +32,12 @@
<SignUp
@
getStatus=
"getStatus"
v-if=
"this.campindex_type == 0"
>
</SignUp>
<Homework
v-if=
"this.campindex_type == 1
&& this.homework_val == null
"
@
torefer=
"torefer"
v-if=
"this.campindex_type == 1"
>
</Homework>
<Certificate
v-if=
"this.campindex_type == 2"
>
</Certificate>
<
homeRefer
v-if=
"this.homework_val == 3"
>
</homeRefer
>
<
!--
<homeRefer
v-if=
"this.homework_val == 3"
>
</homeRefer>
--
>
</div>
</div>
</div>
...
...
@@ -56,7 +56,7 @@ import svg3 from "@/assets/img/signUp/icon-2.svg";
import
SignUp
from
"
v/index/camp/SignUp
"
;
import
Homework
from
"
v/index/camp/Homework
"
;
import
Certificate
from
"
v/index/camp/Certificate
"
;
import
homeRefer
from
"
v/index/camp/homework/refer
"
;
//
import homeRefer from "v/index/camp/homework/refer";
export
default
{
name
:
"
campIndex
"
,
...
...
@@ -66,7 +66,7 @@ export default {
SignUp
,
Homework
,
Certificate
,
homeRefer
,
//
homeRefer,
},
// props:{}
data
()
{
...
...
@@ -98,13 +98,13 @@ export default {
campindex_type
:
0
,
index_status
:
""
,
homework_val
:
""
,
//
homework_val: "",
};
},
watch
:
{},
created
()
{
this
.
getStatus
();
this
.
torefer
();
//
this.torefer();
},
mounted
()
{
window
.
addEventListener
(
"
scroll
"
,
this
.
handleScrollX
,
true
);
...
...
@@ -115,10 +115,10 @@ export default {
window
.
removeEventListener
(
"
resize
"
,
this
.
onResize
,
true
);
},
methods
:
{
torefer
(
val
)
{
console
.
log
(
val
,
"
val
"
);
this
.
homework_val
=
val
;
},
//
torefer(val) {
//
console.log(val, "val");
//
this.homework_val = val;
//
},
getStatus
(
val
)
{
// console.log(val, "index_type");
this
.
index_status
=
val
;
...
...
src/views/index/camp/homework/refer.vue
View file @
7ac47adc
<
template
>
<div
class=
"referHome"
>
<div
class=
"rh_top flex"
>
<i
class=
"el-icon-arrow-left"
></i>
<div>
第三次课程论文
</div>
</div>
<el-form
v-loading=
"loading"
ref=
"formRef"
:model=
"formData"
:rules=
"rules"
label-position=
"top"
class=
"readForm"
>
<div
class=
"cont_title"
>
<div
class=
"line"
></div>
<div
class=
"lf"
>
<span>
{{
stuWork
.
jiguanProvince
}}{{
stuWork
.
jiguanProvince
==
stuWork
.
jiguanCity
?
""
:
stuWork
.
jiguanCity
}}{{
stuWork
.
school
}}
</span
>
<span>
{{
stuWork
.
name
}}
</span>
<span>
提交的作业
</span>
</div>
<div
class=
"rt"
v-if=
"type == 1"
>
编号:
{{
stuInfo
.
workNum
}}
</div>
</div>
<div
class=
"cont_title_2"
>
文字描述
</div>
<div
class=
"cont_info"
>
{{
$store
.
state
.
work_context
}}
</div>
<div
class=
"cont_title_2"
>
相关附件
</div>
<div
class=
"upload_box"
>
<div
v-if=
"stuFileList.length > 0"
class=
"img_list"
v-for=
"(item, index) in stuFileList"
:key=
"index"
>
<div>
<el-image
:src=
"fileImg"
></el-image>
<div
class=
"item_name"
>
{{
item
.
name
}}
</div>
<div
class=
"item_remove"
@
click=
"downloadStuFile(item.url)"
>
下载
</div>
<el-dialog
:title=
"'第' + titleName + '次课程论文'"
:visible.sync=
"dialogVisible"
width=
"650px"
top=
"0"
:before-close=
"cancelBtn"
:close-on-click-modal=
"false"
@
open=
"open"
>
<div
class=
"referHome"
>
<el-form
v-loading=
"loading"
ref=
"formRef"
:model=
"formData"
label-position=
"top"
class=
"readForm"
>
<div
class=
"cont_title"
>
<div
class=
"line"
></div>
<div
class=
"lf"
>
<span>
作业要求
</span>
</div>
</div>
<div
v-if=
"stuFileList.length
<
=
0
"
class=
"img_list"
>
<div>
<div
class=
"item_name"
>
暂无相关附件
</div>
</div>
</div>
<div
style=
"clear: both"
></div>
</div>
<div
class=
"cont_title"
>
<div
class=
"line"
></div>
评阅结果
</div>
<el-form-item
label=
"导师评分"
prop=
"score"
>
<el-input
v-model=
"formData.score"
size=
"small"
placeholder=
"请评分(输入0-100之内的整数)"
@
input=
"inputValue"
/>
</el-form-item>
<el-form-item
label=
"导师评语"
prop=
"teaCommment"
>
<el-input
type=
"textarea"
v-model=
"formData.teaCommment"
placeholder=
"请输入300字以内的评语"
size=
"small"
:maxlength=
"300"
show-word-limit
/>
</el-form-item>
<el-form-item
label=
"相关附件"
prop=
"teacherUrl"
>
<div
class=
"fj_info"
>
1、请上传1-10份相关附件;
</div>
<div
class=
"fj_info"
>
2、单个附件大小不超过100M,支持JPG、JPEG、PNG、docx、doc、pdf、mp4等格式;
</div>
<div
class=
"cont_title_2"
>
作业内容
</div>
<div
v-html=
"this.work_contexts"
class=
"cont_info"
>
}
</div>
<div
class=
"cont_title_2"
>
相关附件
</div>
<div
class=
"upload_box"
>
<div
v-if=
"stuFileList.length > 0"
class=
"img_list"
v-for=
"(item, index) in
tea
FileList"
v-for=
"(item, index) in
stu
FileList"
:key=
"index"
>
<div>
<el-image
:src=
"fileImg"
></el-image>
<div
class=
"item_name"
>
{{
item
.
name
}}
</div>
<div
class=
"item_remove"
@
click=
"handleRemove(item)"
>
删除
</div>
<div
class=
"item_remove"
@
click=
"downloadStuFile(item.url)"
>
下载
</div>
</div>
</div>
<div
v-if=
"stuFileList.length
<
=
0
"
class=
"img_list"
>
<div>
<div
class=
"item_name"
>
暂无相关附件
</div>
</div>
</div>
<el-upload
v-if=
"teaFileList.length
<
10
"
ref=
"systemLogo"
name=
"multipartFile"
:action=
"imgAction"
:file-list=
"teaFileList"
:disabled=
"upLoading"
list-type=
"picture-card"
:show-file-list=
"false"
:before-upload=
"beforeUpload"
:on-progress=
"handleProgress"
:on-success=
"handleSuccess"
>
<i
v-if=
"!upLoading"
class=
"el-icon-plus avatar-uploader-icon"
></i>
<i
v-if=
"upLoading"
class=
"el-icon-loading avatar-uploader-icon"
></i>
</el-upload>
<div
style=
"clear: both"
></div>
</div>
</el-form-item>
<el-form-item
class=
"btn"
>
<el-button
type=
"primary"
@
click=
"confirm"
>
保存
</el-button>
</el-form-item>
</el-form>
</div>
<div
class=
"cont_title"
>
<div
class=
"line"
></div>
评阅结果
</div>
<el-form-item
label=
"文字描述(如超过300字,建议以附件形式上传)"
prop=
"stu_answer"
>
<el-input
type=
"textarea"
v-model=
"formData.stu_answer"
placeholder=
"请输入300字以内的描述"
size=
"small"
:maxlength=
"300"
show-word-limit
/>
</el-form-item>
<el-form-item
label=
"相关附件"
prop=
"teacherUrl"
>
<div
class=
"fj_info"
>
1、请上传1-10份相关附件;
</div>
<div
class=
"fj_info"
>
2、单个附件大小不超过100M,支持JPG、JPEG、PNG、docx、doc、pdf、mp4等格式;
</div>
<div
class=
"upload_box"
>
<div
class=
"img_list"
v-for=
"(item, index) in fileList"
:key=
"index"
>
<div>
<el-image
:src=
"fileImg"
></el-image>
<div
class=
"item_name"
>
{{
item
.
name
}}
</div>
<div
class=
"item_remove"
@
click=
"handleRemove(item)"
>
删除
</div>
</div>
</div>
<el-upload
v-if=
"fileList.length
<
10
"
ref=
"systemLogo"
name=
"multipartFile"
action=
"#"
:file-list=
"fileList"
:disabled=
"isUploading || fileList.length >= 10"
:limit=
"10"
list-type=
"picture-card"
:show-file-list=
"false"
:before-upload=
"beforeAvatarUpload"
:on-progress=
"handleUploadProgress"
:on-success=
"uploadSuccess"
:http-request=
"uploadPicture"
>
<i
v-if=
"!upLoading"
class=
"el-icon-plus avatar-uploader-icon"
></i>
<i
v-if=
"upLoading"
class=
"el-icon-loading avatar-uploader-icon"
></i>
</el-upload>
</div>
</el-form-item>
<el-form-item
class=
"btn"
>
<el-button
type=
"primary"
@
click=
"confirm"
>
保存
</el-button>
</el-form-item>
</el-form>
</div>
</el-dialog>
</
template
>
<
script
>
// import {getToken} from "@/utils/auth";
import
Bus
from
"
config/bus.js
"
;
import
{
downloadTeacherWork
,
PostWorkStudentOss
,
delPic
,
subStudentWork
,
GetStuWork
,
SaveTheRead
,
GetAllReadInfo
,
...
...
@@ -135,200 +134,116 @@ import {
}
from
"
r/index/homework
"
;
import
fileImg
from
"
@/assets/img/homework/file_img.png
"
;
export
default
{
name
:
"
ReadForm
"
,
props
:
{
//
dialogVisibleFu: Boolean,
campIdFu
:
[
Number
,
String
],
stuInfoFu
:
[
Object
,
String
],
typeFu
:
[
Number
,
String
],
dialogVisibleFu
:
Boolean
,
work_contexts
:
[
Number
,
String
],
//作业内容
enclosure_urls
:
[
Object
,
String
],
//老师作业地址
work_nums
:
[
Number
],
},
data
()
{
return
{
titleName
:
""
,
isUploading
:
false
,
// 图片上传蒙层
work_context
:
""
,
//简介
fileImg
:
fileImg
,
loading
:
false
,
dialogVisible
:
this
.
dialogVisibleFu
,
type
:
this
.
typeFu
,
// 来源(1-未评阅 2-已评阅)
campId
:
this
.
campIdFu
,
stuInfo
:
this
.
stuInfoFu
,
// 学生-信息
dialogVisibleimage
:
false
,
stuWork
:
{},
// 学生-作业
stuFileList
:
[],
// 学生-相关附件
teaFileList
:
[],
// 老师-相关附件
formData
:
{
campId
:
null
,
stuWorkNum
:
null
,
uuid
:
null
,
score
:
null
,
teaCommment
:
null
,
teacherUrl
:
null
,
stu_work_num
:
""
,
stu_answer
:
""
,
stu_enclosure_url
:
""
,
},
// 老师-评阅结果
rules
:
{
score
:
[
{
required
:
true
,
message
:
"
请评分(输入0-100之内的整数)
"
,
trigger
:
"
blur
"
,
},
],
},
upLoading
:
false
,
// 老师-上传loading
// 上传图片请求头
// headers: {
// Authorization: "Bearer " + getToken()
// },
imgAction
:
process
.
env
.
VUE_APP_BASE_API
+
"
/modules-campsite/ld/UploadWorkForStudent
"
,
fileList
:
[],
stu_fileList
:
""
,
disabled
:
false
,
//限制输入框
};
},
created
()
{
console
.
log
(
this
.
$store
.
state
.
work_context
)
// this.work_context = this.$store.state.work_context;
console
.
log
(
this
.
enclosure_urls
);
let
code
=
this
.
$store
.
state
.
indexIdentity
;
let
studentFile
=
window
.
localStorage
.
getItem
(
"
student_file_
"
+
window
.
localStorage
.
getItem
(
"
phone
"
+
code
)
+
code
);
if
(
studentFile
&&
JSON
.
parse
(
studentFile
).
length
>
0
)
{
this
.
fileList
=
JSON
.
parse
(
studentFile
);
}
},
methods
:
{
open
()
{
if
(
this
.
type
==
1
)
{
this
.
getStuWork
();
}
else
if
(
this
.
type
==
2
)
{
this
.
getYiStuWork
();
console
.
log
(
this
.
stu_work_nums
);
this
.
titleName
=
this
.
work_nums
;
this
.
getTeachList
();
},
//老师作业展示
getTeachList
()
{
let
url
=
this
.
enclosure_urls
;
console
.
log
(
this
.
enclosure_urls
);
if
(
this
.
enclosure_urls
)
{
let
arr
=
url
.
split
(
"
,
"
);
arr
.
forEach
((
item
)
=>
{
this
.
stuFileList
.
push
({
url
:
item
,
name
:
item
.
split
(
"
/work/
"
)[
1
],
status
:
"
success
"
,
});
});
}
else
{
this
.
stuFileList
=
[];
}
},
// 下载老师附件
downloadStuFile
(
url
)
{
this
.
download
(
'
http://api.campcenter.cn/web/download/downloadTeacherWork
'
,
{
enclosure_url
:
url
,
identity
:
this
.
$store
.
state
.
indexIdentity
},
''
)
// downloadTeacherWork({ enclosure_url:url }).then((res) => {
// console.log(res, "res");
// if (res.code != 200) {
// return this.$message.error(res.data.message);
// }
// this.$message.success(res.data.message);
// });
// window.location.href = url;
},
// 保存按钮
confirm
()
{
this
.
$refs
[
"
formRef
"
].
validate
((
valid
)
=>
{
if
(
!
valid
)
return
;
if
(
this
.
type
==
1
)
{
this
.
notReadHandle
();
}
else
if
(
this
.
type
==
2
)
{
this
.
yiReadHandle
();
}
// if (this.type == 1) {
// 未完成
this
.
notReadHandle
();
// } else if (this.type == 2) {
// 已完成
// this.yiReadHandle();
// }
});
},
// 下载学生附件
downloadStuFile
(
url
)
{
window
.
location
.
href
=
url
;
},
// 导师评分0-100限制
inputValue
(
value
)
{
if
(
value
.
length
>
1
&&
value
.
slice
(
0
,
1
)
==
0
)
{
return
(
this
.
formData
.
score
=
0
);
}
else
if
(
value
.
length
>=
3
&&
value
>
100
)
{
return
(
this
.
formData
.
score
=
100
);
}
this
.
formData
.
score
=
value
.
replace
(
/
[^\d]
/g
,
""
);
},
// 已评阅-获取学生答案
getYiStuWork
()
{
GetAllReadInfo
({
campId
:
this
.
campId
,
stuWorkNum
:
this
.
stuInfo
.
stuWorkNum
,
uuid
:
this
.
stuInfo
.
uuid
,
})
.
then
((
response
)
=>
{
console
.
log
(
response
);
if
(
response
.
code
!=
200
)
{
return
this
.
msgError
(
response
.
msg
);
}
this
.
stuWork
=
response
.
data
;
this
.
formData
.
score
=
this
.
stuWork
[
"
score
"
];
this
.
formData
.
teaCommment
=
this
.
stuWork
[
"
teacherCommment
"
];
this
.
formData
.
teacherUrl
=
this
.
stuWork
[
"
teacherUrl
"
];
let
url
=
this
.
stuWork
.
stuEnclosureUrl
;
if
(
this
.
stuWork
.
stuEnclosureUrl
)
{
let
arr
=
url
.
split
(
"
,
"
);
arr
.
forEach
((
item
)
=>
{
this
.
stuFileList
.
push
({
url
:
item
,
name
:
item
.
split
(
"
/work/
"
)[
1
],
status
:
"
success
"
,
});
});
}
else
{
this
.
stuFileList
=
[];
}
let
urlT
=
this
.
stuWork
.
teacherUrl
;
if
(
this
.
stuWork
.
teacherUrl
)
{
let
arr
=
urlT
.
split
(
"
,
"
);
arr
.
forEach
((
item
)
=>
{
this
.
teaFileList
.
push
({
url
:
item
,
name
:
item
.
split
(
"
/workforstudent/
"
)[
1
],
status
:
"
success
"
,
});
});
}
else
{
this
.
teaFileList
=
[];
}
})
.
catch
((
error
)
=>
{
console
.
log
(
error
);
});
},
// 已评阅-评阅
// yiReadHandle(){
// this.formData.campId = this.campId;
// this.formData.stuWorkNum = this.stuInfo.stuWorkNum;
// this.formData.uuid = this.stuInfo.uuid;
// SaveYiRead(this.formData)
// .then(response => {
// console.log(response);
// if (response.code != 200) {
// return this.msgError(response.msg);
// }
// this.msgSuccess(response.msg);
// this.cancelBtnTrue();
// })
// .catch(error => {
// console.log(error);
// });
// },
// 未评阅-获取学生答案
getStuWork
()
{
GetStuWork
({
campId
:
this
.
campId
,
stuWorkNum
:
this
.
stuInfo
.
stuWorkNum
,
uuid
:
this
.
stuInfo
.
uuid
,
})
.
then
((
response
)
=>
{
console
.
log
(
response
);
if
(
response
.
code
!=
200
)
{
return
this
.
msgError
(
response
.
msg
);
}
this
.
stuWork
=
response
.
data
;
let
url
=
this
.
stuWork
.
stuEnclosureUrl
;
if
(
this
.
stuWork
.
stuEnclosureUrl
)
{
let
arr
=
url
.
split
(
"
,
"
);
arr
.
forEach
((
item
)
=>
{
this
.
stuFileList
.
push
({
url
:
item
,
name
:
item
.
split
(
"
/work/
"
)[
1
],
status
:
"
success
"
,
});
});
}
else
{
this
.
stuFileList
=
[];
}
})
.
catch
((
error
)
=>
{
console
.
log
(
error
);
});
},
// 未评阅-评阅
// 未完成
notReadHandle
()
{
this
.
formData
.
campId
=
this
.
campId
;
this
.
formData
.
stuWorkNum
=
this
.
stuInfo
.
stuWorkNum
;
this
.
formData
.
uuid
=
this
.
stuInfo
.
uuid
;
SaveTheRead
(
this
.
formData
)
this
.
formData
.
stu_work_num
=
this
.
work_nums
;
this
.
formData
.
stu_enclosure_url
=
this
.
stu_fileList
;
subStudentWork
(
this
.
formData
)
.
then
((
response
)
=>
{
console
.
log
(
response
);
if
(
response
.
code
!=
200
)
{
return
this
.
msgError
(
response
.
msg
);
return
this
.
$message
.
error
(
response
.
message
);
}
this
.
msgSuccess
(
response
.
msg
);
this
.
$message
.
success
(
response
.
message
);
this
.
cancelBtnTrue
();
})
.
catch
((
error
)
=>
{
...
...
@@ -352,53 +267,181 @@ export default {
this
.
dialogVisible
=
false
;
this
.
$emit
(
"
closeDialog
"
,
this
.
dialogVisible
,
false
);
},
// 删除文件
handleRemove
(
data
)
{
this
.
teaFileList
=
this
.
teaFileList
.
filter
((
item
)
=>
{
return
item
!=
data
;
});
this
.
formData
.
teacherUrl
=
this
.
teaFileList
.
map
((
item
)
=>
{
return
item
.
url
;
})
.
join
(
"
,
"
);
console
.
log
(
this
.
teaFileList
);
console
.
log
(
this
.
formData
.
teacherUrl
);
//上传前
beforeAvatarUpload
(
file
)
{
const
isLt10M
=
file
.
size
/
1024
/
1024
<
10
;
if
(
!
isLt10M
)
{
this
.
$message
.
info
(
"
上传图片大小不能超过 10MB!
"
);
}
return
isLt10M
;
},
// 文件上传成功时的钩子
handleSuccess
(
res
,
file
,
fileList
)
{
if
(
res
.
code
!=
200
)
{
this
.
upLoading
=
false
;
return
this
.
msgError
(
res
.
msg
);
// handlePictureCardPreview(file) {
// console.log(file, "11111111");
// this.resultPicture = file.url;
// this.dialogVisibleimage = true;
// },
// 文件上传中处理
handleUploadProgress
(
event
,
file
,
fileList
)
{
// console.log(fileList);
this
.
isUploading
=
true
;
if
(
this
.
fileList
.
lenge
<
10
)
{
return
this
.
$message
.
info
(
"
chaochushuliamng
"
);
}
let
length
=
this
.
teaFileList
.
length
;
this
.
teaFileList
[
length
]
=
{
status
:
"
success
"
,
name
:
res
.
msg
.
split
(
"
/workforstudent/
"
)[
1
],
url
:
res
.
msg
,
},
uploadSuccess
(
res
,
file
,
fileList
)
{
// console.log(res, "res");
console
.
log
(
file
,
"
file
"
);
// console.log(fileList, "fileList");
this
.
referForm
.
achievementPath
=
res
;
this
.
fileList
=
{
name
:
file
.
name
,
url
:
res
,
};
this
.
$refs
[
"
imgUrl
"
].
clearFiles
();
//上传成功之后清除历史记录
},
uploadPicture
(
params
)
{
console
.
log
(
"
已经准备好上传图片
"
,
params
);
this
.
file
=
params
.
file
;
console
.
log
(
this
.
file
,
"
1111
"
);
let
raw
=
params
.
file
;
let
image
=
{
name
:
raw
.
name
,
size
:
raw
.
size
,
type
:
raw
.
type
,
};
this
.
formData
.
teacherUrl
=
this
.
teaFileList
.
map
((
item
)
=>
{
return
item
.
url
;
this
.
getOssConfigs
(
image
,
params
.
file
);
},
async
getOssConfigs
(
image
,
file
)
{
// let code = this.$store.state.indexIdentity;
// let stu_work_num = window.localStorage.getItem("stu_work_num" + code);
// console.log(
// window.localStorage.getItem("stu_work_num" + code),
// "stu_work_num"
// );
let
obj
=
{
url
:
""
,
savefile
:
""
,
};
await
PostWorkStudentOss
({
image
:
image
,
stu_work_num
:
this
.
stu_work_nums
,
})
.
then
((
res
)
=>
{
console
.
log
(
res
,
"
开始上传图片
"
);
if
(
res
.
data
.
code
===
200
)
{
let
oss_url
=
res
.
data
.
config
.
host
;
let
filename
=
res
.
data
.
config
.
file
;
let
formData
=
new
FormData
();
formData
.
append
(
"
OSSAccessKeyId
"
,
res
.
data
.
config
.
accessid
);
formData
.
append
(
"
policy
"
,
res
.
data
.
config
.
policy
);
formData
.
append
(
"
signature
"
,
res
.
data
.
config
.
signature
);
formData
.
append
(
"
filename
"
,
res
.
data
.
config
.
file
);
formData
.
append
(
"
key
"
,
res
.
data
.
config
.
savefile
);
formData
.
append
(
"
callback
"
,
res
.
data
.
config
.
callback
);
formData
.
append
(
"
success_action_status
"
,
200
);
formData
.
append
(
"
file
"
,
file
);
// console.log(formData);
this
.
upload
(
oss_url
,
formData
)
.
then
((
ress
)
=>
{
console
.
log
(
ress
,
"
ress
"
);
if
(
ress
.
data
.
code
!=
200
)
{
console
.
log
(
ress
,
"
ress
"
);
return
this
.
$message
.
error
(
ress
.
data
.
message
);
}
this
.
resultPicture
=
filename
+
"
?t=
"
+
Date
.
parse
(
new
Date
());
this
.
$forceUpdate
();
this
.
$message
.
success
(
"
上传成功
"
);
obj
=
{
url
:
ress
.
data
.
picture_path
,
savefile
:
res
.
data
.
config
.
savefile
,
};
this
.
fileList
.
push
(
obj
);
// let stu_obj={
// url: ress.data.picture_path,
// }
// this.stu_fileList.push(stu_obj);
// let arrNew = [];
this
.
stu_fileList
=
this
.
fileList
.
map
((
item
)
=>
{
return
item
.
url
;
})
.
join
(
"
,
"
);
// console.log(this.stu_fileList)
let
code
=
this
.
$store
.
state
.
indexIdentity
;
window
.
localStorage
.
setItem
(
"
student_file_
"
+
+
window
.
localStorage
.
getItem
(
"
phone
"
+
code
)
+
code
,
JSON
.
stringify
(
this
.
fileList
)
);
})
.
catch
((
err
)
=>
{
this
.
$message
.
error
(
err
);
});
}
else
{
this
.
$message
.
error
(
res
.
data
.
message
);
}
})
.
join
(
"
,
"
);
this
.
upLoading
=
false
;
this
.
msgSuccess
(
"
上传成功
"
);
.
catch
((
err
)
=>
{
// console.log(err)
;
}
);
},
handleProgress
(
event
,
file
,
fileList
)
{
this
.
upLoading
=
true
;
// 下载证明资料图片
handleDownload
(
file
)
{
// console.log(file,'file22');
window
.
location
.
href
=
file
.
url
;
},
// 上传文件之前的钩子
beforeUpload
(
file
)
{
const
isLt10M
=
file
.
size
/
1024
/
1024
<=
100
;
//删除图片
handleRemove
(
file
)
{
console
.
log
(
file
,
"
file
"
);
this
.
$confirm
(
"
此操作将永久删除该文件, 是否继续?
"
,
"
提示
"
,
{
confirmButtonText
:
"
确定
"
,
cancelButtonText
:
"
取消
"
,
type
:
"
warning
"
,
})
.
then
(()
=>
{
let
getfile
=
file
.
url
;
// console.log(savefile.match(/^(?:[^\/]|\/\/)*/),'222222');//获取域名
let
str
=
getfile
.
split
(
"
https://campiste.oss-cn-beijing.aliyuncs.com/
"
);
//https://yingdi-achievement.oss-cn-beijing.aliyuncs.com/进行分割,
console
.
log
(
str
,
"
str
"
);
let
savefile
=
str
[
1
];
// console.log(savefile, "savefile");
delPic
({
object
:
savefile
}).
then
((
res
)
=>
{
// console.log(res, "delpic");
if
(
res
.
data
.
code
!=
200
)
{
return
this
.
$message
.
error
(
res
.
data
.
message
);
}
this
.
fileList
.
forEach
((
item
,
idx
)
=>
{
// console.log(item.url == file.url);
if
(
item
.
url
==
file
.
url
)
{
this
.
fileList
.
splice
(
idx
,
1
);
let
code
=
this
.
$store
.
state
.
indexIdentity
;
window
.
localStorage
.
setItem
(
"
student_file_
"
+
window
.
localStorage
.
getItem
(
"
phone
"
+
code
)
+
code
,
JSON
.
stringify
(
this
.
fileList
)
);
}
});
if
(
!
isLt10M
)
{
this
.
$message
.
error
(
"
上传的附件大小不能超过 100M!
"
);
return
false
;
}
return
isLt10M
;
// console.log(this.fileList);
this
.
$message
.
success
(
res
.
data
.
message
);
});
})
.
catch
((
err
)
=>
{
this
.
$message
({
type
:
"
info
"
,
message
:
"
取消删除
"
,
});
});
},
},
watch
:
{
dialogVisibleFu
()
{
this
.
dialogVisible
=
this
.
dialogVisibleFu
;
...
...
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