Browse Source

动态多语言

lipenghui 2 months ago
parent
commit
965ff41d75
4 changed files with 15 additions and 9 deletions
  1. 1 0
      public/images/newding.svg
  2. 1 0
      public/images/newfail.svg
  3. 2 1
      src/config/axios/service.ts
  4. 11 8
      src/views/pms/map/Map.vue

+ 1 - 0
public/images/newding.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750399217103" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5709" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48"><path d="M702.932 777.584c-11.692-3.161-23.743 3.758-26.903 15.45-3.165 11.698 3.758 23.744 15.451 26.903 73.027 19.747 105.712 47.546 105.712 66.333 0 14.494-19.804 37.052-75.398 56.907-55.701 19.895-130.205 30.845-209.791 30.845-79.586 0-154.099-10.95-209.799-30.845-55.593-19.855-75.396-42.413-75.396-56.907 0-18.793 32.702-46.602 105.761-66.348 11.698-3.161 18.618-15.201 15.456-26.899-3.159-11.692-15.199-18.617-26.897-15.455-89.119 24.084-138.198 62.687-138.198 108.702 0 26.869 17.359 47.165 31.924 59.459 17.477 14.762 41.905 27.805 72.594 38.766 60.318 21.541 140.063 33.407 224.549 33.407 84.493 0 164.238-11.872 224.556-33.407 30.689-10.961 55.115-24.005 72.595-38.766 14.564-12.295 31.924-32.59 31.924-59.459 0-46-49.056-84.603-138.137-108.686v0zM422.048 826.725c23.419 26.842 56.222 42.223 90.118 42.223h0.005c34.028 0 66.802-15.506 90.080-42.569 7.059-7.696 67.087-73.789 127.916-160.351 88.146-125.43 132.837-229.369 132.837-308.923 0-47.367-9.283-93.344-27.597-136.64-17.684-41.803-42.986-79.343-75.212-111.563-32.219-32.218-69.751-57.526-111.554-75.202-43.302-18.315-89.278-27.603-136.639-27.603-47.367 0-93.344 9.289-136.641 27.603-41.802 17.678-79.342 42.985-111.561 75.202-32.219 32.226-57.526 69.759-75.202 111.563-18.315 43.297-27.603 89.273-27.603 136.64 0 79.552 44.724 183.524 132.929 309.029 61.247 87.146 121.682 153.568 128.124 160.59v0zM375.908 347.29c0-77.421 62.989-140.405 140.402-140.405 77.421 0 140.404 62.986 140.404 140.405 0 77.415-62.982 140.404-140.404 140.404-77.414 0-140.402-62.989-140.402-140.404v0zM375.908 347.29z" p-id="5710" fill="#2aa515"></path></svg>

+ 1 - 0
public/images/newfail.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750399458248" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5985" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48"><path d="M702.932 777.584c-11.692-3.161-23.743 3.758-26.903 15.45-3.165 11.698 3.758 23.744 15.451 26.903 73.027 19.747 105.712 47.546 105.712 66.333 0 14.494-19.804 37.052-75.398 56.907-55.701 19.895-130.205 30.845-209.791 30.845-79.586 0-154.099-10.95-209.799-30.845-55.593-19.855-75.396-42.413-75.396-56.907 0-18.793 32.702-46.602 105.761-66.348 11.698-3.161 18.618-15.201 15.456-26.899-3.159-11.692-15.199-18.617-26.897-15.455-89.119 24.084-138.198 62.687-138.198 108.702 0 26.869 17.359 47.165 31.924 59.459 17.477 14.762 41.905 27.805 72.594 38.766 60.318 21.541 140.063 33.407 224.549 33.407 84.493 0 164.238-11.872 224.556-33.407 30.689-10.961 55.115-24.005 72.595-38.766 14.564-12.295 31.924-32.59 31.924-59.459 0-46-49.056-84.603-138.137-108.686v0zM422.048 826.725c23.419 26.842 56.222 42.223 90.118 42.223h0.005c34.028 0 66.802-15.506 90.080-42.569 7.059-7.696 67.087-73.789 127.916-160.351 88.146-125.43 132.837-229.369 132.837-308.923 0-47.367-9.283-93.344-27.597-136.64-17.684-41.803-42.986-79.343-75.212-111.563-32.219-32.218-69.751-57.526-111.554-75.202-43.302-18.315-89.278-27.603-136.639-27.603-47.367 0-93.344 9.289-136.641 27.603-41.802 17.678-79.342 42.985-111.561 75.202-32.219 32.226-57.526 69.759-75.202 111.563-18.315 43.297-27.603 89.273-27.603 136.64 0 79.552 44.724 183.524 132.929 309.029 61.247 87.146 121.682 153.568 128.124 160.59v0zM375.908 347.29c0-77.421 62.989-140.405 140.402-140.405 77.421 0 140.404 62.986 140.404 140.405 0 77.415-62.982 140.404-140.404 140.404-77.414 0-140.402-62.989-140.402-140.404v0zM375.908 347.29z" p-id="5986" fill="#d4237a"></path></svg>

