SanHQin 1 year ago
parent
commit
b328070d0b

BIN
src/assets/icon/pblCourse/del.png


BIN
src/assets/icon/pblCourse/file1.png


+ 3 - 2
src/components/pages/classroomObservation/index.vue

@@ -34,7 +34,7 @@
 								<span style="float: left">{{ item.label }}</span>
 								<span
 									class="delSelect"
-									@click.stop="delCourse(item.value)"
+									@click.stop="delCourse(item.id)"
 									style="float: right"
 								></span>
 							</div>
@@ -285,7 +285,7 @@ export default {
 		home() {
 			this.$message.info("主页");
 		},
-		delCourse(_value = this.tid) {
+		delCourse(_value) {
 			this.$confirm("此操作将永久删除该课程, 是否继续?", "提示", {
 				confirmButtonText: "确定",
 				cancelButtonText: "取消",
@@ -379,6 +379,7 @@ export default {
 									? item.jsonData.courseName
 									: `${item.tId}课程`,
 								value: item.tId,
+								id:item.id
 							};
 						});
 						_optionData = _optionData.filter(

+ 19 - 10
src/components/pages/pblCourse/component/doWorkArea.vue

@@ -11,24 +11,24 @@
 			</div>
 		</div>
 		<div class="dw_work">
-			<work v-if="task" :task="task" @submitTask="down" @choiceAnswer="choiceAnswer" @getTaskList="getTaskList" :phase="phase"/>
+			<work v-if="task" :task="task" @submitTask="down" @choiceAnswer="choiceAnswer" @getTaskList="getTaskList" :phase="phase" @deleteFile="deleteFile" @addFile="addFile"/>
 			<div v-else>
 				<h3>等待生成数据...</h3>
 			</div>
 		</div>
-		<div class="dw_bottom">
+		<!-- <div class="dw_bottom">
 			<div class="dw_b_btn" @click.stop="submitTask()">
 				<img :src="require('../../../../assets/icon/pblCourse/bookIcon.png')">
 				<span>提交作业</span>
 			</div>
-		</div>	
+		</div>	 -->
 	</div>
 </template>
 
 <script>
 import work from './work'
 	export default {
-		emits:["changePhase","choiceAnswer","submitTask","getTaskList"],
+		emits:["changePhase","choiceAnswer","submitTask","getTaskList","deleteFile","addFile"],
 		props:{
 			phase:{
 				type:Object,
@@ -70,7 +70,13 @@ import work from './work'
 			},
 			getTaskList(_data){
 				this.$emit("getTaskList",_data)
-			}
+			},
+			deleteFile(index){
+				this.$emit("deleteFile",index)
+			},
+			addFile(obj){
+				this.$emit("addFile",obj)
+			},
 		}
 	}
 </script>
@@ -109,7 +115,7 @@ import work from './work'
 
 
 .dw_h_left>span{
-	font-size: 22px;
+	font-size: 24px;
 	font-weight: bold;
 }
 
@@ -134,12 +140,15 @@ import work from './work'
 	transform: rotate(180deg);
 }
 .dw_work{
-	width: calc(100% - 30px);
-	height: calc(100% - 60px - 100px - 30px);
+	width: 100%;
+	/* height: auto; */
+	height: calc(100% - 60px - 30px);
 	box-sizing: border-box;
-	margin: 0 15px;
+	/* margin: 0 15px; */
+	padding: 0 15px;
 	border-radius: 8px;
-	background-color: #F3F7FD;
+	overflow: auto;
+	/* background-color: #F3F7FD; */
 }
 
 .dw_bottom{

+ 1 - 1
src/components/pages/pblCourse/component/selectTopicDialog.vue

@@ -9,7 +9,7 @@
 			:close-on-press-escape="false"
       v-loading="loading"
     >
-      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+      <el-form ref="form" :model="form" :rules="rules" label-width="100px" @submit.native.prevent="() => submitFrom('form')">
         <el-form-item label="选题:" prop="title">
           <el-input v-model="form.title"></el-input>
         </el-form-item>

+ 297 - 8
src/components/pages/pblCourse/component/work.vue

@@ -1,5 +1,5 @@
 <template>
-	<div class="work" ref="workRef">
+	<div class="work" ref="workRef" v-loading="loading">
 		<div class="w_nowWork">
 			<div class="w_nw_header">
 				<div class="w_nw_h_title">
@@ -39,13 +39,43 @@
 					</div>
 				</div>
 		</div>
+		<div class="w_submitWork">
+			<div class="w_sw_header">
+				<div class="w_sw_h_title">
+					<img :src="require('../../../../assets/icon/pblCourse/bookIcon.png')">
+					<span>提交作业</span>
+					<div class="w_sw_h_t_brief">(支持txt、doc、xlsx、png、jpg、jpeg、wav格式的文件上传)</div>
+				</div>
+				<div class="w_sw_h_controls">
+					<span @click="uploadFile">上传</span>
+					<span class="w_sw_h_t_submit" @click.stop="submitTask2()">提交</span>
+				</div>
+			</div>
+			<div class="w_sw_fileBox" v-if="task.fileList.length>0">
+				<div :class="['w_sw_fb_item',index%2!==0?'w_sw_fb_item2':'']" v-for="(item,index) in task.fileList" :key="index">
+					<div class="w_sw_fb_i_left" @click="previewFile(item)">
+						<img :src="require('../../../../assets/icon/pblCourse/file1.png')">
+						<span>{{ item.fileName }}</span>
+					</div>
+					<div class="w_sw_fb_i_right">
+						<el-tooltip class="item" effect="light" content="删除" placement="top">
+							<span class="w_sw_fb_i_r_delete" @click.stop="delFile(item,index)">
+							<img :src="require('../../../../assets/icon/pblCourse/del.png')">
+						</span>
+    			</el-tooltip>
+						
+					</div>
+				</div>
+			</div>
+		</div>
 	</div>
 </template>
 
 <script>
 	import MarkdownIt from "markdown-it";
+	import '@/common/aws-sdk-2.235.1.min.js'
 	export default {
-		emits:['choiceAnswer','submitTask',"getTaskList"],
+		emits:['choiceAnswer','submitTask',"getTaskList","deleteFile","addFile"],
 		props:{
 			task:{
 				type:Object,
@@ -76,6 +106,7 @@
 				steps:"",
 				target:"",
 				tips:"",
+				loading:false,
 			}
 		},
 		computed:{
@@ -112,6 +143,91 @@
 			submitTask(){
 				if((this.phase.doPhase>this.phase.atPhase) || this.phase.doPhase>=5)return this.$message.error("该阶段已提交过了")
 				this.$emit("submitTask")
+			},
+			submitTask2(){
+				return console.log('第二个提交')
+			},
+			uploadFile(){
+			let input = document.createElement("input");
+			input.type = "file";
+			input.accept = "*";
+			input.click();
+			input.onchange = () => {
+				this.uploadFileLoading = true;
+				let file = input.files[0];
+				// if(!/\.(wav|txt|pdf|xlsx|doc|docx)$/i.test(file.name)){
+				// 	this.uploadFileLoading = false;
+				// 	return this.$message.info("请上传.wav,.txt,.pdf,.xlsx,.doc,.docx格式的文件")
+				// }
+				var credentials = {
+				accessKeyId: "AKIATLPEDU37QV5CHLMH",
+				secretAccessKey: "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",
+			}; //秘钥形式的登录上传
+			window.AWS.config.update(credentials);
+			window.AWS.config.region = "cn-northwest-1"; //设置区域
+
+			var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
+			var _this = this;
+
+			if (file) {
+				this.loading = true;
+				var params = {
+					Key:
+						file.name.split(".")[0] +
+						new Date().getTime() +
+						"." +
+						file.name.split(".")[file.name.split(".").length - 1],
+					ContentType: file.type,
+					Body: file,
+					"Access-Control-Allow-Credentials": "*",
+					ACL: "public-read",
+				}; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
+				var options = {
+					partSize: 2048 * 1024 * 1024,
+					queueSize: 2,
+					leavePartsOnError: true,
+				};
+				bucket
+					.upload(params, options)
+					.on("httpUploadProgress", function (evt) {
+						//这里可以写进度条
+						// console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
+					})
+					.send(function (err, data) {
+						if (err) {
+							_this.$message.error("上传失败");
+							_this.loading = false;
+						} else {
+							_this.loading = false;
+							_this.$emit("addFile",{
+									fileName:data.key,
+									url:data.Location,
+							})
+							// _this.fileList.push({
+							// 	fileName:data.key,
+							// 	url:data.Location,
+							// })
+							console.log(data);
+						}
+					});
+				}
+			}
+			},
+			delFile(_item,_index){
+				this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning'
+				}).then(() => {
+					this.$emit("deleteFile",_index)
+					// this.fileList.splice(_index,1);
+				}).catch(_=>{
+					console.log("取消删除")
+				});
+				
+			},
+			previewFile(_item){
+				this.$message.info(`预览文件:${_item.filename}`)
 			}
 		}
 	}
@@ -120,10 +236,9 @@
 <style scoped>
 .work{
 	width: 100%;
-	max-height: 100%;
-	overflow: auto;
+	height: auto;
 	box-sizing: border-box;
-	padding: 25px;
+	/* padding: 25px; */
 	/* background-color: aqua; */
 }
 
@@ -131,6 +246,10 @@
 	width: 100%;
 	height: auto;
 	margin-bottom: 20px;
+	background-color: #F3F7FD;
+	box-sizing: border-box;
+	padding: 20px;
+	border-radius: 8px;
 }
 
 .w_nw_header{
@@ -190,7 +309,7 @@
 }
 
 .w_nw_introduce>div{
-	margin: 10px 0px;
+	margin: 20px 0px;
 }
 
 .w_nw_introduce >>> ol{
@@ -222,6 +341,12 @@
 .w_doWork{
 	width: 100%;
 	height: auto;
+	box-sizing: border-box;
+	padding: 20px;
+	background-color: #F3F7FD;
+	margin-bottom: 20px;
+	border-radius: 8px;
+
 }
 
 .w_dw_header{
@@ -305,7 +430,7 @@
 }
 
 .w_dw_w_title{
-	font-size: 24px;
+	font-size: 20px;
 	font-weight: bold;
 }
 
@@ -324,7 +449,7 @@
 }
 
 .w_dw_w_r_g_item>>>.el-radio__label{
-	font-size: 22px;
+	font-size: 16px;
 }
 
 .w_dw_w_r_g_item>>>.el-radio__inner{
@@ -332,4 +457,168 @@
 	height: 20px;
 	margin-right: 5px;
 }
