autodoor.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="container">
  3. <!-- 建议放在外层 -->
  4. <u-navbar :title="name" @leftClick="backPage" class="top-nav">
  5. <view class="u-nav-slot top-nav" 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. };
  51. },
  52. onLoad(query) {
  53. // query 中包含传递过来的id
  54. const id = query.id;
  55. const name = query.name;
  56. //保存id到 data 中 可以在整个页面中使用
  57. this.itemId = id;
  58. this.name = name;
  59. },
  60. components: {
  61. },
  62. watch:{
  63. },
  64. created() {
  65. this.getDeviceInfo(this.itemId);
  66. },
  67. methods: {
  68. getDeviceInfo(ID){
  69. let IDString = String(ID); // 将 ID 转换为字符串
  70. new Promise((resolve, reject) => {
  71. api.getDeviceMonitor({devicetype: this.TabCur, ids:IDString}).then(response => {
  72. if(response.data.code ==200){
  73. this.tableData = response.data.result.msgTxt[0].datalist
  74. }else{
  75. resolve(response)
  76. }
  77. }).catch(error => {
  78. console.log("catch===>response",response)
  79. reject(error)
  80. })
  81. })
  82. },
  83. backPage(){
  84. uni.navigateBack({
  85. delta:1
  86. })
  87. }
  88. },
  89. }
  90. </script>
  91. <style>
  92. .top-nav{
  93. background-image: url(../../../../static/topnavbar.png) ;
  94. background-size: cover; /* 背景图片大小适应 */
  95. height: 100%;
  96. }
  97. .top-nav2{
  98. background-color:#ffffff
  99. }
  100. .main{
  101. margin-top: 100rpx;
  102. display: flex;
  103. flex-direction: column;
  104. }
  105. .button-grid {
  106. display: grid;
  107. grid-template-columns: repeat(4, 1fr);
  108. gap: 10px; /* 可以根据需要调整行列之间的间距 */
  109. }
  110. .flcard{
  111. padding: 20rpx;
  112. background-color: #ffffff;
  113. margin-bottom: 5rpx;
  114. }
  115. .additional-div {
  116. grid-column: span 2; /* 让附加内容跨越三列 */
  117. display: flex;
  118. align-items: center;
  119. }
  120. .checkbox-group {
  121. margin-left: 10px; /* 可以根据需要调整间距 */
  122. }
  123. .card{
  124. background-color: #ffffff;
  125. margin: auto;
  126. margin-top: 20rpx;
  127. width: 90%;
  128. height: 280rpx;
  129. border:1rpx solid #000000;
  130. border-radius: 20rpx;
  131. }
  132. </style>