index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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></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></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">
  23. {{}}
  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. this.$api.post('/device/unbind',{deviceId:item.id}).then(res=>{
  66. if(res.data.code!==0) return this.$showToast(res.data.msg)
  67. this.$showToast('解绑成功');
  68. setTimeout(()=>{
  69. this.$emit('unbindSuccess')
  70. },1000)
  71. })
  72. }
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style scoped lang="less">
  79. .box{
  80. position: relative;
  81. width: calc(100% - 60rpx);
  82. background: #FFFFFF;
  83. box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(0,0,0,0.04);
  84. border-radius: 32rpx;
  85. border: 1rpx solid #D9F159;
  86. box-sizing: border-box;
  87. }
  88. .l_box{
  89. width: 100%;
  90. padding: 49rpx 30rpx 40rpx;
  91. margin-top: 20rpx;
  92. .l_top{
  93. .lt_l{
  94. font-family: PingFang-SC, PingFang-SC;
  95. font-weight: bold;
  96. font-size: 32rpx;
  97. color: #111111;
  98. line-height: 40rpx;
  99. }
  100. .lt_r{
  101. image{
  102. width: 42rpx;
  103. height: 42rpx;
  104. margin-right: 34rpx;
  105. }
  106. .ltr_zt{
  107. font-family: PingFangSC, PingFang SC;
  108. font-weight: 400;
  109. font-size: 26rpx;
  110. line-height: 37rpx;
  111. padding-left: 22rpx;
  112. position: relative;
  113. &::before{
  114. content: '';
  115. width: 12rpx;
  116. height: 12rpx;
  117. border-radius: 50%;
  118. position: absolute;
  119. left: 0;
  120. top: 50%;
  121. margin-top: -6rpx;
  122. }
  123. &.zx{
  124. color: #1B50FF;
  125. &::before{
  126. background: #1B50FF;
  127. }
  128. }
  129. &.lx{
  130. color: #C7C7C7;
  131. &::before{
  132. background: #C7C7C7;
  133. }
  134. }
  135. }
  136. }
  137. }
  138. .l_content{
  139. border-top: 1rpx solid #E2E2E2;
  140. margin-top: 37rpx;
  141. padding-top: 36rpx;
  142. overflow: hidden;
  143. .lc_role{
  144. .lcr_l{
  145. width: 148rpx;
  146. height: 148rpx;
  147. border-radius: 50%;
  148. }
  149. .lcr_r{
  150. width: calc(100% - 148rpx);
  151. padding-left: 30rpx;
  152. box-sizing: border-box;
  153. p{
  154. font-family: PingFang-SC, PingFang-SC;
  155. font-weight: bold;
  156. font-size: 32rpx;
  157. color: #111111;
  158. line-height: 32rpx;
  159. overflow: hidden;
  160. white-space: nowrap;
  161. text-overflow: ellipsis;
  162. }
  163. .text{
  164. font-family: PingFangSC, PingFang SC;
  165. font-weight: 400;
  166. font-size: 24rpx;
  167. color: #7C8592;
  168. line-height: 24rpx;
  169. margin-top: 24rpx;
  170. }
  171. }
  172. }
  173. .lc_info{
  174. margin-top: 36rpx;
  175. font-family: PingFangSC, PingFang SC;
  176. font-weight: 400;
  177. font-size: 24rpx;
  178. color: #7C8592;
  179. line-height: 40rpx;
  180. }
  181. .lc_btns{
  182. margin-top: 62rpx;
  183. margin-left: -1rpx;
  184. overflow: hidden;
  185. .lcb_pre{
  186. width: calc(100% / 3);
  187. height: 37rpx;
  188. border-left: 1rpx solid #72832B;
  189. font-family: PingFang-SC, PingFang-SC;
  190. font-weight: bold;
  191. font-size: 26rpx;
  192. color: #72832B;
  193. line-height: 37rpx;
  194. text-align: center;
  195. }
  196. }
  197. }
  198. }
  199. </style>