SanHQin 9 months ago
parent
commit
70239c48a1

+ 18 - 0
src/components/pages/classroomObservation/components/analysisTemplateDialog.vue

@@ -257,6 +257,18 @@
 										@click.stop="useAnalysis(analysisDetail)"
 										>使用</el-button
 									>
+									<el-button
+										v-if="tagBox == 2 && (!defaultData || defaultData.id!=analysisDetail.id)"
+										type="primary"
+										@click.stop="setDefault(analysisDetail)"
+										>设为默认</el-button
+									>
+									<el-button
+										v-if="tagBox == 2 && defaultData && defaultData.id==analysisDetail.id"
+										type="info"
+										:disabled="true"
+										>已设为默认</el-button
+									>
 								</div>
 							</div>
 							<div class="ad_h_bottom">
@@ -355,6 +367,7 @@ export default {
 				{ value: "9", label: "地理" },
 				{ value: "10", label: "政治" },
 			],
+			defaultData:{"id":"45413212-2956-11ef-bee5-005056b86db5","name":"科学通用模板","detail":"针对性分析科学课堂,包含通用分析模块以及科学学科分析模块,并采用5E和5EX课程设计模型对课堂进行改编。","open":"1","userid":"qgt","type":"4","use":0,"update_at":"2024-06-13T07:21:48.000Z","create_at":"2024-06-13T07:21:48.000Z"},
 			templateData: [],
 			collectData: [],
 			analysisDetail: null,
@@ -730,6 +743,11 @@ export default {
 			this.tagBox = 0;
 			this.analysisDetail = null;
 		},
+		//设置默认
+		setDefault(_data){
+			if(this.defaultData.id==_data.id)return;
+			this.$message.info("设置默认");
+		}
 	},
 };
 </script>

+ 47 - 45
src/components/pages/classroomObservation/components/chatArea.vue

@@ -389,17 +389,17 @@ import startPage from "./startPage";
 import transcription from "./transcription";
 import tape from "./tape";
 import { v4 as uuidv4 } from "uuid";
-import Recorder from "js-audio-recorder";
+// import Recorder from "js-audio-recorder";
 import MarkdownIt from "markdown-it";
 import EditorBar from "./wangEnduit";
 const lamejs = require("lamejs");
 import vpdf from "./vpdf";
-const recorder = new Recorder({
-	sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
-	sampleRate: 48000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
-	numChannels: 1, // 声道,支持 1 或 2, 默认是1
-	// compiling: false,(0.x版本中生效,1.x增加中) // 是否边录边转换,默认是false
-});
+// const recorder = new Recorder({
+// 	sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
+// 	sampleRate: 48000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
+// 	numChannels: 1, // 声道,支持 1 或 2, 默认是1
+// 	// compiling: false,(0.x版本中生效,1.x增加中) // 是否边录边转换,默认是false
+// });
 
 // 绑定事件-打印的是当前录音数据
 // recorder.onprogress = function (params) {
