yellowtaotao 3 éve
szülő
commit
f294acaad2

+ 4 - 4
src/plugins/modules/axios.js

@@ -1,7 +1,7 @@
 "use strict";
 
 import axios from "axios";
-import store from "@/store";
+// import store from "@/store";
 import { getCookie } from "@/utils/cookie";
 import { AUTH_TOKEN_FRONT, AUTH_TOKEN_END } from "@/common/Constant";
 import { getAllPromise } from "@/utils/tools";
@@ -109,9 +109,9 @@ _axios.interceptors.response.use(
     }
     let status = error.response.status;
     if (status === 401) {
-      message.error("您的登录已过期,请重新登录");
-      window.location.reload();
-      store.dispatch("user/logout");
+      // message.error("您的登录已过期,请重新登录");
+      // window.location.reload();
+      // store.dispatch("user/logout");
       return Promise.reject(error);
     }
     if (status < 200) {

+ 32 - 13
src/views/articleManagement/articleCarouselUpload.vue

@@ -42,7 +42,7 @@
                 title="点击放大"
                 fit="contain"
               />
-              <a title="绑定文章">
+              <a title="关联文章">
                 <a-icon
                   class="carousel-item-icon carousel-item-reddit"
                   type="reddit"
@@ -56,6 +56,10 @@
                   @click="handleDeleteCarousel(item)"
                 />
               </a>
+              <div class="carousel-item-bind">
+                已关联文章:
+                {{ item.materialId ? item.materialTitle : '无' }}
+              </div>
             </div>
           </div>
         </viewer>
@@ -67,7 +71,7 @@
         copyright © 浮游科技有限公司出品
       </span>
     </div> -->
-    <!-- 绑定文章弹框 -->
+    <!-- 关联文章弹框 -->
     <a-modal
       class="article-carousel-bind-modal"
       :title="carouselTitle"
@@ -130,7 +134,7 @@
               <span class="exam-question-edit-search-title">搜索:</span>
               <a-input-search
                 v-model="searchInputVal"
-                placeholder="请输入试题内容关键字"
+                placeholder="请输入文章标题关键字"
                 :maxLength="100"
                 @search="searchInputFun"
               />
@@ -149,7 +153,7 @@
             slot="action"
             slot-scope="text, record"
             @click="handleArticleBindCarousel(record)"
-            >绑定</a
+            >关联</a
           >
         </a-table>
         <!-- 分页 -->
@@ -181,9 +185,9 @@ export default {
       headers: {
         authorization: 'authorization-text',
       },
-      carouselTitle: '绑定文章', // 轮播图绑定文章弹框标题
+      carouselTitle: '关联文章', // 轮播图关联文章弹框标题
       carouselList: [], // 已有轮播图列表
-      toBindCarouselData: null, // 将要绑定文章的轮播图信息
+      toBindCarouselData: null, // 将要关联文章的轮播图信息
       isVisible: false, // 弹框是否可见
       articleTypeList: [], // 文章类型列表
       articleArticleType: '', // 所选文章类型
@@ -240,7 +244,7 @@ export default {
     // 查询:轮播图列表
     getCarouselListFun() {
       let params = {
-        num: 10,
+        num: 100,
       };
       this.$_http
         .get(this.$_API.INTERFACE_GET_CAROUSELS_LIST, { params })
@@ -450,19 +454,19 @@ export default {
     onChangePagesize() {
       this.getArticleListFun(); // 查询:文章列表数据
     },
-    // 操作:绑定文章
+    // 操作:关联文章
     handleArticleBindCarousel(record) {
       if (!record || !record.id) {
         return;
       }
       let that = this;
       that.$confirm({
-        title: '轮播图绑定文章',
-        content: `确认绑定文章 ${record.name} 吗?`,
+        title: '轮播图关联文章',
+        content: `确认关联文章 ${record.name} 吗?`,
         okText: '确认',
         cancelText: '取消',
         onOk() {
-          that.carouselEdit(record); // 编辑轮播图文章绑定
+          that.carouselEdit(record); // 编辑轮播图文章关联
         },
         onCancel() {},
       });
@@ -483,9 +487,9 @@ export default {
         .then((res) => {
           if (res.success && res.data) {
             if (this.toBindCarouselData.isUpload) {
-              this.$message.success(`成功上传一张轮播图并绑定了文章`);
+              this.$message.success(`成功上传一张轮播图并关联了文章`);
             } else {
-              this.$message.success(`修改绑定文章成功`);
+              this.$message.success(`修改关联文章成功`);
             }
           } else {
             this.$message.error(`${res.data || res.message}`);
@@ -602,6 +606,21 @@ export default {
           border-color: @mainColorBlueNormal;
         }
       }
+      .carousel-item-bind {
+        height: 42px;
+        line-height: 42px;
+        position: absolute;
+        bottom: 0;
+        left: 0;
+        right: 0;
+        padding: 0 @paddingMarginVal;
+        background-color: rgba(0, 0, 0, 0.3);
+        font-size: 14px;
+        color: @mainColorWhite;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        overflow: hidden;
+      }
     }
     .carousel-item-margin {
       margin-right: 2%;

+ 1 - 1
src/views/articleManagement/articleList.vue

@@ -55,7 +55,7 @@
               <span class="exam-question-edit-search-title">搜索:</span>
               <a-input-search
                 v-model="searchInputVal"
-                placeholder="请输入试题内容关键字"
+                placeholder="请输入文章标题关键字"
                 :maxLength="100"
                 @search="searchInputFun"
               />

+ 196 - 103
src/views/examManagement/examAutomaticVolumeFormation.vue

@@ -6,7 +6,7 @@
         <div class="basic-information-title">基本信息</div>
         <div class="basic-information-form">
           <a-form
-            :form="loginForm"
+            :form="examAutomaticVolumeFormationForm"
             @submit="handleSubmitFun"
             style="width: 515px;"
             :loading="loading"
@@ -170,100 +170,99 @@
         </div>
       </div>
       <!-- 试题数量 -->
-      <div class="common-card a-card-margin-top other-information-box">
-        <div class="other-information-title">题目数量</div>
-        <div class="other-information-content">
-          <div class="other-information-item">
-            <span class="other-information-item-title">单选题:</span>
-            <a-input
-              v-model="questionInfo.singleNum"
-              placeholder="输入数量"
-              type="number"
-              :max-length="3"
-              style="width: 100px;"
-            />
-          </div>
-          <div class="other-information-item">
-            <span class="other-information-item-title">每题分值:</span>
-            <a-input
-              v-model="questionInfo.singleGrade"
-              placeholder="输入分值"
-              type="number"
-              :maxLength="3"
-              style="width: 100px;"
-            />
-          </div>
-        </div>
-        <div class="other-information-content">
-          <div class="other-information-item">
-            <span class="other-information-item-title">多选题:</span>
-            <a-input
-              v-model="questionInfo.multiNum"
-              placeholder="输入数量"
-              type="number"
-              :maxLength="3"
-              style="width: 100px;"
-            />
-          </div>
-          <div class="other-information-item">
-            <span class="other-information-item-title">每题分值:</span>
-            <a-input
-              v-model="questionInfo.multiGrade"
-              placeholder="输入分值"
-              type="number"
-              :maxLength="3"
-              style="width: 100px;"
-            />
-          </div>
-        </div>
-        <div class="other-information-content">
-          <div class="other-information-item">
-            <span class="other-information-item-title">判断题:</span>
-            <a-input
-              v-model="questionInfo.trueFalseNum"
-              placeholder="输入数量"
-              type="number"
-              :maxLength="3"
-              style="width: 100px;"
-            />
-          </div>
-          <div class="other-information-item">
-            <span class="other-information-item-title">每题分值:</span>
-            <a-input
-              v-model="questionInfo.trueFalseGrade"
-              placeholder="输入分值"
-              type="number"
-              :maxLength="3"
-              style="width: 100px;"
-            />
-          </div>
-        </div>
-        <div class="other-information-content">
-          <div class="other-information-item">
-            <span class="other-information-item-title">填空题:</span>
-            <a-input
-              v-model="questionInfo.gapFillingNum"
-              placeholder="输入数量"
-              type="number"
-              :maxLength="3"
-              style="width: 100px;"
-            />
-          </div>
-          <div class="other-information-item">
-            <span class="other-information-item-title">每题分值:</span>
-            <a-input
-              v-model="questionInfo.gapFillingGrade"
-              placeholder="输入分值"
-              type="number"
-              :maxLength="3"
-              style="width: 100px;"
-            />
-          </div>
-        </div>
-        <div class="submit-row-PreAssembledVolume">
-          <a-button type="primary" @click="handlePreAssembledVolumeFun"
-            >预组卷</a-button
+      <div class="common-card a-card-margin-top basic-information-box">
+        <div class="basic-information-title">出题数量</div>
+        <div class="basic-information-form">
+          <a-form
+            :form="anserRuleSpecialNumForm"
+            @submit="handlePreAssembledVolumeFun"
+            style="width: 515px;"
+            :loading="loading"
+            :label-col="labelCol"
+            :wrapper-col="wrapperCol"
           >
+            <a-form-item label="单选题">
+              <ExamQuestionNum
+                v-decorator="[
+                  'single',
+                  {
+                    initialValue: {
+                      num: questionInfo.singleNum,
+                      grade: questionInfo.singleGrade,
+                    },
+                    rules: [
+                      {
+                        required: true,
+                        validator: checkExamQuestionNum,
+                      },
+                    ],
+                  },
+                ]"
+              />
+            </a-form-item>
+            <a-form-item label="多选题">
+              <ExamQuestionNum
+                v-decorator="[
+                  'multi',
+                  {
+                    initialValue: {
+                      num: questionInfo.multiNum,
+                      grade: questionInfo.multiGrade,
+                    },
+                    rules: [
+                      {
+                        required: true,
+                        validator: checkExamQuestionNum,
+                      },
+                    ],
+                  },
+                ]"
+              />
+            </a-form-item>
+            <a-form-item label="判断题">
+              <ExamQuestionNum
+                v-decorator="[
+                  'trueFalse',
+                  {
+                    initialValue: {
+                      num: questionInfo.trueFalseNum,
+                      grade: questionInfo.trueFalseGrade,
+                    },
+                    rules: [
+                      {
+                        required: true,
+                        validator: checkExamQuestionNum,
+                      },
+                    ],
+                  },
+                ]"
+              />
+            </a-form-item>
+            <a-form-item label="填空题">
+              <ExamQuestionNum
+                v-decorator="[
+                  'gapFilling',
+                  {
+                    initialValue: {
+                      num: questionInfo.gapFillingNum,
+                      grade: questionInfo.gapFillingGrade,
+                    },
+                    rules: [
+                      {
+                        required: true,
+                        validator: checkExamQuestionNum,
+                      },
+                    ],
+                  },
+                ]"
+              />
+            </a-form-item>
+            <a-form-item :label-col="labelCol" :wrapper-col="{ span: 24 }">
+              <div class="submit-row">
+                <a-button type="primary" html-type="submit">预组卷</a-button>
+              </div>
+            </a-form-item>
+          </a-form>
         </div>
       </div>
       <!-- 当前试题列表 -->
@@ -351,6 +350,7 @@ import {
   formateEngineeringWork,
 } from '@/filters';
 import { mapGetters } from 'vuex';
+// 考试时长
 const ExamTimeLong = {
   props: ['value'],
   template: `
@@ -407,20 +407,80 @@ const ExamTimeLong = {
     },
   },
 };
+// 试题数量、分数
+const ExamQuestionNum = {
+  props: ['value'],
+  template: `
+    <span>
+      <a-input
+        type='number'
+        :value="num"
+        :maxLength="3"
+        @change="handleNumberChange"
+        style="width: 37%; margin-right: 2%;"
+      />
+      <span style="margin-left: 2%;">每题分值:</span>
+      <a-input
+        :value="grade"
+        :maxLength="3"
+        @change="handleCurrencyChange"
+        style="width: 37%;"
+      />
+    </span>
+  `,
+  data() {
+    const value = this.value || {};
+    return {
+      num: value.num,
+      grade: value.grade,
+    };
+  },
+  watch: {
+    value(val = {}) {
+      this.num = val.num;
+      this.grade = val.grade;
+    },
+  },
+  methods: {
+    handleNumberChange(e) {
+      const num = e.target.value;
+      if (isNaN(num)) {
+        return;
+      }
+      this.triggerChange({ num });
+    },
+    handleCurrencyChange(e) {
+      const grade = e.target.value;
+      if (isNaN(grade)) {
+        return;
+      }
+      this.triggerChange({ grade });
+    },
+    triggerChange(changedValue) {
+      // Should provide an event to pass value to Form.
+      this.$emit('change', Object.assign({}, this.$data, changedValue));
+    },
+  },
+};
 export default {
-  name: 'examManualVolumeFormation',
+  name: 'examAutomaticVolumeFormation',
   props: {},
   components: {
     ExamTimeLong,
+    ExamQuestionNum,
   },
   data() {
     return {
       loading: false, // 是否展示加载动画
       // 基础信息的表单
-      labelCol: { span: 6 }, // 表单行中label的占位
-      wrapperCol: { span: 18 }, // 表单行中内容的占位
-      loginForm: this.$form.createForm(this, {
-        name: 'examManualVolumeFormation',
+      labelCol: { span: 4 }, // 表单行中label的占位
+      wrapperCol: { span: 20 }, // 表单行中内容的占位
+      examAutomaticVolumeFormationForm: this.$form.createForm(this, {
+        name: 'examAutomaticVolumeFormation',
+      }),
+
+      anserRuleSpecialNumForm: this.$form.createForm(this, {
+        name: 'answerManagementSpecialNum',
       }),
       engineeringWorkList: [], // 工种数据列表
       examTypeList: [], // 考试类型列表
@@ -836,14 +896,47 @@ export default {
     },
     // #endregion
 
-    // 操作:点击提交按钮
-    handlePreAssembledVolumeFun() {
-      document.getElementById('examManualVolumeFormation').click();
+    // 校验:考试试题数量
+    checkExamQuestionNum(rule, value, callback) {
+      if (
+        value.num !== '' &&
+        value.num >= 0 &&
+        value.grade !== '' &&
+        value.grade >= 0 &&
+        !(!value.num && !value.grade)
+      ) {
+        callback();
+        return;
+      }
+      callback('请输入完整的题目数量、题目分数');
+    },
+
+    // 操作:点击预组卷按钮
+    handlePreAssembledVolumeFun(e) {
+      // 验证:出题数量
+      e.preventDefault();
+      this.anserRuleSpecialNumForm.validateFields((err, values) => {
+        if (!err) {
+          console.log(values);
+          this.questionInfo = {
+            singleNum: values.single.num,
+            singleGrade: values.single.grade,
+            multiNum: values.multi.num,
+            multiGrade: values.multi.grade,
+            trueFalseNum: values.trueFalse.num,
+            trueFalseGrade: values.trueFalse.grade,
+            gapFillingNum: values.gapFilling.num,
+            gapFillingGrade: values.gapFilling.grade,
+          };
+          // 验证:基础信息
+          document.getElementById('examManualVolumeFormation').click();
+        }
+      });
     },
     // 操作:表单提交
     handleSubmitFun(e) {
       e.preventDefault();
-      this.loginForm.validateFields((err, values) => {
+      this.examAutomaticVolumeFormationForm.validateFields((err, values) => {
         if (!err) {
           let that = this;
           that.$confirm({

+ 3 - 3
src/views/examManagement/examManualVolumeFormation.vue

@@ -6,7 +6,7 @@
         <div class="basic-information-title">基本信息</div>
         <div class="basic-information-form">
           <a-form
-            :form="loginForm"
+            :form="examManualVolumeFormationForm"
             @submit="handleSubmitFun"
             style="width: 515px;"
             :loading="loading"
@@ -520,7 +520,7 @@ export default {
       // 基础信息的表单
       labelCol: { span: 6 }, // 表单行中label的占位
       wrapperCol: { span: 18 }, // 表单行中内容的占位
-      loginForm: this.$form.createForm(this, {
+      examManualVolumeFormationForm: this.$form.createForm(this, {
         name: 'examManualVolumeFormation',
       }),
       engineeringWorkList: [], // 工种数据列表
@@ -1187,7 +1187,7 @@ export default {
     // 操作:表单提交
     handleSubmitFun(e) {
       e.preventDefault();
-      this.loginForm.validateFields((err, values) => {
+      this.examManualVolumeFormationForm.validateFields((err, values) => {
         if (!err) {
           let that = this;
           that.$confirm({

+ 12 - 3
src/views/login/login.vue

@@ -112,17 +112,16 @@ export default {
               },
             })
             .then((res) => {
-              console.log(res);
               this.loading = false;
               if (res.data) {
                 this.getEngineeringWorkList(res.data); // 获取工种,并存到vuex
               } else {
                 this.loginForm.setFields({
-                  password: {
+                  loginUserName: {
                     value: values.loginUserName,
                     errors: [new Error('账号密码不正确')],
                   },
-                  passwordSecond: {
+                  loginPassword: {
                     value: values.loginPassword,
                     errors: [new Error('账号密码不正确')],
                   },
@@ -131,6 +130,16 @@ export default {
             })
             .catch(() => {
               this.loading = false;
+              this.loginForm.setFields({
+                loginUserName: {
+                  value: values.loginUserName,
+                  errors: [new Error('账号密码不正确')],
+                },
+                loginPassword: {
+                  value: values.loginPassword,
+                  errors: [new Error('账号密码不正确')],
+                },
+              });
             });
         }
       });