lsc 2 years ago
parent
commit
88e0b7ac01

File diff suppressed because it is too large
+ 0 - 0
src/assets/drawIcon/iconfont.js


+ 65 - 0
src/assets/drawIcon/iconfont.svg

@@ -0,0 +1,65 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<!--
+2013-9-30: Created.
+-->
+<svg>
+<metadata>
+Created by iconfont
+</metadata>
+<defs>
+
+<font id="iconfont" horiz-adv-x="1024" >
+  <font-face
+    font-family="iconfont"
+    font-weight="500"
+    font-stretch="normal"
+    units-per-em="1024"
+    ascent="896"
+    descent="-128"
+  />
+    <missing-glyph />
+    
+    <glyph glyph-name="baocun" unicode="&#58894;" d="M831.4 643.8L711.5 763.6c-10.3 10.3-24.2 16.1-38.8 16.1h-450c-23.3 0-42.2-18.9-42.2-42.2v-709.4c0-23.3 18.9-42.2 42.2-42.2h582.6c23.3 0 42.2 18.9 42.2 42.2V605c-0.1 14.5-5.8 28.5-16.1 38.8zM619.6 737v-159.8c0-4-3.3-7.3-7.3-7.3H387.2c-4 0-7.3 3.3-7.3 7.3V737h239.7z m67.7-708.4H340.8v292c0 3.9 3.2 7.1 7.1 7.1h332.4c3.9 0 7.1-3.2 7.1-7.1v-292z m117.4 0H730v292c0 27.5-22.3 49.8-49.8 49.8H347.8c-27.5 0-49.8-22.3-49.8-49.8v-292h-74.7V736.9h113.9v-159.8c0-27.6 22.4-50.1 50.1-50.1h225.1c27.6 0 50.1 22.4 50.1 50.1V737h10.4c3.2 0 6.3-1.3 8.6-3.6l119.9-119.9c2.3-2.3 3.6-5.3 3.6-8.6l-0.3-576.3zM536 699.7h42.7v-87.2H536zM368.7 254.8h220.7v-42.7H368.7zM368.7 152h170.9v-42.7H368.7z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="zhongzuo" unicode="&#58922;" d="M86.6 222.9c-2.6 0-5.2 0.4-7.8 1.4-12.1 4.3-18.4 17.6-14.1 29.7 63.8 178.7 234.1 298.7 423.9 298.7 172.3 0 326.9-96 403.5-250.5 5.7-11.5 1-25.4-10.5-31.1-11.5-5.7-25.4-1-31.1 10.5-68.6 138.6-207.3 224.7-361.8 224.7-170.2 0-323-107.7-380.2-267.9-3.4-9.6-12.4-15.5-21.9-15.5zM896.1 431.9L746.1 299c-0.3-0.3-0.2-0.7 0.2-0.8l190-63.4c0.4-0.1 0.7 0.2 0.6 0.6l-40.1 196.3c0 0.3-0.4 0.5-0.7 0.2zM932.8 212.9c-2.8 0-5.6 0.4-8.4 1.4l-180.8 60.3c-9 3-15.7 10.6-17.6 19.9-1.9 9.3 1.3 18.9 8.4 25.2L877 446.1c7.1 6.3 17 8.3 26 5.3 9-3 15.7-10.6 17.6-19.9l38.1-186.7c1.9-9.3-1.3-18.9-8.4-25.2-4.8-4.4-11.1-6.7-17.5-6.7zM791 307.7l115.4-38.5L882 388.4l-91-80.7z m116.8 103.6c0-0.1 0 0 0 0z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="chexiao" unicode="&#58921;" d="M933.5 225.2c-9.5 0-18.3 5.9-21.7 15.3-56.7 158.9-208.2 265.6-377 265.6-153.2 0-290.7-85.4-358.8-222.8-5.6-11.4-19.4-16.1-30.9-10.4-11.4 5.6-16.1 19.5-10.4 30.9C210.6 457 363.9 552.2 534.8 552.2c188.2 0 357.1-119 420.4-296.2 4.3-12-2-25.2-14-29.4-2.6-0.9-5.2-1.4-7.7-1.4zM130.8 432.5l148.7-131.7c0.3-0.3 0.2-0.7-0.2-0.8L90.8 237c-0.4-0.1-0.7 0.2-0.6 0.6L130 432.2c0 0.4 0.5 0.5 0.8 0.3zM94.4 215.3c-6.3 0-12.6 2.3-17.5 6.6-7 6.2-10.2 15.8-8.3 25L106.4 432c1.9 9.2 8.6 16.7 17.4 19.7 8.9 3 18.8 1 25.8-5.3L291 321.1c7-6.2 10.2-15.8 8.3-25-1.9-9.2-8.6-16.7-17.5-19.7l-179.3-59.8c-2.5-0.8-5.3-1.3-8.1-1.3z m50.3 174.1l-24.1-118.1L235 309.4l-90.3 80zM119.1 412z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="lajixiang_huaban1" unicode="&#58971;" d="M853.333333 641.706667h-170.666666v50.631111a62.577778 62.577778 0 0 1-62.577778 62.577778H402.204444A62.577778 62.577778 0 0 1 341.333333 692.337778v-50.631111H170.666667v-56.888889h56.888889v-512a62.577778 62.577778 0 0 1 62.577777-62.577778h443.733334a62.577778 62.577778 0 0 1 62.577777 62.577778v512h56.888889z m-455.111111 50.631111a5.688889 5.688889 0 0 0 5.688889 5.688889h219.591111a5.688889 5.688889 0 0 0 5.688889-5.688889v-50.631111H398.222222z m341.333334-616.675556a5.12 5.12 0 0 0-5.688889-5.688889H290.133333a5.12 5.12 0 0 0-5.688889 5.688889V584.817778h455.111112zM398.222222 464.213333h56.888889v-274.773333H398.222222zM568.888889 464.213333h56.888889v-274.773333h-56.888889z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="yuanquan_huaban1" unicode="&#58988;" d="M512 64a320 320 0 1 0 320 320 320 320 0 0 0-320-320z m0 554.666667a234.666667 234.666667 0 1 1 234.666667-234.666667A235.093333 235.093333 0 0 1 512 618.666667z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="zhixian_huaban1" unicode="&#58989;" d="M197.333333 129.706667l568.746667 568.661333 60.330667-60.330667-568.746667-568.746666z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="huabi_huaban1" unicode="&#58998;" d="M483.84 310.613333a99.84 99.84 0 0 1 66.56-26.453333 16.213333 16.213333 0 0 1 12.8 4.693333L840.96 554.666667a103.68 103.68 0 0 1-5.12 152.32 103.253333 103.253333 0 0 1-148.053333-13.653334l-228.693334-313.173333a17.493333 17.493333 0 0 1-2.986666-13.653333 103.253333 103.253333 0 0 1 27.733333-55.893334zM162.133333 160.853333a47.786667 47.786667 0 0 1 51.2 17.92c18.773333 27.306667 24.32 85.333333 64.853334 121.173334a142.506667 142.506667 0 0 0 111.786666 37.12 11.52 11.52 0 0 0 9.813334-8.96 116.053333 116.053333 0 0 1 39.253333-72.106667 243.2 243.2 0 0 1 81.066667-32.853333 10.666667 10.666667 0 0 0 8.96-10.666667c2.56-37.546667 0-179.2-186.88-173.226667C128 42.666667 143.36 167.68 162.133333 160.853333z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="youqitong_huaban1" unicode="&#59000;" d="M869.973333 391.68l-347.733333 347.733333L469.333333 682.666667 414.293333 735.573333a28.16 28.16 0 0 1-40.106666-40.106666l55.466666-55.466667L170.666667 357.973333a53.333333 53.333333 0 0 1 0-74.666666l243.2-243.626667a55.466667 55.466667 0 0 1 38.4-15.786667 54.613333 54.613333 0 0 1 36.266666 14.506667l322.56 298.666667v-227.84h59.733334v282.026666z m-242.346666 130.56l-128 128 24.32 26.453333 282.453333-282.453333-573.866667-32 228.266667 246.186667 128-128a28.16 28.16 0 1 1 40.106667 40.106666z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="xiangpi_huaban1" unicode="&#59003;" d="M849.066667 429.226667a60.16 60.16 0 0 1 0 85.333333l-193.28 192.426667a59.733333 59.733333 0 0 1-42.666667 17.493333 61.44 61.44 0 0 1-42.666667-17.493333l-395.52-396.8a60.16 60.16 0 0 1 0-85.333334l144.64-143.786666a128 128 0 0 1 83.2-38.4H853.333333v42.666666h-347.306666zM205.226667 256a17.493333 17.493333 0 0 0-5.12 11.946667 17.493333 17.493333 0 0 0 5.12 12.373333L384 459.946667l216.746667-217.173334L469.333333 111.36a85.333333 85.333333 0 0 0-120.746666 0z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="juxinggongju_huaban1" unicode="&#59005;" d="M746.666667 554.666667v-341.333334h-469.333334V554.666667h469.333334m68.266666 85.333333H209.066667a17.066667 17.066667 0 0 1-17.066667-17.066667v-477.866666a17.066667 17.066667 0 0 1 17.066667-17.066667h605.866666a17.066667 17.066667 0 0 1 17.066667 17.066667V622.933333a17.066667 17.066667 0 0 1-17.066667 17.066667z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="wenzi_huaban1" unicode="&#59007;" d="M213.333333 686.08v-128h85.333334v42.666667h170.666666v-433.493334H384.853333v-85.333333h256v85.333333H554.666667V600.746667h170.666666v-42.666667h85.333334v128H213.333333z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="suoxiao_huaban1" unicode="&#59016;" d="M793.6 29.866667a64.853333 64.853333 0 0 0-45.226667 18.773333L597.333333 202.24a286.293333 286.293333 0 1 0 94.293334 85.333333l149.333333-149.76a64 64 0 0 0-47.36-107.946666z m-341.333333 588.8a167.68 167.68 0 1 1 167.253333-167.68 167.68 167.68 0 0 1-166.4 167.68zM453.12 640A189.013333 189.013333 0 1 1 640 450.986667 189.013333 189.013333 0 0 1 453.12 640zM853.333333 154.453333l-136.533333 137.386667a308.48 308.48 0 1 1-125.44-116.053333l142.08-142.08a85.333333 85.333333 0 0 1 120.746667 0 85.333333 85.333333 0 0 1-0.853334 120.746666z m-30.293333-90.453333a42.666667 42.666667 0 0 0-60.16 0L597.333333 229.12a266.24 266.24 0 1 0 62.72 57.6l162.56-162.56a42.666667 42.666667 0 0 0 1.28-60.16zM346.453333 480.853333h213.333334v-59.733333h-213.333334z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="fangda_huaban1" unicode="&#59017;" d="M793.6 29.866667a64.853333 64.853333 0 0 0-45.226667 18.773333L597.333333 202.24a286.293333 286.293333 0 1 0 94.293334 85.333333l149.333333-149.76a64 64 0 0 0-47.36-107.946666z m-341.333333 588.8a167.68 167.68 0 1 1 167.253333-167.68 167.68 167.68 0 0 1-166.4 167.68zM453.12 640A189.013333 189.013333 0 1 1 640 450.986667 189.013333 189.013333 0 0 1 453.12 640zM853.333333 154.453333l-136.533333 137.386667a308.48 308.48 0 1 1-125.44-116.053333l142.08-142.08a85.333333 85.333333 0 0 1 120.746667 0 85.333333 85.333333 0 0 1-0.853334 120.746666z m-30.293333-90.453333a42.666667 42.666667 0 0 0-60.16 0L597.333333 229.12a266.24 266.24 0 1 0 62.72 57.6l162.56-162.56a42.666667 42.666667 0 0 0 1.28-60.16zM559.786667 480.853333h-76.8v76.8h-59.733334v-76.8h-76.8v-59.733333h76.8v-76.8h59.733334v76.8h76.8v59.733333z"  horiz-adv-x="1024" />
+
+    
+
+
+  </font>
+</defs></svg>

