index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div class="l_box box">
  3. <div class="l_top adfacjb">
  4. <div class="lt_l">{{item.alias||item.board||''}}</div>
  5. <div class="lt_r adfac">
  6. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/660f9a0f-8127-4575-81a2-3e1c2ae45841.png" v-if="item.state===1"></image>
  7. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/f2978646-aee1-4e86-8f36-c8dbb08d3ecb.png" v-else-if="item.state===0"></image>
  8. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/d05d9fbf-61f4-486b-b954-efa2f49d8ac3.png" v-if="item.state===1"></image>
  9. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/ea72f9c1-6ded-48d3-b4fb-e692b7b7881e.png" v-else-if="item.state===0"></image>
  10. <div class="ltr_zt" :class="{'zx':item.state===1,'lx':item.state===0}">{{item.state===1?'在线':'离线'}}</div>
  11. </div>
  12. </div>
  13. <div class="l_content">
  14. <div class="lc_role adfac">
  15. <image class="lcr_l" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/24380873-b8d7-413c-8d9d-d997fe13685d.png"></image>
  16. <div class="lcr_r">
  17. <p>{{item.agent.agentName||''}}</p>
  18. <div class="text">角色模板:{{item.roleModelName||''}}</div>
  19. <div class="text">绑定时间:{{item.createDate||''}}</div>
  20. </div>
  21. </div>
  22. <div class="lc_info" v-if="showInfo">
  23. <u--text :lines="3" :text="item.agent.systemPrompt||''" size="24rpx" color="#7C8592" lineHeight="40rpx"></u--text>
  24. </div>
  25. <div class="lc_btns adfac">
  26. <!-- <div class="lcb_pre" @tap="editRole(item)">角色编辑</div> -->
  27. <div class="lcb_pre" @tap="dislogRecord(item)">对话记录</div>
  28. <div class="lcb_pre" @tap="changeWifi(item)">配置网络</div>
  29. <div class="lcb_pre" @tap="unbindDevice(item)">解绑设备</div>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. export default {
  36. props:{
  37. item:{
  38. typeof:Object
  39. },
  40. showInfo:{
  41. typeof:Boolean,
  42. default:false
  43. }
  44. },
  45. data(){
  46. return {
  47. }
  48. },
  49. methods:{
  50. dislogRecord(item){
  51. this.$api.get(`/agent/${item.agentId}/${item.id}/sessions`,{page:1,limit:-1}).then(res=>{
  52. if(res.data.code!==0) return this.$showToast(res.data.msg)
  53. this.$api.get(`/agent/${item.agentId}/${item.id}/chat-history/${'17a9ae7e-601b-4566-96fc-7728e8342072'}`).then(res2=>{
  54. if(res2.data.code!==0) return this.$showToast(res2.data.msg)
  55. })
  56. })
  57. },
  58. editRole(item){
  59. this.$emit('editRole');
  60. uni.navigateTo({
  61. url:`/pagesRole/addRole?agentId=${item.agentId}&deviceId=${item.id}`
  62. })
  63. },
  64. changeWifi(item){
  65. uni.navigateTo({
  66. url:'/pagesMy/wifi'
  67. })
  68. },
  69. unbindDevice(item){
  70. uni.showModal({
  71. title:'温馨提示',
  72. content:'确定要解绑该设备吗?',
  73. success: (res) => {
  74. if(res.confirm){
  75. this.$api.post('/device/unbind',{deviceId:item.id}).then(res=>{
  76. if(res.data.code!==0) return this.$showToast(res.data.msg)
  77. this.$showToast('解绑成功');
  78. setTimeout(()=>{
  79. this.$emit('unbindSuccess')
  80. },1000)
  81. })
  82. }
  83. }
  84. })
  85. }
  86. }
  87. }
  88. </script>
  89. <style scoped lang="less">
  90. .box{
  91. position: relative;
  92. width: calc(100% - 60rpx);
  93. background: #FFFFFF;
  94. box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(0,0,0,0.04);
  95. border-radius: 32rpx;
  96. border: 1rpx solid #D9F159;
  97. box-sizing: border-box;
  98. }
  99. .l_box{
  100. width: 100%;
  101. padding: 49rpx 30rpx 40rpx;
  102. margin-top: 20rpx;
  103. .l_top{
  104. .lt_l{
  105. font-family: PingFang-SC, PingFang-SC;
  106. font-weight: bold;
  107. font-size: 32rpx;
  108. color: #111111;
  109. line-height: 40rpx;
  110. }
  111. .lt_r{
  112. image{
  113. width: 42rpx;
  114. height: 42rpx;
  115. margin-right: 34rpx;
  116. }
  117. .ltr_zt{
  118. font-family: PingFangSC, PingFang SC;
  119. font-weight: 400;
  120. font-size: 26rpx;
  121. line-height: 37rpx;
  122. padding-left: 22rpx;
  123. position: relative;
  124. &::before{
  125. content: '';
  126. width: 12rpx;
  127. height: 12rpx;
  128. border-radius: 50%;
  129. position: absolute;
  130. left: 0;
  131. top: 50%;
  132. margin-top: -6rpx;
  133. }
  134. &.zx{
  135. color: #1B50FF;
  136. &::before{
  137. background: #1B50FF;
  138. }
  139. }
  140. &.lx{
  141. color: #C7C7C7;
  142. &::before{
  143. background: #C7C7C7;
  144. }
  145. }
  146. }
  147. }
  148. }
  149. .l_content{
  150. border-top: 1rpx solid #E2E2E2;
  151. margin-top: 37rpx;
  152. padding-top: 36rpx;
  153. overflow: hidden;
  154. .lc_role{
  155. .lcr_l{
  156. width: 148rpx;
  157. height: 148rpx;
  158. border-radius: 50%;
  159. }
  160. .lcr_r{
  161. width: calc(100% - 148rpx);
  162. padding-left: 30rpx;
  163. box-sizing: border-box;
  164. p{
  165. font-family: PingFang-SC, PingFang-SC;
  166. font-weight: bold;
  167. font-size: 32rpx;
  168. color: #111111;
  169. line-height: 32rpx;
  170. overflow: hidden;
  171. white-space: nowrap;
  172. text-overflow: ellipsis;
  173. }
  174. .text{
  175. font-family: PingFangSC, PingFang SC;
  176. font-weight: 400;
  177. font-size: 24rpx;
  178. color: #7C8592;
  179. line-height: 24rpx;
  180. margin-top: 24rpx;
  181. }
  182. }
  183. }
  184. .lc_info{
  185. margin-top: 36rpx;
  186. font-family: PingFangSC, PingFang SC;
  187. font-weight: 400;
  188. font-size: 24rpx;
  189. color: #7C8592;
  190. line-height: 40rpx;
  191. }
  192. .lc_btns{
  193. margin-top: 62rpx;
  194. margin-left: -1rpx;
  195. overflow: hidden;
  196. .lcb_pre{
  197. width: calc(100% / 3);
  198. height: 37rpx;
  199. border-left: 1rpx solid #72832B;
  200. font-family: PingFang-SC, PingFang-SC;
  201. font-weight: bold;
  202. font-size: 26rpx;
  203. color: #72832B;
  204. line-height: 37rpx;
  205. text-align: center;
  206. }
  207. }
  208. }
  209. }
  210. </style>