+ 2 - 1
src/config/axios/service.ts

@@ -180,7 +180,8 @@ service.interceptors.response.use(
 
       const requestUrl = response.config.url || ''
       // 判断是否包含rq/iot路径
-      if (requestUrl.includes('rq/')||requestUrl.includes('system/dict')||requestUrl.includes('system/auth/get-permission-info')||requestUrl.includes('system/menu/list')||requestUrl.includes('system/menu/simple-list')) {
+      if (requestUrl.includes('rq/')||requestUrl.includes('system/dict')||requestUrl.includes('system/auth/get-permission-info')||requestUrl.includes('system/dept/list')
+        ||requestUrl.includes('system/menu/simple-list')||requestUrl.includes('system/menu/list')||requestUrl.includes('system/dept/simple-list')) {
         const localeStore = useLocaleStore()
         const lang = localeStore.getCurrentLocale.lang
         if (data&& data.data) {

+ 11 - 8
src/views/pms/map/Map.vue

@@ -56,7 +56,7 @@ const initMap = () => {
     if ((window as any).BMap) {
       map.value = new (window as any).BMap.Map(mapContainer.value)
       const point = new (window as any).BMap.Point(104.114129, 37.550339)
-      map.value.centerAndZoom(point, 6)
+      map.value.centerAndZoom(point, 5.5)
 
       map.value.enableScrollWheelZoom(true)
       map.value.setMapType((window as any)[mapType.value])
@@ -117,13 +117,13 @@ const initDeviceMarkers = () => {
 const createDeviceMarker = (device: IotDeviceVO, point: any) => {
   // 根据设备是否在线选择不同的图标
   const iconUrl = device.ifInline === 3
-    ? 'https://iot.deepoil.cc/images/dinggreen.svg'
-    : 'https://iot.deepoil.cc/images/dingout.svg';
+    ? 'https://iot.deepoil.cc/images/newding.svg'
+    : 'https://iot.deepoil.cc/images/newfail.svg';
 
   const marker = new (window as any).BMap.Marker(point, {
     icon: new (window as any).BMap.Icon(
       iconUrl,
-      new (window as any).BMap.Size(40, 40),
+      new (window as any).BMap.Size(40, 47),
       {
         anchor: new (window as any).BMap.Size(25, 40)
         // imageOffset: new (window as any).BMap.Size(0, -5)
@@ -162,10 +162,13 @@ const createClusterLabel = (cluster: Cluster, point: any) => {
   `
   document.head.appendChild(style)
 
+  // 根据 cluster.count 的值设置不同的背景颜色
+  const backgroundColor = cluster.count > 10 ? '#1d4eed' : '#f67d1a';
+
   // 初始样式
   label.setStyle({
     color: '#fff',
-    backgroundColor: 'blue',
+    backgroundColor: backgroundColor,
     borderRadius: '50%',
     width: '50px',
     height: '50px',
@@ -188,7 +191,7 @@ const createClusterLabel = (cluster: Cluster, point: any) => {
 
   // 鼠标移出样式
   const normalStyle = {
-    backgroundColor: '#c38f65',
+    backgroundColor: backgroundColor,
     transform: 'scale(1)'
   }
 
@@ -250,7 +253,7 @@ const showDeviceInfoWindow = (device: IotDeviceVO, point: any) => {
           <p><strong>设备编码:</strong> ${device.deviceCode}</p>
           <p><strong>设备名称:</strong> ${device.deviceName}</p>
           <p><strong>所在部门:</strong> ${res.name}</p>
-          <p><strong>位置:</strong> ${device.location}</p>
+          <p><strong>位置:</strong> ${device.location?device.location.replaceAll('"',''):''}</p>
           <p><strong>状态:</strong> ${getDictLabel(DICT_TYPE.PMS_DEVICE_STATUS, device.deviceStatus)}</p>
           <p><strong>是否在线:</strong> ${getDictLabel(DICT_TYPE.IOT_DEVICE_STATUS, device.ifInline)}</p>
           <p><strong>最后在线时间:</strong> ${device.lastInlineTime}</p>
@@ -347,7 +350,7 @@ onBeforeUnmount(() => {
 .map-container {
   position: relative;
   width: 100%;
-  height: 100vh;
+  height: 90vh;
 }
 
 #baidu-map {