浏览代码

feat:前端增加版本号显示

Zhenghanjv 2 月之前
父节点
当前提交
677b034335

+ 15 - 1
src/FccLife.Web/Controller/ConfigController.cs

@@ -3,6 +3,7 @@ using Edge.Core.Domain.FccOilInfo.Ouput;
 using Edge.Core.Domain.FccStationInfo.Input;
 using Edge.Core.Domain.FccStationInfo.Output;
 using FccLite.Web.Services.FccOilInfo;
+using FccLite.Web.Services.FccProjectInfo;
 using FccLite.Web.Services.FccStaionInfo;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
@@ -21,10 +22,23 @@ namespace FccLite.Web.Controller
 
         private readonly IStationService _stationService;
         private readonly IOilInfoService _oilInfoService;
-        public ConfigController(IStationService stationService,IOilInfoService oilInfoService) 
+        private readonly IFccProjectInfoServices _fccProjectInfoServices;
+        public ConfigController(IStationService stationService,IOilInfoService oilInfoService,IFccProjectInfoServices fccProjectInfoServices) 
         {
             _stationService = stationService;
             _oilInfoService = oilInfoService;
+            _fccProjectInfoServices = fccProjectInfoServices;
+        }
+
+        /// <summary>
+        /// 返回FCC版本号
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("getVersion")]
+        public async Task<IActionResult> GetVersion()
+        {
+            string version = await _fccProjectInfoServices.GetVersion();
+            return Ok(version);
         }
 
         /// <summary>

+ 2 - 0
src/FccLife.Web/Program.cs

@@ -19,6 +19,7 @@ using FccLite.Web.Services.FccMachineInfo;
 using FccLite.Web.Repositories.FccMachineInfo;
 using OfficeOpenXml;
 using System.Text.Json;
+using FccLite.Web.Services.FccProjectInfo;
 
 var builder = WebApplication.CreateBuilder(args);
 // 自动加载 appsettings.json 和 appsettings.{Environment}.json
@@ -56,6 +57,7 @@ builder.Services.AddScoped<IMachineService, MachineServiceImpl>();
 builder.Services.AddScoped<IMachineRepository, MachineReposity>();
 builder.Services.AddScoped<IHttpClient, HttpClientService>();
 builder.Services.AddScoped<IHttpClientUtil, HttpClientUtils>();
+builder.Services.AddScoped<IFccProjectInfoServices, FccProjectInfoServices>();
 
 //excel
 ExcelPackage.LicenseContext = LicenseContext.NonCommercial;

+ 22 - 0
src/FccLife.Web/Services/FccProjectInfo/FccProjectInfoServices.cs

@@ -0,0 +1,22 @@
+
+namespace FccLite.Web.Services.FccProjectInfo
+{
+    public class FccProjectInfoServices : IFccProjectInfoServices
+    {
+        private readonly IConfiguration _configuration;
+        public FccProjectInfoServices(IConfiguration configuration) 
+        {
+            _configuration = configuration;
+        }
+
+        /// <summary>
+        /// 返回FCC版本号
+        /// </summary>
+        /// <returns></returns>
+        public Task<string> GetVersion()
+        {
+            string version = _configuration.GetSection("Version").Get<string>() ?? "null";
+            return Task.FromResult(version);
+        }
+    }
+}

+ 11 - 0
src/FccLife.Web/Services/FccProjectInfo/IFccProjectInfoServices.cs

@@ -0,0 +1,11 @@
+namespace FccLite.Web.Services.FccProjectInfo
+{
+    public interface IFccProjectInfoServices
+    {
+        /// <summary>
+        /// 返回FCC版本号
+        /// </summary>
+        /// <returns></returns>
+        Task<String> GetVersion();
+    }
+}

+ 2 - 1
src/FccLife.Web/appsettings.Production.json

@@ -20,5 +20,6 @@
     "subTopic": [ "authorization", "unAuthorization", "paid", "refund" ],
     "user": "HSClient",
     "password": "HS202503"
-  }
+  },
+  "Version": "2025.02.02"
 }

+ 9 - 0
src/FccWeb/admin.ui.plus-master/src/api/api.ts

@@ -1,6 +1,15 @@
 import axios from 'axios'
 import request from './request'    // 引入封装的axios
 
