1
shuishen
2022-11-18 37a4a03e1ddef4f66904dccee54b684e73e9a3b2
src/App.vue
@@ -1,11 +1,12 @@
<template>
    <div id="app" :class="{ cantdoit: cantdoits }">
    <div ref="appRef" id="app" :class="{ cantdoit: cantdoits }">
        <router-view v-if="isRouterActive"></router-view>
    </div>
</template>
<script>
import AMapLoader from '@amap/amap-jsapi-loader'
// import AMapLoader from '@amap/amap-jsapi-loader'
import DevicePixelRatio from './utils/devicePixelRatio'
export default {
    name: 'App',
@@ -19,7 +20,9 @@
        }
    },
    created () {
        if (!this._isMobile()) {
            new DevicePixelRatio().init()
        }
    },
    mounted () {
        var transmitData = {}
@@ -43,50 +46,59 @@
        if (this._isMobile()) {
            this.cantdoits = true
            // 手机端
            document.title = '江西经济管理干部学院三维可视化平台'
            this.$router.replace('/mobileLayout')
            AMapLoader.load({
                key: '9c4b1a0ce88821775605e726073c52b5', // 申请好的Web端开发者Key,首次调用 load 时必填
                version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
                plugins: [] // 插件列表
            })
                .then((AMap) => {
                    window.AMap = AMap
                    // that.map = new AMap.Map("mymap", {
                    //   center: [115.84414205551147, 28.678983439095823],
                    //   zoom: 14,
                    // });
            // AMapLoader.load({
            //     key: '9c4b1a0ce88821775605e726073c52b5', // 申请好的Web端开发者Key,首次调用 load 时必填
            //     version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
            //     plugins: [] // 插件列表
            // })
            //     .then((AMap) => {
            //         window.AMap = AMap
            //         // that.map = new AMap.Map("mymap", {
            //         //   center: [115.84414205551147, 28.678983439095823],
            //         //   zoom: 14,
            //         // });
                    // this.map.on('touchmove', (e) => {
                    //     console.log(e)
                    // })
            //         // this.map.on('touchmove', (e) => {
            //         //     console.log(e)
            //         // })
                    // that.getLocationInfor(AMap, 115.84414205551147, 28.678983439095823);
                    // that.map.on("mapmove", () => {
                    //   that.mouseMoveFlag = false;
                    //   that.mouseMoveFlag = true;
                    //   var currentCenter = that.map.getCenter();
                    //   if (that.setime) {
                    //     clearTimeout(that.setime);
                    //   }
                    //   that.setime = setTimeout(() => {
                    //     that.getLocationInfor(AMap, currentCenter.lng, currentCenter.lat);
                    //     clearTimeout(that.setime);
                    //     that.setime = null;
                    //   }, 200);
                    // });
            //         // that.getLocationInfor(AMap, 115.84414205551147, 28.678983439095823);
            //         // that.map.on("mapmove", () => {
            //         //   that.mouseMoveFlag = false;
            //         //   that.mouseMoveFlag = true;
            //         //   var currentCenter = that.map.getCenter();
            //         //   if (that.setime) {
            //         //     clearTimeout(that.setime);
            //         //   }
            //         //   that.setime = setTimeout(() => {
            //         //     that.getLocationInfor(AMap, currentCenter.lng, currentCenter.lat);
            //         //     clearTimeout(that.setime);
            //         //     that.setime = null;
            //         //   }, 200);
            //         // });
                    // this.map.on('mousemove', (e) => {
                    //     console.log(e)
                    // })
                })
                .catch((e) => {
                    console.log(e)
                })
            //         // this.map.on('mousemove', (e) => {
            //         //     console.log(e)
            //         // })
            //     })
            //     .catch((e) => {
            //         console.log(e)
            //     })
        } else {
            // pc端
            // this.$router.replace('/large')
            this.$router.replace('/pcLayout')
            // if (this.$route.path == '/pcLayout/default') {
            //     this.$router.replace('/pcLayout')
            // }
            //  else {
            //     this.$router.replace('/login')
            // }
        }
    },
    methods: {
@@ -105,17 +117,6 @@
            var r = window.location.href.slice(inlength)
            if (r != null) return decodeURIComponent(r)
            return null
        },
        getQueryVariable (variable) {
            var query = window.location.search.substring(1)
            var vars = query.split('&')
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split('=')
                if (pair[0] == variable) {
                    return pair[1]
                }
            }
            return false
        },
        _isMobile () {
            const flag = navigator.userAgent.match(
@@ -136,6 +137,7 @@
    padding: 0;
    overflow: hidden;
}
#app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;