shuishen
2022-04-12 ca0258c8e07a7a36616d7036d7baa1b7ab6b4bba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<template>
    <!-- 信息窗口主体mobilePopupOur -->
    <div id="mobilePopupOur" v-loading.fullscreen.lock="fullscreenLoading">
        <div class="m_p_heard">
            <div class="m_p_h_break" @click="closeBigPopup">
                <i class="el-icon-arrow-left icon"></i>
            </div>
            <div class="m_p_h_center">
                <div>
                    <div
                        v-if="mBigPopup.search"
                        style="color: #fff"
                    >查询结果{{ searchLabel ? " -- " + searchLabel : "" }}</div>
                    <el-dropdown trigger="click" @command="choiceIt" v-else>
                        <span class="el-dropdown-link">
                            {{ choiceValue }}
                            <i class="el-icon-arrow-down el-icon--right"></i>
                        </span>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item
                                v-for="(item, index) in choiceData"
                                :key="index"
                                :command="item"
                            >{{ item.name }}</el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </div>
            </div>
        </div>
        <div class="m_p_center">
            <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.name + cindex"
                    :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.title"
                    :name="item.key"
                >
                    <div class="m_p_c_tableIn">
                        <el-empty v-show="item.child.length == 0" description="暂无数据"></el-empty>
                        <mobilePopupOurOnce
                            v-for="(citem, cindex) in item.child"
                            :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;暂无更多
                            </el-divider>
                        </div>
                    </div>
                </el-tab-pane>
            </el-tabs>
        </div>
    </div>
</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", "popupOurOpenData"]),
    },
    name: "mobilePopupOur",
    data () {
        return {
            searchLabel: "",
            choiceValue: "",
            choiceKey: "",
            choiceMethod: "",
            choiceData: [],
            tabTable: [],
            fullscreenLoading: false,
            activeName: "1",
            choiceMain: "",
            onlyData: [],
        }
    },
    mounted () {
        this.fullscreenLoading = true
        if (this.mBigPopup.search) {
            //搜索事件
            this.searchLabel = this.mBigPopup.value
            // console.log("查询搜索结果", this.mBigPopup.value);
            this.fullscreenLoading = false
            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()
    },
    watch: {
        fullscreenLoading () {
            if (this.fullscreenLoading) {
                this.notLine()
            }
        },
    },
    methods: {
        handleClick (tab, event) {
            //头下部标签
            this.fullscreenLoading = true
            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
            }
            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) {
            // console.log(this.choiceMain, campus, type, "see");
            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 ? item.tpurl.split(",") : item.id
                        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 if (this.mBigPopup.name == "活动") {
                    // 社区建筑使用该id获取具体信息
                    data.records.forEach((item) => {
                        let icon = item.tpurl.split(",")
                        let useData = {
                            name: item.hdname,
                            // 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.hdname, //图片响应改变
                            from: this.choiceMain,
                            // QRImg: item.codeurl,
                            websiteUrl: item.websiteurl,
                            telePhone: item.telephone,
                            // address: item.address,
                            introduce: item.context,
                            video: item.videourl,
                            buts:
                                that.mBigPopup.name == "社区建筑" ||
                                    that.mBigPopup.name == "文化风景"
                                    ? ["定位", "实景", "图集"]
                                    : ["定位"],
                            //活动添加的字段
                            addressname: item.addressname.split(";"),
                            address: item.address.split(";"),
                            lxname: item.lxname.split(";"),
                            lx: item.lx.split(";"),
                            lntLat: [
                                item.address.split(";")[0].split(",")[0],
                                item.address.split(";")[0].split(",")[1],
                            ],
                            panoramaurl: item.panoramaurl, //全景
                        }
                        outList.push(useData)
                    })
                } 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 == "文化风景"
                                    ? ["定位", "实景", "图集"]
                                    : ["定位"],
                            panoramaurl: item.panoramaurl, //全景
                        }
                        outList.push(useData)
                    })
                }
                that.fullscreenLoading = false
                if (this.choiceMain == "机构单位" || 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.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 == "文化风景"
                                ? ["定位", "实景", "图集"]
                                : ["定位"],
                        panoramaurl: item.panoramaurl, //全景
                    }
                    outList.push(useData)
                })
                that.fullscreenLoading = false
                that.onlyData = outList
            })
        },
        notLine () {
            console.log("等待关闭")
            setTimeout(() => {
                this.fullscreenLoading = false
                console.log("关闭dolog")
            }, 5000)
        },
    },
};
</script>