1
0
forked from dyf/APP

6075页面功能开发

This commit is contained in:
fengerli
2025-11-08 10:33:00 +08:00
parent b8ce1621b4
commit 968d7a613d
6 changed files with 153 additions and 55 deletions

62
api/6075/6075.js Normal file
View File

@ -0,0 +1,62 @@
import request from '@/utils/request'
export function deviceDetail(id) {
return request({
url: `/app/bjq6075/device/${id}`,
method: 'get',
})
}
// 获取设备分享详细信息
export function deviceShareId(id) {
return request({
url: `/app/bjq6075/device/getShareInfo/${id}`,
method: 'get',
})
}
// 人员信息登记
export function registerPersonInfo(data) {
return request({
url: `/app/bjq6075/device/registerPersonInfo`,
method: 'post',
data: data
})
}
// 发送信息
export function deviceSendMessage(data) {
return request({
url: `/app/bjq6075/device/sendMessage`,
method: 'post',
data: data
})
}
// 灯光模式设置
export function lightModeSettings(data) {
return request({
url: `/app/bjq6075/device/lightModeSettings`,
method: 'post',
data: data
})
}
// 激光模式设置
export function laserModeSettings(data) {
return request({
url: `/app/bjq6075/device/laserModeSettings`,
method: 'post',
data: data
})
}
// 灯光亮度设置
export function lightBrightnessSettings(data) {
return request({
url: `/app/bjq6075/device/lightBrightnessSettings`,
method: 'post',
data: data
})
}
// 地图逆解析
export function mapReverseGeocoding(data) {
return request({
url: `/app/bjq6075/device/mapReverseGeocoding`,
method: 'post',
data: data
})
}

View File

