<template>
  <view class="flex-column">
    <device-item showBtn="true" :device="device ? device : defaultDevice" @onclick="goDeviceInfo()"></device-item>
    <text class="black-mudium-30rpx mt10 ml32">定时设置</text>
    <view class="flex-row alarm-layout">
      <view class="alarm">
        <image
          class="alarm-png"
          src="https://airsmart-photo1.oss-cn-shanghai.aliyuncs.com/wx/bg_device-alarm.png"
          mode="aspectFit"
        />
        <view class="alarm-content" hover-class="view-hover radius16">
          <text class="black-mudium-30rpx mb20">定时唤醒</text>
          <text class="black-normal-24rpx alarm-time">去设置</text>
          <image
            class="alarm-rightic right-ic"
            src="../../../../static/common/right.svg"
            mode="aspectFit"
          />
        </view>
      </view>
      <view class="alarm ml26" > 
		  <image
          class="alarm-png"
          src="https://airsmart-photo1.oss-cn-shanghai.aliyuncs.com/wx/bg_device-alarm.png"
          mode="aspectFit"
        />
        <view class="alarm-content" hover-class="view-hover radius16">
          <text class="black-mudium-30rpx mb20">定时休眠</text>
          <text class="black-normal-24rpx alarm-time">去设置</text>
          <image
            class="alarm-rightic right-ic"
            src="../../../../static/common/right.svg"
            mode="aspectFit"
          />
        </view>
	  </view>
    </view>

	<view class="flex-row item mt20" hover-class="view-hover">
		<text class="black-mudium-28rpx">网络</text>
		<view class="item-right">
			<image
            class="right-ic"
            src="../../../../static/common/right.svg"
            mode="aspectFit"
          />
		</view>
	</view>
	<view class="line align-center"></view>

	<view class="flex-row item">
		<text class="black-mudium-28rpx">IMEI</text>
		<text class="gray-normal-24rpx mr34">{{device ? device.imei : ""}}</text>
	</view>
	<view class="line align-center"></view>

	<view class="flex-row item">
		<text class="black-mudium-28rpx">序列号</text>
		<text class="gray-normal-24rpx mr34">{{uuid}}</text>
	</view>
	<view class="line align-center"></view>

	<view class="flex-row item" hover-class="view-hover">
		<text class="black-mudium-28rpx">数据流量</text>
		<view class="item-right">
			<image
            class="right-ic"
            src="../../../../static/common/right.svg"
            mode="aspectFit"
          />
		  <text class="gray-normal-24rpx mr18">unKnow</text>
		</view>
	</view>
	<view class="line align-center"></view>

	<view class="flex-row item"  hover-class="view-hover">
		<text class="black-mudium-28rpx">发现设备</text>
		<view class="item-right">
			<image
            class="right-ic"
            src="../../../../static/common/right.svg"
            mode="aspectFit"
          />
		  
		</view>
	</view>
	<view class="line align-center"></view>

	<view class="flex-row item">
		<text class="black-mudium-28rpx">当前固件版本</text>
		<text class="gray-normal-24rpx mr34">{{device ? device.Firmware : ""}}</text>
	</view>
	<view class="line align-center"></view>

	<view class="flex-row item">
		<text class="black-mudium-28rpx">最新固件版本</text>
		<text class="gray-normal-24rpx mr34">1.0</text>
	</view>
	
	<button class="btn btn-primary mt28 mb20" hover-class="btn-primary-hover">更新设备固件</button>
  </view>
</template>

<script>
import deviceItem from "../../../../components/device-manager/deviceItem/deviceItem.vue";
export default {
  components: { deviceItem },
  data() {
    return {
		uuid:'',
		defaultDevice:{
			devName: "猫王音响.Mate3",
          	ProdModel: "MW-M3",
		}
	};
  },
  methods: {
	  goDeviceInfo(){
		  uni.navigateTo({
		  	url:`../../../demo/mqtt/deviceInfo?uuid=${this.uuid}`
		  })
	  }
  },
  computed:{
	  device(){
		//   let device = this.$store.moduleMqtt.getters.getDeviceById(this.uuid)
		let device = this.$store.getters['moduleMqtt/getDeviceById'](this.uuid)
		  console.log(device);
		  return device
	  }
  },
  onLoad(option){
	  this.uuid = option.uuid
	  this.defaultDevice.devName = option.devName
	  this.defaultDevice.ProdModel = option.model
  }
};
</script>

<style>
.mt10 {
  margin-top: 10rpx;
}
.ml32{
 margin-left: 32rpx;
}
.alarm-layout {
  margin-top: 12rpx;
  justify-content: center;
}
.alarm {
  width: 44vw;
  height: 120rpx;
  background: #ffffff;
  box-shadow: 0px 0px 20px 0px rgba(213, 212, 212, 0.6);
  border-radius: 16rpx;
  filter: blur(0px);
  position: relative;
}
.radius16{
	 border-radius: 16rpx;
}
.alarm-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column-reverse;
  position: relative;
  align-items: center;
}
.ml100 {
  margin-left: 100rpx;
}
.ml26 {
  margin-left: 26rpx;
}
.mb20 {
  margin-bottom: 20rpx;
}
.mt20{
	margin-top: 20rpx;
}

.alarm-rightic {
  position: absolute;
  bottom: 28rpx;
  right: 80rpx;
}
.alarm-time {
  align-self: center;
  margin-bottom: 6rpx;
}
.alarm-png {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.item{
	height: 100rpx;
	justify-content: space-between;
	padding-left: 34rpx;
	padding-right: 34rpx;
	align-items: center;
}
.item-right{
	display: flex;
	flex-direction: row-reverse;
}
.right-ic{
	width: 13rpx;
  height: 21rpx;
  align-self: center;
}
.mr34{
	margin-right: 34rpx;
}
.mr18{
	margin-right: 18rpx;
}
.mt28{
	margin-top: 28rpx;
}
.align-center{
	align-self: center;
}
</style>
