dialogDetail.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='对话记录' bgColor="transparent"></cus-header>
  4. <div class="list" v-if="list.length">
  5. <div class="l_item" v-for="(item,index) in list">
  6. <div class="time">{{item.createdAt}}</div>
  7. <div class="pre adf my" v-if="item.chatType===1">
  8. <div class="text my">{{item.content}}</div>
  9. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/6edb131a-66f9-4a2a-a865-7b74e3dd52ed.png"></image>
  10. </div>
  11. <div class="pre adf ai" v-else-if="item.chatType===2">
  12. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/bcde7118-fc4e-4fa6-96ca-ebe1e0beba2f.png"></image>
  13. <div class="text ai">{{item.content}}</div>
  14. </div>
  15. </div>
  16. </div>
  17. <template v-else>
  18. <page-empty :height="'calc(100vh - 200rpx)'"></page-empty>
  19. </template>
  20. </view>
  21. </template>
  22. <script>
  23. import pageEmpty from '@/components/pageEmpty/index.vue'
  24. export default {
  25. components:{pageEmpty},
  26. data(){
  27. return {
  28. agentId:'',
  29. deviceId:'',
  30. sessionId:'',
  31. list:[
  32. // {
  33. // createdAt:'2025-05-30 06:25:53',
  34. // chatType:1,
  35. // content:'你好哇'
  36. // },
  37. // {
  38. // createdAt:'2025-05-30 06:27:53',
  39. // chatType:2,
  40. // content:'你好,很高兴认识你,我是AI智能陪绑助手小智。'
  41. // },
  42. // {
  43. // createdAt:'2025-05-30 06:27:53',
  44. // chatType:2,
  45. // content:'有什么可以帮您的吗?'
  46. // },
  47. // {
  48. // createdAt:'2025-05-30 06:31:53',
  49. // chatType:1,
  50. // content:'今天天气如何'
  51. // },
  52. // {
  53. // createdAt:'2025-05-30 06:33:53',
  54. // chatType:2,
  55. // content:'我也母鸡啦'
  56. // }
  57. ]
  58. }
  59. },
  60. onLoad(option) {
  61. this.agentId = option?.agentId;
  62. this.deviceId = option?.deviceId;
  63. this.sessionId = option?.sessionId;
  64. this.getList();
  65. },
  66. methods:{
  67. getList(){
  68. this.$api.get(`/agent/${this.agentId}/${this.deviceId}/chat-history/${this.sessionId}`).then(res=>{
  69. if(res.data.code!==0) return this.$showToast(res.data.msg)
  70. this.list = res.data.data;
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style scoped lang="less">
  77. .page{
  78. background: #F7F6F9;
  79. padding: 0 30rpx 40rpx;
  80. box-sizing: border-box;
  81. .list{
  82. .l_item{
  83. margin-top: 48rpx;
  84. .time{
  85. font-family: PingFangSC, PingFang SC;
  86. font-weight: 400;
  87. font-size: 24rpx;
  88. color: #8D8D8D;
  89. line-height: 24rpx;
  90. text-align: center;
  91. }
  92. .pre{
  93. margin-top: 32rpx;
  94. image{
  95. width: 78rpx;
  96. height: 78rpx;
  97. border-radius: 50%;
  98. }
  99. .text{
  100. padding: 24rpx;
  101. font-family: PingFangSC, PingFang SC;
  102. font-weight: 400;
  103. font-size: 28rpx;
  104. line-height: 48rpx;
  105. border-radius: 20rpx;
  106. }
  107. &.my{
  108. justify-content: flex-end;
  109. .text{
  110. background: #72832B;
  111. color: #FFFFFF;
  112. }
  113. image{
  114. margin-left: 20rpx;
  115. }
  116. }
  117. &.ai{
  118. .text{
  119. background: #FFFFFF;
  120. color: #252525;
  121. }
  122. image{
  123. margin-right: 20rpx;
  124. }
  125. }
  126. }
  127. }
  128. }
  129. }
  130. </style>