index.vue 5.6 KB

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