diff --git a/pages/maps/index.vue b/pages/maps/index.vue index 016ff00..df824c6 100644 --- a/pages/maps/index.vue +++ b/pages/maps/index.vue @@ -2,7 +2,7 @@ @@ -35,34 +35,23 @@ × - - 企业简称: - {{ currentEnterprise.entShortName || '-' }} - - - 负责人: - {{ currentEnterprise.entCharge || '-' }} - - - 统一信用代码: - {{ currentEnterprise.entCredit || '-' }} - - - 企业编号: - {{ currentEnterprise.entCode || '-' }} + + 企业照片: + + + 企业简介: {{ currentEnterprise.entIntro || '暂无简介' }} - - 联系电话: - {{ currentEnterprise.entPhone || '暂无' }} - - - 创建时间: - {{ currentEnterprise.createTime || '-' }} - @@ -78,8 +67,8 @@ return { baseUrl: configService.staticDomainURL, center: { - latitude: 36.5, - longitude: 111.7 + latitude: 35.604, + longitude: 110.983 }, mapScale: 13, markers: [], @@ -98,7 +87,8 @@ currentMarkerId: null, maxMarkerId: 0, // 当前筛选类型:'' 表示显示全部 - activeType: '' + activeType: '', + hasLoaded: false }; }, computed: { @@ -108,6 +98,15 @@ return this.markers; } return this.markers.filter(item => item.stationType === this.activeType); + }, + // 企业照片列表 + enterprisePics() { + const raw = this.currentEnterprise.entPics || ''; + if (!raw) return []; + return raw.split(',').map(p => p.trim()).filter(p => p).map(p => { + if (/^https?:\/\//.test(p)) return p; + return this.baseUrl.replace(/\/$/, '') + '/' + p.replace(/^\//, ''); + }); } }, onLoad() {}, @@ -116,8 +115,10 @@ }, onShow() { api.checkLogin(() => { + if (this.hasLoaded) return // 已经加载过,不再重复请求 this.$nextTick(() => { this.getList() + this.hasLoaded = true }) }, () => { uni.reLaunch({ @@ -161,9 +162,9 @@ this.maxMarkerId = this.allStationList.length + 1; // 渲染所有标记 - this.enterpriseRender(); this.stationRender(); - this.monitorRender() + this.monitorRender(); + this.enterpriseRender(); // 使用增强的视野调整方法 this.ensureAllMarkersVisible(); @@ -197,7 +198,16 @@ console.error('加载企业数据失败:', err); }) }, - + previewImage(index) { + const urls = this.enterprisePics; + const current = urls[index]; + uni.previewImage({ + urls: urls, + current: current, + indicator: 'default', + loop: true + }); + }, // 渲染企业标记(自动过滤掉无有效坐标的企业) renderEnterpriseMarkers() { if (!this.enterpriseList || this.enterpriseList.length === 0) { @@ -233,8 +243,8 @@ iconPath: iconPath, latitude: lat, longitude: lng, - width: 40, - height: 50, + width: 20, + height: 25, stationType: 'enterprise', stationName: item.entName, entShortName: item.entShortName, @@ -246,15 +256,15 @@ createTime: item.createTime, entId: item.id, joinCluster: false, - zIndex: this.markersZIndex++, + zIndex: 1, enterpriseData: item, callout: { content: item.entName || '企业', color: '#FFFFFF', - fontSize: 14, + fontSize: 12, borderRadius: 10, bgColor: '#007AFF', - padding: 8, + padding: 4, display: 'ALWAYS' } }; @@ -392,8 +402,8 @@ iconPath: '/static/qiyeIcon.png', latitude: lat, longitude: lng, - width: 35, - height: 52, + width: 17, + height: 26, customCallout: { anchorY: 0, anchorX: 0, @@ -403,7 +413,7 @@ stationName: item.stationName, stationCode: item.stationCode, joinCluster: false, - zIndex: this.markersZIndex, + zIndex: 1, }; this.markers.push(markerItem); } @@ -437,7 +447,7 @@ stationName: item.stationName, stationCode: item.stationCode, joinCluster: false, - zIndex: this.markersZIndex, + zIndex: 100, }; this.markers.push(markerItem); } @@ -490,7 +500,7 @@ stationCode: item.ids, deviceType: item.type, joinCluster: false, - zIndex: this.markersZIndex, + zIndex: 20, }; this.markers.push(markerItem); }); @@ -769,4 +779,9 @@ flex: 1; word-break: break-all; } + .pic-item { + width: 380rpx; + height: auto; + border-radius: 8rpx; + } \ No newline at end of file