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