Przeglądaj źródła

移除findTeachClass

OnePsycho 3 lat temu
rodzic
commit
6664bf8f97

+ 4 - 4
TEAMModelOS/ClientApp/src/components/homework/BaseHwForm.vue

@@ -231,10 +231,10 @@
 		},
 		created() {
 			/** 获取可选班级列表 */
-			this.getClassrooms(this.userInfo.TEAMModelId).then(res => {
-				console.log(res)
-				this.classRooms = res
-			})
+			// this.getClassrooms(this.userInfo.TEAMModelId).then(res => {
+			// 	console.log(res)
+			// 	this.classRooms = res
+			// })
 			this.voteFormEdit = this.editable
 		},
 		methods: {

+ 1 - 1
TEAMModelOS/ClientApp/src/components/questionnaire/BaseQnForm.vue

@@ -497,7 +497,7 @@
 		},
 		mounted() {
 			/** 获取可选班级列表 */
-			this.getClassrooms(this.userInfo.TEAMModelId).then(res => this.classRooms = res)
+			// this.getClassrooms(this.userInfo.TEAMModelId).then(res => this.classRooms = res)
 
 			/** 初始化问卷详情的富文本编辑器 */
 			let descriptionEditor = new E(this.$refs.descriptionEditor)

+ 0 - 48
TEAMModelOS/ClientApp/src/components/vote/BaseVoteForm.vue

@@ -233,12 +233,6 @@
 			}
 		},
 		created() {
-			/** 获取可选班级列表 */
-			this.getClassrooms(this.userInfo.TEAMModelId).then(res => {
-				console.log(res)
-				this.classRooms = res
-			})
-
 			this.findResearchList()
 			if (this.isAreaVote) {
 				this.getAreaTargets()
@@ -557,33 +551,6 @@
 				}
 			},
 
-			/**
-			 * 获取当前教师的所有班级数据
-			 * @param teacherId 老师的醍摩豆ID
-			 */
-			getClassrooms(teacherId) {
-				return new Promise((r, j) => {
-					this.$api.learnActivity.FindClassroomByTeacherId({
-						id: teacherId,
-						code: this.$store.state.userInfo.schoolCode
-					}).then(res => {
-						if (!res.error && res.courses) {
-							this.$store.dispatch('user/getSchoolProfile').then(schoolProfile => {
-								//    let schoolClasses =  schoolProfile.school_classes
-								// console.log(schoolClasses)
-								r(res.courses)
-							}).catch(err => {
-								r([])
-							})
-
-						} else {
-							j(500)
-							this.$Message.error(this.$t('vote.form.getDataFailTip'))
-						}
-					})
-				})
-			},
-
 			// 提取富文本内容中的文本
 			getSimpleText(html) {
 				var r = /<(?!img|video|audio).*?>/g;
@@ -742,21 +709,6 @@
 				})
 			},
 
