deviceList.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <view class="container">
  3. <view style="height: 0vh;place-items: center;display: grid;">
  4. <image style="height: 3vh;width: 15vh;margin-top: 5vh;top: 3vh;"
  5. src="../../static/images/new/starts/login/backImg2.png"></image>
  6. <text @click="clickRight()" style="color: #ffffff;font-size: 15px;margin: 0 0 0 31vh;font-weight: bold;">· · ·</text>
  7. <view>
  8. <uni-drawer @change="changeDrawer" width="300" style="top:20vh;height: 100vh" ref="showRight" mode="right"
  9. :mask-click="true">
  10. <scroll-view style="background: linear-gradient(#000000, #5a5a58);font-size: 20px;height: 100%" scroll-y="true">
  11. <view class="prop-item" @click="handleLogout()">
  12. <!-- <view class="prop-item-image">
  13. <image :src="imgUrl+'/logout.png'" style="width: 30%;height:100%;" />
  14. </view> -->
  15. <view class="prop-item-right">{{i18('退出登录')}}</view>
  16. <view class="prop-item-left">
  17. <uni-icons type="forward" color="lightgray" size="16"></uni-icons>
  18. </view>
  19. </view>
  20. <u-divider/>
  21. <view class="prop-item" @click="skip(2)">
  22. <!-- <view class="prop-item-image">
  23. <image :src="imgUrl+'/logout.png'" style="width: 30%;height:100%;" />
  24. </view> -->
  25. <view class="prop-item-right">{{i18('关于我们')}}</view>
  26. <view class="prop-item-left">
  27. <uni-icons type="forward" color="lightgray" size="16"></uni-icons>
  28. </view>
  29. </view>
  30. <u-divider/>
  31. <view class="prop-item" @click="skip(3)">
  32. <!-- <view class="prop-item-image">
  33. <image :src="imgUrl+'/logout.png'" style="width: 30%;height:100%;" />
  34. </view> -->
  35. <view class="prop-item-right">{{i18('帮助')}}</view>
  36. <view class="prop-item-left">
  37. <uni-icons type="forward" color="lightgray" size="16"></uni-icons>
  38. </view>
  39. </view>
  40. <u-divider/>
  41. </scroll-view>
  42. </uni-drawer>
  43. </view>
  44. </view>
  45. <view class="list-item">
  46. <view class="item" v-for="item in chargeList" :key="item.id">
  47. <view class="item-header">
  48. <view class="item-title">
  49. {{i18('设备编号')}}:{{ item.qrcode }}
  50. </view>
  51. <view class="item-status">
  52. <uni-tag type="success" :text="i18('在线中')" v-if="item.status === 1"></uni-tag>
  53. <uni-tag type="default" :text="i18('已离线')" v-if="item.status === 0"></uni-tag>
  54. </view>
  55. </view>
  56. <view class="item-body">
  57. <view style="font-size: 12px; margin: 5px 0;position: relative">
  58. <view class="item-detail-btn" @click.stop="unbind(item.qrcode)">
  59. {{i18('解绑设备')}}
  60. </view>
  61. </view>
  62. </view>
  63. <view class="item-body" style ="height: 10vh;line-height: 10vh">
  64. <view style="font-size: 12px; margin: 5px 0;position: relative">
  65. {{i18('创建时间')}}:{{ item.createTime }}
  66. <view class="item-detail-btn" @click="detail(item)">
  67. {{i18('设备控制')}}
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view style="position:fixed;bottom:10px;display: flex;align-items: center;justify-content: center;text-align: center;left:0px;right:0px;">
  74. <view @click="skipPage(0)" style="margin:0px 10px;">
  75. <image src="@/static/images/new/starts/tabbar/one_off.png"
  76. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  77. </view>
  78. <view @click="skipPage(1)" style="margin:0px 10px;">
  79. <image src="@/static/images/new/starts/tabbar/two_on.png"
  80. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  81. </view>
  82. <view @click="skipPage(2)" style="margin:0px 10px;">
  83. <image src="@/static/images/new/starts/tabbar/three_off.png"
  84. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  85. </view>
  86. </view>
  87. </view>
  88. </template>
  89. <script>
  90. import { deviceList,unBind } from '@/api/device/device.js';
  91. import i18 from '@/utils/i18.js'
  92. export default {
  93. data() {
  94. return {
  95. startText:"more",
  96. search:{
  97. pageNum:1,
  98. pageSize:6,
  99. reasonable:true,
  100. },
  101. contentText: {
  102. contentdown: i18('点击查看更多'),
  103. contentrefresh: i18('加载中'),
  104. contentnomore: i18('没有更多'),
  105. },
  106. chargeList: [],
  107. clickRightTag: 0
  108. };
  109. },
  110. onShow(){
  111. uni.setNavigationBarTitle({
  112. title: this.$t('page.deviceList')
  113. })
  114. this.deviceList();
  115. },
  116. methods: {
  117. skipPage(type){
  118. if(type==0){
  119. uni.reLaunch({
  120. url:'/pages/index'
  121. })
  122. }else if(type==1){
  123. uni.reLaunch({
  124. url:'/pages/weitiandi/deviceList'
  125. })
  126. }else if(type==2){
  127. uni.reLaunch({
  128. url:'/pages/mine/index'
  129. })
  130. }
  131. },
  132. skip(){
  133. this.$modal.showToast("功能开发中..");
  134. },
  135. changeDrawer(event) {
  136. if (event) {
  137. // 抽屉打开时的逻辑
  138. this.clickRightTag = 1
  139. } else {
  140. // 抽屉关闭时的逻辑
  141. this.clickRightTag = 0
  142. }
  143. },
  144. //自定义头右操作函数
  145. clickRight() {
  146. //打开抽屉
  147. if (this.clickRightTag == 0) {
  148. this.$refs.showRight.open();
  149. this.clickRightTag = 1
  150. } else {
  151. this.$refs.showRight.close()
  152. this.clickRightTag = 0
  153. }
  154. },
  155. unbind(qrcode){
  156. let self = this;
  157. this.$modal.confirm("确认解绑该设备?").then(res=>{
  158. unBind(qrcode).then(res=>{
  159. console.log('?>>>'+JSON.stringify(res))
  160. if(res.data){
  161. self.deviceList();
  162. }else{
  163. this.$modal.showToast("Device is offline.");
  164. }
  165. });
  166. })
  167. },
  168. i18(text){
  169. return i18(text)
  170. },
  171. getMore(){
  172. this.search.pageNum++;
  173. this.deviceList();
  174. },
  175. async deviceList() {
  176. deviceList().then(res=>{
  177. this.startText = "more"
  178. this.chargeList = res.data;
  179. if(this.chargeList.length == 1 && this.chargeList[0] == 1){
  180. this.detail(this.chargeList[0])
  181. }
  182. })
  183. },
  184. detail(item){
  185. if(item.status == 0){
  186. this.$modal.showToast("Device is offline.");
  187. return;
  188. }
  189. let qrcode = item.qrcode;
  190. let imei = item.imei;
  191. let ccid = item.ccid;
  192. uni.navigateTo({
  193. url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
  194. });
  195. },
  196. },
  197. created() {
  198. },
  199. };
  200. </script>
  201. <style>
  202. .container {
  203. background-image: url('../../static/images/new/starts/bg1.jpg');
  204. background-size: cover;
  205. background-repeat: no-repeat;
  206. inset: 0;
  207. position: absolute;
  208. }
  209. .list-item {
  210. margin: 0vw;
  211. margin-top: 15vh;
  212. }
  213. .item {
  214. color: aliceblue;
  215. box-shadow: 0px 5px 27px 0px rgba(94, 94, 94, 0.4);
  216. border-radius: 4px;
  217. background: linear-gradient(#565656, #050609);
  218. margin: 4vw;
  219. padding: 4vw;
  220. }
  221. .item-title {
  222. display: inline-block;
  223. float: left;
  224. }
  225. .item-status {
  226. display: inline-block;
  227. float: right;
  228. }
  229. .item-header {
  230. border-bottom: 1px solid lightgray;
  231. height: 4vh;
  232. font-size: 12px;
  233. }
  234. .item-body {
  235. padding-top: 4vw;
  236. line-height: 3vh;
  237. }
  238. .item-time {
  239. color: #545454;
  240. font-size: 12px;
  241. margin-bottom: 4px
  242. }
  243. .item-detail-btn{
  244. position: absolute;
  245. right: 0px;
  246. top:0px;
  247. text-decoration: underline;
  248. }
  249. .prop-item {
  250. position: relative;
  251. display: flex;
  252. flex-direction: row;
  253. height: 40px;
  254. line-height: 40px;
  255. margin: 0 20rpx;
  256. }
  257. .prop-item-left {
  258. color: #BCBCBF;
  259. ;
  260. width: 30%;
  261. font-size: 14px;
  262. //margin-left: 36px;
  263. }
  264. .prop-item-image {
  265. width: 15px;
  266. height: 15px;
  267. position: absolute;
  268. left: 2vw;
  269. top: 0.5vh;
  270. }
  271. .prop-item-right {
  272. position: absolute;
  273. right: 10rpx;
  274. top: 5rpx;
  275. color: #BCBCBF;
  276. }
  277. </style>