Bläddra i källkod

添加机关标识

shaogen1995 5 månader sedan
förälder
incheckning
e651e25282

+ 18 - 0
packages/mobile/public/index.html

@@ -13,6 +13,24 @@
       type="text/css"
     />
     <link href="./lib/mars3d/mars3d.css" rel="stylesheet" type="text/css" />
+
+  <!-- <style>
+    #_ideConac {
+      position: fixed;
+      z-index: 99999;
+      bottom: 20px;
+      left: 5px;
+    }
+
+    #_ideConac img {
+      width: 40px;
+      height: auto;
+    }
+  </style>
+
+      <script
+    type="text/javascript">document.write(unescape("%3Cspan id='_ideConac' %3E%3C/span%3E%3Cscript  src='https://dcs.conac.cn/js/nis/44/07/00/05f3733d27894e46708e2378a98839f9/114407005536613194-20014838.js' type='text/javascript'%3E%3C/script%3E"));</script> -->
+
     <script>
       // window.CESIUM_BASE_URL = "./lib/Cesium/" //非必须,如jsp、asp.net等非html框架报错时建议取消注释
     </script>

+ 65 - 12
packages/mobile/src/views/Home.vue

@@ -1,5 +1,14 @@
 <template>
   <div class="Home">
+    <!-- 机关图标 -->
+    <a
+      id="_ideConac"
+      href="https://bszs.conac.cn/sitename?method=show&id=3A90AA974EB3C48EE06310291AAC48FC"
+      target="_blank"
+    >
+      <img src="https://dcs.conac.cn/image/nis/red.png" alt="" />
+    </a>
+
     <div class="map">
       <div id="mars3dContainer" class="mars3d-container"></div>
     </div>
@@ -14,7 +23,12 @@
     <!-- 顶部 -->
     <div class="top" :class="{ topOpen: cutArrows }">
       <!-- 箭头 -->
-      <img class="arrowsImg" @click="cutArrows = !cutArrows" src="../assets/img/arrows.png" alt="" />
+      <img
+        class="arrowsImg"
+        @click="cutArrows = !cutArrows"
+        src="../assets/img/arrows.png"
+        alt=""
+      />
       <div class="arrows" @click="cutArrows = !cutArrows">
         <div class="arrowsLeft"></div>
         <div class="arrowsRight"></div>
@@ -39,7 +53,12 @@
         </div>
         <div class="browse browse2">详情统计</div>
         <div class="detailsNum">
-          <div class="row" v-for="item in numData" :key="item.id" @click="toCun(item.id)">
+          <div
+            class="row"
+            v-for="item in numData"
+            :key="item.id"
+            @click="toCun(item.id)"
+          >
             <div class="rowLeft">{{ item.name }}</div>
             <div class="rowRight">
               <div class="plan">
@@ -60,8 +79,12 @@
     </div>
 
     <div class="btn-list">
-      <div @click="showTopic = true" class="btn topic-btn"><img src="../assets/img/icon_special topic.svg" alt="" /></div>
-      <div @click="showQA = true" class="btn qa-btn"><img src="../assets/img/icon_q&a.svg" alt="" /></div>
+      <div @click="showTopic = true" class="btn topic-btn">
+        <img src="../assets/img/icon_special topic.svg" alt="" />
+      </div>
+      <div @click="showQA = true" class="btn qa-btn">
+        <img src="../assets/img/icon_q&a.svg" alt="" />
+      </div>
     </div>
     <Topic v-if="showTopic" @close="showTopic = false" />
     <QA v-if="showQA" @close="showQA = false" />
