member-active-o.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { defineComponent, onMounted, ref } from 'vue'
  2. import styles from './member-active.module.less'
  3. import p1 from './images/active-o/1.png'
  4. import p2 from './images/active-o/2.png'
  5. import p3 from './images/active-o/3.png'
  6. import btn from './images/active-o/btn.png'
  7. import { useRouter } from 'vue-router'
  8. import { postMessage } from '@/helpers/native-message'
  9. import { Icon } from 'vant'
  10. import { browser } from '@/helpers/utils'
  11. import ColSticky from '@/components/col-sticky'
  12. export default defineComponent({
  13. setup() {
  14. const router = useRouter()
  15. const navBarHeight = ref(0)
  16. const onDetail = () => {
  17. router.push('/memberCenter')
  18. }
  19. const onBack = () => {
  20. if (browser().isApp) {
  21. postMessage({ api: 'goBack' })
  22. } else {
  23. router.back()
  24. }
  25. }
  26. onMounted(() => {
  27. postMessage({ api: 'getNavHeight' }, res => {
  28. const { content } = res as any
  29. const dpi = content.dpi || 2
  30. if (content.navHeight) {
  31. const navHeight = content.navHeight / dpi
  32. navBarHeight.value = navHeight
  33. }
  34. })
  35. })
  36. return () => (
  37. <div class={[styles.memberActive, styles.memberActiveO]}>
  38. <Icon
  39. name="arrow-left"
  40. class={styles.backIcon}
  41. style={{
  42. top: `calc(${navBarHeight.value}px + 12px)`
  43. }}
  44. onClick={onBack}
  45. />
  46. <img src={p1} style={{ 'margin-bottom': '-1px' }} />
  47. <img src={p2} />
  48. <img src={p3} />
  49. <ColSticky position="bottom">
  50. <div class={styles.memberBtn}>
  51. <img src={btn} onClick={onDetail} />
  52. </div>
  53. </ColSticky>
  54. </div>
  55. )
  56. }
  57. })