소스 검색

feat:前端部署,无法跳转fcc端口,未解决

Zhenghanjv 3 달 전
부모
커밋
19334ff27e

+ 4 - 4
Edge.Core/Processor/Dispatcher/ProcessorLoader/DbJSonLoader.cs

@@ -37,7 +37,7 @@ namespace Edge.Core.Processor.Dispatcher
         protected virtual IEnumerable<ProcessorMetaConfig> LoadProcessorMetaConfigs()
         {
             List<ProcessorMetaConfig> processorMetaConfigs = new List<ProcessorMetaConfig>();
-            MysqlDbContext mysqlDbContext = services.GetRequiredService<MysqlDbContext>();
+            MysqlDbContext mysqlDbContext = new MysqlDbContext();
             List<Domain.FccMachineInfo.FccMachineInfo> fccMachineInfos = mysqlDbContext.FccMachineInfos.ToList();
             foreach (var item in fccMachineInfos)
             {
@@ -79,7 +79,7 @@ namespace Edge.Core.Processor.Dispatcher
             }
 
             return processorMetaConfigs;
-            //            string json = @"[
+            //string json = @"[
             //    {
             //        ""Id"": 16,
             //        ""Name"": ""HengshanPaymentTerminal.HengshanPayTerminal.Hengs_938d2e2bd48b45ba_8"",
@@ -108,8 +108,8 @@ namespace Edge.Core.Processor.Dispatcher
             //        ""Activated"": true
             //    }
             //]";
-            //            IEnumerable<ProcessorMetaConfig> configs = JsonSerializer.Deserialize<IEnumerable<ProcessorMetaConfig>>(json);
-            //            return configs;
+            //IEnumerable<ProcessorMetaConfig> configs = JsonSerializer.Deserialize<IEnumerable<ProcessorMetaConfig>>(json);
+            //return configs;
             //using (var scope = this.services.CreateScope())
             //{
             //var dbContext = scope.ServiceProvider.GetRequiredService<SqliteDbContext>();

+ 0 - 1
HengshanPaymentTerminal/HengshanPaymentTerminal.csproj

@@ -19,7 +19,6 @@
 
   <ItemGroup>
     <ProjectReference Include="..\Edge.Core\Edge.Core.csproj" />
-    <ProjectReference Include="..\Web\Web.csproj" />
   </ItemGroup>
 
   <ItemGroup>

+ 13 - 0
src/FccLife.Web/.config/dotnet-tools.json

@@ -0,0 +1,13 @@
+{
+  "version": 1,
+  "isRoot": true,
+  "tools": {
+    "dotnet-ef": {
+      "version": "9.0.2",
+      "commands": [
+        "dotnet-ef"
+      ],
+      "rollForward": false
+    }
+  }
+}

+ 1 - 2
src/FccLife.Web/FccLite.Web.csproj

@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk.Web">
+<Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
     <TargetFramework>net6.0</TargetFramework>
@@ -17,7 +17,6 @@
   <ItemGroup>
     <ProjectReference Include="..\..\Edge.Core\Edge.Core.csproj" />
     <ProjectReference Include="..\..\HengshanPaymentTerminal\HengshanPaymentTerminal.csproj" />
-    <ProjectReference Include="..\..\Web\Web.csproj" />
   </ItemGroup>
 
   <ItemGroup>

+ 8 - 1
src/FccLife.Web/Program.cs

@@ -20,7 +20,14 @@ using FccLite.Web.Repositories.FccMachineInfo;
 using OfficeOpenXml;
 
 var builder = WebApplication.CreateBuilder(args);
- DefaultDispatcher processorsDispatcher = null;
+// 自动加载 appsettings.json 和 appsettings.{Environment}.json
+builder.WebHost.ConfigureKestrel((context, options) =>
+{
+    var kestrelConfig = context.Configuration.GetSection("Kestrel");
+    options.Configure(kestrelConfig);
+});
+
+DefaultDispatcher processorsDispatcher = null;
 //数据库
 builder.Services.AddDbContext<MysqlDbContext>(options =>
     options.UseMySql(builder.Configuration.GetConnectionString("DefaultConnection"), ServerVersion.AutoDetect(builder.Configuration.GetConnectionString("DefaultConnection")))

+ 7 - 0
src/FccLife.Web/appsettings.Development.json

@@ -8,5 +8,12 @@
   "ConnectionStrings": {
     "DefaultConnection": "Server=localhost;Port=3306;Database=qrFueling;User=root;Password=123456",
     "isMigrate": "true"
+  },
+  "Kestrel": {
+    "Endpoints": {
+      "Http": {
+        "Url": "http://0.0.0.0:8080"
+      }
+    }
   }
 }

+ 19 - 0
src/FccLife.Web/appsettings.Production.json

@@ -0,0 +1,19 @@
+{
+  "Logging": {
+    "LogLevel": {
+      "Default": "Information",
+      "Microsoft.AspNetCore": "Warning"
+    }
+  },
+  "ConnectionStrings": {
+    "DefaultConnection": "Server=localhost;Port=3306;Database=qrFueling;User=root;Password=123456",
+    "isMigrate": "true"
+  },
+  "Kestrel": {
+    "Endpoints": {
+      "Http": {
+        "Url": "http://0.0.0.0:9999"
+      }
+    }
+  }
+}

+ 3 - 1
src/FccWeb/admin.ui.plus-master/src/router/backEnd.ts

@@ -41,8 +41,10 @@ export async function initBackEndControlRoutes() {
   // 无 token 停止执行下一步
   if (!useUserInfo().getToken()) return false
   // 触发初始化用户信息 pinia
-  await useUserInfo().setUserInfos()
 
+  console.log("1111")
+  await useUserInfo().setUserInfos()
+  console.log("2222")
   // 获取路由菜单数据
   // const menus = await getBackEndControlRoutes()    // ---后端接口读取路由。
   // console.log(menus)

+ 2 - 0
src/FccWeb/admin.ui.plus-master/src/router/index.ts

@@ -119,9 +119,11 @@ router.beforeEach(async (to, from, next) => {
       storesRoute.setRouteTo({ to: { path: to.path, params: JSON.stringify(to.query ? to.query : to.params) } })
       const storesRoutesList = useRoutesList(pinia)
       const { routesList } = storeToRefs(storesRoutesList)
+      console.log(routesList.value)
       if (routesList.value.length === 0) {
         if (isRequestRoutes) {
           // 后端控制路由:路由数据初始化,防止刷新时丢失
+          console.log("index.ts")
           const isNoPower = await initBackEndControlRoutes()
           // if (isNoPower) {
           //   ElMessage.warning('抱歉,您没有分配权限,请联系管理员')

+ 59 - 60
src/FccWeb/admin.ui.plus-master/src/router/route.ts

@@ -46,70 +46,68 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
     meta: {
       isKeepAlive: true,
     },
-    children: import.meta.env.PROD
-      ? []
-      : [
-        {
-          path: '/statement',
-          name: '/statement',
-          component: () => import('/@/views/admin/nozzle/index.vue'),
-          meta: {
-            title: '油枪状态',
-            isLink: '',
-            isHide: false,
-            isKeepAlive: true,
-            isAffix: false,
-            isIframe: false,
-            roles: ['admin', 'common'],
-            icon: 'iconfont icon-crew_feature',
-          },
+    children: [
+      {
+        path: '/statement',
+        name: '/statement',
+        component: () => import('/@/views/admin/nozzle/index.vue'),
+        meta: {
+          title: '油枪状态',
+          isLink: '',
+          isHide: false,
+          isKeepAlive: true,
+          isAffix: false,
+          isIframe: false,
+          roles: ['admin', 'common'],
+          icon: 'iconfont icon-crew_feature',
         },
-        {
-          path: '/station',
-          name: '/station',
-          component: () => import('/@/views/admin/station/station.vue'),
-          meta: {
-            title: '油站信息',
-            isLink: '',
-            isHide: false,
-            isKeepAlive: true,
-            isAffix: false,
-            isIframe: false,
-            roles: ['admin', 'common'],
-            icon: 'iconfont icon-crew_feature',
-          },
+      },
+      {
+        path: '/station',
+        name: '/station',
+        component: () => import('/@/views/admin/station/station.vue'),
+        meta: {
+          title: '油站信息',
+          isLink: '',
+          isHide: false,
+          isKeepAlive: true,
+          isAffix: false,
+          isIframe: false,
+          roles: ['admin', 'common'],
+          icon: 'iconfont icon-crew_feature',
         },
-        {
-          path: '/oil',
-          name: '/oil',
-          component: () => import('/@/views/admin/oil/oil.vue'),
-          meta: {
-            title: '油品信息',
-            isLink: '',
-            isHide: false,
-            isKeepAlive: true,
-            isAffix: false,
-            isIframe: false,
-            roles: ['admin', 'common'],
-            icon: 'iconfont icon-crew_feature',
-          },
+      },
+      {
+        path: '/oil',
+        name: '/oil',
+        component: () => import('/@/views/admin/oil/oil.vue'),
+        meta: {
+          title: '油品信息',
+          isLink: '',
+          isHide: false,
+          isKeepAlive: true,
+          isAffix: false,
+          isIframe: false,
+          roles: ['admin', 'common'],
+          icon: 'iconfont icon-crew_feature',
         },
-        {
-          path: '/order',
-          name: '/order',
-          component: () => import('/@/views/admin/order/index.vue'),
-          meta: {
-            title: '订单信息',
-            isLink: '',
-            isHide: false,
-            isKeepAlive: true,
-            isAffix: false,
-            isIframe: false,
-            roles: ['admin', 'common'],
-            icon: 'iconfont icon-crew_feature',
-          },
+      },
+      {
+        path: '/order',
+        name: '/order',
+        component: () => import('/@/views/admin/order/index.vue'),
+        meta: {
+          title: '订单信息',
+          isLink: '',
+          isHide: false,
+          isKeepAlive: true,
+          isAffix: false,
+          isIframe: false,
+          roles: ['admin', 'common'],
+          icon: 'iconfont icon-crew_feature',
         },
-      ],
+      },
+    ],
   },
 
 ]
@@ -147,6 +145,7 @@ export const notFoundAndNoPower = [
  */
 export const staticRoutes: Array<RouteRecordRaw> = [
   {
+    
     path: '/login',
     name: 'login',
     component: () => import('/@/views/admin/login/index.vue'),

+ 2 - 0
src/FccWeb/admin.ui.plus-master/src/views/admin/login/component/account.vue

@@ -129,6 +129,8 @@ const login = async () => {
   const token = res.data?.token
   useUserInfo().setToken(token)
   // 添加完动态路由,再进行 router 跳转,否则可能报错 No match found for location with path "/"
+  
+  console.log("account.vue")
   const isNoPower = await initBackEndControlRoutes()
   // 执行完 initBackEndControlRoutes,再执行 signInSuccess
   signInSuccess(isNoPower)

+ 2 - 0
src/FccWeb/admin.ui.plus-master/src/views/admin/login/component/mobile.vue

@@ -100,6 +100,8 @@ const onSignIn = async () => {
     const token = res.data?.token
     useUserInfo().setToken(token)
     // 添加完动态路由,再进行 router 跳转,否则可能报错 No match found for location with path "/"
+    
+    console.log("mobile.ts")
     const isNoPower = await initBackEndControlRoutes()
     // 执行完 initBackEndControlRoutes,再执行 signInSuccess
     signInSuccess(isNoPower)