소스 검색

feat:修改数据响应时间

xianna.liang 8 달 전
부모
커밋
207bac0166
6개의 변경된 파일47개의 추가작업 그리고 41개의 파일을 삭제
  1. 1 1
      App.vue
  2. 8 8
      pages/index15/index15.vue
  3. 14 13
      pages/index32/index32.vue
  4. 11 8
      theme/chat15.css
  5. 12 11
      theme/chat32.css
  6. 1 0
      until/request.js

+ 1 - 1
App.vue

@@ -14,7 +14,7 @@
 					console.log(screenHeight, screenWidth)
 				}
 			})
-			if (screenHeight == 720 && screenWidth == 1280) {
+			if (screenHeight == 768 && screenWidth == 1024) {
 				uni.redirectTo({
 					url: '/pages/index15/index15'
 				})

+ 8 - 8
pages/index15/index15.vue

@@ -1,11 +1,11 @@
 <template>
 	<view id='app'>
+		<view class="head">
+			<text>睿宝AI</text>
+		</view>
 		<view class="pageView">
 			<view class="sidebar-left"></view>
 			<view class="body">
-				<view class="head">
-					<text>睿宝AI</text>
-				</view>
 				<view class="list-wrap">
 					<scroll-view id="content-box" scroll-y="true" class="scrollview" :scroll-top="msgList.scrollTop">
 						<!-- 聊天主体 -->
@@ -107,7 +107,7 @@
 			msgList.chatList.push(obj)
 
 			obj.otherContent = await GetNewsList(data)
-			await sleep(16000);
+			// await sleep(16000);
 			getChatContent(obj.otherContent, msgList.len)
 		}
 		
@@ -145,9 +145,9 @@
 
 	// ------- 聊天逐字输出 -----------
 	// 延时函数
-	const sleep = ((delaytime = 10000) => {
-		return new Promise(resolve => setTimeout(resolve, delaytime));
-	})
+	// const sleep = ((delaytime = 10000) => {
+	// 	return new Promise(resolve => setTimeout(resolve, delaytime));
+	// })
 
 	// 逐字显示内容
 	const getChatContent = ((text, index) => {
@@ -162,7 +162,7 @@
 				msgList.otherChatList[index - 1] = nowStr;
 			}
 
-		}, 200);
+		}, 50);
 		msgList.textCount = 0
 		msgList.isloading[index - 1] = false
 		msgList.isClick = !msgList.isClick

+ 14 - 13
pages/index32/index32.vue

@@ -1,12 +1,12 @@
 <template>
 	<view id='app'>
 		<view class="placeholder"></view>
+		<view class="head">
+			<text>睿宝AI</text>
+		</view>
 		<view class="pageView">
 			<view class="sidebar-left"></view>
 			<view class="body">
-				<view class="head">
-					<text>睿宝AI</text>
-				</view>
 				<view class="list-wrap">
 					<scroll-view id="content-box" scroll-y="true" class="scrollview" :scroll-top="msgList.scrollTop">
 						<!-- 聊天主体 -->
@@ -24,7 +24,8 @@
 											<loadingPointsVue></loadingPointsVue>
 										</view>
 										<view class="content left" v-if='!msgList.isloading[index]'>
-											{{ msgList.otherChatList[index] }}</view>
+											{{ msgList.otherChatList[index] }}
+										</view>
 									</view>
 									<image class="avtar" src="../../static/Ai-avatar.png" mode="aspectFit"></image>
 								</view>
@@ -80,7 +81,7 @@
 		otherChatList: [],
 		len: 0,
 		isloading: [],
-		isClick:false
+		isClick: false
 	})
 
 	// 发送消息
@@ -105,7 +106,7 @@
 
 			obj.otherContent = await GetNewsList(data)
 
-			await sleep(16000);
+			// await sleep(16000);
 			getChatContent(obj.otherContent, msgList.len)
 
 
@@ -130,12 +131,12 @@
 			})
 		})
 	})
