From b5b9e66ba12aa34a08abff36633b182ee4df347e Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Fri, 23 Sep 2022 20:10:26 +0800 Subject: [PATCH] Changing the workbench layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 变更工作台组件. * 工作台加入天气, 需要适配天气api接口. * 将 withAcceptLanguage 加入axios中, 用户自行决定是否加入头. * Platform模块新增用户收藏菜单接口,使用前需要切换目录 PlatformManagement.HttpApi.Host,运行命令行 **dotnet ef database update** 或 **dotnet ef migrations script**执行迁移 --- apps/vue/src/api/weather/index.ts | 75 ++ apps/vue/src/api/weather/model/index.ts | 101 +++ .../Form/src/components/ApiTree.vue | 6 +- .../header/components/lock/LockModal.vue | 86 +- .../src/locales/lang/en/routes/dashboard.ts | 21 +- .../locales/lang/zh-CN/routes/dashboard.ts | 21 +- .../src/router/routes/modules/dashboard.ts | 2 +- apps/vue/src/store/modules/weather.ts | 36 + apps/vue/src/utils/http/axios/index.ts | 11 +- .../workbench/components/MenuCard.vue | 76 ++ .../workbench/components/MenuReference.vue | 86 ++ .../workbench/components/ProjectCard.vue | 2 +- .../workbench/components/WorkbenchHeader.vue | 84 +- .../src/views/dashboard/workbench/index.vue | 47 +- apps/vue/types/axios.d.ts | 2 + apps/vue/vite.config.ts | 22 +- .../VueVbenAdminStandardMenuConverter.cs | 28 + .../Localization/ApplicationContracts/en.json | 3 +- .../ApplicationContracts/zh-Hans.json | 3 +- .../Platform/Menus/Dto/UserFavoriteMenuDto.cs | 21 + .../Menus/Dto/UserFavoriteMenuGetListInput.cs | 9 + .../Menus/Dto/UserFavoriteMenuSetInput.cs | 11 + .../LINGYUN/Platform/Menus/IMenuAppService.cs | 8 + .../PlatformPermissionDefinitionProvider.cs | 3 +- .../Permissions/PlatformPermissions.cs | 4 +- .../LINGYUN/Platform/Menus/MenuAppService.cs | 73 ++ .../PlatformApplicationMappingProfile.cs | 1 + .../LINGYUN.Platform.Domain.Shared.csproj | 4 - .../LINGYUN/Platform/Layouts/LayoutEto.cs | 10 + .../LINGYUN/Platform/Menus/MenuEto.cs | 11 + .../LINGYUN/Platform/Menus/RoleMenuEto.cs | 14 + .../LINGYUN/Platform/Menus/UserMenuEto.cs | 14 + .../LINGYUN/Platform/Routes/RoleRouteEto.cs | 12 - .../LINGYUN/Platform/Routes/RouteEto.cs | 2 +- .../Platform/Routes/UserFavoriteMenuConsts.cs | 5 + .../LINGYUN/Platform/Routes/UserRouteEto.cs | 12 - .../Platform/Datas/DataItemMappingOptions.cs | 27 +- .../Menus/DefaultStandardMenuConverter.cs | 20 + .../LINGYUN/Platform/Menus/IMenuRepository.cs | 3 + .../Platform/Menus/IStandardMenuConverter.cs | 6 + .../Menus/IUserFavoriteMenuRepository.cs | 20 + .../Platform/Menus/MenuChangeHandler.cs | 71 ++ .../LINGYUN/Platform/Menus/StandardMenu.cs | 10 + .../Platform/Menus/UserFavoriteMenu.cs | 47 ++ .../Platform/PlatformDomainMappingProfile.cs | 8 +- .../LINGYUN/Platform/PlatformDomainModule.cs | 10 +- ...PlatformDbContextModelBuilderExtensions.cs | 28 + .../Platform/Menus/EfCoreMenuRepository.cs | 9 + .../Menus/EfCoreUserFavoriteMenuRepository.cs | 44 ++ .../LINGYUN/Platform/Menus/MenuController.cs | 28 + ...3113938_Add-User-Favorite-Menu.Designer.cs | 740 ++++++++++++++++++ .../20220923113938_Add-User-Favorite-Menu.cs | 53 ++ ...ApiHostMigrationsDbContextModelSnapshot.cs | 69 +- ...rmManagementHttpApiHostModule.Configure.cs | 11 +- .../appsettings.Development.json | 1 + 55 files changed, 2000 insertions(+), 131 deletions(-) create mode 100644 apps/vue/src/api/weather/index.ts create mode 100644 apps/vue/src/api/weather/model/index.ts create mode 100644 apps/vue/src/store/modules/weather.ts create mode 100644 apps/vue/src/views/dashboard/workbench/components/MenuCard.vue create mode 100644 apps/vue/src/views/dashboard/workbench/components/MenuReference.vue create mode 100644 aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin/LINGYUN/Abp/UI/Navigation/VueVbenAdmin/VueVbenAdminStandardMenuConverter.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuGetListInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuSetInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Layouts/LayoutEto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/MenuEto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/RoleMenuEto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/UserMenuEto.cs delete mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RoleRouteEto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/UserFavoriteMenuConsts.cs delete mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/UserRouteEto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/DefaultStandardMenuConverter.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IStandardMenuConverter.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IUserFavoriteMenuRepository.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/MenuChangeHandler.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/StandardMenu.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/UserFavoriteMenu.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserFavoriteMenuRepository.cs create mode 100644 aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220923113938_Add-User-Favorite-Menu.Designer.cs create mode 100644 aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220923113938_Add-User-Favorite-Menu.cs diff --git a/apps/vue/src/api/weather/index.ts b/apps/vue/src/api/weather/index.ts new file mode 100644 index 000000000..7e8976bb1 --- /dev/null +++ b/apps/vue/src/api/weather/index.ts @@ -0,0 +1,75 @@ +/* + 天气接口 + 数据来源: http://www.nmc.cn (中央气象台) +*/ +import { defHttp } from '/@/utils/http/axios'; +import { Position, Province, WeatherResult } from './model'; +import { format } from '/@/utils/strings'; + +//const Host = 'http://www.nmc.cn'; +const Api = { + GetProvinces: '/wapi/rest/province/all', + GetPosition: '/wapi/rest/position', + GetCitys: '/wapi/rest/province/{province}', + GetWeather: '/wapi/rest/weather?stationid={code}', +}; + +export const getProvinces = () => { + return defHttp.get({ + url: Api.GetProvinces, + //baseURL: Host, + headers: { + 'X-Requested-With': 'XMLHttpRequest' + } + }, { + apiUrl: '', + joinTime: false, + withToken: false, + withAcceptLanguage: false, + }); +}; + +export const getPosition = () => { + return defHttp.get({ + url: Api.GetPosition, + //baseURL: Host, + headers: { + 'X-Requested-With': 'XMLHttpRequest', + } + }, { + apiUrl: '', + joinTime: false, + withToken: false, + withAcceptLanguage: false, + }); +} + +export const getCitys = (provinceCode: string) => { + return defHttp.get({ + url: format(Api.GetCitys, {province: provinceCode}), + //baseURL: Host, + headers: { + 'X-Requested-With': 'XMLHttpRequest' + } + }, { + apiUrl: '', + joinTime: false, + withToken: false, + withAcceptLanguage: false, + }); +} + +export const getWeather = (cityCode: string) => { + return defHttp.get({ + url: format(Api.GetWeather, {code: cityCode}), + //baseURL: Host, + headers: { + 'X-Requested-With': 'XMLHttpRequest' + } + }, { + apiUrl: '', + joinTime: false, + withToken: false, + withAcceptLanguage: false, + }); +} diff --git a/apps/vue/src/api/weather/model/index.ts b/apps/vue/src/api/weather/model/index.ts new file mode 100644 index 000000000..dc3553b9d --- /dev/null +++ b/apps/vue/src/api/weather/model/index.ts @@ -0,0 +1,101 @@ +/* + 天气数据模型 + 数据来源: http://www.nmc.cn (中央气象台) +*/ + +/** + * 定位 + */ +export interface Position { + /** 城市 */ + city: string; + /** 代码 */ + code: string; + /** 省份 */ + province: string; + /** 专用页面 */ + url: string; +} + +/** + * 省份 + */ +export interface Province { + /** 代码 */ + code: string; + /** 名称 */ + name: string; + /** 专用页面 */ + url: string; +} + +export interface Air { + aq: number; + aqi: number; + aqiCode: string; + forecasttime: Date; + text: string; +} + +export interface Weather { + airpressure: number; + feelst: number; + humidity: number; + icomfort: number; + img: string; + info: string; + rain: number; + rcomfort: number; + temperature: number; + temperatureDiff: number; +} + +export interface Wind { + degree: number; + direct: string; + power: string; + speed: number; +} + +export interface PredictDetail { + date: Date; + pt: Date; + day: { weather: Weather; wind: Wind }; + night: { weather: Weather; wind: Wind }; +} + +export interface Predict { + detail: PredictDetail[]; + publish_time: Date; + station: Position; +} + +export interface Real { + publish_time: Date; + station: Position; + weather: Weather; + wind: Wind; +} + +export interface Tempchart { + day_img: string; + day_text: string; + max_temp: number; + min_temp: number; + night_img: string; + night_text: string; + time: Date; +} + +export interface WeatherInfo { + air: Air; + predict: Predict; + real: Real; + tempchart: Tempchart; +} + +export interface WeatherResult { + code: number; + msg: string; + data: WeatherInfo; +} diff --git a/apps/vue/src/components/Form/src/components/ApiTree.vue b/apps/vue/src/components/Form/src/components/ApiTree.vue index 0ec6917dd..44d6b5a2c 100644 --- a/apps/vue/src/components/Form/src/components/ApiTree.vue +++ b/apps/vue/src/components/Form/src/components/ApiTree.vue @@ -1,12 +1,12 @@ diff --git a/apps/vue/src/views/dashboard/workbench/components/MenuReference.vue b/apps/vue/src/views/dashboard/workbench/components/MenuReference.vue new file mode 100644 index 000000000..a325098df --- /dev/null +++ b/apps/vue/src/views/dashboard/workbench/components/MenuReference.vue @@ -0,0 +1,86 @@ + + + + + \ No newline at end of file diff --git a/apps/vue/src/views/dashboard/workbench/components/ProjectCard.vue b/apps/vue/src/views/dashboard/workbench/components/ProjectCard.vue index 0c4990bf2..f990e802d 100644 --- a/apps/vue/src/views/dashboard/workbench/components/ProjectCard.vue +++ b/apps/vue/src/views/dashboard/workbench/components/ProjectCard.vue @@ -4,7 +4,7 @@ 更多 - + {{ item.title }} diff --git a/apps/vue/src/views/dashboard/workbench/components/WorkbenchHeader.vue b/apps/vue/src/views/dashboard/workbench/components/WorkbenchHeader.vue index ef4d90d79..089b7fe38 100644 --- a/apps/vue/src/views/dashboard/workbench/components/WorkbenchHeader.vue +++ b/apps/vue/src/views/dashboard/workbench/components/WorkbenchHeader.vue @@ -2,32 +2,88 @@
-

早安, {{ userinfo.realName }}, 开始您一天的工作吧!

- 今日晴,20℃ - 32℃! +

{{ getWelcomeTitle }}

+ {{ getWeatherInfo }}
-
- 待办 - 2/10 -
- -
- 项目 - 8 -
- 团队 - 300 + {{ t('routes.dashboard.workbench.header.notifier.title') }} + {{ t('routes.dashboard.workbench.header.notifier.count', [unReadNotiferCount]) }}
diff --git a/apps/vue/src/views/dashboard/workbench/index.vue b/apps/vue/src/views/dashboard/workbench/index.vue index 5ee292e22..7858089f3 100644 --- a/apps/vue/src/views/dashboard/workbench/index.vue +++ b/apps/vue/src/views/dashboard/workbench/index.vue @@ -3,30 +3,59 @@
- - +
- + - +