修改url
This commit is contained in:
@@ -11,9 +11,9 @@
|
|||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
<!-- 消息列表 -->
|
<!-- 消息列表 -->
|
||||||
<scroll-view scroll-y class="message-list" :scroll-top="scrollTop" scroll-with-animation="true"
|
<scroll-view scroll-y class="message-list" :scroll-top="scrollTop" scroll-with-animation="true"
|
||||||
show-scrollbar="false" enhanced="true" bounces="true"
|
show-scrollbar="false" enhanced="true" bounces="true" @scroll="onScroll" @scrolltoupper="loadMoreHistory"
|
||||||
@scroll="onScroll" @scrolltoupper="loadMoreHistory" upper-threshold="50">
|
upper-threshold="50">
|
||||||
<!-- 加载提示 -->
|
<!-- 加载提示 -->
|
||||||
<view v-if="isLoadingHistory" class="loading-history">
|
<view v-if="isLoadingHistory" class="loading-history">
|
||||||
<text>正在加载历史记录...</text>
|
<text>正在加载历史记录...</text>
|
||||||
@@ -245,22 +245,25 @@
|
|||||||
if (res) {
|
if (res) {
|
||||||
console.log('forceScrollToBottom: 获取到scrollOffset', res);
|
console.log('forceScrollToBottom: 获取到scrollOffset', res);
|
||||||
console.log('forceScrollToBottom: 当前scrollTop', this.scrollTop);
|
console.log('forceScrollToBottom: 当前scrollTop', this.scrollTop);
|
||||||
|
|
||||||
// 使用scrollHeight,如果没有则使用一个大值
|
// 使用scrollHeight,如果没有则使用一个大值
|
||||||
const scrollHeight = res.scrollHeight || 99999;
|
const scrollHeight = res.scrollHeight || 99999;
|
||||||
const targetScrollTop = scrollHeight + 1000;
|
const targetScrollTop = scrollHeight + 1000;
|
||||||
|
|
||||||
// 先重置scrollTop,然后设置到底部
|
// 先重置scrollTop,然后设置到底部
|
||||||
this.scrollTop = 0;
|
this.scrollTop = 0;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.scrollTop = targetScrollTop;
|
this.scrollTop = targetScrollTop;
|
||||||
console.log('forceScrollToBottom: 设置scrollTop为', targetScrollTop);
|
console.log('forceScrollToBottom: 设置scrollTop为',
|
||||||
|
targetScrollTop);
|
||||||
|
|
||||||
// 延迟再次确保滚动到底部
|
// 延迟再次确保滚动到底部
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const finalScrollTop = (res.scrollHeight || 99999) + 1000;
|
const finalScrollTop = (res.scrollHeight ||
|
||||||
|
99999) + 1000;
|
||||||
this.scrollTop = finalScrollTop;
|
this.scrollTop = finalScrollTop;
|
||||||
console.log('forceScrollToBottom: 延迟设置scrollTop完成', finalScrollTop);
|
console.log('forceScrollToBottom: 延迟设置scrollTop完成',
|
||||||
|
finalScrollTop);
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -656,7 +659,7 @@
|
|||||||
});
|
});
|
||||||
this.inputMessage = '';
|
this.inputMessage = '';
|
||||||
this.saveMessagesToLocal(); // 保存用户消息
|
this.saveMessagesToLocal(); // 保存用户消息
|
||||||
|
|
||||||
// 立即滚动到底部显示用户消息
|
// 立即滚动到底部显示用户消息
|
||||||
this.forceScrollToBottom();
|
this.forceScrollToBottom();
|
||||||
|
|
||||||
|
@@ -3,12 +3,12 @@ import axios from 'axios'
|
|||||||
import {
|
import {
|
||||||
getToken
|
getToken
|
||||||
} from './auth'
|
} from './auth'
|
||||||
|
import config from '@/config'
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
// baseURL: 'http://localhost:9090/dev-api/aitutor/aichat',
|
// baseURL: 'http://localhost:9090/dev-api/aitutor/aichat',
|
||||||
// baseURL: 'http://localhost:8088/aitutor/aichat',
|
// baseURL: 'http://localhost:8088/aitutor/aichat',
|
||||||
// baseURL: 'http://localhost:8080/aitutor/aichat',
|
// baseURL: 'http://localhost:8080/aitutor/aichat',
|
||||||
baseURL: 'http://localhost:8088',
|
baseURL: config.baseUrl,
|
||||||
timeout: 15000,
|
timeout: 15000,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
import {
|
import {
|
||||||
getToken
|
getToken
|
||||||
} from '@/utils/auth';
|
} from '@/utils/auth';
|
||||||
|
import config from '@/config'
|
||||||
const BASE_URL = (() => {
|
const BASE_URL = (() => {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
return 'http://localhost:8088';
|
return config.baseUrl;
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
// return 'http://192.168.x.x:8088'; // 换成你的电脑 IP
|
// return 'http://192.168.x.x:8088'; // 换成你的电脑 IP
|
||||||
|
Reference in New Issue
Block a user