Explorar el Código

仲裁给分标绿色

刘洋 hace 1 año
padre
commit
79fce2325a
Se han modificado 2 ficheros con 40 adiciones y 8 borrados
  1. 29 4
      src/features/ImageDownload/ImageDownload.vue
  2. 11 4
      src/lib/watermark.ts

+ 29 - 4
src/features/ImageDownload/ImageDownload.vue

@@ -84,7 +84,8 @@ onMounted(async () => {
   const storePassedToNodeJs = JSON.parse(JSON.stringify(store));
   const storePassedToNodeJs = JSON.parse(JSON.stringify(store));
   const color = storePassedToNodeJs.config.watermark.color;
   const color = storePassedToNodeJs.config.watermark.color;
   const nextColor = storePassedToNodeJs.config.watermark.nextColor;
   const nextColor = storePassedToNodeJs.config.watermark.nextColor;
-  const otherColor = storePassedToNodeJs.config.watermark.otherColor;
+  // const otherColor = storePassedToNodeJs.config.watermark.otherColor;
+  const otherColor = "#ddd";
   try {
   try {
     if (config.type === "1") {
     if (config.type === "1") {
       console.log("download start ", Date.now());
       console.log("download start ", Date.now());
@@ -142,15 +143,38 @@ onMounted(async () => {
             } else {
             } else {
               item.hide = false;
               item.hide = false;
             }
             }
+            if (
+              allTags.find((v: any) => {
+                return (
+                  v.groupNumber == item.groupNumber &&
+                  v.userRole &&
+                  v.userRole !== "MARKER" &&
+                  (item.userRole === "MARKER" || !item.userRole)
+                );
+              })
+            ) {
+              item.forceHide = true;
+            }
           });
           });
 
 
-          allTags.sort((a: any, b: any) => {
-            return a.userId - b.userId;
-          });
+          // allTags.sort((a: any, b: any) => {
+          //   return a.userId - b.userId;
+          // });
           let colorMap: any = {};
           let colorMap: any = {};
+          let headerColorMap: any = {};
           for (let i = 0; i < allTags.length; i++) {
           for (let i = 0; i < allTags.length; i++) {
             const tag: any = allTags[i];
             const tag: any = allTags[i];
             const { groupNumber } = tag;
             const { groupNumber } = tag;
+            if (tag.userRole && tag.userRole !== "MARKER") {
+              if (!headerColorMap[groupNumber + ""]) {
+                headerColorMap[groupNumber + ""] = {};
+                headerColorMap[groupNumber + ""][tag.userId + ""] = "#008000";
+                continue;
+              } else {
+                headerColorMap[groupNumber + ""][tag.userId + ""] = "#008000";
+                continue;
+              }
+            }
             if (!colorMap[groupNumber + ""]) {
             if (!colorMap[groupNumber + ""]) {
               colorMap[groupNumber + ""] = {};
               colorMap[groupNumber + ""] = {};
               colorMap[groupNumber + ""][tag.userId + ""] = color;
               colorMap[groupNumber + ""][tag.userId + ""] = color;
@@ -227,6 +251,7 @@ onMounted(async () => {
                 config.x,
                 config.x,
                 config.y,
                 config.y,
                 colorMap,
                 colorMap,
+                headerColorMap,
                 onlyUsePdf
                 onlyUsePdf
               );
               );
               resultImgList.push(fileLocation);
               resultImgList.push(fileLocation);

+ 11 - 4
src/lib/watermark.ts

@@ -24,6 +24,7 @@ export async function addWatermark(
   x = 0.01,
   x = 0.01,
   y = 0.03,
   y = 0.03,
   colorMap: any = {},
   colorMap: any = {},
+  headerColorMap: any = {},
   onlyUsePdf = false
   onlyUsePdf = false
 ): Promise<boolean | string> {
 ): Promise<boolean | string> {
   const canShowDouble = store.env.user.doubleTrack;
   const canShowDouble = store.env.user.doubleTrack;
@@ -255,11 +256,17 @@ export async function addWatermark(
 
 
     for (let i = 0; i < tags.length; i++) {
     for (let i = 0; i < tags.length; i++) {
       const tag = tags[i];
       const tag = tags[i];
-      if (tag.content != undefined && (!tag.hide || canShowDouble)) {
+      if (
+        tag.content != undefined &&
+        (!tag.hide || canShowDouble) &&
+        !tag.forceHide
+      ) {
         let top = tag.top;
         let top = tag.top;
-        imgData
-          .font(fontFile, fontSize)
-          .fill(colorMap[tag.groupNumber + ""][tag.userId + ""] || "gray");
+        const c =
+          tag.userRole && tag.userRole !== "MARKER"
+            ? headerColorMap[tag.groupNumber + ""][tag.userId + ""]
+            : colorMap[tag.groupNumber + ""][tag.userId + ""];
+        imgData.font(fontFile, fontSize).fill(c);
         for (let j = 0; j < tag.content.length; j++) {
         for (let j = 0; j < tag.content.length; j++) {
           drawText(tag.left, top, tag.content[j]);
           drawText(tag.left, top, tag.content[j]);
           top += height;
           top += height;