diff --git a/public/iconfont.js b/public/iconfont.js
new file mode 100644
index 0000000..3b25f0b
--- /dev/null
+++ b/public/iconfont.js
@@ -0,0 +1 @@
+window._iconfont_svg_string_4815459='',(v=>{var c=(h=(h=document.getElementsByTagName("script"))[h.length-1]).getAttribute("data-injectcss"),h=h.getAttribute("data-disable-injectsvg");if(!h){var t,i,a,o,m,z=function(c,h){h.parentNode.insertBefore(c,h)};if(c&&!v.__iconfont__svg__cssinject__){v.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}t=function(){var c,h=document.createElement("div");h.innerHTML=v._iconfont_svg_string_4815459,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(c=document.body).firstChild?z(h,c.firstChild):c.appendChild(h))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),t()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(a=t,o=v.document,m=!1,d(),o.onreadystatechange=function(){"complete"==o.readyState&&(o.onreadystatechange=null,l())})}function l(){m||(m=!0,a())}function d(){try{o.documentElement.doScroll("left")}catch(c){return void setTimeout(d,50)}l()}})(window);
\ No newline at end of file
diff --git a/public/index.html b/public/index.html
index bf796e1..02eef8d 100644
--- a/public/index.html
+++ b/public/index.html
@@ -16,9 +16,6 @@
-->
-
-
华宇平台
+
+ 想做的事情
diff --git a/src/App.js b/src/App.js
index 7343932..e890095 100644
--- a/src/App.js
+++ b/src/App.js
@@ -9,6 +9,7 @@ import ToDoCal from "./pages/ToDoCal";
import ToDoTree from "./pages/ToDoTree";
import {PersonalCenter} from "./pages/PersonalCenter";
import {MyRootProvider} from "./components/MyRootContext";
+import ToDoTest from "./pages/ToDoTest";
function App() {
return (
@@ -25,6 +26,7 @@ function App() {
}>
}/>
}>
+ } />
}>
}>
diff --git a/src/assets/icon/tree.svg b/src/assets/icon/tree.svg
new file mode 100644
index 0000000..da88e8d
--- /dev/null
+++ b/src/assets/icon/tree.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/components/DataPickItemPopup/constant.js b/src/components/DataPickItemPopup/constant.js
new file mode 100644
index 0000000..c7caf67
--- /dev/null
+++ b/src/components/DataPickItemPopup/constant.js
@@ -0,0 +1,91 @@
+export const basicColumns =[
+ [
+ { label: '00', value: '00' },
+ { label: '01', value: '01' },
+ { label: '02', value: '02' },
+ { label: '03', value: '03' },
+ { label: '04', value: '04' },
+ { label: '05', value: '05' },
+ { label: '06', value: '06' },
+ { label: '07', value: '07' },
+ { label: '08', value: '08' },
+ { label: '09', value: '09' },
+ { label: '10', value: '10' },
+ { label: '11', value: '11' },
+ { label: '12', value: '12' },
+ { label: '13', value: '13' },
+ { label: '14', value: '14' },
+ { label: '15', value: '15' },
+ { label: '16', value: '16' },
+ { label: '17', value: '17' },
+ { label: '18', value: '18' },
+ { label: '19', value: '19' },
+ { label: '20', value: '20' },
+ { label: '21', value: '21' },
+ { label: '22', value: '22' },
+ { label: '23', value: '23' },
+ ],
+ [
+ { label: '00', value: '00' },
+ { label: '01', value: '01' },
+ { label: '02', value: '02' },
+ { label: '03', value: '03' },
+ { label: '04', value: '04' },
+ { label: '05', value: '05' },
+ { label: '06', value: '06' },
+ { label: '07', value: '07' },
+ { label: '08', value: '08' },
+ { label: '09', value: '09' },
+ { label: '10', value: '10' },
+ { label: '11', value: '11' },
+ { label: '12', value: '12' },
+ { label: '13', value: '13' },
+ { label: '14', value: '14' },
+ { label: '15', value: '15' },
+ { label: '16', value: '16' },
+ { label: '17', value: '17' },
+ { label: '18', value: '18' },
+ { label: '19', value: '19' },
+ { label: '20', value: '20' },
+ { label: '21', value: '21' },
+ { label: '22', value: '22' },
+ { label: '23', value: '23' },
+ { label: '24', value: '24' },
+ { label: '25', value: '25' },
+ { label: '26', value: '26' },
+ { label: '27', value: '27' },
+ { label: '28', value: '28' },
+ { label: '29', value: '29' },
+ { label: '30', value: '30' },
+ { label: '31', value: '31' },
+ { label: '32', value: '32' },
+ { label: '33', value: '33' },
+ { label: '34', value: '34' },
+ { label: '35', value: '35' },
+ { label: '36', value: '36' },
+ { label: '37', value: '37' },
+ { label: '38', value: '38' },
+ { label: '39', value: '39' },
+ { label: '40', value: '40' },
+ { label: '41', value: '41' },
+ { label: '42', value: '42' },
+ { label: '43', value: '43' },
+ { label: '44', value: '44' },
+ { label: '45', value: '45' },
+ { label: '46', value: '46' },
+ { label: '47', value: '47' },
+ { label: '48', value: '48' },
+ { label: '49', value: '49' },
+ { label: '50', value: '50' },
+ { label: '51', value: '51' },
+ { label: '52', value: '52' },
+ { label: '53', value: '53' },
+ { label: '54', value: '54' },
+ { label: '55', value: '55' },
+ { label: '56', value: '56' },
+ { label: '57', value: '57' },
+ { label: '58', value: '58' },
+ { label: '59', value: '59' },
+
+ ],
+]
\ No newline at end of file
diff --git a/src/components/DataPickItemPopup/index.css b/src/components/DataPickItemPopup/index.css
new file mode 100644
index 0000000..e69de29
diff --git a/src/components/DataPickItemPopup/index.js b/src/components/DataPickItemPopup/index.js
new file mode 100644
index 0000000..44fda8a
--- /dev/null
+++ b/src/components/DataPickItemPopup/index.js
@@ -0,0 +1,123 @@
+import React, {useState} from "react";
+import {Form, Calendar, CapsuleTabs, JumboTabs, Picker, PickerView, Popup} from "antd-mobile";
+import {basicColumns} from "./constant";
+import "./index.css"
+import {CloseCircleFill} from "antd-mobile-icons";
+import dayjs from "dayjs";
+
+export default function DataPickItemPopup(props) {
+ const {fieldName, labelName, disabled} = props
+ const [visiblePopup, setVisiblePopup] = useState(false);
+ const [dateShowValue, setDateShowValue] = useState('日期');
+ const [timeValue, setTimeValue] = useState(['时间']);
+ const [activeKey, setActiveKey] = useState("date");
+ const [dataPick, setDataPick] = useState();
+ return (
+ {
+ return prevValues.fieldName !== curValues.fieldName
+ }}
+ >
+ {({getFieldValue, setFieldsValue}) => (
+ {
+ // 计算属性名:允许你在对象字面量中使用表达式来动态确定属性名。
+ setFieldsValue({[fieldName]: null})
+ e.stopPropagation()
+ }}/>) : true
+ }
+ onClick={() => {
+ setVisiblePopup(true)
+ let fieldValue = getFieldValue(fieldName);
+ console.log({fieldValue})
+ if (fieldValue) {
+ let dayjs1 = dayjs(fieldValue);
+ setDateShowValue(dayjs1.format('YYYY-MM-DD'));
+ setTimeValue([dayjs1.hour().toString(), dayjs1.minute().toString()])
+ setDataPick(dayjs1.toDate())
+ } else {
+ let dayjs1 = dayjs(new Date());
+ setDateShowValue(dayjs1.format('YYYY-MM-DD'));
+ setTimeValue([dayjs1.hour().toString(), dayjs1.minute().toString()])
+ setDataPick(new Date())
+ }
+ }}
+ >
+ {getFieldValue(fieldName) ? dayjs(getFieldValue(fieldName)).format('YYYY-MM-DD HH:mm') : '请选择日期'}
+ {
+ setVisiblePopup(false)
+ }}
+ bodyStyle={{
+ borderTopLeftRadius: '8px',
+ borderTopRightRadius: '8px',
+ minHeight: '40vh',
+ }}
+ >
+ {
+ if (key === 'ok') {
+ setVisiblePopup(false)
+ if (dateShowValue && timeValue) {
+ setFieldsValue({
+ [fieldName]: (dateShowValue + ' ' + timeValue.join(":"))
+ })
+ } else {
+ setActiveKey(key)
+ }
+ }
+ }}
+ activeKey={activeKey}
+ >
+
+
+ {
+ if (val) {
+ setDateShowValue(dayjs(val).format('YYYY-MM-DD'))
+ } else {
+ setDateShowValue(undefined)
+ }
+ }}
+ />
+
+
+
+ {
+ }}
+ value={timeValue}
+ onChange={(val, extend) => {
+ setTimeValue(val)
+ console.log('onChange', val, extend.items)
+ }}
+ />
+
+
+
+
+
+
+ )}
+ )
+
+}
\ No newline at end of file
diff --git a/src/components/DetailForm/index.js b/src/components/DetailForm/index.js
index 58bcf17..3503f9f 100644
--- a/src/components/DetailForm/index.js
+++ b/src/components/DetailForm/index.js
@@ -13,6 +13,7 @@ import "./index.css"
import {addTask, getPTask, getTaskById, updateTask} from "../../utils";
import {useLocation, useNavigate, useOutletContext, useSearchParams} from "react-router-dom";
import dayjs from "dayjs";
+import DataPickItemPopup from "../DataPickItemPopup";
export default () => {
// 进入此页面的操作:添加,修改,详情(按钮为添加任务日志)
@@ -29,8 +30,7 @@ export default () => {
// 获取form引用
const [form] = Form.useForm();
useEffect(() => {
-
-
+ window.scrollTo(0, 0);
if (location.pathname.endsWith("addTask")) {
setTitle("添加任务");
setCurrentPath("addTask");
@@ -48,7 +48,6 @@ export default () => {
} else {
// todo 异常处理
}
-
}, [])
function editParentTask(id) {
@@ -208,13 +207,13 @@ export default () => {
-
-
-
-
+
>
)
diff --git a/src/components/MyCalendarOutline/iconfont.json b/src/components/MyCalendarOutline/iconfont.json
new file mode 100644
index 0000000..b73543b
--- /dev/null
+++ b/src/components/MyCalendarOutline/iconfont.json
@@ -0,0 +1,226 @@
+{
+ "id": "4815459",
+ "name": "日历",
+ "font_family": "iconfont",
+ "css_prefix_text": "icon-",
+ "description": "",
+ "glyphs": [
+ {
+ "icon_id": "1718319",
+ "name": "日历1",
+ "font_class": "rili",
+ "unicode": "e600",
+ "unicode_decimal": 58880
+ },
+ {
+ "icon_id": "1718322",
+ "name": "日历2",
+ "font_class": "rili1",
+ "unicode": "e601",
+ "unicode_decimal": 58881
+ },
+ {
+ "icon_id": "1718324",
+ "name": "日历4",
+ "font_class": "rili2",
+ "unicode": "e602",
+ "unicode_decimal": 58882
+ },
+ {
+ "icon_id": "1718325",
+ "name": "日历3",
+ "font_class": "rili3",
+ "unicode": "e603",
+ "unicode_decimal": 58883
+ },
+ {
+ "icon_id": "1718326",
+ "name": "日历5",
+ "font_class": "rili4",
+ "unicode": "e604",
+ "unicode_decimal": 58884
+ },
+ {
+ "icon_id": "1718327",
+ "name": "日历7",
+ "font_class": "rili5",
+ "unicode": "e605",
+ "unicode_decimal": 58885
+ },
+ {
+ "icon_id": "1718328",
+ "name": "日历8",
+ "font_class": "rili6",
+ "unicode": "e606",
+ "unicode_decimal": 58886
+ },
+ {
+ "icon_id": "1718329",
+ "name": "日历11",
+ "font_class": "rili7",
+ "unicode": "e607",
+ "unicode_decimal": 58887
+ },
+ {
+ "icon_id": "1718330",
+ "name": "日历9",
+ "font_class": "rili8",
+ "unicode": "e608",
+ "unicode_decimal": 58888
+ },
+ {
+ "icon_id": "1718331",
+ "name": "日历12",
+ "font_class": "rili9",
+ "unicode": "e609",
+ "unicode_decimal": 58889
+ },
+ {
+ "icon_id": "1718332",
+ "name": "日历10",
+ "font_class": "rili10",
+ "unicode": "e60a",
+ "unicode_decimal": 58890
+ },
+ {
+ "icon_id": "1718333",
+ "name": "日历13",
+ "font_class": "rili11",
+ "unicode": "e60b",
+ "unicode_decimal": 58891
+ },
+ {
+ "icon_id": "1718334",
+ "name": "日历14",
+ "font_class": "rili12",
+ "unicode": "e60c",
+ "unicode_decimal": 58892
+ },
+ {
+ "icon_id": "1718335",
+ "name": "日历6",
+ "font_class": "rili13",
+ "unicode": "e60d",
+ "unicode_decimal": 58893
+ },
+ {
+ "icon_id": "1718336",
+ "name": "日历15",
+ "font_class": "rili14",
+ "unicode": "e60e",
+ "unicode_decimal": 58894
+ },
+ {
+ "icon_id": "1718337",
+ "name": "日历17",
+ "font_class": "rili15",
+ "unicode": "e60f",
+ "unicode_decimal": 58895
+ },
+ {
+ "icon_id": "1718338",
+ "name": "日历16",
+ "font_class": "rili16",
+ "unicode": "e610",
+ "unicode_decimal": 58896
+ },
+ {
+ "icon_id": "1718339",
+ "name": "日历18",
+ "font_class": "rili17",
+ "unicode": "e611",
+ "unicode_decimal": 58897
+ },
+ {
+ "icon_id": "1718340",
+ "name": "日历19",
+ "font_class": "rili18",
+ "unicode": "e612",
+ "unicode_decimal": 58898
+ },
+ {
+ "icon_id": "1718341",
+ "name": "日历21",
+ "font_class": "rili19",
+ "unicode": "e613",
+ "unicode_decimal": 58899
+ },
+ {
+ "icon_id": "1718342",
+ "name": "日历20",
+ "font_class": "rili20",
+ "unicode": "e614",
+ "unicode_decimal": 58900
+ },
+ {
+ "icon_id": "1718343",
+ "name": "日历24",
+ "font_class": "rili21",
+ "unicode": "e615",
+ "unicode_decimal": 58901
+ },
+ {
+ "icon_id": "1718344",
+ "name": "日历22",
+ "font_class": "rili22",
+ "unicode": "e616",
+ "unicode_decimal": 58902
+ },
+ {
+ "icon_id": "1718345",
+ "name": "日历25",
+ "font_class": "rili23",
+ "unicode": "e617",
+ "unicode_decimal": 58903
+ },
+ {
+ "icon_id": "1718346",
+ "name": "日历23",
+ "font_class": "rili24",
+ "unicode": "e618",
+ "unicode_decimal": 58904
+ },
+ {
+ "icon_id": "1718347",
+ "name": "日历27",
+ "font_class": "rili25",
+ "unicode": "e619",
+ "unicode_decimal": 58905
+ },
+ {
+ "icon_id": "1718348",
+ "name": "日历26",
+ "font_class": "rili26",
+ "unicode": "e61a",
+ "unicode_decimal": 58906
+ },
+ {
+ "icon_id": "1718349",
+ "name": "日历29",
+ "font_class": "rili27",
+ "unicode": "e61b",
+ "unicode_decimal": 58907
+ },
+ {
+ "icon_id": "1718350",
+ "name": "日历28",
+ "font_class": "rili28",
+ "unicode": "e61c",
+ "unicode_decimal": 58908
+ },
+ {
+ "icon_id": "1718352",
+ "name": "日历31",
+ "font_class": "rili29",
+ "unicode": "e61d",
+ "unicode_decimal": 58909
+ },
+ {
+ "icon_id": "1718354",
+ "name": "日历30",
+ "font_class": "rili30",
+ "unicode": "e61e",
+ "unicode_decimal": 58910
+ }
+ ]
+}
diff --git a/src/components/MyCalendarOutline/index.css b/src/components/MyCalendarOutline/index.css
new file mode 100644
index 0000000..0295783
--- /dev/null
+++ b/src/components/MyCalendarOutline/index.css
@@ -0,0 +1,5 @@
+.icon {
+ height: 24px;
+ width: 24px;
+ fill: currentColor;
+}
\ No newline at end of file
diff --git a/src/components/MyCalendarOutline/index.js b/src/components/MyCalendarOutline/index.js
new file mode 100644
index 0000000..e20af19
--- /dev/null
+++ b/src/components/MyCalendarOutline/index.js
@@ -0,0 +1,50 @@
+import React, {useEffect, useState} from 'react';
+import "./index.css"
+import dayjs from "dayjs";
+import calendarList from "./iconfont.json"
+const My1CalendarOutline = (props) => {
+ return (
+
+ );
+};
+const My20CalendarOutline = (props) => {
+ return (
+
+ );
+};
+
+const CurrentDayOutline = ()=>{
+ const [currentDay, setCurrentDay] = useState(null);
+ useEffect(()=>{
+ setCurrentDay(calendarList.glyphs.find(obj=>obj.name===('日历'+(dayjs(new Date()).date()))).font_class)
+ console.log(calendarList.glyphs.find(obj=>obj.name===('日历'+(dayjs(new Date()).date()))).font_class)
+ },[dayjs(new Date()).date()])
+ return (
+
+ )
+}
+
+export {
+ My1CalendarOutline,
+ CurrentDayOutline,
+ My20CalendarOutline
+};
+
diff --git a/src/components/MyRootContext/index.js b/src/components/MyRootContext/index.js
index 31dd6c8..7699aef 100644
--- a/src/components/MyRootContext/index.js
+++ b/src/components/MyRootContext/index.js
@@ -7,7 +7,7 @@ export const MyRootContext = createContext();
export const UPDATE_SEARCH = "UPDATE_SEARCH";
// 定义初始状态和 reducer 函数
const initialState = {"search":{
- "pageSize": 12,
+ "pageSize": 20,
"pageNumber": 1,
"data": {
"orSearchModel": {
diff --git a/src/pages/Bottom/index.css b/src/pages/Bottom/index.css
index f7a8993..fb94eae 100644
--- a/src/pages/Bottom/index.css
+++ b/src/pages/Bottom/index.css
@@ -2,28 +2,40 @@
touch-action:pan-y
} */
.app {
- height: 100vh;
- display: flex;
- flex-direction: column;
+ height: 100vh;
+ display: flex;
+ flex-direction: column;
}
.top {
- flex: 0;
- border-bottom: solid 1px var(--adm-color-border);
+ flex: 0;
+ border-bottom: solid 1px var(--adm-color-border);
}
.body {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: top;
+ flex: 1;
+ display: flex;
+ justify-content: center;
+ align-items: top;
}
.adm-tab-bar {
- flex: 0;
- background: white;
- border-top: solid 1px var(--adm-color-border);
- width:100%;
- position: fixed;
- bottom:0;
+ flex: 0;
+ background: white;
+ border-top: solid 1px var(--adm-color-border);
+ width: 100%;
+ position: fixed;
+ bottom: 0;
+}
+
+.icon {
+ height: 24px;
+ width: 24px;
+ fill: currentColor;
+}
+
+.icon path {
+ height: 24px;
+ width: 24px;
+ fill: currentColor;
}
\ No newline at end of file
diff --git a/src/pages/Bottom/index.js b/src/pages/Bottom/index.js
index 4370abc..7760326 100644
--- a/src/pages/Bottom/index.js
+++ b/src/pages/Bottom/index.js
@@ -9,12 +9,13 @@ import {
AddOutline,
} from 'antd-mobile-icons'
import "./index.css"
-
+import {CurrentDayOutline, My20CalendarOutline} from "../../components/MyCalendarOutline";
+import { ReactComponent as TreeIcon } from '../../assets/icon/tree.svg';
const tabs = [
{
key: '/home/treeTask',
title: '主子任务',
- icon: ,
+ icon: ,
// badge: '1',
},
{
@@ -26,7 +27,7 @@ const tabs = [
{
key: '/home/calTask',
title: '日历任务',
- icon: ,
+ icon: ,
// badge: '3',
},
{
diff --git a/src/pages/ToDoList/index.js b/src/pages/ToDoList/index.js
index 79092e5..acb4645 100644
--- a/src/pages/ToDoList/index.js
+++ b/src/pages/ToDoList/index.js
@@ -1,12 +1,11 @@
import {Dialog, InfiniteScroll, List, PullToRefresh, SwipeAction} from 'antd-mobile'
-import React, {Fragment, useContext, useEffect, useRef, useState} from 'react'
+import React, {Fragment, useCallback, useContext, useEffect, useRef, useState} from 'react'
import {deleteTaskById, getTaskList, updateTaskStateById} from "../../utils";
import "./index.css"
-import {useLocation, useNavigate, useOutletContext} from "react-router-dom";
+import { useNavigate, useOutletContext} from "react-router-dom";
import dayjs from "dayjs";
-import {DATE_TIME_FORMAT, DATE_TIME_FORMAT_SIMPLE} from "../../utils/timeFormatUtil";
+import { DATE_TIME_FORMAT_SIMPLE} from "../../utils/timeFormatUtil";
import {getDictionary} from "../../utils/dictUtil";
-import {List as VirtualizedList,AutoSizer} from "react-virtualized";
import {MyRootContext} from "../../components/MyRootContext";
const reorder = (
@@ -29,11 +28,11 @@ const ToDoList = () => {
const [stateMap, setStateMap] = useState([])
const navigate = useNavigate();
let loading = false;
- const { state } = useContext(MyRootContext);
+ const {state} = useContext(MyRootContext);
const search = state.search
- console.log("从全局取出的search:" ,{search})
+ console.log("从全局取出的search:", {search})
const loadMore = async () => {
- console.log("loading:",pageNumber,loading)
+ console.log("loading:", pageNumber, loading)
if (loading) {
return
}
@@ -41,12 +40,12 @@ const ToDoList = () => {
console.log("loadMore", loading)
const taskRes = await getTaskList({...search, "pageNumber": pageNumber});
console.log({taskRes})
- setTaskList( [...taskList, ...taskRes.content])
+ setTaskList([...taskList, ...taskRes.content])
- if (taskRes.page.number < taskRes.page.totalPages){
+ if (taskRes.page.number < taskRes.page.totalPages) {
setHasMore(true)
setPageNumber(pageNumber + 1)
- }else {
+ } else {
setHasMore(false)
setPageNumber(1)
}
@@ -55,8 +54,24 @@ const ToDoList = () => {
/**
* 根据查询条件筛选本地列表,不触发接口
*/
- const localRefresh = () =>{
-
+ const localRefresh = () => {
+ console.log("refresh")
+ const refreshSearch = {...search, "pageNumber": 1};
+ if (pageNumber>1){
+ refreshSearch.pageSize = 20*pageNumber;
+ }
+ loading = true;
+ getTaskList({...search, "pageNumber": 1}).then(result => {
+ setTaskList(result.content)
+ if (result.page.number < result.page.totalPages) {
+ setHasMore(true)
+ setPageNumber(pageNumber + 1)
+ } else {
+ setHasMore(false)
+ setPageNumber(1)
+ }
+ })
+ loading = false;
}
useEffect(() => {
@@ -79,26 +94,29 @@ const ToDoList = () => {
// })
}, [useOutletContext()])
- const ref = useRef(null)
+
+ // 创建一个用于存储当前激活的 SwipeAction ref 的变量
+ const activeSwipeActionRef = useRef(null);
+ // 定义一个回调函数来更新当前激活的 SwipeAction ref
+ const setActiveSwipeAction = useCallback((ref) => {
+ if (activeSwipeActionRef.current && ref !== activeSwipeActionRef.current) {
+ activeSwipeActionRef.current.close();
+ }else {
+ activeSwipeActionRef.current = ref;
+ }
+ }, []);
+ // 定义一个函数来关闭当前激活的 SwipeAction
+ const closeActiveSwipeAction = useCallback(() => {
+ console.log({activeSwipeActionRef})
+ if (activeSwipeActionRef.current) {
+ activeSwipeActionRef.current.close();
+ }
+ }, []);
return (
{/* 下拉刷新 */}
{
- console.log("refresh")
- loading = true;
- getTaskList({...search, "pageNumber": 1}).then(result => {
- setTaskList(result.content)
- if (result.page.number < result.page.totalPages){
- setHasMore(true)
- setPageNumber(pageNumber + 1)
- }else {
- setHasMore(false)
- setPageNumber(1)
- }
- })
- loading= false;
- }}
+ onRefresh={localRefresh}
>
{/**/}
@@ -113,28 +131,37 @@ const ToDoList = () => {
{/**/}
{taskList.map((item, index) => (
setActiveSwipeAction(ref)}
+ closeOnAction={true}
closeOnTouchOutside={false}
rightActions={[
{
key: `delete${item.id}`,
text: '删除',
color: 'danger',
- onClick: () => {
- Dialog.confirm({
+ onClick: async () => {
+ await Dialog.confirm({
content: '确定要删除吗?',
- onConfirm: () => {
- deleteTaskById(item.id).then(() => {
- ref.current?.close()
- })
- },
- onClose: () => {
- console.log(ref)
- ref.current?.close()
- }
})
+ // 关闭当前激活的 SwipeAction
+ closeActiveSwipeAction();
},
+ // onClick: async () => {
+ // const result = await Dialog.confirm({
+ // content: '确定要删除吗?',
+ // onConfirm: () => {
+ // deleteTaskById(item.id).then(() => {
+ // ref.current?.close()
+ // })
+ // },
+ // onClose: () => {
+ // // console.log(ref)
+ // }
+ // })
+ // console.log({result})
+ // ref.current.close()
+ // localRefresh()
+ // },
},
{
key: `close${item.id}`,
@@ -145,10 +172,12 @@ const ToDoList = () => {
content: '确定要关闭吗?',
onConfirm: () => {
updateTaskStateById('6', item.id).then(res => {
- ref.current?.close()
+ // 关闭当前激活的 SwipeAction
+ closeActiveSwipeAction();
})
},
})
+ localRefresh()
},
},
{
@@ -156,7 +185,8 @@ const ToDoList = () => {
text: '修改',
color: 'primary',
onClick: () => {
- ref.current?.close()
+ // 关闭当前激活的 SwipeAction
+ closeActiveSwipeAction();
// 跳转
navigate(`/detail/updateTask?id=${item.id}`)
},
@@ -170,12 +200,12 @@ const ToDoList = () => {
content: '确定要完成吗?',
onConfirm: () => {
updateTaskStateById('7', item.id).then(res => {
- ref.current?.close()
- console.log({ref})
+ // 关闭当前激活的 SwipeAction
+ closeActiveSwipeAction();
})
},
})
-
+ localRefresh()
},
},
]}