Li 3 gadi atpakaļ
vecāks
revīzija
29cc5bf456

+ 2 - 0
src/BI/BI.csproj

@@ -11,6 +11,7 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
     <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.7" />
     <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
     <PackageReference Include="VueCliMiddleware" Version="5.0.0" />
@@ -30,6 +31,7 @@
   </ItemGroup>
 
   <ItemGroup>
+    <Folder Include="Profiles\" />
     <Folder Include="Services\" />
   </ItemGroup>
 

+ 50 - 50
src/BI/ClientApp/src/views/Index.vue

@@ -6,77 +6,62 @@
       <dv-loading v-if="loading">Loading...</dv-loading>
       <div v-else
            class="host-body">
-        <div class="d-flex jc-center">
-        </div>
-        <!-- 第二行 -->
-        <div class="d-flex jc-between px-2">
-        </div>
-
-        <div class="body-box">
-          <!-- 第三行数据 -->
-          <div class="content-box">
-          </div>
-          <!-- 第四行数据 -->
-          <div class="bototm-box">
-            <dv-border-box-13>
-              <bottom-left />
-            </dv-border-box-13>
-            <dv-border-box-12>
-              <bottom-right />
-            </dv-border-box-12>
-          </div>
-        </div>
+        <dv-full-screen-container>content</dv-full-screen-container>
       </div>
     </div>
   </div>
 </template>
 
-<script>
-import { onMounted, onBeforeUnmount, ref, defineComponent,watch } from 'vue'
-import { formatTime } from '@/utils/index'
-import { reactive } from '@vue/reactivity'
-import { WEEK } from '@/constant/index'
-import { title, subtitle, moduleInfo } from '@/constant/index'
-import useIndex from '@/utils/useDraw'
+<script lang="ts">
+import { onMounted, onBeforeUnmount, ref, defineComponent, watch } from 'vue';
+import { formatTime } from '@/utils/index';
+import { reactive } from '@vue/reactivity';
+import { WEEK } from '@/constant/index';
+import { title, subtitle, moduleInfo } from '@/constant/index';
+import useIndex from '@/utils/useDraw';
+
 export default defineComponent({
+  components: {
+
+  },
   setup(props, context) {
-    let loading = ref(true)
+    let loading = ref(true);
     //时间信息
     const timeInfo = reactive({
       setInterval: 0,
       dateDay: '',
       dataYear: '',
       dataWeek: '',
-    })
+    });
     // * 适配处理
-    const { appRef, calcRate, windowDraw } = useIndex()
+    const { appRef, calcRate, windowDraw } = useIndex();
     // 生命周期
     onMounted(() => {
-      cancelLoading()
-      handleTime()
+      cancelLoading();
+      handleTime();
       // todo 屏幕适应
       //windowDraw()
-      calcRate()
-    })
+      calcRate();
+    });
 
     onBeforeUnmount(() => {
-      clearInterval(timeInfo.setInterval)
-    })
+      clearInterval(timeInfo.setInterval);
+    });
 
     const cancelLoading = () => {
       setTimeout(() => {
-        loading.value = false
-      }, 500)
-    }
+        loading.value = false;
+      }, 500);
+    };
     // todo 处理时间监听
     const handleTime = () => {
-      timeInfo.setInterval = setInterval(() => {
-        const date = new Date()
-        timeInfo.dateDay = formatTime(date, 'HH: mm: ss')
-        timeInfo.dateYear = formatTime(date, 'yyyy-MM-dd')
-        timeInfo.dateWeek = WEEK[date.getDay()]
-      }, 1000)
-    }
+      timeInfo.setInterval = window.setInterval(() => {
+        const date = new Date();
+        timeInfo.dateDay = formatTime(date, 'HH: mm: ss');
+        timeInfo.dataYear = formatTime(date, 'yyyy-MM-dd');
+        timeInfo.dataWeek = WEEK[date.getDay()];
+      }, 1000);
+    };
     // return
     return {
       loading,
@@ -85,16 +70,16 @@ export default defineComponent({
       title,
       subtitle,
       moduleInfo,
-    }
+    };
   },
-})
+});
 </script>
 
 <style lang="scss" scoped>
 #index {
   color: #d3d6dd;
-  width: 100%;
-  height: 100%;
+  width: 1920px;
+  height: 1080px;
   position: absolute;
   top: 50%;
   left: 50%;
