整合
This commit is contained in:
parent
ebdd3c68f7
commit
d5342f5fed
@ -1,28 +1,12 @@
|
||||
<template>
|
||||
<view class="aircraft-equipment">
|
||||
<!-- 顶部区域 -->
|
||||
<Topnav :topLevel="topLevel" title="爱尚云" />
|
||||
<view class="header">
|
||||
<view class="header-content">
|
||||
<u-image width="100%" :src="fileUrl + banner" mode="widthFix" />
|
||||
<view class="top-abs">
|
||||
<view class="title">我的设备</view>
|
||||
<view class="aircraft-equipment" :style="{backgroundImage: `url(${fileUrl+banner})`}">
|
||||
<view class="equipment-content">
|
||||
<view class="top-abs" :style="{marginTop: CustomBar+'px'}">
|
||||
我的设备
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 设备列表区域 -->
|
||||
<scroll-view scroll-y class="device-list">
|
||||
<view
|
||||
class="device-item"
|
||||
v-for="(item, index) in deviceList"
|
||||
:key="index"
|
||||
>
|
||||
<u-image
|
||||
class="device-image"
|
||||
:src="item.image"
|
||||
mode="widthFix"
|
||||
></u-image>
|
||||
<view class="device-item" v-for="(item, index) in deviceList" :key="index">
|
||||
<u-image class="device-image" :src="item.image||(ordFileUrl+defaultIcon)"
|
||||
mode="widthFix" @click="preview(item.image||(ordFileUrl+defaultIcon))" />
|
||||
<view class="device-info">
|
||||
<text class="device-name">{{ item.name }}</text>
|
||||
<text class="device-model">{{ item.model }}</text>
|
||||
@ -31,85 +15,77 @@
|
||||
查看详情
|
||||
</button>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<u-loadmore v-if="deviceList.length>0" @loadmore="getMore" :status="form.isFinish" color="#333333" marginTop="30" marginBottom="20" />
|
||||
<view class="device-empty" :style="{marginTop: CustomBar+100+'px'}" v-else>
|
||||
<u-empty text="暂无设备" mode="list"
|
||||
src="/static/empty.png" icon-size="300" font-size="40"
|
||||
margin-top="250"></u-empty>
|
||||
</view>
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tools } from "@/utils/utils.js";
|
||||
import Topnav from "@/components/topnav/index.vue";
|
||||
|
||||
import configService from '@/common/config.service.js';
|
||||
export default {
|
||||
// #ifdef MP
|
||||
options: {
|
||||
styleIsolation: "shared"
|
||||
},
|
||||
// #endif
|
||||
components: { Topnav },
|
||||
props: {
|
||||
topLevel: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fileUrl: "/static/", //静态资源基础路径
|
||||
// #ifdef MP
|
||||
// 微信小程序自定义导航栏参数
|
||||
StatusBar: this.StatusBar || 0,
|
||||
CustomBar: this.CustomBar || 0,
|
||||
// #endif
|
||||
fileUrl: configService.fileUrl + 'aerocraft/equipment/', //静态资源基础路径
|
||||
ordFileUrl: configService.fileUrl + 'aerocraft/order/',
|
||||
// 飞行任务默认图片
|
||||
defaultIcon: 'default.png',
|
||||
banner: "devicebg.png",
|
||||
deviceList: [],
|
||||
};
|
||||
// 翻页参数
|
||||
form:{
|
||||
current: 1,
|
||||
size: 10,
|
||||
// 是否结束——loadmore加载更多,loading加载中,nomore无更多
|
||||
isFinish: 'nomore',
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 初始化
|
||||
async init() {
|
||||
// 获取设备列表
|
||||
const devicesRes = await this.$api.getDevices();
|
||||
if (!devicesRes) {
|
||||
this.$refs.uToast.show({
|
||||
type: 'error',
|
||||
title: '设备列表获取失败!'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 为每个设备获取详情
|
||||
const deviceList = [];
|
||||
for (const device of devicesRes.records) {
|
||||
try {
|
||||
const detailRes = await this.$api.getDevicesDetail(device.id);
|
||||
if (detailRes) {
|
||||
// 使用第一张图片作为设备图片
|
||||
const image = detailRes.deviceImages && detailRes.deviceImages.length > 0
|
||||
? detailRes.deviceImages[0].fileFullPath
|
||||
: '/static/drone.png';
|
||||
|
||||
deviceList.push({
|
||||
id: device.id,
|
||||
name: device.name,
|
||||
model: device.model,
|
||||
image: image
|
||||
});
|
||||
}
|
||||
} catch(err) {
|
||||
console.error('获取设备详情失败:', err);
|
||||
// 使用基本信息添加到列表
|
||||
deviceList.push({
|
||||
id: device.id,
|
||||
name: device.name,
|
||||
model: device.model,
|
||||
image: '/static/drone.png'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.deviceList = deviceList;
|
||||
this.form = {size: 10,current: 1,isFinish: 'nomore'};
|
||||
await this.getDeviceList();
|
||||
},
|
||||
async getDeviceList(){
|
||||
this.form.isFinish = 'loading';
|
||||
let deviceRes = await this.$api.getDevices(this.form);
|
||||
if(deviceRes){
|
||||
const { records, size, total, current } = deviceRes;
|
||||
if(current == 1) this.deviceList = records || [];
|
||||
else this.deviceList.push(...records);
|
||||
this.form.isFinish = size*current >= total ? 'nomore' : 'loadmore';
|
||||
}else{
|
||||
this.$refs.uToast.show({type:'error',title: "设备列表获取失败!"});
|
||||
this.form.isFinish = 'loadmore';
|
||||
}
|
||||
},
|
||||
// 加载更多
|
||||
getMore(){
|
||||
if(this.form.isFinish === 'nomore') return;
|
||||
this.form.current++;
|
||||
this.getDeviceList();
|
||||
},
|
||||
// 预览
|
||||
preview(url){
|
||||
console.log(url);
|
||||
this.$util.tools.methods.lookImage(0,[url]);
|
||||
},
|
||||
|
||||
// 跳转到设备详情
|
||||
goToDetail(id) {
|
||||
uni.navigateTo({
|
||||
@ -122,54 +98,37 @@ export default {
|
||||
|
||||
<style scoped lang="scss">
|
||||
.aircraft-equipment {
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
|
||||
.header {
|
||||
background: linear-gradient(180deg, #fff7e6 0%, #fff9ed 100%);
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 261rpx;
|
||||
|
||||
.header-content {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
background-color: #f5f5f5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
padding-bottom: 30rpx;
|
||||
|
||||
.equipment-content {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
padding: 0 24rpx 0;
|
||||
|
||||
.top-abs {
|
||||
position: absolute;
|
||||
top: 72px;
|
||||
|
||||
.title {
|
||||
margin-left: 34rpx;
|
||||
font-family: Source Han Sans SC;
|
||||
font-weight: 800;
|
||||
font-size: 50rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.header-image {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.device-list {
|
||||
padding: 24rpx;
|
||||
padding-top: 0;
|
||||
height: calc(100vh - 160px);
|
||||
box-sizing: border-box;
|
||||
|
||||
.device-item {
|
||||
height: 200rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 26rpx;
|
||||
padding: 30rpx;
|
||||
// position: absolute;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-family: Source Han Sans SC;
|
||||
font-weight: 800;
|
||||
font-size: 44rpx;
|
||||
color: #333333;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.device-item {
|
||||
margin-top: 26rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
|
||||
.device-image {
|
||||
width: 142rpx;
|
||||
@ -183,6 +142,7 @@ export default {
|
||||
flex: 1;
|
||||
margin-left: 24rpx;
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.device-name {
|
||||
font-family: Source Han Sans SC;
|
||||
font-weight: bold;
|
||||
@ -199,19 +159,27 @@ export default {
|
||||
color: #666666;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.detail-btn {
|
||||
border: none;
|
||||
background: #fee547;
|
||||
border-radius: 12rpx;
|
||||
|
||||
font-family: Source Han Sans SC;
|
||||
font-weight: bold;
|
||||
font-size: 30rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.device-empty{
|
||||
width: 100%;
|
||||
&::v-deep .u-icon__label{
|
||||
margin-top: 24rpx !important;
|
||||
font-weight: 500;
|
||||
font-family: Source Han Sans SC;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -3,7 +3,7 @@
|
||||
<!-- 顶部导航区 -->
|
||||
<Topnav :topLevel="topLevel" title="设备详情" defaultBackColor="#333333"
|
||||
defaultNavTextColor="#333333" showBack />
|
||||
|
||||
<view :style="{height: CustomBar + 'px'}" />
|
||||
<!-- 主要内容区域 -->
|
||||
<view class="detail-container">
|
||||
<!-- 设备图片展示区 -->
|
||||
@ -88,7 +88,7 @@
|
||||
<view class="action-title">新增记录</view>
|
||||
<u-icon
|
||||
class="action-close"
|
||||
:name="fileUrl + closeIcon"
|
||||
:name="ordFileUrl + closeIcon"
|
||||
size="32"
|
||||
@click="showRecordPopup = false"
|
||||
/>
|
||||
@ -159,7 +159,7 @@ export default {
|
||||
// #endif
|
||||
deviceId: '',
|
||||
equipmentImages: [{
|
||||
image: "/static/drone.png",
|
||||
image: this.fileUrl + "drone.png",
|
||||
title: "默认图片"
|
||||
}],
|
||||
currentImageIndex: 0,
|
||||
@ -170,8 +170,9 @@ export default {
|
||||
// 设备详情
|
||||
equipmentDetail: {},
|
||||
maintenanceRecords: [],
|
||||
fileUrl: configService.fileUrl + 'aerocraft/equipment/', //静态资源基础路径
|
||||
// 订单页图标基础路径
|
||||
fileUrl: configService.fileUrl + "aerocraft/order/",
|
||||
ordFileUrl: configService.fileUrl + "aerocraft/order/",
|
||||
// 下拉三角
|
||||
triangle: "triangle.png",
|
||||
// 弹窗关闭图标
|
||||
@ -382,7 +383,7 @@ export default {
|
||||
.equipment-images {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
padding-top:144rpx;
|
||||
// padding-top:144rpx;
|
||||
background-color: #ebebf0;
|
||||
// margin-bottom: 20rpx;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ export default {
|
||||
name: '路线',
|
||||
icon: 'route.png',
|
||||
select: 'route-select.png',
|
||||
navTitle: '路线'
|
||||
navTitle: '爱尚云'
|
||||
},
|
||||
{
|
||||
name: '我的',
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 729 KiB |
BIN
static/drone.png
BIN
static/drone.png
Binary file not shown.
Before Width: | Height: | Size: 1.3 MiB |
Loading…
Reference in New Issue
Block a user