feat(home): 实现热门问题展示及刷新功能

This commit is contained in:
yangzhe 2025-11-28 16:05:57 +08:00
parent ed3dc52aa0
commit c7bf6bd6b1
1 changed files with 78 additions and 45 deletions

View File

@ -22,7 +22,7 @@
<view class="qa-section">
<view class="qa-header">
<text class="qa-title">大家都在问</text>
<view class="more-link" @click="handleRefresh">
<view class="more-link" @click="hotQARefresh">
<image
class="icon-refresh"
src="/static/common/images/icon-refresh.png"
@ -80,27 +80,37 @@
>
<!-- 头部卡片 -->
<!-- 后端让先注释 -->
<!-- <view class="chat-card">
<view class="chat-card">
<view class="chat-card-title-wrapper">
<view class="chat-card-title">源小新AI校园小助手</view>
<view class="more-link" @click="hotQARefresh">
<image
class="icon-refresh"
src="/static/common/images/icon-refresh.png"
></image>
<text class="more-text">换一批</text>
</view>
</view>
<view class="chat-card-desc"
>我是你们的AI校园助手我可以为您答疑解惑</view
>
<view class="chat-card-questions">
<view class="question-item">学校哪些专业比较好?</view>
<view class="question-item">如何报考学校综合素质评价招生?</view>
<view class="question-item">学校有那些专业?</view>
<view class="question-item"
>学校在录取时有没有一些专业会有特殊...</view
<view class="qa-list">
<view
class="qa-item"
v-for="(item, index) in hotQuestions"
:key="index"
>
<view class="question-item">我什么时候能够知道自己是否被录取?</view>
<text class="qa-question">{{ item.content }}</text>
</view>
</view> -->
<view class="chat-card">
</view>
</view>
<!-- <view class="chat-card">
<view class="chat-card-title">源小新AI校园小助手</view>
<view class="chat-card-desc"
>我是你们的AI校园助手我可以为你答疑解惑</view
>
</view>
</view> -->
<!-- 对话内容区域 -->
<view class="chat-content">
@ -444,7 +454,10 @@ export default {
deep: true,
},
},
onLoad() {},
onLoad() {
this.hotQARefresh(); //
},
methods: {
async handleLeftClick() {
await this.getChatHistoryList();
@ -660,7 +673,6 @@ export default {
this.handleGetConversationDetail();
},
// (interactMode=0)
sortMessages(list = []) {
return (list || []).sort((a, b) => {
@ -694,7 +706,6 @@ export default {
});
},
// >1退
refreshPageWithFallback() {
const currentIndex = this.pageQuery.PageIndex || 1;
@ -837,7 +848,7 @@ export default {
},
//
handleRefresh() {
hotQARefresh() {
console.log("刷新问题");
this.$u.api.GetHotQuestions({}).then((res) => {
@ -850,9 +861,7 @@ export default {
// /&退
handleFeedback(message, isHelp) {
this.$u.api
.ModifyStatus({ id: message.id, isHelp })
.then((res) => {
this.$u.api.ModifyStatus({ id: message.id, isHelp }).then((res) => {
if (!res.succeed) return;
this.$u.toast("操作成功");
// 退
@ -958,7 +967,7 @@ export default {
.qa-question {
font-size: 28rpx;
color: #333;
color: #333333;
line-height: 1.5;
}
}
@ -1062,10 +1071,20 @@ export default {
}
.chat-card {
background-image: url("@/static/common/images/hot-question-bg2.png");
background-repeat: no-repeat;
background-size: 100% 100%;
background-position: 0 0;
// background-color: #ffffff;
// border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 32rpx;
margin: 32rpx 0;
.chat-card-title-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
.chat-card-title {
font-family: DouyinSans;
@ -1076,7 +1095,20 @@ export default {
background: linear-gradient(-56deg, #4d50dd 0%, #3e6aff 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 12rpx;
}
.more-link {
display: flex;
align-items: center;
.icon-refresh {
width: 36rpx;
height: 36rpx;
margin-right: 8rpx;
}
.more-text {
font-size: 26rpx;
color: #333;
}
}
}
.chat-card-desc {
@ -1088,18 +1120,19 @@ export default {
margin-bottom: 12rpx;
}
.chat-card-questions {
display: flex;
flex-direction: column;
gap: 16rpx;
.qa-list {
margin-top: 32rpx;
.qa-item {
margin-top: 16rpx;
.question-item {
.qa-question {
font-size: 28rpx;
color: #333333;
line-height: 1.5;
}
}
}
}
.chat-content {
flex: 1;