From e40ee62d3e9b71ffe3432d32a53a00c4097b5708 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 31 Dec 2021 09:03:28 +0800
Subject: [PATCH] +3d  2.5d

---
 src/components/mobilePopupOur/index.vue |  645 ++++++++++++++++++++--------------------------------------
 1 files changed, 221 insertions(+), 424 deletions(-)

diff --git a/src/components/mobilePopupOur/index.vue b/src/components/mobilePopupOur/index.vue
index b3c26ad..92e36be 100644
--- a/src/components/mobilePopupOur/index.vue
+++ b/src/components/mobilePopupOur/index.vue
@@ -7,7 +7,7 @@
       <div class="m_p_h_center">
         <div>
           <div v-if="mBigPopup.search" style="color: #fff">
-            查询结果{{ searchLabel ? "--" + searchLabel : "" }}
+            查询结果{{ searchLabel ? " -- " + searchLabel : "" }}
           </div>
           <el-dropdown trigger="click" @command="choiceIt" v-else>
             <span class="el-dropdown-link">
@@ -17,7 +17,7 @@
               <el-dropdown-item
                 v-for="(item, index) in choiceData"
                 :key="index"
-                :command="item.name"
+                :command="item"
                 >{{ item.name }}</el-dropdown-item
               >
             </el-dropdown-menu>
@@ -26,12 +26,33 @@
       </div>
     </div>
     <div class="m_p_center">
-      <el-tabs v-model="activeName" @tab-click="handleClick">
+      <div
+        class="m_p_c_tableIn"
+        style="padding-top: 10px"
+        v-if="tabTable.length <= 0"
+      >
+        <el-empty
+          v-show="onlyData.length == 0"
+          description="暂无数据"
+        ></el-empty>
+        <mobilePopupOurOnce
+          v-for="(citem, cindex) in onlyData"
+          :key="citem.icons + ''"
+          :ends="onlyData.length - 1 == cindex"
+          :onceData="citem"
+        ></mobilePopupOurOnce>
+        <div v-show="onlyData.length != 0">
+          <el-divider content-position="left">
+            <i class="el-icon-s-promotion"></i>&nbsp;&nbsp;&nbsp;暂无更多
+          </el-divider>
+        </div>
+      </div>
+      <el-tabs v-model="activeName" @tab-click="handleClick" v-else>
         <el-tab-pane
           v-for="(item, index) in tabTable"
           :key="index"
-          :label="item.label"
-          :name="item.value"
+          :label="item.title"
+          :name="item.key"
         >
           <div class="m_p_c_tableIn">
             <el-empty
@@ -40,10 +61,11 @@
             ></el-empty>
             <mobilePopupOurOnce
               v-for="(citem, cindex) in item.child"
-              :key="cindex"
+              :key="citem.icons"
               :ends="item.child.length - 1 == cindex"
               :onceData="citem"
             ></mobilePopupOurOnce>
+            <!-- {{ citem.icon }} -->
             <div v-show="item.child.length != 0">
               <el-divider content-position="left">
                 <i class="el-icon-s-promotion"></i>&nbsp;&nbsp;&nbsp;暂无更多
@@ -57,446 +79,221 @@
 </template>
 
 <script>
+import { getListarc } from "@/api/mobile/public/arc"; //头部下标签页数据
 import { mapGetters } from "vuex";
