未验证 提交 941a061d 编写于 作者: 陈帅 提交者: GitHub

feat: add a demo that jump to details (#3502)

* feat: add a demo that jump to details

* feat: hide progress in coi

* remove trigger config

* remove fetchDepth: 1

* refactor: userinfo and application  from api

* style: fix code style
上级 5ef08f7f
...@@ -7,11 +7,6 @@ name: ant design pro ...@@ -7,11 +7,6 @@ name: ant design pro
trigger: trigger:
- master - master
resources:
repositories:
- repository: self
fetchDepth: 1
jobs: jobs:
- job: lintAndBuild - job: lintAndBuild
...@@ -19,11 +14,15 @@ jobs: ...@@ -19,11 +14,15 @@ jobs:
vmImage: 'Ubuntu-16.04' vmImage: 'Ubuntu-16.04'
steps: steps:
- checkout: self
clean: false
- script: yarn install - script: yarn install
displayName: install displayName: install
- script: npm run lint - script: npm run lint
displayName: lint displayName: lint
- script: npm run build - script: npm run build
env:
PROGRESS: none
displayName: build displayName: build
- job: test - job: test
...@@ -38,6 +37,8 @@ jobs: ...@@ -38,6 +37,8 @@ jobs:
- script: yarn install - script: yarn install
displayName: install displayName: install
- script: npm run test:all - script: npm run test:all
env:
PROGRESS: none
displayName: test displayName: test
- job: Windows - job: Windows
...@@ -52,6 +53,8 @@ jobs: ...@@ -52,6 +53,8 @@ jobs:
- script: npm run lint - script: npm run lint
displayName: lint displayName: lint
- script: npm run build - script: npm run build
env:
PROGRESS: none
displayName: build displayName: build
- job: MacOS - job: MacOS
...@@ -65,5 +68,7 @@ jobs: ...@@ -65,5 +68,7 @@ jobs:
displayName: install displayName: install
- script: npm run lint - script: npm run lint
displayName: lint displayName: lint
- script: npm run build - script: npm run
env:
PROGRESS: none
displayName: build displayName: build
...@@ -147,6 +147,12 @@ export default [ ...@@ -147,6 +147,12 @@ export default [
name: 'basic', name: 'basic',
component: './Profile/BasicProfile', component: './Profile/BasicProfile',
}, },
{
path: '/profile/basic/:id',
name: 'basic',
hideInMenu: true,
component: './Profile/BasicProfile',
},
{ {
path: '/profile/advanced', path: '/profile/advanced',
name: 'advanced', name: 'advanced',
......
import mockjs from 'mockjs';
const basicGoods = [ const basicGoods = [
{ {
id: '1234561', id: '1234561',
...@@ -140,19 +142,36 @@ const advancedOperation3 = [ ...@@ -140,19 +142,36 @@ const advancedOperation3 = [
memo: '-', memo: '-',
}, },
]; ];
const getProfileBasicData = {
basicGoods,
basicProgress,
};
const getProfileAdvancedData = { const getProfileAdvancedData = {
advancedOperation1, advancedOperation1,
advancedOperation2, advancedOperation2,
advancedOperation3, advancedOperation3,
}; };
const { Random } = mockjs;
export default { export default {
'GET /api/profile/advanced': getProfileAdvancedData, 'GET /api/profile/advanced': getProfileAdvancedData,
'GET /api/profile/basic': getProfileBasicData, 'GET /api/profile/basic': (req, res) => {
const { id } = req.query;
const application = {
id,
status: '已取货',
orderNo: Random.id(),
childOrderNo: Random.id(),
};
const userInfo = {
name: Random.cname(),
tel: '18100000000',
delivery: '菜鸟物流',
addr: '浙江省杭州市西湖区万塘路18号',
remark: '备注',
};
res.json({
userInfo,
application,
basicGoods,
basicProgress,
});
},
}; };
import React, { PureComponent, Fragment } from 'react'; import React, { PureComponent, Fragment } from 'react';
import { connect } from 'dva'; import { connect } from 'dva';
import moment from 'moment'; import moment from 'moment';
import router from 'umi/router';
import { import {
Row, Row,
Col, Col,
...@@ -292,6 +293,7 @@ class TableList extends PureComponent { ...@@ -292,6 +293,7 @@ class TableList extends PureComponent {
{ {
title: '规则名称', title: '规则名称',
dataIndex: 'name', dataIndex: 'name',
render: text => <a onClick={() => this.previewItem(text)}>{text}</a>,
}, },
{ {
title: '描述', title: '描述',
...@@ -381,6 +383,10 @@ class TableList extends PureComponent { ...@@ -381,6 +383,10 @@ class TableList extends PureComponent {
}); });
}; };
previewItem = id => {
router.push(`/profile/basic/${id}`);
};
handleFormReset = () => { handleFormReset = () => {
const { form, dispatch } = this.props; const { form, dispatch } = this.props;
form.resetFields(); form.resetFields();
......
...@@ -47,15 +47,18 @@ const progressColumns = [ ...@@ -47,15 +47,18 @@ const progressColumns = [
})) }))
class BasicProfile extends Component { class BasicProfile extends Component {
componentDidMount() { componentDidMount() {
const { dispatch } = this.props; const { dispatch, match } = this.props;
const { params } = match;
dispatch({ dispatch({
type: 'profile/fetchBasic', type: 'profile/fetchBasic',
payload: params.id || '1000000000',
}); });
} }
render() { render() {
const { profile, loading } = this.props; const { profile = {}, loading } = this.props;
const { basicGoods, basicProgress } = profile; const { basicGoods = [], basicProgress = [], userInfo = {}, application = {} } = profile;
let goodsData = []; let goodsData = [];
if (basicGoods.length) { if (basicGoods.length) {
let num = 0; let num = 0;
...@@ -142,21 +145,21 @@ class BasicProfile extends Component { ...@@ -142,21 +145,21 @@ class BasicProfile extends Component {
}, },
]; ];
return ( return (
<PageHeaderWrapper title="基础详情页"> <PageHeaderWrapper title="基础详情页" loading={loading}>
<Card bordered={false}> <Card bordered={false}>
<DescriptionList size="large" title="退款申请" style={{ marginBottom: 32 }}> <DescriptionList size="large" title="退款申请" style={{ marginBottom: 32 }}>
<Description term="取货单号">1000000000</Description> <Description term="取货单号">{application.id}</Description>
<Description term="状态">已取货</Description> <Description term="状态">{application.status}</Description>
<Description term="销售单号">1234123421</Description> <Description term="销售单号">{application.orderNo}</Description>
<Description term="子订单">3214321432</Description> <Description term="子订单">{application.childOrderNo}</Description>
</DescriptionList> </DescriptionList>
<Divider style={{ marginBottom: 32 }} /> <Divider style={{ marginBottom: 32 }} />
<DescriptionList size="large" title="用户信息" style={{ marginBottom: 32 }}> <DescriptionList size="large" title="用户信息" style={{ marginBottom: 32 }}>
<Description term="用户姓名">付小小</Description> <Description term="用户姓名">{userInfo.name}</Description>
<Description term="联系电话">18100000000</Description> <Description term="联系电话">{userInfo.tel}</Description>
<Description term="常用快递">菜鸟仓储</Description> <Description term="常用快递">{userInfo.delivery}</Description>
<Description term="取货地址">浙江省杭州市西湖区万塘路18号</Description> <Description term="取货地址">{userInfo.addr}</Description>
<Description term="备注"></Description> <Description term="备注">{userInfo.remark}</Description>
</DescriptionList> </DescriptionList>
<Divider style={{ marginBottom: 32 }} /> <Divider style={{ marginBottom: 32 }} />
<div className={styles.title}>退货商品</div> <div className={styles.title}>退货商品</div>
......
...@@ -11,8 +11,8 @@ export default { ...@@ -11,8 +11,8 @@ export default {
}, },
effects: { effects: {
*fetchBasic(_, { call, put }) { *fetchBasic({ payload }, { call, put }) {
const response = yield call(queryBasicProfile); const response = yield call(queryBasicProfile, payload);
yield put({ yield put({
type: 'show', type: 'show',
payload: response, payload: response,
......
...@@ -58,8 +58,8 @@ export async function queryTags() { ...@@ -58,8 +58,8 @@ export async function queryTags() {
return request('/api/tags'); return request('/api/tags');
} }
export async function queryBasicProfile() { export async function queryBasicProfile(id) {
return request('/api/profile/basic'); return request(`/api/profile/basic?id=${id}`);
} }
export async function queryAdvancedProfile() { export async function queryAdvancedProfile() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册