htc 3 gün önce
ebeveyn
işleme
b1374c1bd6

+ 2 - 6
components/deviceBox/index.vue

@@ -50,12 +50,8 @@
 		},
 		methods:{
 			dislogRecord(item){
-				this.$api.get(`/agent/${item.agentId}/${item.id}/sessions`,{page:1,limit:-1}).then(res=>{
-					if(res.data.code!==0) return this.$showToast(res.data.msg)
-					this.$api.get(`/agent/${item.agentId}/${item.id}/chat-history/${'17a9ae7e-601b-4566-96fc-7728e8342072'}`).then(res2=>{
-						if(res2.data.code!==0) return this.$showToast(res2.data.msg)
-						
-					})
+				uni.navigateTo({
+					url:`/pagesHome/dialogRecord?agentId=${item.agentId}&deviceId=${item.id}`
 				})
 			},
 			editRole(item){

+ 12 - 0
pages.json

@@ -29,6 +29,18 @@
 		{
 			"root": "pagesHome",
 			"pages": [
+				{
+					"path": "dialogRecord",
+					"style": {
+						"navigationStyle": "custom"
+					}
+				},
+				{
+					"path": "dialogDetail",
+					"style": {
+						"navigationStyle": "custom"
+					}
+				},
 				{
 					"path": "wifiSetMemo1",
 					"style": {

+ 1 - 1
pages/role.vue

@@ -119,7 +119,7 @@
 			},
 			addRole(){
 				uni.navigateTo({
-					url:'/pagesRole/addRole'
+					url:'/pagesRole/addRole?type=2'
 				})
 			},
 			deleteRole(item,e){

+ 57 - 0
pagesHome/dialogDetail.vue

@@ -0,0 +1,57 @@
+<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="time">{{item.createdAt}}</div>
+				<div class="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">
+					<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>
+	</view>
+</template>
+
+<script>
+	export default {
+		data(){
+			return {
+				agentId:'',
+				deviceId:'',
+				sessionId:'',
+				list:[]
+			}
+		},
+		onLoad(option) {
+			this.agentId = option?.agentId;
+			this.deviceId = option?.deviceId;
+			this.sessionId = option?.sessionId;
+			this.getList();
+		},
+		methods:{
+			getList(){
+				this.$api.get(`/agent/${this.agentId}/${this.deviceId}/chat-history/${this.sessionId}`).then(res=>{
+					if(res.data.code!==0) return this.$showToast(res.data.msg)
+					this.list = res.data.data;
+				})
+			}
+		}
+	}
+</script>
+
+<style scoped lang="less">
+	.page{
+		background: #F7F6F9;
+		padding: 0 30rpx 40rpx;
+		box-sizing: border-box;
+		
+		.list{
+			
+		}
+	}
+</style>

+ 121 - 0
pagesHome/dialogRecord.vue

@@ -0,0 +1,121 @@
+<template>
+	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
+		<cus-header title='对话记录'></cus-header>
+		<template v-if="list.length">
+			<div class="list">
+				<div class="item adfacjb" v-for="(item,index) in list" :key="index" @tap="toDetail(item)">
+					<div class="i_l adfac">
+						<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/bcde7118-fc4e-4fa6-96ca-ebe1e0beba2f.png"></image>
+						<div class="info">
+							<p>{{item.createdAt}}</p>
+							<p class="name">{{'玩具名称'}}</p>
+						</div>
+					</div>
+					<div class="i_r adfac">
+						<text>{{item.chatCount}}条</text>
+						<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/e84d58ee-1cc7-4457-bf65-4849a9a22acb.png"></image>
+					</div>
+				</div>
+			</div>
+		</template>
+		<template v-else>
+			<page-empty :height="'calc(100vh - 72rpx)'"></page-empty>
+		</template>
+	</view>
+</template>
+
+<script>
+	import pageEmpty from '@/components/pageEmpty/index.vue'
+	export default {
+		components:{pageEmpty},
+		data(){
+			return {
+				agentId:'',
+				deviceId:'',
+				page:1,
+				limit:10,
+				list:[],
+				isOver:false
+			}
+		},
+		onLoad(option) {
+			this.agentId = option?.agentId;
+			this.deviceId = option?.deviceId;
+			this.getList()
+		},
+		onReachBottom() {
+			if(this.isOver) return
+			this.getList();
+		},
+		methods:{
+			getList(){
+				this.$api.get(`/agent/${this.agentId}/${this.deviceId}/sessions`,{page:this.page,limit:this.limit}).then(res=>{
+					if(res.data.code!==0) return this.$showToast(res.data.msg)
+					if(this.list.length<res.data.data.total){
+						this.page++;
+						this.list = [...this.list,...res.data.data.list];
+					}else this.isOver = true
+				})
+			},
+			toDetail(item){
+				uni.navigateTo({
+					url:`/pagesHome/dialogDetail?agentId=${this.agentId}&deviceId=${this.deviceId}&sessionId=${item.sessionId}`
+				})
+			}
+		}
+	}
+</script>
+
+<style scoped lang="less">
+	.page{
+		background: #FFFFFF;
+		padding: 0 30rpx 30rpx;
+		box-sizing: border-box;
+		.list{
+			.item{
+				margin-top: 72rpx;
+				&:first-child{
+					margin-top: 36rpx;
+				}
+				.i_l{
+					image{
+						width: 78rpx;
+						height: 78rpx;
+						border-radius: 50%;
+					}
+					.info{
+						padding-left: 28rpx;
+						p{
+							font-family: PingFang-SC, PingFang-SC;
+							font-weight: bold;
+							font-size: 32rpx;
+							color: #333333;
+							line-height: 34rpx;
+							&.name{
+								font-weight: 400;
+								font-size: 24rpx;
+								color: #8D8D8D;
+								line-height: 24rpx;
+								margin-top: 20rpx;
+							}
+						}
+					}
+				}
+				.i_r{
+					text{
+						font-family: PingFang-SC, PingFang-SC;
+						font-weight: bold;
+						font-size: 30rpx;
+						color: #72832B;
+						line-height: 30rpx;
+					}
+					image{
+						width: 36rpx;
+						height: 36rpx;
+						margin-left: 10rpx;
+					}
+				}
+			}
+		}
+	}
+</style>

+ 1 - 1
pagesMy/scanResult.vue

@@ -19,7 +19,7 @@
 		methods:{
 			addRole(){
 				uni.navigateTo({
-					url:'/pages/role'
+					url:'/pagesRole/addRole?type=1'
 				})
 			},
 			goBack(){

+ 7 - 1
pagesRole/addRole.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
-		<cus-header :title='title' bgColor="transparent"></cus-header>
+		<cus-header :title='title' bgColor="transparent" :backUrl="backUrl"></cus-header>
 		<div class="box">
 			<div class="title adfac">角色形象</div>
 			<div class="upload">
@@ -53,6 +53,8 @@
 	export default {
 		data(){
 			return {
+				type:'',
+				backUrl:'/pages/home',
 				title:'创建角色',
 				voiceText:'请选择音色',
 				fileList:[],
@@ -83,6 +85,10 @@
 			}
 		},
 		onLoad(option) {
+			if(option?.type){
+				if(option.type==1) this.backUrl = '/pages/home'
+				else if(option.type==2) this.backUrl = '/pages/role'
+			}
 			if(option.agentId){
 				this.title = '编辑角色';
 				this.agentId = option.agentId;