This commit is contained in:
Double-_-Z 2025-08-07 20:37:50 +08:00
parent ebdd3c68f7
commit d5342f5fed
6 changed files with 182 additions and 213 deletions

View File

@ -1,28 +1,12 @@
<template> <template>
<view class="aircraft-equipment"> <view class="aircraft-equipment" :style="{backgroundImage: `url(${fileUrl+banner})`}">
<!-- 顶部区域 --> <view class="equipment-content">
<Topnav :topLevel="topLevel" title="爱尚云" /> <view class="top-abs" :style="{marginTop: CustomBar+'px'}">
<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> </view>
</view> <view class="device-item" v-for="(item, index) in deviceList" :key="index">
</view> <u-image class="device-image" :src="item.image||(ordFileUrl+defaultIcon)"
mode="widthFix" @click="preview(item.image||(ordFileUrl+defaultIcon))" />
<!-- 设备列表区域 -->
<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-info"> <view class="device-info">
<text class="device-name">{{ item.name }}</text> <text class="device-name">{{ item.name }}</text>
<text class="device-model">{{ item.model }}</text> <text class="device-model">{{ item.model }}</text>
@ -31,85 +15,77 @@
查看详情 查看详情
</button> </button>
</view> </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> <u-toast ref="uToast"></u-toast>
</view> </view>
</template> </template>
<script> <script>
import { tools } from "@/utils/utils.js"; import configService from '@/common/config.service.js';
import Topnav from "@/components/topnav/index.vue";
export default { export default {
// #ifdef MP // #ifdef MP
options: { options: {
styleIsolation: "shared" styleIsolation: "shared"
}, },
// #endif // #endif
components: { Topnav },
props: {
topLevel: {
type: Number,
default: 0
},
},
data() { data() {
return { 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", banner: "devicebg.png",
deviceList: [], deviceList: [],
}; //
form:{
current: 1,
size: 10,
// loadmoreloadingnomore
isFinish: 'nomore',
}, },
mounted() { };
this.init();
}, },
methods: { methods: {
// //
async init() { async init() {
// this.form = {size: 10,current: 1,isFinish: 'nomore'};
const devicesRes = await this.$api.getDevices(); await this.getDeviceList();
if (!devicesRes) { },
this.$refs.uToast.show({ async getDeviceList(){
type: 'error', this.form.isFinish = 'loading';
title: '设备列表获取失败!' let deviceRes = await this.$api.getDevices(this.form);
}); if(deviceRes){
return; 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';
const deviceList = []; }else{
for (const device of devicesRes.records) { this.$refs.uToast.show({type:'error',title: "设备列表获取失败!"});
try { this.form.isFinish = 'loadmore';
const detailRes = await this.$api.getDevicesDetail(device.id); }
if (detailRes) { },
// 使 //
const image = detailRes.deviceImages && detailRes.deviceImages.length > 0 getMore(){
? detailRes.deviceImages[0].fileFullPath if(this.form.isFinish === 'nomore') return;
: '/static/drone.png'; this.form.current++;
this.getDeviceList();
deviceList.push({ },
id: device.id, //
name: device.name, preview(url){
model: device.model, console.log(url);
image: image this.$util.tools.methods.lookImage(0,[url]);
});
}
} catch(err) {
console.error('获取设备详情失败:', err);
// 使
deviceList.push({
id: device.id,
name: device.name,
model: device.model,
image: '/static/drone.png'
});
}
}
this.deviceList = deviceList;
}, },
// //
goToDetail(id) { goToDetail(id) {
uni.navigateTo({ uni.navigateTo({
@ -122,54 +98,37 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.aircraft-equipment { .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%; 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 { .top-abs {
position: absolute; // 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;
display: flex; display: flex;
align-items: center; 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 { .device-image {
width: 142rpx; width: 142rpx;
@ -183,6 +142,7 @@ export default {
flex: 1; flex: 1;
margin-left: 24rpx; margin-left: 24rpx;
margin-bottom: 32rpx; margin-bottom: 32rpx;
.device-name { .device-name {
font-family: Source Han Sans SC; font-family: Source Han Sans SC;
font-weight: bold; font-weight: bold;
@ -199,19 +159,27 @@ export default {
color: #666666; color: #666666;
display: block; display: block;
} }
}
}
.detail-btn { .detail-btn {
border: none; border: none;
background: #fee547; background: #fee547;
border-radius: 12rpx; border-radius: 12rpx;
font-family: Source Han Sans SC; font-family: Source Han Sans SC;
font-weight: bold; font-weight: bold;
font-size: 30rpx; font-size: 30rpx;
color: #333333; 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> </style>

View File

@ -3,7 +3,7 @@
<!-- 顶部导航区 --> <!-- 顶部导航区 -->
<Topnav :topLevel="topLevel" title="设备详情" defaultBackColor="#333333" <Topnav :topLevel="topLevel" title="设备详情" defaultBackColor="#333333"
defaultNavTextColor="#333333" showBack /> defaultNavTextColor="#333333" showBack />
<view :style="{height: CustomBar + 'px'}" />
<!-- 主要内容区域 --> <!-- 主要内容区域 -->
<view class="detail-container"> <view class="detail-container">
<!-- 设备图片展示区 --> <!-- 设备图片展示区 -->
@ -88,7 +88,7 @@
<view class="action-title">新增记录</view> <view class="action-title">新增记录</view>
<u-icon <u-icon
class="action-close" class="action-close"
:name="fileUrl + closeIcon" :name="ordFileUrl + closeIcon"
size="32" size="32"
@click="showRecordPopup = false" @click="showRecordPopup = false"
/> />
@ -159,7 +159,7 @@ export default {
// #endif // #endif
deviceId: '', deviceId: '',
equipmentImages: [{ equipmentImages: [{
image: "/static/drone.png", image: this.fileUrl + "drone.png",
title: "默认图片" title: "默认图片"
}], }],
currentImageIndex: 0, currentImageIndex: 0,
@ -170,8 +170,9 @@ export default {
// //
equipmentDetail: {}, equipmentDetail: {},
maintenanceRecords: [], maintenanceRecords: [],
fileUrl: configService.fileUrl + 'aerocraft/equipment/', //
// //
fileUrl: configService.fileUrl + "aerocraft/order/", ordFileUrl: configService.fileUrl + "aerocraft/order/",
// //
triangle: "triangle.png", triangle: "triangle.png",
// //
@ -382,7 +383,7 @@ export default {
.equipment-images { .equipment-images {
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
padding-top:144rpx; // padding-top:144rpx;
background-color: #ebebf0; background-color: #ebebf0;
// margin-bottom: 20rpx; // margin-bottom: 20rpx;
} }

View File

@ -74,7 +74,7 @@ export default {
name: '路线', name: '路线',
icon: 'route.png', icon: 'route.png',
select: 'route-select.png', select: 'route-select.png',
navTitle: '路线' navTitle: '爱尚云'
}, },
{ {
name: '我的', name: '我的',

Binary file not shown.

Before

Width:  |  Height:  |  Size: 729 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB