feat:发版

This commit is contained in:
1708-huayu 2025-01-13 19:33:16 +08:00
parent da867a47f7
commit 791e0c2ef6
25 changed files with 13429 additions and 794 deletions

View File

@ -4,19 +4,31 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c22c6a78-950d-4bff-ac7a-ed800fcbb7de" name="Changes" comment="feat:flex,左右对齐">
<change afterPath="$PROJECT_DIR$/src/components/DetailSearchBar/index.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/components/DetailSearchBar/index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/pages/DetailSearchContext/index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/pages/ToDoTree/index.js" afterDir="false" />
<list default="true" id="c22c6a78-950d-4bff-ac7a-ed800fcbb7de" name="Changes" comment="feat:左滑修改">
<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$/src/App.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/App.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/DataPickerItem/index.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/DataPickerItem/index.jsx" 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/DetailNavBar/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/DetailNavBar/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/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/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/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/requestUtil.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/requestUtil.js" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -37,28 +49,39 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;last_opened_file_path&quot;: &quot;D:/electron/assistant-todo-mobile&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;npm.start.executor&quot;: &quot;Run&quot;,
&quot;ts.external.directory.path&quot;: &quot;C:\\Program Files\\JetBrains\\WebStorm 2024.1.5\\plugins\\javascript-plugin\\jsLanguageServicesImpl\\external&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"git-widget-placeholder": "master",
"last_opened_file_path": "D:/electron/assistant-todo-mobile",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"npm.build.executor": "Run",
"npm.start.executor": "Run",
"ts.external.directory.path": "C:\\Program Files\\JetBrains\\WebStorm 2024.1.5\\plugins\\javascript-plugin\\jsLanguageServicesImpl\\external",
"vue.rearranger.settings.migration": "true"
}
}</component>
}]]></component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\electron\assistant-todo-mobile\src\components\DataPickerItem" />
</key>
</component>
<component name="RunManager">
<component name="RunManager" selected="npm.build">
<configuration name="build" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="build" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
<configuration name="start" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
@ -71,6 +94,7 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="npm.build" />
<item itemvalue="npm.start" />
</list>
</recent_temporary>
@ -95,6 +119,8 @@
<workItem from="1735389721633" duration="18791000" />
<workItem from="1735474579369" duration="4701000" />
<workItem from="1735522393453" duration="23975000" />
<workItem from="1736653373329" duration="943000" />
<workItem from="1736729514856" duration="22949000" />
</task>
<task id="LOCAL-00001" summary="feat:backup">
<option name="closed" value="true" />

13059
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,8 +7,10 @@
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"antd-mobile": "^5.27.0",
"antd-mobile-icons": "^0.3.0",
"axios": "^1.2.2",
"dayjs": "^1.11.13",
"js-cookie": "^2.2.1",
"node-gyp": "^9.3.1",
"react": "^18.2.0",
"react-beautiful-dnd": "^13.1.1",

View File

