Commit 64ce1288 authored by 熊成伟's avatar 熊成伟

debug

parent 186034f2
This diff is collapsed.
import React from 'react';
import './index.less'
const data = [{}, {}, {}, {}]
const Index = () => {
return (
<div className="address-box">
{data.map((item, index) => (
<div className="address-item">
cccc
<img src="/img/rarrow.png" alt="" className='icon18'/>
</div>
))}
</div>
);
};
export default Index;
.address-item{
display: flex;
justify-content: space-between;
padding: 15px;
margin-bottom: 1px;
background: #ffffff;
}
.address-box > .address-item:first-child{
border-radius: 6px 6px 0 0;
}
.address-box > .address-item:last-child{
border-radius: 0 0 6px 6px;
}
@import '../../variable.less';
.todo-card{ .todo-card{
} }
...@@ -13,7 +15,7 @@ ...@@ -13,7 +15,7 @@
height: 18px; height: 18px;
font-size: 9px; font-size: 9px;
padding: 0 5px; padding: 0 5px;
background: #2087ED; background: @primary;
color: #ffffff; color: #ffffff;
border-radius:3px; border-radius:3px;
} }
...@@ -39,6 +41,7 @@ ...@@ -39,6 +41,7 @@
.todo-footer{ .todo-footer{
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center;
padding: 15px 15px; padding: 15px 15px;
background:rgba(255,255,255,1); background:rgba(255,255,255,1);
border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px;
......
...@@ -7,7 +7,7 @@ const tabs = [ ...@@ -7,7 +7,7 @@ const tabs = [
{ title: '未读', sub: '2' }, { title: '未读', sub: '2' },
] ]
const Index = () => { const Index = (props) => {
return ( return (
<div className="pos-line"> <div className="pos-line">
<div className="search-notice-box"> <div className="search-notice-box">
......
...@@ -2,7 +2,7 @@ import React from 'react'; ...@@ -2,7 +2,7 @@ import React from 'react';
import './index.less' import './index.less'
const data = [{}, {}, {}, {s: '1'}, {s: '111', result: '11111'}] const data = [{}, {}, {}, {s: '1'}, {s: '111', result: '11111'}]
const Index = () => { const Index = (props) => {
return ( return (
<div className="auto-step"> <div className="auto-step">
<ul className="auto-step-card"> <ul className="auto-step-card">
......
import React, {Component} from 'react'; import React, {useState} from 'react';
import {Icon} from 'antd-mobile' import {Icon} from 'antd-mobile'
import './index.less' import './index.less'
class Index extends Component {
state={ const Index = (props) => {
status: false const [status, setStatus] = useState(false);
};
topSearch = () => { const topSearch = () => {
const input = document.getElementsByClassName("top-single-search"); const input = document.getElementsByClassName("top-single-search");
this.props.onSearch(input[0].value); props.onSearch(input[0].value);
let inputValue = input[0].value let inputValue = input[0].value;
this.setState({status: (inputValue != null && inputValue != undefined && inputValue != '')}) setStatus(inputValue != null && inputValue != undefined && inputValue != '')
}; };
clear = () => { const clear = () => {
this.setState({status: false}) setStatus(false)
const input = document.getElementsByClassName("top-single-search"); const input = document.getElementsByClassName("top-single-search");
input[0].value = null; input[0].value = null;
input[0].focus(); input[0].focus();
} }
render() { return (
const {status} = this.state <div className="search-box">
return ( <Icon type="search" size="xs" className="search-svg"/>
<div className="search-box"> <input onChange={topSearch} className="top-single-search" placeholder="请输入关键字搜索" />
<Icon type="search" size="xs" className="search-svg"/> {status && (
<input onChange={this.topSearch} className="top-single-search" placeholder="请输入关键字搜索" /> <Icon type="cross-circle-o" color="rgba(35, 35, 35, 0.3)" size="xxs" className="clear-svg" onClick={clear}/>
{status && ( )}
<Icon type="cross-circle-o" color="rgba(35, 35, 35, 0.3)" size="xxs" className="clear-svg" onClick={this.clear}/>
)}
</div> </div>
); );
} };
}
export default Index; export default Index;
import React, {Component} from 'react'; import React, {useState, useEffect} from 'react';
import './index.less' import './index.less'
class CardItem extends Component {
state = {
addStatus: false
}
componentWillReceiveProps(nextProps, nextContext) {
if (this.props.addStatus !== nextProps.addStatus) {
this.setState({ addStatus: nextProps.addStatus });
}
};
contentCLick = () => { const CardItem = (props) => {
const {data, addCommon} = this.props; const {data, addStatus, type, addCommon, iconAction} = props;
const {addStatus} = this.state
!addStatus && !data.iconAdd && console.log(data.text); const [status, setStatus] = useState(false);
useEffect(() => {
setStatus(addStatus)
}, [addStatus])
const contentCLick = () => {
!status && !data.iconAdd && console.log(data.text);
data.iconAdd && addCommon() data.iconAdd && addCommon()
}; };
iconClick = () => { const iconClick = () => {
const { iconAction} = this.props;
iconAction() iconAction()
} };
return (
render() { <div className="card-content" onClick={contentCLick}>
const {data, type} = this.props; {data.text && (
const {addStatus} = this.state <div className="card-content-box">
return ( <div className="card-content-img">
<div className="card-content" onClick={this.contentCLick}> {
{data.text && ( status && !data.iconAdd && (
<div className="card-content-box"> <img
<div className="card-content-img"> src={type === 'edit' ? '/img/common-d.png' : '/img/common-a.png'}
{ className="card-content-img-icon"
addStatus && !data.iconAdd && ( alt=""
<img onClick={iconClick}
src={type === 'edit' ? '/img/common-d.png' : '/img/common-a.png'} />
className="card-content-img-icon" )
alt="" }
onClick={this.iconClick}
/>
)
}
<img src={data.icon} className="card-content-img-svg" alt="" /> <img src={data.icon} className="card-content-img-svg" alt="" />
</div> </div>
<div className="card-content-title"> <div className="card-content-title">
{data.text} {data.text}
</div>
</div> </div>
)} </div>
</div> )}
); </div>
} );
} };
export default CardItem; export default CardItem;
import React, {Component} from 'react'; import React from 'react';
import './index.less' import './index.less'
import CardItem from './CardItem' import CardItem from './CardItem'
class Index extends Component { const Index = (props) => {
render() { const {title, type, addStatus, addCommon, data, iconAction} = props;
const {title, type, addStatus, addCommon, data, iconAction} = this.props; const emptyIcon = type === 'edit' ? {
const emptyIcon = type === 'edit' ? { text: addStatus ? '完成添加' :'添加常用', icon: addStatus ? '/img/finish-work.png' : '/img/add-work.png', iconAdd: true
text: addStatus ? '完成添加' :'添加常用', icon: addStatus ? '/img/finish-work.png' : '/img/add-work.png', iconAdd: true } : {};
} : {};
const empty = data.length % 3;
const empty = data.length % 3; empty === 0 && data.push(emptyIcon, {}, {});
empty === 0 && data.push(emptyIcon, {}, {}); empty === 1 && data.push(emptyIcon, {});
empty === 1 && data.push(emptyIcon, {}); empty === 2 && data.push(emptyIcon);
empty === 2 && data.push(emptyIcon); return (
<div>
return ( <div className="work-card-title">
<div> {title}
<div className="work-card-title"> </div>
{title} <div className="work-card-body">
</div> {data.map((item, index) => (
<div className="work-card-body"> <CardItem
{data.map((item, index) => ( type={type}
<CardItem key={index}
type={type} data={item}
key={index} addStatus={addStatus}
data={item} addCommon={addCommon}
addStatus={addStatus} iconAction={iconAction}
addCommon={addCommon} />
iconAction={iconAction} ))}
/>
))}
</div>
</div> </div>
); </div>
} );
} };
export default Index; export default Index;
import React, {Component} from 'react'; import React, {useState} from 'react';
import {WhiteSpace, WingBlank, ActivityIndicator} from 'antd-mobile' import {WhiteSpace, WingBlank, ActivityIndicator} from 'antd-mobile'
import TodoCard from '../../components/LogCard' import TodoCard from '../../components/LogCard'
import TopSearch from '../../components/TopSearch' import TopSearch from '../../components/TopSearch'
class Index extends Component { const Backlog = () => {
constructor(){
super(); const [loading, setLoading] = useState(false)
this.state={
loading: false const checkLog = () => {
};
};
checkLog = () => {
this.props.history.push(`/blank/info/example/1`) this.props.history.push(`/blank/info/example/1`)
} }
render() { return (
const {loading} = this.state; <WingBlank>
return ( <ActivityIndicator
<WingBlank> toast
<ActivityIndicator text="加载中..."
toast animating={loading}
text="加载中..." />
animating={loading} <WhiteSpace/>
/> <TopSearch onSearch={val => console.log(val)}/>
<WhiteSpace/> {
<TopSearch onSearch={val => console.log(val)}/> [{},{},{},{},{},{}].map((item, index) => (
{ <div key={index}>
[{},{},{},{},{},{}].map((item, index) => ( <WhiteSpace/>
<div key={index}> <TodoCard data={item} onClick={checkLog}/>
<WhiteSpace/> </div>
<TodoCard data={item} onClick={this.checkLog}/>
</div>
)) ))
} }
</WingBlank> </WingBlank>
); );
} };
}
export default Index; export default Backlog;
import React, {Component} from 'react'; import React, {useState, useEffect} from 'react';
import {WingBlank, WhiteSpace, ActionSheet, ActivityIndicator} from 'antd-mobile' import {WingBlank, WhiteSpace, ActionSheet, ActivityIndicator} from 'antd-mobile'
import './index.less' import './index.less'
import TopTabs from '../../components/BlankTabs' import TopTabs from '../../components/BlankTabs'
...@@ -7,76 +7,59 @@ import Adjunct from './Adjunct' ...@@ -7,76 +7,59 @@ import Adjunct from './Adjunct'
import Flow from './Flow'; import Flow from './Flow';
import Option from './Option'; import Option from './Option';
//Ipone antd-mobile ActionSheet const Pro = (props) => {
const isIPhone = new RegExp('\\biPhone\\b|\\biPod\\b', 'i').test(window.navigator.userAgent); const [loading, setLoading] = useState(false);
let wrapProps;
if (isIPhone) { //提交按钮状态
wrapProps = { const [disabled, setDisabled] = useState(true)
onTouchStart: e => e.preventDefault(), //提交按钮文字
const [footButton, setFootButton] = useState('确认发送');
//聚焦
const optionBlur = () => {
setFootButton('确认发送');
setFootStatus(true)
}; };
} useEffect(() => {
const option = document.getElementsByClassName("option-text")[0]
option.addEventListener('focus', optionBlur, true);
return () => option.removeEventListener('focus', optionBlur, true);
}, []);
class Process extends Component { const optionChange = val => {
constructor() { setDisabled(!(val != null && val != undefined && val != ''))
super();
this.optionBlur = this.optionBlur.bind(this)
this.handleScroll = this.handleScroll.bind(this)
this.state = {
current: 'basic',
disabled: true,
footStatus: false,
footButton: '处理',
loading: false
}
}; };
componentDidMount() {
document.getElementsByClassName("option-text")[0].addEventListener('focus', this.optionBlur, true)
window.addEventListener('scroll', this.handleScroll, true);
}
optionBlur = () => {
this.setState({footButton: '确认发送', footStatus: true})
}
componentWillUnmount() { const [current, setCurrent] = useState('basic');
document.getElementsByClassName("option-text")[0].removeEventListener('focus', this.optionBlur, true)
window.removeEventListener('scroll', this.handleScroll, true); const [footStatus, setFootStatus] = useState(false);
}
handleScroll() { //点击输入框, 聚焦移动
const adjunct = document.getElementById("event-adjunct").offsetTop; const textClick = () => {
const flow = document.getElementById("event-flow").offsetTop; const top = document.getElementById(`event-option`).offsetTop;
const option = document.getElementById("event-option").offsetTop; document.getElementById("event").scrollTo(0,top)
const event = document.getElementById('event'); document.getElementsByClassName("option-text")[0].focus();
const top = event.scrollTop; optionBlur()
const scrollHeight = event.scrollHeight;
const clientHeight = event.clientHeight
if (top >= 0 && top < adjunct) {
this.setState({current: 'basic'})
}else if (top >= adjunct && top < flow) {
this.setState({current: 'adjunct'})
}else if (top >= flow && top < option) {
this.setState({current: 'flow'})
}else if (top >= option) {
this.setState({current: 'option'})
}
if (top + clientHeight === scrollHeight) {
this.setState({current: 'option'})
}
}; };
tabClick = (name) => {
this.setState({current: name}) //tab切换
const tabClick = (name) => {
setCurrent(name)
name === 'option' && document.getElementsByClassName("option-text")[0].focus(); name === 'option' && document.getElementsByClassName("option-text")[0].focus();
name === 'option' && this.optionBlur() name === 'option' && optionBlur()
const top = document.getElementById(`event-${name}`).offsetTop; const top = document.getElementById(`event-${name}`).offsetTop;
document.getElementById("event").scrollTo(0,top); document.getElementById("event").scrollTo(0,top);
}; };
textClick = () => {
const top = document.getElementById(`event-option`).offsetTop;
document.getElementById("event").scrollTo(0,top)
document.getElementsByClassName("option-text")[0].focus();
this.optionBlur()
}
showActionSheet = () => {
//antd-mobile 提交选项
const isIPhone = new RegExp('\\biPhone\\b|\\biPod\\b', 'i').test(window.navigator.userAgent);
let wrapProps;
if (isIPhone) {
wrapProps = {
onTouchStart: e => e.preventDefault(),
};
}
const showActionSheet = () => {
const BUTTONS = ['送部门领导审核', '送办公室分管主任审批', '办结', '取消']; const BUTTONS = ['送部门领导审核', '送办公室分管主任审批', '办结', '取消'];
ActionSheet.showActionSheetWithOptions({ ActionSheet.showActionSheetWithOptions({
options: BUTTONS, options: BUTTONS,
...@@ -85,52 +68,72 @@ class Process extends Component { ...@@ -85,52 +68,72 @@ class Process extends Component {
wrapProps, wrapProps,
}, },
(buttonIndex) => { (buttonIndex) => {
props.history.push(`/blank/submit/1`)
// console.log(buttonIndex) // console.log(buttonIndex)
}); });
}; };
optionChange = val => {
this.setState({disabled: !(val != null && val != undefined && val != '')})
}
render() {
const {footButton, disabled, footStatus, current, loading} = this.state
return (
<div>
<ActivityIndicator
toast
text="加载中..."
animating={loading}
/>
<TopTabs page={current} onClick={this.tabClick}/>
<div id="event">
<WingBlank>
<div id="event-basic"/>
<WhiteSpace/>
<Basic/>
<div id="event-adjunct"/>
<WhiteSpace/>
<Adjunct/>
<div id="event-flow"/>
<WhiteSpace/>
<Flow/>
<div id="event-option"/>
<WhiteSpace/>
<Option onChange={this.optionChange}/>
</WingBlank>
</div>
<div className="event-footer">
<div className={`event-footer-button ${(footStatus && disabled) ? 'button-disabled' : '' }`} onClick={footStatus && !disabled ? this.showActionSheet: this.textClick}>
{!footStatus && (
<img alt="" src="/img/process-edit.png" className="process-edit"/>
)}
{footButton}
</div>
const handleScroll = () => {
const adjunct = document.getElementById("event-adjunct").offsetTop;
const flow = document.getElementById("event-flow").offsetTop;
const option = document.getElementById("event-option").offsetTop;
const event = document.getElementById('event');
const top = event.scrollTop;
const scrollHeight = event.scrollHeight;
const clientHeight = event.clientHeight
if (top >= 0 && top < adjunct) {
setCurrent('basic')
}else if (top >= adjunct && top < flow) {
setCurrent('adjunct')
}else if (top >= flow && top < option) {
setCurrent('flow')
}else if (top >= option) {
setCurrent('option')
}
if (top + clientHeight === scrollHeight) {
setCurrent('option')
}
};
useEffect(() => {
window.addEventListener('scroll', handleScroll, true);
return () => window.removeEventListener('scroll', handleScroll, true);
}, [])
return (
<div>
<ActivityIndicator
toast
text="加载中..."
animating={loading}
/>
<TopTabs page={current} onClick={tabClick}/>
<div id="event">
<WingBlank>
<div id="event-basic"/>
<WhiteSpace/>
<Basic/>
<div id="event-adjunct"/>
<WhiteSpace/>
<Adjunct/>
<div id="event-flow"/>
<WhiteSpace/>
<Flow/>
<div id="event-option"/>
<WhiteSpace/>
<Option onChange={optionChange}/>
</WingBlank>
</div>
<div className="event-footer">
<div className={`event-footer-button ${(footStatus && disabled) ? 'button-disabled' : '' }`} onClick={footStatus && !disabled ? showActionSheet: textClick}>
{!footStatus && (
<img alt="" src="/img/process-edit.png" className="process-edit"/>
)}
{footButton}
</div> </div>
</div> </div>
);
}
}
export default Process; </div>
);
};
export default Pro;
import React, {Component} from 'react'; import React, {Component} from 'react';
import AddressList from '../../components/AddressList'
import {WingBlank, WhiteSpace} from "antd-mobile";
class SubmitDetail extends Component { class SubmitDetail extends Component {
render() { render() {
return ( return (
<div> <div>
<WhiteSpace/>
<WingBlank>
<AddressList/>
</WingBlank>
</div> </div>
); );
......
import React, {Component} from 'react'; import React, {useState} from 'react';
import {ActivityIndicator, WhiteSpace, WingBlank} from 'antd-mobile' import {ActivityIndicator, WhiteSpace, WingBlank} from 'antd-mobile'
import TodoCard from '../../components/LogCard' import TodoCard from '../../components/LogCard'
import TopNotice from '../../components/NoticeTab' import TopNotice from '../../components/NoticeTab'
const Notice = (props) => {
class Notice extends Component { const [loading, setLoading] = useState(false)
state={ return (
loading: false <WingBlank>
}; <ActivityIndicator
render() { toast
const {loading} = this.state; text="加载中..."
return ( animating={loading}
<WingBlank> />
<ActivityIndicator <WhiteSpace/>
toast <TopNotice/>
text="加载中..." <WhiteSpace/>
animating={loading} <TodoCard/>
/> </WingBlank>
<WhiteSpace/> );
<TopNotice/> };
<WhiteSpace/>
<TodoCard/>
</WingBlank>
);
}
}
export default Notice; export default Notice;
import React, {Component} from 'react'; import React, {useState} from 'react';
import {ActivityIndicator, WhiteSpace, WingBlank} from "antd-mobile"; import {ActivityIndicator, WhiteSpace, WingBlank} from "antd-mobile";
import TopSearch from '../../components/TopSearch' import TopSearch from '../../components/TopSearch'
import WorkCard from '../../components/WorkCard' import WorkCard from '../../components/WorkCard'
class Work extends Component { const Work = () => {
state = { //测试数据
addStatus: false, const data222 = Array.from(new Array(7)).map((_val, i) => ({
loading: false id: `name${i}`,
}; icon: '/img/test/test.png',
commonEdit = () => { text: `name${i}`,
const {addStatus} = this.state; }));
this.setState({addStatus: !addStatus}) const data22222 = Array.from(new Array(7)).map((_val, i) => ({
id: `name2${i}`,
icon: '/img/test/test-1.png',
text: `name${i}`,
}));
const [addStatus, setAddStatus] = useState(false);
const [loading, setLoading] = useState(false)
const commonEdit = () => {
setAddStatus(!addStatus)
}; };
workSearch = (val) => { const workSearch = (val) => {
console.log(val) console.log(val)
}; };
itemAdd = (id, arr, arr2) => { const itemAdd = (id, arr, arr2) => {
// const item = arr2.filter(item => item.id === id); // const item = arr2.filter(item => item.id === id);
// arr.splice(arr.length - 1, 0, item[0]); // arr.splice(arr.length - 1, 0, item[0]);
}; };
itemSlice = (id, arr, arr2) => { const itemSlice = (id, arr, arr2) => {
// const index = arr.findIndex(item => item.id == id); // const index = arr.findIndex(item => item.id == id);
// index > -1 && arr.splice(index, 1); // index > -1 && arr.splice(index, 1);
}; };
render() {
const {addStatus, loading} = this.state;
//测试数据
const data222 = Array.from(new Array(7)).map((_val, i) => ({
id: `name${i}`,
icon: '/img/test/test.png',
text: `name${i}`,
}));
const data22222 = Array.from(new Array(7)).map((_val, i) => ({
id: `name2${i}`,
icon: '/img/test/test-1.png',
text: `name${i}`,
}));
return ( return (
<WingBlank> <WingBlank>
<ActivityIndicator <ActivityIndicator
toast toast
text="加载中..." text="加载中..."
animating={loading} animating={loading}
/> />
<WhiteSpace/> <WhiteSpace/>
<TopSearch onSearch={this.workSearch}/> <TopSearch onSearch={workSearch}/>
<WhiteSpace/> <WhiteSpace/>
<WorkCard <WorkCard
type="edit" type="edit"
title="常用板块" title="常用板块"
addCommon={this.commonEdit} addCommon={commonEdit}
addStatus={addStatus} addStatus={addStatus}
data={data222} data={data222}
iconAction={this.itemSlice} iconAction={itemSlice}
/> />
<WhiteSpace/> <WhiteSpace/>
<WorkCard <WorkCard
title="事物管理" title="事物管理"
addCommon={this.commonEdit} addCommon={commonEdit}
addStatus={addStatus} addStatus={addStatus}
data={data22222} data={data22222}
iconAction={this.itemAdd} iconAction={itemAdd}
/> />
</WingBlank> </WingBlank>
); );
} };
}
export default Work; export default Work;
...@@ -9,6 +9,7 @@ import Notice from './pages/Notice/Notice' ...@@ -9,6 +9,7 @@ import Notice from './pages/Notice/Notice'
import Communicate from './pages/Communicate/Communicate'; import Communicate from './pages/Communicate/Communicate';
import AddressList from './pages/AddressList/AddressList'; import AddressList from './pages/AddressList/AddressList';
import Process from './pages/EventProcessing/Process' import Process from './pages/EventProcessing/Process'
import SubmitDetail from './pages/EventProcessing/SubmitDetail'
import NoFound from './pages/NoFound' import NoFound from './pages/NoFound'
...@@ -30,6 +31,7 @@ const ReactRouter = () => { ...@@ -30,6 +31,7 @@ const ReactRouter = () => {
}/> }/>
<Route path="/blank" component={() => <Route path="/blank" component={() =>
<BlankLayout> <BlankLayout>
<Route path="/blank/submit/:id" component={SubmitDetail}/>
<Route path="/blank/info/:name/:id" component={Process}/> <Route path="/blank/info/:name/:id" component={Process}/>
</BlankLayout> </BlankLayout>
}/> }/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment