feat:backup

This commit is contained in:
1708-huayu 2025-01-15 19:35:44 +08:00
parent 9c81ff199c
commit 0a1bf766bc
11 changed files with 294 additions and 211 deletions

View File

@ -4,31 +4,19 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="c22c6a78-950d-4bff-ac7a-ed800fcbb7de" name="Changes" comment="feat:左滑修改"> <list default="true" id="c22c6a78-950d-4bff-ac7a-ed800fcbb7de" name="Changes" comment="feat:backup">
<change afterPath="$PROJECT_DIR$/src/components/MyRootContext/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" /> <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/App.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/App.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/App.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/App.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/DetailForm/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/DetailForm/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/DetailSearchBar/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/DetailSearchBar/index.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/components/DetailSearchBar/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/DetailSearchBar/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/Bottom/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/Bottom/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/CityList/index.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/CityList/index.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/CityList/index.module.css" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/PersonalCenter/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/DetailSearchContext/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/DetailSearchContext/index.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/DetailSearchContext/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/DetailSearchContext/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/Home/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/Home/index.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/Home/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/Home/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/Index/index.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/Index/index.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/Map/index.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/Map/index.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/Map/index.module.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/News/index.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/TaskCount/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/TaskCount/index.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/TaskCount/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/TaskCount/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/ToDoList/index.css" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/ToDoList/index.css" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/ToDoList/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/ToDoList/index.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/ToDoList/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/ToDoList/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/ToDoTree/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/ToDoTree/index.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/ToDoTree/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/ToDoTree/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/router/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/router/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/utils/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/index.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/utils/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/utils/requestUtil.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/requestUtil.js" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -49,23 +37,23 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent">{
"keyToString": { &quot;keyToString&quot;: {
"RunOnceActivity.OpenProjectViewOnStart": "true", &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
"RunOnceActivity.ShowReadmeOnStart": "true", &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
"git-widget-placeholder": "master", &quot;git-widget-placeholder&quot;: &quot;master&quot;,
"last_opened_file_path": "D:/electron/assistant-todo-mobile", &quot;last_opened_file_path&quot;: &quot;D:/electron/assistant-todo-mobile&quot;,
"node.js.detected.package.eslint": "true", &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
"node.js.detected.package.tslint": "true", &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
"node.js.selected.package.eslint": "(autodetect)", &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
"node.js.selected.package.tslint": "(autodetect)", &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
"nodejs_package_manager_path": "npm", &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
"npm.build.executor": "Run", &quot;npm.build.executor&quot;: &quot;Run&quot;,
"npm.start.executor": "Run", &quot;npm.start.executor&quot;: &quot;Run&quot;,
"ts.external.directory.path": "C:\\Program Files\\JetBrains\\WebStorm 2024.1.5\\plugins\\javascript-plugin\\jsLanguageServicesImpl\\external", &quot;ts.external.directory.path&quot;: &quot;C:\\Program Files\\JetBrains\\WebStorm 2024.1.5\\plugins\\javascript-plugin\\jsLanguageServicesImpl\\external&quot;,
"vue.rearranger.settings.migration": "true" &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
} }
}]]></component> }</component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">
<recent name="D:\electron\assistant-todo-mobile\src\components\DataPickerItem" /> <recent name="D:\electron\assistant-todo-mobile\src\components\DataPickerItem" />
@ -120,7 +108,9 @@
<workItem from="1735474579369" duration="4701000" /> <workItem from="1735474579369" duration="4701000" />
<workItem from="1735522393453" duration="23975000" /> <workItem from="1735522393453" duration="23975000" />
<workItem from="1736653373329" duration="943000" /> <workItem from="1736653373329" duration="943000" />
<workItem from="1736729514856" duration="22949000" /> <workItem from="1736729514856" duration="23191000" />
<workItem from="1736823301169" duration="14584000" />
<workItem from="1736902715797" duration="17177000" />
</task> </task>
<task id="LOCAL-00001" summary="feat:backup"> <task id="LOCAL-00001" summary="feat:backup">
<option name="closed" value="true" /> <option name="closed" value="true" />
@ -154,7 +144,23 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1735478048560</updated> <updated>1735478048560</updated>
</task> </task>
<option name="localTasksCounter" value="5" /> <task id="LOCAL-00005" summary="feat:发版">
<option name="closed" value="true" />
<created>1736767997236</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1736767997236</updated>
</task>
<task id="LOCAL-00006" summary="feat:backup">
<option name="closed" value="true" />
<created>1736855240006</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1736855240006</updated>
</task>
<option name="localTasksCounter" value="7" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -172,11 +178,12 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="feat:backup" />
<MESSAGE value="feat:添加任务" /> <MESSAGE value="feat:添加任务" />
<MESSAGE value="feat:上滑更多下拉更新" /> <MESSAGE value="feat:上滑更多下拉更新" />
<MESSAGE value="feat:flex,左右对齐" /> <MESSAGE value="feat:flex,左右对齐" />
<option name="LAST_COMMIT_MESSAGE" value="feat:flex,左右对齐" /> <MESSAGE value="feat:发版" />
<MESSAGE value="feat:backup" />
<option name="LAST_COMMIT_MESSAGE" value="feat:backup" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View File

