From d4d8f0793e09374b8cf3e5e4d1c7f4007be96377 Mon Sep 17 00:00:00 2001
From: Sliverber <2622874537@qq.com>
Date: Wed, 5 Jun 2024 18:11:17 +0800
Subject: [PATCH] 111
---
common/http.interceptor.js | 1 +
page_fix/fix_index.vue | 169 +++---
page_fix/repair/repair_detail.vue | 17 +-
page_fix/repair/repair_index.vue | 906 ++++++++++++++++--------------
page_user/bhks.vue | 4 +-
pages/index/index.vue | 443 ++++++++++-----
pages/my.vue | 3 +-
7 files changed, 866 insertions(+), 677 deletions(-)
diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index accae8c..90dddfc 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -24,6 +24,7 @@ const install = (Vue, vm) => {
// baseUrl: 'http://192.168.2.6:8080',
// baseUrl: 'http://124.221.246.124:2289',
baseUrl: 'https://dche.ccttiot.com/prod-api',
+ // baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
loadingText: '努力加载中~',
loadingTime: 800,
// 设置自定义头部content-type
diff --git a/page_fix/fix_index.vue b/page_fix/fix_index.vue
index b2b30a4..9f42ba2 100644
--- a/page_fix/fix_index.vue
+++ b/page_fix/fix_index.vue
@@ -1,3 +1,5 @@
+
+复制代码
- {{infonum.powerReplacementNum}}
+ {{infonum.powerReplacementNum}}
@@ -56,12 +58,11 @@
fixdata: [],
eledata: [],
listData: [],
- infonum:{}
+ infonum: {}
}
},
onShow() {
this.$store.dispatch('userInfo', this.$u).then(() => {
-
// 执行其他操作...
});
this.getArea()
@@ -76,119 +77,89 @@
},
methods: {
onMarkerTap(e) {
- if (e.type === 'markertap') {
- console.log('点击了标记:', e.markerId);
- // 这里可以根据需要处理点击标记的逻辑
- // 阻止事件冒泡
-
- this.sn = e.markerId
- this.todetail()
-
- }
-
+ console.log('点击了标记:', e);
+ this.sn = e.detail.markerId;
+ this.todetail();
},
todetail() {
- for (let item of this.fixdata) {
- if (item.sn == this.sn) {
- uni.navigateTo({
- url:'/page_fix/repair/repair_detail?id='+item.id
- })
- }
- }
-
- for (let item of this.eledata) {
- if (item.sn == this.sn) {
- uni.navigateTo({
- url:'/page_fix/repair/repair_detail?id='+item.id
- })
- }
- }
-
- console.log("no");
+ uni.navigateTo({
+ url: '/page_fix/repair/repair_index?id=' + this.sn
+ });
},
getmarks() {
this.$u.get(`/appVerify/adminOrder/list?adminId=` + 2).then((res) => {
if (res.code == 200) {
console.log('调用了');
this.listData = res.rows;
+ this.fixdata = [];
+ this.eledata = [];
res.rows.forEach(item => {
- if (item.type == 1) {
+ if (item.type == 1&&item.status==2) {
this.fixdata.push(item);
- console.log(this.fixdata, 'this.fixdata');
- } else if (item.type == 2) {
+ } else if (item.type == 2&&item.status==2) {
this.eledata.push(item);
}
- // 可以在这里执行其他针对每个项的操作
});
- setTimeout(() => {
- this.fixdata.forEach(item => {
- this.markers.push({
- id: parseFloat(item.sn),
- latitude: parseFloat(item.latitude),
- longitude: parseFloat(item.longitude),
- // title: item.deviceName,
- width: 40,
- height: 40,
- iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u1UD93BU1vfshWFoDwgX',
- })
- })
- }, 100)
-
- setTimeout(() => {
- this.eledata.forEach(item => {
- this.markers.push({
- id: parseFloat(item.sn),
- latitude: parseFloat(item.latitude),
- longitude: parseFloat(item.longitude),
- // title: item.deviceName,
- width: 40,
- height: 40,
- iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u4UKmB47AxOj3YKIaajM',
- })
- })
- console.log(this.markers, ' this.markers this.markers');
- }, 200)
-
- // this.markers = markers;
-
+ this.updateMarkers();
} else {
- // 处理接口返回错误的情况
+ console.error('接口返回错误:', res);
}
}).catch(error => {
- // 处理接口请求失败的情况
+ console.error("接口请求失败:", error);
});
},
+ updateMarkers() {
+ this.markers = [];
+ const markerIds = new Set(); // 用于跟踪已添加的 id
+
+ const addMarker = (item, iconPath) => {
+ const id = parseFloat(item.sn);
+ if (!markerIds.has(id)) {
+ markerIds.add(id);
+ this.markers.push({
+ id: id,
+ latitude: parseFloat(item.latitude),
+ longitude: parseFloat(item.longitude),
+ width: 40,
+ height: 40,
+ iconPath: iconPath,
+ });
+ }
+ };
+
+ this.fixdata.forEach(item => {
+ addMarker(item, 'https://lxnapi.ccttiot.com/bike/img/static/u1UD93BU1vfshWFoDwgX');
+ });
+
+ this.eledata.forEach(item => {
+ addMarker(item, 'https://lxnapi.ccttiot.com/bike/img/static/u4UKmB47AxOj3YKIaajM');
+ });
+
+ console.log(this.markers, '更新后的标记');
+ },
topage() {
uni.navigateTo({
url: '/page_fix/repair/repair_index'
- })
+ });
},
getordernum() {
- // 发送请求获取数据
this.$u.get('/appVerify/adminOrder/num?adminId=' + 2).then((res) => {
if (res.code === 200) {
- // 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
- this.infonum=res.data
- // console.log(this.polyline);
+ this.infonum = res.data;
}
}).catch(error => {
- console.error("Error fetching area data:", error);
+ console.error("获取订单数量数据失败:", error);
});
},
getArea() {
- // 发送请求获取数据
this.$u.get('/app/area/list').then((res) => {
if (res.code === 200) {
- // 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
- const polylines = res.rows
- .filter(area => area.boundaryStr) // 过滤掉boundary为空的数据
+ const polylines = res.rows.filter(area => area.boundaryStr)
.map(area => this.convertBoundaryToPolyline(area.boundaryStr));
- // 更新折线数据
this.polyline = polylines;
- // console.log(this.polyline);
}
}).catch(error => {
- console.error("Error fetching area data:", error);
+ console.error("获取区域数据失败:", error);
});
},
convertBoundaryToPolylines(boundaries) {
@@ -198,11 +169,11 @@
try {
coords = JSON.parse(boundary);
} catch (error) {
- console.error("Error parsing boundary JSON:", error);
+ console.error("解析边界 JSON 失败:", error);
return null;
}
if (!Array.isArray(coords)) {
- console.error("Parsed boundary is not an array:", coords);
+ console.error("解析的边界不是数组:", coords);
return null;
}
const points = coords.map(coord => ({
@@ -211,47 +182,37 @@
}));
return {
points: points,
- fillColor: "#55888840", //填充颜色
- strokeColor: "#558888", //描边颜色
- strokeWidth: 2, //描边宽度
- zIndex: 1, //层级
+ fillColor: "#55888840",
+ strokeColor: "#558888",
+ strokeWidth: 2,
+ zIndex: 1,
};
- }).filter(polyline => polyline !== null); // 过滤掉无效的折线数据
+ }).filter(polyline => polyline !== null);
},
getParking() {
- // 发送请求获取数据
this.$u.get('/app/parking/list').then((res) => {
if (res.code === 200) {
- // 处理接口返回的数据
- const validBoundaries = res.rows.map(row => row.boundaryStr).filter(boundary =>
- typeof boundary === 'string' && boundary.trim() !== '');
+ const validBoundaries = res.rows.map(row => row.boundaryStr).filter(boundary => boundary);
const polylines = this.convertBoundaryToPolylines(validBoundaries);
-
- // 将处理后的数据添加到 this.polyline 中
this.polyline = this.polyline.concat(polylines);
- console.log(this.polyline);
}
}).catch(error => {
- console.error("Error fetching parking data:", error);
+ console.error("获取停车数据失败:", error);
});
},
convertBoundaryToPolyline(boundary) {
if (!boundary) return null;
-
const points = JSON.parse(boundary).map(coord => ({
latitude: coord[1],
longitude: coord[0]
}));
-
- const polyline = {
+ return {
points: points,
- fillColor: "#55888840", //填充颜色
- strokeColor: "#22FF00", //描边颜色
- strokeWidth: 2, //描边宽度
- zIndex: 1, //层级
+ fillColor: "#55888840",
+ strokeColor: "#22FF00",
+ strokeWidth: 2,
+ zIndex: 1,
};
-
- return polyline;
},
}
}
diff --git a/page_fix/repair/repair_detail.vue b/page_fix/repair/repair_detail.vue
index 02af418..c894611 100644
--- a/page_fix/repair/repair_detail.vue
+++ b/page_fix/repair/repair_detail.vue
@@ -111,14 +111,14 @@
-
+
设备位置
-
+
{{info.address}}
-
+
@@ -182,11 +182,11 @@
换电信息
-
+
换电单号
-
+
{{info.orderNo}}
@@ -249,8 +249,8 @@
-
-
+
+
@@ -603,6 +603,7 @@ page{
}
}
.page1{
+ padding-bottom: 250rpx;
.device_info{
margin: 32rpx auto;
padding: 32rpx 28rpx;
@@ -696,6 +697,8 @@ page{
}
}
.bot_btn{
+ position: fixed;
+ bottom: 0;
display: flex;
flex-wrap: wrap;
padding: 40rpx 18rpx;
diff --git a/page_fix/repair/repair_index.vue b/page_fix/repair/repair_index.vue
index 6c410fd..2e951fb 100644
--- a/page_fix/repair/repair_index.vue
+++ b/page_fix/repair/repair_index.vue
@@ -2,132 +2,135 @@
-
-
-
-
-
-
-
- 搜索
-
+
+
+
+
-
-
- 全部
-
-
- 换电工单
-
-
- 维修工单
-
-
- 已完成
-
+
+ 搜索
-
-
-
-
-
-
-
-
- 电单车
-
-
- {{item.createTime}}
-
+
+
+ 全部
+
+
+ 换电工单
+
+
+ 维修工单
+
+
+ 已完成
+
+
+
+
+
+
+
+
+
+
+
+ 电单车
-
-
- 报修单号
-
-
- {{item.orderNo}}
-
+
+ {{item.createTime}}
-
-
- 设备编号
-
-
- {{item.sn}}
-
+
+
+
+ 报修单号
-
-
- 故障部位
-
-
- {{item.faultTypeStr}}
-
+
+ {{item.orderNo}}
-
-
-
- {{item.address}}
-
-
- 已完成
-
-
- 待换电
-
-
- 待维修
-
-
- 换电中
-
-
- 维修中
-
+
+
+
+ 设备编号
+
+
+ {{item.sn}}
+
+
+
+
+ 故障部位
+
+
+ {{item.faultTypeStr}}
+
+
+
+
+
+ {{item.address}}
+
+
+ 已完成
+
+
+ 待换电
+
+
+ 待维修
+
+
+ 换电中
+
+
+ 维修中
-
-
-
-
-
-
-
- 电单车
-
-
- {{item.createTime}}
-
+
+
+
+
+
+
+
+
+ 电单车
-
-
- 报修单号
-
-
- 2126459452821387
-
+
+ {{item.createTime}}
-
-
- 设备编号
-
-
- DS-21674651
-
+
+
+
+ 报修单号
-
-
- 故障部位
-
-
- 【车把】【刹车】
-
+
+ {{item.orderNo}}
-
-
- 嵛山岛芦竹村三沙路68号
+
+
+
+ 设备编号
+
+
+ {{item.sn}}
+
+
+
+
+ 故障部位
+
+
+ {{item.faultTypeStr}}
+
+
+
+
+ 嵛山岛芦竹村三沙路68号
已完成
@@ -143,49 +146,50 @@
维修中
-
-
-
-
-
-
-
-
- 电单车
-
-
- {{item.createTime}}
-
+
+
+
+
+
+
+
+
+ 电单车
-
-
- 报修单号
-
-
- 2126459452821387
-
+
+ {{item.createTime}}
-
-
- 设备编号
-
-
- DS-21674651
-
+
+
+
+ 报修单号
-
-
- 故障部位
-
-
- 【车把】【刹车】
-
+
+ {{item.orderNo}}
-
-
- 嵛山岛芦竹村三沙路68号
+
+
+
+ 设备编号
+
+
+ {{item.sn}}
+
+
+
+
+ 故障部位
+
+
+ {{item.faultTypeStr}}
+
+
+
+
+ 嵛山岛芦竹村三沙路68号
已完成
@@ -201,50 +205,48 @@
维修中
-
-
-
-
-
-
-
-
- 电单车
-
-
- 2024-03-24 22:28:51
-
+
+
+
+
+
+
+
+
+ 电单车
-
-
- 报修单号
-
-
-
-
+
+ {{item.createTime}}
-
-
- 设备编号
-
-
- DS-21674651
-
+
+
+
+ {{item.orderNo}}
-
-
- 故障部位
-
-
- 【车把】【刹车】
-
+
-
-
- 嵛山岛芦竹村三沙路68号
-
+
+
+
+ 设备编号
+
+
+ {{item.sn}}
+
+
+
+
+ 故障部位
+
+
+ 【车把】【刹车】
+
+
+
+
+ 嵛山岛芦竹村三沙路68号
已完成
@@ -260,12 +262,12 @@
维修中
-
-
-
-
+
+
+
+
@@ -276,64 +278,86 @@
bgc: {
backgroundColor: "#fff",
},
- code:'',
- curtitidx:0,
- swiperHeight:408,
+ code: '',
+ curtitidx: 0,
+ swiperHeight: 408,
fixdata: [],
eledata: [],
listData: [],
- alreadyList:[]
-
+ alreadyList: []
}
},
watch: {
curtitidx(newValue, oldValue) {
- // 处理userId变化的逻辑
- console.log('userId 发生变化', newValue, oldValue);
- if(newValue==0){
- this.swiperHeight=(this.listData.length*440)
- }else if(newValue==1){
- this.swiperHeight=this.eledata.length*440
- }else if(newValue==1){
- this.swiperHeight=this.fixdata.length*440
- }
+ console.log('curtitidx 发生变化', newValue, oldValue);
+ this.updateSwiperHeight();
+ },
+ code(newValue, oldValue) {
+ console.log('code 发生变化', newValue, oldValue);
+ this.updateSwiperHeight();
}
},
- onShow() {
- this.getmarks()
+ computed: {
+ filteredListData() {
+ return this.filterData(this.listData);
+ },
+ filteredEleData() {
+ return this.filterData(this.eledata);
+ },
+ filteredFixData() {
+ return this.filterData(this.fixdata);
+ },
+ filteredAlreadyList() {
+ return this.filterData(this.alreadyList);
+ }
},
methods: {
- todetail(id){
+ updateSwiperHeight() {
+ if (this.curtitidx == 0) {
+ this.swiperHeight = (this.filteredListData.length * 440);
+ } else if (this.curtitidx == 1) {
+ this.swiperHeight = (this.filteredEleData.length * 440);
+ } else if (this.curtitidx == 2) {
+ this.swiperHeight = (this.filteredFixData.length * 440);
+ } else if (this.curtitidx == 3) {
+ this.swiperHeight = (this.filteredAlreadyList.length * 440);
+ }
+ },
+ filterData(data) {
+ if (this.code) {
+ const regex = new RegExp(this.code, 'i');
+ return data.filter(item => regex.test(item.orderNo) || regex.test(item.sn));
+ }
+ return data;
+ },
+ todetail(id) {
uni.navigateTo({
- url:'/page_fix/repair/repair_detail?id='+id
- })
+ url: '/page_fix/repair/repair_detail?id=' + id
+ });
},
- changeidx(idx){
- this.curtitidx=idx
+ changeidx(idx) {
+ this.curtitidx = idx;
},
- swiperchange(e){
- this.curtitidx=e.detail.current
- console.log(e,'eeeeeeeee');
+ swiperchange(e) {
+ this.curtitidx = e.detail.current;
},
getmarks() {
this.$u.get(`/appVerify/adminOrder/list?adminId=` + 2).then((res) => {
if (res.code == 200) {
- console.log('调用了');
this.listData = res.rows;
+ this.fixdata = [];
+ this.eledata = [];
+ this.alreadyList = [];
res.rows.forEach(item => {
- if (item.type == 1&&item.status!=4) {
+ if (item.type == 1 && item.status != 4) {
this.fixdata.push(item);
- console.log(this.fixdata, 'this.fixdata');
- } else if (item.type == 2&item.status!=4) {
+ } else if (item.type == 2 && item.status != 4) {
this.eledata.push(item);
- }else if(item.status==4){
- this.alreadyList.push(item) }
- // 可以在这里执行其他针对每个项的操作
+ } else if (item.status == 4) {
+ this.alreadyList.push(item);
+ }
});
- this.swiperHeight=(this.listData.length*440)
-
- // this.markers = markers;
-
+ this.updateSwiperHeight();
} else {
// 处理接口返回错误的情况
}
@@ -341,226 +365,260 @@
// 处理接口请求失败的情况
});
},
+ },
+ onLoad(e) {
+ console.log(e,'eeeeee');
+ if(e.id){
+
+ this.code = e.id;
+ }
+
+ },
+ onShow() {
+ this.getmarks();
}
}
-
+
\ No newline at end of file
diff --git a/page_user/bhks.vue b/page_user/bhks.vue
index af78c1e..ae249e2 100644
--- a/page_user/bhks.vue
+++ b/page_user/bhks.vue
@@ -6,7 +6,7 @@
输入编号开锁
-
+
@@ -174,7 +174,7 @@ page{
color: #FFFFFF;
}
.act1{
- background: #02CBAF;
+ background: #4C97E7;
}
}
diff --git a/pages/index/index.vue b/pages/index/index.vue
index d37ab38..b8a19d2 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -4,8 +4,11 @@
- 创想出行
+ 创享出行
+
@@ -14,12 +17,12 @@
@markertap="onMarkerTap">
-
-
+
+
-
+
@@ -61,12 +64,13 @@
-
- 扫码用车
-
-
+
+
预约用车
+
+ 解锁用车
+
发现坏车 >
@@ -179,7 +183,7 @@
-
+
{{items.start}}-{{items.end}}分钟
小时
@@ -333,7 +337,7 @@
-
+
扫码开锁
@@ -345,7 +349,7 @@
押金充值
-
+ >
用车指南
+ >
编号开锁
-
-
+
+
- 更多
+ 故障上报
@@ -378,22 +382,58 @@
+
+
+
+
+ 您有正在进行中的订单
+
+
+
+
+
+
+ 点击车辆可以预约用车
+
+
+
+
+
+ 文明骑行,须知
+
+
+
+
+
+
+
-
- 您有正在进行中的订单
-
-
-
- 点击车辆可以预约用车
-
-
- 文明骑行,须知
-
-
-
+
@@ -428,11 +468,14 @@
我已知晓
-
+
安全骑行 禁止超载
-
+
+
+
+
+
我已阅读同意
@@ -675,8 +718,18 @@
seeDetail: false,
showmap: true,
userinfo: {},
- parkingList: []
-
+ parkingList: [],
+ timer: null,
+ listData: [],
+ oldMarkers: [],
+ curtitidx: 0,
+ swiperHeight: 50,
+ background: ['color1', 'color2', 'color3'],
+ indicatorDots: true,
+ autoplay: true,
+ interval: 2000,
+ duration: 500,
+ showTips:false,
// userId:this.$store.getters.userId,
}
},
@@ -687,6 +740,7 @@
this.getisInOrder()
}
},
+
onLoad(e) {
console.log(e, 'eeeeeeeeeeeeeeeeeee');
if (e.q) {
@@ -713,10 +767,10 @@
setTimeout(() => {
if (!this.orderinfo.status) {
- this.deviceInfo()
- this.showdevice = true
- this.deviceIndex = 1
- this.type = 1
+ this.deviceInfo(1)
+ // this.showdevice = true
+ // this.deviceIndex = 1
+ // this.type = 1
}
}, 1000)
@@ -729,16 +783,19 @@
if (this.sn != '') {
setTimeout(() => {
if (!this.orderinfo.status) {
- this.deviceInfo()
- this.showdevice = true
- this.deviceIndex = 1
- this.type = 1
+ this.deviceInfo(1)
+ // this.showdevice = true
+ // this.deviceIndex = 1
+ // this.type = 1
}
}, 1000)
}
}
+ setTimeout(()=>{
+ this.$store.commit('SET_SHOWTIPS', true);
+ },500)
},
onShow() {
if (this.seeDetail == false) {
@@ -783,10 +840,29 @@
} else {
this.getinfo()
}
-
+ this.timer = setInterval(() => {
+ // console.log('定时器运行中...');
+ this.getmarks()
+ // 在这里执行你的逻辑
+ }, 3000); // 每秒执行一次
},
-
+ onHide() {
+ // 页面隐藏时清除定时器
+ if (this.timer) {
+ clearInterval(this.timer);
+ this.timer = null;
+ console.log('定时器已清除');
+ }
+ },
+ onUnload() {
+ // 页面卸载时清除定时器
+ if (this.timer) {
+ clearInterval(this.timer);
+ this.timer = null;
+ console.log('定时器已清除');
+ }
+ },
computed: {
appointmentServiceFee() {
return this.$store.getters.appointmentServiceFee;
@@ -812,9 +888,9 @@
userId() {
return this.$store.getters.userId;
},
- showTips() {
- return this.$store.getters.showTips;
- },
+ // showTips() {
+ // return this.$store.getters.showTips;
+ // },
isMeal() {
return this.$store.getters.isMeal;
},
@@ -822,9 +898,12 @@
methods: {
changetips() {
if (this.showTips) {
- this.$store.commit('SET_SHOWTIPS', false);
+
+ uni.setStorageSync('hasShownPopup', false);
+ this.showTips=uni.getStorageSync('hasShownPopup')
} else {
- this.$store.commit('SET_SHOWTIPS', true);
+ uni.setStorageSync('hasShownPopup', true);
+ this.showTips=uni.getStorageSync('hasShownPopup')
}
},
@@ -893,6 +972,7 @@
},
// 扫码开锁
qecodelock() {
+ this.seeDetail = true
uni.scanCode({
onlyFromCamera: true,
scanType: ['qrCode'],
@@ -914,7 +994,7 @@
if (this.sn != '') {
setTimeout(() => {
if (!this.orderinfo.status) {
- this.deviceInfo()
+ this.deviceInfo(1)
}
}, 1000)
@@ -923,11 +1003,11 @@
},
fail: err => {
- console.error('扫描失败:', err);
- uni.showToast({
- title: '扫描失败',
- icon: 'none'
- });
+ // console.error('扫描失败:', err);
+ // uni.showToast({
+ // title: '扫描失败',
+ // icon: 'none'
+ // });
}
});
},
@@ -1035,7 +1115,7 @@
}
this.$u.post('/appVerify/device/snSwitch', data).then((res) => {
if (res.code == 200) {
-
+
this.getisInOrder()
} else {
this.getisInOrder()
@@ -1460,7 +1540,7 @@
console.log('登录!', res);
let data = {
wxOpenId: res.code,
-
+
};
let areaId = uni.getStorageSync('areaId');
that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId).then(
@@ -1485,7 +1565,7 @@
url: '/pages/my'
})
}
-
+
} else {
uni.showToast({
title: '未登录,请登录后尝试',
@@ -1494,15 +1574,15 @@
});
}
});
-
+
} else {
uni.navigateTo({
url: '/pages/my'
})
}
-
-
-
+
+
+
} else if (res.code == 501) {
uni.showToast({
title: res.msg,
@@ -1518,9 +1598,9 @@
});
}
},
-
+
});
-
+
} else if (num == 7) {
uni.navigateTo({
url: '/page_user/gzsb?sn=' + this.sn
@@ -1764,7 +1844,7 @@
}
}
- }else{
+ } else {
if (this.freeInfo.ruleId) {
let data = {
userId: this.userId,
@@ -1774,8 +1854,8 @@
// money: this.freeInfo.fee,
mark: "预约购买套餐",
type: '2'
-
-
+
+
}
this.$u.post('/appVerify/device/appointment?userId=' + this.userId + '&sn=' + this.sn +
'&ruleId=' +
@@ -1791,7 +1871,7 @@
uni.hideLoading()
}, 1000)
// this.freList=res.rows
-
+
} else {
uni.showToast({
title: res.msg,
@@ -1995,21 +2075,30 @@
// 这里可以根据需要处理点击标记的逻辑
// 阻止事件冒泡\
this.sn = e.markerId
- this.deviceInfo()
+ this.deviceInfo(0)
}
},
- deviceInfo() {
+ deviceInfo(num) {
let that = this
if (uni.getStorageSync('token')) {
this.$u.get('/app/device/info?sn=' + this.sn).then((res) => {
if (res.code === 200) {
this.deviceInfos = res.data
- this.showindex = 0
- this.showdevice = true
+ if (num == 0) {
+ // this.showindex = 0
+ this.showdevice = true
+ this.type = 0
+ } else {
+ // this.showindex = 1
+ this.showdevice = true
+ this.type = 1
+ this.deviceIndex = 1
+ }
+
} else {
this.showdevice = false
this.deviceIndex = 0
@@ -2081,38 +2170,30 @@
// // 这里可以根据需要处理点击地图非标记区域的逻辑
// },
getmarks() {
- this.listData = []
- this.markers = []
let data = {
areaId: this.areaInfo.areaId
- }
+ };
+
this.$u.get(`/app/allVehicleByArea`, data).then((res) => {
if (res.code === 200) {
this.listData = res.data;
- // const markers = data.map(item => {
- // return {
- // id: item.deviceId,
- // latitude: parseFloat(item.latitude),
- // longitude: parseFloat(item.longitude),
- // title: item.deviceName,
- // width : 25,
- // height : 30,
- // iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uF9qLejuAZErNTrRuHq7',
- // };
- // });
- this.listData.forEach(item => {
- this.markers.push({
- id: parseFloat(item.sn),
- latitude: parseFloat(item.latitude),
- longitude: parseFloat(item.longitude),
- // title: item.deviceName,
- width: 40,
- height: 28,
- iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uF9qLejuAZErNTrRuHq7',
- })
- })
- // this.markers = markers;
- // console.log(this.markers, ' this.markers this.markers');
+
+ const newMarkers = this.listData.map(item => ({
+ id: parseFloat(item.sn),
+ latitude: parseFloat(item.latitude),
+ longitude: parseFloat(item.longitude),
+ width: 40,
+ height: 28,
+ iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uF9qLejuAZErNTrRuHq7',
+ }));
+
+ // 检查新数据和旧数据是否有变化
+ if (this.oldMarkers.length === 0 || this.isMarkersChanged(newMarkers)) {
+ console.log('有变化');
+ this.markers = newMarkers;
+ this.oldMarkers = [...newMarkers];
+ }
+
} else {
// 处理接口返回错误的情况
}
@@ -2120,6 +2201,21 @@
// 处理接口请求失败的情况
});
},
+ isMarkersChanged(newMarkers) {
+ if (this.oldMarkers.length !== newMarkers.length) {
+ return true;
+ }
+
+ for (let i = 0; i < newMarkers.length; i++) {
+ if (this.oldMarkers[i].id !== newMarkers[i].id ||
+ this.oldMarkers[i].latitude !== newMarkers[i].latitude ||
+ this.oldMarkers[i].longitude !== newMarkers[i].longitude) {
+ return true;
+ }
+ }
+
+ return false;
+ },
getinfo() {
if (uni.getStorageSync('token')) {
this.$u.get("/getAppInfo").then((res) => {
@@ -2206,7 +2302,28 @@
this.getisInOrder()
}
-
+ const hasShownPopup = uni.getStorageSync('hasShownPopup');
+ console.log(hasShownPopup, 'hasShownPopup');
+
+ if (hasShownPopup === '' || hasShownPopup === null) {
+ console.log('1111111111');
+ this.showTips = true;
+ uni.setStorageSync('hasShownPopup', true);
+ } else {
+ console.log('222');
+ this.showTips = uni.getStorageSync('hasShownPopup');
+ console.log(this.showTips, 'this.showTips');
+ }
+ this.setMapScale()
+ // if(!hasShownPopup){
+ // console.log(typeof(hasShownPopup),'hasShownPopuphasShownPopup');
+ // this.showTips=uni.getStorageSync('hasShownPopup')
+ // }else{
+ // this.showTips=true
+ // uni.setStorageSync('hasShownPopup', true);
+ // }
+
+ // this.$store.commit('SET_SHOWTIPS', true);
// console.log(this.polyline);
} else {
uni.showToast({
@@ -2341,6 +2458,43 @@
}
}
+