downLoad.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div class="studentDownLoad" :class="[wxStatus ? 'wxContainer' : '']">
  3. <div class="container">
  4. <!-- <p class="tips">正在打开酷乐秀~</p>
  5. <p class="ps" v-if="isWx">ps:若无法自动跳转,请在本地浏览器中打开。</p> -->
  6. <img src="../assets/images/downLoad/downLoad_bg.png" class="downloadBg" />
  7. <van-button type="primary" @click="downloadClick" round block>点击下载APP</van-button>
  8. </div>
  9. <div class="wxpopup" v-if="wxStatus" @click="wxStatus = false">
  10. <img src="../assets/images/wx_bg.png" alt />
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. import {
  16. browser
  17. } from "@/utils/common";
  18. export default {
  19. data() {
  20. return {
  21. isWx: browser().weixin,
  22. wxStatus: false,
  23. msg: "此浏览器不支持自动转发,请更换浏览器尝试",
  24. src: ""
  25. };
  26. },
  27. mounted() {
  28. this.downloadApp();
  29. },
  30. methods: {
  31. downloadApp() {
  32. let url = null;
  33. let params = this.$route.query
  34. if (params.url && params.hash) {
  35. url = params.url + '/#/' + params.hash
  36. }
  37. // http://mkjtest.dayaedu.com/#/downLoad?memo=2
  38. // http://mkjtest.dayaedu.com/#/downLoad?url=http://mkjtest.dayaedu.com&hash=appDetail&id=xxx&memo=1
  39. if (params.id) {
  40. url += '?id=' + params.id
  41. }
  42. if(params.memo == 1) {
  43. url = `memo=1&url=` + url
  44. } else if(params.memo == 2) { // 准考证页
  45. url = `memo=2`
  46. if(params.examRegistrationId) {
  47. url += '&examRegistrationId=' + params.examRegistrationId
  48. }
  49. }
  50. // url = encodeURIComponent(url);
  51. if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
  52. window.location.href = `StudentsExam://linkUrl=${url}`;
  53. } else if (/(Android)/i.test(navigator.userAgent)) {
  54. window.location.href = `studentexam://html:8888/SplashActivity?${url}`;
  55. } else {
  56. this.$toast("请用手机或移动设备打开");
  57. }
  58. },
  59. downloadClick() {
  60. if (browser().weixin) {
  61. this.wxStatus = true;
  62. return;
  63. }
  64. if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
  65. window.location.href = "https://apps.apple.com/cn/app/%E9%85%B7%E4%B9%90%E7%A7%80/id1528132269";
  66. // this.$toast('APP暂未开放下载通道')
  67. } else if (/(Android)/i.test(navigator.userAgent)) {
  68. window.location = "https://sj.qq.com/myapp/detail.htm?apkName=com.jinmingyunle.colexiu"; //如果超时就跳转到app下载页
  69. // this.$toast('APP暂未开放下载通道')
  70. } else {
  71. this.$toast("请用手机或移动设备打开");
  72. }
  73. }
  74. }
  75. };
  76. </script>
  77. <style lang="less" scoped>
  78. @import url("../assets/commonLess/variable");
  79. .studentDownLoad {
  80. // min-height: 100vh;
  81. }
  82. .container {
  83. overflow: hidden;
  84. background: url("../assets/images/downLoad/bg.png") top center no-repeat #fff;
  85. background-size: contain;
  86. min-height: 100vh;
  87. text-align: center;
  88. .downloadBg {
  89. width: 100%;
  90. }
  91. }
  92. .wxContainer {
  93. overflow: hidden;
  94. height: 100vh;
  95. }
  96. .van-button--primary {
  97. margin: .36rem 0 .18rem;
  98. background-color: @--main-color;
  99. border: 1px solid @--main-color;
  100. color: #FFFFFF;
  101. font-size: .18rem;
  102. height: .5rem;
  103. line-height: .52rem;
  104. width: 60%;
  105. margin-left: 20%;
  106. }
  107. .wxpopup {
  108. width: 100%;
  109. height: 100vh;
  110. position: absolute;
  111. top: 0;
  112. left: 0;
  113. background: rgba(0, 0, 0, 0.5);
  114. img {
  115. width: 88%;
  116. margin: 0 6%;
  117. }
  118. }
  119. </style>