@ -1,6 +1,7 @@
{ {
"name": "assistant-todo-mobile", "name": "assistant-todo-mobile",
"version": "0.1.0", "version": "0.1.0",
"homepage": "/mobile",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@testing-library/jest-dom": "^5.16.5", "@testing-library/jest-dom": "^5.16.5",

View File

@ -8,9 +8,11 @@ import DetailSearchContext from "./pages/DetailSearchContext";
import ToDoCal from "./pages/ToDoCal"; import ToDoCal from "./pages/ToDoCal";
import ToDoTree from "./pages/ToDoTree"; import ToDoTree from "./pages/ToDoTree";
import {PersonalCenter} from "./pages/PersonalCenter"; import {PersonalCenter} from "./pages/PersonalCenter";
import {MyRootProvider} from "./components/MyRootContext";
function App() { function App() {
return ( return (
<MyRootProvider>
<Router> <Router>
<div className='app'> <div className='app'>
<Routes> <Routes>
@ -18,8 +20,9 @@ function App() {
</Route> </Route>
<Route path='/mobile' element={<Home/>}> <Route path='/mobile' element={<Home/>}>
{/*<Route index element={<ToDoList />} />*/}
<Route path='treeTask' element={<ToDoTree/>}/> <Route path='treeTask' element={<ToDoTree/>}/>
<Route index path='listTask' element={<ToDoList/>}></Route> <Route path='listTask' element={<ToDoList/>}></Route>
<Route path='calTask' element={<ToDoCal/>}/> <Route path='calTask' element={<ToDoCal/>}/>
<Route path='me' element={<PersonalCenter/>}></Route> <Route path='me' element={<PersonalCenter/>}></Route>
</Route> </Route>
@ -32,6 +35,7 @@ function App() {
</Routes> </Routes>
</div> </div>
</Router> </Router>
</MyRootProvider>
); );
} }

View File

@ -1,18 +1,17 @@
import {Tag,} from "antd-mobile"; import {Tag,} from "antd-mobile";
import React, {Fragment, useEffect, useState} from "react"; import React, {Fragment, useContext, useEffect, useState} from "react";
import {useLocation, useNavigate} from 'react-router-dom'; import {useLocation, useNavigate} from 'react-router-dom';
import {AddOutline, CloseOutline, SearchOutline} from "antd-mobile-icons"; import {AddOutline, CloseOutline, SearchOutline} from "antd-mobile-icons";
import "./index.css" import "./index.css"
import {getDictionary} from "../../utils/dictUtil"; import {getDictionary} from "../../utils/dictUtil";
import dayjs from "dayjs"; import dayjs from "dayjs";
import {MyRootContext, UPDATE_SEARCH} from "../MyRootContext";
import {getTaskById} from "../../utils";
const DetailSearchBar = (props) => { const DetailSearchBar = (props) => {
// 从搜索设置中传来的search const { state, dispatch } = useContext(MyRootContext);
// const location = useLocation(); const search = state.search
// const searchUpdate = location.state?.search;
// 父子传值从搜索框传来的search
const {search, updateSearch, pName} = props;
console.log("DetailSearchBar.search", search)
const [tags, setTags] = useState([]); const [tags, setTags] = useState([]);
const showCloseOutline = search && search.data && const showCloseOutline = search && search.data &&
(search.data.andList?.length > 0 || search.data.orList?.length > 0) (search.data.andList?.length > 0 || search.data.orList?.length > 0)
@ -27,9 +26,11 @@ const DetailSearchBar = (props) => {
// 处理主要条件 // 处理主要条件
const tagList = []; const tagList = [];
console.log("search.data.orSearchModel",search.data.orSearchModel) console.log("search.data.orSearchModel",search.data.orSearchModel)
search.data.orSearchModel?.andList?.forEach((searchObj) => { await search.data.orSearchModel?.andList?.forEach((searchObj) => {
if (searchObj.name === "pid") { if (searchObj.name === "pid") {
tagList.push(<Tag key={pName}>{pName}</Tag>) getTaskById(searchObj.value).then(result=>{
tagList.push(<Tag key={result[0].name}>{result[0].name}</Tag>)
})
} else if (searchObj.name === "state") { } else if (searchObj.name === "state") {
const items = searchObj.value.split(','); const items = searchObj.value.split(',');
items.forEach((item) => { items.forEach((item) => {
@ -84,29 +85,27 @@ const DetailSearchBar = (props) => {
<div className="detailSearchBar"> <div className="detailSearchBar">
<div className={"onSearchItem " + (showCloseOutline ? "onSearchItemWidth" : "onSearchItemOnlyWidth")} <div className={"onSearchItem " + (showCloseOutline ? "onSearchItemWidth" : "onSearchItemOnlyWidth")}
onClick={() => { onClick={() => {
navigate("/detail/searchTask", {state: {"search": search}}); navigate("/detail/searchTask");
}}> }}>
<SearchOutline/> <SearchOutline/>
{/*根据search处理搜素框展示内容*/} {/*根据search处理搜素框展示内容*/}
{tags} {tags}
</div> </div>
{showCloseOutline && <div className="CloseOutline-CloseOutline" onClick={() => { {showCloseOutline && <div className="CloseOutline-CloseOutline" onClick={() => {
updateSearch({ dispatch({type:UPDATE_SEARCH,search:{
"pageSize": 20, "pageSize": 20,
"pageNumber": 1, "pageNumber": 1,
"data": { "data": {
"andList": [], "andList": [],
"orList": [] "orList": []
} }
}); }});
setTags([]); setTags([]);
}}> }}>
<CloseOutline style={{float: "right"}}/> <CloseOutline style={{float: "right"}}/>
</div> </div>
} }
{/*<SearchBar placeholder='请输入内容,无法放入标签' onFocus={() => {*/}
{/*<SearchBar placeholder='请输入内容' onFocus={() => {*/}
{/* navigate("/detail/searchTask")*/} {/* navigate("/detail/searchTask")*/}
{/*}}*/} {/*}}*/}

View File

@ -0,0 +1,94 @@
import { createContext, useReducer } from 'react';
import {dayStartUtcFormat, nextDayStartUtcFormat} from "../../utils/timeFormatUtil";
import dayjs from "dayjs";
// 创建一个 context
export const MyRootContext = createContext();
export const UPDATE_SEARCH = "UPDATE_SEARCH";
// 定义初始状态和 reducer 函数
const initialState = {"search":{
"pageSize": 20,
"pageNumber": 1,
"data": {
"orSearchModel": {
"andList": [
{"name": "state", "value": "8,9", "operateType": "IN"},
],
"andSearchModel": {
"andList": [
{
"name": "expectedStartTime",
"value": nextDayStartUtcFormat(dayjs()),
"operateType": "<"
},
{
"name": "expectedEndTime",
"value": dayStartUtcFormat(dayjs()),
"operateType": ">"
}
],
"orSearchModel": {
"andList": [
{
"name": "expectedStartTime",
"value": nextDayStartUtcFormat(dayjs()),
"operateType": "<"
},
{
"name": "expectedStartTime",
"value": dayStartUtcFormat(dayjs()),
"operateType": ">"
},
{
"name": "expectedEndTime",
"value": dayStartUtcFormat(dayjs()),
"operateType": "NULL"
}
],
"orSearchModel": {
"andList": [
{
"name": "expectedEndTime",
"value": nextDayStartUtcFormat(dayjs()),
"operateType": "<"
},
{
"name": "expectedEndTime",
"value": dayStartUtcFormat(dayjs()),
"operateType": ">"
},
{
"name": "expectedStartTime",
"value": dayStartUtcFormat(dayjs()),
"operateType": "NULL"
}
],
}
}
},
},
"andList": [
{"name": "state", "value": "10", "operateType": "="}
]
}
}};
function reducer(state, action) {
switch (action.type) {
case UPDATE_SEARCH:
return { ...state, search:action.search};
case 'decrement':
return { count: state.count - 1 };
default:
throw new Error();
}
}
// 创建一个 Provider 组件
export function MyRootProvider({ children }) {
const [state, dispatch] = useReducer(reducer, initialState);
return (
<MyRootContext.Provider value={{ state, dispatch }}>
{children}
</MyRootContext.Provider>
);
}

View File

@ -1,19 +1,18 @@
import {Button, Checkbox, DatePicker, Form, Input, Space, Switch, Tag} from "antd-mobile"; import {Button, Checkbox, DatePicker, Form, Input, Space, Switch, Tag} from "antd-mobile";
import ParentTask from "../../components/ParentTask"; import ParentTask from "../../components/ParentTask";
import React, {useEffect} from "react"; import React, {useContext, useEffect} from "react";
import dayjs from "dayjs"; import dayjs from "dayjs";
import {CloseCircleFill} from "antd-mobile-icons"; import {CloseCircleFill} from "antd-mobile-icons";
import {useLocation, useNavigate, useOutletContext} from "react-router-dom"; import {useLocation, useNavigate, useOutletContext} from "react-router-dom";
import {getDictionary} from "../../utils/dictUtil"; import {getDictionary} from "../../utils/dictUtil";
import {MyRootContext, UPDATE_SEARCH} from "../../components/MyRootContext";
const DetailSearchContext = () => { const DetailSearchContext = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const [form] = Form.useForm(); const [form] = Form.useForm();
const [visible, setVisible] = React.useState(false); const [visible, setVisible] = React.useState(false);
const location = useLocation(); const { state, dispatch } = useContext(MyRootContext);
console.log("DetailSearchContext", location); const search = state.search
const {search} = location?.state || undefined;
console.log("DetailSearchContext.search", search)
const [stateList, setStateList] = React.useState([]); const [stateList, setStateList] = React.useState([]);
const [priorityList, setPriorityList] = React.useState([]); const [priorityList, setPriorityList] = React.useState([]);
// 使用Outlet,传值修改标题 // 使用Outlet,传值修改标题
@ -132,19 +131,15 @@ const DetailSearchContext = () => {
if (allOverdueTasks) { if (allOverdueTasks) {
andList.push({"name": "state", "value": "10", "operateType": "="}) andList.push({"name": "state", "value": "10", "operateType": "="})
} }
navigate("/mobile/listTask", { dispatch({type:UPDATE_SEARCH,search:{
state: {
search: {
"pageSize": 12, "pageSize": 12,
"pageNumber": 1, "pageNumber": 1,
"data": { "data": {
andList, andList,
orSearchModel orSearchModel
} }
} }})
} navigate("/mobile/listTask")
}
)
}} }}
footer={ footer={
<Button block type='submit' color='primary' size='large'> <Button block type='submit' color='primary' size='large'>

View File

@ -1,90 +1,13 @@
import React, {Fragment, useEffect} from 'react' import React, {Fragment, useContext, useEffect} from 'react'
import Bottom from './../Bottom/index' import Bottom from './../Bottom/index'
import './index.css' import './index.css'
import {Outlet, useLocation} from 'react-router-dom' import {Outlet, useLocation} from 'react-router-dom'
import DetailSearchBar from "../../components/DetailSearchBar"; import DetailSearchBar from "../../components/DetailSearchBar";
import dayjs from "dayjs";
import {dayStartUtcFormat, nextDayStartUtcFormat} from "../../utils/timeFormatUtil";
const Home = () => { const Home = () => {
const location = useLocation(); const location = useLocation();
console.log("Home", location); console.log("Home", location);
const searchUrl = location?.state?.search;
const [pName, setName] = React.useState("");
const [search, setSearch] = React.useState()
const updateSearch = (values) => {
setSearch(values);
};
useEffect(() => {
setSearch(searchUrl ? searchUrl : {
"pageSize": 20,
"pageNumber": 1,
"data": {
"orSearchModel": {
"andList": [
{"name": "state", "value": "8,9", "operateType": "IN"},
],
"andSearchModel": {
"andList": [
{
"name": "expectedStartTime",
"value": nextDayStartUtcFormat(dayjs()),
"operateType": "<"
},
{
"name": "expectedEndTime",
"value": dayStartUtcFormat(dayjs()),
"operateType": ">"
}
],
"orSearchModel": {
"andList": [
{
"name": "expectedStartTime",
"value": nextDayStartUtcFormat(dayjs()),
"operateType": "<"
},
{
"name": "expectedStartTime",
"value": dayStartUtcFormat(dayjs()),
"operateType": ">"
},
{
"name": "expectedEndTime",
"value": dayStartUtcFormat(dayjs()),
"operateType": "NULL"
}
],
"orSearchModel": {
"andList": [
{
"name": "expectedEndTime",
"value": nextDayStartUtcFormat(dayjs()),
"operateType": "<"
},
{
"name": "expectedEndTime",
"value": dayStartUtcFormat(dayjs()),
"operateType": ">"
},
{
"name": "expectedStartTime",
"value": dayStartUtcFormat(dayjs()),
"operateType": "NULL"
}
],
}
}
},
},
"andList": [
{"name": "state", "value": "10", "operateType": "="}
]
}
})
},[searchUrl])
return ( return (
<div className='body'> <div className='body'>
@ -92,15 +15,13 @@ const Home = () => {
location.pathname.endsWith("/calTask") ? ( location.pathname.endsWith("/calTask") ? (
<Fragment> <Fragment>
<div style={{marginBottom: "49px", width: "100%"}}> <div style={{marginBottom: "49px", width: "100%"}}>
<Outlet context={{"search": search}}/> <Outlet />
</div> </div>
</Fragment> </Fragment>
) : (<Fragment> ) : (<Fragment>
<DetailSearchBar search={search} <DetailSearchBar/>
updateSearch={updateSearch}
pName={pName}/>
<div style={{marginTop: "40px", marginBottom: "49px", width: "100%"}}> <div style={{marginTop: "40px", marginBottom: "49px", width: "100%"}}>
<Outlet context={{"search": search}}/> <Outlet/>
</div> </div>
</Fragment> </Fragment>
) )

View File

@ -1,4 +1,4 @@
import React, {Fragment, useEffect, useMemo} from "react"; import React, {Fragment, useContext, useEffect, useMemo} from "react";
import {getTaskCount} from "../../utils"; import {getTaskCount} from "../../utils";
import dayjs from "dayjs"; import dayjs from "dayjs";
import {DATE_FORMAT} from "../../utils/timeFormatUtil"; import {DATE_FORMAT} from "../../utils/timeFormatUtil";
@ -6,6 +6,7 @@ import {getDictionary} from "../../utils/dictUtil";
import {Tag} from "antd-mobile"; import {Tag} from "antd-mobile";
import detailSearchBar from "../../components/DetailSearchBar"; import detailSearchBar from "../../components/DetailSearchBar";
import {useNavigate} from "react-router-dom"; import {useNavigate} from "react-router-dom";
import {MyRootContext, UPDATE_SEARCH} from "../../components/MyRootContext";
const TaskCount = (props) => { const TaskCount = (props) => {
@ -14,6 +15,7 @@ const TaskCount = (props) => {
const [taskCount, setTaskCount] = React.useState([]); const [taskCount, setTaskCount] = React.useState([]);
const [stateMap, setStateMap] = React.useState(new Map); const [stateMap, setStateMap] = React.useState(new Map);
const [priorityMap, setPriorityMap] = React.useState(new Map); const [priorityMap, setPriorityMap] = React.useState(new Map);
const {dispatch } = useContext(MyRootContext);
useEffect(() => { useEffect(() => {
console.log("useEffect"); console.log("useEffect");
if (currentDay) { if (currentDay) {
@ -81,18 +83,14 @@ const TaskCount = (props) => {
} }
} }
console.log({orSearchModel}) console.log({orSearchModel})
navigate("/mobile/listTask", { dispatch({type:UPDATE_SEARCH,search:{
state: {
search: {
"pageSize": 12, "pageSize": 12,
"pageNumber": 1, "pageNumber": 1,
"data": { "data": {
orSearchModel orSearchModel
} }
} }})
} navigate("/mobile/listTask")
}
)
} }
return ( return (

View File

@ -4,6 +4,6 @@
.adm-card-header-title{ .adm-card-header-title{
width:100%; width:100%;
} }
.adm-pull-to-refresh{ /*.adm-pull-to-refresh{*/
touch-action:none; /* touch-action:none;*/
} /*}*/

View File

@ -1,11 +1,13 @@
import {Dialog, InfiniteScroll, List, PullToRefresh, SwipeAction} from 'antd-mobile' import {Dialog, InfiniteScroll, List, PullToRefresh, SwipeAction} from 'antd-mobile'
import React, {Fragment, useEffect, useRef, useState} from 'react' import React, {Fragment, useContext, useEffect, useRef, useState} from 'react'
import {deleteTaskById, getTaskList, updateTaskStateById} from "../../utils"; import {deleteTaskById, getTaskList, updateTaskStateById} from "../../utils";
import "./index.css" import "./index.css"
import {useLocation, useNavigate, useOutletContext} from "react-router-dom"; import {useLocation, useNavigate, useOutletContext} from "react-router-dom";
import dayjs from "dayjs"; import dayjs from "dayjs";
import {DATE_TIME_FORMAT, DATE_TIME_FORMAT_SIMPLE} from "../../utils/timeFormatUtil"; import {DATE_TIME_FORMAT, DATE_TIME_FORMAT_SIMPLE} from "../../utils/timeFormatUtil";
import {getDictionary} from "../../utils/dictUtil"; import {getDictionary} from "../../utils/dictUtil";
import {List as VirtualizedList,AutoSizer} from "react-virtualized";
import {MyRootContext} from "../../components/MyRootContext";
const reorder = ( const reorder = (
list, list,
@ -26,20 +28,21 @@ const ToDoList = () => {
const [priorityMap, setPriorityMap] = useState([]); const [priorityMap, setPriorityMap] = useState([]);
const [stateMap, setStateMap] = useState([]) const [stateMap, setStateMap] = useState([])
const navigate = useNavigate(); const navigate = useNavigate();
let loading = true; let loading = false;
const location = useLocation(); const { state } = useContext(MyRootContext);
const {search: outletSearch} = useOutletContext() const search = state.search
const search = location.state ? location.state.search : outletSearch; console.log("从全局取出的search" ,{search})
console.log("ToDoList.search", location, outletSearch)
console.log("ToDoList测试下从添加任务过来条件都没有了",search,outletSearch)
const loadMore = async () => { const loadMore = async () => {
console.log("loading:",pageNumber,loading)
if (loading) { if (loading) {
return return
} }
loading = true; loading = true;
console.log("loadMore", loading) console.log("loadMore", loading)
const taskRes = await getTaskList({...search, "pageNumber": pageNumber + 1}); const taskRes = await getTaskList({...search, "pageNumber": pageNumber});
setTaskList(val => [...val, ...taskRes.connect]) console.log({taskRes})
setTaskList( [...taskList, ...taskRes.content])
if (taskRes.page.number < taskRes.page.totalPages){ if (taskRes.page.number < taskRes.page.totalPages){
setHasMore(true) setHasMore(true)
setPageNumber(pageNumber + 1) setPageNumber(pageNumber + 1)
@ -63,17 +66,17 @@ const ToDoList = () => {
getDictionary("1").then(res => { getDictionary("1").then(res => {
setPriorityMap(res) setPriorityMap(res)
}) })
getTaskList({...search, "pageNumber": pageNumber}).then(result => { // getTaskList({...search, "pageNumber": pageNumber}).then(result => {
setTaskList(result.content) // setTaskList(result.content)
if (result.page.number < result.page.totalPages){ // if (result.page.number < result.page.totalPages){
setHasMore(true) // setHasMore(true)
setPageNumber(pageNumber + 1) // setPageNumber(pageNumber + 1)
}else { // }else {
setHasMore(false) // setHasMore(false)
setPageNumber(1) // setPageNumber(1)
} // }
loading = false; // loading = false;
}) // })
}, [useOutletContext()]) }, [useOutletContext()])
const ref = useRef(null) const ref = useRef(null)
@ -83,6 +86,7 @@ const ToDoList = () => {
<PullToRefresh <PullToRefresh
onRefresh={() => { onRefresh={() => {
console.log("refresh") console.log("refresh")
loading = true;
getTaskList({...search, "pageNumber": 1}).then(result => { getTaskList({...search, "pageNumber": 1}).then(result => {
setTaskList(result.content) setTaskList(result.content)
if (result.page.number < result.page.totalPages){ if (result.page.number < result.page.totalPages){
@ -93,9 +97,20 @@ const ToDoList = () => {
setPageNumber(1) setPageNumber(1)
} }
}) })
loading= false;
}} }}
> >
<List> <List>
{/*<AutoSizer disableHeight>*/}
{/* <VirtualizedList*/}
{/* rowCount={rowCount}*/}
{/* rowRenderer={rowRenderer}*/}
{/* width={width}*/}
{/* height={480}*/}
{/* rowHeight={60}*/}
{/* overscanRowCount={10}*/}
{/* />*/}
{/*</AutoSizer>*/}
{taskList.map((item, index) => ( {taskList.map((item, index) => (
<SwipeAction <SwipeAction
ref={ref} ref={ref}
@ -200,11 +215,11 @@ const ToDoList = () => {
style={{color: priorityMap.get(item.priority)?.jsonValue?.color}}>{item.name}</span>) : ( style={{color: priorityMap.get(item.priority)?.jsonValue?.color}}>{item.name}</span>) : (
<span>{item.name}</span>)} <span>{item.name}</span>)}
{item.expectedEndTime && (stateMap.get(item.state)?.jsonValue?.color ? {item.expectedStartTime && (stateMap.get(item.state)?.jsonValue?.color ?
(<span style={{color: stateMap.get(item.state)?.jsonValue?.color}}> (<span style={{color: stateMap.get(item.state)?.jsonValue?.color}}>
{dayjs(item.expectedEndTime).format(DATE_TIME_FORMAT_SIMPLE)}</span>) : {dayjs(item.expectedStartTime).format(DATE_TIME_FORMAT_SIMPLE)}</span>) :
( (
<span>{dayjs(item.expectedEndTime).format(DATE_TIME_FORMAT_SIMPLE)}</span>)) <span>{dayjs(item.expectedStartTime).format(DATE_TIME_FORMAT_SIMPLE)}</span>))
} }
</div>} </div>}
description={item.description} description={item.description}

View File

@ -1,8 +1,57 @@
import {Fragment} from "react"; import {Fragment, useEffect, useMemo, useState} from "react";
import {Card, Cascader, CascaderView} from "antd-mobile";
import {getTaskByPid} from "../../utils";
export default ()=>{ export default ()=>{
const [valueToOptions, setValueToOptions] = useState([])
const options = useMemo(() => {
function generate(v) {
const options = valueToOptions[v]
if (options === null) {
return undefined
}
if (options === undefined) {
return Cascader.optionSkeleton
}
return options.map(option => ({
...option,
children: generate(option.value),
}))
}
return generate('0') ?? []
}, [valueToOptions])
async function fetchOptionsForValue(v, level) {
if (v in valueToOptions) return
// if (level >= 3) {
// setValueToOptions(prev => ({
// ...prev,
// [v]: null,
// }))
// return
// }
const data = await getTaskByPid(v)
console.log("await getTaskByPid(v)",data.content)
const options =
data.content.length === 0
? null
: data.content.map(task => ({
value: task.id,
label: task.name,
}))
console.log("await getTaskByPid(v) options",options)
setValueToOptions(prev => ({
...prev,
[v]: options,
}))
}
useEffect(() => {
fetchOptionsForValue('0', 0)
}, [])
return <Fragment> return <Fragment>
<p>文本</p> <Card title='任务名称'>
<p>联动数</p> 任务详情
</Card>
<CascaderView options={options} />
</Fragment> </Fragment>
} }