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 @@ + +复制代码 @@ -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 @@ } } +