@@ -273,7 +296,11 @@ export default {
       const acInfo = this.villagePos.find((v) => v.id === id) || {};
 
       const graphic = new mars3d.graphic.DivGraphic({
-        position: new mars3d.LngLatPoint(acInfo.position[0], acInfo.position[1], 100),
+        position: new mars3d.LngLatPoint(
+          acInfo.position[0],
+          acInfo.position[1],
+          100
+        ),
         style: {
           html: `<div class="lableContent" _id=${id} >
   <div class="lableIconArea">
@@ -285,7 +312,12 @@ export default {
           horizontalOrigin: mars3d.Cesium.HorizontalOrigin.LEFT,
           verticalOrigin: mars3d.Cesium.VerticalOrigin.BOTTOM,
           // distanceDisplayCondition: new mars3d.Cesium.DistanceDisplayCondition(0, 30000), // 按视距距离显示
-          scaleByDistance: new mars3d.Cesium.NearFarScalar(1000, 1.5, 12000, 0.8),
+          scaleByDistance: new mars3d.Cesium.NearFarScalar(
+            1000,
+            1.5,
+            12000,
+            0.8
+          ),
           clampToGround: true,
         },
         attr: {
@@ -320,9 +352,12 @@ export default {
       this.map.addLayer(this.tilesetLayer);
 
       // 加载的事件 只执行一次
-      this.tilesetLayer.on(mars3d.EventType.initialTilesLoaded, function (event) {
-        console.log("触发initialTilesLoaded事件", event);
-      });
+      this.tilesetLayer.on(
+        mars3d.EventType.initialTilesLoaded,
+        function (event) {
+          console.log("触发initialTilesLoaded事件", event);
+        }
+      );
     },
     // 加载区域边界
     loadZoneLayer(_map, _type, _color, _repeat) {
@@ -425,7 +460,11 @@ export default {
   //生命周期 - 创建完成(可以访问当前this实例)
   async created() {
     // 移动端和pc端的切换
-    if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
+    if (
+      window.navigator.userAgent.match(
+        /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
+      )
+    ) {
       // 移动端
     } else {
       // PC端
@@ -490,6 +529,20 @@ export default {
   margin: 0 auto;
   position: relative;
   overflow: hidden;
+
+  // 计算图标
+   #_ideConac {
+      position: fixed;
+      z-index: 99;
+      bottom: 20px;
+      left: 5px;
+    }
+
+    #_ideConac img {
+      width: 40px;
+      height: auto;
+    }
+
   .btn-list {
     position: absolute;
     bottom: 0.6133rem;
@@ -786,8 +839,8 @@ export default {
   justify-content: center;
   align-items: center;
   position: absolute;
-  bottom: 30px;
-  left: 5px;
+  bottom: 25px;
+  left: 47px;
   width: 40px;
   height: 40px;
   background-color: rgba(0, 16, 56, 0.7);

+ 60 - 50
packages/pc/public/index.html

@@ -1,56 +1,66 @@
 <!DOCTYPE html>
 <html lang="">
-  <head>
-    <meta charset="utf-8" />
-    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
-    <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
-
-    <!-- 方式2:使用cdn引入的Cesium -->
-    <!-- <link href="https://unpkg.com/mars3d-cesium/Build/Cesium/Widgets/widgets.css" rel="stylesheet" type="text/css" />
+
+<head>
+  <meta charset="utf-8" />
+  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+  <meta name="viewport" content="width=device-width,initial-scale=1.0" />
+  <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
+
+  <!-- 方式2:使用cdn引入的Cesium -->
+  <!-- <link href="https://unpkg.com/mars3d-cesium/Build/Cesium/Widgets/widgets.css" rel="stylesheet" type="text/css" />
   <script src="https://unpkg.com/mars3d-cesium/Build/Cesium/Cesium.js" type="text/javascript"></script>
   <script src="https://unpkg.com/@turf/turf/turf.min.js" type="text/javascript"></script> -->
 
-    <script type="text/javascript">
-      window.CESIUM_BASE_URL = "<%= BASE_URL %>lib/Cesium/";
-    </script>
-    <link
-      rel="stylesheet"
-      href="<%= BASE_URL %>lib/Cesium/Widgets/widgets.css"
-    />
-    <script
-      type="text/javascript"
-      src="<%= BASE_URL %>lib/Cesium/Cesium.js"
-    ></script>
-    <script
-      type="text/javascript"
-      src="<%= BASE_URL %>lib/mars3d/mars3d.js"
-    ></script>
-    <script src="./lib/turf/turf.min.js" type="text/javascript"></script>
-    <title>江门市传统村落一张图</title>
-    <style>
-      .mars3d-locationbar {
-        background-color: #000 !important;
-        z-index: 0 !important;
-      }
-      .mars3d-divlayer>div:nth-of-type(5){
-        z-index: 2 !important;
-      }
-      .mars3d-divlayer>div:nth-of-type(12){
-        z-index: 2 !important;
-      }
-    </style>
-  </head>
-
-  <body>
-    <noscript>
-      <strong
-        >We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
+  <style>
+    #_ideConac {
+      position: fixed;
+      z-index: 99999;
+      bottom: 20px;
+      left: 5px;
+    }
+
+    #_ideConac img {
+      width: 40px;
+      height: auto;
+    }
+  </style>
+
+  <script
+    type="text/javascript">document.write(unescape("%3Cspan id='_ideConac' %3E%3C/span%3E%3Cscript  src='https://dcs.conac.cn/js/nis/44/07/00/05f3733d27894e46708e2378a98839f9/114407005536613194-20014838.js' type='text/javascript'%3E%3C/script%3E"));</script>
+
+  <script type="text/javascript">
+    window.CESIUM_BASE_URL = "<%= BASE_URL %>lib/Cesium/";
+  </script>
+  <link rel="stylesheet" href="<%= BASE_URL %>lib/Cesium/Widgets/widgets.css" />
+  <script type="text/javascript" src="<%= BASE_URL %>lib/Cesium/Cesium.js"></script>
+  <script type="text/javascript" src="<%= BASE_URL %>lib/mars3d/mars3d.js"></script>
+  <script src="./lib/turf/turf.min.js" type="text/javascript"></script>
+  <title>江门市传统村落一张图</title>
+  <style>
+    .mars3d-locationbar {
+      background-color: #000 !important;
+      z-index: 0 !important;
+    }
+
+    .mars3d-divlayer>div:nth-of-type(5) {
+      z-index: 2 !important;
+    }
+
+    .mars3d-divlayer>div:nth-of-type(12) {
+      z-index: 2 !important;
+    }
+  </style>
+</head>
+
+<body>
+  <noscript>
+    <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
         properly without JavaScript enabled. Please enable it to
-        continue.</strong
-      >
-    </noscript>
-    <div id="app"></div>
-    <!-- built files will be auto injected -->
-  </body>
-</html>
+        continue.</strong>
+  </noscript>
+  <div id="app"></div>
+  <!-- built files will be auto injected -->
+</body>
+
+</html>

+ 166 - 18
packages/pc/src/views/Home.vue

@@ -1,6 +1,15 @@
 <!--  -->
 <template>
   <div class="home">
+    <!-- 机关标识 -->
+    <!-- <a
+      id="_ideConac"
+      href="https://bszs.conac.cn/sitename?method=show&id=3A90AA974EB3C48EE06310291AAC48FC"
+      target="_blank"
+    >
+    <img src="https://dcs.conac.cn/image/nis/red.png" alt="">
+  </a> -->
+
     <div id="mars3dContainer" class="mars3d-container"></div>
     <div id="zoneControl" @click="showZoneSelect">
       <img src="data/layer.png" />
@@ -27,13 +36,25 @@
       <!-- 搜索 -->
       <div class="search" @keyup.enter="mySearch">
         <div class="searchBtn" @click="mySearch"></div>
-        <el-input placeholder="搜索村落名称..." suffix-icon="el-icon-search" v-model="name"> </el-input>
+        <el-input
+          placeholder="搜索村落名称..."
+          suffix-icon="el-icon-search"
+          v-model="name"
+        >
+        </el-input>
       </div>
       <!-- 下面内容 -->
       <div class="main">
         <div class="mainTop">
-          <div :class="{ active: mainInd === 0 }" @click="mainInd = 0">浏览统计</div>
-          <div :class="{ active: mainInd === 1 }" @click="mainInd = 1">区域筛选</div>
+          <div :class="{ active: mainInd === 0 }" @click="mainInd = 0">
+            浏览统计
+          </div>
+          <div :class="{ active: mainInd === 1 }" @click="mainInd = 1">
+            区域筛选
+          </div>
+          <div :class="{ active: mainInd === 2 }" @click="mainInd = 2">
+            类型筛选
+          </div>
         </div>
         <!-- 浏览统计盒子 -->
         <div class="mainBox1" v-show="mainInd === 0">
@@ -55,7 +76,12 @@
           <div class="details">
             <h3>详情统计</h3>
             <div class="detailsNum">
-              <div class="row" @click.stop="toCun(item.id)" v-for="item in numData" :key="item.id">
+              <div
+                class="row"
+                @click.stop="toCun(item.id)"
+                v-for="item in numData"
+                :key="item.id"
+              >
                 <div class="rowLeft">{{ item.name }}</div>
                 <div class="rowRight">
                   <div class="plan">
@@ -74,9 +100,52 @@
               <div>{{ item.name }}</div>
               <div class="bs">{{ item.son.length }}</div>
             </div>
-            <div @click="cutInd(item.id)" class="rr" :class="item.id === mapDataInd ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></div>
+            <div
+              @click="cutInd(item.id)"
+              class="rr"
+              :class="
+                item.id === mapDataInd
+                  ? 'el-icon-arrow-up'
+                  : 'el-icon-arrow-down'
+              "
+            ></div>
             <div class="sonBox">
-              <div @click.stop="toCun(val.id)" :class="{ active: item.id === mapDataInd }" v-for="val in item.son" :key="val.id">· {{ val.name }}</div>
+              <div
+                @click.stop="toCun(val.id)"
+                :class="{ active: item.id === mapDataInd }"
+                v-for="val in item.son"
+                :key="val.id"
+              >
+                · {{ val.name }}
+              </div>
+            </div>
+          </div>
+        </div>
+        <!-- 类型筛选合作 -->
+        <div class="mainBox2" v-show="mainInd === 2">
+          <div class="box2Row" v-for="item in gongNengData" :key="item.id">
+            <div class="ll" @click="cutInd(item.id, true)">
+              <div>{{ item.name }}</div>
+              <div class="bs">{{ item.son.length }}</div>
+            </div>
+            <div
+              @click="cutInd(item.id, true)"
+              class="rr"
+              :class="
+                item.id === gongNengInd
+                  ? 'el-icon-arrow-up'
+                  : 'el-icon-arrow-down'
+              "
+            ></div>
+            <div class="sonBox">
+              <div
+                @click.stop="toCun(val.id)"
+                :class="{ active: item.id === gongNengInd }"
+                v-for="val in item.son"
+                :key="val.id"
+              >
+                · {{ val.name }}
+              </div>
             </div>
           </div>
         </div>
@@ -84,11 +153,19 @@
 
       <div class="special_topic">
         <img src="../assets/img/icon_q&a.png" @click="showQA = true" alt="" />
-        <img src="../assets/img/icon_special_topic.png" alt="" @click="topicModalVisible = true" />
+        <img
+          src="../assets/img/icon_special_topic.png"
+          alt=""
+          @click="topicModalVisible = true"
+        />
       </div>
     </div>
     <!-- 加载中 -->
-    <div class="homeLoading" :class="{ homeLoadingNone: isLoading }" v-loading="true"></div>
+    <div
+      class="homeLoading"
+      :class="{ homeLoadingNone: isLoading }"
+      v-loading="true"
+    ></div>
     <topic :value="topicModalVisible" @close="topicModalVisible = false" />
     <QA v-if="showQA" @closeQA="showQA = false"></QA>
   </div>
@@ -262,6 +339,47 @@ export default {
       villageLabel: null,
       villageLabels: [],
       // zoneLayer: null,
+
+      //类型划分模块
+      gongNengInd: null,
+      gongNengData: [
+        {
+          id: 10001,
+          name: "宗祠建筑",
+          son: [
+            { id: 3, name: "卢边村" },
+            { id: 10, name: "浮石村" },
+            { id: 2, name: "良溪村" },
+            { id: 6, name: "霄南村" },
+            { id: 7, name: "歇马村" },
+          ],
+        },
+        {
+          id: 10002,
+          name: "洋楼、书室建筑",
+          son: [{ id: 12, name: "横江村" }],
+        },
+        {
+          id: 10003,
+          name: "侨乡碉楼、居庐建筑",
+          son: [
+            { id: 5, name: "仓前村" },
+            { id: 11, name: "浮月村" },
+            { id: 9, name: "马降龙村" },
+            { id: 8, name: "自力村" },
+          ],
+        },
+        {
+          id: 10004,
+          name: "民居建筑",
+          son: [{ id: 1, name: "东宁村" }],
+        },
+        {
+          id: 10005,
+          name: "客家建筑",
+          son: [{ id: 4, name: "田心村" }],
+        },
+      ],
     };
   },
   //监听属性 类似于data概念
@@ -285,7 +403,7 @@ export default {
 
       // 监听地图缩放
       map.controls.distanceLegend.on(mars3d.EventType.change, function (event) {
-        console.log("比例尺发生变化", event);
+        // console.log("比例尺发生变化", event);
 
         const obj = {
           20000: [],
@@ -325,7 +443,11 @@ export default {
       const acInfo = this.villagePos.find((v) => v.id === id) || {};
 
       const graphic = new mars3d.graphic.DivGraphic({
-        position: new mars3d.LngLatPoint(acInfo.position[0], acInfo.position[1], 100),
+        position: new mars3d.LngLatPoint(
+          acInfo.position[0],
+          acInfo.position[1],
+          100
+        ),
         style: {
           html: `
           <div class="lableContent" _id=${id} >
@@ -339,7 +461,12 @@ export default {
           horizontalOrigin: mars3d.Cesium.HorizontalOrigin.LEFT,
           verticalOrigin: mars3d.Cesium.VerticalOrigin.BOTTOM,
           // distanceDisplayCondition: new mars3d.Cesium.DistanceDisplayCondition(0, 30000), // 按视距距离显示
-          scaleByDistance: new mars3d.Cesium.NearFarScalar(1000, 1.5, 12000, 0.8),
+          scaleByDistance: new mars3d.Cesium.NearFarScalar(
+            1000,
+            1.5,
+            12000,
+            0.8
+          ),
           clampToGround: true,
         },
         attr: {
@@ -360,9 +487,14 @@ export default {
         zoneSelect.style.display = "flex";
       }
     },
-    cutInd(id) {
-      if (this.mapDataInd === id) this.mapDataInd = null;
-      else this.mapDataInd = id;
+    cutInd(id, val) {
+      if (val) {
+        if (this.gongNengInd === id) this.gongNengInd = null;
+        else this.gongNengInd = id;
+      } else {
+        if (this.mapDataInd === id) this.mapDataInd = null;
+        else this.mapDataInd = id;
+      }
     },
     mySearch() {
       console.log("点击了搜索", this.name);
@@ -500,7 +632,11 @@ export default {
   //生命周期 - 创建完成(可以访问当前this实例)
   async created() {
     // 移动端和pc端的切换
-    if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
+    if (
+      window.navigator.userAgent.match(
+        /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
+      )
+    ) {
       // 移动端
       if (window.location.href.includes("web")) {
         window.location.href = window.location.href.replace("web", "webM");
@@ -566,6 +702,18 @@ export default {
   background-size: cover;
   overflow: hidden;
 
+  // 机关标识
+  #_ideConac{
+    position: absolute;
+    z-index: 99999;
+    top: 20px;
+    left: 20px;
+    &>img{
+      width: 50px;
+      height: auto;
+    }
+  }
+
   .homeLoading {
     position: absolute;
     top: 0;
@@ -733,9 +881,9 @@ export default {
         height: 40px;
         color: #e8e0d1;
         border-bottom: 1px solid #e8e0d1;
-        padding: 0 40px;
+        // padding: 0 40px;
         justify-content: space-between;
-        font-size: 22px;
+        font-size: 20px;
 
         & > div {
           cursor: pointer;
@@ -989,7 +1137,7 @@ export default {
   align-items: center;
   position: absolute;
   bottom: 30px;
-  left: 5px;
+  left: 50px;
   width: 40px;
   height: 40px;
   background-color: rgba(0, 16, 56, 0.7);