-	
+
 	//滚动至聊天底部
-	watch([msgList.otherChatList,msgList.chatList], (newVal) => {
+	watch([msgList.otherChatList, msgList.chatList], (newVal) => {
 		scrollToBottom()
 	})
-	
+
 	// 调用数据接口
 	const GetNewsList = async (data) => {
 		msgList.chatMsg = ''
@@ -143,13 +144,13 @@
 		console.log(res)
 		return res
 	}
-	
+
 	// ------- 聊天逐字输出 -----------
 	// 延时函数
 	const sleep = ((delaytime = 10000) => {
 		return new Promise(resolve => setTimeout(resolve, delaytime));
 	})
-	
+
 	// 逐字显示内容
 	const getChatContent = ((text, index) => {
 		console.log(index)
@@ -163,8 +164,8 @@
 				let nowStr = text.substring(0, msgList.textCount);
 				msgList.otherChatList[index - 1] = nowStr;
 			}
-	
-		}, 200);
+
+		}, 50);
 		console.log(msgList.timer)
 		msgList.textCount = 0
 		msgList.isloading[index - 1] = false

+ 11 - 8
theme/chat15.css

@@ -1,7 +1,16 @@
 /* 15寸 大屏样式 */
 
+/* --- 标题 --- */
+.head {
+	height: 5vh;
+	text-align: center;
+	line-height: 5vh;
+	background-color: #f5f5f5;
+	font-size: 18px;
+}
 
 .pageView {
+	height: 95%;
 	display: flex;
 	background-color: #f5f5f5;
 }
@@ -9,16 +18,10 @@
 .body {
 	display: flex;
 	flex-direction: column;
-	height: 100vh;
+	height: 95vh;
 	width: 75%;
 }
 
-/* --- 头部 --- */
-.head {
-	height: 100rpx;
-	text-align: center;
-	line-height: 100rpx;
-}
 
 /* --- 主内容区 --- */
 .list-wrap {
@@ -51,7 +54,7 @@
 
 .list-wrap .scrollview .scrollview-item .item .content {
 	position: relative;
-	max-width: 750rpx;
+	max-width: 1050rpx;
 	background-color: #fff;
 	margin: 40rpx 24rpx 0;
 	border-radius: 5px;

+ 12 - 11
theme/chat32.css

@@ -1,11 +1,18 @@
 /* 32寸 大屏样式 */
 
-
 .placeholder {
 	height: 40vh;
 
 }
 
+/* --- 标题 --- */
+.head {
+	height: 5vh;
+	background-color: #f5f5f5;
+	text-align: center;
+	line-height: 5vh;
+}
+
 .pageView {
 	display: flex;
 	background-color: #f5f5f5;
@@ -14,18 +21,12 @@
 .body {
 	display: flex;
 	flex-direction: column;
-	height: 60vh;
+	height: 55vh;
 	width: 70%;
 	/* background-color: #f5f5f5; */
 }
 
-/* --- 头部 --- */
-.head {
-	height: 100rpx;
-	/* background-color: #f5f5f5; */
-	text-align: center;
-	line-height: 100rpx;
-}
+
 
 /* --- 主内容区 --- */
 .list-wrap {
@@ -58,7 +59,7 @@
 
 .list-wrap .scrollview .scrollview-item .item .content {
 	position: relative;
-	max-width: 750rpx;
+	max-width: 1050rpx;
 	background-color: #fff;
 	margin: 40rpx 24rpx 0;
 	border-radius: 5px;
@@ -122,7 +123,7 @@
 
 .sidebar-right {
 	width: 25%;
-	height: 60vh;
+	height: 55vh;
 	position: relative;
 }
 

+ 1 - 0
until/request.js

@@ -8,6 +8,7 @@ const axios = Axios.create({
 	},
 	timeout: 600000, // 超时
 	baseURL: 'http://192.168.0.166:5000' ,
+	// baseURL: 'http://192.168.1.105:5000' ,
 	adapter: axiosAdapterUniapp
 })