Quellcode durchsuchen

先提交一下又有别的事了

zhaosongshan vor 7 Monaten
Ursprung
Commit
ab766d6cfb
2 geänderte Dateien mit 107 neuen und 2 gelöschten Zeilen
  1. 62 0
      src/views/exm/exampaper/Show.vue
  2. 45 2
      src/views/exm/exampaper/form.vue

+ 62 - 0
src/views/exm/exampaper/Show.vue

@@ -0,0 +1,62 @@
+<template>
+  <div style="line-height:1.8">
+    <div v-if="qType==1" v-loading="qLoading">
+      <div class="q-title" v-html="question.title"/>
+      <div class="q-content">
+          <span :key="item.id" v-for="item in question.items" class="q-item-contain">
+            <span class="q-item-prefix">{{item.prefix}}</span>
+            <span v-html="item.content" class="q-item-content"></span>
+          </span>
+      </div>
+    </div>
+    <div v-else-if="qType==2" v-loading="qLoading">
+      <div class="q-title" v-html="question.title"/>
+      <div class="q-content">
+          <span :key="item.id" v-for="item in question.items" class="q-item-contain">
+            <span class="q-item-prefix">{{item.prefix}}</span>
+            <span v-html="item.content" class="q-item-content"></span>
+          </span>
+      </div>
+    </div>
+    <div v-else-if="qType==3" v-loading="qLoading">
+      <div class="q-title" v-html="question.title" style="display: inline;margin-right: 10px"/>
+      <span>(</span>
+      <span :key="item.id" v-for="item in question.items">
+        <span v-html="item.content" class="q-item-content"></span>
+       </span>
+      <span>)</span>
+    </div>
+    <div v-else-if="qType==4" v-loading="qLoading">
+      <div class="q-title" v-html="question.title"/>
+    </div>
+    <div v-else-if="qType==5" v-loading="qLoading">
+      <div class="q-title" v-html="question.title"/>
+    </div>
+    <div v-else>
+    </div>
+  </div>
+
+</template>
+
+<script>
+export default {
+  name: 'QuestionShow',
+  props: {
+    question: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    },
+    qLoading: {
+      type: Boolean,
+      default: false
+    },
+    qType: {
+      type: Number,
+      default: 0
+    }
+  },
+  methods: {}
+}
+</script>

+ 45 - 2
src/views/exm/exampaper/form.vue

@@ -39,12 +39,33 @@
             </a-form-item>
 
 
+			<a-form-item :key="index" :label="'标题'+(index+1)+':'" required v-for="(titleItem,index) in titleItems">
+				<a-input v-model="titleItem.name" style="width: 65%"/>
+				<a-button  style="margin-left: 20px" @click="addQuestion(titleItem)">添加题目</a-button>
+				<a-button  style="margin-left: 20px;background-color: red;"  @click="titleItems.splice(index,1)" type="primary">删除</a-button>
+				<a-card class="exampaper-item-box" v-if="titleItem.questionItems.length!==0">
+					<a-form-item :key="questionIndex" :label="'题目'+(questionIndex+1)+':'"
+								  v-for="(questionItem,questionIndex) in titleItem.questionItems" style="margin-bottom: 15px">
+						<a-row>
+							<a-col :span="23">
+								<QuestionShow :qType="questionItem.questionType" :question="questionItem"/>
+							</a-col>
+							<a-col :span="1">
+								<a-button @click="titleItem.value.questionItems.splice(questionIndex,1)">删除</a-button>
+							</a-col>
+						</a-row>
+					</a-form-item>
+				</a-card>
+			</a-form-item>
+
+
+
 			<a-form-item label="建议时长:" name="suggestTime">
-				<a-input-number id="inputNumber" width="100%" v-model:value="formData.suggestTime" :min="1" :max="180" placeholder="请输入建议时长" allow-clear/>
+				<a-input-number id="inputNumber" width="100%" v-model:value="formData.suggestTime" :min="1" :max="180" placeholder="分钟" allow-clear/>
 			</a-form-item>
         </a-form>
         <template #footer>
-			<a-button style="margin-right: 8px" @click="onClose">添加标题</a-button>
+			<a-button style="margin-right: 8px" @click="addTitle">添加标题</a-button>
             <a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
             <a-button type="primary" @click="onSubmit" :loading="submitLoading">保存</a-button>
         </template>
@@ -99,8 +120,30 @@
 	const gradeLevelOptions = tool.dictList('SEMESTER')
 	const susbjectOptions = tool.dictList('SUBJECT')
 	const paperTypeOptions = tool.dictList('PAPER_TYPE')
+	const titleItems =  ref([])
+	const currentTitleItem = ref(null)
+	const addTitle = () => {
+		titleItems.value.push({
+			name: '',
+			questionItems: []
+		})
+	}
+	const addQuestion = (titleItem) =>{
+		currentTitleItem.value = titleItem
+		this.questionPage.showDialog = true
+		this.search()
+	}
 	// 抛出函数
     defineExpose({
         onOpen
     })
 </script>
+<style>
+.exampaper-item-box {
+	.q-title {
+		margin: 0px 5px 0px 5px;
+	}
+	.q-item-content {
+	}
+}
+</style>