浏览代码

切割材料

dxd 2 年之前
父节点
当前提交
c775627147
共有 3 个文件被更改,包括 26 次插入12 次删除
  1. 0 1
      src/router/index.js
  2. 25 10
      src/views/menu5/cutPage/cutPage.vue
  3. 1 1
      src/views/menu5/menu5-1/index.vue

+ 0 - 1
src/router/index.js

@@ -378,7 +378,6 @@ export function resetRouter() {
 
 router.beforeEach(async function (to, from, next) {
   if (getToken()) {
-    debugger
     if (to.path !== '/login') {
       if (user.state.init) {
         // 获取了动态路由 data一定true,就无需再次请求 直接放行

+ 25 - 10
src/views/menu5/cutPage/cutPage.vue

@@ -5,7 +5,7 @@
       <div
         :class="[index == curLeftIndex ? 'cur' : '', 'paperBox']"
         v-for="(img, index) in leftImgs"
-        :key="index+'paper'"
+        :key="index + 'paper'"
         @click="leftClick(index)"
       >
         <span class="paper">
@@ -140,7 +140,7 @@
         <li
           :class="[curBoxIndex == 'answerBox' ? ' cur' : '', 'cutBox']"
           v-for="(element, index) in answerList"
-          :key="index+'answer'"
+          :key="index + 'answer'"
           @click="cutBoxClick('answerBox')"
         >
           <!-- <el-input
@@ -154,7 +154,7 @@
             <div
               style="position: relative"
               v-for="(item, index2) in element.ele"
-              :key="index2+'anbk'"
+              :key="index2 + 'anbk'"
             >
               <!-- <el-input
                 v-show="curOpt != 'fast'"
@@ -197,7 +197,7 @@
           <li
             :class="[index == curBoxIndex ? ' cur' : '', 'cutBox']"
             v-for="(element, index) in list"
-            :key="index+'cut'"
+            :key="index + 'cut'"
             @click="cutBoxClick(index)"
           >
             <el-input
@@ -216,7 +216,7 @@
               <div
                 style="position: relative"
                 v-for="(item, index2) in element.ele"
-                :key="index2+'cutbk'"
+                :key="index2 + 'cutbk'"
               >
                 <el-input
                   v-show="curOpt != 'fast' && curOpt != 'answer'"
@@ -544,6 +544,7 @@ export default {
       if (ques[ques.length - 1].ele.length <= 0) {
         ques.pop();
       }
+      debugger
       var req = {
         id: this.paperInfo.id,
         pid: this.paperInfo.id,
@@ -557,7 +558,7 @@ export default {
                 page: i2.page,
                 qno: i.order + "",
                 sqno: i2.subNum,
-                imgtype: 0,
+                imgtype: i2.imgType,
                 points: [i2.point],
                 imgs: [],
               };
@@ -685,6 +686,7 @@ export default {
               } else {
                 // 添加单张截图
                 if (!that.isMaterial) {
+                  debugger;
                   // 不是材料正常添加逻辑
                   if (that.curBoxIndex == "answerBox") {
                     that.addAnswerImg();
@@ -696,8 +698,17 @@ export default {
                       that.addAnswerImg();
                       that.curBoxIndex = "answerBox";
                     } else {
-                      that.list[that.curBoxIndex].ele = [];
-                      that.addImg();
+                      if (
+                        that.list[that.curBoxIndex].ele.every((item) => {
+                          return item.imgType == 1;
+                        })
+                      ) {
+                        console.log("hasMaterial");
+                        that.addImg();
+                      } else {
+                        that.list[that.curBoxIndex].ele = [];
+                        that.addImg();
+                      }
                     }
                   } else {
                     if (that.curOpt == "answer") {
@@ -720,6 +731,7 @@ export default {
                     }
                   }
                 } else {
+                  debugger;
                   // 材料添加逻辑
                   if (that.list[that.curBoxIndex].ele.length > 0) {
                     that.addImg("material");
@@ -750,7 +762,7 @@ export default {
       });
     },
     addImg(ImgType) {
-      var imgType = ImgType ? 1 : 0;
+      var imgType = ImgType ? 1 : 0; // 1 切割材料
       let cropData = this.myCropper.getCropBoxData();
       let standardPoint = this.paperInfo.points[0][0];
       let point = {
@@ -760,6 +772,7 @@ export default {
         h: cropData.height / this.imgSize,
       };
       if (imgType) {
+        // 切割材料
         this.list[this.curBoxIndex].ele.unshift({
           // subNum: this.list[this.curBoxIndex].ele.length + 1,
           subNum: 1,
@@ -769,7 +782,9 @@ export default {
           point: point,
           imgType: imgType,
         });
+        debugger;
       } else {
+        // 正常切题
         this.list[this.curBoxIndex].id = 0;
         this.list[this.curBoxIndex].ele.push({
           // subNum: this.list[this.curBoxIndex].ele.length + 1,
@@ -830,7 +845,7 @@ export default {
         return;
       }
       if (!this.previewTop) {
-        this.previewCss ={};
+        this.previewCss = {};
         this.previewCss.transform = "scale(1.1)";
         this.previewTop = "40%";
         this.previewIMG = img;

+ 1 - 1
src/views/menu5/menu5-1/index.vue

@@ -811,7 +811,7 @@ export default {
       // let fileList = new FormData();
       var token = this.Cookies.get("www-authenticate");
       axios({
-        url: "http://47.108.130.28:19882/parsedocx.aspx",
+        url: "http://127.0.0.1:19882/parsedocx.aspx",
         // url: "http://10.10.153.242:19882/parsedocx.aspx",
         method: "post",
         data: formData,