|
@@ -254,7 +254,11 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="uploadImg" @click="addImg($event)">
|
|
|
+ <div
|
|
|
+ class="uploadImg"
|
|
|
+ @click="addImg($event)"
|
|
|
+ v-if="upload[0].upImg.length == 0"
|
|
|
+ >
|
|
|
<img src="../assets/icon/uploadImg.png" alt="" />
|
|
|
<input
|
|
|
type="file"
|
|
@@ -273,7 +277,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div
|
|
|
+ <!-- <div
|
|
|
style="
|
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
@@ -314,7 +318,7 @@
|
|
|
上传视频
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
<div style="padding-left: 25px">
|
|
|
<span style="color: red">*</span> 简要描述
|
|
|
</div>
|
|
@@ -333,9 +337,7 @@
|
|
|
style="padding: 10% 10px 50px 0px"
|
|
|
>
|
|
|
<el-button @click="steps = 1">返回答题</el-button>
|
|
|
- <el-button type="primary" @click="dialogVisible = true"
|
|
|
- >确定</el-button
|
|
|
- >
|
|
|
+ <el-button type="primary" @click="addWork">确定</el-button>
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -392,11 +394,13 @@ export default {
|
|
|
isLoading: false,
|
|
|
formLabelWidth: "100px",
|
|
|
userid: this.$route.query.userid,
|
|
|
+ cid: this.$route.query.courseId,
|
|
|
oid: this.$route.query.oid,
|
|
|
mr: require("../assets/kc1.png"),
|
|
|
timu: [],
|
|
|
dialogVisible: false,
|
|
|
answerBox: "",
|
|
|
+ isNoHomeWork: false,
|
|
|
answer: [
|
|
|
{ name: "A.1568" },
|
|
|
{ name: "B.720" },
|
|
@@ -602,9 +606,74 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ addWork() {
|
|
|
+ if (this.upload[0].upImg.length == 0) {
|
|
|
+ this.$message.error("请上传图片");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // else if (this.upload[0].upVedio.length == 0) {
|
|
|
+ // this.$message.error("请上传视频");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ else if (this.upload[0].upIntro == "") {
|
|
|
+ this.$message.error("请填写简要描述");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.isNoHomeWork == true) {
|
|
|
+ this.$confirm(
|
|
|
+ "您已经提交了该作业了,如果您再提交将覆盖上次提交的作业!",
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ this.addSWork();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ } else {
|
|
|
+ this.addSWork();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addSWork() {
|
|
|
+ let params = {
|
|
|
+ uid: this.userid,
|
|
|
+ upload: JSON.stringify(this.upload),
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "insertSWork", params)
|
|
|
+ .then((res) => {
|
|
|
+ this.isNoHomeWork = true;
|
|
|
+ this.selectSWork();
|
|
|
+ // this.upload = res.data[0][0].upload;
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error("查询失败");
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ selectSWork() {
|
|
|
+ let params = {
|
|
|
+ uid: this.userid,
|
|
|
+ cid: this.cid,
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "selectSWork", params)
|
|
|
+ .then((res) => {
|
|
|
+ this.isNoHomeWork = true;
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error("提交失败");
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
search() {},
|
|
|
},
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.selectSWork();
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|