<template>
	<view>
		<tm-nav-bar left-icon="arrow-left" title="我的设备" @clickLeft="back" />
		<view class="content">
			<view class="content-header">
				<view class="title">设备</view>
				<!-- <view class="add" @click="toAdd()">
					<image src="/static/image/add-icon.png" mode=""></image>
				</view> -->
			</view>
			<view class="content-item" v-for="(item, index) in deviceList">
				<view class="title">
					<text>绑定人: {{item.user.mobile}}</text>
				</view>
				<view class="desc">
					<text>蓝牙设备: {{item.device_id}}</text>
				</view>
			</view>
		</view>
		
		<navtab :current="1"></navtab>
	</view>
</template>

<script>
	import store from "@/store/index.js";
	export default {
		data() {
			return {
				deviceList: []
			}
		},
		onLoad() {
			this.$store.dispatch('api/getBindUserDeviceId').then(res => {
				this.deviceList = res;
				console.log(this.deviceList)
			})
		},
		methods: {
			// toAdd() {
			// 	uni.navigateTo({
			// 		url: '/pages/device/adddevice'
			// 	})
			// },
			clickLeft() {
				uni.navigateBack({
					delta: 1
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding: 20rpx 30rpx;
		margin-top: 20rpx;
		.content-header {
			margin-bottom: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 40rpx;
			font-weight: 800;
			.add {
				image {
					width: 50rpx;
					height: 50rpx;
				}
			}
		}
		.content-item {
			padding: 30rpx;
			border: none;
			border-radius: 30rpx ;
			-webkit-box-shadow: 0 0 60rpx 0 rgba(43,86,112,.1) ;
			box-shadow: 0 0 60rpx 0 rgba(43,86,112,.1);
			margin-bottom: 30rpx;
			.title {
				font-size: 36rpx;
				font-weight: 800;
				margin-bottom: 10rpx;
			}
			.desc {
				font-size: 30rpx;
				opacity: .6;
			}
		}
	}
</style>