@@ -725,6 +725,8 @@ export default {
 				this.recordedForm.timeDuration = 0;
 				this.recordedForm.startTime = 1;
 				this.recordedForm.endTime = 0;
+				this.showIndexPage = false;
+				this.pageStatus = 2;
 				// 录音开始
 				iiframe.contentWindow.onRecognizedResult = (e) => {
 					// let e = {
@@ -734,7 +736,7 @@ export default {
 					if (flag) {
 						this.controlsStatus = 1;
 						this.showIndexPage = false;
-						this.pageStatus = 1;
+						this.pageStatus = 2;
 						this.editorBarData.type = "0";
 						flag = false;
 						this.uploadFileLoading = false;
@@ -1312,42 +1314,42 @@ export default {
 		noShowRoleList() {
 			this.showRoleList = false;
 		},
-		convertToMp3(wavDataView) {
-			// 获取wav头信息
-			const wav = lamejs.WavHeader.readHeader(wavDataView); // 此处其实可以不用去读wav头信息,毕竟有对应的config配置
-			const { channels, sampleRate } = wav;
-			const mp3enc = new lamejs.Mp3Encoder(channels, sampleRate, 128);
-			// 获取左右通道数据
-			const result = recorder.getChannelData();
-			const buffer = [];
-			const leftData =
-				result.left &&
-				new Int16Array(result.left.buffer, 0, result.left.byteLength / 2);
-			const rightData =
-				result.right &&
-				new Int16Array(result.right.buffer, 0, result.right.byteLength / 2);
-			const remaining = leftData.length + (rightData ? rightData.length : 0);
-			const maxSamples = 1152;
-			for (let i = 0; i < remaining; i += maxSamples) {
-				const left = leftData.subarray(i, i + maxSamples);
-				let right = null;
-				let mp3buf = null;
-				if (channels === 2) {
-					right = rightData.subarray(i, i + maxSamples);
-					mp3buf = mp3enc.encodeBuffer(left, right);
-				} else {
-					mp3buf = mp3enc.encodeBuffer(left);
-				}
-				if (mp3buf.length > 0) {
-					buffer.push(mp3buf);
-				}
-			}
-			const enc = mp3enc.flush();
-			if (enc.length > 0) {
-				buffer.push(enc);
-			}
-			return new Blob(buffer, { type: "audio/mp3" });
-		},
+		// convertToMp3(wavDataView) {
+		// 	// 获取wav头信息
+		// 	const wav = lamejs.WavHeader.readHeader(wavDataView); // 此处其实可以不用去读wav头信息,毕竟有对应的config配置
+		// 	const { channels, sampleRate } = wav;
+		// 	const mp3enc = new lamejs.Mp3Encoder(channels, sampleRate, 128);
+		// 	// 获取左右通道数据
+		// 	const result = recorder.getChannelData();
+		// 	const buffer = [];
+		// 	const leftData =
+		// 		result.left &&
+		// 		new Int16Array(result.left.buffer, 0, result.left.byteLength / 2);
+		// 	const rightData =
+		// 		result.right &&
+		// 		new Int16Array(result.right.buffer, 0, result.right.byteLength / 2);
+		// 	const remaining = leftData.length + (rightData ? rightData.length : 0);
+		// 	const maxSamples = 1152;
+		// 	for (let i = 0; i < remaining; i += maxSamples) {
+		// 		const left = leftData.subarray(i, i + maxSamples);
+		// 		let right = null;
+		// 		let mp3buf = null;
+		// 		if (channels === 2) {
+		// 			right = rightData.subarray(i, i + maxSamples);
+		// 			mp3buf = mp3enc.encodeBuffer(left, right);
+		// 		} else {
+		// 			mp3buf = mp3enc.encodeBuffer(left);
+		// 		}
+		// 		if (mp3buf.length > 0) {
+		// 			buffer.push(mp3buf);
+		// 		}
+		// 	}
+		// 	const enc = mp3enc.flush();
+		// 	if (enc.length > 0) {
+		// 		buffer.push(enc);
+		// 	}
+		// 	return new Blob(buffer, { type: "audio/mp3" });
+		// },
 		wavFileGetText(audioFile) {
 			let flag = true;
 			let textList = [];
@@ -1364,7 +1366,7 @@ export default {
 					// _this.uploadWavFile(audioFile);
 					_this.controlsStatus = 2;
 					_this.showIndexPage = false;
-					_this.pageStatus = 1;
+					_this.pageStatus = 2;
 					_this.editorBarData.type = "0";
 					flag = false;
 					_this.uploadFileLoading = false;

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

@@ -293,7 +293,7 @@ export default {
   width: 100%;
   display: flex;
   align-items: center;
-  border: 1px solid #e7e7e7;
+  /*border: 1px solid #e7e7e7;*/
   border-radius: 4px;
   height: 35px;
   padding: 0 7px;