+//搜索
+import { getListSearch } from "@/api/mobile/search/index";
 export default {
   computed: {
-    ...mapGetters(["mBigPopup"]),
+    ...mapGetters(["mBigPopup", "popupOurOpenData"]),
   },
   name: "mobilePopupOur",
   data() {
     return {
       searchLabel: "",
       choiceValue: "",
-      choiceData: [
-        {
-          name: "党群机构",
-          value: "1",
-        },
-        {
-          name: "职能部门",
-          value: "2",
-        },
-        {
-          name: "其他机构",
-          value: "3",
-        },
-      ],
-      tabTable: [
-        {
-          label: "西东大街",
-          value: "first",
-          child: [
-            {
-              name: "电力部门",
-              icon: "",
-              Cartesian3: {
-                x: -2852016.545079094,
-                y: 4654237.53861168,
-                z: 3288210.9971253853,
-              },
-              position: [121.49907024133591, 31.234911748958513],
-              buts: ["实景", "图集", "定位"],
-            },
-            {
-              name: "保安部门",
-              icon: "",
-              Cartesian3: {
-                x: -2853624.057617497,
-                y: 4654505.819491945,
-                z: 3286416.3935731286,
-              },
-              position: [121.51198333955459, 31.216073280697593],
-              buts: ["图集", "定位"],
-            },
-            {
-              name: "图书馆",
-              icon: "",
-              Cartesian3: {
-                x: -2852304.498038979,
-                y: 4655537.369322868,
-                z: 3286133.4029617086,
-              },
-              position: [121.4945198122125, 31.213002416673532],
-              buts: ["定位"],
-            },
-            {
-              name: "电力部门",
-              icon: "",
-              Cartesian3: {
-                x: -2852016.545079094,
-                y: 4654237.53861168,
-                z: 3288210.9971253853,
-              },
-              position: [121.49907024133591, 31.234911748958513],
-              buts: ["实景", "图集", "定位"],
-            },
-            {
-              name: "保安部门",
-              icon: "",
-              Cartesian3: {
-                x: -2853624.057617497,
-                y: 4654505.819491945,
-                z: 3286416.3935731286,
-              },
-              position: [121.51198333955459, 31.216073280697593],
-              buts: ["图集", "定位"],
-            },
-            {
-              name: "图书馆",
-              icon: "",
-              Cartesian3: {
-                x: -2852304.498038979,
-                y: 4655537.369322868,
-                z: 3286133.4029617086,
-              },
-              position: [121.4945198122125, 31.213002416673532],
-              buts: ["定位"],
-            },
-            {
-              name: "电力部门",
-              icon: "",
-              Cartesian3: {
-                x: -2852016.545079094,
-                y: 4654237.53861168,
-                z: 3288210.9971253853,
-              },
-              position: [121.49907024133591, 31.234911748958513],
-              buts: ["实景", "图集", "定位"],
-            },
-            {
-              name: "保安部门",
-              icon: "",
-              Cartesian3: {
-                x: -2853624.057617497,
-                y: 4654505.819491945,
-                z: 3286416.3935731286,
-              },
-              position: [121.51198333955459, 31.216073280697593],
-              buts: ["图集", "定位"],
-            },
-            {
-              name: "图书馆",
-              icon: "",
-              Cartesian3: {
-                x: -2852304.498038979,
-                y: 4655537.369322868,
-                z: 3286133.4029617086,
-              },
-              position: [121.4945198122125, 31.213002416673532],
-              buts: ["定位"],
-            },
-            {
-              name: "电力部门",
-              icon: "",
-              Cartesian3: {
-                x: -2852016.545079094,
-                y: 4654237.53861168,
-                z: 3288210.9971253853,
-              },
-              position: [121.49907024133591, 31.234911748958513],
-              buts: ["实景", "图集", "定位"],
-            },
-            {
-              name: "保安部门",
-              icon: "",
-              Cartesian3: {
-                x: -2853624.057617497,
-                y: 4654505.819491945,
-                z: 3286416.3935731286,
-              },
-              position: [121.51198333955459, 31.216073280697593],
-              buts: ["图集", "定位"],
-            },
-            {
-              name: "图书馆",
-              icon: "",
-              Cartesian3: {
-                x: -2852304.498038979,
-                y: 4655537.369322868,
-                z: 3286133.4029617086,
-              },
-              position: [121.4945198122125, 31.213002416673532],
-              buts: ["定位"],
-            },
-            {
-              name: "电力部门",
-              icon: "",
-              Cartesian3: {
-                x: -2852016.545079094,
-                y: 4654237.53861168,
-                z: 3288210.9971253853,
-              },
-              position: [121.49907024133591, 31.234911748958513],
-              buts: ["实景", "图集", "定位"],
-            },
-            {
-              name: "保安部门",
-              icon: "",
-              Cartesian3: {
-                x: -2853624.057617497,
-                y: 4654505.819491945,
-                z: 3286416.3935731286,
-              },
-              position: [121.51198333955459, 31.216073280697593],
-              buts: ["图集", "定位"],
-            },
-            {
-              name: "图书馆",
-              icon: "",
-              Cartesian3: {
-                x: -2852304.498038979,
-                y: 4655537.369322868,
-                z: 3286133.4029617086,
-              },
-              position: [121.4945198122125, 31.213002416673532],
-              buts: ["定位"],
-            },
-            {
-              name: "电力部门",
-              icon: "",
-              Cartesian3: {
-                x: -2852016.545079094,
-                y: 4654237.53861168,
-                z: 3288210.9971253853,
-              },
-              position: [121.49907024133591, 31.234911748958513],
-              buts: ["实景", "图集", "定位"],
-            },
-            {
-              name: "保安部门",
-              icon: "",
-              Cartesian3: {
-                x: -2853624.057617497,
-                y: 4654505.819491945,
-                z: 3286416.3935731286,
-              },
-              position: [121.51198333955459, 31.216073280697593],
-              buts: ["图集", "定位"],
-            },
-            {
-              name: "图书馆",
-              icon: "",
-              Cartesian3: {
-                x: -2852304.498038979,
-                y: 4655537.369322868,
-                z: 3286133.4029617086,
-              },
-              position: [121.4945198122125, 31.213002416673532],
-              buts: ["定位"],
-            },
-            {
-              name: "电力部门",
-              icon: "",
-              Cartesian3: {
-                x: -2852016.545079094,
-                y: 4654237.53861168,
-                z: 3288210.9971253853,
-              },
-              position: [121.49907024133591, 31.234911748958513],
-              buts: ["实景", "图集", "定位"],
-            },
-            {
-              name: "保安部门",
-              icon: "",
-              Cartesian3: {
-                x: -2853624.057617497,
-                y: 4654505.819491945,
-                z: 3286416.3935731286,
-              },
-              position: [121.51198333955459, 31.216073280697593],
-              buts: ["图集", "定位"],
-            },
-            {
-              name: "图书馆",
-              icon: "",
-              Cartesian3: {
-                x: -2852304.498038979,
-                y: 4655537.369322868,
-                z: 3286133.4029617086,
-              },
-              position: [121.4945198122125, 31.213002416673532],
-              buts: ["定位"],
-            },
-            {
-              name: "电力部门",
-              icon: "",
-              Cartesian3: {
-                x: -2852016.545079094,
-                y: 4654237.53861168,
-                z: 3288210.9971253853,
-              },
-              position: [121.49907024133591, 31.234911748958513],
-              buts: ["实景", "图集", "定位"],
-            },
-            {
-              name: "保安部门",
-              icon: "",
-              Cartesian3: {
-                x: -2853624.057617497,
-                y: 4654505.819491945,
-                z: 3286416.3935731286,
-              },
-              position: [121.51198333955459, 31.216073280697593],
-              buts: ["图集", "定位"],
-            },
-            {
-              name: "图书馆",
-              icon: "",
-              Cartesian3: {
-                x: -2852304.498038979,
-                y: 4655537.369322868,
-                z: 3286133.4029617086,
-              },
-              position: [121.4945198122125, 31.213002416673532],
-              buts: ["定位"],
-            },
-          ],
-        },
-        {
-          label: "长江路",
-          value: "second",
-          child: [
-            {
-              name: "电力部门1",
-              icon: "",
-              Cartesian3: {
-                x: -2852016.545091094,
-                y: 4654237.53861168,
-                z: 3288210.9971238153,
-              },
-              position: [121.49190702133591, 31.234911741858513],
-              buts: ["实景", "图集", "定位"],
-            },
-            {
-              name: "保安部门1",
-              icon: "",
-              Cartesian3: {
-                x: -2852016.541509094,
-                y: 4654237.53816168,
-                z: 3288210.9971125853,
-              },
-              position: [121.49907021413591, 31.234911741895513],
-              buts: ["图集", "定位"],
-            },
-            {
-              name: "图书馆1",
-              icon: "",
-              Cartesian3: {
-                x: -2852016.545019094,
-                y: 4654237.53861168,
-                z: 3288210.9971123853,
-              },
-              position: [121.49901024133591, 31.234911749581513],
-              buts: ["定位"],
-            },
-          ],
-        },
-        {
-          label: "科技园",
-          value: "third",
-          child: [],
-        },
-        {
-          label: "逸夫楼",
-          value: "fourth",
-          child: [],
-        },
-      ],
+      choiceKey: "",
+      choiceMethod: "",
+      choiceData: [],
+      tabTable: [],
       fullscreenLoading: false,
-      activeName: "first",
+      activeName: "1",
+      choiceMain: "",
+      onlyData: [],
     };
   },
-  // watch: {
-  //   mBigPopup() {
-  //     console.log(this.mBigPopup.name);
-  //     this.choiceValue = this.mBigPopup.name;
-  //   },
-  // },
   mounted() {
     this.fullscreenLoading = true;
-    setTimeout(() => {
-      if (this.mBigPopup.search) {
-        this.searchLabel = this.mBigPopup.value;
-        console.log("查询搜索结果", this.mBigPopup.value);
-        this.fullscreenLoading = false;
-        return;
-      }
-      this.choiceValue = this.mBigPopup.name;
+    if (this.mBigPopup.search) {
+      //搜索事件
+      this.searchLabel = this.mBigPopup.value;
+      // console.log("查询搜索结果", this.mBigPopup.value);
       this.fullscreenLoading = false;
-      this.$store.commit("MSET_BIGPOPUPAFTER", false);
-      console.log("请求对应街道接口");
-    }, 500);
-    // this.choiceValue = this.choiceData[0].name;
+      this.choiceMain = "搜索";
+      this.getListSearchMethod(this.mBigPopup.value);
+      return;
+    }
+    this.choiceMain = this.popupOurOpenData.qurey; // 进入的主题:列:机构单位,校园建筑
+    this.choiceData = this.popupOurOpenData.main; //带入数据  包括name、type、method
+
+    this.choiceValue = this.popupOurOpenData.main[0].name;
+    this.choiceKey = this.popupOurOpenData.main[0].type;
+    this.choiceMethod = this.popupOurOpenData.main[0].method;
+
+    this.$store.commit("MSET_BIGPOPUPAFTER", false); //关闭前一个弹窗
+    // console.log("请求对应街道接口", this.popupOurOpenData);
+    this.getDataHeardDown();
   },
   methods: {
     handleClick(tab, event) {
-      console.log(tab.name);
-    },
-    choiceIt(name) {
+      //头下部标签
       this.fullscreenLoading = true;
-      setTimeout(() => {
-        this.choiceValue = name;
-        this.fullscreenLoading = false;
-        console.log("请求对应头部下拉菜单接口");
-      }, 500);
+      this.getOutList(this.activeName, this.choiceKey);
+    },
+    choiceIt(command) {
+      //头部下拉菜单
+      this.fullscreenLoading = true;
+      this.choiceValue = command.name;
+      this.choiceKey = command.type;
+      this.choiceMethod = command.method; //更改请求
+      // console.log("请求对应头部下拉菜单接口", command);
+      this.getOutList(this.activeName, this.choiceKey);
     },
     closeBigPopup() {
       this.$store.commit("MSET_BIGPOPUP", false);
     },
+    getDataHeardDown() {
+      if (this.choiceMain == "机构单位") {
+        //不请求头部标签页数据
+        this.getOutList(this.choiceKey);
+        return;
+      }
+      //获取头下部标签页
+      getListarc().then((res) => {
+        let title = [];
+        res.data.data.forEach((item) => {
+          title.push({
+            title: item.dictValue,
+            flag: false,
+            key: item.dictKey,
+            child: [],
+          });
+        });
+        this.tabTable = title;
+        this.getOutList(this.activeName, this.choiceKey);
+      });
+    },
+    //请求
+    getOutList(campus, type) {
+      let that = this;
+      let d;
+      if (this.choiceMain == "机构单位") {
+        // 不传标签页
+        d = {
+          type: type,
+        };
+      } else if (
+        this.choiceMain == "生活设施" ||
+        this.choiceMain == "出入口" ||
+        this.choiceMain == "停车场"
+      ) {
+        // 改变传入属性
+        d = {
+          campus: campus,
+          lifetype: type,
+        };
+      } else {
+        d = {
+          campus: campus,
+          type: type,
+        };
+      }
+      this.choiceMethod(d).then((res) => {
+        const data = res.data.data;
+        let outList = [];
+        if (
+          this.mBigPopup.name == "校园建筑" ||
+          this.mBigPopup.name == "文化风景"
+        ) {
+          // 校园建筑使用该id获取具体信息
+          data.forEach((item) => {
+            let icon = item.tpurl.split(",");
+            outList.push({
+              id: item.id,
+              name: item.mechanismname,
+              icon: icon,
+              icons: icon + item.mechanismname, //图片响应改变
+              from: this.choiceMain,
+              video: item.videourl,
+              buts:
+                this.mBigPopup.name == "校园建筑" ||
+                this.mBigPopup.name == "文化风景"
+                  ? ["定位", "实景", "图集"]
+                  : ["定位"],
+            });
+          });
+        } else {
+          //正常获取全部数据
+          data.records.forEach((item) => {
+            let icon = item.tpurl.split(",");
+            let useData = {
+              name: item.mechanismname,
+              lntLat: [item.jd, item.wd],
+              alt: item.gd,
+              heading: item.heading,
+              pitch: item.pitch,
+              roll: item.roll,
+              bgImg: item.tpurl,
+              icon: icon,
+              icons: icon + item.mechanismname, //图片响应改变
+              from: this.choiceMain,
+              QRImg: item.codeurl,
+              websiteUrl: item.websiteurl,
+              telePhone: item.telephone,
+              address: item.address,
+              introduce: item.introduce,
+              video: item.videourl,
+              buts:
+                that.mBigPopup.name == "校园建筑" ||
+                that.mBigPopup.name == "文化风景"
+                  ? ["定位", "实景", "图集"]
+                  : ["定位"],
+            };
+            outList.push(useData);
+          });
+        }
+        that.fullscreenLoading = false;
+        if (this.choiceMain == "机构单位") {
+          that.onlyData = outList;
+          return;
+        }
+        that.tabTable[+campus - 1].child = outList;
+      });
+    },
+    //搜索请求
+    getListSearchMethod(name) {
+      let val = {
+          mechanismName: name,
+        },
+        that = this;
+      getListSearch(val).then((res) => {
+        if (res.data.code != 200) {
+          return;
+        }
+        const data = res.data.data;
+        //正常获取全部数据
+        let outList = [];
+        data.forEach((item) => {
+          let icon = item.list.tpurl.split(",");
+          let useData = {
+            name: item.list.mechanismname,
+            lntLat: [item.list.jd, item.list.wd],
+            alt: item.list.gd,
+            heading: item.list.heading,
+            pitch: item.list.pitch,
+            roll: item.list.roll,
+            bgImg: item.list.tpurl,
+            icon: icon,
+            icons: icon + item.list.mechanismname, //图片响应改变
+            from: this.choiceMain,
+            QRImg: item.list.codeurl,
+            websiteUrl: item.list.websiteurl,
+            telePhone: item.list.telephone,
+            address: item.list.address,
+            introduce: item.list.introduce,
+            video: item.list.videourl,
+            buts:
+              that.mBigPopup.name == "校园建筑" ||
+              that.mBigPopup.name == "文化风景"
+                ? ["定位", "实景", "图集"]
+                : ["定位"],
+          };
+          outList.push(useData);
+        });
+        that.fullscreenLoading = false;
+        that.onlyData = outList;
+      });
+    },
   },
 };
