index.tsx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import OEmpty from '@/components/o-empty'
  2. import OFullRefresh from '@/components/o-full-refresh'
  3. import OHeader from '@/components/o-header'
  4. import OSearch from '@/components/o-search'
  5. import OSticky from '@/components/o-sticky'
  6. import { snedStatus } from '@/constant'
  7. import request from '@/helpers/request'
  8. import item from '@/student/coupons/item'
  9. import { Cell, CellGroup, Icon, Swipe, SwipeItem, Tab, Tabs } from 'vant'
  10. import { defineComponent, onMounted, reactive } from 'vue'
  11. import { useRouter } from 'vue-router'
  12. import List from './list'
  13. import styles from './index.module.less'
  14. export default defineComponent({
  15. name: 'mass-message',
  16. setup() {
  17. const router = useRouter()
  18. const status = sessionStorage.getItem('mass-message-send')
  19. const state = reactive({
  20. refreshing: false,
  21. height: 0, // 页面头部高度,为了处理下拉刷新用的
  22. tabValue: status || 'WAIT'
  23. })
  24. return () => (
  25. <div class={[styles.massMessage]}>
  26. <OSticky
  27. position="top"
  28. onGetHeight={(height: any) => {
  29. state.height = height
  30. document.documentElement.style.setProperty('--header-height', height + 'px')
  31. }}
  32. >
  33. <OHeader border={false}>
  34. {{
  35. right: () => (
  36. <span
  37. style="color: var(--van-primary-color)"
  38. onClick={() => {
  39. router.push('/create-message')
  40. }}
  41. >
  42. 消息群发
  43. </span>
  44. )
  45. }}
  46. </OHeader>
  47. </OSticky>
  48. <Tabs
  49. lineWidth={18}
  50. v-model:active={state.tabValue}
  51. sticky
  52. animated
  53. swipeable
  54. offsetTop={state.height}
  55. onChange={(val: string) => {
  56. sessionStorage.setItem('mass-message-send', val)
  57. }}
  58. >
  59. <Tab title="待发送" name="WAIT">
  60. {state.tabValue === 'WAIT' && <List status="WAIT" height={state.height} />}
  61. </Tab>
  62. <Tab title="已发送" name="SEND">
  63. {state.tabValue === 'SEND' && <List status="SEND" height={state.height} />}
  64. </Tab>
  65. </Tabs>
  66. {/* <Swipe
  67. showIndicators={false}
  68. style={{
  69. height: 'calc(100vh - var(--header-height))',
  70. overflowY: 'auto'
  71. }}
  72. >
  73. <SwipeItem>
  74. <List status="WAIT" height={state.height} />
  75. </SwipeItem>
  76. <SwipeItem>
  77. <List status="SEND" height={state.height} />
  78. </SwipeItem>
  79. </Swipe> */}
  80. </div>
  81. )
  82. }
  83. })