chore: 移除所有调试日志
This commit is contained in:
@@ -54,9 +54,8 @@ export default {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/config/agreement',
|
||||
data: data,
|
||||
success: res => {
|
||||
console.log(res.data.title)
|
||||
uni.setNavigationBarTitle({
|
||||
success: res => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.data.title
|
||||
})
|
||||
this.content = res.data.content
|
||||
|
||||
@@ -671,15 +671,7 @@ async loadChatHistoryIfExist() {
|
||||
return;
|
||||
}
|
||||
// 需要根据实际返回的 response.data.messages 来映射
|
||||
console.log('【调试】后端返回的历史消息数据:', response.messages);
|
||||
this.messages = response.messages.map(msg => {
|
||||
console.log('【调试】单条消息完整数据:', JSON.stringify(msg));
|
||||
console.log('【调试】单条消息时间字段:');
|
||||
console.log(' - created_at:', msg.created_at, typeof msg.created_at);
|
||||
console.log(' - create_time:', msg.create_time, typeof msg.create_time);
|
||||
console.log(' - time:', msg.time, typeof msg.time);
|
||||
console.log(' - Date.now():', Date.now());
|
||||
|
||||
let content = '';
|
||||
if (msg.role === 'user') {
|
||||
content = msg.query || (typeof msg.inputs === 'string' ? msg.inputs : JSON.stringify(msg.inputs || '')) || '';
|
||||
@@ -688,7 +680,6 @@ async loadChatHistoryIfExist() {
|
||||
}
|
||||
// 只使用后端返回的真实时间,不使用假时间
|
||||
const realTimestamp = msg.created_at || msg.create_time || msg.time;
|
||||
console.log('【调试】最终使用的时间戳:', realTimestamp);
|
||||
return {
|
||||
id: msg.message_id || (Date.now() + Math.random() * 10000),
|
||||
role: msg.role === 'user' ? 'user' : 'assistant',
|
||||
@@ -740,13 +731,11 @@ async loadChatHistoryIfExist() {
|
||||
|
||||
// 从相册选择头像
|
||||
chooseAvatarFromAlbum() {
|
||||
console.log('选择从相册选择头像')
|
||||
this.selectAvatar()
|
||||
},
|
||||
|
||||
// 统一头像选择方法 - 仅从相册选择
|
||||
selectAvatar() {
|
||||
console.log('开始选择头像')
|
||||
|
||||
// #ifdef H5
|
||||
// H5环境下的处理 - 仅从相册选择
|
||||
@@ -1259,11 +1248,9 @@ async loadChatHistoryIfExist() {
|
||||
offset: this.historyOffset // 改用独立偏移量
|
||||
});
|
||||
|
||||
if (response.success && Array.isArray(response.messages) && response.messages.length > 0) {
|
||||
console.log('【调试】加载更多历史消息数据:', response.messages);
|
||||
const historyMessages = response.messages.map(msg => {
|
||||
console.log('【调试】加载更多单条消息数据:', msg);
|
||||
// 只使用后端返回的真实时间,不使用假时间
|
||||
if (response.success && Array.isArray(response.messages) && response.messages.length > 0) {
|
||||
const historyMessages = response.messages.map(msg => {
|
||||
// 只使用后端返回的真实时间,不使用假时间
|
||||
const realTimestamp = msg.create_time || msg.created_at || msg.time;
|
||||
return {
|
||||
id: msg.id || `history-${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
||||
@@ -1370,7 +1357,6 @@ async loadChatHistoryIfExist() {
|
||||
navigator.mediaDevices.getUserMedia({ audio: true })
|
||||
.then(stream => {
|
||||
// 语音输入处理
|
||||
console.log('语音输入开始')
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('语音输入错误:', error)
|
||||
@@ -1480,7 +1466,6 @@ async loadChatHistoryIfExist() {
|
||||
if (width && height) {
|
||||
// 判断视频方向:宽度 >= 高度为横屏,否则为竖屏
|
||||
const videoRatio = width >= height ? 'landscape' : 'portrait';
|
||||
console.log(`AI聊天视频宽高比检测: ${width}x${height}, 比例: ${videoRatio}`);
|
||||
|
||||
// 动态设置视频样式
|
||||
// 这里可以添加逻辑来动态调整视频播放器的样式
|
||||
|
||||
@@ -183,7 +183,6 @@ export default {
|
||||
onShow() {
|
||||
// 监听键盘高度变化
|
||||
uni.onKeyboardHeightChange((res) => {
|
||||
console.log('键盘高度变化:', res.height);
|
||||
this.keyboardHeight = res.height;
|
||||
if (this.$refs.chat && this.$refs.chat.updateKeyboardHeight) {
|
||||
this.$refs.chat.updateKeyboardHeight(res.height);
|
||||
@@ -233,7 +232,6 @@ export default {
|
||||
|
||||
setupNavigationEvents() {
|
||||
uni.onWindowResize((res) => {
|
||||
console.log('窗口大小变化:', res.size);
|
||||
this.calculateScrollViewHeight();
|
||||
});
|
||||
},
|
||||
@@ -241,8 +239,6 @@ export default {
|
||||
// ========== 事件处理方法 ==========
|
||||
|
||||
async handleServiceRequest(event) {
|
||||
console.log('处理服务请求:', EventSafety.extractEventData(event));
|
||||
|
||||
if (event.matches('.service-component') ||
|
||||
event.detail?.componentType === 'service') {
|
||||
await this.processServiceRequest(event);
|
||||
@@ -250,12 +246,10 @@ export default {
|
||||
},
|
||||
|
||||
async handleNavigationRequest(event) {
|
||||
console.log('处理导航请求:', event.type);
|
||||
this.emitNavigationInfo(event);
|
||||
},
|
||||
|
||||
handleComponentInteraction(event) {
|
||||
console.log('处理组件交互:', event.detail);
|
||||
this.processComponentInteraction(event);
|
||||
},
|
||||
|
||||
@@ -271,16 +265,11 @@ export default {
|
||||
|
||||
// ========== 初始化页面 ==========
|
||||
initChat() {
|
||||
console.log('AI聊天页面初始化');
|
||||
|
||||
// 检查是否有从商品分类传递过来的商品信息
|
||||
const selectedProduct = uni.getStorageSync('selectedProduct')
|
||||
if (selectedProduct) {
|
||||
console.log('检测到选择的商品:', selectedProduct)
|
||||
|
||||
// 清除存储的商品信息,避免重复发送
|
||||
uni.removeStorageSync('selectedProduct')
|
||||
|
||||
// 延迟发送商品信息,确保聊天组件已经初始化
|
||||
setTimeout(() => {
|
||||
this.sendProductToAI(selectedProduct)
|
||||
@@ -329,7 +318,6 @@ export default {
|
||||
this. $off(eventType, handler);
|
||||
});
|
||||
this.safeEventHandlers.clear();
|
||||
console.log('组件清理完成');
|
||||
},
|
||||
|
||||
showError(message) {
|
||||
@@ -443,11 +431,9 @@ export default {
|
||||
},
|
||||
|
||||
onMessageSent(message) {
|
||||
console.log('用户发送消息:', message);
|
||||
},
|
||||
|
||||
onAIResponse(message) {
|
||||
console.log('AI回复消息:', message);
|
||||
},
|
||||
|
||||
generateAIResponse(userMessage) {
|
||||
@@ -489,7 +475,6 @@ export default {
|
||||
},
|
||||
|
||||
onHistoryLoaded(messages) {
|
||||
console.log('历史消息加载完成:', messages.length);
|
||||
},
|
||||
|
||||
onFilePreview(message) {
|
||||
@@ -497,19 +482,15 @@ export default {
|
||||
},
|
||||
|
||||
onAudioPlay(message) {
|
||||
console.log('音频播放:', message);
|
||||
},
|
||||
|
||||
onAudioPause(message) {
|
||||
console.log('音频暂停:', message);
|
||||
},
|
||||
|
||||
onVideoPlay(message) {
|
||||
console.log('视频播放:', message);
|
||||
},
|
||||
|
||||
onVideoPause(message) {
|
||||
console.log('视频暂停:', message);
|
||||
},
|
||||
|
||||
sendProductToAI(product) {
|
||||
@@ -520,8 +501,6 @@ export default {
|
||||
|
||||
const productContent = `我想了解以下商品的详细信息:\n商品名称:${product.goods_name}\n价格:¥${product.price}\n商品ID:${product.goods_id}`
|
||||
|
||||
console.log('商品信息已发送到AI客服:', productContent)
|
||||
|
||||
// 使用sendMessageWithContent方法发送商品信息
|
||||
this.$refs.chat.sendMessageWithContent(productContent)
|
||||
},
|
||||
@@ -548,7 +527,6 @@ export default {
|
||||
},
|
||||
|
||||
onInputChange(value) {
|
||||
console.log('输入内容:', value);
|
||||
},
|
||||
|
||||
// ✅ 新增:权限校验(核心修复)
|
||||
|
||||
@@ -130,12 +130,10 @@ export default {
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
toDetail(item) {
|
||||
console.log(item.files_url);
|
||||
const url = item.files_url;
|
||||
uni.showLoading({ title: "正在加载" });
|
||||
try {
|
||||
@@ -147,7 +145,6 @@ export default {
|
||||
uni.openDocument({
|
||||
filePath: filePath,
|
||||
success: () => {
|
||||
console.log("打开成功");
|
||||
},
|
||||
fail: () => {
|
||||
},
|
||||
@@ -161,14 +158,12 @@ export default {
|
||||
uni.hideLoading();
|
||||
},
|
||||
complete: (res) => {
|
||||
console.log("下载完成", res);
|
||||
if (res.statusCode === 404) {
|
||||
uni.showToast({ title: "文件不存在", icon: "none" });
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.log("CatchClause", e);
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
@@ -196,7 +191,6 @@ export default {
|
||||
uni.openDocument({
|
||||
filePath: filePath,
|
||||
success: () => {
|
||||
console.log("打开成功");
|
||||
},
|
||||
fail: () => {
|
||||
},
|
||||
@@ -210,14 +204,12 @@ export default {
|
||||
uni.hideLoading();
|
||||
},
|
||||
complete: (res) => {
|
||||
console.log("下载完成", res);
|
||||
if (res.statusCode === 404) {
|
||||
uni.showToast({ title: "文件不存在", icon: "none" });
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.log("CatchClause", e);
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
@@ -249,7 +241,6 @@ export default {
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.log("CatchClause", e);
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
@@ -265,12 +256,10 @@ export default {
|
||||
this.$util.showToast({ title: res.message });
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
change(e) {
|
||||
console.log(e);
|
||||
this.ismessage = e.show ? 1 : 0;
|
||||
},
|
||||
tapMessage() {
|
||||
@@ -285,7 +274,6 @@ export default {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phone + "",
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -293,11 +281,9 @@ export default {
|
||||
uni.setClipboardData({
|
||||
data: text,
|
||||
success: () => {
|
||||
console.log("复制成功");
|
||||
uni.showToast({ title: "复制成功", icon: "success", duration: 2000 });
|
||||
},
|
||||
fail: () => {
|
||||
console.log("复制失败");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -110,7 +110,6 @@ export default {
|
||||
})
|
||||
},
|
||||
toDetail(item) {
|
||||
console.log(item.files_url)
|
||||
uni.showLoading({
|
||||
title: '正在加载'
|
||||
})
|
||||
@@ -118,12 +117,10 @@ export default {
|
||||
uni.downloadFile({
|
||||
url: item.files_url,
|
||||
success: res => {
|
||||
console.log(res)
|
||||
if (res.statusCode === 200) {
|
||||
uni.openDocument({
|
||||
filePath: res.tempFilePath,
|
||||
success: () => {
|
||||
console.log('打开成功')
|
||||
},
|
||||
fail: () => {
|
||||
},
|
||||
@@ -137,7 +134,6 @@ export default {
|
||||
uni.hideLoading()
|
||||
},
|
||||
complete: res => {
|
||||
console.log('下载完成', res)
|
||||
if (res.statusCode === 404) {
|
||||
uni.showToast({
|
||||
title: '文件不存在',
|
||||
@@ -147,7 +143,6 @@ export default {
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
console.log('CatchClause', e)
|
||||
uni.hideLoading()
|
||||
}
|
||||
},
|
||||
|
||||
@@ -324,9 +324,8 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: res => {
|
||||
console.log('fail', res);
|
||||
}
|
||||
fail: res => {
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
|
||||
@@ -265,9 +265,8 @@
|
||||
if (res.code == 0 && res.data.length) {
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: res.data,
|
||||
fail: res => {
|
||||
console.log('fail', res);
|
||||
},
|
||||
fail: res => {
|
||||
},
|
||||
complete: () => {
|
||||
callback();
|
||||
}
|
||||
|
||||
@@ -114,8 +114,6 @@ export default {
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
console.log(`后台服务器返回的信息:${msg}`);
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
|
||||
@@ -2,7 +2,6 @@ export default {
|
||||
methods: {
|
||||
// 跳转至登录页
|
||||
toLogin(url) {
|
||||
console.log('跳转至登录页', {url, currentRoute: this.$util.getCurrentRoute()});
|
||||
this.$refs.login.open(url ?? this.$util.getCurrentRoute());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +264,6 @@ export default {
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: res.data,
|
||||
fail: (res) => {
|
||||
console.log('fail', res)
|
||||
},
|
||||
complete: ()=> {
|
||||
callback();
|
||||
|
||||
@@ -266,7 +266,6 @@ export default {
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: res.data,
|
||||
fail: (res) => {
|
||||
console.log('fail', res)
|
||||
},
|
||||
complete: ()=> {
|
||||
callback();
|
||||
|
||||
@@ -75,7 +75,6 @@ export default {
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("CatchClause", error);
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
@@ -103,7 +102,6 @@ export default {
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
uni.hideLoading();
|
||||
this.$util.showToast({ title: '下载失败' });
|
||||
}
|
||||
@@ -114,7 +112,6 @@ export default {
|
||||
url: '/api/seal/info',
|
||||
data: { keyword: this.keyword },
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
this.list = res.value;
|
||||
this.info = res;
|
||||
this.title = res.name;
|
||||
|
||||
@@ -64,7 +64,6 @@ export default {
|
||||
uni.openDocument({
|
||||
filePath: res.tempFilePath,
|
||||
success: (res) => {
|
||||
console.log('打开文档成功');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ export default {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/config/defaultvr',
|
||||
success: res => {
|
||||
console.log(res)
|
||||
if (res.code == 0) {
|
||||
uni.setNavigationBarTitle({
|
||||
title:res.data.title
|
||||
|
||||
Reference in New Issue
Block a user