Bläddra i källkod

增加角色详情

htc 2 dagar sedan
förälder
incheckning
b60ce4a641
3 ändrade filer med 213 tillägg och 2 borttagningar
  1. 6 0
      pages.json
  2. 7 2
      pages/role.vue
  3. 200 0
      pagesRole/roleDetail.vue

+ 6 - 0
pages.json

@@ -81,6 +81,12 @@
 					"style": {
 						"navigationStyle": "custom"
 					}
+				},
+				{
+					"path": "roleDetail",
+					"style": {
+						"navigationStyle": "custom"
+					}
 				}
 			]
 		},

+ 7 - 2
pages/role.vue

@@ -16,7 +16,7 @@
 						>
 							<view class="swipe-action u-border-top u-border-bottom">
 								<view class="swipe-action__content">
-								  <div class="l_item adfacjb">
+								  <div class="l_item adfacjb" @tap.stop="showDetail(item)">
 									<div class="li_l adfac">
 										<image :src="item.img"></image>
 										<div class="lil_info">
@@ -128,7 +128,7 @@
 						this.$refs['swipeAction' + i][0].closeHandler();
 					})
 					uni.navigateTo({
-						url:`/pagesRole/addRole?agentId=${item.id}`
+						url:`/pagesRole/addRole?agentId=${item.id}&type=2`
 					})
 				}else if(e.index===1){
 					let that = this;
@@ -148,6 +148,11 @@
 					})
 				}
 			},
+			showDetail(item){
+				uni.navigateTo({
+					url:'/pagesRole/roleDetail?agentId='+item.id
+				})
+			},
 			toBindDevice(item){
 				this.agentId = item.id;
 				this.show = true;

+ 200 - 0
pagesRole/roleDetail.vue

@@ -0,0 +1,200 @@
+<template>
+	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
+		<cus-header title='角色详情' bgColor="transparent"></cus-header>
+		<div class="box">
+			<div class="title adfac">角色形象</div>
+			<div class="upload">
+				<div class="sc">
+						<div class="imgs">
+							<image class="img1" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/44f91a62-29c1-4d1f-8064-0d7579da2fb0.png"></image>
+						</div>
+				</div>
+			</div>
+		</div>
+		<div class="box adfacjb">
+			<div class="title">角色昵称</div>
+			<input type="text" v-model="agentDto.agentName" placeholder="请输入角色昵称" placeholder-class="ph" disabled>
+		</div>
+		<div class="box">
+			<div class="top adfacjb">
+				<div class="title">设定描述</div>
+			</div>
+			<div class="desc"><u-textarea v-model="agentDto.systemPrompt" :focus="focus" autoHeight :maxlength="-1" border="none" disabled></u-textarea>			
+			</div>
+		</div>
+		<div class="box adfacjb">
+			<div class="title">声音</div>
+			<div class="right adfac" @tap="show=true">
+				<div class="mtext active">{{voiceText}}</div>
+			</div>
+		</div>
+	</view>
+</template>
+
+<script>
+	export default {
+		data(){
+			return {
+				agentId:'',
+				deviceId:'',
+				voiceText:'',
+				agentDto:{
+					"agentName": "",
+					"asrModelId": "",
+					"vadModelId": "",
+					"llmModelId": "",
+					"ttsModelId": "",
+					"ttsVoiceId": "",
+					"memModelId": "",
+					"intentModelId": "",
+					"systemPrompt": "",
+					"langCode": "",
+					"language": "",
+					"deviceId": "",
+					"chatHistoryConf": ""
+				}
+			}
+		},
+		onLoad(option) {
+			if(option.agentId){
+				this.agentId = option.agentId;
+				this.getDetail();
+			} 
+		},
+		methods:{
+			getDetail(){
+				this.$api.get(`/agent/${this.agentId}`).then(res=>{
+					if(res.data.code!==0) return this.$showToast(res.data.msg)
+					this.agentDto = {...this.agentDto,...res.data.data};
+					this.getModelVoiceList();
+				})
+			},
+			getModelVoiceList(){
+				this.$api.get(`/models/${this.agentDto.ttsModelId}/voices`).then(res=>{
+					if(res.data.code!==0) return this.$showToast(res.data.msg)
+					this.voiceText = res.data.data.find(v=>v.id===this.agentDto.ttsVoiceId)?.name||'未选择音色';
+				})
+			}
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	::v-deep .desc .u-textarea{
+		padding: 0 !important;
+		background-color: transparent !important;
+	}
+	
+	.ph{
+		font-family: PingFangSC, PingFang SC;
+		font-weight: 400;
+		font-size: 28rpx;
+		color: #A6A6A6;
+		line-height: 40rpx;
+		text-align: right;
+	}
+	.page{
+		background: #F7F6F9;
+		padding: 0 30rpx 30rpx;
+		box-sizing: border-box;
+		.box{
+			background: #FFFFFF;
+			border-radius: 24rpx;
+			margin-top: 20rpx;
+			width: 100%;
+			padding: 40rpx 30rpx;
+			box-sizing: border-box;
+			
+			.title{
+				font-family: PingFang-SC, PingFang-SC;
+				font-weight: bold;
+				font-size: 30rpx;
+				color: #111111;
+				line-height: 32rpx;
+				span{
+					font-size: 32rpx;
+					color: #F31616;
+				}
+			}
+			.upload{
+				margin-top: 12rpx;
+				display: flex;
+				flex-direction: column;
+				align-items: center;
+				.sc{
+					width: 188rpx;
+					height: 188rpx;
+				}
+				.text{
+					font-family: PingFangSC, PingFang SC;
+					font-weight: 400;
+					font-size: 26rpx;
+					color: #A6A6A6;
+					line-height: 37rpx;
+					text-align: center;
+					margin-top: 8rpx;
+				}
+			}
+			.right{
+				.mtext{
+					font-family: PingFangSC, PingFang SC;
+					font-weight: 400;
+					font-size: 28rpx;
+					color: #A6A6A6;
+					line-height: 40rpx;
+					text-align: right;
+					&.active{
+						color: #111111;
+					}
+				}
+				image{
+					width: 36rpx;
+					height: 36rpx;
+					margin-left: 10rpx;
+				}
+			}
+			.desc{
+				margin-top: 20rpx;
+				min-height: 200rpx;
+				overflow-y: auto;
+			}
+			.tip{
+				font-family: PingFangSC, PingFang SC;
+				font-weight: 400;
+				font-size: 28rpx;
+				color: #1B50FF;
+				line-height: 40rpx;
+				text-align: right;
+			}
+			.imgs{
+				width: 188rpx;
+				height: 188rpx;
+				border-radius: 50%;
+				position: relative;
+				.img1{
+					width: 188rpx;
+					height: 188rpx;
+					border-radius: 50%;
+					position: absolute;
+					z-index: 2;
+				}
+				.img2{
+					width: 42rpx;
+					height: 42rpx;
+					position: absolute;
+					right: 0;
+					bottom: 0;
+					z-index: 3;
+				}
+			}
+		}
+		.zt_btn{
+			margin-top: 54rpx;
+		}
+		input{
+			border: none;
+			text-align: right;
+			font-size: 28rpx;
+		}
+	}
+</style>