Browse Source

在app.vue created时获取楼层列表

yunxing 4 years ago
parent
commit
47a9b0bb28
5 changed files with 48 additions and 11 deletions
  1. 11 2
      src/App.vue
  2. 6 2
      src/api/public.js
  3. 19 1
      src/store/index.ts
  4. 5 2
      src/views/overview/UpdateRecord.vue
  5. 7 4
      src/views/overview/index.vue

+ 11 - 2
src/App.vue

@@ -1,6 +1,6 @@
 <template>
     <!-- ios头部padding适配 -->
-    <div id='app' >
+    <div id='app'>
         <div id='fengMap' class='fengMap'></div>
         <!-- 顶部navbar -->
         <NarBar class='nav-bar' v-if='!$route.meta.hideNarBar' />
@@ -63,12 +63,15 @@ export default {
         store.commit('SETSSOTOKEN', 'admin:liujiandong')
         console.log(window.location.href)
         this.SETHAVEFENGMAP(false)
+        // 判断 安卓,ios
         const { os } = osInfo()
         if (os === 'iOS') {
             this.isIOS = true
         } else {
             this.isIOS = false
         }
+        // 获取楼层列表
+        this.getFloorList()
     },
     mounted() {
         console.log('环境变量', process.env.VUE_APP_RealEnv)
@@ -82,7 +85,7 @@ export default {
         ...mapGetters(['plazaId', 'fmapID']),
     },
     methods: {
-        ...mapActions(['getfmapID']),
+        ...mapActions(['getfmapID', 'getFloors']),
         ...mapMutations(['SETHAVEFENGMAP']),
         getFengMap() {
             this.getfmapID().then(() => {
@@ -127,6 +130,12 @@ export default {
             this.$router.push({ name: this.routeDict[active] })
             store.commit('SETAPPTITLE', this.titleDict[active])
         },
+        /**
+         * 查询楼层列表
+         */
+        getFloorList() {
+            this.getFloors()
+        },
     },
     watch: {
         plazaId(plazaId) {

+ 6 - 2
src/api/public.js

@@ -1,9 +1,13 @@
-import httputils from "@/api/httputils"
+import httputils from '@/api/httputils'
 
 //查询系统图展示所需数据 --平面图业务数据
 export function readGroup(postParams) {
     return httputils.postJson(`/serve/topology-wanda/graph/read`, postParams)
 }
+// 查询铺位名称
+export function queryBrand({ data, postParams }) {
+    return httputils.fetchJson(`/data/tb_brand_intentiondetail/query`, data, postParams)
+}
 //记录PV/UV
 export function getPvUv(data, postParams) {
     return httputils.fetchJson(`/data/pvuv/save`, data, postParams)
@@ -13,6 +17,6 @@ export function setFloor(data, postParams) {
     return httputils.fetchJson(`/data/plaza/floor/set`, data, postParams)
 }
 // 查询图
-export function graphQuery(params){
+export function graphQuery(params) {
     return httputils.postJson(`/serve/topology-wanda/graph/query`, params)
 }

+ 19 - 1
src/store/index.ts

@@ -1,6 +1,6 @@
 import Vue from 'vue'
 import Vuex from 'vuex'
-import { queryfmapID } from '@/api/login.js'
+import { queryfmapID, queryFloor } from '@/api/login.js'
 import { queryBrand } from '@/api/public.js'
 
 Vue.use(Vuex)
@@ -15,6 +15,7 @@ export default new Vuex.Store({
         haveFengMap: -1, //是否有蜂鸟地图的数据 -1为等待 0 为失败 1 为成功
         isMessage: true, //是否有发布的图
         bunkObj: {}, // 铺位名称
+        floorsArr: [], //楼层数组
     },
     getters: {
         ssoToken: (state) => state.ssoToken,
@@ -47,6 +48,10 @@ export default new Vuex.Store({
         SETBUNKOBJ(state, data) {
             state.bunkObj = data
         },
+        // 设置楼层列表
+        SETFLOORS(state, data) {
+            state.floorsArr = data
+        },
     },
     actions: {
         async getfmapID(context) {
@@ -73,6 +78,19 @@ export default new Vuex.Store({
                 context.commit('SETBUNKOBJ', obj)
             })
         },
+        /**
+         * 获取楼层列表
+         * @param context
+         */
+        async getFloors(context) {
+            await queryFloor({
+                plazaId: context.state.plazaId,
+            }).then((res: any) => {
+                if (res.result == 'success') {
+                    context.commit('SETFLOORS', res.data)
+                }
+            })
+        },
     },
     modules: {},
 })

+ 5 - 2
src/views/overview/UpdateRecord.vue

@@ -39,6 +39,7 @@ import { NavBar, DropdownMenu, DropdownItem, List } from 'vant'
 Vue.use(NavBar)
 Vue.use(DropdownMenu).use(DropdownItem)
 Vue.use(List)
+import { mapGetters } from 'vuex'
 // import { getChangeList } from '@/api/homePage'
 import { queryEventypes } from '@/api/overview'
 import { querySelect } from '@/api/public'
@@ -49,7 +50,6 @@ export default {
     components: {},
     data() {
         return {
-            plazaId: '1000423',
             objType: 0,
             option: [
                 { text: '全部', value: 0 },
@@ -67,10 +67,13 @@ export default {
             finished: false,
         }
     },
+    computed: {
+        ...mapGetters(['plazaId']),
+    },
     created() {
         let params = {
             getParams: {
-                plazaId: '1000423',
+                plazaId: this.plazaId,
                 page: 1,
                 size: 100,
             },

+ 7 - 4
src/views/overview/index.vue

@@ -6,7 +6,7 @@
         <div class='my-swipe'>
             <van-swipe :autoplay='0' indicator-color='white'>
                 <van-swipe-item v-for='(image, index) in imgList' :key='index'>
-                    <span class='type-name'>{{ image.typename }}</span>
+                    <span class='type-name' v-show='image.typename'>{{ image.typename }}</span>
                     <van-image fit='contain' :src='image.url' />
                 </van-swipe-item>
             </van-swipe>
@@ -181,6 +181,7 @@ Vue.use(Button).use(Icon).use(Swipe).use(SwipeItem).use(Lazyload).use(VanImage)
 Vue.use(Tab).use(Tabs)
 Vue.use(NoticeBar)
 Vue.use(Empty)
+import { mapGetters } from 'vuex'
 // lodash
 import { isEmpty } from 'lodash'
 // moment
@@ -197,7 +198,6 @@ export default {
             showImgPreview: true,
             imgList: ['https://img.yzcdn.cn/vant/apple-1.jpg', 'https://img.yzcdn.cn/vant/apple-2.jpg'],
             active: 0, //  激活的tab页 0:建筑综合信息 1:施工单位信息
-            plazaId: '1000423', //广场ID
             plazaName: '', //广场名称
             build: [], //建筑综合信息
             totalContractInfo: {}, //总包信息
@@ -213,6 +213,9 @@ export default {
             },
         }
     },
+    computed: {
+        ...mapGetters(['plazaId']),
+    },
     watch: {
         showImgPreview(val) {
             console.log('========')
@@ -368,8 +371,8 @@ export default {
                 position: relative;
                 .type-name {
                     display: inline-block;
-                    width: 100px;
-                    padding: 10px 0 10px 20px;
+                    width: 70px;
+                    padding: 5px 0 5px 10px;
                     position: absolute;
                     z-index: 10;
                     left: 0;