index.tsx 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import { Button, showToast, Image } from 'vant'
  2. import { defineComponent, onMounted, reactive } from 'vue'
  3. import { useRoute } from 'vue-router'
  4. import styles from './index.module.less'
  5. import wxBg from './images/wx_bg.png'
  6. import { browser } from '@/helpers/utils'
  7. import student from './images/student_bg.png'
  8. import teacher from './images/teacher_bg.png'
  9. import manage from './images/manage_bg.png'
  10. import OSticky from '@/components/o-sticky'
  11. // 唤起前缀
  12. // BandMusicTeam:// 管乐团
  13. // BandMusicTeamTeacher://
  14. // BandMusicTeamManager://
  15. export default defineComponent({
  16. name: 'download',
  17. setup() {
  18. const route = useRoute()
  19. const state = reactive({
  20. wxStatus: false,
  21. type: 'student',
  22. buttonText: '下载管乐团学生端'
  23. })
  24. const onDownload = () => {
  25. if (browser().weixin) {
  26. state.wxStatus = true
  27. return
  28. }
  29. let urlIos = ''
  30. let urlAndroid = ''
  31. if (location.origin.indexOf('online.colexiu.com') > -1) {
  32. if (state.type === 'student') {
  33. urlIos = 'https://itunes.apple.com/cn/app/id1626971695?mt=8'
  34. urlAndroid = 'https://appstore.ks3-cn-beijing.ksyuncs.com/clx-student-domain.apk'
  35. } else if (state.type === 'teacher') {
  36. urlIos = 'https://itunes.apple.com/cn/app/id1626971149?mt=8'
  37. urlAndroid = 'https://appstore.ks3-cn-beijing.ksyuncs.com/clx-teacher-domain.apk'
  38. } else if (state.type === 'manage') {
  39. urlIos = 'https://itunes.apple.com/cn/app/id1626971149?mt=8'
  40. urlAndroid = 'https://appstore.ks3-cn-beijing.ksyuncs.com/clx-teacher-domain.apk'
  41. }
  42. } else {
  43. if (state.type === 'student') {
  44. urlIos = 'https://www.pgyer.com/powy'
  45. urlAndroid = 'https://www.pgyer.com/70e7'
  46. } else if (state.type === 'teacher') {
  47. urlIos = 'https://www.pgyer.com/iO0m'
  48. urlAndroid = 'https://www.pgyer.com/N2U3'
  49. } else if (state.type === 'manage') {
  50. urlIos = 'https://www.pgyer.com/iO0m'
  51. urlAndroid = 'https://www.pgyer.com/N2U3'
  52. }
  53. }
  54. if (browser().ios || /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
  55. window.location.href = urlIos
  56. } else if (/(Android)/i.test(navigator.userAgent)) {
  57. window.location.href = urlAndroid
  58. } else {
  59. showToast('请用手机或移动设备打开')
  60. }
  61. }
  62. onMounted(() => {
  63. const type: any = route.query.type
  64. state.type = type ? type : 'student'
  65. if (type === 'student') {
  66. state.buttonText = '下载管乐团学生端'
  67. } else if (type === 'teacher') {
  68. state.buttonText = '下载管乐团伴学端'
  69. } else if (type === 'manage') {
  70. state.buttonText = '下载管乐团管理端'
  71. }
  72. document.title = state.buttonText
  73. })
  74. return () => (
  75. <div
  76. class={[
  77. styles.student,
  78. state.type === 'teacher' && styles.teacher,
  79. state.type === 'manage' && styles.manage
  80. ]}
  81. >
  82. {/* {state.type !== 'teacher' && state.type !== 'manage' && <Image src={student} />}
  83. {state.type === 'teacher' && <Image src={teacher} />}
  84. {state.type === 'manage' && <Image src={manage} />} */}
  85. <OSticky background="white" position="bottom">
  86. <div class={[styles.buttonGroup, 'btnGroup']}>
  87. <Button round size="large" color="#FF8057" class={styles.btn} onClick={onDownload}>
  88. {state.buttonText}
  89. </Button>
  90. </div>
  91. </OSticky>
  92. {state.wxStatus && (
  93. <div
  94. class={styles.wxpopup}
  95. onClick={() => {
  96. state.wxStatus = false
  97. }}
  98. >
  99. <img src={wxBg} alt="" />
  100. </div>
  101. )}
  102. </div>
  103. )
  104. }
  105. })