| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <template>
- <view class="device-card__body">
- <view class="device-card">
- <view :class=" dataSource.status == 1 ?'online-status':'offline-status'">{{ dataSource.status === 1 ? '在线' : '离线' }}</view>
- <view class="device-card__title">设备ID</view>
- <view class="device-card__content">
- <text class="device-id-text">{{ dataSource.id }}</text>
- <img class="copy-icon" :src="copy" @click="copyDeviceId"/>
- </view>
- </view>
- <view class="device-card">
- <view class="device-card__title">上报时间</view>
- <view class="device-card__content">{{ dataSource.uptime | timeFormat()}}</view>
- </view>
- <view class="device-card">
- <view class="device-card__title">设备位置</view>
- <view class="device-card__content address">{{ dataSource.address || '-' }}</view>
- </view>
- </view>
- </template>
- <script>
- import copy from '../assets/copy.png';
- export default {
- props: {
- dataSource: {
- type: Object,
- default: () => ({})
- }
- },
- data() {
- return {
- copy,
- title: ''
- }
- },
- methods: {
- copyDeviceId() {
- uni.setClipboardData({
- data: this.deviceId,
- success: () => {
- uni.showToast({
- title: '复制成功',
- icon: 'success'
- })
- }
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .device-card__body {
- display: flex;
- padding: 16px 12px;
- flex-direction: column;
- align-items: flex-start;
- gap: 8px;
- border-radius: 8px;
- background: linear-gradient(180deg, #EFF 0%, #FFF 23.56%);
- margin-top: 34rpx;
- position: relative;
- .device-card {
- display: flex;
- gap: 16px;
- .device-card__title {
- width: 136rpx;
- color: #4E5969;
- font-size: 14px;
- font-style: normal;
- font-weight: 400;
- text-align: right;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- }
- .online-status {
- width: 136rpx;
- height: 56rpx;
- line-height: 56rpx;
- position: absolute;
- text-align: center;
- top: 0;
- right: 0;
- background: url('../assets/online.png') no-repeat center center;
- background-size: 100% 100%;
- color: #0bbc58;
- font-family: "Source Han Sans CN VF";
- font-size: 28rpx;
- }
- .offline-status{
- width: 136rpx;
- height: 56rpx;
- line-height: 56rpx;
- position: absolute;
- text-align: center;
- top: 0;
- right: 0;
- background: url('../assets/offline.png') no-repeat center center;
- background-size: 100% 100%;
- color: #ff3546;
- font-family: "Source Han Sans CN VF";
- font-size: 28rpx;
- }
- .device-card__content {
- color: #4E5969;
- font-size: 14px;
- font-style: normal;
- font-weight: 400;
- display: flex;
- align-items: center;
- gap: 8rpx;
- .device-id-text {
- flex: 1;
- }
- .copy-icon {
- font-family: 'iconfont';
- font-size: 32rpx;
- color: #86909C;
- cursor: pointer;
- width: 28rpx;
- height: 28rpx;
- &:active {
- opacity: 0.6;
- }
- }
- }
- .address {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- }
- </style>
|