device.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='设备管理'></cus-header>
  4. <template v-if="list.length">
  5. <div class="list" :style="{'height':'calc(100vh - '+(mt+100)+'px)'}">
  6. <u-list @scrolltolower="scrolltolower">
  7. <u-list-item v-for="(item, index) in list" :key="index">
  8. <div class="l_box box">
  9. <div class="l_top adfacjb">
  10. <div class="lt_l">我的设备:{{1}}</div>
  11. <div class="lt_r adfac">
  12. <image src="http://106.54.209.120:8188/static/wifi_on_mini.png" v-if="index===0"></image>
  13. <image src="http://106.54.209.120:8188/static/wifi_off_mini.png" v-else></image>
  14. <image src="http://106.54.209.120:8188/static/online_mini.png" v-if="index===0"></image>
  15. <image src="http://106.54.209.120:8188/static/offline_mini.png" v-else></image>
  16. <div class="ltr_zt" :class="{'zx':index===0,'lx':index===1}">{{index===0?'在线':'离线'}}</div>
  17. </div>
  18. </div>
  19. <div class="l_content">
  20. <div class="lc_role adfac">
  21. <image class="lcr_l" src="http://106.54.209.120:8188/static/avatar_default.png"></image>
  22. <div class="lcr_r">
  23. <p>{{'角色昵称'}}</p>
  24. <div class="text">角色模板:{{'英语老师'}}</div>
  25. <div class="text">绑定时间:{{'2025-05-25'}}</div>
  26. </div>
  27. </div>
  28. <div class="lc_btns adfac">
  29. <div class="lcb_pre">角色编辑</div>
  30. <div class="lcb_pre">更换网络</div>
  31. <div class="lcb_pre" @tap="unbindDevice">解绑设备</div>
  32. </div>
  33. </div>
  34. </div>
  35. </u-list-item>
  36. </u-list>
  37. </div>
  38. </template>
  39. <template v-else>
  40. <div class="empty adffcacjc" :style="{'height':'calc(100vh - '+(mt+100)+'px)'}">
  41. <image src="http://106.54.209.120:8188/static/empty_device.png"></image>
  42. <p>暂无绑定设备</p>
  43. </div>
  44. </template>
  45. <div class="btns adfacjb">
  46. <div class="zt_btn" @tap="scanBindDevice">扫码绑定设备</div>
  47. <div class="zt_btn" @tap="wifiBindDevice">配网并绑定设备</div>
  48. </div>
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. data(){
  54. return {
  55. list:[]
  56. }
  57. },
  58. methods:{
  59. scrolltolower(){
  60. },
  61. getList(){
  62. },
  63. scanBindDevice(){
  64. },
  65. wifiBindDevice(){
  66. this.list = [1,1,1,1];
  67. uni.navigateTo({
  68. url:'/pagesMy/deviceAdd'
  69. })
  70. },
  71. unbindDevice(){
  72. uni.showModal({
  73. title:'温馨提示',
  74. content:'确定要解绑该设备吗?',
  75. success: (res) => {
  76. this.$api.post('/device/unbind',{deviceId:item.id}).then(res=>{
  77. if(res.data.code!==0) return this.$showToast(res.data.msg)
  78. this.$showToast('解绑成功');
  79. setTimeout(()=>{
  80. this.getList();
  81. },1000)
  82. })
  83. }
  84. })
  85. }
  86. }
  87. }
  88. </script>
  89. <style scoped lang="less">
  90. .page{
  91. padding: 0 21rpx 172rpx;
  92. box-sizing: border-box;
  93. .box{
  94. position: relative;
  95. width: calc(100% - 60rpx);
  96. background: #FFFFFF;
  97. box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(0,0,0,0.04);
  98. border-radius: 32rpx;
  99. border: 1rpx solid #D9F159;
  100. box-sizing: border-box;
  101. }
  102. .list{
  103. position: relative;
  104. ::v-deep .u-list{
  105. width: 100%;
  106. height: 100% !important;
  107. }
  108. ::v-deep .u-list-item{
  109. width: 100%;
  110. }
  111. .l_box{
  112. width: 100%;
  113. padding: 49rpx 30rpx 40rpx;
  114. margin-top: 20rpx;
  115. .l_top{
  116. .lt_l{
  117. font-family: PingFang-SC, PingFang-SC;
  118. font-weight: bold;
  119. font-size: 32rpx;
  120. color: #111111;
  121. line-height: 40rpx;
  122. }
  123. .lt_r{
  124. image{
  125. width: 42rpx;
  126. height: 42rpx;
  127. margin-right: 34rpx;
  128. }
  129. .ltr_zt{
  130. font-family: PingFangSC, PingFang SC;
  131. font-weight: 400;
  132. font-size: 26rpx;
  133. line-height: 37rpx;
  134. padding-left: 22rpx;
  135. position: relative;
  136. &::before{
  137. content: '';
  138. width: 12rpx;
  139. height: 12rpx;
  140. border-radius: 50%;
  141. position: absolute;
  142. left: 0;
  143. top: 50%;
  144. margin-top: -6rpx;
  145. }
  146. &.zx{
  147. color: #1B50FF;
  148. &::before{
  149. background: #1B50FF;
  150. }
  151. }
  152. &.lx{
  153. color: #C7C7C7;
  154. &::before{
  155. background: #C7C7C7;
  156. }
  157. }
  158. }
  159. }
  160. }
  161. .l_content{
  162. border-top: 1rpx solid #E2E2E2;
  163. margin-top: 37rpx;
  164. padding-top: 36rpx;
  165. overflow: hidden;
  166. .lc_role{
  167. .lcr_l{
  168. width: 148rpx;
  169. height: 148rpx;
  170. border-radius: 50%;
  171. }
  172. .lcr_r{
  173. width: calc(100% - 148rpx);
  174. padding-left: 30rpx;
  175. box-sizing: border-box;
  176. p{
  177. font-family: PingFang-SC, PingFang-SC;
  178. font-weight: bold;
  179. font-size: 32rpx;
  180. color: #111111;
  181. line-height: 32rpx;
  182. overflow: hidden;
  183. white-space: nowrap;
  184. text-overflow: ellipsis;
  185. }
  186. .text{
  187. font-family: PingFangSC, PingFang SC;
  188. font-weight: 400;
  189. font-size: 24rpx;
  190. color: #7C8592;
  191. line-height: 24rpx;
  192. margin-top: 24rpx;
  193. }
  194. }
  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. }
  215. .empty{
  216. image{
  217. width: 64rpx;
  218. height: 66rpx;
  219. }
  220. p{
  221. font-family: PingFangSC, PingFang SC;
  222. font-weight: 400;
  223. font-size: 30rpx;
  224. color: #A6A6A6;
  225. line-height: 42rpx;
  226. text-align: center;
  227. margin-top: 30rpx;
  228. }
  229. }
  230. .btns{
  231. width: calc(100% - 60rpx);
  232. position: fixed;
  233. left: 20rpx;
  234. bottom: 64rpx;
  235. .zt_btn{
  236. width: calc(50% - 15rpx);
  237. }
  238. }
  239. }
  240. </style>