@@ -108,5 +93,20 @@ export default defineComponent({
     background-size: cover;
     background-position: center center;
   }
+
+  .host-body {
+    .dv-dec-10,
+    .dv-dec-10-s {
+      width: 33.3%;
+      height: 5px;
+    }
+    .dv-dec-10-s {
+      transform: rotateY(180deg);
+    }
+    .dv-dec-8 {
+      width: 200px;
+      height: 50px;
+    }
+  }
 }
 </style>

+ 1 - 1
src/BI/ClientApp/src/views/login/index.ts

@@ -1,6 +1,6 @@
 const SuiteKey = 'dingoabikplouc0kaoq7io'
 const redirect_uri = encodeURIComponent(
-  'http://localhost.me/index.php?test=1&aa=2'
+  'https://https://localhost:5001/api/auth'
 )
 
 const handleMessage = function(event: any) {

+ 7 - 6
src/BI/Controllers/AuthController.cs

@@ -14,20 +14,21 @@ using System.Text;
 
 namespace BI.Controllers
 {
-    [Route("api/[controller]")]
+    [Route("api/auth")]
+    //[Route("api/[controller]")]
     [ApiController]
     public class AuthController : ControllerBase
     {
         private readonly IConfiguration _configuration;
         public AuthController(IConfiguration configuration)
         {
-            _configuration = configuration ?? throw new NullReferenceException("config inject Failed in LoginController");
+            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
         }
-        [HttpGet("code")]
-        public IActionResult DingDingLogin(string code)
+        [HttpGet("{loginTmpCode}")]
+        public IActionResult DingDingLogin(string loginTmpCode)
         {
             //判断参数是否为空
-            if (string.IsNullOrEmpty(code))
+            if (string.IsNullOrEmpty(loginTmpCode))
             {
                 return BadRequest("temp code error");
             }
@@ -53,7 +54,7 @@ namespace BI.Controllers
             OapiSnsGetuserinfoBycodeRequest reqBycodeRequest = new()
             {
                 // 通过扫描二维码,跳转指定的redirect_uri后,向url中追加的code临时授权码
-                TmpAuthCode = code
+                TmpAuthCode = loginTmpCode
             };
             OapiSnsGetuserinfoBycodeResponse bycodeResponse = client2.Execute(reqBycodeRequest, appId, appSecret);
             if (bycodeResponse.IsError) return BadRequest();

+ 12 - 4
src/BI/Startup.cs

@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Formatters;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Hosting;
@@ -27,7 +28,15 @@ namespace BI
         // This method gets called by the runtime. Use this method to add services to the container.
         public void ConfigureServices(IServiceCollection services)
         {
-            services.AddControllers();
+            services.AddControllers(setup=>
+            {
+                setup.ReturnHttpNotAcceptable = true;
+                // 以前的写法
+                setup.OutputFormatters.Add(new XmlDataContractSerializerOutputFormatter());//默认是json格式,因为在最前面.
+                // setup.OutputFormatters.Insert(0, new XmlDataContractSerializerOutputFormatter());//此时将xml格式化器放在集合最前面,则默认输出就是xml格式
+
+            }).AddXmlDataContractSerializerFormatters();//支持xml(包含输入输出)的现在的写法
+            services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
             services.AddSpaStaticFiles(configuration =>
             {
                 configuration.RootPath = "ClientApp";
@@ -43,9 +52,8 @@ namespace BI
                         ValidateIssuerSigningKey = true,  ////是否验证密钥
                         ValidAudience = "https://localhost:5001",//Audience
                         ValidIssuer = "https://localhost:5001",//Issuer,这两项和登陆时颁发的一致
-                        IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("dhVbXOD61yXM22A3aZF9vaja5yt7zwCK")),     //拿到SecurityKey
-                        //缓冲过期时间,总的有效时间等于这个时间加上jwt的过期时间,如果不配置,默认是5分钟                                                                                                            //注意这是缓冲过期时间,总的有效时间等于这个时间加上jwt的过期时间,如果不配置,默认是5分钟
-                        ClockSkew = TimeSpan.FromMinutes(5)   //设置过期时间
+                        IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("dhVbXOD61yXM22A3aZF9vaja5yt7zwCK")),     //拿到SecurityKey                                                                                                       //注意这是缓冲过期时间,总的有效时间等于这个时间加上jwt的过期时间,如果不配置,默认是5分钟
+                        ClockSkew = TimeSpan.FromMinutes(5)   //设置验证token过期时间的间隔时间
                     };
                 });
         }