+
+.w_submitWork{
+	width: 100%;
+	height: auto;
+	background-color: #F3F7FD;
+	margin-bottom: 20px;
+	box-sizing: border-box;
+	padding: 20px;
+	border-radius: 8px;
+}
+
+.w_sw_header{
+	width: 100%;
+	display: flex;
+	justify-content: space-between;
+	align-items: center;
+	height: 35px;
+}
+
+.w_sw_h_title{
+	display: flex;
+	align-items: center;
+}
+
+.w_sw_h_title>img{
+	width: 50px;
+	height: 50px;
+	margin-right: 10px;
+}
+
+.w_sw_h_title>span{
+	font-size: 24px;
+	font-weight: bold;
+	background: linear-gradient(to right, #3673E8, #AD88FD);
+	-webkit-background-clip: text;
+	color: transparent;
+}
+
+.w_sw_h_t_brief{
+	font-size: 20px !important;
+	color:#00000066 !important;
+	font-weight: 400 !important;
+	margin-left: 20px;
+}
+
+.w_sw_h_controls{
+	display: flex;
+	align-items: center;
+}
+
+.w_sw_h_controls>span{
+	font-size: 16px;
+	margin-left: 20px;
+	cursor: pointer;
+	transition: .3s;
+	box-sizing: border-box;
+	/* padding: 0 15px; */
+	padding: 0 23px;
+	background-color: white;
+	height: 35px;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+	border-radius: 100px;
+	border: solid 1px #AD88FD;
+	/* 不可选中 */
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.w_sw_h_controls>span:hover{
+	background-color: rgb(248, 246, 246);
+}
+
+.w_sw_h_t_submit{
+	background:linear-gradient(to right,#6082E5,#A293F3);
+	color: white;
+}
+
+.w_sw_fileBox{
+	width: 100%;
+	height: auto;
+	margin-top: 20px;
+	display: flex;
+	flex-wrap: wrap;
+}
+
+.w_sw_fb_item{
+	width: 49.5%;
+	height: 45px;
+	margin-bottom: 10px;
+	margin-right: 1%;
+	display: flex;
+	align-items: center;
+	justify-content: space-between;
+	box-sizing: border-box;
+	padding: 0 10px;
+	background-color: #FFFFFF;
+	border: solid 1px #E7E7E7;
+	border-radius: 4px;
+	position: relative;
+}
+
+.w_sw_fb_item:hover{
+	border: solid 1px #3681FC;
+}
+
+.w_sw_fb_item2{
+	margin-right: 0 !important;
+}
+
+.w_sw_fb_i_left{
+	width: calc(100% - 80px);
+	cursor: pointer;
+	display: flex;
+	align-items: center;
+	position: relative;
+}
+
+.w_sw_fb_i_left>span{
+	/* 字体溢出隐藏 */                   
+	width: 80%;
+	display: block;
+	white-space: nowrap;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	
+}
+
+.w_sw_fb_i_left>img{
+	width: 30px;
+	height: 30px;
+	margin-right: 10px;
+}
+
+.w_sw_fb_i_right{
+	width: 80px;
+	display: flex;
+	align-items: center;
+	justify-content: flex-end;
+	height: auto;
+}
+
+.w_sw_fb_item:hover .w_sw_fb_i_r_delete{
+	display: flex;
+}
+
+.w_sw_fb_i_right>span{
+	width: 30px;
+	height: 30px;
+	background-color: #F3F7FD;
+	display: none;
+	border-radius: 4px;
+	justify-content: center;
+	align-items: center;
+	cursor: pointer;
+}
+
+.w_sw_fb_i_right>span>img{
+	width: 25px;
+	height: 25px;
+}
 </style>

+ 17 - 4
src/components/pages/pblCourse/index.vue

@@ -5,7 +5,7 @@
 				<procedureArea :phase="phase" />
 			</div>
 			<div class="pc_l_bottom">
-				<doWorkArea :phase="phase" @changePhase="changePhase" @choiceAnswer="choiceAnswer" @submitTask="submitTask" :task="taskList[phase.atPhase]" @getTaskList="getTaskList"/>
+				<doWorkArea :phase="phase" @changePhase="changePhase" @choiceAnswer="choiceAnswer" @submitTask="submitTask" :task="taskList[phase.atPhase]" @getTaskList="getTaskList" @addFile="addFile" @deleteFile="deleteFile"/>
 			</div>
 		</div>
 		<div class="pc_right">
@@ -48,6 +48,10 @@ export default {
 				if(this.loading)return this.$message.info("请稍等")
 			this.loading = true;
 		const _uuid = uuidv4()
+		let _copyTask = JSON.parse(JSON.stringify(this.taskList))
+		if(this.phase.doPhase!=0){
+			delete _copyTask[this.phase.doPhase-1].fileList;
+		}
 		const _msg = `
 NOTICE
 Role: 作为学生的学习指导Agent,你熟悉熟悉PBL(基于问题的学习)和5EX教学模型,能够根据学生的学情数据(当前的学习任务设计、学习表现数据、作业数据等)生成自适应的学习任务和对应的5道考核题目。
@@ -85,7 +89,7 @@ Evaluate(评估):教师和学生共同评估学习效果,反思学习过
 
 ## 学情数据
 选题:${this.selectTopic}
-${this.phase.doPhase==0?'':`这是你生成适应性学习任务时,需要参考的前置学情数据${JSON.stringify(this.taskList[this.phase.doPhase-1])}(当前的学习任务设计、学习表现数据、作业数据等)。`}
+${this.phase.doPhase==0?'':`这是你生成适应性学习任务时,需要参考的前置学情数据${JSON.stringify(_copyTask[this.phase.doPhase-1])}(当前的学习任务设计、学习表现数据、作业数据等)。`}
 
 # Format example
 {
@@ -145,6 +149,7 @@ Instruction: Based on the context, follow "Format example", write content.
 				_result.steps = _result.steps?_result.steps:"",
 				_result.target = _result.target?_result.target:"",
 				_result.tips =_result.tips?_result.tips:""
+				_result.fileList = [];
 				this.taskList[phase] = _result;
 				// this.phase.doPhase = phase;
 				this.phase.atPhase = phase;
@@ -202,10 +207,17 @@ Instruction: Based on the context, follow "Format example", write content.
 				this.getTaskList()
 				this.$refs.selectTopicDialogRef.close();
 			}
-		}
+		},
+		addFile(obj){
+			this.taskList[this.phase.atPhase].fileList.push(obj)
+			this.$forceUpdate()
+		},
+		deleteFile(index){
+			this.taskList[this.phase.atPhase].fileList.splice(index,1)
+			this.$forceUpdate()
+		},
 	},
 	mounted() {
-		
 		this.selectTopic = "";
 		this.$refs.selectTopicDialogRef.open();
 		// this.getTaskList()
@@ -223,6 +235,7 @@ Instruction: Based on the context, follow "Format example", write content.
 	background-color: #f0f2f5;
 	box-sizing: border-box;
 	padding: 20px;
+	background-image: radial-gradient( #C6D6FF,#D0D1FE, #F3F7FF);
 }
 
 .pc_left {