download.tsx 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import { browser } from '@/helpers/utils'
  2. import { Button, Toast } from 'vant'
  3. import { defineComponent } from 'vue'
  4. import styles from './index.module.less'
  5. export const getAssetsHomeFile = (fileName: string) => {
  6. const path = `./images/${fileName}`
  7. const modules = import.meta.globEager('./images/*')
  8. return modules[path].default
  9. }
  10. export default defineComponent({
  11. name: 'download',
  12. data() {
  13. const query = this.$route.query
  14. return {
  15. type: query.type || 'student',
  16. wxStatus: false
  17. }
  18. },
  19. mounted() {
  20. if (this.type === 'student') {
  21. document.title = '酷乐秀学院下载'
  22. } else if (this.type === 'teacher') {
  23. document.title = '酷乐秀下载'
  24. }
  25. },
  26. methods: {
  27. downLoadApp() {
  28. if (browser().weixin) {
  29. this.wxStatus = true
  30. return
  31. }
  32. if (
  33. browser().ios ||
  34. /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)
  35. ) {
  36. if (this.type == 'student') {
  37. window.location.href =
  38. 'https://apps.apple.com/cn/app/%E7%AE%A1%E4%B9%90%E8%BF%B7/id1487054260'
  39. } else if (this.type == 'teacher') {
  40. window.location.href =
  41. 'https://apps.apple.com/cn/app/%E7%AE%A1%E4%B9%90%E8%BF%B7/id1487054260'
  42. }
  43. } else if (/(Android)/i.test(navigator.userAgent)) {
  44. if (this.type == 'student') {
  45. window.location.href =
  46. 'https://sj.qq.com/myapp/detail.htm?apkName=com.daya.studaya_android'
  47. } else if (this.type == 'teacher') {
  48. window.location.href =
  49. 'https://sj.qq.com/myapp/detail.htm?apkName=com.daya.studaya_android'
  50. }
  51. } else {
  52. this.$toast('请用手机或移动设备打开')
  53. }
  54. }
  55. },
  56. render() {
  57. return (
  58. <div class={styles.downContainer}>
  59. <div class={styles.logo}>
  60. {this.type === 'student' ? (
  61. <img src={getAssetsHomeFile('logo.png')} alt="" />
  62. ) : (
  63. <img src={getAssetsHomeFile('teacher_logo.png')} alt="" />
  64. )}
  65. </div>
  66. <div class={styles.down}>
  67. <Button type="primary" round plain onClick={this.downLoadApp}>
  68. 点击下载App
  69. </Button>
  70. </div>
  71. <div class={styles.mainImg}>
  72. {this.type === 'student' ? (
  73. <img src={getAssetsHomeFile('student_bg.png')} alt="" />
  74. ) : (
  75. <img src={getAssetsHomeFile('teacher_bg.png')} alt="" />
  76. )}
  77. </div>
  78. {this.wxStatus && (
  79. <div
  80. class={styles.wxpopup}
  81. onClick={() => {
  82. this.wxStatus = false
  83. }}
  84. >
  85. <img src={getAssetsHomeFile('wx_bg.png')} alt="" />
  86. </div>
  87. )}
  88. </div>
  89. )
  90. }
  91. })