autodoor.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="container">
  3. <!-- 建议放在外层 -->
  4. <u-navbar :title="name" @leftClick="backPage" :bgImage="backPic" >
  5. <view class="u-nav-slot" slot="left">
  6. <u-icon name="arrow-left" size="20" >
  7. </u-icon>
  8. </view>
  9. </u-navbar>
  10. <view class="main">
  11. <view class="u-page" >
  12. <div class="button-grid flcard">
  13. <u-button type="primary" shape="circle" text="打开前门"></u-button>
  14. <u-button type="primary" shape="circle" text="关闭前门"></u-button>
  15. <u-button type="primary" shape="circle" text="打开后门"></u-button>
  16. <u-button type="primary" shape="circle" text="关闭后门"></u-button>
  17. <u-button type="primary" shape="circle" text="打开前后门"></u-button>
  18. <u-button type="primary" shape="circle" text="关闭前后门"></u-button>
  19. <div class="additional-div">
  20. <span>控制模式:</span>
  21. <u-checkbox-group
  22. v-model="checked"
  23. iconPlacement="left"
  24. placement="row"
  25. >
  26. <u-checkbox type="primary" shape="circle" label="就地" style="margin-right: 20rpx;"></u-checkbox>
  27. <u-checkbox type="primary" shape="circle" label="远程"></u-checkbox>
  28. </u-checkbox-group>
  29. </div>
  30. </div>
  31. <div class="flcard">
  32. 测试 两扇风门
  33. </div>
  34. <div class="flcard">
  35. </div>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import api from "@/api/api";
  42. export default {
  43. data() {
  44. return {
  45. tableData:[],
  46. itemId: '' ,// 初始化 itemId
  47. name: '' ,// 初始化 name
  48. TabCur: "gate",
  49. checked: [],
  50. backPic:"url(../../../../static/topnavbar.png)",
  51. };
  52. },
  53. onLoad(query) {
  54. // query 中包含传递过来的id
  55. const id = query.id;
  56. const name = query.name;
  57. //保存id到 data 中 可以在整个页面中使用
  58. this.itemId = id;
  59. this.name = name;
  60. },
  61. components: {
  62. },
  63. watch:{
  64. },
  65. created() {
  66. this.getDeviceInfo(this.itemId);
  67. },
  68. methods: {
  69. getDeviceInfo(ID){
  70. let IDString = String(ID); // 将 ID 转换为字符串
  71. new Promise((resolve, reject) => {
  72. api.getDeviceMonitor({devicetype: this.TabCur, ids:IDString}).then(response => {
  73. if(response.data.code ==200){
  74. this.tableData = response.data.result.msgTxt[0].datalist
  75. }else{
  76. resolve(response)
  77. }
  78. }).catch(error => {
  79. console.log("catch===>response",response)
  80. reject(error)
  81. })
  82. })
  83. },
  84. backPage(){
  85. uni.navigateBack({
  86. delta:1
  87. })
  88. }
  89. },
  90. }
  91. </script>
  92. <style>
  93. .top-nav{
  94. background-image: url(../../../../static/topnavbar.png) ;
  95. background-size: cover; /* 背景图片大小适应 */
  96. height: 100%;
  97. }
  98. .top-nav2{
  99. background-color:#ffffff
  100. }
  101. .main{
  102. margin-top: 100rpx;
  103. display: flex;
  104. flex-direction: column;
  105. }
  106. .button-grid {
  107. display: grid;
  108. grid-template-columns: repeat(4, 1fr);
  109. gap: 10px; /* 可以根据需要调整行列之间的间距 */
  110. }
  111. .flcard{
  112. padding: 20rpx;
  113. background-color: #ffffff;
  114. margin-bottom: 5rpx;
  115. }
  116. .additional-div {
  117. grid-column: span 2; /* 让附加内容跨越三列 */
  118. display: flex;
  119. align-items: center;
  120. }
  121. .checkbox-group {
  122. margin-left: 10px; /* 可以根据需要调整间距 */
  123. }
  124. .card{
  125. background-color: #ffffff;
  126. margin: auto;
  127. margin-top: 20rpx;
  128. width: 90%;
  129. height: 280rpx;
  130. border:1rpx solid #000000;
  131. border-radius: 20rpx;
  132. }
  133. </style>