parent
b33c7170ea
commit
3844bbc0ca
@ -0,0 +1,89 @@ |
|||||||
|
import {FC, useState} from "react"; |
||||||
|
import {Image, View} from "@tarojs/components"; |
||||||
|
import {Meeting, meetingAPi} from "@/api"; |
||||||
|
import Taro from "@tarojs/taro"; |
||||||
|
import styles from "@/pages/manage/meetings/list.module.scss"; |
||||||
|
import {formatDate} from "@/utils/time"; |
||||||
|
import Empty from "@/components/empty/empty"; |
||||||
|
import MyButton from "@/components/button/MyButton"; |
||||||
|
import Icon from "@/components/icon"; |
||||||
|
import meetingBefore from "@/static/img/beforeMeeting.png" |
||||||
|
import meet from "@/static/img/meeting.png" |
||||||
|
import usePubsub from "@/hooks/pubsub"; |
||||||
|
import Spin from "@/components/spinner"; |
||||||
|
|
||||||
|
const MeetingsList: FC = () => { |
||||||
|
const [meeting, setMeeting] = useState<Meeting[]>([]) |
||||||
|
const {sub} = usePubsub() |
||||||
|
const [enable ,setEnable] = useState(true) |
||||||
|
|
||||||
|
const getData = async () => { |
||||||
|
try { |
||||||
|
const data = await meetingAPi.unstopsList() |
||||||
|
setMeeting(data) |
||||||
|
setEnable(false) |
||||||
|
} catch (e) { |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function jumpInfo(item: Meeting) { |
||||||
|
Taro.navigateTo({url: `/pages/manage/spotMeeting/spotMeeting?id=${item.id}`}) |
||||||
|
} |
||||||
|
|
||||||
|
Taro.useLoad(() => { |
||||||
|
getData() |
||||||
|
sub('deleteMeeting', (id) => { |
||||||
|
setMeeting((data) => { |
||||||
|
return data.filter(d => d.id === id) |
||||||
|
}) |
||||||
|
}) |
||||||
|
sub('updateMeetingList', getData) |
||||||
|
sub('updateMeetingList', () => { |
||||||
|
console.log('二次更新') |
||||||
|
}) |
||||||
|
}) |
||||||
|
|
||||||
|
return ( |
||||||
|
<View className='p-2'> |
||||||
|
<Spin overlay enable={enable} ></Spin> |
||||||
|
{ |
||||||
|
meeting.length ? |
||||||
|
meeting.map((d) => <View onClick={() => jumpInfo(d)} className={styles.meeting} key={d.id}> |
||||||
|
<View className="absolute z1 flex justify-end align-center right top bottom mr-2"> |
||||||
|
{ |
||||||
|
d.status === 0 |
||||||
|
? <Image style={{width: '88rpx', height: '88rpx'}} src={meetingBefore}></Image> |
||||||
|
: <Image style={{width: '88rpx', height: '88rpx'}} src={meet}></Image> |
||||||
|
} |
||||||
|
</View> |
||||||
|
<View className="z2 absolute"> |
||||||
|
<View className='font-32 bold mb-2' style={{color: '#606563'}}>{d.name}</View> |
||||||
|
<View className="font-24" |
||||||
|
style={{color: '#909795'}}>{formatDate(new Date(d.estimate_start_time), "MM-dd hh:mm")} 至 {formatDate(new Date(d.estimate_end_time), "MM-dd hh:mm")}</View> |
||||||
|
</View> |
||||||
|
</View>) |
||||||
|
: <Empty name='暂无未完成的现场会'/> |
||||||
|
} |
||||||
|
<View className="mt-10 flex flex-column align-center"> |
||||||
|
<MyButton |
||||||
|
formType='submit' |
||||||
|
fillet |
||||||
|
width={200} |
||||||
|
className={styles.button} |
||||||
|
onClick={() => { |
||||||
|
Taro.navigateTo({ |
||||||
|
url: '/pages/manage/meetings/form/form' |
||||||
|
}) |
||||||
|
}} |
||||||
|
loading={false}>新建现场会</MyButton> |
||||||
|
<View |
||||||
|
className='text-center text-muted my-3' |
||||||
|
onClick={() => Taro.navigateTo({url: '/pages/manage/meetings/meetings'})}> |
||||||
|
历史列表 <Icon name='chevron-right'/> |
||||||
|
</View> |
||||||
|
</View> |
||||||
|
|
||||||
|
</View> |
||||||
|
) |
||||||
|
} |
||||||
|
export default MeetingsList |
Loading…
Reference in new issue