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

@@ -24,7 +24,7 @@
</view> </view>
<view class="new-chat-btn" @click="goContactPages"> <view class="new-chat-btn" @click="goContactPages">
<text>+ 聊天列表</text> <text>+ 更多聊天列表</text>
</view> </view>
</view> </view>
<view class="chat-history"> <view class="chat-history">

View File

@@ -1,5 +1,5 @@
{ {
"name" : "test1", "name" : "宇恒一号",
"appid" : "__UNI__923FD9E", "appid" : "__UNI__923FD9E",
"description" : "", "description" : "",
"versionName" : "1.1.1", "versionName" : "1.1.1",

View File

@@ -105,11 +105,13 @@
font-size: 36rpx; font-size: 36rpx;
font-weight: 700; font-weight: 700;
color: #1a1a2e; color: #1a1a2e;
align-items: center;
} }
.ncd-header uni-icons { .ncd-header uni-icons {
display: flex; display: flex;
flex-shrink: 0; flex-shrink: 0;
align-items: center;
} }
.ncd-options { .ncd-options {
@@ -325,6 +327,62 @@
color: #ff4d4f; color: #ff4d4f;
} }
/* ==========WYXD 文件入口横幅========== */
.wyxd-banner {
display: flex;
align-items: center;
padding: 14rpx 24rpx;
margin: 6rpx 20rpx;
background: linear-gradient(135deg, #e8f4fd, #f0e6ff);
border: 1.5rpx solid rgba(120, 120, 220, 0.25);
border-radius: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(100, 100, 200, 0.08);
}
.wyxd-banner:active {
background: linear-gradient(135deg, #d8eafb, #e6d8ff);
transform: scale(0.98);
}
.wyxd-banner-icon {
font-size: 32rpx;
color: #6c6ce0;
margin-right: 12rpx;
}
.wyxd-banner-text {
flex: 1;
font-size: 26rpx;
font-weight: 600;
color: #4a4ab8;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.wyxd-banner-arrow {
font-size: 24rpx;
color: #9999cc;
}
.wyxd-banner-close {
width: 36rpx;
height: 36rpx;
line-height: 36rpx;
text-align: center;
font-size: 28rpx;
color: #9999cc;
border-radius: 50%;
background: rgba(100, 100, 200, 0.08);
margin-left: 8rpx;
flex-shrink: 0;
}
.wyxd-banner-close:active {
background: rgba(100, 100, 200, 0.18);
color: #6c6ce0;
}
/* ==========聊天主体部分========== */ /* ==========聊天主体部分========== */
.main-chat { .main-chat {
display: flex; display: flex;

View File

@@ -64,6 +64,15 @@
</view> </view>
</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"> <view class="main-chat">
<scroll-view class="chat-messages" direction="vertical" scroll-y :scroll-into-view="scrollToView" <scroll-view class="chat-messages" direction="vertical" scroll-y :scroll-into-view="scrollToView"
:upper-threshold="0" :scroll-with-animation="!isThinking" @scroll="onScroll"> :upper-threshold="0" :scroll-with-animation="!isThinking" @scroll="onScroll">
@@ -293,6 +302,7 @@
watch watch
} from 'vue'; } from 'vue';
import { import {
onLoad,
onShow, onShow,
onUnload onUnload
} from '@dcloudio/uni-app'; } from '@dcloudio/uni-app';
@@ -356,6 +366,13 @@
// 聊天类型ai好友群聊 // 聊天类型ai好友群聊
const ChatType = ref(0) 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({ // marked.setOptions({
// breaks: true, // 自动把换行符转成 <br> 换行 // 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 = () => { const goCloudDatabase = () => {
// 保存当前会话id确保从工作区返回时能恢复 // 保存当前会话id确保从工作区返回时能恢复
@@ -1480,6 +1508,7 @@
if (oldId && oldId !== newId) { if (oldId && oldId !== newId) {
isLoadingMessages.value = true isLoadingMessages.value = true
allmessages.value = [] allmessages.value = []
hasWyxdFile.value = false
} }
switch (ChatType.value) { switch (ChatType.value) {
case 0: case 0:
@@ -1503,6 +1532,17 @@
immediate: true 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(() => { onMounted(() => {
// currentSessionId.value = getCurrentSessionId() // currentSessionId.value = getCurrentSessionId()
}) })

View File

@@ -188,7 +188,8 @@ onLoad((options) => {
userToken: userToken.value userToken: userToken.value
}) })
if (isWyxdCached(workspaceId.value, filePath.value)) { // forceDownload 强制重新下载不走缓存
if (options.forceDownload !== '1' && isWyxdCached(workspaceId.value, filePath.value)) {
loadFromCache() loadFromCache()
} else { } else {
startDownload() startDownload()

View File

@@ -284,20 +284,35 @@
const handleLongPress = (folder) => { const handleLongPress = (folder) => {
if (isSelectFolder.value) return; if (isSelectFolder.value) return;
const isWyxd = folder.name && folder.name.toLowerCase().endsWith('.wyxd'); const isWyxd = folder.name && folder.name.toLowerCase().endsWith('.wyxd');
const itemList = isWyxd ? ['下载', '删除', 'WYXD查看器'] : ['下载', '删除']; const itemList = isWyxd ? ['下载', '删除', 'WYXD查看器', 'AI修改'] : ['下载', '删除'];
uni.showActionSheet({ uni.showActionSheet({
title: folder.name,
itemList: itemList, itemList: itemList,
success: (res) => { success: (res) => {
switch (res.tapIndex) { if (isWyxd) {
case 0: switch (res.tapIndex) {
handleDownload(folder); case 0:
break; handleDownload(folder);
case 1: break;
handleDelete(folder); case 1:
break; handleDelete(folder);
case 2: break;
if (isWyxd) openWyxdViewer(folder); case 2:
break; openWyxdViewer(folder);
break;
case 3: // 'AI修改',
handleAiModify(folder);
break;
}
} else {
switch (res.tapIndex) {
case 0:
handleDownload(folder);
break;
case 1:
handleDelete(folder);
break;
}
} }
} }
}) })
@@ -472,6 +487,17 @@
}); });
}; };
// AI修改入口跳转对话页并传入 WYXD 信息
const handleAiModify = (folder) => {
const filePath = folder.path.startsWith('./') ? folder.path.slice(2) : folder.path;
uni.navigateTo({
url: '/pages/Chat/Chat?wyxdWorkspaceId=' + encodeURIComponent(workspaceId.value)
+ '&wyxdFilePath=' + encodeURIComponent(filePath)
+ '&wyxdFileName=' + encodeURIComponent(folder.name)
+ '&wyxdUserToken=' + encodeURIComponent(UserToken.value)
});
};
// 删除 // 删除
const handleDelete = (folder) => { const handleDelete = (folder) => {
uni.showModal({ uni.showModal({

View File

@@ -1,8 +1,8 @@
;(function(){ ;(function(){
let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[]; let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[];
const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","navigationBar":{"backgroundColor":"#F8F8F8","titleText":"uni-app","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"test1","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"5.07","entryPagePath":"pages/Login/Login","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}}; const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","navigationBar":{"backgroundColor":"#F8F8F8","titleText":"uni-app","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"宇恒一号","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"5.07","entryPagePath":"pages/Login/Login","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}};
const __uniRoutes = [{"path":"pages/Login/Login","meta":{"isQuit":true,"isEntry":true,"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"登录页面","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/Chat/Chat","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"聊天页面(主页面)","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/WorkSpace/WorkSpace","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"工作区文件管理","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/UserProfileModal/UserProfileModal","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/ContactPages/ContactPages","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/WorkSpace/TemplateSpace/TemplateSpace","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/CloudDatabase/CloudDatabase","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"云端数据","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/CloudDbDetail/CloudDbDetail","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"数据库详情","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/text/text","meta":{"navigationBar":{"titleText":"","type":"default"},"isNVue":false}},{"path":"pages/text/IntuitiveAipptViewer","meta":{"navigationBar":{"titleText":"","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute)); const __uniRoutes = [{"path":"pages/Login/Login","meta":{"isQuit":true,"isEntry":true,"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"登录页面","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/Chat/Chat","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"聊天页面(主页面)","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/WorkSpace/WorkSpace","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"工作区文件管理","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/UserProfileModal/UserProfileModal","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/ContactPages/ContactPages","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/WorkSpace/TemplateSpace/TemplateSpace","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/CloudDatabase/CloudDatabase","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"云端数据","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/CloudDbDetail/CloudDbDetail","meta":{"titleNView":false,"bounce":"none","softinputMode":"adjustResize","navigationBar":{"titleText":"数据库详情","style":"custom","type":"default"},"isNVue":false}},{"path":"pages/text/text","meta":{"navigationBar":{"titleText":"","type":"default"},"isNVue":false}},{"path":"pages/text/IntuitiveAipptViewer","meta":{"navigationBar":{"titleText":"","type":"default"},"isNVue":false}},{"path":"pages/WYXD/WYXD","meta":{"titleNView":false,"bounce":"none","navigationBar":{"titleText":"","style":"custom","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
__uniConfig.styles=[];//styles __uniConfig.styles=[];//styles
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});

File diff suppressed because one or more lines are too long

View File

@@ -5,7 +5,7 @@
"iPad" "iPad"
], ],
"id": "__UNI__923FD9E", "id": "__UNI__923FD9E",
"name": "test1", "name": "宇恒一号",
"version": { "version": {
"name": "1.1.1", "name": "1.1.1",
"code": 2 "code": 2

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -2727,7 +2727,7 @@ if (uni.restoreGlobal) {
class: "new-chat-btn", class: "new-chat-btn",
onClick: $setup.goContactPages onClick: $setup.goContactPages
}, [ }, [
vue.createElementVNode("text", null, "+ 聊天列表") vue.createElementVNode("text", null, "+ 更多聊天列表")
]) ])
]), ]),
vue.createElementVNode("view", { class: "chat-history" }, [ vue.createElementVNode("view", { class: "chat-history" }, [
@@ -5639,7 +5639,7 @@ This will fail in production.`);
if (friendSocketStore.isConnected) if (friendSocketStore.isConnected)
return; return;
if (!userToken.value || !UserId.value) { if (!userToken.value || !UserId.value) {
formatAppLog("warn", "at pages/Chat/Chat.vue:345", "Token或UserId未准备好"); formatAppLog("warn", "at pages/Chat/Chat.vue:355", "Token或UserId未准备好");
return; return;
} }
friendSocketStore.connect({ friendSocketStore.connect({
@@ -5649,6 +5649,11 @@ This will fail in production.`);
}; };
const socketStore = useSocketStore(); const socketStore = useSocketStore();
const ChatType = vue.ref(0); const ChatType = vue.ref(0);
const wyxdWorkspaceId = vue.ref("");
const wyxdFilePath = vue.ref("");
const wyxdFileName = vue.ref("");
const wyxdUserToken = vue.ref("");
const hasWyxdFile = vue.ref(false);
const convertMarkdownTable = (text) => { const convertMarkdownTable = (text) => {
const lines = text.split("\n"); const lines = text.split("\n");
let result = []; let result = [];
@@ -5725,7 +5730,7 @@ This will fail in production.`);
); );
return html; return html;
} catch (e2) { } catch (e2) {
formatAppLog("error", "at pages/Chat/Chat.vue:471", "解析失败", e2); formatAppLog("error", "at pages/Chat/Chat.vue:488", "解析失败", e2);
return content; return content;
} }
}; };
@@ -5784,7 +5789,7 @@ This will fail in production.`);
files files
}; };
} catch (e2) { } catch (e2) {
formatAppLog("error", "at pages/Chat/Chat.vue:548", "解析文件信息失败:", e2); formatAppLog("error", "at pages/Chat/Chat.vue:565", "解析文件信息失败:", e2);
return { return {
textContent: content, textContent: content,
files: [] files: []
@@ -5822,7 +5827,7 @@ This will fail in production.`);
closeNewChatModal(); closeNewChatModal();
takeUserConversations(); takeUserConversations();
} catch (error) { } catch (error) {
formatAppLog("error", "at pages/Chat/Chat.vue:594", "新建普通会话失败:", error); formatAppLog("error", "at pages/Chat/Chat.vue:611", "新建普通会话失败:", error);
uni.showToast({ uni.showToast({
title: "创建会话失败,请重试", title: "创建会话失败,请重试",
icon: "none" icon: "none"
@@ -5845,6 +5850,11 @@ This will fail in production.`);
url: "/pages/WorkSpace/WorkSpace" url: "/pages/WorkSpace/WorkSpace"
}); });
}; };
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 = () => { const goCloudDatabase = () => {
if (currentSessionId.value) { if (currentSessionId.value) {
uni.setStorageSync("currentSessionId", currentSessionId.value); uni.setStorageSync("currentSessionId", currentSessionId.value);
@@ -5860,7 +5870,7 @@ This will fail in production.`);
}; };
const previewFileArray = vue.ref([]); const previewFileArray = vue.ref([]);
const uploadPhoto = () => { const uploadPhoto = () => {
formatAppLog("log", "at pages/Chat/Chat.vue:643", "点击了拍照上传"); formatAppLog("log", "at pages/Chat/Chat.vue:671", "点击了拍照上传");
uni.chooseImage({ uni.chooseImage({
count: 1, count: 1,
sourceType: ["camera", "album"], sourceType: ["camera", "album"],
@@ -5883,7 +5893,7 @@ This will fail in production.`);
}); });
}, },
fail: (err) => { fail: (err) => {
formatAppLog("error", "at pages/Chat/Chat.vue:661", "选择图片失败", err); formatAppLog("error", "at pages/Chat/Chat.vue:689", "选择图片失败", err);
} }
}); });
}; };
@@ -5892,12 +5902,12 @@ This will fail in production.`);
}; };
const fileList = vue.ref([]); const fileList = vue.ref([]);
const uploadFile = () => { const uploadFile = () => {
formatAppLog("log", "at pages/Chat/Chat.vue:672", "点击了上传文件"); formatAppLog("log", "at pages/Chat/Chat.vue:700", "点击了上传文件");
chooseFile({ chooseFile({
count: 5, count: 5,
type: "all", type: "all",
success: (res) => { success: (res) => {
formatAppLog("log", "at pages/Chat/Chat.vue:677", "成功了"); formatAppLog("log", "at pages/Chat/Chat.vue:705", "成功了");
fileList.value = res.tempFiles; fileList.value = res.tempFiles;
previewFileArray.value.push(...res.tempFiles); previewFileArray.value.push(...res.tempFiles);
uni.showToast({ uni.showToast({
@@ -5906,7 +5916,7 @@ This will fail in production.`);
}); });
}, },
fail: (err) => { fail: (err) => {
formatAppLog("error", "at pages/Chat/Chat.vue:688", "选择失败:", err); formatAppLog("error", "at pages/Chat/Chat.vue:716", "选择失败:", err);
uni.showToast({ uni.showToast({
title: "选择失败", title: "选择失败",
icon: "error" icon: "error"
@@ -6108,7 +6118,7 @@ This will fail in production.`);
previewFileArray.value = []; previewFileArray.value = [];
} catch (err) { } catch (err) {
uni.hideLoading(); uni.hideLoading();
formatAppLog("error", "at pages/Chat/Chat.vue:923", "文件上传失败:", err); formatAppLog("error", "at pages/Chat/Chat.vue:951", "文件上传失败:", err);
uni.showToast({ uni.showToast({
title: "文件上传失败,请重试", title: "文件上传失败,请重试",
icon: "error" icon: "error"
@@ -6242,15 +6252,15 @@ This will fail in production.`);
} }
}; };
const stopConversation = async () => { const stopConversation = async () => {
formatAppLog("log", "at pages/Chat/Chat.vue:1093", "中断对话 - 当前会话ID:", currentSessionId.value); formatAppLog("log", "at pages/Chat/Chat.vue:1121", "中断对话 - 当前会话ID:", currentSessionId.value);
try { try {
await socketStore.send({ await socketStore.send({
type: "stop", type: "stop",
conversation_id: currentSessionId.value conversation_id: currentSessionId.value
}); });
formatAppLog("log", "at pages/Chat/Chat.vue:1099", "中断指令已发送成功"); formatAppLog("log", "at pages/Chat/Chat.vue:1127", "中断指令已发送成功");
} catch (err) { } catch (err) {
formatAppLog("error", "at pages/Chat/Chat.vue:1101", "中断指令发送失败:", err); formatAppLog("error", "at pages/Chat/Chat.vue:1129", "中断指令发送失败:", err);
} }
if (streamingMessageId.value) { if (streamingMessageId.value) {
allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value); allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value);
@@ -6268,9 +6278,9 @@ This will fail in production.`);
}); });
}; };
vue.watch(() => socketStore.isThinking, (newVal, oldVal) => { vue.watch(() => socketStore.isThinking, (newVal, oldVal) => {
formatAppLog("log", "at pages/Chat/Chat.vue:1125", "isThinking 变化:", oldVal, "→", newVal, "messageString:", socketStore.messageString); formatAppLog("log", "at pages/Chat/Chat.vue:1153", "isThinking 变化:", oldVal, "→", newVal, "messageString:", socketStore.messageString);
if (!oldVal && newVal) { if (!oldVal && newVal) {
formatAppLog("log", "at pages/Chat/Chat.vue:1128", "AI开始回复跨设备同步锁定输入框"); formatAppLog("log", "at pages/Chat/Chat.vue:1156", "AI开始回复跨设备同步锁定输入框");
isThinking.value = true; isThinking.value = true;
if (!streamingMessageId.value) { if (!streamingMessageId.value) {
streamingMessageId.value = "streaming-" + Date.now(); streamingMessageId.value = "streaming-" + Date.now();
@@ -6284,7 +6294,7 @@ This will fail in production.`);
return; return;
} }
if (oldVal && !newVal) { if (oldVal && !newVal) {
formatAppLog("log", "at pages/Chat/Chat.vue:1144", "AI回复结束正常/中断),解锁并刷新消息列表"); formatAppLog("log", "at pages/Chat/Chat.vue:1172", "AI回复结束正常/中断),解锁并刷新消息列表");
if (streamingMessageId.value) { if (streamingMessageId.value) {
allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value); allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value);
streamingMessageId.value = null; streamingMessageId.value = null;
@@ -6336,15 +6346,15 @@ This will fail in production.`);
UserData.value = await getUserInfo(userToken.value); UserData.value = await getUserInfo(userToken.value);
UserId.value = UserData.value._id; UserId.value = UserData.value._id;
UserAvatar.value = UserData.value.avatar || ""; UserAvatar.value = UserData.value.avatar || "";
formatAppLog("log", "at pages/Chat/Chat.vue:1208", "用户信息已加载:", UserId.value, UserAvatar.value); formatAppLog("log", "at pages/Chat/Chat.vue:1236", "用户信息已加载:", UserId.value, UserAvatar.value);
} catch (error) { } catch (error) {
formatAppLog("error", "at pages/Chat/Chat.vue:1210", "获取用户信息失败:", error); formatAppLog("error", "at pages/Chat/Chat.vue:1238", "获取用户信息失败:", error);
} }
}; };
const takeUserConversations = async () => { const takeUserConversations = async () => {
try { try {
userToken.value = getToken(); userToken.value = getToken();
formatAppLog("log", "at pages/Chat/Chat.vue:1218", "token:", userToken.value); formatAppLog("log", "at pages/Chat/Chat.vue:1246", "token:", userToken.value);
UserConversations.value = await getUserConversations(userToken.value) || []; UserConversations.value = await getUserConversations(userToken.value) || [];
const savedSessionId = getCurrentSessionId(); const savedSessionId = getCurrentSessionId();
if (savedSessionId && UserConversations.value.some((c) => c._id === savedSessionId)) { if (savedSessionId && UserConversations.value.some((c) => c._id === savedSessionId)) {
@@ -6354,7 +6364,7 @@ This will fail in production.`);
} else { } else {
currentSessionId.value = ""; currentSessionId.value = "";
} }
formatAppLog("log", "at pages/Chat/Chat.vue:1230", "保存会话id", currentSessionId.value); formatAppLog("log", "at pages/Chat/Chat.vue:1258", "保存会话id", currentSessionId.value);
uni.setStorageSync("currentSessionId", currentSessionId.value); uni.setStorageSync("currentSessionId", currentSessionId.value);
} catch (error) { } catch (error) {
uni.showToast({ uni.showToast({
@@ -6366,17 +6376,17 @@ This will fail in production.`);
const FriendInfoList = vue.ref([]); const FriendInfoList = vue.ref([]);
const takeFriendList = async () => { const takeFriendList = async () => {
try { try {
formatAppLog("log", "at pages/Chat/Chat.vue:1245", "开始获取好友列表"); formatAppLog("log", "at pages/Chat/Chat.vue:1273", "开始获取好友列表");
const friendList = await getChatFriend(UserId.value); const friendList = await getChatFriend(UserId.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1248", "friendList:", friendList); formatAppLog("log", "at pages/Chat/Chat.vue:1276", "friendList:", friendList);
if (friendList && friendList.length) { if (friendList && friendList.length) {
FriendInfoList.value = await takeUserAvatar(friendList); FriendInfoList.value = await takeUserAvatar(friendList);
} else { } else {
FriendInfoList.value = []; FriendInfoList.value = [];
formatAppLog("log", "at pages/Chat/Chat.vue:1253", "好友列表为空"); formatAppLog("log", "at pages/Chat/Chat.vue:1281", "好友列表为空");
} }
} catch (error) { } catch (error) {
formatAppLog("error", "at pages/Chat/Chat.vue:1256", "获取好友列表失败:", error); formatAppLog("error", "at pages/Chat/Chat.vue:1284", "获取好友列表失败:", error);
FriendInfoList.value = []; FriendInfoList.value = [];
} finally { } finally {
UserConversations.value = FriendInfoList.value; UserConversations.value = FriendInfoList.value;
@@ -6403,17 +6413,17 @@ This will fail in production.`);
}; };
}); });
} catch (err) { } catch (err) {
formatAppLog("error", "at pages/Chat/Chat.vue:1286", "获取好友头像失败", err); formatAppLog("error", "at pages/Chat/Chat.vue:1314", "获取好友头像失败", err);
return friendList; return friendList;
} }
}; };
const GroupList = vue.ref([]); const GroupList = vue.ref([]);
const takeGroupList = async () => { const takeGroupList = async () => {
try { try {
formatAppLog("log", "at pages/Chat/Chat.vue:1296", "开始获取群聊列表"); formatAppLog("log", "at pages/Chat/Chat.vue:1324", "开始获取群聊列表");
GroupList.value = await getGroup(UserId.value); GroupList.value = await getGroup(UserId.value);
} catch (error) { } catch (error) {
formatAppLog("error", "at pages/Chat/Chat.vue:1301", "获取群聊列表失败:", error); formatAppLog("error", "at pages/Chat/Chat.vue:1329", "获取群聊列表失败:", error);
GroupList.value = []; GroupList.value = [];
} finally { } finally {
UserConversations.value = GroupList.value; UserConversations.value = GroupList.value;
@@ -6425,22 +6435,22 @@ This will fail in production.`);
return []; return [];
try { try {
const memberIds = memberList.map((item) => item.groupContactId); const memberIds = memberList.map((item) => item.groupContactId);
formatAppLog("log", "at pages/Chat/Chat.vue:1315", "请求头像的ID列表:", memberIds); formatAppLog("log", "at pages/Chat/Chat.vue:1343", "请求头像的ID列表:", memberIds);
const memberAvatarList = await getUserAvatar(userToken.value, memberIds); const memberAvatarList = await getUserAvatar(userToken.value, memberIds);
formatAppLog("log", "at pages/Chat/Chat.vue:1317", "头像接口返回数据:", memberAvatarList); formatAppLog("log", "at pages/Chat/Chat.vue:1345", "头像接口返回数据:", memberAvatarList);
const userMap = new Map(memberAvatarList.map((user) => [user.user_id, user]) || []); const userMap = new Map(memberAvatarList.map((user) => [user.user_id, user]) || []);
formatAppLog("log", "at pages/Chat/Chat.vue:1320", "userMap的keys:", Array.from(userMap.keys())); formatAppLog("log", "at pages/Chat/Chat.vue:1348", "userMap的keys:", Array.from(userMap.keys()));
return memberList.map((member) => { return memberList.map((member) => {
const memberId = member.groupContactId; const memberId = member.groupContactId;
const userInfo = userMap.get(memberId); const userInfo = userMap.get(memberId);
formatAppLog("log", "at pages/Chat/Chat.vue:1325", `查找 ${memberId} 的头像:`, userInfo); formatAppLog("log", "at pages/Chat/Chat.vue:1353", `查找 ${memberId} 的头像:`, userInfo);
return { return {
...member, ...member,
avatar: (userInfo == null ? void 0 : userInfo.avatar) || null avatar: (userInfo == null ? void 0 : userInfo.avatar) || null
}; };
}); });
} catch (err) { } catch (err) {
formatAppLog("error", "at pages/Chat/Chat.vue:1332", "获取群成员头像失败", err); formatAppLog("error", "at pages/Chat/Chat.vue:1360", "获取群成员头像失败", err);
return memberList; return memberList;
} }
}; };
@@ -6487,12 +6497,12 @@ This will fail in production.`);
const takeGroupMessages = async () => { const takeGroupMessages = async () => {
try { try {
allmessages.value = await getGroupMessages(currentSessionId.value) || []; allmessages.value = await getGroupMessages(currentSessionId.value) || [];
formatAppLog("log", "at pages/Chat/Chat.vue:1396", "群聊消息:", allmessages.value); formatAppLog("log", "at pages/Chat/Chat.vue:1424", "群聊消息:", allmessages.value);
const memberList = await getGroupMemberList(currentSessionId.value); const memberList = await getGroupMemberList(currentSessionId.value);
formatAppLog("log", "at pages/Chat/Chat.vue:1399", "获取到的群成员列表:", memberList); formatAppLog("log", "at pages/Chat/Chat.vue:1427", "获取到的群成员列表:", memberList);
if (memberList && memberList.length) { if (memberList && memberList.length) {
groupMemberList.value = await takeGroupMemberAvatar(memberList); groupMemberList.value = await takeGroupMemberAvatar(memberList);
formatAppLog("log", "at pages/Chat/Chat.vue:1402", "群成员列表(带头像):", groupMemberList.value); formatAppLog("log", "at pages/Chat/Chat.vue:1430", "群成员列表(带头像):", groupMemberList.value);
} else { } else {
groupMemberList.value = []; groupMemberList.value = [];
} }
@@ -6516,9 +6526,9 @@ This will fail in production.`);
} }
}; };
vue.watch(() => friendSocketStore.MessageReceived, (newId) => { vue.watch(() => friendSocketStore.MessageReceived, (newId) => {
formatAppLog("log", "at pages/Chat/Chat.vue:1449", "收到了好友消息"); formatAppLog("log", "at pages/Chat/Chat.vue:1477", "收到了好友消息");
if (newId) { if (newId) {
formatAppLog("log", "at pages/Chat/Chat.vue:1451", "ChatType:", ChatType.value); formatAppLog("log", "at pages/Chat/Chat.vue:1479", "ChatType:", ChatType.value);
switch (ChatType.value) { switch (ChatType.value) {
case 0: case 0:
takeConversationMessages(); takeConversationMessages();
@@ -6533,7 +6543,7 @@ This will fail in production.`);
friendSocketStore.MessageReceived = false; friendSocketStore.MessageReceived = false;
break; break;
default: default:
formatAppLog("log", "at pages/Chat/Chat.vue:1467", "default 分支"); formatAppLog("log", "at pages/Chat/Chat.vue:1495", "default 分支");
friendSocketStore.MessageReceived = false; friendSocketStore.MessageReceived = false;
break; break;
} }
@@ -6547,6 +6557,7 @@ This will fail in production.`);
if (oldId && oldId !== newId) { if (oldId && oldId !== newId) {
isLoadingMessages.value = true; isLoadingMessages.value = true;
allmessages.value = []; allmessages.value = [];
hasWyxdFile.value = false;
} }
switch (ChatType.value) { switch (ChatType.value) {
case 0: case 0:
@@ -6568,6 +6579,15 @@ This will fail in production.`);
}, { }, {
immediate: true immediate: true
}); });
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;
}
});
vue.onMounted(() => { vue.onMounted(() => {
}); });
onShow(async () => { onShow(async () => {
@@ -6602,11 +6622,13 @@ This will fail in production.`);
onUnload(() => { onUnload(() => {
socketStore.disconnect(); socketStore.disconnect();
}); });
const __returned__ = { friendSocketStore, handleFriendConnect, socketStore, ChatType, convertMarkdownTable, renderTable, escapeLoneUnderscores, pareseMarkdown, sanitizeContent, previewImage, openFile, formatFileSize, parseFileInfo, selectNormalChat, showNewChatModal, closeNewChatModal, isChatSidebar, handleChatSidebar, goWorkSpace, goCloudDatabase, logOut, previewFileArray, uploadPhoto, deleteImage, fileList, uploadFile, handleConnect, isThinking, isSelfSent, isUploading, isLoadingMessages, uploadedFiles, streamingMessageId, showMessageModal, detailLinks, handleChatContentClick, extractLinks, extractFileNameFromUrl, showMessageDetail, closeMessageDetail, downloadToast, get downloadToastTimer() { const __returned__ = { friendSocketStore, handleFriendConnect, socketStore, ChatType, wyxdWorkspaceId, wyxdFilePath, wyxdFileName, wyxdUserToken, hasWyxdFile, convertMarkdownTable, renderTable, escapeLoneUnderscores, pareseMarkdown, sanitizeContent, previewImage, openFile, formatFileSize, parseFileInfo, selectNormalChat, showNewChatModal, closeNewChatModal, isChatSidebar, handleChatSidebar, goWorkSpace, goWyxdViewer, goCloudDatabase, logOut, previewFileArray, uploadPhoto, deleteImage, fileList, uploadFile, handleConnect, isThinking, isSelfSent, isUploading, isLoadingMessages, uploadedFiles, streamingMessageId, showMessageModal, detailLinks, handleChatContentClick, extractLinks, extractFileNameFromUrl, showMessageDetail, closeMessageDetail, downloadToast, get downloadToastTimer() {
return downloadToastTimer; return downloadToastTimer;
}, set downloadToastTimer(v) { }, set downloadToastTimer(v) {
downloadToastTimer = v; downloadToastTimer = v;
}, showDownloadToast, hideDownloadToast, openLink, downloadAndHandle, sendMessage, sendFriendMessage, sendGroupMessage, sendAIMessage, stopConversation, textMessage, UserConversations, currentSessionId, userToken, UserId, UserAvatar, UserData, takeUserInfo, takeUserConversations, FriendInfoList, takeFriendList, takeTalkUserAvatar, takeUserAvatar, GroupList, takeGroupList, groupMemberList, takeGroupMemberAvatar, getGroupMemberAvatarById, allmessages, scrollToView, bottomToggle, isLoadingMore, currentPage, currentMessages, takeConversationMessages, takeFriendMessages, takeGroupMessages, onScroll, scrollToBottom, computed: vue.computed, getCurrentInstance: vue.getCurrentInstance, nextTick: vue.nextTick, onMounted: vue.onMounted, ref: vue.ref, watch: vue.watch, get onShow() { }, showDownloadToast, hideDownloadToast, openLink, downloadAndHandle, sendMessage, sendFriendMessage, sendGroupMessage, sendAIMessage, stopConversation, textMessage, UserConversations, currentSessionId, userToken, UserId, UserAvatar, UserData, takeUserInfo, takeUserConversations, FriendInfoList, takeFriendList, takeTalkUserAvatar, takeUserAvatar, GroupList, takeGroupList, groupMemberList, takeGroupMemberAvatar, getGroupMemberAvatarById, allmessages, scrollToView, bottomToggle, isLoadingMore, currentPage, currentMessages, takeConversationMessages, takeFriendMessages, takeGroupMessages, onScroll, scrollToBottom, computed: vue.computed, getCurrentInstance: vue.getCurrentInstance, nextTick: vue.nextTick, onMounted: vue.onMounted, ref: vue.ref, watch: vue.watch, get onLoad() {
return onLoad;
}, get onShow() {
return onShow; return onShow;
}, get onUnload() { }, get onUnload() {
return onUnload; return onUnload;
@@ -6790,6 +6812,30 @@ This will fail in production.`);
]) ])
]) ])
]), ]),
$setup.hasWyxdFile ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "wyxd-banner"
}, [
vue.createElementVNode("view", { class: "wyxd-banner-icon iconfont icon-wenjian" }),
vue.createElementVNode(
"view",
{
class: "wyxd-banner-text",
onClick: $setup.goWyxdViewer
},
"查看: " + vue.toDisplayString($setup.wyxdFileName),
1
/* TEXT */
),
vue.createElementVNode("view", {
class: "wyxd-banner-arrow",
onClick: $setup.goWyxdViewer
}, ""),
vue.createElementVNode("view", {
class: "wyxd-banner-close",
onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => $setup.hasWyxdFile = false, ["stop"]))
}, "×")
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "main-chat" }, [ vue.createElementVNode("view", { class: "main-chat" }, [
vue.createElementVNode("scroll-view", { vue.createElementVNode("scroll-view", {
class: "chat-messages", class: "chat-messages",
@@ -7125,7 +7171,7 @@ This will fail in production.`);
"view", "view",
{ {
class: vue.normalizeClass(["chat-interactive-btn", { disabled: $setup.isThinking }]), class: vue.normalizeClass(["chat-interactive-btn", { disabled: $setup.isThinking }]),
onClick: _cache[5] || (_cache[5] = ($event) => !$setup.isThinking && $setup.uploadPhoto()) onClick: _cache[6] || (_cache[6] = ($event) => !$setup.isThinking && $setup.uploadPhoto())
}, },
"拍照上传", "拍照上传",
2 2
@@ -7135,7 +7181,7 @@ This will fail in production.`);
"view", "view",
{ {
class: vue.normalizeClass(["chat-interactive-btn", { disabled: $setup.isThinking }]), class: vue.normalizeClass(["chat-interactive-btn", { disabled: $setup.isThinking }]),
onClick: _cache[6] || (_cache[6] = ($event) => !$setup.isThinking && $setup.uploadFile()) onClick: _cache[7] || (_cache[7] = ($event) => !$setup.isThinking && $setup.uploadFile())
}, },
"上传文件", "上传文件",
2 2
@@ -7183,7 +7229,7 @@ This will fail in production.`);
class: "message-input", class: "message-input",
placeholder: $setup.isThinking ? $setup.isSelfSent ? "AI 正在回复中..." : "电脑正在运行,请稍后" : "输入消息...", placeholder: $setup.isThinking ? $setup.isSelfSent ? "AI 正在回复中..." : "电脑正在运行,请稍后" : "输入消息...",
disabled: $setup.isThinking, disabled: $setup.isThinking,
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $setup.textMessage = $event), "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $setup.textMessage = $event),
"auto-height": "" "auto-height": ""
}, null, 8, ["placeholder", "disabled"]), [ }, null, 8, ["placeholder", "disabled"]), [
[vue.vModelText, $setup.textMessage] [vue.vModelText, $setup.textMessage]
@@ -7197,7 +7243,7 @@ This will fail in production.`);
])) : (vue.openBlock(), vue.createElementBlock("view", { ])) : (vue.openBlock(), vue.createElementBlock("view", {
key: 1, key: 1,
class: "input-btn-group send-message-btn", class: "input-btn-group send-message-btn",
onClick: _cache[8] || (_cache[8] = ($event) => $setup.sendMessage()) onClick: _cache[9] || (_cache[9] = ($event) => $setup.sendMessage())
}, [ }, [
vue.createElementVNode("view", { class: "iconfont icon-fasong" }) vue.createElementVNode("view", { class: "iconfont icon-fasong" })
])) ]))
@@ -7219,7 +7265,7 @@ This will fail in production.`);
}, [ }, [
vue.createElementVNode("view", { vue.createElementVNode("view", {
class: "ncd-card message-detail-card", class: "ncd-card message-detail-card",
onClick: _cache[9] || (_cache[9] = vue.withModifiers(() => { onClick: _cache[10] || (_cache[10] = vue.withModifiers(() => {
}, ["stop"])) }, ["stop"]))
}, [ }, [
vue.createElementVNode("view", { class: "ncd-header" }, [ vue.createElementVNode("view", { class: "ncd-header" }, [
@@ -7465,21 +7511,34 @@ This will fail in production.`);
if (isSelectFolder.value) if (isSelectFolder.value)
return; return;
const isWyxd = folder.name && folder.name.toLowerCase().endsWith(".wyxd"); const isWyxd = folder.name && folder.name.toLowerCase().endsWith(".wyxd");
const itemList = isWyxd ? ["下载", "删除", "WYXD查看器"] : ["下载", "删除"]; const itemList = isWyxd ? ["下载", "AI修改", "删除", "WYXD查看器"] : ["下载", "删除"];
uni.showActionSheet({ uni.showActionSheet({
itemList, itemList,
success: (res) => { success: (res) => {
switch (res.tapIndex) { if (isWyxd) {
case 0: switch (res.tapIndex) {
handleDownload(folder); case 0:
break; handleDownload(folder);
case 1: break;
handleDelete(folder); case 1:
break; handleAiModify(folder);
case 2: break;
if (isWyxd) case 2:
handleDelete(folder);
break;
case 3:
openWyxdViewer(folder); openWyxdViewer(folder);
break; break;
}
} else {
switch (res.tapIndex) {
case 0:
handleDownload(folder);
break;
case 1:
handleDelete(folder);
break;
}
} }
} }
}); });
@@ -7511,7 +7570,7 @@ This will fail in production.`);
initCurrentFolderList(); initCurrentFolderList();
} catch (error) { } catch (error) {
uni.hideLoading(); uni.hideLoading();
formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:338", "重命名失败:", error); formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:352", "重命名失败:", error);
uni.showToast({ uni.showToast({
title: typeof error === "string" ? error : "重命名失败,请重试", title: typeof error === "string" ? error : "重命名失败,请重试",
icon: "error" icon: "error"
@@ -7556,7 +7615,7 @@ This will fail in production.`);
uni.hideLoading(); uni.hideLoading();
if (downloadRes.statusCode === 200) { if (downloadRes.statusCode === 200) {
const tempPath = downloadRes.tempFilePath; const tempPath = downloadRes.tempFilePath;
formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:395", "// 下载成功,文件下载路径为:", tempPath); formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:409", "// 下载成功,文件下载路径为:", tempPath);
openFile(tempPath); openFile(tempPath);
} else { } else {
uni.showToast({ uni.showToast({
@@ -7567,7 +7626,7 @@ This will fail in production.`);
}, },
fail: (err) => { fail: (err) => {
uni.hideLoading(); uni.hideLoading();
formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:406", "下载文件失败:", err); formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:420", "下载文件失败:", err);
uni.showToast({ uni.showToast({
title: "下载失败,请重试", title: "下载失败,请重试",
icon: "error" icon: "error"
@@ -7576,7 +7635,7 @@ This will fail in production.`);
}); });
} catch (error) { } catch (error) {
uni.hideLoading(); uni.hideLoading();
formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:415", "获取下载链接失败:", error); formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:429", "获取下载链接失败:", error);
uni.showToast({ uni.showToast({
title: "获取下载链接失败,请重试", title: "获取下载链接失败,请重试",
icon: "error" icon: "error"
@@ -7591,7 +7650,7 @@ This will fail in production.`);
icon: "success" icon: "success"
}), }),
fail: (err) => { fail: (err) => {
formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:432", "打开文件失败:", err); formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:446", "打开文件失败:", err);
uni.showToast({ uni.showToast({
title: "无法打开此文件", title: "无法打开此文件",
icon: "error" icon: "error"
@@ -7608,7 +7667,7 @@ This will fail in production.`);
icon: "success" icon: "success"
}), }),
fail: (err) => { fail: (err) => {
formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:451", "打开文件失败:", err); formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:465", "打开文件失败:", err);
uni.showToast({ uni.showToast({
title: "无法打开此文件", title: "无法打开此文件",
icon: "error" icon: "error"
@@ -7618,14 +7677,20 @@ This will fail in production.`);
}; };
const openWyxdViewer = (folder) => { const openWyxdViewer = (folder) => {
const filePath = folder.path.startsWith("./") ? folder.path.slice(2) : folder.path; const filePath = folder.path.startsWith("./") ? folder.path.slice(2) : folder.path;
formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:463", "解析文件路径:", filePath); formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:477", "解析文件路径:", filePath);
formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:464", "folder", folder); formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:478", "folder", folder);
formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:465", "encode", encodeURIComponent(filePath)); formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:479", "encode", encodeURIComponent(filePath));
formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:466", "encode", encodeURIComponent(folder.name)); formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:480", "encode", encodeURIComponent(folder.name));
uni.navigateTo({ uni.navigateTo({
url: "/pages/WYXD/WYXD?workspaceId=" + encodeURIComponent(workspaceId.value) + "&filePath=" + encodeURIComponent(filePath) + "&fileName=" + encodeURIComponent(folder.name) + "&userToken=" + encodeURIComponent(UserToken.value) url: "/pages/WYXD/WYXD?workspaceId=" + encodeURIComponent(workspaceId.value) + "&filePath=" + encodeURIComponent(filePath) + "&fileName=" + encodeURIComponent(folder.name) + "&userToken=" + encodeURIComponent(UserToken.value)
}); });
}; };
const handleAiModify = (folder) => {
const filePath = folder.path.startsWith("./") ? folder.path.slice(2) : folder.path;
uni.navigateTo({
url: "/pages/Chat/Chat?wyxdWorkspaceId=" + encodeURIComponent(workspaceId.value) + "&wyxdFilePath=" + encodeURIComponent(filePath) + "&wyxdFileName=" + encodeURIComponent(folder.name) + "&wyxdUserToken=" + encodeURIComponent(UserToken.value)
});
};
const handleDelete = (folder) => { const handleDelete = (folder) => {
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
@@ -7634,7 +7699,7 @@ This will fail in production.`);
if (res.confirm) { if (res.confirm) {
try { try {
const filePath = `./${folder.path}`; const filePath = `./${folder.path}`;
formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:485", "删除的是:", filePath); formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:510", "删除的是:", filePath);
await daleteWorkspace(UserToken.value, workspaceId.value, filePath); await daleteWorkspace(UserToken.value, workspaceId.value, filePath);
uni.showToast({ uni.showToast({
title: "删除成功", title: "删除成功",
@@ -7642,7 +7707,7 @@ This will fail in production.`);
}); });
initCurrentFolderList(); initCurrentFolderList();
} catch (error) { } catch (error) {
formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:493", "删除失败:", error); formatAppLog("error", "at pages/WorkSpace/WorkSpace.vue:518", "删除失败:", error);
uni.showToast({ uni.showToast({
title: "删除失败,请重试", title: "删除失败,请重试",
icon: "error" icon: "error"
@@ -7710,7 +7775,7 @@ This will fail in production.`);
const currentFolderList = vue.ref([]); const currentFolderList = vue.ref([]);
const getCurrentFolderList = () => { const getCurrentFolderList = () => {
var _a, _b; var _a, _b;
formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:574", "当前路径为:", JSON.stringify(folderStack.value)); formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:599", "当前路径为:", JSON.stringify(folderStack.value));
const currentPath = folderStack.value.length > 0 ? folderStack.value[folderStack.value.length - 1].path : "."; const currentPath = folderStack.value.length > 0 ? folderStack.value[folderStack.value.length - 1].path : ".";
if (currentPath === ".") { if (currentPath === ".") {
return ((_a = allFoldersData.value) == null ? void 0 : _a.children) || []; return ((_a = allFoldersData.value) == null ? void 0 : _a.children) || [];
@@ -7734,7 +7799,7 @@ This will fail in production.`);
const initCurrentFolderList = async () => { const initCurrentFolderList = async () => {
workspaceId.value = getWorkspaceId(); workspaceId.value = getWorkspaceId();
UserToken.value = getToken(); UserToken.value = getToken();
formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:601", "getWorkspaceId:", workspaceId.value); formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:626", "getWorkspaceId:", workspaceId.value);
allFoldersData.value = await getWorkspaceList(UserToken.value, workspaceId.value); allFoldersData.value = await getWorkspaceList(UserToken.value, workspaceId.value);
currentFolderList.value = getCurrentFolderList(); currentFolderList.value = getCurrentFolderList();
}; };
@@ -7781,7 +7846,7 @@ This will fail in production.`);
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1,
fail() { fail() {
formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:661", "返回失败,进入兜底跳转"); formatAppLog("log", "at pages/WorkSpace/WorkSpace.vue:686", "返回失败,进入兜底跳转");
uni.reLaunch({ uni.reLaunch({
url: "/pages/Chat/Chat" url: "/pages/Chat/Chat"
}); });
@@ -7792,7 +7857,7 @@ This will fail in production.`);
vue.onMounted(() => { vue.onMounted(() => {
initCurrentFolderList(); initCurrentFolderList();
}); });
const __returned__ = { UserToken, workspaceId, navbarBeforeTitle, navbarTitle, isSelectFolder, selectFileList, handleSelectFolder, selectFolder, showNewFolder, isNFNFocused, newFolderName, closeNewFolderModal, newWorkspaceFolder, handleUploadFile, doUploadWorkspaceFiles, currentFolderPath, folderPathPreview, confirmCreateFolder, handleLongPress, handleRename, handleDownload, openFile, openFileWithMenu, openWyxdViewer, handleDelete, isMenuOpen, handleMenu, searchKeyword, isSearchFocus, handleSearchFocus, getFileIcon, allFoldersData, folderStack, currentFolderList, getCurrentFolderList, initCurrentFolderList, handleFolderClick, handleSelectAll, handleBackOrCheck, onMounted: vue.onMounted, ref: vue.ref, computed: vue.computed, get getWorkspaceId() { const __returned__ = { UserToken, workspaceId, navbarBeforeTitle, navbarTitle, isSelectFolder, selectFileList, handleSelectFolder, selectFolder, showNewFolder, isNFNFocused, newFolderName, closeNewFolderModal, newWorkspaceFolder, handleUploadFile, doUploadWorkspaceFiles, currentFolderPath, folderPathPreview, confirmCreateFolder, handleLongPress, handleRename, handleDownload, openFile, openFileWithMenu, openWyxdViewer, handleAiModify, handleDelete, isMenuOpen, handleMenu, searchKeyword, isSearchFocus, handleSearchFocus, getFileIcon, allFoldersData, folderStack, currentFolderList, getCurrentFolderList, initCurrentFolderList, handleFolderClick, handleSelectAll, handleBackOrCheck, onMounted: vue.onMounted, ref: vue.ref, computed: vue.computed, get getWorkspaceId() {
return getWorkspaceId; return getWorkspaceId;
}, get getToken() { }, get getToken() {
return getToken; return getToken;
@@ -18117,7 +18182,7 @@ This will fail in production.`);
fileName: fileName.value, fileName: fileName.value,
userToken: userToken.value userToken: userToken.value
}); });
if (isWyxdCached(workspaceId.value, filePath.value)) { if (options.forceDownload !== "1" && isWyxdCached(workspaceId.value, filePath.value)) {
loadFromCache(); loadFromCache();
} else { } else {
startDownload(); startDownload();

View File

@@ -1006,10 +1006,12 @@ to { opacity: 1; transform: translateY(0) scale(1);
font-size: 1.125rem; font-size: 1.125rem;
font-weight: 700; font-weight: 700;
color: #1a1a2e; color: #1a1a2e;
align-items: center;
} }
.ncd-header uni-icons[data-v-5eb7b895] { .ncd-header uni-icons[data-v-5eb7b895] {
display: flex; display: flex;
flex-shrink: 0; flex-shrink: 0;
align-items: center;
} }
.ncd-options[data-v-5eb7b895] { .ncd-options[data-v-5eb7b895] {
display: flex; display: flex;
@@ -1192,6 +1194,55 @@ to { opacity: 1; transform: translateY(0) scale(1);
.log-out .iconfont[data-v-5eb7b895] { .log-out .iconfont[data-v-5eb7b895] {
color: #ff4d4f; color: #ff4d4f;
} }
/* ==========WYXD 文件入口横幅========== */
.wyxd-banner[data-v-5eb7b895] {
display: flex;
align-items: center;
padding: 0.4375rem 0.75rem;
margin: 0.1875rem 0.625rem;
background: linear-gradient(135deg, #e8f4fd, #f0e6ff);
border: 0.04688rem solid rgba(120, 120, 220, 0.25);
border-radius: 0.5rem;
box-shadow: 0 0.0625rem 0.25rem rgba(100, 100, 200, 0.08);
}
.wyxd-banner[data-v-5eb7b895]:active {
background: linear-gradient(135deg, #d8eafb, #e6d8ff);
transform: scale(0.98);
}
.wyxd-banner-icon[data-v-5eb7b895] {
font-size: 1rem;
color: #6c6ce0;
margin-right: 0.375rem;
}
.wyxd-banner-text[data-v-5eb7b895] {
flex: 1;
font-size: 0.8125rem;
font-weight: 600;
color: #4a4ab8;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.wyxd-banner-arrow[data-v-5eb7b895] {
font-size: 0.75rem;
color: #9999cc;
}
.wyxd-banner-close[data-v-5eb7b895] {
width: 1.125rem;
height: 1.125rem;
line-height: 1.125rem;
text-align: center;
font-size: 0.875rem;
color: #9999cc;
border-radius: 50%;
background: rgba(100, 100, 200, 0.08);
margin-left: 0.25rem;
flex-shrink: 0;
}
.wyxd-banner-close[data-v-5eb7b895]:active {
background: rgba(100, 100, 200, 0.18);
color: #6c6ce0;
}
/* ==========聊天主体部分========== */ /* ==========聊天主体部分========== */
.main-chat[data-v-5eb7b895] { .main-chat[data-v-5eb7b895] {
display: flex; display: flex;

View File

@@ -1006,10 +1006,12 @@ to { opacity: 1; transform: translateY(0) scale(1);
font-size: 1.125rem; font-size: 1.125rem;
font-weight: 700; font-weight: 700;
color: #1a1a2e; color: #1a1a2e;
align-items: center;
} }
.ncd-header uni-icons[data-v-fdf84df1] { .ncd-header uni-icons[data-v-fdf84df1] {
display: flex; display: flex;
flex-shrink: 0; flex-shrink: 0;
align-items: center;
} }
.ncd-options[data-v-fdf84df1] { .ncd-options[data-v-fdf84df1] {
display: flex; display: flex;
@@ -1192,6 +1194,55 @@ to { opacity: 1; transform: translateY(0) scale(1);
.log-out .iconfont[data-v-fdf84df1] { .log-out .iconfont[data-v-fdf84df1] {
color: #ff4d4f; color: #ff4d4f;
} }
/* ==========WYXD 文件入口横幅========== */
.wyxd-banner[data-v-fdf84df1] {
display: flex;
align-items: center;
padding: 0.4375rem 0.75rem;
margin: 0.1875rem 0.625rem;
background: linear-gradient(135deg, #e8f4fd, #f0e6ff);
border: 0.04688rem solid rgba(120, 120, 220, 0.25);
border-radius: 0.5rem;
box-shadow: 0 0.0625rem 0.25rem rgba(100, 100, 200, 0.08);
}
.wyxd-banner[data-v-fdf84df1]:active {
background: linear-gradient(135deg, #d8eafb, #e6d8ff);
transform: scale(0.98);
}
.wyxd-banner-icon[data-v-fdf84df1] {
font-size: 1rem;
color: #6c6ce0;
margin-right: 0.375rem;
}
.wyxd-banner-text[data-v-fdf84df1] {
flex: 1;
font-size: 0.8125rem;
font-weight: 600;
color: #4a4ab8;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.wyxd-banner-arrow[data-v-fdf84df1] {
font-size: 0.75rem;
color: #9999cc;
}
.wyxd-banner-close[data-v-fdf84df1] {
width: 1.125rem;
height: 1.125rem;
line-height: 1.125rem;
text-align: center;
font-size: 0.875rem;
color: #9999cc;
border-radius: 50%;
background: rgba(100, 100, 200, 0.08);
margin-left: 0.25rem;
flex-shrink: 0;
}
.wyxd-banner-close[data-v-fdf84df1]:active {
background: rgba(100, 100, 200, 0.18);
color: #6c6ce0;
}
/* ==========聊天主体部分========== */ /* ==========聊天主体部分========== */
.main-chat[data-v-fdf84df1] { .main-chat[data-v-fdf84df1] {
display: flex; display: flex;