123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <template>
- <view>
- <view class="device" v-for="item in devices" :key="item.code">
- <view class="col">
- <view class="switch">
- <switch checked color="#007AFE" @change="switchChange" />
- </view>
- <view class="list" @tap="showDetail" :data-code="item.code">查看 ></view>
- </view>
- <text class="title">{{item.name}}</text>
- <view class="content">
- <text>设备SN:{{item.sn}}</text>
- <text>设备类型:{{item.type}}</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- devices: [],
- }
- },
- onLoad(e) {
- console.log(e);
- uni.request({
- url: 'http://127.0.0.1:9999/device/list?gatewayCode=' + e.code,
- method: 'GET',
- data: {},
- success: res => {
- this.devices = res.data.data.devices;
- console.log(this.devices);
- },
- });
- },
- methods: {
- showDetail(e) {
- console.log(e);
- var code = e.currentTarget.dataset.code;
- uni.navigateTo({
- url: '/pages/device/deviceInfo/deviceInfo?code=' + code,
- });
- }
- }
- }
- </script>
- <style>
- .list {
- font-size: 28rpx;
- color: #007AFF;
- margin-right: 20rpx;
- margin-top: 85rpx;
- }
- .switch {
- transform: scale(0.6);
- }
- .col {
- float: right;
- }
- .device {
- width: 702rpx;
- height: 230rpx;
- background-color: white;
- margin-top: 30rpx;
- margin-left: 24rpx;
- border-radius: 10rpx;
- padding-top: 30rpx;
- }
- .content {
- display: flex;
- flex-direction: column;
- margin-top: 30rpx;
- margin-left: 30rpx;
- line-height: 60rpx;
- color: #444546;
- font-size: 28rpx;
- }
- .title {
- font-size: 36rpx;
- margin-left: 30rpx;
- color: #282828;
- font-weight: 600;
- }
- </style>
|