+/** ----- 项目信息 ------- */
+//获取FCC版本信息
+export const getFccVersion = () =>{
+	return request({
+		url:'/qrFueling/config/getVersion',
+		method:'get'
+	})
+}
+
 /** ----- 站点 ----- */
 // 获取油站信息
 export const getDataList = (data:any)=>{

+ 17 - 1
src/FccWeb/admin.ui.plus-master/src/layout/logo/index.vue

@@ -2,6 +2,7 @@
   <div class="layout-logo" v-if="setShowLogo" @click="onThemeConfigChange">
     <img v-if="showLogoMini" :src="logoMini" class="layout-logo-medium-img" />
     <span class="my-line-1">{{ themeConfig.globalTitle }}</span>
+    <span class="my-line-1">_v{{ version }}</span>
   </div>
   <div class="layout-logo-size" v-else @click="onThemeConfigChange">
     <img v-if="showLogoMini" :src="logoMini" class="layout-logo-size-img" />
@@ -9,15 +10,18 @@
 </template>
 
 <script setup lang="ts" name="layoutLogo">
-import { computed } from 'vue'
+import { computed, onMounted, ref } from 'vue'
 import { storeToRefs } from 'pinia'
 import { useThemeConfig } from '/@/stores/themeConfig'
 import logoMini from '/@/assets/logo-com.png'
+import { getFccVersion } from "/@/api/api";
 
 // 定义变量内容
 const storesThemeConfig = useThemeConfig()
 const { themeConfig } = storeToRefs(storesThemeConfig)
 
+let version = ref('');
+
 // 设置 logo 的显示。classic 经典布局默认显示 logo
 const setShowLogo = computed(() => {
   let { isCollapse, layout } = themeConfig.value
@@ -29,6 +33,18 @@ const showLogoMini = computed(() => {
   return layout !== 'columns'
 })
 
+// 页面加载时
+onMounted(() => {
+  getVersion();
+})
+
+//获取版本号
+const getVersion = async () => {
+  const res = await getFccVersion();
+  console.log(res)
+  version.value = res;
+}
+
 // logo 点击实现菜单展开/收起
 const onThemeConfigChange = () => {
   if (themeConfig.value.layout === 'transverse') return false

+ 14 - 3
src/FccWeb/admin.ui.plus-master/src/views/admin/login/index.vue

@@ -13,7 +13,7 @@
           <img :src="loginMain" />
         </div>
         <img :src="loginBg" class="login-left-waves" />
-        <div class="floor">托肯恒山科技(广州)有限公司&nbsp;&nbsp;版本号:v2.00.1</div>
+        <div class="floor">托肯恒山科技(广州)有限公司&nbsp;&nbsp;版本号:v{{ version }}</div>
       </div>
       <div class="login-right flex">
         <div class="login-right-warp flex-margin">
@@ -46,13 +46,14 @@
 </template>
 
 <script setup lang="ts" name="loginIndex">
-import { defineAsyncComponent, onMounted, reactive, computed } from 'vue'
+import { defineAsyncComponent, onMounted, reactive, computed, ref } from 'vue'
 import { storeToRefs } from 'pinia'
 import { useThemeConfig } from '/@/stores/themeConfig'
 import { NextLoading } from '/@/utils/loading'
 import logoMini from '/src/assets/logo-com.png'
 import loginMain from '/@/assets/login-main.svg'
 import loginBg from '/@/assets/login-bg.svg'
+import { getFccVersion } from "/@/api/api";
 
 // 引入组件
 const Account = defineAsyncComponent(() => import('./component/account.vue'))
@@ -64,8 +65,10 @@ const storesThemeConfig = useThemeConfig()
 const { themeConfig } = storeToRefs(storesThemeConfig)
 const state = reactive({
   tabsActiveName: 'account',
-  isScan: false,
+  isScan: false
 })
+let version = ref('');
+
 
 // 获取布局配置信息
 const getThemeConfig = computed(() => {
@@ -73,8 +76,16 @@ const getThemeConfig = computed(() => {
 })
 // 页面加载时
 onMounted(() => {
+  getVersion();
   NextLoading.done()
 })
+
+//获取版本号
+const getVersion = async () => {
+  const res = await getFccVersion();
+  console.log(res)
+  version.value = res;
+}
 </script>
 
 <style scoped lang="scss">