+ 212 - 48
src/components/GM/studyStudentGM.vue

@@ -556,11 +556,14 @@
                   @click="checkFileFull(showType, pptImgUrl1)"
                   >全屏查看</el-button
                 >
-                <el-button class="btnClassGM" type="primary" @click="downloadFile(pptImgUrl1)"
+                <el-button
+                  class="btnClassGM"
+                  type="primary"
+                  @click="downloadFile(pptImgUrl1)"
                   >文件下载</el-button
                 >
                 <el-button
-                class="btnClassGM"
+                  class="btnClassGM"
                   v-if="isClickNav.indexOf('line') != -1"
                   type="primary"
                   @click="openLine(pptImgUrl1)"
@@ -568,7 +571,10 @@
                 </el-button>
               </div>
               <div style="padding: 0px 30px" v-if="showType == 1">
-                <el-button class="btnClassGM" type="primary" @click="checkFileFull(showType, text)"
+                <el-button
+                  class="btnClassGM"
+                  type="primary"
+                  @click="checkFileFull(showType, text)"
                   >全屏查看</el-button
                 >
               </div>
@@ -1597,7 +1603,7 @@
                         <div class="workImg" v-if="w.type == 0">
                           <img
                             :src="w.works"
-                            @click="previewImg(w.works)"
+                            @click="commentOther(w, toolIndex, wIndex)"
                             alt
                           />
                           <div
@@ -2170,7 +2176,7 @@
                         <div class="workImg">
                           <img
                             :src="w.works"
-                            @click="previewImg(w.works)"
+                            @click="commentOther(w, toolIndex, wIndex)"
                             alt
                           />
                           <div
@@ -2292,7 +2298,7 @@
                         <div class="workImg">
                           <img
                             :src="w.works"
-                            @click="previewImg(w.works)"
+                            @click="commentOther(w, toolIndex, wIndex)"
                             alt
                           />
                           <div
@@ -2414,7 +2420,7 @@
                         <div class="workImg">
                           <img
                             :src="w.works"
-                            @click="previewImg(w.works)"
+                            @click="commentOther(w, toolIndex, wIndex)"
                             alt
                           />
                           <div
@@ -2536,7 +2542,7 @@
                         <div class="workImg">
                           <img
                             :src="w.works"
-                            @click="previewImg(w.works)"
+                            @click="commentOther(w, toolIndex, wIndex)"
                             alt
                           />
                           <div
@@ -2631,7 +2637,7 @@
                         type="text"
                         @click="jump()"
                         v-if="tType == 2"
-                         class="buttonA"
+                        class="buttonA"
                         >我的评价</el-button
                       >
                     </div>
@@ -2711,7 +2717,7 @@
                         type="text"
                         @click="jump()"
                         v-if="tType == 2"
-                         class="buttonA"
+                        class="buttonA"
                         >我的评价</el-button
                       >
                     </div>
@@ -2808,7 +2814,7 @@
                         type="text"
                         @click="jump()"
                         v-if="tType == 2"
-                         class="buttonA"
+                        class="buttonA"
                         >我的评价</el-button
                       >
                     </div>
@@ -2886,7 +2892,7 @@
                         type="text"
                         @click="jump()"
                         v-if="tType == 2"
-                         class="buttonA"
+                        class="buttonA"
                         >我的评价</el-button
                       >
                     </div>
@@ -2954,7 +2960,7 @@
                         type="text"
                         @click="jump()"
                         v-if="tType == 2"
-                         class="buttonA"
+                        class="buttonA"
                         >我的评价</el-button
                       >
                     </div>
@@ -3492,9 +3498,7 @@
     </div>
     <div v-if="proVisible" class="mask">
       <div class="progressBox">
-        <div class="lbox">
-          <img src="@/assets/loading.gif" />上传中,请稍后
-        </div>
+        <div class="lbox"><img src="@/assets/loading.gif" />上传中,请稍后</div>
         <el-progress
           :text-inside="true"
           :stroke-width="20"
@@ -3564,10 +3568,17 @@
         </div>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button class="cancelbtnGM" @click="dialogVisible5 = false" v-show="noteName == ''"
+        <el-button
+          class="cancelbtnGM"
+          @click="dialogVisible5 = false"
+          v-show="noteName == ''"
           >取 消</el-button
         >
-        <el-button class="btnClassGM" type="primary" @click="addStudentAsk" v-show="noteName == ''"
+        <el-button
+          class="btnClassGM"
+          type="primary"
+          @click="addStudentAsk"
+          v-show="noteName == ''"
           >确 定</el-button
         >
       </span>
@@ -3648,7 +3659,10 @@
         </div>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button class="cancelbtnGM" @click="dialogVisibleChoice = false" v-show="noteName == ''"
+        <el-button
+          class="cancelbtnGM"
+          @click="dialogVisibleChoice = false"
+          v-show="noteName == ''"
           >取 消</el-button
         >
         <el-button
@@ -3679,7 +3693,10 @@
         ></div>
       </el-form>
       <span slot="footer" class="dialog-footer">
-        <el-button class="btnClassGM" type="primary" @click="dialogVisible1 = false"
+        <el-button
+          class="btnClassGM"
+          type="primary"
+          @click="dialogVisible1 = false"
           >确定</el-button
         >
       </span>
@@ -3781,8 +3798,12 @@
         </div>
       </div>
       <div slot="footer">
-        <el-button class="cancelbtnGM" @click="answerDialogVisible = false">取 消</el-button>
-        <el-button class="btnClassGM" type="primary" @click="addQuestion">提 交</el-button>
+        <el-button class="cancelbtnGM" @click="answerDialogVisible = false"
+          >取 消</el-button
+        >
+        <el-button class="btnClassGM" type="primary" @click="addQuestion"
+          >提 交</el-button
+        >
       </div>
     </el-dialog>
     <el-dialog
@@ -3797,7 +3818,9 @@
         <Time v-if="timeDialogVisible"></Time>
       </div>
       <div slot="footer">
-        <el-button class="cancelbtnGM" @click="timeDialogVisible = false">关 闭</el-button>
+        <el-button class="cancelbtnGM" @click="timeDialogVisible = false"
+          >关 闭</el-button
+        >
       </div>
     </el-dialog>
     <el-dialog
@@ -3831,9 +3854,7 @@
         </div>
       </div>
       <div slot="footer">
-        <el-button
-        class="cancelbtnGM"
-          @click="juriVisible = false"
+        <el-button class="cancelbtnGM" @click="juriVisible = false"
           >关 闭</el-button
         >
       </div>
@@ -3857,7 +3878,7 @@
       </div>
       <div slot="footer">
         <el-button
-        class="btnClassGM"
+          class="btnClassGM"
           style="color: #fff"
           @click="(videoVisible = false), (videoDetail.sources[0].src = '')"
         >
@@ -3880,6 +3901,18 @@
             <div style="margin-bottom: 5px">{{ commentDetail.sName }}</div>
             <div>{{ commentDetail.time }}</div>
           </div>
+          <div
+            class="returnBtn btnClassGM"
+            style="margin-left: auto;width: 80px;"
+            v-if="
+              (commentDetail.works && commentDetail.type == 0) ||
+              tType == 1 ||
+              tType == 4
+            "
+            @click="showPicturePaint(commentDetail.works)"
+          >
+          教师批注
+          </div>
         </div>
         <div
           class="worksAnswer"
@@ -3989,6 +4022,14 @@
             <div>{{ commentDetail.commentCount }}</div>
           </div>
         </div>
+        <div class="drawPBox" v-if="commentDetail.img">
+            <span>教师批注</span>
+            <img
+              :src="commentDetail.img"
+              alt=""
+              @click="previewImg(commentDetail.img)"
+            />
+          </div>
       </div>
       <div class="commentBox">
         <div class="pl">评论:</div>
@@ -4054,7 +4095,7 @@
 
       <div slot="footer">
         <el-button
-        class="cancelbtnGM"
+          class="cancelbtnGM"
           @click="
             (commentDialogVisible = false),
               (commentIndexJson = {}),
@@ -4065,7 +4106,7 @@
           >取 消</el-button
         >
         <el-button
-        class="btnClassGM"
+          class="btnClassGM"
           type="primary"
           @click="addComment(commentDetail.wid, userid, 2)"
           >确 定</el-button
@@ -4188,8 +4229,14 @@
         </div>
       </div>
       <div slot="footer">
-        <el-button class="cancelbtnGM" @click="studentEvalDialogVisible = false">取 消</el-button>
-        <el-button class="btnClassGM" type="primary" @click="addBzWorks" v-if="!isStar"
+        <el-button class="cancelbtnGM" @click="studentEvalDialogVisible = false"
+          >取 消</el-button
+        >
+        <el-button
+          class="btnClassGM"
+          type="primary"
+          @click="addBzWorks"
+          v-if="!isStar"
           >确 定</el-button
         >
       </div>