-			/* 根据班级ID获取班级名称 */
-			getTargetName(classId) {
-				// if (this.classRooms.length) {
-				// 	let targetIndex = this.classRooms.map(i => i.id).indexOf(classId)
-				// 	return targetIndex > -1 ? this.classRooms[targetIndex].name : this.$t('vote.form.noMatchDataTip')
-				// } else {
-				// 	this.getClassrooms(this.userInfo.TEAMModelId).then(res => {
-				// 		return res.filter(i => i.id === classId)[0].name
-				// 	})
-				// }
-				console.log(classId);
-				return this.classNameArr.find(i => i.id === classId) ? this.classNameArr.find(i => i.id === classId).name :
-					this.$t('vote.form.noMatchDataTip')
-			},
-
 			/* 查找学校检验组信息 */
 			findResearchList() {
 				this.$api.schoolUser.getResearchGroup({

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/evaluation.js

@@ -21,7 +21,7 @@ export default {
 		collapseAll:'全部折叠',
 		autoCreate:'智能组卷',
 		manualCreate:'挑题组卷',
-		importCreate:'导题组卷',
+		importCreate:'文档导入',
 		backList:'返回列表'
 	},
 	filter:{

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/evaluation.js

@@ -21,7 +21,7 @@ export default {
 		collapseAll: '全部折疊',
 		autoCreate: '智慧組卷',
 		manualCreate: '挑題組卷',
-		importCreate: '導題組卷',
+		importCreate: '文檔導入',
 		backList: '返回列表'
 	},
 	filter: {

+ 5 - 6
TEAMModelOS/ClientApp/src/view/evaluation/bank/index.vue

@@ -27,24 +27,23 @@
 							<Icon type="md-hand" size="16"/>
 							<span>{{ $t('evaluation.index.manualCreate') }}</span>
 						</span>
-						<span @click="goCreatePaper('import')" class="bank-tools-btn">
+						<!-- <span @click="goCreatePaper('import')" class="bank-tools-btn">
 							<Icon type="md-folder" size="16"/>
 							<span>{{ $t('evaluation.index.importCreate') }}</span>
 							<Tooltip :content="$t('tip.importPaper')" class="common-toolTip" placement="bottom-end" theme="light" max-width="200">
 							    <Icon type="ios-information-circle-outline"/>
 							</Tooltip>
-						</span>
+						</span> -->
 					</div>
-					
 				</div>
 				
 				<span @click="goCreateExercise" v-show="currentTab === 'exercise' && ($access.can('admin.*||exercise-upd') || !isSchool)" class="bank-tools-btn">
 					<Icon type="md-add" size="16"/>
 					<span style="display: inline-block;margin-bottom: 2px;">{{ $t('evaluation.index.addExercise') }}</span>
 				</span>
-				<span @click="goCreatePaper('import',true)" v-show="currentTab === 'exercise'" class="bank-tools-btn">
-					<Icon type="md-archive"  size="16"/>
-					<span>批量导入</span>
+				<span @click="goCreatePaper('import',true)" class="bank-tools-btn">
+					<Icon type="md-folder"  size="16"/>
+					<span>{{ $t('evaluation.index.importCreate') }}</span>
 				</span>
 			</div>
 		</div>

+ 25 - 8
TEAMModelOS/ClientApp/src/view/evaluation/components/BasePasteTool.vue

@@ -55,6 +55,7 @@
 				} );
 			},
 			normalizeSpacing( htmlString ) {
+				htmlString = htmlString.replace( /<!--\[if gte vml 1]>/g, '' );
 				// Run normalizeSafariSpaceSpans() two times to cover nested spans.
 				return this.normalizeSafariSpaceSpans( this.normalizeSafariSpaceSpans( htmlString ) )
 					// Remove all \r\n from "spacerun spans" so the last replace line doesn't strip all whitespaces.
@@ -71,7 +72,6 @@
 		mounted() {
 			let stemEditor = new E(this.$refs.editor)
 			stemEditor.config.onchange = (html) => {
-				console.log(html);
 				this.stemContent = html
 			}
 			this.$editorTools.initSimpleEditor(stemEditor, this)
@@ -86,15 +86,30 @@
 					if (item.kind === "string" && item.type === 'text/html') {
 						item.getAsString(async (str) => {
 							// 先排查粘贴的内容里面是否包含图片
-							let html = that.normalizeSpacing(str)
+							console.log(that.normalizeSpacing(str))
+							let html = that.normalizeSpacing(str).replace(/[\r\n]/g, "") // 简化HTML字符串
+							let hasVshape = html.includes('</v:shape>')
+							let hasConvertImg = html.includes('<![endif]--><![if !vml]>')
 							let srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/ig;
-							let srcArr = html.match(srcReg)
-							let srcArrStr = str.match(srcReg)
-							console.log(srcArr);
-							console.log(srcArrStr);
+							let imgReg = /<img.*?(?:>|\/>)/gi;
+							let imagedataRef = /<v:imagedata.*?(?:>|\/>)/gi
+							let srcArr = []
+							let noImgMode = false
+							console.log(html)
+							// 如果没有v:shape 则代表是wps粘贴的 直接拿图片
+							if(!hasVshape || (hasVshape && hasConvertImg)){
+								srcArr = html.match(imgReg)
+							}else{
+								srcArr = html.match(imagedataRef)
+								noImgMode = true
+							}
+							console.error('匹配结果:',srcArr);
 							if(srcArr && srcArr.length){
 								// 如果有图片数据 则需要去唤起阅卷助手提供图片转换功能 把本地格式转换成base64
-								let localImgArr = srcArr.map(i => i.replace('src=','').replace("\"","").replace("\"",""))
+								let localImgArr = srcArr.map(i => i.match(srcReg)[0].replace('src=','').replace("\"","").replace("\"",""))
+								console.log(localImgArr)
+								// return
+								// let localImgArr = srcArr
 								// 检查助手是否已经开启
 								let isToolAlive = await that.checkTools()
 								if(isToolAlive){
@@ -102,7 +117,9 @@
 									let base64Arrs = await that.transBase64ByTool(localImgArr)
 									console.log('转换前的',html);
 									console.log(base64Arrs);
-									html = html.replace('v:imagedata', 'img')
+									if(noImgMode){
+										html = html.replace('v:imagedata', 'img')
+									}
 									// 获取到转换后的Base64要进行图片替换
 									localImgArr.forEach((i,index) => {
 										html = html.replace(i, base64Arrs[index])

+ 2 - 2
TEAMModelOS/ClientApp/src/view/evaluation/index/CreatePaper.vue

@@ -3,10 +3,10 @@
 		<div class="create-header">
 			<p class="create-header-title">
 				{{ isEditPaper ? $t('evaluation.paperList.editPaper') : evaluationInfo.createType === 'auto' ? $t('evaluation.index.autoCreate') : evaluationInfo.createType === 'import' ? $t('evaluation.importItems')  : $t('evaluation.index.manualCreate') }}
-				<Checkbox v-model="isGeneratePaper" v-if="evaluationInfo.createType === 'import'"
-					style="margin-left: 20px;" @on-change="onModeChange('paper')"> {{ $t('evaluation.composePaper') }}</Checkbox>
 				<Checkbox v-model="isSaveToBank" v-if="evaluationInfo.createType === 'import'"
 					style="margin-left: 20px;" @on-change="onModeChange('item')"> {{ $t('evaluation.syncItems') }}</Checkbox>
+				<Checkbox v-model="isGeneratePaper" v-if="evaluationInfo.createType === 'import'"
+					style="margin-left: 20px;" @on-change="onModeChange('paper')"> {{ $t('evaluation.composePaper') }}</Checkbox>
 			</p>
 			<div style="float: right;" class="common-save-btn">
 				<Button class="btn-save" type="text" icon="md-arrow-round-back"