From 1c7486a7bcf59071830292206cbd46597a10c615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Fri, 9 Aug 2024 22:39:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9Ebbs=E6=8E=92=E8=A1=8C?= =?UTF-8?q?=E6=A6=9C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/BbsUser/MoneyTopUserDto.cs | 4 +- .../Analyses/BbsUserAnalyseService.cs | 55 +++---- Yi.Bbs.Vue3/src/apis/analyseApi.js | 4 +- Yi.Bbs.Vue3/src/router/index.js | 9 ++ Yi.Bbs.Vue3/src/views/home/Index.vue | 138 +++++++++++------- .../home/components/PointsRanking/index.vue | 15 +- .../home/components/RecommendFriend/index.vue | 19 ++- .../home/hooks/accessLogEchartsConfig.js | 3 + 8 files changed, 142 insertions(+), 105 deletions(-) diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/MoneyTopUserDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/MoneyTopUserDto.cs index 19fc69dc..e957f079 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/MoneyTopUserDto.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/MoneyTopUserDto.cs @@ -5,9 +5,9 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; public class MoneyTopUserDto { public string UserName { get; set; } - public string? Nice { get; set; } + public string? Nick { get; set; } public decimal Money { get; set; } - public string Order { get; set; } + public int Order { get; set; } public string? Icon { get; set; } public int Level { get; set; } /// diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsUserAnalyseService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsUserAnalyseService.cs index f71d2d26..429a86e9 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsUserAnalyseService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsUserAnalyseService.cs @@ -19,6 +19,7 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses { private BbsUserManager _bbsUserManager; private IOnlineService _onlineService; + public BbsUserAnalyseService(BbsUserManager bbsUserManager, IOnlineService onlineService) { _bbsUserManager = bbsUserManager; @@ -36,22 +37,24 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses { RefAsync total = 0; var output = await _bbsUserManager._userRepository._DbQueryable - .LeftJoin((u,info)=>u.Id==info.UserId) + .LeftJoin((u, info) => u.Id == info.UserId) + .OrderByDescending((u,info) => info.Money) .Select((u, info) => new MoneyTopUserDto { UserName = u.UserName, - Nice = u.Nick, + Nick = u.Nick, Money = info.Money, Icon = u.Icon, Level = info.Level, - UserLimit = info.UserLimit + UserLimit = info.UserLimit, + Order = SqlFunc.RowNumber(u.Id) } ) - .OrderBy(info=>info.Money) - .ToPageListAsync(input.SkipCount, input.MaxResultCount,total); - - output.ForEach(x => { x.LevelName = _bbsUserManager._levelCacheDic[x.Level].Name;}); + + .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); + + output.ForEach(x => { x.LevelName = _bbsUserManager._levelCacheDic[x.Level].Name; }); return new PagedResultDto { Items = output, @@ -71,10 +74,9 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses using (DataFilter.DisablePermissionHandler()) { var randUserIds = await _bbsUserManager._userRepository._DbQueryable - //.Where(x => x.UserName != UserConst.Admin) - .OrderBy(x => SqlFunc.GetRandom()) - .Select(x => x.Id). - ToPageListAsync(input.SkipCount, input.MaxResultCount); + //.Where(x => x.UserName != UserConst.Admin) + .OrderBy(x => SqlFunc.GetRandom()) + .Select(x => x.Id).ToPageListAsync(input.SkipCount, input.MaxResultCount); var output = await _bbsUserManager.GetBbsUserInfoAsync(randUserIds); return output.Adapt>(); @@ -83,26 +85,6 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses //这里有数据权限,会根据用户角色进行过滤 } - /// - /// 积分钱钱排行榜 - /// - /// - [HttpGet("analyse/bbs-user/integral-top")] - public async Task> GetIntegralTopUserAsync([FromQuery] PagedResultRequestDto input) - { - using (DataFilter.DisablePermissionHandler()) - { - var randUserIds = await _bbsUserManager._userRepository._DbQueryable - // .Where(user => user.UserName != UserConst.Admin) - .LeftJoin((user, info) => user.Id == info.UserId) - .OrderByDescending((user, info) => info.Money) - .Select((user, info) => user.Id). - ToPageListAsync(input.SkipCount, input.MaxResultCount); - var output = await _bbsUserManager.GetBbsUserInfoAsync(randUserIds); - return output.OrderByDescending(x => x.Money).ToList().Adapt>(); - } - } - /// /// 用户分析 /// @@ -112,7 +94,7 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses { using (DataFilter.DisablePermissionHandler()) { - var sss= DataFilter.IsEnabled(); + var sss = DataFilter.IsEnabled(); var registerUser = await _bbsUserManager._userRepository._DbQueryable.CountAsync(); @@ -121,16 +103,15 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses DateTime startTime = new DateTime(yesterday.Year, yesterday.Month, yesterday.Day, 0, 0, 0); DateTime endTime = startTime.AddHours(24); var yesterdayNewUser = await _bbsUserManager._userRepository._DbQueryable - .Where(x => x.CreationTime >= startTime && x.CreationTime <= endTime).CountAsync(); + .Where(x => x.CreationTime >= startTime && x.CreationTime <= endTime).CountAsync(); var userOnline = (await _onlineService.GetListAsync(new OnlineUserModel { })).TotalCount; - var output = new BbsUserAnalyseGetOutput() { OnlineNumber = userOnline, RegisterNumber = registerUser, YesterdayNewUser = yesterdayNewUser }; + var output = new BbsUserAnalyseGetOutput() + { OnlineNumber = userOnline, RegisterNumber = registerUser, YesterdayNewUser = yesterdayNewUser }; return output; } } - - } -} +} \ No newline at end of file diff --git a/Yi.Bbs.Vue3/src/apis/analyseApi.js b/Yi.Bbs.Vue3/src/apis/analyseApi.js index 2ae3d8e5..3f1cfbbf 100644 --- a/Yi.Bbs.Vue3/src/apis/analyseApi.js +++ b/Yi.Bbs.Vue3/src/apis/analyseApi.js @@ -33,9 +33,9 @@ export function getRecommendedFriend(data) { */ export function getRankingPoints(data) { return request({ - url: "/analyse/bbs-user/integral-top", + url: "/analyse/bbs-user/money-top", method: "get", - data, + params: data }); } diff --git a/Yi.Bbs.Vue3/src/router/index.js b/Yi.Bbs.Vue3/src/router/index.js index a2782a2b..9413c399 100644 --- a/Yi.Bbs.Vue3/src/router/index.js +++ b/Yi.Bbs.Vue3/src/router/index.js @@ -106,6 +106,15 @@ const router = createRouter({ title: "联系我们", }, }, + + { + name:"money", + path:"/money", + component: () => import("../views/money/Index.vue"), + meta: { + title: "钱钱", + }, + }, ], }, { diff --git a/Yi.Bbs.Vue3/src/views/home/Index.vue b/Yi.Bbs.Vue3/src/views/home/Index.vue index 59db4649..c3e066d0 100644 --- a/Yi.Bbs.Vue3/src/views/home/Index.vue +++ b/Yi.Bbs.Vue3/src/views/home/Index.vue @@ -81,13 +81,13 @@ @@ -102,7 +102,18 @@ - + + + + + + 即将上线,敬请期待 + + + + + + @@ -118,7 +129,7 @@ @@ -439,10 +468,12 @@ const onClickAccessLog = async () => { } } } - .top{ - text-align: center; + + .top { + text-align: center; margin-bottom: 20px; -} + } + .active { display: flex; justify-content: space-between; @@ -454,13 +485,16 @@ const onClickAccessLog = async () => { flex-direction: column; align-items: center; display: flex; - cursor: pointer; + cursor: pointer; padding: 10px 0px; } + .el-col:hover { - background-color: #cce1ff; /* 悬浮时背景色变化 */ - color: #70aafb; /* 悬浮时文字颜色变化 */ -} + background-color: #cce1ff; + /* 悬浮时背景色变化 */ + color: #70aafb; + /* 悬浮时文字颜色变化 */ + } &-btn { cursor: pointer; diff --git a/Yi.Bbs.Vue3/src/views/home/components/PointsRanking/index.vue b/Yi.Bbs.Vue3/src/views/home/components/PointsRanking/index.vue index 0f13206e..86f8d446 100644 --- a/Yi.Bbs.Vue3/src/views/home/components/PointsRanking/index.vue +++ b/Yi.Bbs.Vue3/src/views/home/components/PointsRanking/index.vue @@ -10,25 +10,26 @@ > - + +
- {{ pointsData.userName }} + {{ pointsData.nick }}
@@ -111,4 +112,8 @@ const userImageSrc = computed(() => { } } } +.follow-text +{ cursor: pointer; + font-size: small; +} diff --git a/Yi.Bbs.Vue3/src/views/home/components/RecommendFriend/index.vue b/Yi.Bbs.Vue3/src/views/home/components/RecommendFriend/index.vue index 01ef4092..b19ca866 100644 --- a/Yi.Bbs.Vue3/src/views/home/components/RecommendFriend/index.vue +++ b/Yi.Bbs.Vue3/src/views/home/components/RecommendFriend/index.vue @@ -9,27 +9,27 @@ - {{ friendData.userName }} + {{ friendData.nick }} - {{ friendData.level }}-{{friendData.levelName}} 等级 + > -->
@@ -86,7 +86,7 @@ const userImageSrc = computed(() => { display: flex; align-items: center; .name { - width: 50px; + width: 100px; color: #252933; margin-left: 5px; white-space: nowrap; @@ -111,4 +111,9 @@ const userImageSrc = computed(() => { } } } +.follow-text +{ + font-size: small; + cursor: pointer; +} diff --git a/Yi.Bbs.Vue3/src/views/home/hooks/accessLogEchartsConfig.js b/Yi.Bbs.Vue3/src/views/home/hooks/accessLogEchartsConfig.js index a9b7f064..ef49911e 100644 --- a/Yi.Bbs.Vue3/src/views/home/hooks/accessLogEchartsConfig.js +++ b/Yi.Bbs.Vue3/src/views/home/hooks/accessLogEchartsConfig.js @@ -1,4 +1,7 @@ export const accessLogEchartsConfig = { + tooltip: { + trigger: 'axis' + }, xAxis: { type: 'category', boundaryGap: false,