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

11

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