@@ -4379,7 +4426,7 @@
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button
-        class="cancelbtnGM"
+          class="cancelbtnGM"
           @click="
             (dialogVisibleScore = false),
               (commentIndexJson = {}),
@@ -4398,6 +4445,12 @@
         >
       </span>
     </el-dialog>
+    <ImgDraw
+      :drawShow="drawShow"
+      @closeDraw="closeDraw"
+      @addImgDraw="addImgDraw"
+      :bg="bg"
+    ></ImgDraw>
   </div>
 </template>
 
@@ -4415,6 +4468,7 @@ import Sunburst from "../tools/sunburst";
 import SeeBoard from "../tools/seeBoard";
 import * as imageConversion from "image-conversion";
 import Audio from "../components/audioGM.vue";
+import ImgDraw from "../tools/imgDraw/imgDraw";
 
 export default {
   components: {
@@ -4428,9 +4482,12 @@ export default {
     SeeBoard,
     AnswerData2,
     Audio,
+    ImgDraw,
   },
   data() {
     return {
+      bg: false,
+      drawShow: false,
       dialogVisible: false,
       commentDialogVisible: false,
       videoVisible: false,
@@ -4926,6 +4983,7 @@ export default {
                       works: b[j].content,
                       sName: b[j].name,
                       score: b[j].score,
+                      img: b[j].img,
                       type: 1,
                       time: b[j].time,
                       userid: b[j].userid,
@@ -4944,6 +5002,7 @@ export default {
                       works: b[j].content,
                       sName: b[j].name,
                       score: b[j].score,
+                      img: b[j].img,
                       type: 3,
                       time: b[j].time,
                     });
@@ -4954,6 +5013,7 @@ export default {
                       works: b[j].content,
                       sName: b[j].name,
                       score: b[j].score,
+                      img: b[j].img,
                       type: 4,
                       time: b[j].time,
                     });
@@ -4964,6 +5024,7 @@ export default {
                       works: b[j].content,
                       sName: b[j].name,
                       score: b[j].score,
+                      img: b[j].img,
                       type: 5,
                       time: b[j].time,
                     });
@@ -4972,6 +5033,7 @@ export default {
                       works: b[j].content,
                       sName: b[j].name,
                       score: b[j].score,
+                      img: b[j].img,
                       type: 0,
                       time: b[j].time,
                       userid: b[j].userid,
@@ -4983,6 +5045,7 @@ export default {
                     works: b[j].content,
                     sName: b[j].name,
                     score: b[j].score,
+                    img: b[j].img,
                     type: 2,
                     time: b[j].time,
                     userid: b[j].userid,
@@ -4994,6 +5057,7 @@ export default {
                     works: b[j].content,
                     sName: b[j].name,
                     score: b[j].score,
+                    img: b[j].img,
                     type: 2,
                     time: b[j].time,
                     userid: b[j].userid,
@@ -5005,6 +5069,7 @@ export default {
                     works: b[j].content,
                     sName: b[j].name,
                     score: b[j].score,
+                    img: b[j].img,
                     type: 8,
                     time: b[j].time,
                     userid: b[j].userid,
@@ -5477,6 +5542,7 @@ export default {
                       type: 1,
                       time: b[j].time,
                       score: b[j].score,
+                      img: b[j].img,
                       likesCount: likesCount,
                       commentCount: commentCount,
                       isLikes: isLikes,
@@ -5497,6 +5563,7 @@ export default {
                       type: 3,
                       time: b[j].time,
                       score: b[j].score,
+                      img: b[j].img,
                       likesCount: likesCount,
                       commentCount: commentCount,
                       isLikes: isLikes,
@@ -5511,6 +5578,7 @@ export default {
                       type: 4,
                       time: b[j].time,
                       score: b[j].score,
+                      img: b[j].img,
                       likesCount: likesCount,
                       commentCount: commentCount,
                       isLikes: isLikes,
@@ -5525,6 +5593,7 @@ export default {
                       type: 5,
                       time: b[j].time,
                       score: b[j].score,
+                      img: b[j].img,
                       likesCount: likesCount,
                       commentCount: commentCount,
                       isLikes: isLikes,
@@ -5539,6 +5608,7 @@ export default {
                       type: 0,
                       time: b[j].time,
                       score: b[j].score,
+                      img: b[j].img,
                       likesCount: likesCount,
                       commentCount: commentCount,
                       isLikes: isLikes,
@@ -5554,6 +5624,7 @@ export default {
                     type: 2,
                     time: b[j].time,
                     score: b[j].score,
+                    img: b[j].img,
                     likesCount: likesCount,
                     commentCount: commentCount,
                     isLikes: isLikes,
@@ -5569,6 +5640,7 @@ export default {
                     type: 2,
                     time: b[j].time,
                     score: b[j].score,
+                    img: b[j].img,
                     likesCount: likesCount,
                     commentCount: commentCount,
                     isLikes: isLikes,
@@ -5584,6 +5656,7 @@ export default {
                     type: 8,
                     time: b[j].time,
                     score: b[j].score,
+                    img: b[j].img,
                     likesCount: likesCount,
                     commentCount: commentCount,
                     isLikes: isLikes,
@@ -5689,8 +5762,12 @@ export default {
     },
     async beforeUpload1(event, type, i) {
       // this.$message.success('进入上传')
-
-      var file = event.target.files[0];
+      var file = "";
+      if (type == 5) {
+        file = event;
+      } else {
+        file = event.target.files[0];
+      }
       var credentials = {
         accessKeyId: "AKIATLPEDU37QV5CHLMH",
         secretAccessKey: "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",
@@ -5877,6 +5954,8 @@ export default {
                 _this.addCourseWorks(i);
               } else if (type == 4) {
                 _this.addPz("3", data.Location);
+              } else if (type == 5) {
+                _this.addImgDrawImG(data.Location);
               }
               _this.imgChange(null, null, type);
               console.log(data.Location);
@@ -6011,7 +6090,8 @@ export default {
             if (
               !this.chapInfoList[this.courseType].chapterInfo[0].taskJson[bbb]
                 .isLook &&
-              this.courseDetail.userid != this.userid  && this.IsLookOpen
+              this.courseDetail.userid != this.userid &&
+              this.IsLookOpen
             ) {
               this.$message.error("任务未解锁");
               return;
@@ -6033,7 +6113,8 @@ export default {
             var bbb = parseInt(this.courseType) + 1;
             if (
               !this.chapInfoList[bbb].chapterInfo[0].taskJson[0].isLook &&
-              this.courseDetail.userid != this.userid  && this.IsLookOpen
+              this.courseDetail.userid != this.userid &&
+              this.IsLookOpen
             ) {
               this.$message.error("任务未解锁");
               return;
@@ -6047,7 +6128,8 @@ export default {
             if (
               !this.chapInfoList[this.courseType].chapterInfo[0].taskJson[bbb]
                 .isLook &&
-              this.courseDetail.userid != this.userid && this.IsLookOpen
+              this.courseDetail.userid != this.userid &&
+              this.IsLookOpen
             ) {
               this.$message.error("任务未解锁");
               return;
@@ -6610,9 +6692,9 @@ export default {
         .post(this.$store.state.api + "updateCourseLookOpen", params)
         .then((res) => {
           if (this.IsLookOpen == true) {
-            if (this.courseType != 0 && this.taskCount != 0) {
-              this.openTask(0, 0, "0-0");
-            }
+            // if (this.courseType != 0 && this.taskCount != 0) {
+            //   this.openTask(0, 0, "0-0");
+            // }
             this.$message({
               message: "权限开放成功",
               type: "success",
@@ -6720,7 +6802,15 @@ export default {
         for (var i = 0; i < _state.length; i++) {
           let el = _state[i].chapterInfo[0].taskJson;
           for (var j = 0; j < el.length; j++) {
-            if (i == 0 && j == 0) {
+            // if (i == 0 && j == 0) {
+            //   el[j].isLook = true;
+            // } else {
+            //   el[j].isLook = false;
+            // }
+            if (
+              this.courseType > i ||
+              (this.courseType == i && this.taskCount + 1 > j)
+            ) {
               el[j].isLook = true;
             } else {
               el[j].isLook = false;
@@ -7584,7 +7674,9 @@ export default {
         // a.remove();
         let content = x.response;
         let elink = document.createElement("a");
-        elink.download = decodeURI(_url.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]);
+        elink.download = decodeURI(
+          _url.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]
+        );
         elink.style.display = "none";
         let blob = new Blob([content]);
         elink.href = URL.createObjectURL(blob);
@@ -7608,6 +7700,55 @@ export default {
         document.getElementsByClassName("student_body").length &&
         document.getElementsByClassName("student_body")[0].offsetWidth;
     },
+    closeDraw() {
+      this.bg = null;
+      this.drawShow = false;
+    },
+    showPicturePaint(url) {
+      let params = {
+        img: url,
+      };
+      this.ajax
+        .get(this.$store.state.api + "imgToBase64", params)
+        .then((res) => {
+          console.log(res);
+          this.drawShow = true;
+          this.bg = res.data[0].img;
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    addImgDraw(base64) {
+      let file = { name: "批注图.png" };
+      let img = this.dataUrlToFile(base64, file);
+      this.beforeUpload1(img, 5);
+    },
+    addImgDrawImG(url) {
+       // console.log(url);
+       let params = [
+        {
+          wid: this.commentDetail.wid,
+          img: url,
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "updateCourseWorks", params)
+        .then((res) => {
+          this.$message({
+            message: "提交成功",
+            type: "success",
+          });
+          this.drawShow = false;
+          this.bg = "";
+          this.selectSWorks();
+          this.selectStudent();
+        })
+        .catch((err) => {
+          this.$message.error("提交失败");
+          console.error(err);
+        });
+    },
   },
   directives: {
     // 使用局部注册指令的方式
@@ -7653,7 +7794,7 @@ export default {
     if (this.screenType == 2) {
       window.parent.postMessage({ allScreen: 4 }, "*");
     } else if (this.screenType == 3) {
-      window.parent.postMessage({ allScreen: '5gm' }, "*");
+      window.parent.postMessage({ allScreen: "5gm" }, "*");
     } else if (this.screenType == 1) {
       window.parent.postMessage({ allScreen: 6 }, "*");
     }
@@ -8822,7 +8963,7 @@ export default {
 }
 
 .openTaskActive {
-  color: #947edc;;
+  color: #947edc;
 }
 
 .iframeName {
@@ -9480,7 +9621,7 @@ export default {
 }
 
 .isClickNav {
-  color: #947edc;;
+  color: #947edc;
 }
 
 .commentImg {
@@ -9551,8 +9692,11 @@ export default {
 }
 
 .worksAnswer > img {
-  width: 100%;
-  height: 100%;
+  width: 500px;
+  height: 300px;
+  object-fit:contain;
+  margin:0 auto;
+  display: block;
 }
 
 .commentTop {
@@ -10027,7 +10171,7 @@ export default {
 }
 
 .addPz {
-  background:#8681b7;
+  background: #8681b7;
   width: 100px;
   color: #fff;
   font-size: 12px;
@@ -10279,4 +10423,24 @@ ol {
 .rightW {
   right: 40px;
 }
+
+.drawPBox {
+  display: flex;
+  flex-direction: column;
+}
+.drawPBox span{
+  font-size: 18px;
+    color: #606266;
+    padding-bottom: 10px;
+    margin: 10px 0;
+    border-bottom: 1px solid #eaeaea;
+}
+.drawPBox img {
+  width: 500px;
+  height: 300px;
+  object-fit: contain;
+  cursor: pointer;
+  margin: 0 auto;
+}
+
 </style>

+ 155 - 17
src/components/studyStudent.vue

@@ -1595,7 +1595,7 @@
                         <div class="workImg" v-if="w.type == 0">
                           <img
                             :src="w.works"
-                            @click="previewImg(w.works)"
+                            @click="commentOther(w, toolIndex, wIndex)"
                             alt
                           />
                           <div
@@ -2168,7 +2168,7 @@
                         <div class="workImg">
                           <img
                             :src="w.works"
-                            @click="previewImg(w.works)"
+                            @click="commentOther(w, toolIndex, wIndex)"
                             alt
                           />
                           <div
@@ -2290,7 +2290,7 @@
                         <div class="workImg">
                           <img
                             :src="w.works"
-                            @click="previewImg(w.works)"
+                            @click="commentOther(w, toolIndex, wIndex)"
                             alt
                           />
                           <div
@@ -2412,7 +2412,7 @@
                         <div class="workImg">
                           <img
                             :src="w.works"
-                            @click="previewImg(w.works)"
+                            @click="commentOther(w, toolIndex, wIndex)"
                             alt
                           />
                           <div
@@ -2534,7 +2534,7 @@
                         <div class="workImg">
                           <img
                             :src="w.works"
-                            @click="previewImg(w.works)"
+                            @click="commentOther(w, toolIndex, wIndex)"
                             alt
                           />
                           <div
@@ -3876,6 +3876,18 @@
             <div style="margin-bottom: 5px">{{ commentDetail.sName }}</div>
             <div>{{ commentDetail.time }}</div>
           </div>
+          <div
+            class="returnBtn"
+            style="margin-left: auto;width: 80px;"
+            v-if="
+              commentDetail.works &&
+              commentDetail.type == 0 &&
+              (tType == 1 || tType == 4)
+            "
+            @click="showPicturePaint(commentDetail.works)"
+          >
+            教师批注
+          </div>
         </div>
         <div
           class="worksAnswer"
@@ -3985,6 +3997,14 @@
             <div>{{ commentDetail.commentCount }}</div>
           </div>
         </div>
+        <div class="drawPBox" v-if="commentDetail.img">
+            <span>教师批注</span>
+            <img
+              :src="commentDetail.img"
+              alt=""
+              @click="previewImg(commentDetail.img)"
+            />
+          </div>
       </div>
       <div class="commentBox">
         <div class="pl">评论:</div>
@@ -4389,6 +4409,12 @@
         >
       </span>
     </el-dialog>
+    <ImgDraw
+      :drawShow="drawShow"
+      @closeDraw="closeDraw"
+      @addImgDraw="addImgDraw"
+      :bg="bg"
+    ></ImgDraw>
   </div>
 </template>
 
@@ -4406,6 +4432,7 @@ import Sunburst from "./tools/sunburst";
 import SeeBoard from "./tools/seeBoard";
 import * as imageConversion from "image-conversion";
 import Audio from "./components/audio.vue";
+import ImgDraw from "./tools/imgDraw/imgDraw";
 
 export default {
   components: {
@@ -4419,9 +4446,12 @@ export default {
     SeeBoard,
     AnswerData2,
     Audio,
+    ImgDraw,
   },
   data() {
     return {
+      bg: null,
+      drawShow: false,
       dialogVisible: false,
       commentDialogVisible: false,
       videoVisible: false,
@@ -4917,6 +4947,7 @@ export default {
                       works: b[j].content,
                       sName: b[j].name,
                       score: b[j].score,
+                      img: b[j].img,
                       type: 1,
                       time: b[j].time,
                       userid: b[j].userid,
@@ -4935,6 +4966,7 @@ export default {
                       works: b[j].content,
                       sName: b[j].name,
                       score: b[j].score,
+                      img: b[j].img,
                       type: 3,
                       time: b[j].time,
                     });
@@ -4945,6 +4977,7 @@ export default {
                       works: b[j].content,
                       sName: b[j].name,
                       score: b[j].score,
+                      img: b[j].img,
                       type: 4,
                       time: b[j].time,
                     });
@@ -4955,6 +4988,7 @@ export default {
                       works: b[j].content,
                       sName: b[j].name,
                       score: b[j].score,
+                      img: b[j].img,
                       type: 5,
                       time: b[j].time,
                     });
@@ -4963,6 +4997,7 @@ export default {
                       works: b[j].content,
                       sName: b[j].name,
                       score: b[j].score,
+                      img: b[j].img,
                       type: 0,
                       time: b[j].time,
                       userid: b[j].userid,
@@ -4974,6 +5009,7 @@ export default {
                     works: b[j].content,
                     sName: b[j].name,
                     score: b[j].score,
+                    img: b[j].img,
                     type: 2,
                     time: b[j].time,
                     userid: b[j].userid,
@@ -4985,6 +5021,7 @@ export default {
                     works: b[j].content,
                     sName: b[j].name,
                     score: b[j].score,
+                    img: b[j].img,
                     type: 2,
                     time: b[j].time,
                     userid: b[j].userid,
@@ -4996,6 +5033,7 @@ export default {
                     works: b[j].content,
                     sName: b[j].name,
                     score: b[j].score,
+                    img: b[j].img,
                     type: 8,
                     time: b[j].time,
                     userid: b[j].userid,
@@ -5468,6 +5506,7 @@ export default {
                       type: 1,
                       time: b[j].time,
                       score: b[j].score,
+                      img: b[j].img,
                       likesCount: likesCount,
                       commentCount: commentCount,
                       isLikes: isLikes,
@@ -5488,6 +5527,7 @@ export default {
                       type: 3,
                       time: b[j].time,
                       score: b[j].score,
+                      img: b[j].img,
                       likesCount: likesCount,
                       commentCount: commentCount,
                       isLikes: isLikes,
@@ -5502,6 +5542,7 @@ export default {
                       type: 4,
                       time: b[j].time,
                       score: b[j].score,
+                      img: b[j].img,
                       likesCount: likesCount,
                       commentCount: commentCount,
                       isLikes: isLikes,
@@ -5516,6 +5557,7 @@ export default {
                       type: 5,
                       time: b[j].time,
                       score: b[j].score,
+                      img: b[j].img,
                       likesCount: likesCount,
                       commentCount: commentCount,
                       isLikes: isLikes,
@@ -5530,6 +5572,7 @@ export default {
                       type: 0,
                       time: b[j].time,
                       score: b[j].score,
+                      img: b[j].img,
                       likesCount: likesCount,
                       commentCount: commentCount,
                       isLikes: isLikes,
@@ -5545,6 +5588,7 @@ export default {
                     type: 2,
                     time: b[j].time,
                     score: b[j].score,
+                    img: b[j].img,
                     likesCount: likesCount,
                     commentCount: commentCount,
                     isLikes: isLikes,
@@ -5560,6 +5604,7 @@ export default {
                     type: 2,
                     time: b[j].time,
                     score: b[j].score,
+                    img: b[j].img,
                     likesCount: likesCount,
                     commentCount: commentCount,
                     isLikes: isLikes,
@@ -5575,6 +5620,7 @@ export default {
                     type: 8,
                     time: b[j].time,
                     score: b[j].score,
+                    img: b[j].img,
                     likesCount: likesCount,
                     commentCount: commentCount,
                     isLikes: isLikes,
@@ -5680,8 +5726,12 @@ export default {
     },
     async beforeUpload1(event, type, i) {
       // this.$message.success('进入上传')
-
-      var file = event.target.files[0];
+      var file = "";
+      if (type == 5) {
+        file = event;
+      } else {
+        file = event.target.files[0];
+      }
       var credentials = {
         accessKeyId: "AKIATLPEDU37QV5CHLMH",
         secretAccessKey: "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",
@@ -5868,6 +5918,8 @@ export default {
                 _this.addCourseWorks(i);
               } else if (type == 4) {
                 _this.addPz("3", data.Location);
+              } else if (type == 5) {
+                _this.addImgDrawImG(data.Location);
               }
               _this.imgChange(null, null, type);
               console.log(data.Location);
@@ -6002,7 +6054,8 @@ export default {
             if (
               !this.chapInfoList[this.courseType].chapterInfo[0].taskJson[bbb]
                 .isLook &&
-              this.courseDetail.userid != this.userid  && this.IsLookOpen
+              this.courseDetail.userid != this.userid &&
+              this.IsLookOpen
             ) {
               this.$message.error("任务未解锁");
               return;
@@ -6024,7 +6077,8 @@ export default {
             var bbb = parseInt(this.courseType) + 1;
             if (
               !this.chapInfoList[bbb].chapterInfo[0].taskJson[0].isLook &&
-              this.courseDetail.userid != this.userid  && this.IsLookOpen
+              this.courseDetail.userid != this.userid &&
+              this.IsLookOpen
             ) {
               this.$message.error("任务未解锁");
               return;
@@ -6038,7 +6092,8 @@ export default {
             if (
               !this.chapInfoList[this.courseType].chapterInfo[0].taskJson[bbb]
                 .isLook &&
-              this.courseDetail.userid != this.userid && this.IsLookOpen
+              this.courseDetail.userid != this.userid &&
+              this.IsLookOpen
             ) {
               this.$message.error("任务未解锁");
               return;
@@ -6601,9 +6656,9 @@ export default {
         .post(this.$store.state.api + "updateCourseLookOpen", params)
         .then((res) => {
           if (this.IsLookOpen == true) {
-            if (this.courseType != 0 && this.taskCount != 0) {
-              this.openTask(0, 0, "0-0");
-            }
+            // if (this.courseType != 0 && this.taskCount != 0) {
+            //   this.openTask(0, 0, "0-0");
+            // }
             this.$message({
               message: "权限开放成功",
               type: "success",
@@ -6707,11 +6762,21 @@ export default {
     },
     addCourseState(type) {
       let _state = this.chapInfoList;
+      // this.courseType   this.taskCount
       if (type == 1 || type == 2) {
         for (var i = 0; i < _state.length; i++) {
           let el = _state[i].chapterInfo[0].taskJson;
           for (var j = 0; j < el.length; j++) {
-            if (i == 0 && j == 0) {
+            // if (i == 0 && j == 0) {
+            //   el[j].isLook = true;
+            // } else {
+            //   el[j].isLook = false;
+            // }
+
+            if (
+              this.courseType > i ||
+              (this.courseType == i && this.taskCount + 1 > j)
+            ) {
               el[j].isLook = true;
             } else {
               el[j].isLook = false;
@@ -7575,7 +7640,9 @@ export default {
         // a.remove();
         let content = x.response;
         let elink = document.createElement("a");
-        elink.download = decodeURI(_url.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]);
+        elink.download = decodeURI(
+          _url.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]
+        );
         elink.style.display = "none";
         let blob = new Blob([content]);
         elink.href = URL.createObjectURL(blob);
@@ -7599,6 +7666,55 @@ export default {
         document.getElementsByClassName("student_body").length &&
         document.getElementsByClassName("student_body")[0].offsetWidth;
     },
+    closeDraw() {
+      this.bg = null;
+      this.drawShow = false;
+    },
+    showPicturePaint(url) {
+      let params = {
+        img: url,
+      };
+      this.ajax
+        .get(this.$store.state.api + "imgToBase64", params)
+        .then((res) => {
+          console.log(res);
+          this.drawShow = true;
+          this.bg = res.data[0].img;
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    addImgDraw(base64) {
+      let file = { name: "批注图.png" };
+      let img = this.dataUrlToFile(base64, file);
+      this.beforeUpload1(img, 5);
+    },
+    addImgDrawImG(url) {
+      // console.log(url);
+      let params = [
+        {
+          wid: this.commentDetail.wid,
+          img: url,
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "updateCourseWorks", params)
+        .then((res) => {
+          this.$message({
+            message: "提交成功",
+            type: "success",
+          });
+          this.drawShow = false;
+          this.bg = "";
+          this.selectSWorks();
+          this.selectStudent();
+        })
+        .catch((err) => {
+          this.$message.error("提交失败");
+          console.error(err);
+        });
+    },
   },
   directives: {
     // 使用局部注册指令的方式
@@ -9542,8 +9658,11 @@ export default {
 }
 
 .worksAnswer > img {
-  width: 100%;
-  height: 100%;
+  width: 500px;
+  height: 300px;
+  object-fit:contain;
+  margin:0 auto;
+  display: block;
 }
 
 .commentTop {
@@ -10269,4 +10388,23 @@ ol {
 .rightW {
   right: 40px;
 }
+
+.drawPBox {
+  display: flex;
+  flex-direction: column;
+}
+.drawPBox span {
+  font-size: 18px;
+  color: #606266;
+  padding-bottom: 10px;
+  margin: 10px 0;
+  border-bottom: 1px solid #eaeaea;
+}
+.drawPBox img {
+  width: 500px;
+  height: 300px;
+  object-fit: contain;
+  cursor: pointer;
+  margin: 0 auto;
+}
 </style>

+ 9 - 0
src/components/tools/imgDraw/cursor.js

@@ -0,0 +1,9 @@
+let cursors={
+    pen:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACd0lEQVRYR+2WT2gTQRTGv7eb9JLkmPoHvHkQLy2i94o0KMiyMxgRbwrmpigeFBUJFPHiRegpgiLiQZbMTFoR/4AX7UVQCD14EfGcQkGFiia7T0Yq1HWTbLeGgnSOszPv9/HNex9L2ORFm8zHloD/1gHyff8cEZ0EEAIIyuXybKPR6MZ7biQOCCEaAM6shRHRrFLq7MgF+L5/nIgexUHMHOXz+XIQBMt/CPuXY+h53m7Xdd8BKPWpO6m1bo9EQLVaHet2uwtEtL8P/HMul9sRBMG3kQjwff8WEV3sA2cAp7TW90fSA0KIwwCeAInBxsx8wRhzO0nchqdACDEeRVHbcZztCQA7gjWt9d1+vbYhAfV63Wm3208BTCcAekR0Win1YFCjb0iAEOIygJsJgB9EdEIppYdNWWYBUsoDzPwawFgMssLMwhjzfBjcfs8sQAjRBCBjkC9RFB1ttVqv0sBTC6hUKoVisSiZeS8RPVZKLQghbNTayP29lpn5iDHmTVp4KgGrVhsAO1cLv9RaH7LuSSlvMPN5AF8BVOIpl0bIwCeoVqvlXq+3CGDbmmI2VI5prZXdm5qaypVKpbH5+fmVNMB1BZGUcoaZr8UvMXPXcZx7RHSn2Wy+BWBFZVp9HajVavmlpaVPa6xPBBDRdaXUTCZ6vynwPK/kuu4lAFeHFWbmK8aYpCwYdvXX978ckFLuY2Zra9plm+9F2sNDe8COXKFQ+AhgPEXRxYmJicl6vR6lOJv8hEm71oUwDB86jrNnQOH3YRh6c3NzH7LCB+aAbcJOp3OQiKaZeRcRWUe+A+gQ0TPXdXX85yKLkMxRnAWWdGdLwJYDPwFn/dQhz4OkVwAAAABJRU5ErkJggg==',
+    line:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA4klEQVRYR+3WTQrCMBCG4fmy8AYeyo2kBS+goAsPJPhzhTEIHso7SEa6EETsXzJjN+m+vE8nhQlo4gcT96kAygRMJ1BV1RrAg5nvbT+7GaCJi8gJwBPAiplvvxAmAO/9hoiOAJyIRCLahhAufwF8fLkjIhGRfQjh8JcjGBtvUGpHkBJXA6TGVQA58WxAbjwLoBFPBmjFkwCa8dEA7fgogEV8MMAqPghgGe8FWMc7Ad8r1Tm3Y+az9i26dRl57xcArkQ061upOajObVjX9TLGOG+7TOSE3++qreNUTAGUCUw+gRcF0dchsIjssQAAAABJRU5ErkJggg==',
+    round:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACpUlEQVRYR+2WPW8TQRCG39mLqUBQuKQiCeJDSiT4DRCFwtk964KQ6BCWoCUfonMJOD1gRAkCjG/ODUmB+AcgpQECCVW6NBFQYecGbbSHEhPfnZ0ijbezduedx7PvzhzhiBcdcX4MAYYV6KsCQRAc29nZMSIyA+ASEZ22JhaRTQCfRCQqFApRo9H4k9fcuQG01mUiegTgTIb4BoAFZg7zQGQCBEHgtdvth0R0r0twTUQ2iMhqjAI427W/NDk5uVitVuM0kEwArfXSnuQdInpGREvNZvPHXuFSqTQ2MjIyLyK3AHhur8bMCwMDuLK/dQLbAMrM/CFN0BhzBUADwEnnDxNFUdQrpmcFrOE6nc4Xd+cdAFNZyZMkWuurRPTOVoKI1j3Pu9jLmD0BfN+/LiKvrCgRPQ7D8G4eUyVnjDF1ALfd71lmtlX5b/UEMMa8BHDDRiilRrvvPAumXC6Px3H8zZ17wcw3+wVYs86O4/hrq9U6n5XwoH1jjAUYB7DGzOf6BfgF4DiAZWa+NgiA1nqFiKYA/GbmE4MCrDDz9CEBfjLz7qvoXmke2L2CtPJlQRljMjVymVBExqIosi0297KNyfO87wObUGs9S0SvncATZr6TOzsA3/efikjFPeMgDMOkoe2TyWpEn12f7yilppvN5vs8EK4bLieNqFgsXqjX6+2+PGAPG2N8AE0XuK2UCrIgXPI3AE65OM3MrV7gmcPIGFMDMOcEbEt+LiK1bk8cNIzs+A7DcDGtapkA1WpVra6uPgAw3yVkm4w1ZjKObcP5t2zyiYmJ+4cex4mi1lorpWr2RaT+I6J1EZlLK/s+0DymSs5UKpXC1taWBjATx/FlpdTuJ1kcx5tKqY9EFBWLxVYvw/Vtwn7gBj2b6YFBhfPGDQGGFfgLW7AHMIfxtKYAAAAASUVORK5CYII=',
+    trangle:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAl0lEQVRYR+2WsQ2DMBBF/w1BaLIIW/gKGJIU31uwCJUzhFGKVIAEjiUr0nd/95+f5DsbGh9rnA8ByIAMnBoIISQz62o805zzO8b4OOp1CuDuuUb4twfJw6wrACuApRBmAPD81P4C8CI5lQC4+wxgFIAMyIAM/L2B5qO4ZArvam7vgprrGEAi2d9ax1WufaGJvmQyIAPNDWzonXsh3WqxKQAAAABJRU5ErkJggg==',
+    eraser:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACaElEQVRYR+2Uv4sTQRTHv28ymKBYqAg2WolYJYKCWByiicGoIRvDdlcE4x9gb5PCWtDK7mxOi3Uzk6RT8VrxB/7qD1s5jyOgiLi7TwY2sIb8mM0WB3LTznvv+5nve/MIu3xol/WxB/B/ONButwuj0egOgGNCiIe+72/azlZmB2q1Wr5QKPgArhtRZt5i5nK/3/9iA5EJYFJ8LJgGYmmAWeJJiFwuV/F9//M8J5YCWCSeENxh5ita6/ezIFIDuK67LwgC0/MbNj0GsCOEqPq+/25afCqAeNoVgKuW4uOwbWauaK0/TuZZA2QQH2tuKqVOmo+ShLACiHtuXn4+Tj6c0gETHkopD3qe9ysVgBHP5/M9IrpARJX4r78AkBbigVLKLKt/zlwHzMCFYfiMmVeIqNrr9d6abMdxzhDRSwBHLJ1YK5VKt7vdbmQNEE+7B+AiM1e11m+SySkgZoqbelMdWCQ+BrGAmCs+E8BxnHUiupa0fZbVjuOcJSIzE4cmYhaKTwWo1+v7pZQ/AHSUUms2PW61WueiKHo+hiCix8VisTOt51Yz0Gw2PwEQUsrLnudt2UA0m827AO6lEZ83AyeCINgA8DsMw0uDweDbPAjHcVoAnhKRL6Vc9TwvtIGeCWAuXNc1EK8A/AyCoDwcDr9PK5pFfC6AuWw0GseFEMYJMxNlpdT2xFdc+uXjOgtXcezEBjOPANzUWn+Nl1GHiB4BeCKlvJXG9lSrOOGEBnA6iqIPQoijAE4x8x8iGpo9b9Hz10qp+1a/YFqxeDmtEtEKMx+wEJwMyQawhKBVysIZsKqSIWgPYNcd+AsPkxIwA3VPaAAAAABJRU5ErkJggg==',
+    text:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA5klEQVRYR+2VPwrCMBSHfwlFvIizq6u7y0vR2Qt4A0dP4AmcLSUUhI6Ozs5epA5NpKBQ1Ni0tAThZUxe8r735Z9A4CYC5wcDsAGngTiOJ8aYRR+HVEp5StP09m0tJwARLQEc+wAAsNJaJ38NsDXGnOsVSCnnAHbPvqbxTgam1tp1lUAIcdBaX+sAb1v0kYCIfs5/rdX5GjYB+J4dBmADbIANsIHWBpRSs7IspeszyrLsAsAO9hQT0R3AyJWgKIpxnudVjFdrbSA4gFJqY62NXOVFUbRPkqT0Kr/66n0Dh4pjADYQ3MADakKSIQVRq+oAAAAASUVORK5CYII='
+}
+export default cursors;

File diff suppressed because it is too large
+ 0 - 0
src/components/tools/imgDraw/img.js


+ 1019 - 0
src/components/tools/imgDraw/imgDraw.vue

@@ -0,0 +1,1019 @@
+<template>
+  <div class="imgDraw">
+    <a
+      href="javascript:void(0);"
+      ref="download"
+      download="picture.png"
+      v-show="false"
+    ></a>
+    <el-button type="primary" @click="handleShowCanvas">showCanvas</el-button>
+    <el-dialog
+      destroy-on-close
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      :show-close="false"
+      :visible.sync="show"
+      fullscreen
+    >
+      <!-- <p slot="title" class="title">Vue-ImagePainter🎨</p> -->
+      <div class="d_body">
+        <div class="board" ref="board">
+          <img id="img1" ref="img1" v-bind:src="baseMap" hidden="hidden" />
+          <canvas
+            id="ctx_front"
+            ref="ctx_front"
+            :style="'cursor:' + cursor"
+          ></canvas>
+          <canvas
+            id="ctx_base"
+            ref="ctx_base"
+            :style="'cursor:' + cursor"
+          ></canvas>
+          <canvas
+            id="ctx_back"
+            ref="ctx_back"
+            :style="'cursor:' + cursor"
+          ></canvas>
+          <input
+            name="text"
+            id="text"
+            @blur="handleTextBlur"
+            @keyup.enter="handleTextBlur"
+            v-model="text"
+            autofocus
+            autocomplete="off"
+            :style="
+              'font-size:' + (this.slide * 10 + 14) + 'px;color:' + defaultColor
+            "
+          />
+        </div>
+        <div :class="['tools', 'settings', isExpand ? '' : 'noExpand']">
+          <div
+            class="tool_item"
+            v-for="(item, index) in settings"
+            :key="item.icon"
+          >
+            <button v-if="index == 0">
+              <svg
+                class="icon"
+                aria-hidden="true"
+                :style="'color:' + defaultColor"
+              >
+                <use :xlink:href="item.icon" />
+              </svg>
+              <span :style="'color:' + defaultColor">{{ item.name }}</span>
+              <el-color-picker v-model="defaultColor"></el-color-picker>
+            </button>
+            <div v-else-if="index == 1" class="slide">
+              <svg class="icon" aria-hidden="true">
+                <use :xlink:href="item.icon" />
+              </svg>
+              <span>{{ item.name }}</span
+              >&emsp;&emsp;
+              <el-slider
+                ref="slide"
+                v-model="slide"
+                :min="1"
+                :max="100"
+                :step="1"
+                style="width: 70px"
+              ></el-slider>
+            </div>
+            <button v-else @click.stop="item.fun">
+              <svg class="icon" aria-hidden="true">
+                <use :xlink:href="item.icon" />
+              </svg>
+              <span>{{ item.name }}</span>
+            </button>
+          </div>
+          <div class="tool_item" v-for="item in btns" :key="item.icon">
+            <button
+              @click.stop="item.fun"
+              v-if="item.name == '上一步'"
+              :disabled="prevDis"
+              :style="prevDis ? 'cursor:not-allowed' : ''"
+            >
+              <svg class="icon" aria-hidden="true">
+                <use :xlink:href="item.icon" />
+              </svg>
+              <span>{{ item.name }}</span>
+            </button>
+            <button
+              @click.stop="item.fun"
+              v-else-if="item.name == '下一步'"
+              :disabled="nextDis"
+              :style="nextDis ? 'cursor:not-allowed' : ''"
+            >
+              <svg class="icon" aria-hidden="true">
+                <use :xlink:href="item.icon" />
+              </svg>
+              <span>{{ item.name }}</span>
+            </button>
+            <button @click.stop="item.fun" v-else>
+              <svg class="icon" aria-hidden="true" v-if="item.icon">
+                <use :xlink:href="item.icon" />
+              </svg>
+              <span>{{ item.name }}</span>
+            </button>
+          </div>
+          <div class="tool_item go_up">
+            <button @click.stop="handleShowOrHide(0)">
+              <i class="el-icon-caret-top"></i>
+              <span>收起</span>
+            </button>
+          </div>
+          <div class="pull" v-if="!isExpand">
+            <span class="line"></span>
+            <span
+              class="round"
+              title="展开"
+              @click.stop="handleShowOrHide(1)"
+            ></span>
+          </div>
+        </div>
+        <div :class="['tools', 'bars', showTools ? '' : 'hideTools']">
+          <div
+            class="el-icon-s-tools arrow"
+            v-if="!showTools"
+            title="展开"
+            @click.stop="handleShowTools(1)"
+          ></div>
+          <div
+            class="el-icon-arrow-right arrow"
+            v-else
+            title="收起"
+            @click.stop="handleShowTools(0)"
+          ></div>
+          <div
+            :class="[
+              'tool_item',
+              activeTool == item.toolType ? 'activeTool' : '',
+            ]"
+            v-for="item in tools"
+            :key="item.toolType"
+            @click.stop="handleChangeToolType(item.toolType)"
+          >
+            <svg class="icon" aria-hidden="true">
+              <use :xlink:href="item.icon" />
+            </svg>
+            <span>{{ item.name }}</span>
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+// eslint-disable-next-line no-unused-vars
+import cursors from "./cursor";
+import "../../../assets/drawIcon/iconfont";
+import bgA from "./img";
+export default {
+  name: "imgDraw",
+  props: {
+    drawShow: {
+      type: Boolean,
+      default: false,
+    },
+    bg: {
+      type: String,
+    },
+    closeDraw: {
+      type: Function,
+    },
+  },
+  data() {
+    return {
+      show: true,
+      defaultColor: "#333333",
+      cursor: `url('${cursors.pen}'),auto`,
+      slide: 1,
+      settings: [
+        {
+          icon: "#icon-youqitong_huaban1",
+          name: "颜色",
+          fun: "",
+        },
+        {
+          icon: "#icon-huabi_huaban1",
+          name: "粗细",
+          fun: "",
+        },
+        {
+          icon: "#icon-fangda_huaban1",
+          name: "放大",
+          fun: () => {
+            return this.handleBeLarge();
+          },
+        },
+        {
+          icon: "#icon-suoxiao_huaban1",
+          name: "缩小",
+          fun: () => {
+            return this.handleBeSmall();
+          },
+        },
+      ],
+      activeTool: 1,
+      tools: [
+        {
+          icon: "#icon-huabi_huaban1",
+          name: "画笔",
+          toolType: 1,
+        },
+        // {
+        //   icon: "#icon-zhixian_huaban1",
+        //   name: "直线",
+        //   toolType: 2,
+        // },
+        // {
+        //   icon: "#icon-yuanquan_huaban1",
+        //   name: "圆形",
+        //   toolType: 3,
+        // },
+        // {
+        //   icon: "#icon-juxinggongju_huaban1",
+        //   name: "矩形",
+        //   toolType: 4,
+        // },
+        // {
+        //   icon: "#icon-xiangpi_huaban1",
+        //   name: "橡皮",
+        //   toolType: 5,
+        // },
+        {
+          icon: "#icon-wenzi_huaban1",
+          name: "文字",
+          toolType: 6,
+        },
+      ],
+      btns: [
+        {
+          icon: "#icon-chexiao",
+          name: "上一步",
+          fun: () => {
+            return this.handlePrev();
+          },
+        },
+        {
+          icon: "#icon-zhongzuo",
+          name: "下一步",
+          fun: () => {
+            return this.handleNext();
+          },
+        },
+        {
+          icon: "#icon-lajixiang_huaban1",
+          name: "清除",
+          fun: () => {
+            return this.handleClearCanvas();
+          },
+        },
+        {
+          // icon: "#icon-baocun",
+          icon: "",
+          name: "关闭",
+          fun: () => {
+            // return this.handleCanvas2Img();
+            // return (this.show = false);
+            return this.$emit("closeDraw");
+          },
+        },
+        {
+          icon: "",
+          name: "保存批注",
+          fun: () => {
+            return this.handleSave();
+          },
+        },
+      ],
+      canvas_front: null,
+      canvas_back: null,
+      canvas_base: null,
+      ctx_base: null,
+      ctx_front: null,
+      ctx_back: null,
+      currentImg: {
+        url: "",
+        width: "",
+        height: "",
+        scale: 1,
+        index: 0,
+      },
+      isExpand: 1,
+      showTools: 1,
+      canDraw: false,
+      text: "",
+      canvasStore: [""],
+      prevDis: true,
+      nextDis: true,
+      baseMap: "",
+      tl: 0,
+      tt: 0,
+    };
+  },
+  methods: {
+    /** 显示或隐藏设置栏*/
+    handleShowOrHide(status) {
+      this.isExpand = status;
+    },
+    /** 显示或隐藏工具栏*/
+    handleShowTools(status) {
+      this.showTools = status;
+    },
+    handleShowCanvas() {
+      this.show = true;
+    },
+    /** 工具切换*/
+    handleChangeToolType(type) {
+      this.activeTool = type;
+      switch (type) {
+        case 1:
+          this.cursor = `url('${cursors.pen}'),auto`;
+          break;
+        case 2:
+          this.cursor = `crosshair`;
+          break;
+        case 3:
+          this.cursor = `crosshair`;
+          break;
+        case 4:
+          this.cursor = `crosshair`;
+          break;
+        case 5:
+          this.cursor = `url('${cursors.eraser}'),auto`;
+          break;
+        case 6:
+          this.cursor = `url('${cursors.text}'),auto`;
+          break;
+        default:
+          this.cursor = `url('${cursors.pen}'),auto`;
+          break;
+      }
+      this.handleDrawCanvas(type);
+    },
+    /** 初始化画布*/
+    handleInitCanvas() {
+      this.currentImg = {
+        url: this.bg || bgA,
+        width: "",
+        height: "",
+        scale: 1,
+        index: 0,
+      };
+      this.canvasStore = [this.bg || bgA];
+      this.prevDis = true;
+      this.nextDis = true;
+      this.baseMap = this.bg || bgA;
+      // 用于绘制的画板
+      this.canvas_front = document.getElementById("ctx_front");
+      // 用于生成绘制后图片的画板
+      this.canvas_back = document.getElementById("ctx_back");
+      // 底图画板,橡皮擦除时获取像素放到绘制画板中,达到不擦出底图的效果
+      this.canvas_base = document.getElementById("ctx_base");
+
+      this.ctx_base = this.canvas_base.getContext("2d");
+      this.ctx_front = this.canvas_front.getContext("2d");
+      this.ctx_back = this.canvas_back.getContext("2d");
+      this.ctx_front.strokeStyle = this.defaultColor;
+      let img = new Image();
+      img.src = this.baseMap;
+      img.crossOrigin = "";
+      let _this = this;
+      img.onload = function () {
+        let width = parseInt(this.width);
+        let height = parseInt(this.height);
+        _this.currentImg.width = width;
+        _this.currentImg.height = height;
+        _this.canvas_front.width = width;
+        _this.canvas_front.height = height;
+        _this.canvas_back.width = width;
+        _this.canvas_back.height = height;
+        _this.canvas_base.width = width;
+        _this.canvas_base.height = height;
+        _this.ctx_front.drawImage(this, 0, 0, width, height);
+        _this.ctx_back.drawImage(this, 0, 0, width, height);
+        _this.ctx_base.drawImage(this, 0, 0, width, height);
+      };
+    },
+    /** 处理放大缩小*/
+    handleDrawImage() {
+      let _this = this;
+      let img = new Image();
+      let baseImg = new Image();
+      img.src = this.currentImg.url;
+      baseImg.src = this.baseMap;
+      _this.currentImg.width = _this.currentImg.width * this.currentImg.scale;
+      _this.currentImg.height = _this.currentImg.height * this.currentImg.scale;
+      img.onload = function () {
+        _this.canvas_front.width = _this.currentImg.width;
+        _this.canvas_front.height = _this.currentImg.height;
+        _this.canvas_back.width = _this.currentImg.width;
+        _this.canvas_back.height = _this.currentImg.height;
+        _this.ctx_front.drawImage(
+          this,
+          0,
+          0,
+          _this.currentImg.width,
+          _this.currentImg.height
+        );
+        _this.ctx_back.drawImage(
+          this,
+          0,
+          0,
+          _this.currentImg.width,
+          _this.currentImg.height
+        );
+      };
+      baseImg.onload = () => {
+        _this.canvas_base.width = _this.currentImg.width;
+        _this.canvas_base.height = _this.currentImg.height;
+        _this.ctx_base.drawImage(
+          baseImg,
+          0,
+          0,
+          _this.currentImg.width,
+          _this.currentImg.height
+        );
+      };
+    },
+    handleBeLarge() {
+      this.currentImg.scale = 1;
+      this.currentImg.scale += 0.1;
+      this.$nextTick(() => {
+        this.handleDrawImage();
+      });
+    },
+    handleBeSmall() {
+      this.currentImg.scale = 1;
+      this.currentImg.scale -= 0.1;
+      this.$nextTick(() => {
+        this.handleDrawImage();
+      });
+    },
+    /** 下载图片*/
+    handleCanvas2Img() {
+      let canvas = document.getElementById("ctx_back");
+      this.$refs.download.href = canvas.toDataURL();
+      this.$refs.download.click();
+    },
+    /** 清除画布*/
+    handleClearCanvas() {
+      this.handleInitCanvas();
+    },
+    handleFrommatCanvas() {
+      this.ctx_front.clearRect(
+        0,
+        0,
+        this.canvas_front.width,
+        this.canvas_front.height
+      );
+    },
+    handleDrawCanvas(type) {
+      this.canDraw = false;
+      let sx, sy, mx, my;
+      let text = document.getElementById("text");
+      //鼠标按下
+      let mousedown = (e) => {
+        this.ctx_front.strokeStyle = this.defaultColor;
+        this.ctx_front.lineWidth = this.slide;
+        e = e || window.event;
+        sx = e.clientX - this.canvas_front.offsetLeft;
+        sy = e.clientY - this.canvas_front.offsetTop;
+        // const cbx = this.ctx_base.getImageData(
+        //   e.offsetX - this.slide / 2,
+        //   e.offsetY - this.slide / 2,
+        //   this.slide * 2,
+        //   this.slide * 2
+        // );
+        this.ctx_front.moveTo(sx, sy);
+        this.canDraw = true;
+        switch (type) {
+          case 1:
+            this.ctx_front.beginPath();
+            break;
+          case 5:
+            this.ctx_front.putImageData(
+              cbx,
+              e.offsetX - this.slide / 2,
+              e.offsetY - this.slide / 2
+            );
+            break;
+          case 6:
+            this.handleTextBlur();
+            this.text = "";
+            text.style.fontSize = 14 + this.slide * 10 + "px";
+            text.style.color = this.defaultColor;
+            text.style.left =
+              e.offsetX + this.canvas_front.offsetLeft - 20 + "px";
+            text.style.top =
+              e.offsetY + this.canvas_front.offsetTop - 10 + "px";
+            text.style.zIndex = 10;
+            text.style.display = "block";
+            this.tl = e.offsetX - 20;
+            this.tt = e.offsetY + 10;
+            break;
+        }
+      };
+      let mousemove = (e) => {
+        e = e || window.event;
+        // mx = e.clientX - this.canvas_front.offsetLeft;
+        // my = e.clientY - this.canvas_front.offsetTop;
+        var scrollL =
+          document.getElementsByClassName("d_body")[0].scrollLeft ||
+          document.getElementsByClassName("d_body")[0].scrollLeft;
+        var scrollT =
+          document.getElementsByClassName("d_body")[0].scrollTop ||
+          document.getElementsByClassName("d_body")[0].scrollTop;
+        // mx = e.clientX + scrollL;
+        // my = e.clientY + scrollT;
+        mx = e.clientX - this.canvas_front.offsetLeft + scrollL;
+        my = e.clientY - this.canvas_front.offsetTop + scrollT;
+        // const cbx = this.ctx_base.getImageData(
+        //   e.offsetX - this.slide / 2,
+        //   e.offsetY - this.slide / 2,
+        //   this.slide * 2,
+        //   this.slide * 2
+        // );
+        if (this.canDraw) {
+          switch (type) {
+            case 1:
+              this.ctx_front.lineTo(mx - 8, my);
+              this.ctx_front.stroke();
+              break;
+            case 2:
+              this.handleFrommatCanvas();
+              this.ctx_front.beginPath();
+              this.ctx_front.moveTo(sx - 10, sy - 20);
+              this.ctx_front.lineTo(mx - 10, my - 20);
+              this.ctx_front.stroke();
+              break;
+            case 3:
+              this.handleFrommatCanvas();
+              this.ctx_front.beginPath();
+              // eslint-disable-next-line no-case-declarations
+              let rds = Math.sqrt(
+                (sx - 10 - mx) * (sx - 10 - mx) +
+                  (sy - 49 - my) * (sy - 49 - my)
+              );
+              this.ctx_front.arc(sx - 15, sy - 69, rds, 0, Math.PI * 2, false);
+              this.ctx_front.stroke();
+              break;
+            case 4:
+              this.handleFrommatCanvas();
+              this.ctx_front.beginPath();
+              this.ctx_front.moveTo(sx - 10, sy - 79);
+              this.ctx_front.lineTo(mx - 10, sy - 79);
+              this.ctx_front.lineTo(mx - 10, my - 79);
+              this.ctx_front.lineTo(sx - 10, my - 79);
+              this.ctx_front.lineTo(sx - 10, sy - 79);
+              this.ctx_front.stroke();
+              break;
+            case 5:
+              this.ctx_front.putImageData(
+                cbx,
+                e.offsetX - this.slide / 2,
+                e.offsetY - this.slide / 2
+              );
+              break;
+          }
+        }
+      };
+      let mouseup = () => {
+        if (this.canDraw) {
+          this.canDraw = false;
+          this.ctx_front.closePath();
+          if (type != 6) {
+            this.handleSaveCanvasStore();
+          }
+        }
+      };
+      this.canvas_front.onmousedown = (e) => mousedown(e);
+      this.canvas_front.onmousemove = (e) => mousemove(e);
+      this.canvas_front.onmouseup = (e) => mouseup(e);
+      this.canvas_front.onmouseout = (e) => mouseup(e);
+      this.canvas_front.onmouseleave = (e) => mouseup(e);
+    },
+    /** 失焦或者回车绘制文本,框隐藏*/
+    handleTextBlur() {
+      let text = document.getElementById("text");
+      this.ctx_front.font = `300 ${text.style.fontSize} sans-serif`;
+      this.ctx_front.fillStyle = this.defaultColor;
+      this.ctx_front.fillText(this.text, this.tl, this.tt);
+      text.style.display = "none";
+      this.text = "";
+      text.value = "";
+      this.handleSaveCanvasStore();
+    },
+    /** 上一步*/
+    handlePrev() {
+      if (this.currentImg.index > 0) {
+        this.nextDis = false;
+        this.currentImg.index -= 1;
+        this.currentImg.index == 0
+          ? (this.prevDis = true)
+          : (this.prevDis = false);
+        this.currentImg.url = this.canvasStore[this.currentImg.index];
+        this.currentImg.scale = 1;
+        this.handleDrawImage();
+      } else {
+        this.prevDis = true;
+      }
+    },
+    /** 下一步*/
+    handleNext() {
+      if (this.currentImg.index < this.canvasStore.length - 1) {
+        this.prevDis = false;
+        this.currentImg.index += 1;
+        this.currentImg.index == this.canvasStore.length - 1
+          ? (this.nextDis = true)
+          : (this.nextDis = false);
+        this.currentImg.url = this.canvasStore[this.currentImg.index];
+        this.currentImg.scale = 1;
+        this.handleDrawImage();
+      } else {
+        this.nextDis = true;
+      }
+    },
+    /** 保存绘制*/
+    handleSaveCanvasStore() {
+      let url = this.canvas_front.toDataURL();
+      let image = new Image();
+      image.src = url;
+      image.onload = () => {
+        this.ctx_front.clearRect(
+          0,
+          0,
+          this.canvas_front.width,
+          this.canvas_front.height
+        );
+        this.ctx_front.drawImage(image, 0, 0, image.width, image.height);
+        this.ctx_back.drawImage(image, 0, 0, image.width, image.height);
+        const url2 = this.canvas_back.toDataURL();
+        this.currentImg.url = url2;
+        this.currentImg.index += 1;
+        this.canvasStore.push(url2);
+        this.prevDis = false;
+        console.log(this.canvasStore);
+      };
+
+    },
+    // 将网络图片转换成base64格式
+    transBase64FromImage(image) {
+      let canvas = document.createElement("canvas");
+      canvas.width = image.width;
+      canvas.height = image.height;
+      let ctx = canvas.getContext("2d");
+      ctx.drawImage(image, 0, 0, image.width, image.height);
+      // 可选其他值 image/jpeg
+      return canvas.toDataURL("image/jpeg");
+    },
+    // 设置需要展示的图片  base64
+    setAvatarBase64(src, callback) {
+      let _this = this;
+      let image = new Image();
+      // 处理缓存
+      // image.src = src + "?v=" + Math.random();
+      image.src = src;
+      // 支持跨域图片
+      image.crossOrigin = "*";
+      image.onload = function () {
+        let base64 = _this.transBase64FromImage(image);
+        // callback && callback(base64);
+        console.log(base64);
+        // return base64
+      };
+    },
+    handleSave(){
+      let url = this.canvas_back.toDataURL();
+      console.log(url);
+      this.$emit('addImgDraw', url)
+    }
+  },
+  mounted() {
+    this.$nextTick(() => {
+      this.show = this.drawShow;
+      this.handleInitCanvas();
+      this.handleChangeToolType(1);
+    });
+  },
+  watch: {
+    drawShow(val) {
+      this.show = val;
+      this.ctx_base = null;
+      this.ctx_front = null;
+      this.ctx_back = null;
+      this.handleInitCanvas();
+      this.handleChangeToolType(1);
+    },
+  },
+};
+</script>
+
+<!-- Add "scoped" attribute to limit CSS to this component only -->
+<style scoped lang="css">
+* {
+  margin: 0;
+  padding: 0;
+  box-sizing: border-box;
+}
+.icon {
+  width: 1em;
+  height: 1em;
+  vertical-align: -0.15em;
+  fill: currentColor;
+  overflow: hidden;
+}
+.imgDraw >>> .el-dialog {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+.imgDraw >>> .el-dialog > div {
+  width: 100%;
+  box-sizing: border-box;
+}
+.imgDraw >>> .el-dialog .el-dialog__header {
+  padding: 0 20px;
+}
+.imgDraw >>> .el-dialog .el-dialog__header p {
+  padding: 20px 0;
+  border-bottom: 1px solid #bdbdbd;
+}
+.imgDraw >>> .el-dialog .el-dialog__body {
+  padding: 10px 20px;
+  flex: 1;
+  height: 0;
+  padding-top: 0;
+  position: relative;
+  overflow: hidden;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body {
+  height: 100%;
+  overflow-y: auto;
+  padding-top: 20px;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .board {
+  position: relative;
+  min-height: 100%;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .board canvas {
+  position: absolute;
+  margin: 0 auto;
+  left: 0;
+  right: 0;
+  top: 0;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .board #ctx_front {
+  z-index: 5;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .board #ctx_back {
+  z-index: 3;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .board #ctx_base {
+  z-index: 1;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .board #text {
+  position: absolute;
+  z-index: -1;
+  resize: none;
+  outline: none;
+  border: 1px dashed #eeeeee;
+  overflow: hidden;
+  background: transparent;
+  line-height: 30px;
+  display: none;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .tools {
+  width: 100%;
+  position: absolute;
+  display: flex;
+  z-index: 5;
+  background: #ffffff;
+  transition: all 0.2s ease-in-out;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .settings {
+  top: 0;
+  left: 50%;
+  transform: translateX(-50%);
+  z-index: 10;
+  padding: 5px 10px;
+  border-bottom-left-radius: 4px;
+  border-bottom-right-radius: 4px;
+  border: 1px solid #eeeeee;
+  border-top: 0;
+  width: auto;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .settings .tool_item {
+  display: flex;
+  align-items: center;
+  flex-wrap: nowrap;
+}
+.imgDraw
+  >>> .el-dialog
+  .el-dialog__body
+  .d_body
+  .settings
+  .tool_item:not(:last-of-type) {
+  margin-right: 25px;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .settings .go_up {
+  margin-right: 0 !important;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .settings button {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 5px 10px;
+  background: #ffffff;
+  border: 1px solid #eeeeee;
+  outline: none;
+  cursor: pointer;
+  position: relative;
+  flex-wrap: nowrap;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .settings button svg {
+  color: #333333;
+  font-size: 18px;
+  margin-right: 5px;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .settings button span {
+  white-space: nowrap;
+}
+.imgDraw
+  >>> .el-dialog
+  .el-dialog__body
+  .d_body
+  .settings
+  button
+  >>> .el-color-picker {
+  position: absolute;
+  left: 0;
+  top: 0;
+  width: 100%;
+  height: 100%;
+}
+.imgDraw
+  >>> .el-dialog
+  .el-dialog__body
+  .d_body
+  .settings
+  button
+  >>> .el-color-picker
+  .el-color-picker__trigger {
+  width: 100%;
+  height: 100%;
+  opacity: 0;
+  filter: alpha(opacity=0);
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .settings .slide {
+  width: 150px;
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  align-items: center;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .settings .slide svg {
+  font-size: 18px;
+  margin-right: 5px;
+}
+.imgDraw
+  >>> .el-dialog
+  .el-dialog__body
+  .d_body
+  .settings
+  .slide
+  >>> .el-slider {
+  flex: 1;
+  width: 0;
+  margin-left: 10px;
+}
+.imgDraw
+  >>> .el-dialog
+  .el-dialog__body
+  .d_body
+  .settings
+  .slide
+  >>> .el-slider
+  .el-slider__button-wrapper
+  .el-slider__button {
+  width: 12px;
+  height: 12px;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .settings .pull {
+  position: absolute;
+  right: 20px;
+  bottom: -45px;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: flex-start;
+  margin-right: 0;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .settings .pull .line {
+  width: 2px;
+  height: 30px;
+  background: dodgerblue;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .settings .pull .round {
+  width: 15px;
+  height: 15px;
+  border-radius: 50%;
+  background: dodgerblue;
+  cursor: pointer;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars {
+  top: 100px;
+  right: 30px;
+  z-index: 10;
+  padding: 15px;
+  border-top-left-radius: 4px;
+  border-bottom-left-radius: 4px;
+  border: 1px solid #eeeeee;
+  width: auto;
+  display: flex;
+  flex-direction: column;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars .tool_item {
+  cursor: pointer;
+}
+.imgDraw
+  >>> .el-dialog
+  .el-dialog__body
+  .d_body
+  .bars
+  .tool_item:not(:last-of-type) {
+  margin-bottom: 15px;
+  border-bottom: 1px solid #dddddd;
+  padding-bottom: 10px;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars .tool_item svg {
+  font-size: 24px;
+  margin-right: 8px;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars .tool_item span {
+  font-size: 18px;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars .tool_item:hover svg {
+  color: dodgerblue;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars .tool_item:hover span {
+  color: dodgerblue;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars .activeTool {
+  border-color: dodgerblue !important;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars .activeTool svg {
+  color: dodgerblue;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars .activeTool span {
+  color: dodgerblue;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars .arrow {
+  width: 20px;
+  height: 20px;
+  text-align: center;
+  line-height: 20px;
+  border-radius: 50%;
+  border: 1px solid #606266;
+  color: #606266;
+  position: absolute;
+  left: -10px;
+  background: #ffffff;
+  top: 50%;
+  transform: translateY(-50%);
+  cursor: pointer;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars .el-icon-s-tools {
+  left: -30px;
+  width: 30px;
+  height: 30px;
+  line-height: 30px;
+  font-size: 20px;
+  color: dodgerblue;
+  border-color: dodgerblue;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .bars .el-icon-arrow-right {
+  left: calc(100% - 10px);
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .hideTools {
+  right: -100px;
+}
+.imgDraw >>> .el-dialog .el-dialog__body .d_body .noExpand {
+  top: -50px;
+}
+.imgDraw >>> .el-dialog .el-dialog__footer {
+  text-align: center !important;
+}
+.imgDraw >>> .el-dialog .el-dialog__footer span button {
+  padding-left: 40px;
+  padding-right: 40px;
+}
+.imgDraw >>> .el-dialog .el-dialog__footer span button:first-of-type {
+  margin-right: 50px;
+}
+.imgDraw >>> .el-dialog .el-dialog__footer span button:last-of-type {
+  margin-left: 50px;
+}
+</style>

+ 2 - 2
src/config/config.js

@@ -9,9 +9,9 @@ const store = new Vuex.Store({
         luyou: 1,
         userInfo: {},
         nCount: 0,
-        api: 'https://pbl.cocorobo.cn/api/pbl/',
+        // api: 'https://pbl.cocorobo.cn/api/pbl/',
         socket: "https://poll.cocorobo.cn",
-        // api: 'http://localhost:7003/api/pbl/',
+        api: 'http://localhost:7003/api/pbl/',
     },
 
     mutations: {

Some files were not shown because too many files changed in this diff