-</script>
-
-<style lang="scss" scoped>
-#mobilePopupOur {
-  position: fixed;
-  top: 0;
-  left: 0;
-  width: 100%;
-  height: 100%;
-  background-color: #fff;
-  z-index: 300;
-  .m_p_heard {
-    width: 100%;
-    height: 50px;
-    background-color: #a40000;
-    .m_p_h_break {
-      position: absolute;
-      left: 0;
-      top: 0;
-      width: 50px;
-      height: 50px;
-      display: flex;
-      align-items: center;
-      justify-content: center;
-      .icon {
-        font-size: 22px;
-        color: #fff;
-      }
-    }
-    .m_p_h_center {
-      width: 100%;
-      height: 50px;
-      display: flex;
-      align-items: center;
-      justify-content: center;
-      .el-dropdown-link {
-        color: #fff;
-      }
-    }
-  }
-  .m_p_center {
-    width: 100%;
-    height: calc(100% - 50px);
-    // border: 1px solid red
-    box-sizing: border-box;
-    .m_p_c_tableIn {
-      width: 100%;
-      height: 100%;
-      box-sizing: border-box;
-      overflow-x: hidden;
-      overflow-y: auto;
-    }
-  }
-}
-</style>
\ No newline at end of file
+</script>
\ No newline at end of file

--
Gitblit v1.9.3