downloadAPP.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. </template>
  3. <script>
  4. export default {
  5. name: "downloadAPP",
  6. data(){
  7. return{
  8. version:{
  9. trident: '',
  10. presto: '',
  11. webKit: '',
  12. gecko: '',
  13. mobile: '',
  14. ios: '',
  15. android: '',
  16. iPhone: '',
  17. iPad: '',
  18. webApp: '',
  19. }
  20. }
  21. },
  22. mounted() {
  23. this.getVersion()
  24. },
  25. methods:{
  26. getVersion(){
  27. var u = navigator.userAgent, app = navigator.appVersion;
  28. this.version.trident = u.indexOf('Trident') > -1; //IE内核;
  29. this.version.trident= u.indexOf('Trident') > -1; //IE内核
  30. this.version.presto= u.indexOf('Presto') > -1; //opera内核
  31. this.version.webKit= u.indexOf('AppleWebKit') > -1; //苹果、谷歌内核
  32. this.version.gecko= u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1; //火狐内核
  33. this.version.mobile= !!u.match(/AppleWebKit.*Mobile.*/) || !!u.match(/AppleWebKit/); //是否为移动终端
  34. this.version.ios= !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
  35. this.version.android= u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
  36. this.version.iPhone= u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1; //是否为iPhone或者QQHD浏览器
  37. this.version.iPad= u.indexOf('iPad') > -1; //是否iPad
  38. this.version.webApp= u.indexOf('Safari') == -1; //是否web应该程序,没有头部与底部
  39. console.log('11111111111111111111111111111')
  40. if (this.version.ios || this.version.iPhone || this.version.iPad) {
  41. window.location = "http://d.firim.top/yg58";
  42. } else if (this.version.android) {
  43. window.location = "https://www.geidcp.com/api/file/pub/app/apk/__UNI__3E540D1_1127140956.apk";
  44. }
  45. },
  46. }
  47. }
  48. </script>
  49. <style scoped>
  50. </style>