<template>
	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
		<cus-header title='智能体详情' bgColor="transparent"></cus-header>
		<!-- <div class="top adffcacjc">
			<image src="@/static/avatar_big.png"></image>
			<div class="change adfacjb">
				<image src="@/static/change2.png"></image>
				<span>更换形象</span>
			</div>
		</div> -->
		<div class="box b1 adfac">
			<text>角色昵称</text>
			<span>{{info.agentName||''}}</span>
		</div>
		<div class="box b2">
			<text>角色介绍</text>
			<p>{{info.systemPrompt||''}}</p>
		</div>
		<div class="box b1 adfac">
			<text>角色音色</text>
			<span>{{vname||''}}</span>
		</div>
		<div class="item adfacjb" @tap="toTurn('/pages/roleSet?id='+info.id+'&agentId='+id)">
			<div class="i_l adfac">
				<image src="@/static/user_set.png"></image>
				<span>配置角色</span>
			</div>
			<div class="i_r adfac">
				<span>编辑</span>
				<u-icon name="arrow-right" color="#D3D2D2" size="28rpx"></u-icon>
			</div>
		</div>
		<div class="item adfacjb" @tap="toTurn('/pages/device?agentId='+id)">
			<div class="i_l adfac">
				<image src="@/static/device_gl.png"></image>
				<span>设备管理</span>
			</div>
			<div class="i_r adfac">
				<span>编辑</span>
				<u-icon name="arrow-right" color="#D3D2D2" size="28rpx"></u-icon>
			</div>
		</div>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				id:'',
				vname:'',
				info:null
			}
		},
		onLoad(option) {
			this.id = option.id;
			this.vname = option.vname;
			this.getDetail();
		},
		methods:{
			getDetail(){
				this.$api.get(`/agent/${this.id}`).then(res=>{
					if(res.data.code!==0) return this.$showToast(res.data.msg)
					this.info = res.data.data;
				})
			},
			toTurn(url){
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.page{
		background: linear-gradient( 180deg, #E0EEFF 0%, #F6FCFF 100%);
		padding: 0 31rpx 40rpx;
		box-sizing: border-box;
		
		.top{
			&>image{
				margin-top: 20rpx;
				width: 200rpx;
				height: 233rpx;
			}
			.change{
				margin-top: 40rpx;
				width: 232rpx;
				height: 72rpx;
				background: #FFFFFF;
				border-radius: 36rpx;
				padding: 18rpx 36rpx;
				box-sizing: border-box;
				image{
					width: 28rpx;
					height: 25rpx;
				}
				span{
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 28rpx;
					color: #0066FE;
					line-height: 32rpx;
				}
			}
		}
		
		.box{
			background: #FFFFFF;
			border-radius: 16rpx;
			padding: 35rpx 34rpx;
			margin-top: 20rpx;
			&.b1{
				margin-top: 40rpx;
			}
			text{
				font-family: PingFang-SC, PingFang-SC;
				font-weight: bold;
				font-size: 30rpx;
				color: #111111;
				line-height: 32rpx;
			}
			span{
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 30rpx;
				color: #333333;
				line-height: 42rpx;
				margin-left: 52rpx;
			}
			p{
				margin-top: 30rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 30rpx;
				color: #616161;
				line-height: 56rpx;
			}
		}
		.item{
			margin-top: 20rpx;
			background: #FFFFFF;
			border-radius: 16rpx;
			padding: 18rpx 34rpx;
			.i_l{
				image{
					width: 64rpx;
					height: 64rpx;
				}
				span{
					font-family: PingFang-SC, PingFang-SC;
					font-weight: bold;
					font-size: 30rpx;
					color: #111111;
					line-height: 32rpx;
					margin-left: 30rpx;
				}
			}
			.i_r{
				span{
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 26rpx;
					color: #0066FE;
					line-height: 32rpx;
					margin-right: 14rpx;
				}
			}
		}
	}
</style>