feat: 完成全流程融资助手应用开发

- 新增文章、课程详情页面,完善融资课堂模块
- 新增登录/注册、评估填报、结果匹配全流程业务
- 新增会话管理、错误重试与状态加载逻辑
- 重构首页路由逻辑,适配已登录用户跳转
- 完善个人中心登出与数据持久化功能
This commit is contained in:
hujun
2026-09-11 20:23:10 +08:00
parent 60b58442ce
commit 626cef9d38
14 changed files with 3016 additions and 76 deletions
+12 -4
View File
@@ -11,6 +11,7 @@
<image v-if="item.role == 'assistant'" class="message-avatar" src="/static/images/robot.png" mode="aspectFit"></image>
<view :class="item.role == 'user' ? 'message-bubble user-bubble' : 'message-bubble'"><text>{{ item.text }}</text></view>
</view>
<view v-if="errorMessage.length > 0" class="assistant-error"><text>{{ errorMessage }}</text><text @click="retry">重试</text></view>
</view>
</scroll-view>
<view class="chat-input"><input v-model="draft" confirm-type="send" @confirm="send" placeholder="请输入您的问题..." /><button @click="send"><AppIcon name="send" :size="34" /></button></view>
@@ -25,20 +26,27 @@
const messages = ref<UTSJSONObject[]>([])
const draft = ref('')
const lastMessageId = ref('')
const lastQuestion = ref('')
const sending = ref(false)
const errorMessage = ref('')
const ask = (text: string) => { draft.value = text; send() }
const send = async () => {
const text = draft.value.trim()
if (text.length == 0) return
if (text.length == 0 || sending.value) return
lastQuestion.value = text
messages.value.push({ role: 'user', text: text })
draft.value = ''
const answer = await sendAssistantMessage(text)
messages.value.push({ role: 'assistant', text: answer })
lastMessageId.value = 'message-' + (messages.value.length - 1)
sending.value = true
errorMessage.value = ''
try { const answer = await sendAssistantMessage(text); messages.value.push({ role: 'assistant', text: answer }); lastMessageId.value = 'message-' + (messages.value.length - 1) } catch (error) { errorMessage.value = '消息发送失败,请稍后重试' }
sending.value = false
}
const retry = () => { draft.value = lastQuestion.value; errorMessage.value = ''; send() }
</script>
<style>
.assistant-page { background-color: #f4f7fb; }.chat-scroll { height: calc(100vh - var(--status-bar-height) - 210rpx); }.chat-content { padding: 28rpx 26rpx 50rpx; }.assistant-intro { flex-direction: row; align-items: flex-start; }.assistant-intro image, .message-avatar { width: 78rpx; height: 78rpx; border-radius: 24rpx; background-color: #e7f2ff; margin-right: 16rpx; }.assistant-bubble, .message-bubble { max-width: 530rpx; padding: 24rpx; border-radius: 8rpx 22rpx 22rpx 22rpx; background-color: #fff; color: #344259; font-size: 25rpx; line-height: 42rpx; border: 1rpx solid #e4ebf5; }
.quick-questions { margin: 25rpx 0 36rpx 94rpx; }.question { min-height: 72rpx; margin-top: 13rpx; padding: 14rpx 18rpx; border-radius: 16rpx; border: 2rpx solid #bcd9ff; background-color: #eef6ff; color: #0868f7; font-size: 23rpx; flex-direction: row; align-items: center; justify-content: space-between; }.question-arrow { font-size: 34rpx; }.message-row { margin-top: 22rpx; flex-direction: row; align-items: flex-start; }.user-row { justify-content: flex-end; }.user-bubble { color: #fff; background-color: #0868f7; border-color: #0868f7; border-radius: 22rpx 8rpx 22rpx 22rpx; }
.chat-input { position: fixed; left: 0; right: 0; bottom: 0; min-height: 114rpx; padding: 17rpx 24rpx calc(17rpx + env(safe-area-inset-bottom)); background-color: #fff; border-top: 1rpx solid #e3eaf4; flex-direction: row; align-items: center; }.chat-input input { flex: 1; height: 78rpx; border-radius: 39rpx; background-color: #f2f5f9; padding: 0 28rpx; font-size: 25rpx; }.chat-input button { width: 76rpx; height: 76rpx; line-height: 76rpx; border-radius: 50%; margin-left: 15rpx; padding: 0; background-color: #0868f7; color: #fff; font-size: 29rpx; }
.assistant-error { margin: 18rpx 0 0 94rpx; color: #e05a5a; font-size: 21rpx; flex-direction: row; justify-content: space-between; }.assistant-error text:last-child { color: #0868f7; margin-left: 18rpx; }
</style>