feat: 优化前端请求加载
This commit is contained in:
@@ -9,6 +9,7 @@ namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
|||||||
[SugarTable("Discuss")]
|
[SugarTable("Discuss")]
|
||||||
[SugarIndex($"index_{nameof(Title)}", nameof(Title), OrderByType.Asc)]
|
[SugarIndex($"index_{nameof(Title)}", nameof(Title), OrderByType.Asc)]
|
||||||
[SugarIndex($"index_{nameof(PlateId)}", nameof(PlateId), OrderByType.Asc)]
|
[SugarIndex($"index_{nameof(PlateId)}", nameof(PlateId), OrderByType.Asc)]
|
||||||
|
[SugarIndex($"index_{nameof(CreatorId)}", nameof(CreatorId), OrderByType.Asc)]
|
||||||
[SugarIndex($"index_{nameof(CreationTime)}", nameof(CreationTime), OrderByType.Desc)]
|
[SugarIndex($"index_{nameof(CreationTime)}", nameof(CreationTime), OrderByType.Desc)]
|
||||||
public class DiscussAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject
|
public class DiscussAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,20 +12,21 @@
|
|||||||
|
|
||||||
<el-menu-item index="2" @click="enterStart"
|
<el-menu-item index="2" @click="enterStart"
|
||||||
style="color: red;font-weight: bolder;font-size: large;">开始</el-menu-item>
|
style="color: red;font-weight: bolder;font-size: large;">开始</el-menu-item>
|
||||||
|
<el-menu-item index="3" @click="enterWatermelon"
|
||||||
<el-sub-menu index="3">
|
>大西瓜</el-menu-item>
|
||||||
|
<el-sub-menu index="4">
|
||||||
<template #title>学习</template>
|
<template #title>学习</template>
|
||||||
<el-menu-item index="3-1">前端</el-menu-item>
|
<el-menu-item index="3-1">前端</el-menu-item>
|
||||||
<el-menu-item index="3-2">后端</el-menu-item>
|
<el-menu-item index="3-2">后端</el-menu-item>
|
||||||
<el-menu-item index="3-3">运维</el-menu-item>
|
<el-menu-item index="3-3">运维</el-menu-item>
|
||||||
</el-sub-menu>
|
</el-sub-menu>
|
||||||
|
|
||||||
<el-sub-menu index="4">
|
<!-- <el-sub-menu index="5">-->
|
||||||
<template #title>问答</template>
|
<!-- <template #title>问答</template>-->
|
||||||
<el-menu-item index="4-1">前端</el-menu-item>
|
<!-- <el-menu-item index="4-1">前端</el-menu-item>-->
|
||||||
<el-menu-item index="4-2">后端</el-menu-item>
|
<!-- <el-menu-item index="4-2">后端</el-menu-item>-->
|
||||||
<el-menu-item index="4-3">运维</el-menu-item>
|
<!-- <el-menu-item index="4-3">运维</el-menu-item>-->
|
||||||
</el-sub-menu>
|
<!-- </el-sub-menu>-->
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-bar">
|
<div class="search-bar">
|
||||||
@@ -222,6 +223,9 @@ const enterStart = () => {
|
|||||||
router.push("/start");
|
router.push("/start");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const enterWatermelon=()=>{
|
||||||
|
alert("即将上线,敬请期待~")
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -298,7 +298,10 @@ const handleKeydownInput=()=>{
|
|||||||
|
|
||||||
// 如果只按下 Enter,则阻止默认的提交行为,比如在表单中
|
// 如果只按下 Enter,则阻止默认的提交行为,比如在表单中
|
||||||
if (event.key === 'Enter') {
|
if (event.key === 'Enter') {
|
||||||
|
// 阻止默认行为
|
||||||
|
event.preventDefault();
|
||||||
onclickSendMsg();
|
onclickSendMsg();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,6 +378,12 @@ const onclickSendGroupMsg = (groupName, msg) => {
|
|||||||
const clearAiMsg = () => {
|
const clearAiMsg = () => {
|
||||||
sendAiChatContext.value = [];
|
sendAiChatContext.value = [];
|
||||||
chatStore.clearAiMsg();
|
chatStore.clearAiMsg();
|
||||||
|
ElMessage({
|
||||||
|
message: "当前会话清除成功",
|
||||||
|
type: "success",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取当前最后一条信息
|
//获取当前最后一条信息
|
||||||
@@ -403,7 +412,7 @@ const getLastMessage = ((receiveId, itemType) => {
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div style="position: absolute; top: 0;left: 0;" v-show="isShowTipNumber>0">
|
<div style="position: absolute; top: 0;left: 0;" v-show="isShowTipNumber>0">
|
||||||
<p>当前版本:1.5.1</p>
|
<p>当前版本:1.5.2</p>
|
||||||
<p>tip:官方学习交流群每次发送消息消耗 1 钱钱</p>
|
<p>tip:官方学习交流群每次发送消息消耗 1 钱钱</p>
|
||||||
<p>tip:点击聊天窗口右上角“X”可退出</p>
|
<p>tip:点击聊天窗口右上角“X”可退出</p>
|
||||||
<p>tip:多人同时在聊天室时,左侧可显示其他成员</p>
|
<p>tip:多人同时在聊天室时,左侧可显示其他成员</p>
|
||||||
@@ -501,7 +510,7 @@ const getLastMessage = ((receiveId, itemType) => {
|
|||||||
|
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="header-left">{{ currentHeaderName }} <span v-show="selectIsAi()" @click="clearAiMsg">点击清空当前对话</span>
|
<div class="header-left">{{ currentHeaderName }} <span class="clear-msg" v-show="selectIsAi()" @click="clearAiMsg">点击此处清空当前对话</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="header-right">
|
<div class="header-right">
|
||||||
@@ -780,13 +789,13 @@ const getLastMessage = ((receiveId, itemType) => {
|
|||||||
.content {
|
.content {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
/* 只启用垂直方向滚动条 */
|
/* 只启用垂直方向滚动条 */
|
||||||
height: 555px;
|
height: 535px;
|
||||||
padding: 20px 40px;
|
padding: 20px 40px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom {
|
.bottom {
|
||||||
height: calc(100% - 630px);
|
height: calc(100% - 610px);
|
||||||
background: #f7f7f7;
|
background: #f7f7f7;
|
||||||
border-top: 1.5px solid #e7e7e7;
|
border-top: 1.5px solid #e7e7e7;
|
||||||
padding: 15px 35px;
|
padding: 15px 35px;
|
||||||
@@ -1096,7 +1105,15 @@ const getLastMessage = ((receiveId, itemType) => {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.clear-msg{
|
||||||
|
font-size: large;
|
||||||
|
margin-left: 10px;
|
||||||
|
cursor: pointer; /* 设置为手型 */
|
||||||
|
}
|
||||||
|
.clear-msg:hover {
|
||||||
|
color: red;
|
||||||
|
cursor: pointer; /* 设置鼠标悬浮为手型 */
|
||||||
|
}
|
||||||
::v-deep(.nav-ul) {
|
::v-deep(.nav-ul) {
|
||||||
border-right: 1px solid #FFFFFF;
|
border-right: 1px solid #FFFFFF;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
|
|||||||
@@ -261,40 +261,46 @@ const query = reactive({
|
|||||||
isTop: true,
|
isTop: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const weekQuery = reactive({accessLogType: "Request"});
|
const weekQuery = reactive({accessLogType: "Request"});4
|
||||||
|
|
||||||
|
const init=async ()=>{
|
||||||
|
|
||||||
|
//分阶段优化
|
||||||
|
await Promise.all([
|
||||||
|
(async ()=>{const {data: allDiscussData, config: allDiscussConfig} =
|
||||||
|
await getAllDiscussList({Type: 0, skipCount: 1, maxResultCount: 30,});
|
||||||
|
isAllDiscussFinished.value = allDiscussConfig.isFinish;
|
||||||
|
allDiscussList.value = allDiscussData.items;})(),
|
||||||
|
(async ()=>{const {data: plateData} = await getList();
|
||||||
|
plateList.value = plateData.items;})(),
|
||||||
|
(async ()=>{const {data: discussData, config: discussConfig} = await getHomeDiscuss();
|
||||||
|
discussList.value = discussData;
|
||||||
|
isDiscussFinished.value = discussConfig.isFinish;})(),
|
||||||
|
(async ()=>{const {data: bannerData} = await bannerGetList();
|
||||||
|
bannerList.value = bannerData.items;})(),
|
||||||
|
(async ()=>{const {data: weekData} = await getWeek(weekQuery);
|
||||||
|
weekList.value = weekData;})(),
|
||||||
|
(async ()=>{const {data: pointData, config: pointConfig} = await getRankingPoints();
|
||||||
|
pointList.value = pointData.items;
|
||||||
|
isPointFinished.value = pointConfig.isFinish;})(),
|
||||||
|
(async ()=>{const {data: userAnalyseInfoData} = await getUserAnalyse();
|
||||||
|
onlineNumber.value = userAnalyseInfoData.onlineNumber;
|
||||||
|
userAnalyseInfo.value = userAnalyseInfoData;})(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
//不重要的请求滞后
|
||||||
|
const {data: friendData, config: friendConfig} = await getRecommendedFriend();
|
||||||
|
friendList.value = friendData;
|
||||||
|
isFriendFinished.value = friendConfig.isFinish;
|
||||||
|
const {data: themeData, config: themeConfig} = await getRecommendedTopic();
|
||||||
|
themeList.value = themeData;
|
||||||
|
isThemeFinished.value = themeConfig.isFinish;
|
||||||
|
await access();
|
||||||
|
}
|
||||||
//初始化
|
//初始化
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
access();
|
await init();
|
||||||
const {data: plateData} = await getList();
|
|
||||||
plateList.value = plateData.items;
|
|
||||||
const {data: discussData, config: discussConfig} = await getHomeDiscuss();
|
|
||||||
discussList.value = discussData;
|
|
||||||
isDiscussFinished.value = discussConfig.isFinish;
|
|
||||||
const {data: bannerData} = await bannerGetList();
|
|
||||||
bannerList.value = bannerData.items;
|
|
||||||
const {data: weekData} = await getWeek(weekQuery);
|
|
||||||
weekList.value = weekData;
|
|
||||||
const {data: pointData, config: pointConfig} = await getRankingPoints();
|
|
||||||
pointList.value = pointData.items;
|
|
||||||
isPointFinished.value = pointConfig.isFinish;
|
|
||||||
const {data: friendData, config: friendConfig} =
|
|
||||||
await getRecommendedFriend();
|
|
||||||
friendList.value = friendData;
|
|
||||||
isFriendFinished.value = friendConfig.isFinish;
|
|
||||||
const {data: themeData, config: themeConfig} = await getRecommendedTopic();
|
|
||||||
themeList.value = themeData;
|
|
||||||
isThemeFinished.value = themeConfig.isFinish;
|
|
||||||
const {data: allDiscussData, config: allDiscussConfig} =
|
|
||||||
await getAllDiscussList({
|
|
||||||
Type: 0,
|
|
||||||
skipCount: 1,
|
|
||||||
maxResultCount: 30,
|
|
||||||
});
|
|
||||||
isAllDiscussFinished.value = allDiscussConfig.isFinish;
|
|
||||||
allDiscussList.value = allDiscussData.items;
|
|
||||||
const {data: userAnalyseInfoData} = await getUserAnalyse();
|
|
||||||
onlineNumber.value = userAnalyseInfoData.onlineNumber;
|
|
||||||
userAnalyseInfo.value = userAnalyseInfoData;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const weekXAxis = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"];
|
const weekXAxis = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"];
|
||||||
|
|||||||
Reference in New Issue
Block a user