SanHQin преди 10 месеца
родител
ревизия
8159847f19

+ 79 - 42
src/components/pages/classroomObservation/components/addNewCourseDialog.vue

@@ -1,24 +1,22 @@
 <template>
 	<div class="addNewCourse">
-		<el-dialog
-			title="添加课堂"
-			:visible.sync="dialogVisible"
-			width="500px"		>
-		<div>
-			<el-form ref="form" :model="form" label-position="top">
-			  <el-form-item label="课堂编号">
-  			  <el-input v-model="form.no" placeholder="请输入课堂编号"></el-input>
-  			</el-form-item>
-				<el-form-item label="课堂名称">
-  			  <el-input v-model="form.name" placeholder="请输入课堂名称"></el-input>
-  			</el-form-item>
-			</el-form>
-		</div>
+		<el-dialog title="添加课堂" :visible.sync="dialogVisible" width="500px">
+			<div>
+				<el-form ref="form" :model="form" :rules="rules" label-position="top">
+					<el-form-item label="课堂编号" prop="no">
+						<el-input v-model="form.no" placeholder="请输入课堂编号"></el-input>
+					</el-form-item>
+					<el-form-item label="课堂名称" prop="name">
+						<el-input
+							v-model="form.name"
+							placeholder="请输入课堂名称"
+						></el-input>
+					</el-form-item>
+				</el-form>
+			</div>
 			<span slot="footer" class="dialog-footer">
 				<el-button @click="dialogVisible = false">取 消</el-button>
-				<el-button type="primary" @click="submit()"
-					>确 定</el-button
-				>
+				<el-button type="primary" @click="submit('form')">确 定</el-button>
 			</span>
 		</el-dialog>
 	</div>
@@ -26,38 +24,77 @@
 
 <script>
 export default {
-	emits:["success"],
-	data(){
-		return{
-			dialogVisible:false,
-			form:{
-				no:"",
-				name:"",
+	emits: ["success"],
+	props: {
+		courseList: {
+			type: Array,
+			default: () => [],
+		},
+	},
+	data() {
+		let validateNo = (rule, value, callback) => {
+			console.log(this.courseList.findIndex(i=>i.value==value))
+			if (value.trim().length == 0) {
+				callback(new Error("请输入课堂编号"));
+			}else if(this.courseList.findIndex(i=>i.value==value.trim())!=-1){
+				callback(new Error("该课堂编号已存在"));
+			} else {
+				callback();
+			}
+		};
+		let validateName = (rule, value, callback) => {
+			console.log(this.courseList)
+			console.log(rule)
+			if (value.trim().length == 0) {
+				callback(new Error("请输入课堂名称"));
+			} else {
+				callback();
+			}
+		};
+		return {
+			dialogVisible: false,
+			form: {
+				no: "",
+				name: "",
+			},
+			rules: {
+				no: [{ validator: validateNo,trigger: "change" }],
+				name: [{ validator: validateName, trigger: "change" }],
 			},
-		}
+		};
 	},
-	methods:{
-		open(){
+	methods: {
+		open() {
 			this.form = {
-				name:"",
-				no:"",
-			}
+				name: "",
+				no: "",
+			};
 			this.dialogVisible = true;
 		},
-		submit(){
-			if(this.form.no.trim().length==0 || this.form.name.trim().length==0){//|| this.form.name.trim().length==0
-				this.$message.error("请填写完整信息")
-				return;
-			}
-			this.$emit("success",this.form)
-			this.dialogVisible = false;
-		}
-	}
+		submit(formName) {
+			this.$refs[formName].validate((valid) => {
+				if (valid) {
+					if (
+						this.form.no.trim().length == 0 ||
+						this.form.name.trim().length == 0
+					) {
+						//|| this.form.name.trim().length==0
+						this.$message.error("请填写完整信息");
+						return;
+					}
+					this.$emit("success", this.form);
+					this.dialogVisible = false;
+				} else {
+					console.log("error submit!!");
+					return false;
+				}
+			});
+		},
+	},
 };
 </script>
 
-<style  scoped>
-.addNewCourse{
-
+<style scoped>
+.addNewCourse {
 }
 </style>

+ 5 - 3
src/components/pages/classroomObservation/components/chatArea.vue

@@ -33,6 +33,7 @@
 			<!-- 原文速递 -->
 			<transcription
 				v-show="pageStatus == 1 && !showIndexPage"
+				:showGetTextLoading="showGetTextLoading"
 				:data="transcriptionData"
 			>
 				<!-- <el-button
@@ -53,6 +54,7 @@
 			<!-- <div class="t-t-m-Item" v-show="cardStatus==1"> -->
 			<EditorBar
 				class="editorBar"
+				:showGetTextLoading="showGetTextLoading"
 				v-model="editorBarData.content"
 				v-if="
 					pageStatus == 2 &&
@@ -482,6 +484,7 @@ export default {
 			textareaValue: "",
 			textareaLoading: false,
 			showRoleList: false,
+			showGetTextLoading:false,
 			roleListIndex: 0,
 			recordedForm: {
 				time: "00:00:00", //时间
@@ -1045,10 +1048,8 @@ export default {
 					flag = false;
 					_this.uploadFileLoading = false;
 				}
+				_this.showGetTextLoading = true;
 				let privText = e.privText;
-				privText+='_(转译中...)'
-				_this.transcriptionData.content.replaceAll("_(转译中...)","")
-				_this.editorBarData.content.replaceAll("_(转译中...)","")
 				_this.transcriptionData.content += privText;
 				_this.editorBarData.content += privText;
 			};
@@ -1056,6 +1057,7 @@ export default {
 			
 			iiframe.contentWindow.sessionStopped = function(e){
 				_this.$message.success("转译中完成")
+				_this.showGetTextLoading = false;
 				_this.transcriptionData.content.replaceAll("_(转译中...)","")
 				_this.editorBarData.content.replaceAll("_(转译中...)","")
 				_this.saveEditorBar();

+ 5 - 0
src/components/pages/classroomObservation/components/transcription.vue

@@ -6,6 +6,7 @@
 		</div> -->
 		<div class="t-content">
 			{{ data.content?data.content:"暂无..." }}
+			<span v-if="showGetTextLoading">_(转译中...)</span>
 			<!-- <div class="contentCon" v-for="(i, index) in chatList" :key="index">
 				<div class="conTim">{{ i.timer }}</div>
 				<div class="conTxt">
@@ -26,6 +27,10 @@ export default {
 				return {};
 			},
 		},
+		showGetTextLoading:{
+			type:Boolean,
+			default:false,
+		}
 	},
 	data() {
 		return {

+ 5 - 1
src/components/pages/classroomObservation/components/wangEnduit.vue

@@ -47,7 +47,11 @@ export default {
     placeholder: {
       type: String,
       default: "请输入正文"
-    }
+    },
+		showGetTextLoading:{
+			type:Boolean,
+			default:false,
+		}
   },
   watch: {
     isClear(val) {

+ 1 - 1
src/components/pages/classroomObservation/index.vue

@@ -113,7 +113,7 @@
 			@shareBtn="shareBtn"
 		></sharePdf>
 
-		<addNewCourseDialog ref="addNewCourseDialogRef" @success="addNewCourse" />
+		<addNewCourseDialog :courseList="optionData" ref="addNewCourseDialogRef" @success="addNewCourse" />
 	</div>
 </template>