index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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: 'cx-mxb-wifi',
  81. });
  82. xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
  83. setTimeout(()=>{
  84. this.$emit('unbindSuccess')
  85. },1000)
  86. })
  87. }
  88. }
  89. })
  90. },
  91. funListenDeviceMsgEvent: function(options) {
  92. let that = this
  93. switch (options.type) {
  94. case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
  95. that.connected = options.result
  96. if (!options.result) {
  97. console.log(options,'options')
  98. }
  99. break;
  100. }
  101. }
  102. }
  103. }
  104. </script>
  105. <style scoped lang="less">
  106. .box{
  107. position: relative;
  108. width: calc(100% - 60rpx);
  109. background: #FFFFFF;
  110. box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(0,0,0,0.04);
  111. border-radius: 32rpx;
  112. border: 1rpx solid #D9F159;
  113. box-sizing: border-box;
  114. }
  115. .l_box{
  116. width: 100%;
  117. padding: 49rpx 30rpx 40rpx;
  118. margin-top: 20rpx;
  119. .l_top{
  120. .lt_l{
  121. font-family: PingFang-SC, PingFang-SC;
  122. font-weight: bold;
  123. font-size: 32rpx;
  124. color: #111111;
  125. line-height: 40rpx;
  126. }
  127. .lt_r{
  128. image{
  129. width: 42rpx;
  130. height: 42rpx;
  131. margin-right: 34rpx;
  132. }
  133. .ltr_zt{
  134. font-family: PingFangSC, PingFang SC;
  135. font-weight: 400;
  136. font-size: 26rpx;
  137. line-height: 37rpx;
  138. padding-left: 22rpx;
  139. position: relative;
  140. &::before{
  141. content: '';
  142. width: 12rpx;
  143. height: 12rpx;
  144. border-radius: 50%;
  145. position: absolute;
  146. left: 0;
  147. top: 50%;
  148. margin-top: -6rpx;
  149. }
  150. &.zx{
  151. color: #1B50FF;
  152. &::before{
  153. background: #1B50FF;
  154. }
  155. }
  156. &.lx{
  157. color: #C7C7C7;
  158. &::before{
  159. background: #C7C7C7;
  160. }
  161. }
  162. }
  163. }
  164. }
  165. .l_content{
  166. border-top: 1rpx solid #E2E2E2;
  167. margin-top: 37rpx;
  168. padding-top: 36rpx;
  169. overflow: hidden;
  170. .lc_role{
  171. .lcr_l{
  172. width: 148rpx;
  173. height: 148rpx;
  174. border-radius: 50%;
  175. }
  176. .lcr_r{
  177. width: calc(100% - 148rpx);
  178. padding-left: 30rpx;
  179. box-sizing: border-box;
  180. p{
  181. font-family: PingFang-SC, PingFang-SC;
  182. font-weight: bold;
  183. font-size: 32rpx;
  184. color: #111111;
  185. line-height: 32rpx;
  186. overflow: hidden;
  187. white-space: nowrap;
  188. text-overflow: ellipsis;
  189. }
  190. .text{
  191. font-family: PingFangSC, PingFang SC;
  192. font-weight: 400;
  193. font-size: 24rpx;
  194. color: #7C8592;
  195. line-height: 24rpx;
  196. margin-top: 24rpx;
  197. }
  198. }
  199. }
  200. .lc_info{
  201. margin-top: 36rpx;
  202. font-family: PingFangSC, PingFang SC;
  203. font-weight: 400;
  204. font-size: 24rpx;
  205. color: #7C8592;
  206. line-height: 40rpx;
  207. }
  208. .lc_btns{
  209. margin-top: 62rpx;
  210. margin-left: -1rpx;
  211. overflow: hidden;
  212. .lcb_pre{
  213. width: calc(100% / 3);
  214. height: 37rpx;
  215. border-left: 1rpx solid #72832B;
  216. font-family: PingFang-SC, PingFang-SC;
  217. font-weight: bold;
  218. font-size: 26rpx;
  219. color: #72832B;
  220. line-height: 37rpx;
  221. text-align: center;
  222. }
  223. }
  224. }
  225. }
  226. </style>