فهرست منبع

对话历史接口联调

htc 2 روز پیش
والد
کامیت
c375ad280e
3فایلهای تغییر یافته به همراه86 افزوده شده و 7 حذف شده
  1. 3 0
      pages/home.vue
  2. 82 6
      pagesHome/dialogDetail.vue
  3. 1 1
      pagesHome/dialogRecord.vue

+ 3 - 0
pages/home.vue

@@ -41,6 +41,9 @@
 		async onShow() {
 			await this.getAgentModelList()
 			this.getDeviceList();
+			uni.navigateTo({
+				url:'/pagesHome/dialogDetail'
+			})
 		},
 		methods:{
 			getAgentModelList(){

+ 82 - 6
pagesHome/dialogDetail.vue

@@ -1,30 +1,61 @@
 <template>
 	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
 		<cus-header title='对话记录' bgColor="transparent"></cus-header>
-		<div class="list">
-			<div v-for="(item,index) in list">
+		<div class="list" v-if="list.length">
+			<div class="l_item" v-for="(item,index) in list">
 				<div class="time">{{item.createdAt}}</div>
-				<div class="adf my" v-if="item.chatType===1">
+				<div class="pre adf my" v-if="item.chatType===1">
 					<div class="text my">{{item.content}}</div>
 					<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/6edb131a-66f9-4a2a-a865-7b74e3dd52ed.png"></image>
 				</div>
-				<div class="adf ai" v-else-if="item.chatType===2">
+				<div class="pre adf ai" v-else-if="item.chatType===2">
 					<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/bcde7118-fc4e-4fa6-96ca-ebe1e0beba2f.png"></image>
 					<div class="text ai">{{item.content}}</div>
 				</div>
 			</div>
 		</div>
+		<template v-else>
+			<page-empty :height="'calc(100vh - 200rpx)'"></page-empty>
+		</template>
 	</view>
 </template>
 
 <script>
+	import pageEmpty from '@/components/pageEmpty/index.vue' 
 	export default {
+		components:{pageEmpty},
 		data(){
 			return {
 				agentId:'',
 				deviceId:'',
 				sessionId:'',
-				list:[]
+				list:[
+					// {
+					// 	createdAt:'2025-05-30 06:25:53',
+					// 	chatType:1,
+					// 	content:'你好哇'
+					// },
+					// {
+					// 	createdAt:'2025-05-30 06:27:53',
+					// 	chatType:2,
+					// 	content:'你好,很高兴认识你,我是AI智能陪绑助手小智。'
+					// },
+					// {
+					// 	createdAt:'2025-05-30 06:27:53',
+					// 	chatType:2,
+					// 	content:'有什么可以帮您的吗?'
+					// },
+					// {
+					// 	createdAt:'2025-05-30 06:31:53',
+					// 	chatType:1,
+					// 	content:'今天天气如何'
+					// },
+					// {
+					// 	createdAt:'2025-05-30 06:33:53',
+					// 	chatType:2,
+					// 	content:'我也母鸡啦'
+					// }
+				]
 			}
 		},
 		onLoad(option) {
@@ -51,7 +82,52 @@
 		box-sizing: border-box;
 		
 		.list{
-			
+			.l_item{
+				margin-top: 48rpx;
+				.time{
+					font-family: PingFangSC, PingFang SC;
+					font-weight: 400;
+					font-size: 24rpx;
+					color: #8D8D8D;
+					line-height: 24rpx;
+					text-align: center;
+				}
+				.pre{
+					margin-top: 32rpx;
+					image{
+						width: 78rpx;
+						height: 78rpx;
+						border-radius: 50%;
+					}
+					.text{
+						padding: 24rpx;
+						font-family: PingFangSC, PingFang SC;
+						font-weight: 400;
+						font-size: 28rpx;
+						line-height: 48rpx;
+						border-radius: 20rpx;
+					}
+					&.my{
+						justify-content: flex-end;
+						.text{
+							background: #72832B;
+							color: #FFFFFF;
+						}
+						image{
+							margin-left: 20rpx;
+						}
+					}
+					&.ai{
+						.text{
+							background: #FFFFFF;
+							color: #252525;
+						}
+						image{
+							margin-right: 20rpx;
+						}
+					}
+				}
+			}
 		}
 	}
 </style>

+ 1 - 1
pagesHome/dialogRecord.vue

@@ -19,7 +19,7 @@
 			</div>
 		</template>
 		<template v-else>
-			<page-empty :height="'calc(100vh - 72rpx)'"></page-empty>
+			<page-empty :height="'calc(100vh - 200rpx)'"></page-empty>
 		</template>
 	</view>
 </template>