deviceList.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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" 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. handleLogout() {
  156. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  157. this.$store.dispatch('LogOut').then(() => {
  158. uni.setStorageSync("loginInfo",'');
  159. this.$tab.reLaunch('/pages/index')
  160. })
  161. })
  162. },
  163. unbind(qrcode){
  164. let self = this;
  165. this.$modal.confirm("确认解绑该设备?").then(res=>{
  166. unBind(qrcode).then(res=>{
  167. console.log('?>>>'+JSON.stringify(res))
  168. if(res.data){
  169. self.deviceList();
  170. }else{
  171. this.$modal.showToast("Device is offline.");
  172. }
  173. });
  174. })
  175. },
  176. i18(text){
  177. return i18(text)
  178. },
  179. getMore(){
  180. this.search.pageNum++;
  181. this.deviceList();
  182. },
  183. async deviceList() {
  184. deviceList().then(res=>{
  185. this.startText = "more"
  186. this.chargeList = res.data;
  187. if(this.chargeList.length == 1 && this.chargeList[0] == 1){
  188. this.detail(this.chargeList[0])
  189. }
  190. })
  191. },
  192. detail(item){
  193. if(item.status == 0){
  194. this.$modal.showToast("Device is offline.");
  195. return;
  196. }
  197. let qrcode = item.qrcode;
  198. let imei = item.imei;
  199. let ccid = item.ccid;
  200. uni.navigateTo({
  201. url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
  202. });
  203. },
  204. },
  205. created() {
  206. },
  207. };
  208. </script>
  209. <style>
  210. .container {
  211. background-image: url('../../static/images/new/starts/bg1.jpg');
  212. background-size: cover;
  213. background-repeat: no-repeat;
  214. inset: 0;
  215. position: absolute;
  216. }
  217. .list-item {
  218. margin: 0vw;
  219. margin-top: 15vh;
  220. }
  221. .item {
  222. color: aliceblue;
  223. box-shadow: 0px 5px 27px 0px rgba(94, 94, 94, 0.4);
  224. border-radius: 4px;
  225. background: linear-gradient(#565656, #050609);
  226. margin: 4vw;
  227. padding: 4vw;
  228. }
  229. .item-title {
  230. display: inline-block;
  231. float: left;
  232. }
  233. .item-status {
  234. display: inline-block;
  235. float: right;
  236. }
  237. .item-header {
  238. border-bottom: 1px solid lightgray;
  239. height: 4vh;
  240. font-size: 12px;
  241. }
  242. .item-body {
  243. padding-top: 4vw;
  244. line-height: 3vh;
  245. }
  246. .item-time {
  247. color: #545454;
  248. font-size: 12px;
  249. margin-bottom: 4px
  250. }
  251. .item-detail-btn{
  252. position: absolute;
  253. right: 0px;
  254. top:0px;
  255. text-decoration: underline;
  256. }
  257. .prop-item {
  258. position: relative;
  259. display: flex;
  260. flex-direction: row;
  261. height: 40px;
  262. line-height: 40px;
  263. margin: 0 20rpx;
  264. }
  265. .prop-item-left {
  266. color: #BCBCBF;
  267. ;
  268. width: 30%;
  269. font-size: 14px;
  270. //margin-left: 36px;
  271. }
  272. .prop-item-image {
  273. width: 15px;
  274. height: 15px;
  275. position: absolute;
  276. left: 2vw;
  277. top: 0.5vh;
  278. }
  279. .prop-item-right {
  280. position: absolute;
  281. right: 10rpx;
  282. top: 5rpx;
  283. color: #BCBCBF;
  284. }
  285. </style>