@ -1,31 +1,24 @@
import {BrowserRouter as Router, Route, Navigate, Routes} from 'react-router-dom';
import Home from './pages/Home';
import Map from './pages/Map';
import Index from './pages/Index'
import './pages/Bottom/index.css'
import CityList from './pages/CityList';
import {PersonalCenter} from './pages/Bottom'
import ToDoList from "./pages/ToDoList";
import DetailForm from "./components/DetailForm";
import {NavBar} from "antd-mobile";
import DetailNavBar from "./components/DetailNavBar";
import DetailSearchContext from "./pages/DetailSearchContext";
import ToDoCal from "./pages/ToDoCal";
import ToDoTree from "./pages/ToDoTree";
import {PersonalCenter} from "./pages/PersonalCenter";
function App() {
return (
<Router>
<div className='app'>
{/* <div className='top'>
<NavBar >配合路由使用</NavBar>
</div> */}
{/* <div className='body'> */}
<Routes>
<Route path='/' element={<Navigate to="/home/listTask" />}>
<Route path='/' element={<Navigate to="/mobile/listTask" />}>
</Route>
<Route path='/home' element={<Home/>}>
<Route path='treeTask' element={<Index/>}/>
<Route path='/mobile' element={<Home/>}>
<Route path='treeTask' element={<ToDoTree/>}/>
<Route index path='listTask' element={<ToDoList/>}></Route>
<Route path='calTask' element={<ToDoCal/>}/>
<Route path='me' element={<PersonalCenter/>}></Route>
@ -36,22 +29,7 @@ function App() {
<Route path='updateTask' element={<DetailForm/>}></Route>
<Route path='selectTask' element={<DetailForm/>}></Route>
</Route>
{/* <Route path='/home' element={<Home />}>
<Route path='/home/todo' element={<Todo />}></Route>
<Route path='/home/message' element={<Message />}></Route>
<Route path='/home/me' element={<PersonalCenter />}></Route>
</Route> */}
{/* <Route path='/todo' element={<Todo />}></Route>
<Route path='/message' element={<Message />}></Route>
<Route path='/me' element={<PersonalCenter />}></Route> */}
<Route path='/citylist' element={<CityList/>}></Route>
<Route path='/map' element={<Map/>}></Route>
</Routes>
{/* </div> */}
{/* <div>
<Bottom />
</div> */}
</div>
</Router>
);

View File

@ -82,7 +82,7 @@ export default () => {
const onFinish = (values) => {
if (currentPath === "selectTask") {
// 进入添加日志页面
navigate("/home/detail/logTask")
navigate("/mobile/detail/logTask")
return;
}
console.log("提交:", values)
@ -102,7 +102,7 @@ export default () => {
key: 'back',
text: '回到列表',
onClick: () => {
navigate("/home/listTask")
navigate("/mobile/listTask")
}
},
{
@ -131,7 +131,7 @@ export default () => {
key: 'back',
text: '回到列表',
onClick: () => {
navigate("/home/listTask")
navigate("/mobile/listTask")
}
}
],

View File

@ -17,63 +17,75 @@ const DetailSearchBar = (props) => {
const showCloseOutline = search && search.data &&
(search.data.andList?.length > 0 || search.data.orList?.length > 0)
useEffect(() => {
if (search && search.data) {
Promise.all([
...search.data.andList.map(async (searchObj) => {
console.log("DetailSearchContext.search", searchObj)
if (searchObj.name === "pid") {
return <Tag>{pName}</Tag>
} else if (searchObj.name === "state") {
const dictionary = await getDictionary("2");
const items = searchObj.value.split(',');
const itemPromises = items.map((item) => {
const dict = dictionary.get(item);
return dict ? <Tag key={dict.id} color={dict.jsonValue?.color}>{dict.itemName}</Tag> : null;
});
return Promise.all(itemPromises);
} else if (searchObj.name === "priority") {
const dictionary = await getDictionary("1");
const items = searchObj.value.split(',');
const itemPromises = items.map((item) => {
const dict = dictionary.get(item);
return dict ? <Tag key={dict.id} color={dict.jsonValue?.color}>{dict.itemName}</Tag> : null;
});
return Promise.all(itemPromises);
} else if (searchObj.name === "expectedEndTime") {
console.log("searchObj.value" + searchObj.value, dayjs(searchObj.value).format("YYYY-MM-DD"))
return <Tag>{dayjs(searchObj.value).format("YYYY-MM-DD")}</Tag>;
} else if (searchObj.name === "name") {
return <Tag>{searchObj.value}</Tag>;
}
}),
...search.data.orList.map(async (searchObj) => {
console.log("DetailSearchContext.search", searchObj)
if (searchObj.name === "state" && searchObj.value === "10") {
const dictionary = await getDictionary("2");
const dict = dictionary.get(searchObj.value);
return dict ?
<Fragment><AddOutline/>
<Tag key={dict.id} color={dict.jsonValue?.color}>
{dict.itemName}
</Tag>
</Fragment> : null;
}
})]
).then((results) => {
// Flatten the results and filter out null values
const flattenedResults = results.flat().filter(Boolean);
console.log("flattenedResults", flattenedResults);
setTags(flattenedResults);
});
}
initSearch();
}, []);
const initSearch = async () => {
if (search && search.data) {
const stateDictionary = await getDictionary("2");
const priorityDictionary = await getDictionary("1");
// 处理主要条件
const tagList = [];
console.log("search.data.orSearchModel",search.data.orSearchModel)
search.data.orSearchModel?.andList?.forEach((searchObj) => {
if (searchObj.name === "pid") {
tagList.push(<Tag key={pName}>{pName}</Tag>)
} else if (searchObj.name === "state") {
const items = searchObj.value.split(',');
items.forEach((item) => {
const dict = stateDictionary.get(item);
if (dict) {
tagList.push(<Tag key={dict.id} color={dict.jsonValue?.color}>{dict.itemName}</Tag>)
}
});
} else if (searchObj.name === "priority") {
const items = searchObj.value.split(',');
items.forEach((item) => {
const dict = priorityDictionary.get(item);
if (dict) {
tagList.push(<Tag key={dict.id} color={dict.jsonValue?.color}>{dict.itemName}</Tag>);
}
});
} else if (searchObj.name === "name") {
tagList.push(<Tag key={searchObj.value}>{searchObj.value}</Tag>);
}
})
// 处理日期
search.data.orSearchModel?.andSearchModel?.andList?.forEach((searchObj) => {
if (searchObj.name === "expectedEndTime") {
tagList.push(
<Tag
key={dayjs(searchObj.value).format("YYYY-MM-DD")}>
{dayjs(searchObj.value).format("YYYY-MM-DD")}
</Tag>
)
}
})
// 处理逾期
search.data.andList?.forEach((searchObj) => {
console.log("DetailSearchContext.search", searchObj)
if (searchObj.name === "state" && searchObj.value === "10") {
const dict = stateDictionary.get(searchObj.value);
if (dict && tagList.length > 0) {
tagList.push(<AddOutline/>)
} if (dict) {
tagList.push(<Tag key={dict.id} color={dict.jsonValue?.color}>
{dict.itemName}
</Tag>);
}
}
})
setTags(tagList);
}
}
const navigate = useNavigate();
return (
<div className="detailSearchBar">
<div className={"onSearchItem " + (showCloseOutline ? "onSearchItemWidth" : "onSearchItemOnlyWidth")} onClick={() => {
navigate("/detail/searchTask", {state: {"search": search}});
}}>
<div className={"onSearchItem " + (showCloseOutline ? "onSearchItemWidth" : "onSearchItemOnlyWidth")}
onClick={() => {
navigate("/detail/searchTask", {state: {"search": search}});
}}>
<SearchOutline/>
{/*根据search处理搜素框展示内容*/}
{tags}

View File

@ -12,25 +12,25 @@ import "./index.css"
const tabs = [
{
key: '/home/treeTask',
key: '/mobile/treeTask',
title: '主子任务',
icon: <AppOutline/>,
badge: '1',
},
{
key: '/home/listTask',
key: '/mobile/listTask',
title: '列表任务',
icon: <UnorderedListOutline/>,
badge: '2',
},
{
key: '/home/calTask',
key: '/mobile/calTask',
title: '日历任务',
icon: <MessageOutline/>,
badge: '3',
},
{
key: '/home/me',
key: '/mobile/me',
title: '我的',
icon: <UserOutline/>,
badge: '4',
@ -90,10 +90,6 @@ class BottomInner extends React.Component {
}
}
export function PersonalCenter() {
return <div>pc端可访问:http://www.hauruyu.com</div>
}
// 使用高阶组件包裹当前类组件
const Bottom = WidthUseNavigate(BottomInner);
export default Bottom

View File

@ -1,34 +0,0 @@
.citylist{
height: 100%;
/* padding-top: 45px; */
}
ul{
list-style: none;
margin: 0;
}
.city-index {
position: absolute;
display: flex;
flex-direction: column;
right: 5px;
z-index: 1;
height: 90%;
box-sizing: border-box;
padding-top: 20px;
text-align: center;
}
.city-index .city-index-item {
flex: 1;
}
.city-index .index-active {
color: #fff;
background-color: #21b97a;
border-radius: 100%;
display: inline-block;
font-size: 12px;
width: 15px;
height: 15px;
line-height: 15px;
}

View File

@ -1,192 +0,0 @@
import React from "react";
import { NavBar, Space, Toast } from 'antd-mobile'
import { SearchOutline, MoreOutline, CloseOutline } from 'antd-mobile-icons'
import './index.css'
import axios from "axios";
import { getCurrentCity } from "../../utils";
import { List, AutoSizer } from "react-virtualized";
import WidthUseNavigate from "../WidthUseNavigate";
import NavHeader from "../../components/NavHeader";
import styles from './index.module.css'
console.log(styles)
// list:[{},{}]
const formatCityIndex = (letter) => {
switch (letter) {
case '#':
return '当前城市'
case 'hot':
return '热门城市'
default:
return letter.toUpperCase()
}
}
const formatCityData = (list) => {
// {{'a':{},'b':{}}}
const cityList = {}
// 遍历
list.forEach(element => {
//获取短名称的第一个字母
const first = element.short.substr(0, 1)
//判断cityList中是否包含
if (cityList[first]) {
cityList[first].push(element)
} else {
cityList[first] = [element]
}
});
const cityIndex = Object.keys(cityList).sort()
return {
cityList,
cityIndex
}
}
const HOUSE_CITY= ['北京','上海','广州','深圳']
// const right = (
// <div style={{ fontSize: 24 }}>
// <Space style={{ '--gap': '16px' }}>
// <SearchOutline />
// <MoreOutline />
// </Space>
// </div>
// )
const back = () => { }
// Toast.show({
// content: '点击了返回区域',
// duration: 1000,
// })
// const list =
// // [
// // 'Brian Vaughn',
// // // And so on...
// // ];
// Array(100).fill('Brian Vaughn')
// function rowRenderer({
// key, // Unique key within array of rows
// index, // Index of row within collection
// isScrolling, // The List is currently being scrolled
// isVisible, // This row is visible within the List (eg it is not an overscanned row)
// style, // Style object to be applied to row (to position it)
// }) {
// return (
// <div key={key} style={style}>
// {list[index]}
// </div>
// );
// }
class CityListInner extends React.Component {
constructor(props){
super(props)
this.state = {
cityList: {},
cityIndex: [],
activeIndex: 0
}
this.cityListComponent = React.createRef()
}
async componentDidMount() {
await this.getCityList()
//提前计算list高度
this.cityListComponent.current.measureAllRows()
}
async getCityList() {
const res = await axios.get('http://localhost:8080/area/city?level=1')
const { cityList, cityIndex } = formatCityData(res.data.body)
// 热门城市数据
const hotRes = await axios.get('http://localhost:8080/area/hot')
cityList['hot'] = hotRes.data.body
// 放在第一位
cityIndex.unshift('hot')
const curCity = await getCurrentCity();
cityList['#'] = [curCity]
cityIndex.unshift('#')
this.setState({
cityList,
cityIndex
})
// this.setState(()=>{
// return {
// cityList:cityList,
// cityIndex:cityIndex
// }
// })
}
rowRenderer = ({
key, // Unique key within array of rows
index, // Index of row within collection
isScrolling, // The List is currently being scrolled
isVisible, // This row is visible within the List (eg it is not an overscanned row)
style, // Style object to be applied to row (to position it)
}) => {
const cityIndex = this.state.cityIndex
const letter = cityIndex[index]
return (
<div key={key} style={style} className="city">
<div className="title">{formatCityIndex(letter)}</div>
{
this.state.cityList[letter].map(item => (
<div className="name" key={item.value} onClick={()=>this.changeCity(item)}>{item.label}</div>
))
}
</div>
);
}
getRowHeight = ({ index }) => {
return 36 + this.state.cityList[this.state.cityIndex[index]].length * 20
}
renderCityIndex() {
const { cityIndex, activeIndex } = this.state
return cityIndex.map((item, index) => (
<li className="city-index-item" key={item} onClick={()=>{this.cityListComponent.current.scrollToRow(index)}}>
<span className={activeIndex === index ? "index-active" : ''}>{item === 'hot' ? '热' : item.toUpperCase()}</span>
</li>
))
}
// 用户获取list组件渲染行数据
onRowsRendered=({startIndex})=>{
if(this.state.activeIndex!=startIndex){
this.setState({
activeIndex:startIndex
})
}
}
changeCity({label,value}){
if(HOUSE_CITY.indexOf(label)>-1){
localStorage.setItem('local_city',JSON.stringify({label,value}))
// 返回上一个页面
this.props.to(-1)
}else{
Toast.show('该城市暂无房源数据')
}
}
render() {
return <div className="citylist"><NavHeader>城市选择</NavHeader>
<AutoSizer>
{({ width, height }) => (
<List
width={width}
height={height}
ref={this.cityListComponent}
rowCount={this.state.cityIndex.length}
rowHeight={this.getRowHeight}
rowRenderer={this.rowRenderer}
onRowsRendered={this.onRowsRendered}
scrollToAlignment="start" />
)}
</AutoSizer>
<ul className="city-index">{this.renderCityIndex()}</ul>
</div>
}
}
// 使用高阶组件包裹当前类组件
const CityList = WidthUseNavigate(CityListInner);
export default CityList

View File

@ -1,11 +1,10 @@
import {Button, Checkbox, DatePicker, Form, Input, Space, Switch, Tag} from "antd-mobile";
import ParentTask from "../../components/ParentTask";
import React, {useEffect} from "react";
import dayjs, {isDayjs} from "dayjs";
import dayjs from "dayjs";
import {CloseCircleFill} from "antd-mobile-icons";
import {useLocation, useNavigate, useOutletContext} from "react-router-dom";
import {getDictionary} from "../../utils/dictUtil";
import {getTaskById} from "../../utils";
const DetailSearchContext = () => {
const navigate = useNavigate();
@ -33,7 +32,8 @@ const DetailSearchContext = () => {
if (!search) {
return
}
let searchMap = new Map(search.data.andList.map(searchObj => [searchObj.name, searchObj]));
let searchMap = new Map(
search.data?.orSearchModel?.andList.map(searchObj => [searchObj.name, searchObj]));
if (searchMap.has("pid")) {
// form.setFieldValue(task.name);
@ -45,14 +45,16 @@ const DetailSearchContext = () => {
form.setFieldValue("priority", searchMap.get("priority").value.split(','))
}
// 结束时间大于todo日开始时间小于结束日
if (searchMap.has("expectedEndTime")) {
let value = searchMap.get("expectedEndTime").value;
form.setFieldValue("todoDay", dayjs(value).toDate())
}
search.data.orSearchModel?.andSearchModel?.andList?.forEach((searchObj) => {
if (searchObj.name === "expectedEndTime") {
form.setFieldValue("todoDay", dayjs(searchObj.value).toDate())
}
})
if (searchMap.has("name")) {
form.setFieldValue("name", searchMap.get("name").value)
}
let orMap = new Map(search.data.orList.map(searchObj => [searchObj.name, searchObj]));
let orMap = new Map(search.data.andList.map(searchObj => [searchObj.name, searchObj]));
if (orMap.has("state") && orMap.get("state").value === "10") {
form.setFieldValue("allOverdueTasks", 'checked')
}
@ -64,8 +66,11 @@ const DetailSearchContext = () => {
layout='horizontal'
onFinish={(values) => {
console.log("Form", values)
let searchCondition = [];
let orList = []
let andList = []
let searchCondition =[]
let andSearchModel = {}
let orSearchModel = {"andList":searchCondition,andSearchModel}
const {pidArray, name, priority, state, todoDay, allOverdueTasks} = values;
if (pidArray && pidArray.length !== 0) {
searchCondition.push({"name": "name", "value": pidArray[pidArray.length - 1], "operateType": "="})
@ -80,28 +85,58 @@ const DetailSearchContext = () => {
searchCondition.push({"name": "state", "value": state.join(","), "operateType": "IN"})
}
if (todoDay) {
searchCondition.push({
andSearchModel.andList = [{
"name": "expectedStartTime",
"value": dayjs(todoDay).add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "<"
})
searchCondition.push({
}, {
"name": "expectedEndTime",
"value": dayjs(todoDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": ">"
})
}]
andSearchModel.orSearchModel = {
"andList": [
{
"name": "expectedStartTime",
"value": dayjs(todoDay).add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "<"
}, {
"name": "expectedStartTime",
"value": dayjs(todoDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": ">"
}, {
"name": "expectedEndTime",
"operateType": "NULL"
}
], orSearchModel: {
"andList": [
{
"name": "expectedEndTime",
"value": dayjs(todoDay).add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "<"
}, {
"name": "expectedEndTime",
"value": dayjs(todoDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": ">"
}, {
"name": "expectedStartTime",
"operateType": "NULL"
}
]
}
}
}
if (allOverdueTasks) {
orList.push({"name": "state", "value": "10", "operateType": "="})
andList.push({"name": "state", "value": "10", "operateType": "="})
}
navigate("/home/listTask", {
navigate("/mobile/listTask", {
state: {
search: {
"pageSize": 12,
"pageNumber": 1,
"data": {
"andList": searchCondition,
orList
andList,
orSearchModel
}
}
}
@ -151,9 +186,10 @@ const DetailSearchContext = () => {
</Checkbox.Group>
</Form.Item>
<Form.Item noStyle
shouldUpdate={(prevValues, curValues) =>{
console.log("prevValues,curValues",prevValues,curValues)
return prevValues.todoDay !== curValues.todoDay}
shouldUpdate={(prevValues, curValues) => {
console.log("prevValues,curValues", prevValues, curValues)
return prevValues.todoDay !== curValues.todoDay
}
}
>
{({getFieldValue, setFieldsValue}) => (

View File

@ -16,21 +16,64 @@ const Home = () => {
"pageSize": 20,
"pageNumber": 1,
"data": {
"andList": [
{"name": "state", "value": "8,9", "operateType": "IN"}
,
{
"name": "expectedStartTime",
"value": dayjs().add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "<"
"orSearchModel": {
"andList": [
{"name": "state", "value": "8,9", "operateType": "IN"},
],
"andSearchModel": {
"andList": [
{
"name": "expectedStartTime",
"value": dayjs().add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "<"
},
{
"name": "expectedEndTime",
"value": dayjs().set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": ">"
}
],
"orSearchModel": {
"andList": [
{
"name": "expectedStartTime",
"value": dayjs().add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "<"
},
{
"name": "expectedStartTime",
"value": dayjs().set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": ">"
},
{
"name": "expectedEndTime",
"value": dayjs().set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "NULL"
}
],
"orSearchModel": {
"andList": [
{
"name": "expectedEndTime",
"value": dayjs().add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "<"
},
{
"name": "expectedEndTime",
"value": dayjs().set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": ">"
},
{
"name": "expectedStartTime",
"value": dayjs().set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "NULL"
}
],
}
}
},
{
"name": "expectedEndTime",
"value": dayjs().set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": ">"
}
],
"orList": [
},
"andList": [
{"name": "state", "value": "10", "operateType": "="}
]
}

View File

@ -1,13 +0,0 @@
.home {
padding-bottom: 50px;
}
.home .iconfont {
font-size: 20px;
}
.home .am-tab-bar-bar {
position: fixed;
bottom: 0;
}

View File

@ -1,136 +0,0 @@
import React from 'react'
import { BrowserRouter as Router, Route, Navigate , Routes } from 'react-router-dom';
import axios from 'axios';
import { Swiper,Grid } from 'antd-mobile';
import WidthUseNavigate from './../WidthUseNavigate/index'
import ImgZZ from './../../assets/images/nav-1.png'
import ImgHZ from './../../assets/images/nav-2.png'
import ImgDTZF from './../../assets/images/nav-3.png'
import ImgQCZ from './../../assets/images/nav-4.png'
import './index.css'
const localCatalog = [
{ "imgSrc": ImgZZ, "title": "整租", "path": "/todo" },
{ "imgSrc": ImgHZ, "title": "合租", "path": "/todo" },
{ "imgSrc": ImgDTZF, "title": "地图找房", "path": "/map" },
{ "imgSrc": ImgQCZ, "title": "去出租", "path": "/me" }
]
class IndexInner extends React.Component {
state = {
swipers: [],
isSwiperLoaded: false,
groups: [],
curCityName:''
}
// 获取轮播图
async getSwitpers() {
const res = await axios.get('http://localhost:8080/home/swiper')
this.setState(
{
swipers: res.data.body,
isSwiperLoaded: true
},
// ()=>{
// return{swipers:res.data.body}
// }
)
}
// 获取租房小组
async getGroups() {
const res = await axios.get('http://localhost:8080/home/groups', {
params: {
area: 'AREA%7C88cff55c-aaa4-e2e0'
}
})
this.setState(
() => {
return { groups: res.data.body }
}
)
}
componentDidMount() {
this.getSwitpers()
this.getGroups()
const curCity = new window.BMapGL.LocalCity()
curCity.get(async res=>{
this.setState(()=>{
return {curCityName:res.name}
})
const result = await axios.get('http://localhost:8080/area/info?name=${res.name}')
console.log(result)
})
}
renderSwipers() {
return this.state.swipers.map(item => (<Swiper.Item key={item.id}>
<img height='212'
src={'http://localhost:8080' + item.imgSrc}
style={{ width: '100%', verticalAlign: 'top' }}
/>
</Swiper.Item>))
}
render() {
return <div className='context'>
{/* 轮播图 */}
<div className='context-swapper'>
<div>
{
this.state.isSwiperLoaded ? <Swiper autoplay loop autoplayInterval='1500'>{this.renderSwipers()}</Swiper> : ""
}
</div>
<div className="search-box">
{/* 左侧白色区域 */}
<div className="search">
{/* 位置 */}
<div
className="location"
onClick={() => this.props.to('/citylist')}
>
<span className="name">{this.state.curCityName}</span>
<i className="iconfont icon-arrow" />
</div>
{/* 搜索表单 */}
<div
className="form"
onClick={() => this.props.to('/search')}
>
<i className="iconfont icon-seach" />
<span className="text">请输入小区或地址</span>
</div>
</div>
{/* 右侧地图图标 */}
<i
className="iconfont icon-map"
onClick={() => this.props.history.push('/map')}
/>
</div>
</div>
{/* 本地导航 */}
<Grid columns={4}>
{
localCatalog.map((item, index) => (
<Grid.Item key={index} onClick={() => {
console.log("点击跳转")
this.props.to(item.path)
}}>
<div ><img src={item.imgSrc} /><h2>{item.title}</h2></div>
</Grid.Item>
))
}
</Grid>
{/* 租房小组 */}
<div className='group'>
<h3 className='title'>
租房小组<span className='more'>更多</span>
</h3>
</div>
</div>
};
}
// 使用高阶组件包裹当前类组件
const Index = WidthUseNavigate(IndexInner);
export default Index

View File

@ -1,4 +0,0 @@
#container{
height: 100%;
width: 100%;
}

View File

@ -1,162 +0,0 @@
import React from "react";
// import './index.css'
import 'react-virtualized/styles.css'
import NavHeader from "../../components/NavHeader";
import styles from './index.module.css'
import axios from "axios";
import Item from "antd-mobile/es/components/dropdown/item";
import { type } from "@testing-library/user-event/dist/type";
export default class Map extends React.Component {
async renderOverlays(id){
const res = await axios.get('http://localhost:8080/area/map?id='+id)
const {nextZoom,type} = this.getTypeAndZoom
res.data.body.forEach(element => {
this.createOverlays(element,nextZoom,type)
})
}
createCircle(element){
const {coord:{longitude,latitude},label:areaName,count,value}=element;
console.info(longitude,latitude)
var label = new window.BMapGL.Label(`
<div class="${styles.bubble}">
<p class="${styles.name}">${areaName}</p>
<p>${count}</p>
`, { // 创建文本标注
position: new window.BMapGL.Point(longitude,latitude), // 设置标注的地理位置
offset: new window.BMapGL.Size(10, 20) // 设置标注的偏移量
})
this.map.addOverlay(label);
label.id=value
label.addEventListener('click',()=>{
console.log(value)
// // 放大地图
// this.map.centerAndZoom(new window.BMapGL.Point(longitude,latitude),nextZoom)
// // 清除当前覆盖物信息
// this.map.clearOverlays()
})
}
createRect(element){
const {coord:{longitude,latitude},label:areaName,count,value}=element;
console.info(longitude,latitude)
var label = new window.BMapGL.Label(`
<div class="${styles.bubble}">
<p class="${styles.name}">${areaName}</p>
<p>${count}</p>
`, { // 创建文本标注
position: new window.BMapGL.Point(longitude,latitude), // 设置标注的地理位置
offset: new window.BMapGL.Size(10, 20) // 设置标注的偏移量
})
this.map.addOverlay(label);
label.id=value
label.addEventListener('click',()=>{
console.log(value)
this.getHousesList(value)
})
}
async getHousesList(id){
const res = await axios.get(`http://localhost:8080/houses?cityId=${id}`)
}
createOverlays(element,nextZoom,type){
if(type === 'circle'){
this.createCircle(element)
}else{
this.createRect(element)
}
}
getTypeAndZoom(){
const zoom = this.map.getZoom()
let nextZoom,type
if(zoom>=10&&zoom<12){
nextZoom=13
type='circle'
}else if(zoom>=12&&zoom<14){
nextZoom=15
type='circle'
}else if(zoom>=14&&zoom<16){
type='rect'
}
return {nextZoom,type}
}
componentDidMount() {
// 获取当前城市
const {label,value}=JSON.parse(localStorage.getItem('local_city'))
console.log(label,value)
// 解析当前坐标
var myGeo = new window.BMapGL.Geocoder();
// 将地址解析结果显示在地图上,并调整地图视野
// myGeo.getPoint('北京市海淀区上地10街', function(point){
// if(point){
// map.centerAndZoom(point, 16);
// map.addOverlay(new window.BMapGL.Marker(point, {title: '北京市海淀区上地10街'}))
// }else{
// alert('您选择的地址没有解析到结果!');
// }
// }, '北京市')
var map = new window.BMapGL.Map("container")
// 在其他方法中可以使用map
this.map = map
myGeo.getPoint(label,async point=>{
if(point){
map.centerAndZoom(point,11)
// map.addOverlay(new window.BMapGL.Marker(point))
var scaleCtrl = new window.BMapGL.ScaleControl(); // 添加比例尺控件
map.addControl(scaleCtrl);
var zoomCtrl = new window.BMapGL.ZoomControl(); // 添加缩放控件
map.addControl(zoomCtrl);
var cityCtrl = new window.BMapGL.CityListControl(); // 添加城市列表控件
map.addControl(cityCtrl);
this.renderOverlays(value)
// 文本覆盖物
// const res = await axios.get('http://localhost:8080/area/map?id='+value)
// res.data.body.forEach(element => {
// //
// const {coord:{longitude,latitude},label:areaName,count,value}=element;
// console.info(longitude,latitude)
// var label = new window.BMapGL.Label(`
// <div class="${styles.bubble}">
// <p class="${styles.name}">${areaName}</p>
// <p>${count}</p>
// `, { // 创建文本标注
// position: new window.BMapGL.Point(longitude,latitude), // 设置标注的地理位置
// offset: new window.BMapGL.Size(10, 20) // 设置标注的偏移量
// })
// map.addOverlay(label);
// label.id=value
// label.addEventListener('click',()=>{
// console.log(value)
// // 放大地图
// map.centerAndZoom(new window.BMapGL.Point(longitude,latitude),13)
// // 清除当前覆盖物信息
// map.clearOverlays()
// })
// });
// var point = new BMapGL.Point(116.404, 39.915);
// var content = "文本覆盖物";
// var label = new window.BMapGL.Label(content, { // 创建文本标注
// position: point, // 设置标注的地理位置
// offset: new window.BMapGL.Size(10, 20) // 设置标注的偏移量
// })
// label.setStyle({color:'red'})
// map.addOverlay(label);
}
},label)
// 设置中心点
// var point = new window.BMapGL.Point(116.404, 39.915);
// map.centerAndZoom(point, 15);
map.enableScrollWheelZoom(true);
}
render() {
return (
<div className={styles.map}>
<NavHeader>地图找房</NavHeader>
<div id="container" className={styles.container}>
</div>
</div>
)
}
}

View File

@ -1,10 +0,0 @@
.map{
padding-top: 45px;
height: 100%;
}
.container{
height: 100%;
}
.map :global(.adm-nav-bar){
margin-top: -45px;
}

View File

@ -1,6 +0,0 @@
import React from "react";
export default function News (){
// render(){
return (<div style={{backgroundColor:'skyblue',padding:10}}>news子路由</div>)
// }
}

View File

@ -0,0 +1,5 @@
import React from "react";
export function PersonalCenter() {
return <div>pc端可访问:http://www.hauruyu.com</div>
}

View File

@ -4,10 +4,13 @@ import dayjs from "dayjs";
import {DATE_FORMAT} from "../../utils/timeFormatUtil";
import {getDictionary} from "../../utils/dictUtil";
import {Tag} from "antd-mobile";
import detailSearchBar from "../../components/DetailSearchBar";
import {useNavigate} from "react-router-dom";
const TaskCount = (props) => {
let currentDay = props.currentDay;
const navigate = useNavigate();
const [taskCount, setTaskCount] = React.useState([]);
const [stateMap, setStateMap] = React.useState(new Map);
const [priorityMap, setPriorityMap] = React.useState(new Map);
@ -32,9 +35,70 @@ const TaskCount = (props) => {
}, [currentDay])
const todoDayDetail = ()=>{
let andSearchModel = {}
let orSearchModel = {andSearchModel}
if (currentDay) {
andSearchModel.andList = [{
"name": "expectedStartTime",
"value": dayjs(currentDay).add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "<"
}, {
"name": "expectedEndTime",
"value": dayjs(currentDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": ">"
}]
andSearchModel.orSearchModel = {
"andList": [
{
"name": "expectedStartTime",
"value": dayjs(currentDay).add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "<"
}, {
"name": "expectedStartTime",
"value": dayjs(currentDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": ">"
}, {
"name": "expectedEndTime",
"operateType": "NULL"
}
], orSearchModel: {
"andList": [
{
"name": "expectedEndTime",
"value": dayjs(currentDay).add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": "<"
}, {
"name": "expectedEndTime",
"value": dayjs(currentDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
"operateType": ">"
}, {
"name": "expectedStartTime",
"operateType": "NULL"
}
]
}
}
}
console.log({orSearchModel})
navigate("/mobile/listTask", {
state: {
search: {
"pageSize": 12,
"pageNumber": 1,
"data": {
orSearchModel
}
}
}
}
)
}
return (
<div style={{margin:"20px"}}>
<h2>TODO日{currentDay&&dayjs(currentDay).format(DATE_FORMAT)}代办</h2>
<h2>TODO日{currentDay && dayjs(currentDay).format(DATE_FORMAT)}代办
{currentDay&&<a onClick={todoDayDetail}>详情</a>}</h2>
<h3>任务状态</h3>
{
// taskCount.map(task => {

View File

@ -1,11 +1,5 @@
import {Card, Dialog, Image, 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 {
DragDropContext,
Draggable,
Droppable,
// DropResult,
} from 'react-beautiful-dnd'
import {deleteTaskById, getTaskList, updateTaskStateById} from "../../utils";
import "./index.css"
import {useLocation, useNavigate, useOutletContext} from "react-router-dom";
@ -32,25 +26,31 @@ const ToDoList = () => {
const [priorityMap, setPriorityMap] = useState([]);
const [stateMap, setStateMap] = useState([])
const navigate = useNavigate();
let loading = true;
let loading = false;
const location = useLocation();
const {search: outletSearch} = useOutletContext()
const search = location.state ? location.state.search : outletSearch;
console.log("ToDoList.search", location, outletSearch)
async function loadMore() {
const loadMore = async () => {
if (loading) {
return
}
loading = true;
console.log("loadMore", loading)
getTaskList({...search, "pageNumber": pageNumber + 1}).then(result => {
await getTaskList({...search, "pageNumber": pageNumber + 1}).then(result => {
setTaskList(val => [...val, ...result.content])
setHasMore(result.page.number < result.page.totalPages)
})
setPageNumber(pageNumber + 1)
loading = false;
}
/**
* 根据查询条件筛选本地列表不触发接口
*/
const localRefresh = () =>{
}
useEffect(() => {
getDictionary("2").then(res => {
@ -62,17 +62,11 @@ const ToDoList = () => {
getTaskList({...search, "pageNumber": pageNumber}).then(result => {
setTaskList(result.content)
setHasMore(result.page.number < result.page.totalPages)
loading=false;
loading = false;
})
}, [])
const onDragEnd = (result) => {
if (!result.destination) return
const newList = reorder(taskList, result.source.index, result.destination.index)
setTaskList([...newList])
}
const ref = useRef(null)
const refSwip = useRef(null)
return (
<Fragment>
{/* 下拉刷新 */}
@ -89,65 +83,69 @@ const ToDoList = () => {
<List>
{taskList.map((item, index) => (
<SwipeAction
ref={refSwip}
ref={ref}
closeOnAction={false}
closeOnTouchOutside={false}
rightActions={[
{
key: 'delete',
key: `delete${item.id}`,
text: '删除',
color: 'danger',
onClick: async () => {
onClick: () => {
Dialog.confirm({
content: '确定要删除吗?',
onConfirm: () => {
deleteTaskById(item.id).then(() => {
refSwip.current?.close()
ref.current?.close()
})
},
onClose: () => {
console.log(refSwip)
refSwip.current?.close()
console.log(ref)
ref.current?.close()
}
})
},
},
{
key: 'close',
key: `close${item.id}`,
text: '关闭',
color: 'warning',
onClick: async () => {
await Dialog.confirm({
onClick: () => {
Dialog.confirm({
content: '确定要关闭吗?',
onConfirm: () => {
updateTaskStateById('6', item.id)
updateTaskStateById('6', item.id).then(res => {
ref.current?.close()
})
},
})
refSwip.current?.close()
},
},
{
key: 'update',
key: `update${item.id}`,
text: '修改',
color: 'primary',
onClick: () => {
refSwip.current?.close()
ref.current?.close()
// 跳转
navigate(`/detail/updateTask?id=${item.id}`)
},
},
{
key: 'complete',
key: `complete${item.id}`,
text: '完成',
color: 'success',
onClick: async () => {
await Dialog.confirm({
onClick: () => {
Dialog.confirm({
content: '确定要完成吗?',
onConfirm: () => {
updateTaskStateById('7', item.id)
updateTaskStateById('7', item.id).then(res => {
ref.current?.close()
console.log({ref})
})
},
})
refSwip.current?.close()
},
},
]}
@ -190,27 +188,12 @@ const ToDoList = () => {
{item.expectedEndTime && (stateMap.get(item.state)?.jsonValue?.color ?
(<span style={{color: stateMap.get(item.state)?.jsonValue?.color}}>
结束时间:{dayjs(item.expectedEndTime).format(DATE_TIME_FORMAT)}</span>) :
(<span>结束时间:{dayjs(item.expectedEndTime).format(DATE_TIME_FORMAT)}</span>))
(
<span>结束时间:{dayjs(item.expectedEndTime).format(DATE_TIME_FORMAT)}</span>))
}
</div>}
description={item.description}
>
{/*<Card style={{width: "100%"}} title={*/}
{/* <div style={{*/}
{/* display: "flex",*/}
{/* justifyContent: "space-between",*/}
{/* alignItems: "center",*/}
{/* flexDirection: "row",*/}
{/* flexWrap: "nowrap"*/}
{/* }}>*/}
{/* <span>{item.name}</span>*/}
{/* {item.expectedEndTime && <span>*/}
{/* 结束时间:{item.expectedEndTime}</span>}*/}
{/* </div>}*/}
{/*>*/}
{/* {item.description}*/}
{/*</Card>*/}
</List.Item>
</SwipeAction>
))}

View File

@ -1 +1,8 @@
上面用文本下面用联动视图
import {Fragment} from "react";
export default ()=>{
return <Fragment>
<p>文本</p>
<p>联动数</p>
</Fragment>
}

View File

@ -6,8 +6,8 @@ import DetailSearchContext from "../pages/DetailSearchContext";
const router = [
{
key:"home",
path: "/home",
key:"mobile",
path: "/mobile",
element: <Home/>,
children: [{
key:"treeTask",

View File

@ -1,30 +1,5 @@
import axios from "axios"
import {requestUtil} from "./requestUtil";
export const getCurrentCity = () => {
const localCity = JSON.parse(localStorage.getItem('local_city'))
if (!localCity) {
return new Promise((resolve, reject) => {
const curCity = new window.BMapGL.LocalCity()
curCity.get(async res => {
try {
const result = await axios.get('http://localhost:8080/area/info?name=${res.name}')
localStorage.setItem('local_city', JSON.stringify(result.data.body))
resolve(result.data.body)
} catch (e) {
reject(e)
}
})
})
}
// return new Promise((resolve)=>{
// return resolve(localCity)
// })
return Promise.resolve(localCity)
}
export const getTaskList = (data) => {
let request = encodeURI(JSON.stringify(data))
return requestUtil.get('/todo-server/V2/search/task_message_tree?search=' + request);
@ -59,12 +34,12 @@ export const deleteTaskById = (id) => {
}
export const addTask = async (entity) => {
// 使用 Axios 发送 POST 请求添加数据
return await requestUtil.post('/todo-server' + '/task', entity);
return await requestUtil.post('/todo-server/task', entity);
}
export const updateTask = async (entity) => {
// 使用 Axios 发送 PUT 请求添加数据
return await requestUtil.put('/todo-server' + '/task', entity);
return await requestUtil.put('/todo-server/task', entity);
}
export const getPTask = (id) => {
return requestUtil.get(`http://localhost:8092/task/parent?ids=${id}`)
return requestUtil.get(`/todo-server/task/parent?ids=${id}`)
}

View File

@ -1,11 +1,23 @@
import axios from "axios";
import Cookies from "js-cookie";
export const requestUtil = axios.create({
baseURL: 'http://www.huaruyu.com/',
timeout: 10000,
headers: {'Authorization': 'Bearer eyJraWQiOiJjZDE5YjcxYy05ZDkwLTQyY2EtOGM5NC02YmMyNWY4YTdmNjgiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzaGl4aWFvaHVhIiwic3ViIjoie1wiaWRcIjpcIjM2OTg0Nzc3MTAxODAzNTIwXCIsXCJuaWNrbmFtZVwiOlwi5biI5pmT5Y2OXCIsXCJ1c2VybmFtZVwiOlwic2hpeGlhb2h1YVwifSJ9.3Wu8VMAuk59WP_EIRGX6hVp1ShuvYiAwFmvE6CGe5zA_9AzvUVMyRGWWcEQQzuU3BlZ14cV8-9b_g9_tZepQE_mSlDn0yJ92jB3ATxFPsAdcC5m2o7UY6spUs3zrlJ7v99Gtd6YzzUZvk0JTPjJCIpSi5-_PtIcOmZEkjgLwa2fnOj8eh9U3B2YdQ6p8J8r1ZeNfSMlzFuIyVcLFR-ftDz3Gr6wbs3fPgh03GqevL-HKyTCku2Fb9oYWis4UYDYQFfEVYVLzocsS3DpKyeq8BGxRRqQkSXsodDaO2piib-60Zp5WOg6hQb0n9utH-fQDVU5hIhUYkAbKkGDmTrnyqg'}
// headers: {'Authorization': 'Bearer eyJraWQiOiJjZDE5YjcxYy05ZDkwLTQyY2EtOGM5NC02YmMyNWY4YTdmNjgiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzaGl4aWFvaHVhIiwic3ViIjoie1wiaWRcIjpcIjM2OTg0Nzc3MTAxODAzNTIwXCIsXCJuaWNrbmFtZVwiOlwi5biI5pmT5Y2OXCIsXCJ1c2VybmFtZVwiOlwic2hpeGlhb2h1YVwifSJ9.3Wu8VMAuk59WP_EIRGX6hVp1ShuvYiAwFmvE6CGe5zA_9AzvUVMyRGWWcEQQzuU3BlZ14cV8-9b_g9_tZepQE_mSlDn0yJ92jB3ATxFPsAdcC5m2o7UY6spUs3zrlJ7v99Gtd6YzzUZvk0JTPjJCIpSi5-_PtIcOmZEkjgLwa2fnOj8eh9U3B2YdQ6p8J8r1ZeNfSMlzFuIyVcLFR-ftDz3Gr6wbs3fPgh03GqevL-HKyTCku2Fb9oYWis4UYDYQFfEVYVLzocsS3DpKyeq8BGxRRqQkSXsodDaO2piib-60Zp5WOg6hQb0n9utH-fQDVU5hIhUYkAbKkGDmTrnyqg'}
});
requestUtil.interceptors.request.use()
requestUtil.interceptors.request.use(function (config){
// 从本地存储中获取 token
const token = localStorage.getItem('platform-security');
let platform = Cookies.get('platform-security');
if (token) {
// config.headers.Authorization123 = `Bearer ${token}`;
config.headers.Authorization = `Bearer ${token}`;
}else if (platform){
config.headers.Authorization = `Bearer ${platform}`;
}
return config;
})
// 添加响应拦截器
requestUtil.interceptors.response.use(function (response) {
// 2xx 范围内的状态码都会触发该函数。