整合
This commit is contained in:
parent
ebdd3c68f7
commit
d5342f5fed
@ -1,217 +1,185 @@
|
|||||||
<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">
|
</view>
|
||||||
<u-image width="100%" :src="fileUrl + banner" mode="widthFix" />
|
<view class="device-item" v-for="(item, index) in deviceList" :key="index">
|
||||||
<view class="top-abs">
|
<u-image class="device-image" :src="item.image||(ordFileUrl+defaultIcon)"
|
||||||
<view class="title">我的设备</view>
|
mode="widthFix" @click="preview(item.image||(ordFileUrl+defaultIcon))" />
|
||||||
</view>
|
<view class="device-info">
|
||||||
</view>
|
<text class="device-name">{{ item.name }}</text>
|
||||||
</view>
|
<text class="device-model">{{ item.model }}</text>
|
||||||
|
</view>
|
||||||
<!-- 设备列表区域 -->
|
<button class="detail-btn" @click="goToDetail(item.id)">
|
||||||
<scroll-view scroll-y class="device-list">
|
查看详情
|
||||||
<view
|
</button>
|
||||||
class="device-item"
|
</view>
|
||||||
v-for="(item, index) in deviceList"
|
<u-loadmore v-if="deviceList.length>0" @loadmore="getMore" :status="form.isFinish" color="#333333" marginTop="30" marginBottom="20" />
|
||||||
:key="index"
|
<view class="device-empty" :style="{marginTop: CustomBar+100+'px'}" v-else>
|
||||||
>
|
<u-empty text="暂无设备" mode="list"
|
||||||
<u-image
|
src="/static/empty.png" icon-size="300" font-size="40"
|
||||||
class="device-image"
|
margin-top="250"></u-empty>
|
||||||
:src="item.image"
|
</view>
|
||||||
mode="widthFix"
|
</view>
|
||||||
></u-image>
|
<u-toast ref="uToast"></u-toast>
|
||||||
<view class="device-info">
|
</view>
|
||||||
<text class="device-name">{{ item.name }}</text>
|
|
||||||
<text class="device-model">{{ item.model }}</text>
|
|
||||||
</view>
|
|
||||||
<button class="detail-btn" @click="goToDetail(item.id)">
|
|
||||||
查看详情
|
|
||||||
</button>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
|
|
||||||
<u-toast ref="uToast"></u-toast>
|
|
||||||
</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 {
|
||||||
|
// #ifdef MP
|
||||||
export default {
|
options: {
|
||||||
// #ifdef MP
|
styleIsolation: "shared"
|
||||||
options: {
|
},
|
||||||
styleIsolation: "shared"
|
// #endif
|
||||||
},
|
data() {
|
||||||
// #endif
|
return {
|
||||||
components: { Topnav },
|
// #ifdef MP
|
||||||
props: {
|
// 微信小程序自定义导航栏参数
|
||||||
topLevel: {
|
StatusBar: this.StatusBar || 0,
|
||||||
type: Number,
|
CustomBar: this.CustomBar || 0,
|
||||||
default: 0
|
// #endif
|
||||||
},
|
fileUrl: configService.fileUrl + 'aerocraft/equipment/', //静态资源基础路径
|
||||||
},
|
ordFileUrl: configService.fileUrl + 'aerocraft/order/',
|
||||||
data() {
|
// 飞行任务默认图片
|
||||||
return {
|
defaultIcon: 'default.png',
|
||||||
fileUrl: "/static/", //静态资源基础路径
|
banner: "devicebg.png",
|
||||||
banner: "devicebg.png",
|
deviceList: [],
|
||||||
deviceList: [],
|
// 翻页参数
|
||||||
};
|
form:{
|
||||||
},
|
current: 1,
|
||||||
mounted() {
|
size: 10,
|
||||||
this.init();
|
// 是否结束——loadmore加载更多,loading加载中,nomore无更多
|
||||||
},
|
isFinish: 'nomore',
|
||||||
methods: {
|
},
|
||||||
// 初始化
|
};
|
||||||
async init() {
|
},
|
||||||
// 获取设备列表
|
methods: {
|
||||||
const devicesRes = await this.$api.getDevices();
|
// 初始化
|
||||||
if (!devicesRes) {
|
async init() {
|
||||||
this.$refs.uToast.show({
|
this.form = {size: 10,current: 1,isFinish: 'nomore'};
|
||||||
type: 'error',
|
await this.getDeviceList();
|
||||||
title: '设备列表获取失败!'
|
},
|
||||||
});
|
async getDeviceList(){
|
||||||
return;
|
this.form.isFinish = 'loading';
|
||||||
}
|
let deviceRes = await this.$api.getDevices(this.form);
|
||||||
|
if(deviceRes){
|
||||||
// 为每个设备获取详情
|
const { records, size, total, current } = deviceRes;
|
||||||
const deviceList = [];
|
if(current == 1) this.deviceList = records || [];
|
||||||
for (const device of devicesRes.records) {
|
else this.deviceList.push(...records);
|
||||||
try {
|
this.form.isFinish = size*current >= total ? 'nomore' : 'loadmore';
|
||||||
const detailRes = await this.$api.getDevicesDetail(device.id);
|
}else{
|
||||||
if (detailRes) {
|
this.$refs.uToast.show({type:'error',title: "设备列表获取失败!"});
|
||||||
// 使用第一张图片作为设备图片
|
this.form.isFinish = 'loadmore';
|
||||||
const image = detailRes.deviceImages && detailRes.deviceImages.length > 0
|
}
|
||||||
? detailRes.deviceImages[0].fileFullPath
|
},
|
||||||
: '/static/drone.png';
|
// 加载更多
|
||||||
|
getMore(){
|
||||||
deviceList.push({
|
if(this.form.isFinish === 'nomore') return;
|
||||||
id: device.id,
|
this.form.current++;
|
||||||
name: device.name,
|
this.getDeviceList();
|
||||||
model: device.model,
|
},
|
||||||
image: image
|
// 预览
|
||||||
});
|
preview(url){
|
||||||
}
|
console.log(url);
|
||||||
} catch(err) {
|
this.$util.tools.methods.lookImage(0,[url]);
|
||||||
console.error('获取设备详情失败:', err);
|
},
|
||||||
// 使用基本信息添加到列表
|
// 跳转到设备详情
|
||||||
deviceList.push({
|
goToDetail(id) {
|
||||||
id: device.id,
|
uni.navigateTo({
|
||||||
name: device.name,
|
url: `/aircraft/server/equipment/equipmentDetail?id=${id}`,
|
||||||
model: device.model,
|
});
|
||||||
image: '/static/drone.png'
|
},
|
||||||
});
|
},
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
this.deviceList = deviceList;
|
|
||||||
},
|
|
||||||
|
|
||||||
// 跳转到设备详情
|
|
||||||
goToDetail(id) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/aircraft/server/equipment/equipmentDetail?id=${id}`,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.aircraft-equipment {
|
.aircraft-equipment {
|
||||||
min-height: 100vh;
|
height: 100%;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
padding-bottom: 30rpx;
|
||||||
|
|
||||||
.header {
|
.equipment-content {
|
||||||
background: linear-gradient(180deg, #fff7e6 0%, #fff9ed 100%);
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
padding: 0 24rpx 0;
|
||||||
height: 261rpx;
|
|
||||||
|
|
||||||
.header-content {
|
.top-abs {
|
||||||
position: relative;
|
// position: absolute;
|
||||||
height: 100%;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-family: Source Han Sans SC;
|
||||||
|
font-weight: 800;
|
||||||
|
font-size: 44rpx;
|
||||||
|
color: #333333;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.top-abs {
|
.device-item {
|
||||||
position: absolute;
|
margin-top: 26rpx;
|
||||||
top: 72px;
|
background: #ffffff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 30rpx;
|
||||||
|
|
||||||
.title {
|
.device-image {
|
||||||
margin-left: 34rpx;
|
width: 142rpx;
|
||||||
font-family: Source Han Sans SC;
|
height: 142rpx;
|
||||||
font-weight: 800;
|
background: #f3f3f3;
|
||||||
font-size: 50rpx;
|
border-radius: 12rpx;
|
||||||
color: #333333;
|
border: 2rpx solid #cccccc;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.header-image {
|
.device-info {
|
||||||
position: absolute;
|
flex: 1;
|
||||||
right: 0;
|
margin-left: 24rpx;
|
||||||
bottom: 0;
|
margin-bottom: 32rpx;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.device-list {
|
.device-name {
|
||||||
padding: 24rpx;
|
font-family: Source Han Sans SC;
|
||||||
padding-top: 0;
|
font-weight: bold;
|
||||||
height: calc(100vh - 160px);
|
font-size: 36rpx;
|
||||||
box-sizing: border-box;
|
color: #333333;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.device-item {
|
.device-model {
|
||||||
height: 200rpx;
|
font-family: Source Han Sans SC;
|
||||||
background: #ffffff;
|
font-weight: 400;
|
||||||
border-radius: 16rpx;
|
font-size: 32rpx;
|
||||||
margin-bottom: 26rpx;
|
color: #666666;
|
||||||
padding: 30rpx;
|
display: block;
|
||||||
display: flex;
|
}
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.device-image {
|
}
|
||||||
width: 142rpx;
|
.detail-btn {
|
||||||
height: 142rpx;
|
border: none;
|
||||||
background: #f3f3f3;
|
background: #fee547;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
border: 2rpx solid #cccccc;
|
font-family: Source Han Sans SC;
|
||||||
}
|
font-weight: bold;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.device-info {
|
.device-empty{
|
||||||
flex: 1;
|
width: 100%;
|
||||||
margin-left: 24rpx;
|
&::v-deep .u-icon__label{
|
||||||
margin-bottom: 32rpx;
|
margin-top: 24rpx !important;
|
||||||
.device-name {
|
font-weight: 500;
|
||||||
font-family: Source Han Sans SC;
|
font-family: Source Han Sans SC;
|
||||||
font-weight: bold;
|
}
|
||||||
font-size: 36rpx;
|
}
|
||||||
color: #333333;
|
}
|
||||||
display: block;
|
|
||||||
margin-bottom: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.device-model {
|
|
||||||
font-family: Source Han Sans SC;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 32rpx;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="equipment-detail">
|
<view class="equipment-detail">
|
||||||
<!-- 顶部导航区 -->
|
<!-- 顶部导航区 -->
|
||||||
<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;
|
||||||
}
|
}
|
||||||
|
@ -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: '我的',
|
||||||
|
@ -38,7 +38,7 @@ const install = (Vue, vm) => {
|
|||||||
// 设备管理
|
// 设备管理
|
||||||
vm.$api.obtainDeviceList = async (params = {}) => await vm.$u.get('/api/dataDropdown/obtainDeviceList',params);// 获取设备下拉列表
|
vm.$api.obtainDeviceList = async (params = {}) => await vm.$u.get('/api/dataDropdown/obtainDeviceList',params);// 获取设备下拉列表
|
||||||
vm.$api.getDevices = async (params = {}) => await vm.$u.get('/aircraft/device/page',params);// 获取设备列表
|
vm.$api.getDevices = async (params = {}) => await vm.$u.get('/aircraft/device/page',params);// 获取设备列表
|
||||||
vm.$api.getDevicesDetail = async (id) => await vm.$u.get(`/aircraft/device/${id}`);// 获取设备详情
|
vm.$api.getDevicesDetail = async (id) => await vm.$u.get(`/aircraft/device/${id}`);// 获取设备详情
|
||||||
vm.$api.getMaintenanceRecords = async (params = {}) => await vm.$u.get('/aircraft/maintenance/page',params);// 获取设备维保记录
|
vm.$api.getMaintenanceRecords = async (params = {}) => await vm.$u.get('/aircraft/maintenance/page',params);// 获取设备维保记录
|
||||||
vm.$api.addMaintenanceRecord = async (params = {}) => await vm.$u.post('/aircraft/maintenance',params);// 新增设备维保记录
|
vm.$api.addMaintenanceRecord = async (params = {}) => await vm.$u.post('/aircraft/maintenance',params);// 新增设备维保记录
|
||||||
|
|
||||||
|
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