From a00bf4a95fcd4f343985878edcf5713824f2daa3 Mon Sep 17 00:00:00 2001 From: yzp Date: Fri, 11 Aug 2023 14:42:06 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=90=8E=E7=AB=AF=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=8F=AF=E5=8F=91=E5=B8=83=E5=89=8D=E7=AB=AF=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/Magic.Web.Core/Startup.cs | 13 ++++++++++++- frontend/public/index.html | 2 +- frontend/src/utils/request.js | 4 ++-- frontend/vue.config.js | 8 +++++--- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/backend/Magic.Web.Core/Startup.cs b/backend/Magic.Web.Core/Startup.cs index 0ef0c30..8675059 100644 --- a/backend/Magic.Web.Core/Startup.cs +++ b/backend/Magic.Web.Core/Startup.cs @@ -1,4 +1,4 @@ -using Furion; +using Furion; using Furion.Schedule; using Furion.SpecificationDocument; using IGeekFan.AspNetCore.Knife4jUI; @@ -6,13 +6,16 @@ using Magic.Core; using Magic.Core.Job; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Hosting; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using System; +using System.IO; using System.Net; using System.Net.Http; using Yitter.IdGenerator; @@ -112,6 +115,14 @@ public class Startup : AppStartup app.UseUnifyResultStatusCodes(); app.UseHttpsRedirection(); // 强制https + + app.UseFileServer(new FileServerOptions() + { + FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot/ui/")), + RequestPath = new PathString("/ui"), + EnableDefaultFiles = true + }); + app.UseStaticFiles(); app.UseScheduleUI(); diff --git a/frontend/public/index.html b/frontend/public/index.html index 71617e1..7054ae8 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -4,7 +4,7 @@ - + Magic.NET diff --git a/frontend/src/utils/request.js b/frontend/src/utils/request.js index bd03ce8..1123a9f 100644 --- a/frontend/src/utils/request.js +++ b/frontend/src/utils/request.js @@ -7,8 +7,8 @@ import { ACCESS_TOKEN } from '@/store/mutation-types' // 创建 axios 实例 const service = axios.create({ - baseURL: '/api', // api base_url - //baseURL: process.env.VUE_APP_API_BASE_URL,//不用代理就用这个 + // baseURL: '/api', // 代理直接发给本服务器由Ngnix转发 + baseURL: process.env.VUE_APP_API_BASE_URL, // 不用代理就用这个 timeout: 6000 // 请求超时时间 }) diff --git a/frontend/vue.config.js b/frontend/vue.config.js index dd62923..40a6d1c 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -31,6 +31,8 @@ const assetsCDN = { // vue.config.js const vueConfig = { + // js、css等文件的引用路径 + publicPath: './', configureWebpack: { // webpack plugins plugins: [ @@ -40,8 +42,8 @@ const vueConfig = { new CompressionWebpackPlugin({ algorithm: 'gzip', test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'), - threshold: 10240,// 只有大小大于该值的资源会被处理 10240 10k - minRatio: 0.8,// 只有压缩率小于这个值的资源才会被处理 + threshold: 10240, // 只有大小大于该值的资源会被处理 10240 10k + minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理 deleteOriginalAssets: false // 删除原文件true=删 }) ], @@ -114,7 +116,7 @@ const vueConfig = { // disable source map in production productionSourceMap: false, - lintOnSave: false, //关闭eslint检查 + lintOnSave: false, // 关闭eslint检查 // babel-loader no-ignore node_modules/* transpileDependencies: [] } -- Gitee From b84e3a0ca81d83dddcd08f4ab474350cd72571f3 Mon Sep 17 00:00:00 2001 From: yzp Date: Fri, 11 Aug 2023 15:03:17 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BA=86=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E4=BB=A3=E7=A0=81=E4=B8=8D=E8=83=BD=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E5=9C=A8=E6=9C=89=E5=AD=90=E8=B7=AF=E5=BE=84=E7=9A=84=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/router/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index dd72772..bd375ef 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -12,7 +12,8 @@ Router.prototype.push = function push (location, onResolve, onReject) { Vue.use(Router) export default new Router({ - mode: 'history', + // 如果要发布在子路径中,不能用这种路径模式,把下面这句屏蔽掉 + // mode: 'history', base: process.env.BASE_URL, scrollBehavior: () => ({ y: 0 }), routes: constantRouterMap -- Gitee From 1988bb435dd6d74f391332af832dc25baf340352 Mon Sep 17 00:00:00 2001 From: yzp Date: Fri, 11 Aug 2023 18:07:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Tools:=E5=8A=A0=E5=85=A5VsCode=E8=B0=83?= =?UTF-8?q?=E8=AF=95Vue=E6=96=87=E4=BB=B6=E7=9A=84=E5=8A=9F=E8=83=BD=20Bug?= =?UTF-8?q?:=E9=A1=B9=E7=9B=AE=E5=8F=91=E5=B8=83=E6=97=B6=E6=BC=8F?= =?UTF-8?q?=E4=BA=86=E5=AD=97=E4=BD=93=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Magic.Web.Entry/Magic.Web.Entry.csproj | 3 ++ frontend/.vscode/launch.json | 29 ++++++++++++++----- frontend/vue.config.js | 1 + 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/backend/Magic.Web.Entry/Magic.Web.Entry.csproj b/backend/Magic.Web.Entry/Magic.Web.Entry.csproj index 8a57352..cb3d319 100644 --- a/backend/Magic.Web.Entry/Magic.Web.Entry.csproj +++ b/backend/Magic.Web.Entry/Magic.Web.Entry.csproj @@ -75,6 +75,9 @@ + + PreserveNewest + Never diff --git a/frontend/.vscode/launch.json b/frontend/.vscode/launch.json index 0d22b58..3f7e98a 100644 --- a/frontend/.vscode/launch.json +++ b/frontend/.vscode/launch.json @@ -4,12 +4,27 @@ // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { - "type": "pwa-chrome", - "request": "launch", - "name": "Launch Chrome against localhost", - "url": "http://localhost:8080", - "webRoot": "${workspaceFolder}" - } + { + "type": "pwa-chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + }, + { + "type": "firefox", + "request": "launch", + "name": "Firefox调试", + "url": "http://localhost:82", + "webRoot": "${workspaceFolder}/src", + "pathMappings": [{ + "url": "webpack:///src/", + "path": "${webRoot}/" + }], + "reAttach": true,//在退出调试时,不关闭浏览器 + // 下面这行不设置会用了纯净版的firefox,自已装的扩展就会没有了 + "firefoxExecutable": "C:\\Program Files\\Mozilla Firefox\\firefox.exe", + "profile": "default-release" + } ] } \ No newline at end of file diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 40a6d1c..7228df0 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -34,6 +34,7 @@ const vueConfig = { // js、css等文件的引用路径 publicPath: './', configureWebpack: { + devtool: 'source-map', // webpack plugins plugins: [ // Ignore all locale files of moment.js -- Gitee