From 45485c04fc9d5ad76023dc515f76a2173a538b3d Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Fri, 18 Oct 2024 17:11:30 +0800 Subject: [PATCH 1/8] =?UTF-8?q?BUG=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 + .env.production | 2 + src/main/index.js | 4 +- src/renderer/src/utils/tool.js | 4 +- .../src/views/classTask/classTaskAssign.vue | 44 ++++----- .../views/classTask/container/item-dialog.vue | 3 +- .../container/newTask/taskTypeView.vue | 78 +++++++-------- .../src/views/classTask/newClassTask.vue | 2 +- .../src/views/classTask/teachClassTask.vue | 94 +------------------ src/renderer/src/views/examReport/index.vue | 22 ++--- 10 files changed, 85 insertions(+), 170 deletions(-) diff --git a/.env.development b/.env.development index df0b713..11bbc06 100644 --- a/.env.development +++ b/.env.development @@ -15,3 +15,5 @@ VITE_APP_UPLOAD_API = 'https://file.ysaix.com:7868/prod-api' VITE_APP_RES_FILE_PATH = 'https://file.ysaix.com:7868/src/assets/textbook/booktxt/' VITE_APP_BUILD_BASE_PATH = 'https://file.ysaix.com:7868/' + +VITE_SHOW_DEV_TOOLS = true diff --git a/.env.production b/.env.production index 79007b1..2a0bdc9 100644 --- a/.env.production +++ b/.env.production @@ -17,3 +17,5 @@ VITE_BUILD_COMPRESS = gzip VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktxt/' VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/' + +VITE_SHOW_DEV_TOOLS = false diff --git a/src/main/index.js b/src/main/index.js index 4dcd521..91f5c08 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -74,7 +74,7 @@ function createLoginWindow() { updateInit(loginWindow) } - loginWindow.webContents.openDevTools() + if (import.meta.env.VITE_SHOW_DEV_TOOLS === true) loginWindow.webContents.openDevTools() loginWindow.once('ready-to-show', () => { loginWindow.show() }) @@ -128,7 +128,7 @@ function createMainWindow() { shell.openExternal(details.url) return { action: 'deny' } }) - mainWindow.webContents.openDevTools() + if (import.meta.env.VITE_SHOW_DEV_TOOLS === true) mainWindow.webContents.openDevTools() if (is.dev && process.env['ELECTRON_RENDERER_URL']) { mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL']) diff --git a/src/renderer/src/utils/tool.js b/src/renderer/src/utils/tool.js index 937b498..ebce77f 100644 --- a/src/renderer/src/utils/tool.js +++ b/src/renderer/src/utils/tool.js @@ -138,7 +138,7 @@ export const createWindow = async (type, data) => { wins_tool.setIgnoreMouseEvents(true, {forward: true}) // 忽略鼠标事件但是事件继续传递给窗口 wins_tool.setAlwaysOnTop(true,'screen-saver') // 将窗口设置为顶层窗口 wins_tool.setVisibleOnAllWorkspaces(true) // 如果窗口在所有工作区都可见 - wins_tool.webContents.openDevTools() // 打开调试工具 + if (import.meta.env.VITE_SHOW_DEV_TOOLS === true) wins_tool.webContents.openDevTools() // 打开调试工具 eventHandles(type, wins_tool) // 事件监听处理 return wins_tool } @@ -165,7 +165,7 @@ export const createWindow = async (type, data) => { win.type = type // 唯一标识 win.show() win.setFullScreen(true) // 设置窗口为全屏 - win.webContents.openDevTools() // 打开调试工具 + if (import.meta.env.VITE_SHOW_DEV_TOOLS === true) win.webContents.openDevTools() // 打开调试工具 eventHandles(type, win) // 事件监听处理 winPdf=win break diff --git a/src/renderer/src/views/classTask/classTaskAssign.vue b/src/renderer/src/views/classTask/classTaskAssign.vue index 4baf8a3..5161b50 100644 --- a/src/renderer/src/views/classTask/classTaskAssign.vue +++ b/src/renderer/src/views/classTask/classTaskAssign.vue @@ -6,7 +6,7 @@ :collapse="isCollapse" > -
>G,F>0?(F=255/F,U[i]=(d*j>>G)*F,U[i+1]=(f*j>>G)*F,U[i+2]=(h*j>>G)*F):U[i]=U[i+1]=U[i+2]=0,d-=g,f-=m,h-=v,p-=y,g-=M.r,m-=M.g,v-=M.b,y-=M.a,i=n+((i=r+H)=0&&f>>1,U=B.slice(0,Q+1),k=this._getTextWidth(U)+g;k<=l?(x=Q+1,E=U,F=k):S=Q}if(!E)break;if(h){var I,O=B[E.length];(I=(O===m||"-"===O)&&F<=l?E.length:Math.max(E.lastIndexOf(m),E.lastIndexOf("-"))+1)>0&&(x=I,E=E.slice(0,x),F=this._getTextWidth(E))}if(E=E.trimRight(),this._addTextLine(E),n=Math.max(n,F),d+=r,this._shouldHandleEllipsis(d)){this._tryToAddEllipsisToLastLine();break}if((B=(B=B.slice(x)).trimLeft()).length>0&&(C=this._getTextWidth(B))<=l){this._addTextLine(B),d+=r,n=Math.max(n,C);break}}else this._addTextLine(B),d+=r,n=Math.max(n,C),this._shouldHandleEllipsis(d)&&y{"use strict";e.exports=n(5287)},4848:(e,t,n)=>{"use strict";e.exports=n(1020)},7463:(e,t)=>{"use strict";function n(e,t){var n=e.length;e.push(t);e:for(;0a&&(g=A*a/m,m=a),g=t.wrcImgPosition.w>0?t.wrcImgPosition.w:g,m=t.wrcImgPosition.h>0?t.wrcImgPosition.h:m,null==u||u.drawImage(t.videoController,t.wrcImgPosition.x,t.wrcImgPosition.y,g,m);var v=a-m;if(t.hiddenScrollBar.state&&v>0&&t.hiddenScrollBar.fillState){u.beginPath();var y=A,w=v;t.hiddenScrollBar.fillWidth>0&&(y=t.hiddenScrollBar.fillWidth),t.hiddenScrollBar.fillHeight>0&&(w=t.hiddenScrollBar.fillHeight),u.rect(0,m,y,w),u.fillStyle=t.hiddenScrollBar.color,u.fill()}}t.initScreenShot(void 0,c,t.screenShotImageController);var b=null,B=null;t.captureStream&&(b=null===(o=t.captureStream.getVideoTracks()[0].getSettings())||void 0===o?void 0:o.displaySurface,B=t.captureStream.getVideoTracks()[0].label),e&&e({code:0,msg:"截图加载完成",displaySurface:b,displayLabel:B}),t.stopCapture(),document.body.classList.remove("no-cursor")}}}),this.wrcReplyTime)},e.prototype.adjustContainerLevels=function(e){null==this.screenShotContainer||null==this.toolController||null==this.textInputController||null==this.optionIcoController||null==this.optionController||null==this.cutBoxSizeContainer||e<=0||(this.screenShotContainer.style.zIndex="".concat(e),this.toolController.style.zIndex="".concat(e+1),this.textInputController.style.zIndex="".concat(e+1),this.optionIcoController.style.zIndex="".concat(e+1),this.optionController.style.zIndex="".concat(e+1),this.cutBoxSizeContainer.style.zIndex="".concat(e+1))},e.prototype.initCropBox=function(e){var t=e.x,n=e.y,r=e.w,o=e.h;null!=this.screenShotContainer&&(this.drawGraphPosition={startX:t,startY:n,width:r,height:o},this.data.setCutOutBoxPosition(t,n,r,o),sm(t,n,r,o,this.screenShotCanvas,this.data.getBorderSize(),this.screenShotContainer,this.screenShotImageController),this.cutOutBoxBorderArr=wm(this.data.getBorderSize(),this.drawGraphPosition),this.screenShotContainer.style.cursor="move",this.data.setToolStatus(!0),this.data.setCutBoxSizeStatus(!0),null!=this.toolController&&this.showToolBar())},e.prototype.getWindowContentData=function(e,t,n,r){var o=document.createElement("canvas");o.width=e,o.height=t;var i=Am(o,e,t);if(i){i.drawImage(this.videoController,0,0);var A=t-r,a=n,s=t-A;return i.getImageData(0*this.dpr,A*this.dpr,a*this.dpr,s*this.dpr)}return null},e.prototype.registerContainerShortcuts=function(e){var t=this;e.addEventListener("keydown",(function(n){if(null!=t.screenShotCanvas&&((n.metaKey||n.ctrlKey)&&"Enter"===n.code||"Escape"===n.code)){t.data.setTextEditState(!0);var r=e.innerText;if(!r||""===r)return void t.data.setTextStatus(!1);lm(r,t.textInputPosition.mouseX,t.textInputPosition.mouseY,t.data.getSelectedColor(),t.data.getFontSize(),t.screenShotCanvas),e.innerHTML="",t.data.setTextStatus(!1),cm()}}))},e.prototype.showToolBar=function(){if(null!=this.toolController&&null!=this.screenShotContainer){var e=function(e,t,n,r,o){var i=(e.width-t)/2+(e.startX-o.left);"left"===r&&(i=e.startX),"right"===r&&(i=e.startX+e.width-t),i<0&&(i=0),i+t>n&&(i=n-t);var A=e.startY+e.height+10;return(e.width<0&&e.height<0||e.width>0&&e.height<0)&&(A=e.startY+10),{mouseX:i,mouseY:A-=o.top}}(this.drawGraphPosition,this.toolController.offsetWidth,this.screenShotContainer.width/this.dpr,this.placement,this.position),t=this.screenShotContainer.height/this.dpr;if(e.mouseY>t-64){if(e.mouseY-=this.drawGraphPosition.height+64,e.mouseY<0){var n=parseInt(this.screenShotContainer.style.height);e.mouseY=n-this.fullScreenDiffHeight}this.data.setToolPositionStatus(!0),this.data.setCutBoxSizeStatus(!1)}if(this.getFullScreenStatus){var r=parseInt(this.screenShotContainer.style.height),o=(this.drawGraphPosition.width/this.dpr-this.toolController.offsetWidth)/2;e.mouseY=r-this.fullScreenDiffHeight,e.mouseX=o}this.data.setToolInfo(e.mouseX+this.position.left,e.mouseY+this.position.top),this.data.setCutBoxSizePosition(this.drawGraphPosition.startX,this.drawGraphPosition.startY-35),this.data.setCutBoxSize(this.drawGraphPosition.width,this.drawGraphPosition.height),this.getFullScreenStatus=!1}},e.prototype.setGlobalParameter=function(){this.screenShotContainer=this.data.getScreenShotContainer(),this.toolController=this.data.getToolController(),this.textInputController=this.data.getTextInputController(),this.optionController=this.data.getOptionController(),this.optionIcoController=this.data.getOptionIcoController(),this.cutBoxSizeContainer=this.data.getCutBoxSizeContainer()},e.prototype.setOptionalParameter=function(e){var t,n;if(!0===(null==e?void 0:e.clickCutFullScreen)&&(this.clickCutFullScreen=!0),null!=(null==e?void 0:e.imgSrc)&&(this.imgSrc=e.imgSrc),!0===(null==e?void 0:e.loadCrossImg)&&(this.loadCrossImg=!0),(null==e?void 0:e.proxyUrl)&&(this.proxyUrl=e.proxyUrl),(null==e?void 0:e.useCORS)&&(this.useCORS=e.useCORS),null!=(null==e?void 0:e.position)&&(null!=(null===(t=e.position)||void 0===t?void 0:t.top)&&(this.position.top=e.position.top),null!=(null===(n=e.position)||void 0===n?void 0:n.left)&&(this.position.left=e.position.left)),(null==e?void 0:e.screenShotDom)&&(this.screenShotDom=e.screenShotDom),(null==e?void 0:e.wrcReplyTime)&&(this.wrcReplyTime=e.wrcReplyTime),(null==e?void 0:e.cropBoxInfo)&&(this.cropBoxInfo=e.cropBoxInfo),(null==e?void 0:e.toolPosition)&&(this.placement=e.toolPosition),null==e?void 0:e.wrcImgPosition){var r=e.wrcImgPosition,o=r.x,i=r.y;this.wrcImgPosition.x=-1*Math.abs(o),this.wrcImgPosition.y=-1*Math.abs(i)}if(null!=(null==e?void 0:e.hiddenScrollBar)){var A=e.hiddenScrollBar,a=A.state,s=A.color,l=A.fillWidth,c=A.fillHeight,u=A.fillState;this.hiddenScrollBar={state:a,color:s||"#000000",fillWidth:l||0,fillHeight:c||0,fillState:u||!1},a&&(this.data.setResetScrollbarState(!0),document.documentElement.classList.add("hidden-screen-shot-scroll"),document.body.classList.add("hidden-screen-shot-scroll"))}null!=(null==e?void 0:e.wrcWindowMode)&&(this.wrcWindowMode=e.wrcWindowMode),null!=(null==e?void 0:e.customRightClickEvent)&&(this.customRightClickEvent=e.customRightClickEvent)},e.prototype.operatingCutOutBox=function(e,t,n,r,o,i,A){if(null!=this.screenShotContainer){var a=this.movePosition,s=a.moveStartX,l=a.moveStartY;if(this.cutOutBoxBorderArr.length>0&&!this.data.getDraggingTrim()){var c=!1;A.beginPath();for(var u=0;u