Commit 18ce5072 authored by 杨梦雪's avatar 杨梦雪

11

parent a1d896bf
...@@ -10,8 +10,9 @@ ...@@ -10,8 +10,9 @@
> >
<div class="referHome"> <div class="referHome">
<el-form <el-form
:model="formData" :model="formData"
:rules="referRules"
ref="formRef_stu"
label-position="top" label-position="top"
class="readForm" class="readForm"
> >
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
</div> </div>
</div> </div>
<div class="cont_title_2">作业内容</div> <div class="cont_title_2">作业内容</div>
<div v-html="this.work_contexts" class="cont_info">}</div> <div v-html="work_contexts" class="cont_info">}</div>
<div class="cont_title_2">相关附件</div> <div class="cont_title_2">相关附件</div>
<div class="upload_box"> <div class="upload_box">
<div v-if="teaFileList.length > 0"> <div v-if="teaFileList.length > 0">
...@@ -51,78 +52,100 @@ ...@@ -51,78 +52,100 @@
<div style="clear: both"></div> <div style="clear: both"></div>
</div> </div>
<!-- 我的作业(未提交) --> <!-- 我的作业(未提交) -->
<div v-if="this.student_status == 0"> <div class="cont_title">
<div class="cont_title"> <div class="line"></div>
<div class="line"></div> 我的作业
我的作业 </div>
<el-form-item
label="文字描述(如超过300字,建议以附件形式上传)"
prop="stu_answer"
>
<el-input
ref="stu_answer"
type="textarea"
v-model="formData.stu_answer"
placeholder="请输入300字以内的描述"
size="small"
:maxlength="300"
show-word-limit
:disabled="student_status == 1 || student_status == 2"
/>
</el-form-item>
<el-form-item label="相关附件" prop="stu_enclosure_url">
<div class="fj_info">1、请上传1-10份相关附件;</div>
<div class="fj_info">
2、单个附件大小不超过100M,支持JPG、JPEG、PNG、docx、doc、pdf、mp4等格式;
</div> </div>
<el-form ref="formRef_stu" :rules="referRules" :model="formData"> <div class="upload_box">
<el-form-item <div
label="文字描述(如超过300字,建议以附件形式上传)" class="img_list"
prop="stu_answer" v-for="(item, index) in fileList"
:key="index"
> >
<el-input <div>
type="textarea" <el-image :src="fileImg"></el-image>
v-model="formData.stu_answer" <div class="item_name">{{ item.name }}</div>
placeholder="请输入300字以内的描述"
size="small"
:maxlength="300"
show-word-limit
/>
</el-form-item>
<el-form-item label="相关附件" prop="studentUrl">
<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 <div
class="img_list" v-show="student_status == 0"
v-for="(item, index) in fileList" class="item_remove"
:key="index" @click="handleRemove(item)"
> >
<div> 删除
<el-image :src="fileImg"></el-image>
<div class="item_name">{{ item.name }}</div>
<div class="item_remove" @click="handleRemove(item)">
删除
</div>
</div>
</div> </div>
</div>
</div>
<el-upload <el-upload
v-if="fileList.length < 10" v-if="fileList.length < 10 && student_status == 0"
ref="systemLogo" ref="stu_enclosure_url"
name="multipartFile" name="multipartFile"
action="#" action="#"
:file-list="fileList" :file-list="fileList"
:disabled="isUploading || fileList.length >= 10" :disabled="isUploading || fileList.length >= 10"
:limit="10" :limit="10"
list-type="picture-card" list-type="picture-card"
:show-file-list="false" :show-file-list="false"
:before-upload="beforeAvatarUpload" :before-upload="beforeAvatarUpload"
:http-request="uploadPicture" :http-request="uploadPicture"
> >
<i <i
v-if="!isUploading" v-if="!isUploading"
class="el-icon-plus avatar-uploader-icon" class="el-icon-plus avatar-uploader-icon"
></i> ></i>
<i <i
v-if="isUploading" v-if="isUploading"
class="el-icon-loading avatar-uploader-icon" class="el-icon-loading avatar-uploader-icon"
></i> ></i>
</el-upload> </el-upload>
<div
class="upload_box"
v-if="student_status == 1 || student_status == 2"
>
<div
class="img_list"
v-for="(item, index) in stu_fileList"
:key="index"
>
<div>
<el-image :src="fileImg"></el-image>
<div class="item_name">{{ item.name }}</div>
</div>
</div> </div>
</el-form-item> <div v-if="stu_fileList.length <= 0" class="img_list">
</el-form> <div>
</div> <div class="item_name">暂无相关附件</div>
</div>
</div>
</div>
</div>
<!-- </div> -->
</el-form-item>
<!-- 我的作业(已提交待评分 -不可编辑 )--> <!-- 我的作业(已提交待评分 -不可编辑 )-->
<div v-if="this.student_status == 1 || this.student_status == 2"> <!-- <div v-if="student_status == 1 || student_status == 2">
<div class="cont_title"> <div class="cont_title">
<div class="line"></div> <div class="line"></div>
我的作业 我的作业
</div> </div>
<el-form-item label="文字描述(如超过300字,建议以附件形式上传)"> <el-form-item label="文字描述(如超过300字,建议以附件形式上传)">
<el-input <el-input
type="textarea" type="textarea"
...@@ -157,9 +180,9 @@ ...@@ -157,9 +180,9 @@
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
</div> </div> -->
<!-- 评阅结果 --> <!-- 评阅结果 -->
<div v-if="this.student_status == 2" style="height: 350px"> <div v-if="student_status == 2" style="height: 350px">
<div class="cont_title"> <div class="cont_title">
<div class="line"></div> <div class="line"></div>
<div class="lf"> <div class="lf">
...@@ -196,7 +219,7 @@ ...@@ -196,7 +219,7 @@
</div> </div>
</div> </div>
<el-form-item class="btn" v-if="this.student_status == 0"> <el-form-item class="btn" v-if="student_status == 0">
<el-button type="primary" @click="confirm">提交</el-button> <el-button type="primary" @click="confirm">提交</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -241,7 +264,7 @@ export default { ...@@ -241,7 +264,7 @@ export default {
console.log(this.formData.stu_enclosure_url); console.log(this.formData.stu_enclosure_url);
if ( if (
this.formData.stu_answer == "" && this.formData.stu_answer == "" &&
this.formData.stu_enclosure_url == [] this.formData.stu_enclosure_url == ""
) { ) {
callback(new Error("请至少填写一项")); callback(new Error("请至少填写一项"));
} else { } else {
...@@ -254,11 +277,10 @@ export default { ...@@ -254,11 +277,10 @@ export default {
stu_answer: [ stu_answer: [
{ required: true, validator: validateNum, trigger: "blur" }, { required: true, validator: validateNum, trigger: "blur" },
], ],
studentUrl: [ stu_enclosure_url: [
{ required: true, validator: validateNum, trigger: "blur" }, { required: true, validator: validateNum, trigger: "blur" },
], ],
}, },
titleName: "", titleName: "",
isUploading: false, // 图片上传蒙层 isUploading: false, // 图片上传蒙层
work_context: "", //简介 work_context: "", //简介
...@@ -266,16 +288,13 @@ export default { ...@@ -266,16 +288,13 @@ export default {
loading: false, loading: false,
dialogVisible: this.dialogVisibleFu, dialogVisible: this.dialogVisibleFu,
dialogVisibleimage: false, dialogVisibleimage: false,
// stuWork: {}, // 学生-作业
formData: { formData: {
teacher_id: "", teacher_id: "",
stu_answer: "", stu_answer: "",
stu_enclosure_url: "", stu_enclosure_url: "",
}, // 老师-评阅结果 }, // 老师-评阅结果
// upLoading: false, // 老师-上传loading
disabled: false, //限制输入框 disabled: false, //限制输入框
stu_fileListoss: [], // 学生-上传相关附件(展示-存在缓存) stu_fileListoss: "", // 学生-上传相关附件(展示-存在缓存)
teaFileList: [], // 老师-布置作业附件 teaFileList: [], // 老师-布置作业附件
fileList: [], //学生上传的作业文件 fileList: [], //学生上传的作业文件
stu_fileList: [], //学生上传的文件(传给接口的格式) stu_fileList: [], //学生上传的文件(传给接口的格式)
...@@ -285,6 +304,7 @@ export default { ...@@ -285,6 +304,7 @@ export default {
}; };
}, },
created() { created() {
console.log(this.formData.stu_enclosure_url);
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
let stu_fileListoss = window.localStorage.getItem( let stu_fileListoss = window.localStorage.getItem(
"student_file_" + window.localStorage.getItem("phone" + code) + code "student_file_" + window.localStorage.getItem("phone" + code) + code
...@@ -295,10 +315,12 @@ export default { ...@@ -295,10 +315,12 @@ export default {
}, },
methods: { methods: {
open() { open() {
console.log(this.student_status);
this.titleName = this.order_nums; this.titleName = this.order_nums;
// console.log(this.student_status); // console.log(this.student_status);
this.getTeachList(); this.getTeachList();
if (this.student_status == 0) { if (this.student_status == 0) {
this.formData = {};
} else if (this.student_status == 1) { } else if (this.student_status == 1) {
this.getStudentWork(this.student_status); this.getStudentWork(this.student_status);
} else if (this.student_status == 2) { } else if (this.student_status == 2) {
...@@ -366,38 +388,60 @@ export default { ...@@ -366,38 +388,60 @@ export default {
}); });
}, },
// 学生作业回显 // 学生作业回显
getStudentWork() { getStudentWork(student_status) {
console.log(student_status, "student_status");
let stu_work_num = this.work_nums; let stu_work_num = this.work_nums;
console.log(stu_work_num);
console.log(this.formData);
// return
getStudentWork({ teacher_id: stu_work_num }).then((res) => { getStudentWork({ teacher_id: stu_work_num }).then((res) => {
console.log(res, "getStudentWork"); console.log(res, "getStudentWork");
if (res.data.code != 200) { if (res.data.code != 200) {
return this.$message.error(res.data.message); return this.$message.error(res.data.message);
} }
this.$message.success(res.data.message); this.$message.success(res.data.message);
// console.log(res.data.stu_answer); if (student_status == 1) {
this.formData.stu_answer = res.data.data.stu_answer; // 学生已提交
let gotfileList = res.data.data.stu_enclosure_url_arr; this.formData.stu_answer = res.data.data.stu_answer;
this.stu_fileList = gotfileList.map((item) => { console.log(this.formData);
return {
name: item.split("/work/")[1], let gotfileList = res.data.data.stu_enclosure_url_arr;
url: item, if (gotfileList) {
}; this.stu_fileList = gotfileList.map((item) => {
}); return {
// console.log(this.stu_fileList, "stu_fileList"); name: item.split("/work/")[1],
//老师已评阅 url: item,
if (this.student_status == 2) { };
});
}
this.$forceUpdate();
} else if (student_status == 2) {
//老师已评阅
this.formData.stu_answer = res.data.data.stu_answer;
let gotfileList = res.data.data.stu_enclosure_url_arr;
if (gotfileList) {
this.stu_fileList = gotfileList.map((item) => {
return {
name: item.split("/work/")[1],
url: item,
};
});
}
this.score = res.data.data.score; //老师评分 this.score = res.data.data.score; //老师评分
this.teacher_commment = res.data.data.teacher_commment; //老师评语 this.teacher_commment = res.data.data.teacher_commment; //老师评语
// console.log(res.data.data.teacher_commment, " this.teacher_commment"); // console.log(res.data.data.teacher_commment, " this.teacher_commment");
let scoreFileList = res.data.data.teacher_url; let scoreFileList = res.data.data.teacher_url;
let arr = scoreFileList.split(","); if (scoreFileList) {
// console.log(arr, "arr"); let arr = scoreFileList.split(",");
this.tea_scoreFileList = arr.map((item) => { // console.log(arr, "arr");
return { this.tea_scoreFileList = arr.map((item) => {
name: item.split("workforstudent/")[1], return {
url: item, name: item.split("workforstudent/")[1],
}; url: item,
}); };
});
}
this.$forceUpdate();//强制刷新
} }
}); });
}, },
...@@ -405,14 +449,14 @@ export default { ...@@ -405,14 +449,14 @@ export default {
// 未完成 // 未完成
notReadHandle() { notReadHandle() {
this.formData.teacher_id = this.work_nums; this.formData.teacher_id = this.work_nums;
if (!this.formData.stu_enclosure_url) { // if (!this.formData.stu_enclosure_url) {
delete this.formData.stu_enclosure_url; // delete this.formData.stu_enclosure_url;
} else { // } else {
this.formData.stu_enclosure_url = this.stu_fileListoss; this.formData.stu_enclosure_url = this.stu_fileListoss;
} // }
if (!this.formData.stu_answer) { // if (!this.formData.stu_answer) {
delete this.formData.stu_answer; // delete this.formData.stu_answer;
} // }
console.log(this.stu_fileList, "this.stu_fileList"); console.log(this.stu_fileList, "this.stu_fileList");
// return // return
subStudentWork(this.formData) subStudentWork(this.formData)
...@@ -428,40 +472,23 @@ export default { ...@@ -428,40 +472,23 @@ export default {
console.log(error); console.log(error);
}); });
}, },
// 待评阅
yiReadHandle() {
let code = this.$store.state.indexIdentity;
this.formData.teacher_id = this.work_nums;
this.formData.stu_enclosure_url = window.localStorage.getItem(
"student_file_" + window.localStorage.getItem("phone" + code) + code
);
subStudentWork(this.formData)
.then((response) => {
console.log(response);
if (response.data.code != 200) {
return this.$message.error(response.data.message);
}
this.$message.success(response.data.message);
this.cancelBtnTrue();
})
.catch((error) => {
console.log(error);
});
},
// 成功确认取消,关闭弹框,修改父组件的值 // 成功确认取消,关闭弹框,修改父组件的值
cancelBtnTrue() { cancelBtnTrue() {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.removeItem( window.localStorage.removeItem(
"student_file_" + window.localStorage.getItem("phone" + code) + code "student_file_" + window.localStorage.getItem("phone" + code) + code
); );
this.stu_fileList = []; this.stu_fileList = [];
this.stu_fileListoss = []; this.fileList = [];
this.stu_fileListoss = "";
this.teaFileList = []; this.teaFileList = [];
this.formData.stu_answer = "";
this.$refs["formRef_stu"].resetFields(); this.$refs["formRef_stu"].resetFields();
this.dialogVisible = false; this.dialogVisible = false;
this.$emit("closeDialog", this.dialogVisible, true); this.$emit("closeDialog", this.dialogVisible, true);
// this.$parent.getTeacherWork();
// location.reload();
}, },
// 取消,关闭弹框,修改父组件的值 // 取消,关闭弹框,修改父组件的值
cancelBtn() { cancelBtn() {
...@@ -469,11 +496,11 @@ export default { ...@@ -469,11 +496,11 @@ export default {
window.localStorage.removeItem( window.localStorage.removeItem(
"student_file_" + window.localStorage.getItem("phone" + code) + code "student_file_" + window.localStorage.getItem("phone" + code) + code
); );
this.stu_fileList = []; this.stu_fileList = [];
this.stu_fileListoss = []; this.fileList = [];
this.stu_fileListoss = "";
this.teaFileList = []; this.teaFileList = [];
this.formData.stu_answer = "";
this.dialogVisible = false; this.dialogVisible = false;
this.$emit("closeDialog", this.dialogVisible, false); this.$emit("closeDialog", this.dialogVisible, false);
}, },
...@@ -540,13 +567,14 @@ export default { ...@@ -540,13 +567,14 @@ export default {
name: res.data.config.savefile.split("/work/")[1], name: res.data.config.savefile.split("/work/")[1],
}; };
this.fileList.push(obj); this.fileList.push(obj);
console.log(this.fileList, "fileList"); // console.log(this.fileList, "fileList");
this.stu_fileListoss = this.fileList this.stu_fileListoss = this.fileList
.map((item) => { .map((item) => {
return item.url; return item.url;
}) })
.join(","); .join(",");
console.log(this.stu_fileListoss, "stu_fileListoss"); this.formData.stu_enclosure_url = this.stu_fileListoss;
// console.log(this.stu_fileListoss, "stu_fileListoss");
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.setItem( window.localStorage.setItem(
"student_file_" + "student_file_" +
...@@ -630,14 +658,9 @@ export default { ...@@ -630,14 +658,9 @@ export default {
this.$refs["formRef_stu"].validate((valid) => { this.$refs["formRef_stu"].validate((valid) => {
if (!valid) return; if (!valid) return;
console.log(valid, "valid"); console.log(valid, "valid");
if (this.student_status == 0) { // 未完成
// 未完成 // return
this.notReadHandle(); this.notReadHandle();
} else if (this.student_status == 1) {
// console.log(11111);
// 已完成
this.yiReadHandle();
}
}); });
}, },
}, },
...@@ -646,6 +669,9 @@ export default { ...@@ -646,6 +669,9 @@ export default {
dialogVisibleFu() { dialogVisibleFu() {
this.dialogVisible = this.dialogVisibleFu; this.dialogVisible = this.dialogVisibleFu;
}, },
work_nums() {
this.formData.teacher_id = this.work_nums;
},
}, },
}; };
</script> </script>
......
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