Commit 4a38f03d authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

merge

parents 1c81ff7b 9c215002
This diff is collapsed.
......@@ -80,6 +80,8 @@ const LogisticsRoute = {
name: 'orderSubmitSearchList',
component: '@/pages/logistics/logisticsSubmit/orderSearchList',
},
//物流详情页 查看的
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitDeatil',
name: 'orderSubmitDeatil',
......@@ -90,6 +92,14 @@ const LogisticsRoute = {
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList',
name: 'toOrderSumitList',
component: '@/pages/logistics/logisticsSubmit/toOrderSumitList',
},
//待提交详情页 新增和修改的
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSubmitDetail',
name: 'toOrderSubmitDetail',
component: '@/pages/logistics/logisticsSubmit/toOrderSubmitDetail',
hideInMenu: true
}
......
......@@ -3,11 +3,10 @@
"scripts": {
"api": "god-ytt",
"scripts:build": "node scripts/run",
"start:dev":"umi dev",
"start:dev": "umi dev",
"start:analyze": "ANALYZE=1 umi dev",
"clean": "rimraf node_modules",
"start": "yarn scripts:build && umi dev",
"start:dev": "umi dev",
"build": "umi build",
"build:analyze": "ANALYZE=1 umi build",
"postinstall": "umi generate tmp",
......@@ -32,7 +31,7 @@
"@umijs/preset-react": "1.x",
"@umijs/test": "^3.2.0",
"bizcharts": "^4.0.7",
"god": "^0.1.13",
"god": "0.1.15",
"lint-staged": "^10.0.7",
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
......
......@@ -7,5 +7,6 @@ export const PATTERN_MAPS = {
password: /^(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{8,20}$/,
email: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/,
phone: /^1[3|4|5|6|7|8|9][0-9]{9}$/,
smsCode: /^\d{6}$/
smsCode: /^\d{6}$/,
money:/^\d*(?:\.\d{0,2})?$/
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-13 14:08:50
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-27 11:29:16
* @LastEditTime: 2020-07-28 11:31:13
*/
export default {
......@@ -80,6 +80,7 @@ export default {
'menu.logisticsAbility.logisticsSubmit.orderSubmitSearchList': '物流单查询',
'menu.logisticsAbility.logisticsSubmit.orderSubmitDeatil': '物流单详情',
'menu.logisticsAbility.logisticsSubmit.toOrderSumitList': '待提交物流单',
'menu.logisticsAbility.logisticsSubmit.toOrderSubmitDetail': '新建物流单',
'menu.logisticsAbility.logisticsResult': '物流单处理',
'menu.logisticsAbility.logisticsResult.orderResultSearchList': '物流单查询',
......
@import "../../member/components/index.less";
.count{
font-size: 24px;
color: #172B4D;
font-weight: 500;
}
.add-btn{
margin-bottom: 24px;
padding: 6px 0;
text-align: center;
background: #FAFBFC;
}
.alignCenter{
text-align: center;
}
.alignLeft{
text-align: left;
}
.hidden{
display: none;
}
.block{
display: block;
}
......@@ -14,8 +33,6 @@
}
.select {
width : 160px;
margin: 0 16px 16px 0;
&:nth-last-of-type(1) {
margin-right: 0;
}
......
import React, { Component, useState, useEffect,useRef } from 'react';
import { Modal, Button, Form,Row,Col,Tooltip,Input,Select } from 'antd'
import {UpOutlined, DownOutlined} from '@ant-design/icons'
import {StandardTable} from 'god'
import { ColumnType,TableRowSelection} from 'antd/lib/table/interface'
import style from '../components/index.less'
import { PublicApi} from '@/services/api'
let {Option} = Select
export interface Params {
title: string;
type: number,
columns: Array<any>;
dialogVisible: boolean;
onCancel: Function;
dontReceive?: boolean; //默认展示
}
interface Item {
key: string;
}
interface filterItem{
name?: string;
brandName?:string;
customerCategory?:string,
status?: any
}
const listDialog: React.FC<Params> = (props) => {
const ref = useRef({})
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
let [isSearch, setIsSearch] = useState(false)
let [filterParams, setfilterParams] = useState<filterItem>({
name:'',
})
const [searchForm, setSearchForm] = useState({
searName: '',
buyer:'',//收货商
dateSelect: '',
outSideStatus: '',
TimeRange: ''
})
const TimeList = [
{
label:'单据时间(全部)',value: ''
},
{
label:'今天',value:1
},
{
label:'一周内',value:2
},
{
label:'一个月内',value:3
},
{
label:'三个月内',value:4
},
{
label:'六个月内',value:5
},
{
label:'一年内',value: 6
},
{
label:'一年前',value: 7
}
]
const outSideStatusList = [
{
label:'外部状态(全部)',value: ''
},
{
label:'待提交',value: 1
},
{
label:'待确认',value: 2
},
{
label:'接受物流单',value: 3
},
{
label:'不接受物流单',value: 4
}
]
const handleCancel = () => {
}
const handletOk = (values:any) => {
console.log(values)
props.onCancel()
}
const data = [
{
id:'123',
key:'123',
name:'1231',
}
]
const fetchData = (params:any) => {
if(props.type === 3){
return new Promise((resolve,reject) => {
PublicApi.getProductCommodityGetCommodityList({...params}).then(res => {
resolve(res.data)
})
})
}
// return new Promise((resolve, reject) => {
// const queryResult = data.find(v => v.key === params.keywords)
// setTimeout(() => {
// resolve({
// code: 200,
// message: '',
// data: queryResult ? [queryResult] : data
// })
// }, 1000)
// })
}
useEffect(() => {
return () => {
}
}, [])
const Reset = () => {
}
const handleSearch = () => {
}
const handleReset = () => {
for (let key in searchForm) {
searchForm[key] = ''
}
setSearchForm({ ...searchForm })
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
}
}
return (
<>
<Modal
title={props.title}
width={960}
visible={props.dialogVisible}
onOk={handletOk}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => Reset()}
okText='确定'
cancelText='取消'
>
<StandardTable
tableProps={{ rowKey: 'id' }}
columns={props.columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<>
<Row>
<Col span={24}>
{
//选择订单
props.type === 1 &&
<Select
style={{
marginRight:'16px'
}}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>单据来源:订单</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
}
{
//选择商品
props.type === 3 &&
<Select
style={{
marginRight:'16px'
}}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>来源:发货单</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
}
<Tooltip trigger={['focus']} placement='top'
title={props.type === 1? '输入物流单号、订单号进行搜索':'输入物流单号、发货方进行搜索' }>
<Input.Search
style={{ width: '232px' }}
value={searchForm.searName}
placeholder='搜索'
onChange={(e) => setSearchForm({ ...searchForm, searName: e.target.value })}
onSearch={() => handleSearch}
/>
</Tooltip>
<Button className={style['filter-btn']} onClick={() => setIsSearch(isSearch = !isSearch) }>
高级筛选{isSearch ? <UpOutlined /> : <DownOutlined />}
</Button>
<Button className={style.selectBtn} onClick={() => handleReset()}>重置</Button>
</Col>
</Row>
<Row style={{margin: '16px 0'}}>
{
isSearch &&
<Col>
{
props.type === 1?
<Select
className={style.select}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>物流服务商(全部)</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
:
<Select
className={style.select}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>发货方(全部)</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
}
<Select
className={style.select}
value={searchForm.TimeRange}
onChange={(val) => setSearchForm({ ...searchForm, TimeRange: val })}
>
{
TimeList.map((item) => {
return <Option value={item.value}>{item.label}</Option>
})
}
</Select>
<Select
className={style.select}
value={searchForm.outSideStatus}
onChange={(val) => setSearchForm({ ...searchForm, outSideStatus: val })}
>
{
outSideStatusList.map((item) => {
return <Option value={item.value}>{item.label}</Option>
})
}
</Select>
</Col>
}
</Row>
</>
}
/>
</Modal>
</>
)
}
listDialog.defaultProps = {
dontReceive: true
}
export default listDialog
\ No newline at end of file
/*
* @Date: 2020-07-13 15:01:40
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-27 11:38:38
* @LastEditTime: 2020-07-30 10:06:44
*/
import React, { ReactNode, useRef } from 'react'
......@@ -73,7 +73,7 @@ const Company: React.FC<{}> = () => {
dataIndex: 'name',
align: 'center',
key: 'name',
render: (text: any, record: any) => <span className="commonPickColor">{text}&nbsp;<EyeOutlined /></span>
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record.id)}>{text}&nbsp;<EyeOutlined /></span>
},
{
title: '合作类型',
......@@ -126,7 +126,6 @@ const Company: React.FC<{}> = () => {
</Popconfirm>
</>
:''}
<Button type='link' onClick={() => handleSee(record.id)}>查看</Button>
</>
)
}
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-24 10:58:55
* @LastEditTime: 2020-07-29 20:37:05
*/
import React, { Component, ReactNode, useRef, useState } from 'react'
import { history } from 'umi'
......@@ -190,6 +190,8 @@ const AddressList: React.FC<ListProps> = (props) => {
// 模拟请求
const fetchData = (params: any) => {
console.log(params);
return new Promise((resolve, reject) => {
if (props.type === '1') {//发货
PublicApi.getLogisticsShipperAddressPage({ current: params.page, pageSize: params.rows }).then(res => {
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-27 19:11:21
* @LastEditTime: 2020-07-28 14:01:19
*/
import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom'
......@@ -63,25 +63,6 @@ const actions = createFormActions()
const { ON_FORM_SUBMIT } = LifeCycleTypes //拿到Form提交API
const onFormSubmit$ = FormEffectHooks
const { Option } = ISelect;
const children: any = [];
for (let i = 10; i < 36; i++) {
children.push(<Option value={i} key={i.toString(36) + i}>{i.toString(36) + i}</Option>);
}
const dropdownRender = () => {
return (
<div>12</div>
)
}
// const CustomSelect = (props: any) => {
// return (
// <ISelect showArrow style={{ width: '100%' }} dropdownRender={dropdownRender}
// placeholder="Tags Mode" onChange={value => props.onChange(value)}>
// {/* {children} */}
// </ISelect>
// )
// }
// registerFormFields({ prefixSelect: connect()(CustomSelect) })
const diaLogForm: React.FC<ListProps> = (props) => {
const [provinceList, setProvinceList] = useState([])
const [editable, setEditable] = useState<boolean>(true)
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-27 17:32:33
* @LastEditTime: 2020-07-29 15:55:43
*/
import React, { Component, ReactNode, useRef, useState } from 'react'
import { history } from 'umi'
......@@ -358,34 +358,6 @@ const fetchData = (params: any) => {
{
isSearch &&
<Col>
{
props.type === '1'?
<Select
className={style.select}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>物流服务商(全部)</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
:
<Select
className={style.select}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>发货方(全部)</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
}
<Select
className={style.select}
value={searchForm.TimeRange}
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-27 20:28:06
* @LastEditTime: 2020-07-29 15:52:03
*/
import React, { Component, ReactNode, useRef, useState } from 'react'
import { history } from 'umi'
......@@ -254,7 +254,7 @@ const OrderList: React.FC<ListProps> = (props) => {
</> : ''
}
<Button type='link'>提交</Button>
<Button type='link'>查看</Button>
<Button type='link' onClick={() => handleSee(record.id)}>查看</Button>
</>
)
}
......@@ -293,8 +293,8 @@ const OrderList: React.FC<ListProps> = (props) => {
const handleDelete = () => {
console.log('delete')
}
const handleSee = (record: any) => {
console.log('see')
const handleSee = (id: number) => {
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitDeatil?id=${id}`)
}
const confirm = () => {
......@@ -339,7 +339,7 @@ const OrderList: React.FC<ListProps> = (props) => {
<Button
type="primary"
onClick={() =>
history.push('')
history.push('/memberCenter/logisticsAbility/logisticsSubmit/toOrderSubmitDetail?id=0')
}
>
<PlusOutlined />
......@@ -351,7 +351,7 @@ const OrderList: React.FC<ListProps> = (props) => {
style={{textAlign:'right'}}
>
<Tooltip trigger={['focus']} placement='top'
title={props.type === '1' ? '输入物流单号、订单号进行搜索' : '输入物流单号、发货方进行搜索'}>
title='输入物流单号、订单号进行搜索'>
<Input.Search
style={{ width: '232px' }}
value={searchForm.searName}
......@@ -372,34 +372,16 @@ const OrderList: React.FC<ListProps> = (props) => {
span={22}
>
{
props.type === '1' ?
<Select
className={style.select}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>物流服务商(全部)</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
:
<Select
className={style.select}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>发货方(全部)</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
}
<Select
className={style.select}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>物流服务商(全部)</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
<Select
className={style.select}
value={searchForm.TimeRange}
......
......@@ -420,6 +420,7 @@ const auditDetail: React.FC<ItemProps> = props => {
<StandardTable
tableProps={{
pagination: false,
rowKey: 'id',
}}
columns={columns}
currentRef={ref}
......@@ -432,6 +433,7 @@ const auditDetail: React.FC<ItemProps> = props => {
<StandardTable
tableProps={{
pagination: false,
rowKey: 'id',
}}
columns={columns}
currentRef={ref}
......
......@@ -221,7 +221,10 @@ const auditList: React.FC<PageProps> = props => {
dataIndex: 'status',
align: 'center',
key: 'status',
sorter: true,
filters: [
{ text: '123', value: '123' },
{ text: '456', value: '456' },
],
render: (text: any, record: any) => {
let component: ReactNode = null;
component = (
......@@ -241,7 +244,10 @@ const auditList: React.FC<PageProps> = props => {
dataIndex: 'outSideStatus',
align: 'center',
key: 'outSideStatus',
sorter: true,
filters: [
{ text: '123', value: '123' },
{ text: '456', value: '456' },
],
render: (text: any, record: any) => {
let component: ReactNode = null;
component = (
......@@ -269,7 +275,10 @@ const auditList: React.FC<PageProps> = props => {
dataIndex: 'inSideStatus',
align: 'center',
key: 'inSideStatus',
sorter: true,
filters: [
{ text: '123', value: '123' },
{ text: '456', value: '456' },
],
render: (text: any, record: any) => {
let component: ReactNode = null;
component = (
......@@ -328,6 +337,7 @@ const auditList: React.FC<PageProps> = props => {
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectedRowKeys(selectedRowKeys);
console.log(
`selectedRowKeys: ${selectedRowKeys}`,
'selectedRows: ',
......
......@@ -17,14 +17,6 @@ const actions = createFormActions();
const addMember: React.FC<any> = props => {
const ref = useRef({});
const [actived, setActived] = useState('-1');
const [tabCount, setTabCount] = useState({
'1': 0,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
});
const [editable, setEditable] = useState(
props.location.query.type != 'check',
);
......@@ -167,7 +159,13 @@ const addMember: React.FC<any> = props => {
<>
<div className={style.headerTop}>
<span>返回</span>
<span>新建会员</span>
<span>
{props.location.query.type === 'add'
? '新建会员'
: props.location.query.type === 'change'
? '编辑会员'
: '查看会员'}
</span>
</div>
</>
}
......
......@@ -80,36 +80,6 @@ const memberImport: React.FC<{}> = () => {
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]);
const onClick = ({ key }) => {
if (key === '1') {
console.log('删除');
} else {
console.log('查看');
}
};
const moreMenu = (
<Menu onClick={onClick}>
<Menu.Item key="1">
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否">
<Button type="link">删除</Button>
</Popconfirm>
</Menu.Item>
<Menu.Item key="2">
<Button
type="link"
onClick={() =>
history.push(
'/memberCenter/memberAbility/manage/addMember?type=check',
)
}
>
查看
</Button>
</Menu.Item>
</Menu>
);
const columns: ColumnType<any>[] = [
{
title: 'ID',
......@@ -127,7 +97,9 @@ const memberImport: React.FC<{}> = () => {
<div className={style.nameCell}>
<div
className={style.nameCellTitle}
onClick={() => handleSee(record)}
onClick={() =>
history.push('/memberCenter/memberAbility/manage/addMember?type=check')
}
>
{text}&nbsp;
<EyeOutlined />
......@@ -160,12 +132,20 @@ const memberImport: React.FC<{}> = () => {
title: '会员状态',
dataIndex: 'status',
align: 'center',
filters: [
{ text: 'Male', value: 'male' },
{ text: 'Female', value: 'female' },
],
key: 'status',
},
{
title: '外部状态',
dataIndex: 'externalStatus',
align: 'center',
filters: [
{ text: 'Male', value: 'male' },
{ text: 'Female', value: 'female' },
],
key: 'externalStatus',
},
{
......@@ -179,19 +159,14 @@ const memberImport: React.FC<{}> = () => {
<Button
type="link"
onClick={() =>
history.push(
'/memberCenter/memberAbility/manage/addMember?type=change',
)
history.push('/memberCenter/memberAbility/manage/addMember?type=change')
}
>
编辑
</Button>
<Dropdown overlay={moreMenu} trigger={['click']}>
<Button type="link" onClick={e => e.preventDefault()}>
更多
<DownOutlined />
</Button>
</Dropdown>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否">
<Button type="link">删除</Button>
</Popconfirm>
</>
);
},
......@@ -225,6 +200,10 @@ const memberImport: React.FC<{}> = () => {
});
};
const handleTableChange = (filters: any) => {
console.log(filters);
};
const handleSee = (record: any) => {};
const handleSearch = () => {
......@@ -251,15 +230,14 @@ const memberImport: React.FC<{}> = () => {
currentRef={ref}
rowSelection={rowSelection}
fetchTableData={(params: any) => fetchData(params)}
onChange={handleTableChange}
controlRender={
<Row>
<Col className={style.col} span={8}>
<Button
type="primary"
onClick={() =>
history.push(
'/memberCenter/memberAbility/manage/addMember?type=add',
)
history.push('/memberCenter/memberAbility/manage/addMember?type=add')
}
>
<PlusOutlined />
......
This diff is collapsed.
......@@ -32,21 +32,30 @@
}
.col {
margin : 0 16px 16px 0;
margin-bottom: 16px;
&-open {
color : #fff;
background-color: #6B778C;
}
&-close {
color : #595959;
background-color: #fff;
&:nth-last-of-type(1) {
text-align: right;
}
}
.selectBtn {
margin: 0 16px;
.subRow {
width: 100%;
.subCol {
width : 100%;
text-align: right;
.select {
width : 160px;
margin : 0 0 16px 16px;
text-align: left;
&:nth-of-type(1) {
margin-left: 0;
}
}
}
}
.select {
......@@ -56,4 +65,35 @@
&:nth-last-of-type(1) {
margin-right: 0;
}
}
.headerTop {
display : flex;
align-items: center;
span {
font-size : 14px;
font-weight: 400;
&:nth-last-of-type(1) {
font-size : 20px;
font-weight: 500;
color : #172B4D;
margin-left: 16px;
}
}
}
.saveBtn {
color : #fff;
background: @main-color
}
.required {
display : inline-block;
margin-right: 4px;
color : #ff4d4f;
font-size : 14px;
font-family : SimSun, sans-serif;
line-height : 1;
}
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
import moment from 'moment';
function isArray(arr: any) {
return Array.isArray(arr)
......@@ -7,8 +8,104 @@ function isObject(obj: any) {
return Object.prototype.toString.call(obj) === '[object Object]'
}
export function timeRange(val: number) {
let st, et;
switch (val) {
case 0:
st = et = '';
break;
case 1:
st = moment(
moment()
.startOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 2:
st = moment(
moment()
.subtract(7, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 3:
st = moment(
moment()
.subtract(29, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 4:
st = moment(
moment()
.subtract(89, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 5:
st = moment(
moment()
.subtract(179, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 6:
st = moment(
moment()
.subtract(364, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 7:
st = moment(
moment()
.year(moment().year() - 1)
.startOf('year')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
et = moment(
moment()
.year(moment().year() - 1)
.endOf('year')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
}
return { st, et }
}
export function omit(obj: any, arr: string[]) {
const tempObj = {...obj}
const tempObj = { ...obj }
for (let i = 0; i < arr.length; i++) {
delete tempObj[arr[i]]
}
......
......@@ -34,7 +34,7 @@ const errorMessage: httpStatus = {
504: "网关超时。",
};
const errorHandler = (error: ResponseError):IRequestError => {
const errorHandler = (error: ResponseError): IRequestError => {
const { response } = error
// http状态码非200的错误处理
const messageText = errorMessage[response.status]
......@@ -63,7 +63,7 @@ const baseRequest = extend({
});
// 请求拦截器
baseRequest.interceptors.request.use((url: string, options: RequestOptionsInit):{ url: string, options: RequestOptionsInit } => {
baseRequest.interceptors.request.use((url: string, options: RequestOptionsInit): { url: string, options: RequestOptionsInit } => {
return {
// 前缀如果已经带上api, 跳过自动补前缀
url: url.startsWith('/api') ? url : basePrefix + url,
......@@ -86,7 +86,7 @@ baseRequest.use(async (ctx: Context, next: () => void) => {
*/
class ApiRequest {
createRequest <T>(url: string, options: IApiRequest = { ctlType: 'none' }): Promise<IRequestSuccess<T>> {
createRequest<T>(url: string, options: IApiRequest = { ctlType: 'none' }): Promise<IRequestSuccess<T>> {
return new Promise((resolve, reject) => {
baseRequest<IRequestSuccess<T>>(url, options).then(res => {
if (res.code === 1000) {
......
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