Commit 8211eb250f0e6b46083af9de462b3733905ad12e

Authored by sqy
1 parent e5b54e7a

'fix:修改一些静态图片打包后不能正常显示,设备页面的地图和地理位置的铆钉'

... ... @@ -35,7 +35,7 @@
35 35 >
36 36 <BasicForm @register="registerForm" />
37 37 <Empty v-if="!isNull" />
38   - <div v-show="isNull" ref="chartRef" :style="{ height: '600px', width }"></div>
  38 + <div v-else ref="chartRef" :style="{ height: '600px', width }"></div>
39 39 </BasicModal>
40 40 <DeviceDetailDrawer @register="registerDetailDrawer" />
41 41 </div>
... ... @@ -61,6 +61,13 @@
61 61 import { useDrawer } from '/@/components/Drawer';
62 62 import DeviceDetailDrawer from '/@/views/device/manage/cpns/modal/DeviceDetailDrawer.vue';
63 63 import moment from 'moment';
  64 + // 导入一些静态图片,避免打包时不能正确解析
  65 + import djx from '/@/assets/images/djx.png';
  66 + import zx from '/@/assets/images/zx.png';
  67 + import lx from '/@/assets/images/lx.png';
  68 + import djh from '/@/assets/images/djh.png';
  69 + import online from '/@/assets/images/online1.png';
  70 + import lx1 from '/@/assets/images/lx1.png';
64 71 export default defineComponent({
65 72 name: 'BaiduMap',
66 73 components: {
... ... @@ -141,10 +148,10 @@
141 148 <div style="font-size:16px;font-weight:bold">${name}</div>
142 149 ${
143 150 deviceState === 'INACTIVE'
144   - ? '<div style="display:flex;align-items:center"><img style="width:15px;height:15px" src="/src/assets/images/djh.png">待激活</div>'
  151 + ? `<div style="display:flex;align-items:center"><img style="width:15px;height:15px" src="${djh}">待激活</div>`
145 152 : deviceState === 'ONLINE'
146   - ? '<div style="display:flex;align-items:center"><img style="width:15px;height:15px" src="/src/assets/images/online1.png">在线</div>'
147   - : '<div style="display:flex;align-items:center"><img style="width:15px;height:15px" src="/src/assets/images/lx1.png">离线</div>'
  153 + ? `<div style="display:flex;align-items:center"><img style="width:15px;height:15px" src="${online}">在线</div>`
  154 + : `<div style="display:flex;align-items:center"><img style="width:15px;height:15px" src="${lx1}">离线</div>`
148 155 }
149 156 </div>
150 157 <div>所属组织:${organizationDTO.name}</div>
... ... @@ -161,12 +168,8 @@
161 168
162 169 map.openInfoWindow(infoWindow, map.getCenter());
163 170 let preMarker = null;
164   - const rivet =
165   - deviceState === 'INACTIVE'
166   - ? '/src/assets/images/djx.png'
167   - : deviceState === 'ONLINE'
168   - ? '/src/assets/images/zx.png'
169   - : '/src/assets/images/lx.png';
  171 +
  172 + const rivet = deviceState === 'INACTIVE' ? djx : deviceState === 'ONLINE' ? zx : lx;
170 173 let myIcon = new BMap.Icon(rivet, new BMap.Size(20, 30));
171 174 let marker = new BMap.Marker(point, { icon: myIcon });
172 175 if (marker) {
... ...
... ... @@ -73,6 +73,7 @@
73 73 import { upload } from '/@/api/oss/ossFileUploader';
74 74 import { FileItem } from '/@/components/Upload/src/typing';
75 75 import { BAI_DU_MAP_URL } from '/@/utils/fnUtils';
  76 + import icon from '/@/assets/images/wz.png';
76 77 export default defineComponent({
77 78 components: {
78 79 BasicForm,
... ... @@ -179,7 +180,6 @@
179 180 if (!wrapEl) return;
180 181 let preMarker = null;
181 182 const map = new BMap.Map(wrapEl);
182   - const icon = '/src/assets/images/wz.png';
183 183 let myIcon = new BMap.Icon(icon, new BMap.Size(20, 30));
184 184 const point = new BMap.Point(Number(longitude), Number(latitude));
185 185 let marker = new BMap.Marker(point, { icon: myIcon });
... ... @@ -207,8 +207,8 @@
207 207 //获取详细的地址,精确到街道的名称
208 208 gc.getLocation(newPoint, (rs) => {
209 209 let addComp = rs.addressComponents;
210   - let addrname = addComp.city + addComp.district + addComp.street + addComp.streetNumber;
211   - positionState.address = addrname;
  210 + let address = addComp.city + addComp.district + addComp.street + addComp.streetNumber;
  211 + positionState.address = address;
212 212 });
213 213 });
214 214 }
... ...