| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <template>
- <view class="device-card" @click="handleClick">
- <view class="device-card__status">
- <image
- class="img"
- :src="dataSource.devStatus == '1' ? successImg : errorImg"
- />
- <view
- class="status-text"
- :class="{ offline: dataSource.devStatus != '1' }"
- >{{ dataSource.devStatusName || '' }}</view
- >
- </view>
- <view class="device-card__header">
- <view class="device-card__title u-line-1">
- <view class="name">{{ dataSource.devName || '' }}</view>
- <view class="tips">{{ dataSource.devCode || '' }}</view>
- </view>
- </view>
- <view class="device-card__body">
- <view class="device-card__row">
- <view class="device-card__label">上报时间</view>
- <view class="device-card__value">{{ dataSource.devUpdateddate }}</view>
- </view>
- <view class="device-card__row">
- <view class="device-card__label">设备位置</view>
- <view class="device-card__value">{{
- `${dataSource.devProvincealign || dataSource.devProvince || ''} ${
- dataSource.devCityalign || dataSource.devCity || ''
- } ${dataSource.devDistrictalign || dataSource.devDistrict || ''}`
- }}</view>
- <view class="ntoNative" @tap="toNavigation">
- <image :src="location" class="icon"></image>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'DeviceCard',
- props: {
- dataSource: {
- type: Object,
- default() {
- return {};
- },
- },
- },
- data() {
- return {
- location:
- 'https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/zhongshui/location.svg',
- successImg:
- 'https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/zhongshui/success.png',
- errorImg:
- 'https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/zhongshui/error.png',
- };
- },
- methods: {
- handleClick() {},
- toNavigation() {
- this.$emit('navigation');
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .device-card {
- background: linear-gradient(180deg, #8ae4c93d 0%, #14a47800 25.54%), #fff;
- position: relative;
- padding: 28rpx;
- border-radius: 16rpx;
- background-color: #fff;
- margin-bottom: 32rpx;
- margin: 0 auto;
- &__status {
- position: absolute;
- right: 0;
- top: 0;
- width: 150rpx;
- height: 56rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- .img {
- position: absolute;
- width: 100%;
- height: 100%;
- right: 0;
- top: 0;
- overflow: hidden;
- }
- .status-text {
- font-size: 28rpx;
- color: #14a478;
- &.online {
- color: #14a478;
- }
- &.offline {
- color: #ff3546;
- }
- }
- }
- &__header {
- margin-bottom: 18rpx;
- }
- &__title {
- align-items: center;
- line-height: 48rpx;
- display: flex !important;
- .name {
- width: 140rpx;
- font-size: 32rpx;
- color: #042118;
- margin-right: 32rpx;
- // 超出隐藏
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- text-align: left;
- font-family: 'Source Han Sans CN VF';
- font-weight: 700;
- }
- .tips {
- width: 410rpx;
- font-size: 32rpx;
- color: #687a74;
- // 超出隐藏
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- text-align: left;
- }
- }
- &__body {
- padding: 16rpx 0;
- background-color: #fff;
- border-radius: 12rpx;
- }
- &__row {
- display: flex;
- align-items: center;
- margin-bottom: 16rpx;
- position: relative;
- &:last-child {
- margin-bottom: 0;
- }
- .ntoNative {
- position: absolute;
- right: 16rpx;
- width: 80rpx;
- height: 80rpx;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- .icon {
- width: 30rpx;
- height: 30rpx;
- }
- }
- }
- &__label {
- width: 140rpx;
- color: #9ba6a3;
- text-align: left;
- margin-right: 32rpx;
- }
- &__value {
- width: 420rpx;
- text-align: left;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- }
- </style>
|