|
@@ -20,71 +20,9 @@ export default defineComponent({
|
|
|
const state = reactive({
|
|
|
refreshing: false,
|
|
|
height: 0, // 页面头部高度,为了处理下拉刷新用的
|
|
|
- list: [],
|
|
|
- dataShow: true, // 判断是否有数据
|
|
|
- loading: false,
|
|
|
- finished: false,
|
|
|
- tabValue: status || 'WAIT',
|
|
|
- params: {
|
|
|
- keyword: null as any,
|
|
|
- sendStatus: status || 'WAIT',
|
|
|
- page: 1,
|
|
|
- rows: 10
|
|
|
- },
|
|
|
- isClick: false
|
|
|
+ tabValue: status || 'WAIT'
|
|
|
})
|
|
|
- const getList = async () => {
|
|
|
- try {
|
|
|
- if (state.isClick) return
|
|
|
- state.isClick = true
|
|
|
- const res = await request.post('/api-school/imMessageBatchSending/page', {
|
|
|
- data: {
|
|
|
- ...state.params
|
|
|
- }
|
|
|
- })
|
|
|
- state.isClick = false
|
|
|
- state.loading = false
|
|
|
- state.refreshing = false
|
|
|
- const result = res.data || {}
|
|
|
- // 处理重复请求数据
|
|
|
- if (state.list.length > 0 && result.current === 1) {
|
|
|
- return
|
|
|
- }
|
|
|
- state.list = state.list.concat(result.rows || [])
|
|
|
- state.finished = result.current >= result.pages
|
|
|
- state.params.page = result.current + 1
|
|
|
- state.dataShow = state.list.length > 0
|
|
|
- } catch {
|
|
|
- state.isClick = false
|
|
|
- state.dataShow = false
|
|
|
- state.refreshing = false
|
|
|
- state.finished = true
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- // 搜索
|
|
|
- const onSearch = () => {
|
|
|
- state.params.page = 1
|
|
|
- state.list = []
|
|
|
- state.dataShow = true // 判断是否有数据
|
|
|
- state.loading = false
|
|
|
- state.finished = false
|
|
|
- getList()
|
|
|
- }
|
|
|
-
|
|
|
- // 查看详情
|
|
|
- const onDetail = async (item: any) => {
|
|
|
- router.push({
|
|
|
- path: '/create-message',
|
|
|
- query: {
|
|
|
- id: item.id
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- onMounted(() => {
|
|
|
- getList()
|
|
|
- })
|
|
|
return () => (
|
|
|
<div class={[styles.massMessage]}>
|
|
|
<OSticky
|
|
@@ -118,15 +56,14 @@ export default defineComponent({
|
|
|
offsetTop={state.height}
|
|
|
onChange={(val: string) => {
|
|
|
state.params.sendStatus = val
|
|
|
- onSearch()
|
|
|
sessionStorage.setItem('mass-message-send', val)
|
|
|
}}
|
|
|
>
|
|
|
<Tab title="待发送" name="WAIT">
|
|
|
- <List status="WAIT" height={state.height} />
|
|
|
+ {state.tabValue === 'WAIT' && <List status="WAIT" height={state.height} />}
|
|
|
</Tab>
|
|
|
<Tab title="已发送" name="SEND">
|
|
|
- <List status="SEND" height={state.height} />
|
|
|
+ {state.tabValue === 'SEND' && <List status="SEND" height={state.height} />}
|
|
|
</Tab>
|
|
|
</Tabs>
|
|
|
|