mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	fix: mobile bug
This commit is contained in:
		
							parent
							
								
									fd387fe5cd
								
							
						
					
					
						commit
						298ffd4b0f
					
				
							
								
								
									
										43
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										43
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -580,9 +580,9 @@
 | 
			
		||||
      "dev": true
 | 
			
		||||
    },
 | 
			
		||||
    "element-plus": {
 | 
			
		||||
      "version": "1.0.2-beta.35",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/element-plus/-/element-plus-1.0.2-beta.35.tgz",
 | 
			
		||||
      "integrity": "sha1-FYiQvd8o+ElfJh0CeJvzlMXJcSM=",
 | 
			
		||||
      "version": "1.0.2-beta.36",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/element-plus/-/element-plus-1.0.2-beta.36.tgz",
 | 
			
		||||
      "integrity": "sha1-eKfhvhC5YixPw0L9zggBZQ8wuwE=",
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "@popperjs/core": "^2.4.4",
 | 
			
		||||
        "async-validator": "^3.4.0",
 | 
			
		||||
@ -635,9 +635,9 @@
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "esbuild": {
 | 
			
		||||
      "version": "0.9.6",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/esbuild/-/esbuild-0.9.6.tgz",
 | 
			
		||||
      "integrity": "sha1-LK5RnnziMo7PV65zgJDQfOckWFA=",
 | 
			
		||||
      "version": "0.9.7",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/esbuild/-/esbuild-0.9.7.tgz",
 | 
			
		||||
      "integrity": "sha1-6g1jnL5LiOwl++1Nb/AMjXiO9ws=",
 | 
			
		||||
      "dev": true
 | 
			
		||||
    },
 | 
			
		||||
    "escalade": {
 | 
			
		||||
@ -1001,6 +1001,11 @@
 | 
			
		||||
      "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
 | 
			
		||||
      "dev": true
 | 
			
		||||
    },
 | 
			
		||||
    "mutation-observer": {
 | 
			
		||||
      "version": "1.0.3",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/mutation-observer/-/mutation-observer-1.0.3.tgz",
 | 
			
		||||
      "integrity": "sha1-QukiKxAbyoLlup1aes9KFMDyY9A="
 | 
			
		||||
    },
 | 
			
		||||
    "nanoid": {
 | 
			
		||||
      "version": "3.1.20",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/nanoid/-/nanoid-3.1.20.tgz",
 | 
			
		||||
@ -1235,9 +1240,9 @@
 | 
			
		||||
      "dev": true
 | 
			
		||||
    },
 | 
			
		||||
    "rollup": {
 | 
			
		||||
      "version": "2.42.3",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/rollup/-/rollup-2.42.3.tgz",
 | 
			
		||||
      "integrity": "sha1-eTXXvIaH+qV0NDLiB9dhqjH+b+4=",
 | 
			
		||||
      "version": "2.44.0",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/rollup/-/rollup-2.44.0.tgz",
 | 
			
		||||
      "integrity": "sha1-jaMk0cT9Er7vmubhL0BoJlttles=",
 | 
			
		||||
      "dev": true,
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "fsevents": "~2.3.1"
 | 
			
		||||
@ -1354,6 +1359,11 @@
 | 
			
		||||
        "is-number": "^7.0.0"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "transitionEnd": {
 | 
			
		||||
      "version": "1.0.2",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/transitionEnd/-/transitionEnd-1.0.2.tgz",
 | 
			
		||||
      "integrity": "sha1-GRTbW0Wn79w0oBr2koWjppOHFjM="
 | 
			
		||||
    },
 | 
			
		||||
    "troisjs": {
 | 
			
		||||
      "version": "0.1.19",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/troisjs/-/troisjs-0.1.19.tgz",
 | 
			
		||||
@ -1423,10 +1433,19 @@
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/v-contextmenu/-/v-contextmenu-3.0.0-alpha.4.tgz",
 | 
			
		||||
      "integrity": "sha1-9GWYrJivrF1duMZUDfwSMEztEUA="
 | 
			
		||||
    },
 | 
			
		||||
    "vconsole": {
 | 
			
		||||
      "version": "3.4.0",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/vconsole/-/vconsole-3.4.0.tgz",
 | 
			
		||||
      "integrity": "sha1-LPL/qobNerc2mXoitj0FYnxqtWc=",
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "mutation-observer": "^1.0.3",
 | 
			
		||||
        "transitionEnd": "^1.0.2"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "vite": {
 | 
			
		||||
      "version": "2.1.2",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/vite/-/vite-2.1.2.tgz",
 | 
			
		||||
      "integrity": "sha1-CuyvbTQRKyRTbfGhTNjXT9yrbiA=",
 | 
			
		||||
      "version": "2.1.4",
 | 
			
		||||
      "resolved": "http://192.168.250.101:4873/vite/-/vite-2.1.4.tgz",
 | 
			
		||||
      "integrity": "sha1-ZjloI3AeVM87+59z29OGybQynIY=",
 | 
			
		||||
      "dev": true,
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "esbuild": "^0.9.3",
 | 
			
		||||
 | 
			
		||||
@ -11,7 +11,7 @@
 | 
			
		||||
    "await-to-js": "^2.1.1",
 | 
			
		||||
    "axios": "^0.21.1",
 | 
			
		||||
    "dotenv": "^8.2.0",
 | 
			
		||||
    "element-plus": "^1.0.2-beta.35",
 | 
			
		||||
    "element-plus": "^1.0.2-beta.36",
 | 
			
		||||
    "mitt": "^2.1.0",
 | 
			
		||||
    "mockjs": "^1.1.0",
 | 
			
		||||
    "nprogress": "^0.2.0",
 | 
			
		||||
@ -22,6 +22,7 @@
 | 
			
		||||
    "three": "^0.126.1",
 | 
			
		||||
    "troisjs": "^0.1.19",
 | 
			
		||||
    "v-contextmenu": "^3.0.0-alpha.4",
 | 
			
		||||
    "vconsole": "^3.4.0",
 | 
			
		||||
    "vue": "^3.0.7",
 | 
			
		||||
    "vue-i18n": "^9.0.0",
 | 
			
		||||
    "vue-router": "^4.0.4",
 | 
			
		||||
@ -44,7 +45,7 @@
 | 
			
		||||
    "sass": "^1.32.8",
 | 
			
		||||
    "sass-loader": "^11.0.1",
 | 
			
		||||
    "typescript": "^4.2.2",
 | 
			
		||||
    "vite": "^2.1.2",
 | 
			
		||||
    "vite": "^2.1.4",
 | 
			
		||||
    "vite-plugin-mock": "^2.4.0"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@ import {
 | 
			
		||||
 | 
			
		||||
import { mapJson } from "../../api/map";
 | 
			
		||||
import greenCar from "/@/assets/green.png";
 | 
			
		||||
import { deviceDetection } from "../../utils/deviceDetection"
 | 
			
		||||
 | 
			
		||||
let MarkerCluster = null;
 | 
			
		||||
 | 
			
		||||
@ -44,7 +45,7 @@ export default defineComponent({
 | 
			
		||||
    let map: MapConfigureInter;
 | 
			
		||||
 | 
			
		||||
    const mapSet: mapInter = reactive({
 | 
			
		||||
      loading: true,
 | 
			
		||||
      loading: deviceDetection() ? false : true,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // 地图创建完成(动画关闭)
 | 
			
		||||
@ -134,6 +135,7 @@ export default defineComponent({
 | 
			
		||||
          complete();
 | 
			
		||||
        })
 | 
			
		||||
        .catch((err) => {
 | 
			
		||||
          mapSet.loading = false;
 | 
			
		||||
          throw "地图加载失败,请重新加载";
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,9 @@ import axios from 'axios'
 | 
			
		||||
const app = createApp(App)
 | 
			
		||||
app.config.globalProperties.$config = getConfig()
 | 
			
		||||
 | 
			
		||||
// import vConsole from 'vconsole'
 | 
			
		||||
// app.config.globalProperties.$vConsole = new vConsole()
 | 
			
		||||
 | 
			
		||||
// 获取项目动态全局配置
 | 
			
		||||
export const getServerConfig = async (): Promise<any> => {
 | 
			
		||||
  return axios({
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										25
									
								
								src/utils/deviceDetection/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/utils/deviceDetection/index.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
			
		||||
interface deviceInter {
 | 
			
		||||
  match: any
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 检测设备类型(手机返回true,反之)
 | 
			
		||||
export const deviceDetection = () => {
 | 
			
		||||
  let sUserAgent: deviceInter = navigator.userAgent.toLowerCase()
 | 
			
		||||
  let bIsIpad = sUserAgent.match(/ipad/i) == "ipad"
 | 
			
		||||
  let bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"
 | 
			
		||||
  let bIsMidp = sUserAgent.match(/midp/i) == "midp"
 | 
			
		||||
  let bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"
 | 
			
		||||
  let bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"
 | 
			
		||||
  let bIsAndroid = sUserAgent.match(/android/i) == "android"
 | 
			
		||||
  let bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"
 | 
			
		||||
  let bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"
 | 
			
		||||
  return bIsIphoneOs ||
 | 
			
		||||
    bIsMidp ||
 | 
			
		||||
    bIsUc7 ||
 | 
			
		||||
    bIsUc ||
 | 
			
		||||
    bIsAndroid ||
 | 
			
		||||
    bIsCE ||
 | 
			
		||||
    bIsWM
 | 
			
		||||
    ? true
 | 
			
		||||
    : false
 | 
			
		||||
};
 | 
			
		||||
@ -6,36 +6,11 @@
 | 
			
		||||
import { onMounted } from "vue";
 | 
			
		||||
import Player from "xgplayer/dist/simple_player";
 | 
			
		||||
import { volume, playbackRate, screenShot } from "xgplayer/dist/controls";
 | 
			
		||||
import { deviceDetection } from "../../../utils/deviceDetection"
 | 
			
		||||
 | 
			
		||||
export interface deviceInter {
 | 
			
		||||
  match: any;
 | 
			
		||||
}
 | 
			
		||||
export default {
 | 
			
		||||
  setup() {
 | 
			
		||||
    // 检测设备类型(手机返回true,反之)
 | 
			
		||||
    const deviceDetection = () => {
 | 
			
		||||
      let sUserAgent: deviceInter = navigator.userAgent.toLowerCase();
 | 
			
		||||
      let bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
 | 
			
		||||
      let bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
 | 
			
		||||
      let bIsMidp = sUserAgent.match(/midp/i) == "midp";
 | 
			
		||||
      let bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
 | 
			
		||||
      let bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
 | 
			
		||||
      let bIsAndroid = sUserAgent.match(/android/i) == "android";
 | 
			
		||||
      let bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
 | 
			
		||||
      let bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
 | 
			
		||||
      return bIsIphoneOs ||
 | 
			
		||||
        bIsMidp ||
 | 
			
		||||
        bIsUc7 ||
 | 
			
		||||
        bIsUc ||
 | 
			
		||||
        bIsAndroid ||
 | 
			
		||||
        bIsCE ||
 | 
			
		||||
        bIsWM
 | 
			
		||||
        ? true
 | 
			
		||||
        : false;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    onMounted(() => {
 | 
			
		||||
      console.log("---", deviceDetection());
 | 
			
		||||
      let player = new Player({
 | 
			
		||||
        id: "mse",
 | 
			
		||||
        autoplay: false,
 | 
			
		||||
 | 
			
		||||
@ -59,7 +59,7 @@ export default ({ command }: ConfigEnv): UserConfigExport => {
 | 
			
		||||
    build: {
 | 
			
		||||
      brotliSize: false,
 | 
			
		||||
      // 消除打包大小超过500kb警告
 | 
			
		||||
      chunkSizeWarningLimit: 800
 | 
			
		||||
      chunkSizeWarningLimit: 2000
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user