Browse Source

lyh-new,too

gydx_2024_lyh 2 months ago
parent
commit
b2c8182377
1 changed files with 149 additions and 61 deletions
  1. 149 61
      src/views/system/bank/index.vue

+ 149 - 61
src/views/system/bank/index.vue

@@ -1,62 +1,89 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="问题描述" prop="questionText">
-        <el-input
-          v-model="queryParams.questionText"
-          placeholder="请输入问题描述"
+
+<!--      <el-form-item label="题型" prop="questionType">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.questionType"-->
+<!--          placeholder="请输入问题难度"-->
+<!--          clearable-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
+      <el-form-item label="题型" prop="questionType">
+        <el-select
+          v-model="queryParams.questionType"
+          placeholder="请选择题型"
           clearable
           @keyup.enter.native="handleQuery"
-        />
+        >
+          <el-option label="单选" value="单选" />
+          <el-option label="多选" value="多选" />
+        </el-select>
       </el-form-item>
       <el-form-item label="问题难度" prop="questionDiff">
-        <el-input
+        <el-select
           v-model="queryParams.questionDiff"
-          placeholder="请输入问题难度"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="A" prop="aChoice">
-        <el-input
-          v-model="queryParams.aChoice"
-          placeholder="请输入A"
+          placeholder="请选择问题难度"
           clearable
           @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="B" prop="bChoice">
-        <el-input
-          v-model="queryParams.bChoice"
-          placeholder="请输入B"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        >
+          <el-option label="简单" value="简单" />
+          <el-option label="中等" value="中等" />
+          <el-option label="困难" value="困难" />
+        </el-select>
       </el-form-item>
-      <el-form-item label="C" prop="cChoice">
-        <el-input
-          v-model="queryParams.cChoice"
-          placeholder="请输入C"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="D" prop="dChoice">
-        <el-input
-          v-model="queryParams.dChoice"
-          placeholder="请输入D"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="正确答案" prop="rightAnswer">
+
+
+      <el-form-item label="问题描述" prop="questionText">
         <el-input
-          v-model="queryParams.rightAnswer"
-          placeholder="请输入正确答案"
+          v-model="queryParams.questionText"
+          placeholder="请输入问题描述"
           clearable
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+
+<!--      <el-form-item label="A" prop="aChoice">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.aChoice"-->
+<!--          placeholder="请输入A"-->
+<!--          clearable-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="B" prop="bChoice">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.bChoice"-->
+<!--          placeholder="请输入B"-->
+<!--          clearable-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="C" prop="cChoice">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.cChoice"-->
+<!--          placeholder="请输入C"-->
+<!--          clearable-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="D" prop="dChoice">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.dChoice"-->
+<!--          placeholder="请输入D"-->
+<!--          clearable-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="正确答案" prop="rightAnswer">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.rightAnswer"-->
+<!--          placeholder="请输入正确答案"-->
+<!--          clearable-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -111,18 +138,56 @@
 
     <el-table v-loading="loading" :data="bankList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="问题ID" align="center" prop="questionId" />
-      <el-table-column label="问题描述" align="center" prop="questionText" />
-      <el-table-column label="问题类型" align="center" prop="questionType" />
-      <el-table-column label="问题难度" align="center" prop="questionDiff" />
-      <el-table-column label="A" align="center" prop="aChoice" />
-      <el-table-column label="B" align="center" prop="bChoice" />
-      <el-table-column label="C" align="center" prop="cChoice" />
-      <el-table-column label="D" align="center" prop="dChoice" />
-      <el-table-column label="正确答案" align="center" prop="rightAnswer" />
+      <el-table-column label="问题ID" align="center" prop="questionId"  v-if="false"/>
+
+      <el-table-column
+        label="题型"
+        align="center"
+        prop="questionType"
+        width="50"
+      />
+      <el-table-column
+        label="难度"
+        align="center"
+        prop="questionDiff"
+        width="50"
+      />
+
+
+      <el-table-column
+        prop="foodSupplierStatus"
+        label="是否校验"
+        align="center"
+        width="400"
+       >
+        <template v-slot="scope">
+          <el-switch
+            v-model="scope.row.foodSupplierStatus"
+            :active-value="1"
+            :inactive-value="0"
+          ></el-switch>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="问题描述" align="center" prop="questionText"  width="200" />
+
+      <el-table-column label="A" align="center" prop="aChoice"  v-if="false"/>
+      <el-table-column label="B" align="center" prop="bChoice"  v-if="false"/>
+      <el-table-column label="C" align="center" prop="cChoice"  v-if="false"/>
+      <el-table-column label="D" align="center" prop="dChoice"  v-if="false"/>
+      <el-table-column label="答案" align="center" prop="rightAnswer" width="50"/>
+      <el-table-column label="解释" align="center" prop="jieshi" width="500"/>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+
         <template slot-scope="scope">
           <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              @click="handleUpdate(scope.row)"
