weijin 4 лет назад
Родитель
Сommit
e4ae954cdf

+ 6 - 2
src/components/QuestionCard/PrimaryQuestionCard.vue

@@ -26,7 +26,7 @@
         <el-button type="text" circle @click="isAllShow=!isAllShow"><strong>{{ isAllShowText }}</strong></el-button>
         <slot name="button">
           <!--按钮插槽,用于不同的卡片更换不同的按钮-->
-          <el-button type="primary" icon="el-icon-edit" circle @click="updateQuestion"/>
+          <el-button v-if="isDelete === false" type="primary" icon="el-icon-edit" circle @click="updateQuestion"/>
           <el-button v-if="isDelete === false" type="danger" icon="el-icon-delete" circle @click="deleteQuestion"/>
           <el-button v-else type="success" icon="el-icon-delete" circle @click="recoverQuestion"/>
         </slot>
@@ -129,7 +129,11 @@
       <div class="record-block">
         <el-row>
           <el-col :span="3">
-            <div><strong>状态: </strong>{{ questionVO.state }}</div>
+            <div><strong>状态: </strong>
+              <span v-if="questionVO.state === 'APPROVED'">已通过</span>
+              <span v-else-if="questionVO.state === 'REFUSED'">已拒绝</span>
+              <span v-else-if="questionVO.state === 'DELETED'">已删除</span>
+            </div>
           </el-col>
           <el-col :span="5">
             <div><strong>审核人: </strong>{{ checkedUserName }}</div>

+ 26 - 0
src/components/QuestionCreator/SingleQuestionCreator.vue

@@ -159,6 +159,32 @@ export default {
                 type: 'success'
               });
             }
+            this.form = {
+              id: null,
+              stem: "",
+              type: 1,
+              options: [
+                {
+                  label: "A",
+                  content: "",
+                },
+                {
+                  label: "B",
+                  content: "",
+                },
+                {
+                  label: "C",
+                  content: "",
+                }
+              ],
+              answer: null,
+              multi_answer: [],
+              analysis: "",
+              difficulty: null,
+              knowledgeId: [],
+              tags: "",
+              keyPoints: "",
+            };
             break;
           case "update":
             let old_question = JSON.parse(this.old_question);

+ 3 - 2
src/store/index.js

@@ -19,7 +19,7 @@ export default createStore({
     },
     setUser(state, user){
       state.user = user;
-      localStorage.setItem('user', user);
+      localStorage.setItem('user', JSON.stringify(user));
     },
     logout(state){
       state.token = null;
@@ -57,7 +57,8 @@ export default createStore({
       }
     },
     hasPermission: state => {
-      return state.user.role === 'ADMIN' || state.user.role === 'SEEC' || state.user.role === 'SEECX';
+      const user = JSON.parse(localStorage.getItem("user"));
+      return user.role === 'ADMIN' || user.role === 'SEEC' || user.role === 'SEECX';
     }
   },
   modules: {