@ -2,7 +2,7 @@
const config = {
// 开发环境
development: {
BASE_URL: 'http://192.168.110.56:8000',
BASE_URL: 'http://192.168.2.23:8000',
API_PREFIX: '',
// MQTT 配置
MQTT_HOST: 'www.cnxhyc.com',

View File

@ -8,7 +8,7 @@
<custom-navbar :title="navTitle" :showBack="true" color="#FFFFFF" :rightIcons="[
{src: '/static/images/210/ls.png'},
...(isRightIconVisible ? [{src: '/static/images/common/shape.png'}] : [])
]" @right-click="shareUp" @icon-click="handleIconClick"></custom-navbar>
]" @icon-click="handleIconClick"></custom-navbar>
<view class="device-detail-container" :style="{ paddingTop: navBarHeight + 'px' }">
<!-- 设备电量信息 -->
@ -40,28 +40,29 @@
<view class="info-card">
<view class="info-row">
<text class="info-label">IMEI号</text>
<text class="info-value status-running">123488756</text>
<text class="info-value status-running">{{deviceInfo.deviceImei}}</text>
</view>
<view class="info-row">
<text class="info-label">设备状态</text>
<text class="info-value status-running">运行中</text>
<text class="info-value status-running">{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus === 2 ? '故障' : '在线' }}</text>
</view>
<view class="info-row">
<text class="info-label">定位信息</text>
<view class="info-value status-running" @click="gpsPosition">
<view class="info-value status-running">114.72 30.28</view>
<view class="info-value status-running"> {{ deviceInfo && deviceInfo.longitude ? Number(deviceInfo.longitude).toFixed(4) : '' }}
{{ deviceInfo && deviceInfo.latitude ? Number(deviceInfo.latitude).toFixed(4) : '' }}</view>
<view class="info-value status-running">
<uni-icons @click="toggleForm" type="location" size="17"
color="rgba(255, 255, 255, 0.8)" style="vertical-align: bottom;" />
深圳市龙华区富源晟
{{ deviceInfo.address || '/'}}
</view>
</view>
</view>
</view>
<view class="info-card">
<view class="info-row">
<text class="info-label">海拔高度 2666m</text>
<text class="info-value status-running">相对高度123m</text>
<text class="info-label">海拔高度 {{deviceInfo.altitude}}m</text>
<text class="info-value status-running">相对高度{{deviceInfo.relativeAltitude}}m</text>
</view>
</view>
<!-- 灯光模式选择 -->
@ -95,11 +96,11 @@
</view>
</view>
<view class="mode-v1">
<view class="mode-v2" @click="selectMode('main')">
<view class="mode-v2" @click="audible">
<image src="/static/images/210/zd.png" class="setIMG"></image>
<view>
<view class="battery-v2">声光报警</view>
<view class="mode-v3">{{ currentMainMode }}</view>
<!-- <view class="mode-v3">{{ currentMainMode }}</view> -->
</view>
</view>
</view>
@ -180,11 +181,10 @@
<view class="agreement-mask" v-if="lightModeA" @click.stop="closePopup">
<!-- 灯光模式弹窗 -->
<view class="agreement-popup" @click.stop>
<!-- 标题 -->
<view class="popup-title"> {{ popupTitle }}</view>
<view class="popup-content">
<view v-for="(item, index) in items" :key="index">
<view class="item" :class="{ 'selected': item.selected }">
<view class="item" :class="{ 'selected': item.selected }" @click="onItemClick(index)">
<image :src="item.image" class="setIMG"></image>
{{ item.text }}
</view>
@ -259,7 +259,6 @@
confirm() {
return true; // 直接关闭
}
},
// 上传开机log
logo: {
@ -285,10 +284,22 @@
showCancel: true
},
confirm() {
return true; // 直接关闭
return true;
}
},
// 声光报警
audibleAlarm: {
config: {
icon: '/static/images/210/bj_1.png',
message: '确定开启设备声光报警?',
confirmBtnBg: 'rgba(255, 200, 78, 1)',
popupBorder:'1rpx solid rgba(255, 200, 78, 0.3)',
showCancel: true
},
confirm() {
return true;
}
}
}
import MqttClient from '@/utils/mqtt.js';
@ -300,7 +311,7 @@
lightModeSettings, //灯光模式设置
laserModeSettings, //激光模式设置
mapReverseGeocoding //地图逆解析
} from '@/api/6170/deviceControl.js'
} from '@/api/6075/6075.js'
import {
baseURL,
getToken,
@ -318,6 +329,9 @@
},
currentMainMode: '强光', // 主灯当前模式
currentSubMode: '泛光', // 辅灯当前模式
currentlaserMode: '关闭',
isLaserOn: false,
popupTitle: '',
lightModeC: false,
pageLoading: true,
mainMode: 'string',
@ -357,9 +371,6 @@
computedDeviceId() {
return this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId;
},
popupTitle() {
return this.modeType === 'main' ? '主灯模式' : '辅灯模式';
}
},
methods: {
// 点击弹框外的区域关闭
@ -399,15 +410,6 @@
case 1:
this.uploadStartup();
break;
case 2:
this.automaticAlarm();
break;
case 3:
this.manualAlarm();
break;
case 5:
this.alarmTime();
break;
}
},
@ -426,11 +428,23 @@
lasermode() {
this.lightModeC = true
},
// 声光报警
audible() {
this.showPopup('audibleAlarm');
},
handleDisagree() {
this.lightModeC = false
},
// 取消按钮
handleBtn() {
this.lightModeC = false
},
// 主灯模式
selectMode(type) {
this.modeType = type;
this.lightModeA = true;
if (type === 'main') {
this.popupTitle = '主灯模式'
this.items = [{
text: '强光',
selected: this.currentMainMode === '强光', // 修正匹配条件
@ -477,33 +491,34 @@
];
// 辅灯
} else if (type === 'sub') {
this.popupTitle = '辅灯模式'
this.items = [{
text: '泛光',
selected: this.currentMainMode === '泛光', // 修正匹配条件
selected: this.currentSubMode === '泛光', // 修正匹配条件
image: '/static/images/6075/fg.png',
instructValue: '1'
},
{
text: '泛光爆闪',
selected: this.currentMainMode === '泛光爆闪',
selected: this.currentSubMode === '泛光爆闪',
image: '/static/images/6075/fg.png',
instructValue: '2'
},
{
text: '警示灯',
selected: this.currentMainMode === '警示灯',
selected: this.currentSubMode === '警示灯',
image: '/static/images/6075/jsg.png',
instructValue: '3'
},
{
text: '警示灯/泛光',
selected: this.currentMainMode === '警示灯/泛光',
selected: this.currentSubMode === '警示灯/泛光',
image: '/static/images/6075/jsg.png',
instructValue: '4'
},
{
text: '关闭灯光',
selected: this.currentMainMode === '关闭灯光',
selected: this.currentSubMode === '关闭灯光',
image: '/static/images/6170/close.png',
instructValue: '0',
}
@ -515,6 +530,25 @@
toggleForm() {
this.isFormExpanded = !this.isFormExpanded;
},
onItemClick(index) {
console.log(index, 'index');
const item = this.items[index];
this.selectedItemIndex = index;
this.items = this.items.map((item, i) => ({
...item,
selected: i === index
}));
this.pendingMainMode = item.text;
// 主灯
this.currentMainMode = item.text;
// 辅灯
this.currentSubMode = item.text;
},
// 灯光模式的确认
handleSumbit() {
this.lightModeA = false
},
// 上传开机画面
uploadStartup() {
this.lightModeB = true
@ -538,19 +572,23 @@
});
return;
}
this.selectedImage = res.tempFilePaths[0];
console.log('选择的图片:', res);
//this.file = res.tempFiles[0].file
let that = this;
uni.navigateTo({
url: "/pages/6155/ImgCrop",
events: {
ImgCutOverPath: function(data) {
that.selectedImage = data.picPath;
}
},
fail: (err) => {
console.error('选择图片失败:', err);
uni.showToast({
title: '选择图片失败',
icon: 'none'
success(ev) {
ev.eventChannel.emit('checkImg', {
data: res.tempFiles[0].path,
});
}
});
},
});
},
// 上传开机画面确认按键
handleupload() {
if (!this.selectedImage) {
@ -618,7 +656,7 @@
// 历史记录
if (index === 0) {
uni.navigateTo({
url: '/pages/210/historyRecords/index',
url: '/pages/670/History',
events: {
ack: function(data) {}
},
@ -630,24 +668,22 @@
})
} else {
uni.navigateTo({
url: '/pages/6170/share/index',
url: '/pages/common/share/index',
events: {
ack: function(data) {}
},
success: (res) => {
let json = {
persissonType: '670'
};
Object.assign(json, this.device);
res.eventChannel.emit('share', {
data: this.itemInfo,
data: json
});
}
})
}
},
// 分享
shareUp() {
},
// 操作说明
operatingInst() {
uni.navigateTo({

View File

@ -802,7 +802,6 @@
ack: function(data) {}
},
success: (res) => {
debugger;
let json = {
persissonType: '670'
};

View File

@ -240,6 +240,7 @@
console.log(data, 'data1t111');
this.itemInfo = data.data;
this.permissions=Common.getPermissions(this.itemInfo.persissonType);
console.log(this.itemInfo.persissonType,'this.itemInfo.persissonType');
})
}
};