parent
2b9c256381
commit
e33657c661
@ -1,7 +1,33 @@ |
||||
import {request} from "@/api/request"; |
||||
|
||||
export interface Meeting { |
||||
id: number |
||||
/** 部门ID */ |
||||
department_id: number; |
||||
/** 现场会描述 */ |
||||
description: string; |
||||
/** 预计结束时间 */ |
||||
estimate_end_time: number; |
||||
/** 预计开始时间 */ |
||||
estimate_start_time: number; |
||||
/** 现场会标题 */ |
||||
name: string; |
||||
} |
||||
|
||||
export const meetingAPi = { |
||||
qrcodeKey() { |
||||
return request('/api/v1/auth/login/qrcode/key', "GET") |
||||
setMeetings(data: Meeting) { |
||||
return request<{ id: number }>('/api/v1/meetings/meeting', "POST", data) |
||||
}, |
||||
setMeeting(id: string) { |
||||
return request<Meeting>(`/api/v1/meetings/meeting/${id}`, "GET") |
||||
}, |
||||
setList(page: number, page_size: number) { |
||||
return request<{data:Meeting[],total:number}>(`/api/v1/meetings/meeting?page=${page}&page_size=${page_size}`, "GET") |
||||
}, |
||||
exists() { |
||||
return request<Meeting>('/api/v1/meetings/exists', "GET") |
||||
}, |
||||
del(id:number){ |
||||
return request(`/api/v1/meetings/meeting/${id}`,"DELETE") |
||||
} |
||||
} |
||||
|
@ -0,0 +1,4 @@ |
||||
export default definePageConfig({ |
||||
navigationBarTitleText: '见面会记录', |
||||
onReachBottomDistance: 30 |
||||
}) |
@ -0,0 +1,43 @@ |
||||
.meeting { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
margin-bottom: 20rpx; |
||||
} |
||||
|
||||
.title { |
||||
position: relative; |
||||
flex: 1; |
||||
width: 70%; |
||||
background: #fff; |
||||
padding: 20rpx; |
||||
border-radius: 10rpx; |
||||
overflow: hidden; |
||||
box-sizing: border-box; |
||||
} |
||||
|
||||
|
||||
.overdue { |
||||
position: absolute; |
||||
top: 0; |
||||
bottom: 0; |
||||
right: 0; |
||||
left: 0; |
||||
text-align: center; |
||||
color: #fff; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
background: rgba(#000, .8); |
||||
} |
||||
|
||||
|
||||
.del { |
||||
border-radius: 10rpx; |
||||
background: #FF3A2F; |
||||
display: flex; |
||||
align-items: center; |
||||
color: #fff; |
||||
width: 100rpx; |
||||
justify-content: center; |
||||
margin-left: 20rpx; |
||||
} |
@ -0,0 +1,74 @@ |
||||
import {FC, useCallback, useEffect, useState} from "react"; |
||||
import {View} from "@tarojs/components"; |
||||
import {Meeting, meetingAPi} from "@/api"; |
||||
import styles from './meetings.module.scss' |
||||
import Taro, {useReachBottom} from "@tarojs/taro"; |
||||
import Empty from "@/components/empty/empty"; |
||||
import {formatDate} from "@/utils/time"; |
||||
|
||||
const MeetingsConfig: FC = () => { |
||||
const [page, setPage] = useState(1) |
||||
const [meeting, setMeeting] = useState<Meeting[]>([]) |
||||
const [total, setTotal] = useState(0) |
||||
|
||||
const getData = useCallback(async () => { |
||||
try { |
||||
const res = await meetingAPi.setList(1, 10) |
||||
setTotal(res.total) |
||||
setMeeting([ |
||||
...(meeting || []), |
||||
...res.data |
||||
]) |
||||
} catch (e) { |
||||
} |
||||
}, [page]) |
||||
|
||||
function del(id: number, index: number) { |
||||
try { |
||||
Taro.showModal({ |
||||
title: '确定删除', |
||||
async success({confirm}) { |
||||
if (confirm) { |
||||
await meetingAPi.del(id) |
||||
|
||||
const oldMeeting: Meeting[] = JSON.parse(JSON.stringify(meeting)) |
||||
oldMeeting.splice(index, 1) |
||||
setMeeting(oldMeeting) |
||||
} |
||||
} |
||||
}) |
||||
} catch (e) { |
||||
} |
||||
} |
||||
|
||||
useReachBottom(useCallback(() => { |
||||
if (meeting?.length < total) { |
||||
setPage(page + 1) |
||||
} |
||||
}, [total, meeting])) |
||||
|
||||
useEffect(() => { |
||||
getData() |
||||
}, [page]) |
||||
|
||||
return ( |
||||
<View className='p-2'> |
||||
|
||||
{ |
||||
meeting.length ? |
||||
meeting.map((d, index) => <View className={styles.meeting}> |
||||
<View className={styles.title}> |
||||
<View className='font-weight mb-1'>{d.name}</View> |
||||
<View>{formatDate(new Date(d.estimate_start_time), "MM-dd")} 至 {formatDate(new Date(d.estimate_start_time), "MM-dd")}</View> |
||||
|
||||
{Date.now() > d.estimate_end_time && <View className={styles.overdue}>已过期</View>} |
||||
</View> |
||||
<View className={styles.del} onClick={() => del(d.id, index)}>删除</View> |
||||
</View>) |
||||
: <Empty name='无历史记录'/> |
||||
} |
||||
</View> |
||||
) |
||||
} |
||||
|
||||
export default MeetingsConfig |
@ -1,5 +1,67 @@ |
||||
.page { |
||||
background: #fff; |
||||
background: #00D6AC; |
||||
min-height: 100vh; |
||||
padding: 20px; |
||||
padding: 40px; |
||||
position: absolute; |
||||
top: 0; |
||||
left: 0; |
||||
width: 100%; |
||||
box-sizing: border-box; |
||||
} |
||||
|
||||
|
||||
.box { |
||||
width: 100%; |
||||
padding: 60rpx 20rpx 20rpx 20rpx; |
||||
background: #fff; |
||||
box-sizing: border-box; |
||||
border-radius: 15rpx; |
||||
text-align: center; |
||||
} |
||||
|
||||
|
||||
.code { |
||||
width: 300rpx; |
||||
margin: 50rpx auto 70rpx; |
||||
} |
||||
|
||||
.choice { |
||||
border-top: 1px dashed #ddd; |
||||
padding: 40rpx 0 0; |
||||
position: relative; |
||||
|
||||
&:after { |
||||
content: ''; |
||||
display: block; |
||||
background: #00D6AC; |
||||
width: 40rpx; |
||||
height: 40rpx; |
||||
border-radius: 100%; |
||||
position: absolute; |
||||
left: -40rpx; |
||||
top: -20rpx; |
||||
} |
||||
|
||||
|
||||
&:before { |
||||
content: ''; |
||||
display: block; |
||||
background: #00D6AC; |
||||
width: 40rpx; |
||||
height: 40rpx; |
||||
border-radius: 100%; |
||||
position: absolute; |
||||
right: -40rpx; |
||||
top: -20rpx; |
||||
} |
||||
} |
||||
|
||||
.button { |
||||
margin: 30rpx auto; |
||||
box-shadow: 0 0 10rpx rgba(#00d6ac, .5); |
||||
} |
||||
|
||||
.buttonDel { |
||||
margin: 30rpx auto; |
||||
box-shadow: 0 0 10rpx rgba(#c94f4f, .5); |
||||
} |
||||
|
After Width: | Height: | Size: 10 KiB |
Loading…
Reference in new issue