index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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="http://106.54.209.120:8188/static/wifi_on_mini.png" v-if="item.state===1"></image>
  7. <image src="http://106.54.209.120:8188/static/wifi_off_mini.png" v-else-if="item.state===0"></image>
  8. <image src="http://106.54.209.120:8188/static/online_mini.png" v-if="item.state===1"></image>
  9. <image src="http://106.54.209.120:8188/static/offline_mini.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="http://106.54.209.120:8188/static/avatar_default.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. {{item.agent.systemPrompt||''}}
  24. </div>
  25. <div class="lc_btns adfac">
  26. <div class="lcb_pre" @tap="editRole(item)">角色编辑</div>
  27. <div class="lcb_pre" @tap="changeWifi(item)">配置网络</div>
  28. <div class="lcb_pre" @tap="unbindDevice(item)">解绑设备</div>
  29. </div>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. export default {
  35. props:{
  36. item:{
  37. typeof:Object
  38. },
  39. showInfo:{
  40. typeof:Boolean,
  41. default:false
  42. }
  43. },
  44. data(){
  45. return {
  46. }
  47. },
  48. methods:{
  49. editRole(item){
  50. this.$emit('editRole');
  51. uni.navigateTo({
  52. url:`/pagesRole/addRole?agentId=${item.agentId}&deviceId=${item.id}`
  53. })
  54. },
  55. changeWifi(item){
  56. uni.navigateTo({
  57. url:'/pagesMy/wifi'
  58. })
  59. },
  60. unbindDevice(item){
  61. uni.showModal({
  62. title:'温馨提示',
  63. content:'确定要解绑该设备吗?',
  64. success: (res) => {
  65. if(res.confirm){
  66. this.$api.post('/device/unbind',{deviceId:item.id}).then(res=>{
  67. if(res.data.code!==0) return this.$showToast(res.data.msg)
  68. this.$showToast('解绑成功');
  69. setTimeout(()=>{
  70. this.$emit('unbindSuccess')
  71. },1000)
  72. })
  73. }
  74. }
  75. })
  76. }
  77. }
  78. }
  79. </script>
  80. <style scoped lang="less">
  81. .box{
  82. position: relative;
  83. width: calc(100% - 60rpx);
  84. background: #FFFFFF;
  85. box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(0,0,0,0.04);
  86. border-radius: 32rpx;
  87. border: 1rpx solid #D9F159;
  88. box-sizing: border-box;
  89. }
  90. .l_box{
  91. width: 100%;
  92. padding: 49rpx 30rpx 40rpx;
  93. margin-top: 20rpx;
  94. .l_top{
  95. .lt_l{
  96. font-family: PingFang-SC, PingFang-SC;
  97. font-weight: bold;
  98. font-size: 32rpx;
  99. color: #111111;
  100. line-height: 40rpx;
  101. }
  102. .lt_r{
  103. image{
  104. width: 42rpx;
  105. height: 42rpx;
  106. margin-right: 34rpx;
  107. }
  108. .ltr_zt{
  109. font-family: PingFangSC, PingFang SC;
  110. font-weight: 400;
  111. font-size: 26rpx;
  112. line-height: 37rpx;
  113. padding-left: 22rpx;
  114. position: relative;
  115. &::before{
  116. content: '';
  117. width: 12rpx;
  118. height: 12rpx;
  119. border-radius: 50%;
  120. position: absolute;
  121. left: 0;
  122. top: 50%;
  123. margin-top: -6rpx;
  124. }
  125. &.zx{
  126. color: #1B50FF;
  127. &::before{
  128. background: #1B50FF;
  129. }
  130. }
  131. &.lx{
  132. color: #C7C7C7;
  133. &::before{
  134. background: #C7C7C7;
  135. }
  136. }
  137. }
  138. }
  139. }
  140. .l_content{
  141. border-top: 1rpx solid #E2E2E2;
  142. margin-top: 37rpx;
  143. padding-top: 36rpx;
  144. overflow: hidden;
  145. .lc_role{
  146. .lcr_l{
  147. width: 148rpx;
  148. height: 148rpx;
  149. border-radius: 50%;
  150. }
  151. .lcr_r{
  152. width: calc(100% - 148rpx);
  153. padding-left: 30rpx;
  154. box-sizing: border-box;
  155. p{
  156. font-family: PingFang-SC, PingFang-SC;
  157. font-weight: bold;
  158. font-size: 32rpx;
  159. color: #111111;
  160. line-height: 32rpx;
  161. overflow: hidden;
  162. white-space: nowrap;
  163. text-overflow: ellipsis;
  164. }
  165. .text{
  166. font-family: PingFangSC, PingFang SC;
  167. font-weight: 400;
  168. font-size: 24rpx;
  169. color: #7C8592;
  170. line-height: 24rpx;
  171. margin-top: 24rpx;
  172. }
  173. }
  174. }
  175. .lc_info{
  176. margin-top: 36rpx;
  177. font-family: PingFangSC, PingFang SC;
  178. font-weight: 400;
  179. font-size: 24rpx;
  180. color: #7C8592;
  181. line-height: 40rpx;
  182. }
  183. .lc_btns{
  184. margin-top: 62rpx;
  185. margin-left: -1rpx;
  186. overflow: hidden;
  187. .lcb_pre{
  188. width: calc(100% / 3);
  189. height: 37rpx;
  190. border-left: 1rpx solid #72832B;
  191. font-family: PingFang-SC, PingFang-SC;
  192. font-weight: bold;
  193. font-size: 26rpx;
  194. color: #72832B;
  195. line-height: 37rpx;
  196. text-align: center;
  197. }
  198. }
  199. }
  200. }
  201. </style>