+              v-hasPermi="['system:bank:edit']"
+          >选项配置</el-button>
+          <el-button
             size="mini"
             type="text"
             icon="el-icon-edit"
@@ -139,7 +204,7 @@
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -151,25 +216,39 @@
     <!-- 添加或修改1题库对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="问题描述" prop="questionText">
+        <el-form-item label="题型" prop="questionType" v-if="tianjia">
+          <el-select v-model="form.questionType" placeholder="请选择题型" >
+            <el-option label="单选" value="单选" />
+            <el-option label="多选" value="多选" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="问题难度" prop="questionDiff" v-if="tianjia">
+          <el-select v-model="form.questionDiff" placeholder="请输入问题难度" >
+            <el-option label="简单" value="简单" />
+            <el-option label="中等" value="中等" />
+            <el-option label="困难" value="困难" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="题目文本" prop="questionText" v-if="tianjia">
           <el-input v-model="form.questionText" placeholder="请输入问题描述" />
         </el-form-item>
-        <el-form-item label="问题难度" prop="questionDiff">
-          <el-input v-model="form.questionDiff" placeholder="请输入问题难度" />
+        <el-form-item label="解释" prop="jieshi" v-if="tianjia">
+          <el-input v-model="form.jieshi" placeholder="请输入问题解释" />
         </el-form-item>
-        <el-form-item label="A" prop="aChoice">
+
+        <el-form-item label="A" prop="aChoice" v-if="xuanxiang">
           <el-input v-model="form.aChoice" placeholder="请输入A" />
         </el-form-item>
-        <el-form-item label="B" prop="bChoice">
+        <el-form-item label="B" prop="bChoice" v-if="xuanxiang">
           <el-input v-model="form.bChoice" placeholder="请输入B" />
         </el-form-item>
-        <el-form-item label="C" prop="cChoice">
+        <el-form-item label="C" prop="cChoice" v-if="xuanxiang">
           <el-input v-model="form.cChoice" placeholder="请输入C" />
         </el-form-item>
-        <el-form-item label="D" prop="dChoice">
+        <el-form-item label="D" prop="dChoice" v-if="xuanxiang">
           <el-input v-model="form.dChoice" placeholder="请输入D" />
         </el-form-item>
-        <el-form-item label="正确答案" prop="rightAnswer">
+        <el-form-item label="正确答案" prop="rightAnswer" v-if="xuanxiang">
           <el-input v-model="form.rightAnswer" placeholder="请输入正确答案" />
         </el-form-item>
       </el-form>
@@ -206,6 +285,8 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
+      tianjia:false,
+      xuanxiang:false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -242,6 +323,8 @@ export default {
     // 取消按钮
     cancel() {
       this.open = false;
+      this.xuanxiang=false;
+      this.tianjia=false;
       this.reset();
     },
     // 表单重置
@@ -279,6 +362,7 @@ export default {
     handleAdd() {
       this.reset();
       this.open = true;
+      this.tianjia=true;
       this.title = "添加1题库";
     },
     /** 修改按钮操作 */
@@ -288,6 +372,8 @@ export default {
       getBank(questionId).then(response => {
         this.form = response.data;
         this.open = true;
+        this.xuanxiang=true;
+        this.tianjia=true;
         this.title = "修改1题库";
       });
     },
@@ -305,6 +391,8 @@ export default {
             addBank(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
+              this.tianjia=false;
+              this.xuanxiang=false;
               this.getList();
             });
           }