123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <template>
- <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
- <cus-header title='对话记录' bgColor="transparent"></cus-header>
- <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="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="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:[
- // {
- // 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) {
- 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{
- .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>
|