wyxd与聊天页面的切换,

This commit is contained in:
2026-07-31 10:24:55 +08:00
parent c5958812cf
commit 09f4d3ba52
16 changed files with 400 additions and 96 deletions

View File

@@ -64,6 +64,15 @@
</view>
</view>
<!-- WYXD 文件入口从工作区 AI 修改进入时显示 -->
<view v-if="hasWyxdFile" class="wyxd-banner">
<view class="wyxd-banner-icon iconfont icon-wenjian"></view>
<view class="wyxd-banner-text" @click="goWyxdViewer">查看: {{ wyxdFileName }}</view>
<view class="wyxd-banner-arrow" @click="goWyxdViewer">&rsaquo;</view>
<view class="wyxd-banner-close" @click.stop="hasWyxdFile = false">&times;</view>
</view>
<view class="main-chat">
<scroll-view class="chat-messages" direction="vertical" scroll-y :scroll-into-view="scrollToView"
:upper-threshold="0" :scroll-with-animation="!isThinking" @scroll="onScroll">
@@ -293,6 +302,7 @@
watch
} from 'vue';
import {
onLoad,
onShow,
onUnload
} from '@dcloudio/uni-app';
@@ -356,6 +366,13 @@
// 聊天类型ai好友群聊
const ChatType = ref(0)
// WYXD 关联数据(从 WorkSpace 的「AI修改」进入时携带
const wyxdWorkspaceId = ref('')
const wyxdFilePath = ref('')
const wyxdFileName = ref('')
const wyxdUserToken = ref('')
const hasWyxdFile = ref(false)
// marked.setOptions({
// breaks: true, // 自动把换行符转成 <br> 换行
@@ -621,6 +638,17 @@
})
}
// 跳转到 WYXD 查看器(强制重新下载,不走缓存)
const goWyxdViewer = () => {
uni.navigateTo({
url: '/pages/WYXD/WYXD?workspaceId=' + encodeURIComponent(wyxdWorkspaceId.value)
+ '&filePath=' + encodeURIComponent(wyxdFilePath.value)
+ '&fileName=' + encodeURIComponent(wyxdFileName.value)
+ '&userToken=' + encodeURIComponent(wyxdUserToken.value)
+ '&forceDownload=1'
})
}
// 跳转到云端数据库
const goCloudDatabase = () => {
// 保存当前会话id确保从工作区返回时能恢复
@@ -1480,6 +1508,7 @@
if (oldId && oldId !== newId) {
isLoadingMessages.value = true
allmessages.value = []
hasWyxdFile.value = false
}
switch (ChatType.value) {
case 0:
@@ -1503,6 +1532,17 @@
immediate: true
})
// 接收 WYXD 参数从工作区「AI修改」进入时由 navigateTo 传入)
onLoad((options) => {
if (options.wyxdFilePath) {
wyxdWorkspaceId.value = options.wyxdWorkspaceId ? decodeURIComponent(options.wyxdWorkspaceId) : ''
wyxdFilePath.value = decodeURIComponent(options.wyxdFilePath)
wyxdFileName.value = options.wyxdFileName ? decodeURIComponent(options.wyxdFileName) : '未命名文档'
wyxdUserToken.value = options.wyxdUserToken ? decodeURIComponent(options.wyxdUserToken) : ''
hasWyxdFile.value = true
}
})
onMounted(() => {
// currentSessionId.value = getCurrentSessionId()
})