Commit 0e869795 by ethanlamzs

init base teams

1 parent 897e8ab8
......@@ -214,7 +214,90 @@ const proxy = {
message:'功能触发成功...'
});
},
'GET /sea/2017':[
{
"_id": "5a1bc1f7bf3ad50d1953818a",
"caption": "Campeonato Brasileiro da S\u00e9rie A",
"currentMatchday": 37,
"id": 444,
"lastUpdated": "2017-11-27T04:20:04Z",
"league": "BSA",
"numberOfGames": 380,
"numberOfMatchdays": 38,
"numberOfTeams": 20,
"year": "2017"
},
{
"_id": "5a1bc1f7bf3ad50d1953818b",
"caption": "Premier League 2017/18",
"currentMatchday": 13,
"id": 445,
"lastUpdated": "2017-11-26T18:10:07Z",
"league": "PL",
"numberOfGames": 380,
"numberOfMatchdays": 38,
"numberOfTeams": 20,
"year": "2017"
},
{
"_id": "5a1bc1f7bf3ad50d1953818c",
"caption": "Championship 2017/18",
"currentMatchday": 19,
"id": 446,
"lastUpdated": "2017-11-26T15:10:12Z",
"league": "ELC",
"numberOfGames": 552,
"numberOfMatchdays": 46,
"numberOfTeams": 24,
"year": "2017"
}],
'GET /teams/444':
{
"pagination":{
"total":1,
"pageSize":4,
"current":1
},
"list":[
{
"_id": "5a1e87aebf3ad5246014a67b",
"key":1,
"league": "PL",
"league_id": 445,
"sc_name": "Arsenal",
"team_id": 57,
"team_name": "Arsenal FC"
},
{
"_id": "5a1e87aebf3ad5246014a67c",
"key":2,
"league": "PL",
"league_id": 445,
"sc_name": "Foxes",
"team_id": 338,
"team_name": "Leicester City FC"
},
{
"_id": "5a1e87aebf3ad5246014a67d",
"key":3,
"league": "PL",
"league_id": 445,
"sc_name": "Watford",
"team_id": 346,
"team_name": "Watford FC"
},
{
"_id": "5a1e87aebf3ad5246014a67e",
"key":4,
"league": "PL",
"league_id": 445,
"sc_name": "Liverpool",
"team_id": 64,
"team_name": "Liverpool FC"
}
],
},
};
//export default noProxy ? { "GET /*": "http://www.weixiao100.cn/","POST /*": "http://www.weixiao100.cn/" } : delay(proxy, 1000);
export default noProxy ? { "GET /*": "http://127.0.0.1:8091/","POST /*": "http://127.0.0.1:8091/" } : delay(proxy, 1000);
\ No newline at end of file
export default noProxy ? { "GET /*": "http://127.0.0.1:5000/","POST /*": "http://127.0.0.1:5000/" } : delay(proxy, 1000);
\ No newline at end of file
......@@ -16,7 +16,7 @@
"html": {
"template": "./src/index.ejs"
},
"publicPath": "./",
"publicPath": "/",
"disableDynamicImport": true,
"hash": true
}
......@@ -120,14 +120,14 @@ const menuData = [{
path: 'register-result',
}],
hideInMenu: true,
},
},
{
name: '维护',
name: 'fb',
icon: 'table',
path: 'devutil',
path: 'fb',
children: [{
name: '企业号',
path: 'schoollist',
name: 'teams',
path: 'teams',
}],
}
,{
......
......@@ -159,11 +159,8 @@ export const getRouterData = (app) => {
'/user/register-result': {
component: dynamicWrapper(app, [], () => import('../routes/User/RegisterResult')),
},
'/devutil/schoollist': {
component: dynamicWrapper(app, ['schools','areas'], () => import('../routes/devutil/schoollist')),
},
'/devutil/schoolmgr/:schcode': {
component: dynamicWrapper(app, ['linkman','wxdata'], () => import('../routes/devutil/schoolmgr')),
'/fb/teams': {
component: dynamicWrapper(app, ['fb'], () => import('../routes/fb/teams')),
},
// '/user/:id': {
// component: dynamicWrapper(app, [], () => import('../routes/User/SomeComponent')),
......
......@@ -102,7 +102,7 @@ class BasicLayout extends React.PureComponent {
// According to the url parameter to redirect
// 这里是重定向的,重定向到 url 的 redirect 参数所示地址
const urlParams = new URL(window.location.href);
const redirect = urlParams.searchParams.get('redirect') || '/devutil/schoollist';
const redirect = urlParams.searchParams.get('redirect') || '/fb/teams';
// Remove the parameters in the url
urlParams.searchParams.delete('redirect');
window.history.pushState(null, 'redirect', urlParams.href);
......
import { qryTeams,qrySeasons } from '../services/fb'
export default{
namespace: 'fb',
state : {
seasons:[],
teams:{
pagination:{},
list:[]
}
},
effects:{
*seasons({payload},{call,put}){
const response = yield call(qrySeasons,payload);
yield put({
type : 'querySeasons',
payload: Array.isArray(response) ? response : [],
});
},
*teams({payload},{call,put}){
const response = yield call(qryTeams,payload);
yield put({
type : 'queryTeams',
payload: Array.isArray(response.list) ? response : [],
});
},
},
reducers:{
querySeasons(state,action){
return {
...state,
seasons:action.payload,
};
},
queryTeams(state,action){
return {
...state,
teams:action.payload,
};
},
},
}
\ No newline at end of file
import React, { PureComponent, Fragment } from 'react';
import { connect } from 'dva';
import { Link } from 'dva/router';
import { Row, Col, Card, Form, Input, Select, Icon, Button, Dropdown, Menu, InputNumber, DatePicker, Modal, message } from 'antd';
import { Table, Alert, Badge, Divider } from 'antd';
import StandardTable from '../../components/StandardTableM';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import styles from './teams.less';
import moment from 'moment';
const FormItem = Form.Item;
const { Option } = Select;
const getValue = obj => Object.keys(obj).map(key => obj[key]).join(',');
@connect(({ fb, loading }) => ({
fb,
loading: loading.models.schools,
}))
@Form.create()
export default class schoollist extends PureComponent {
state = {
addInputValue: '',
selectedRows: [],
formValues: {},
};
componentDidMount() {
const { dispatch } = this.props;
dispatch({
type: 'fb/seasons',
payload:2017,
});
}
handleStandardTableChange = (pagination, filtersArg, sorter) => {
const { dispatch } = this.props;
const { formValues } = this.state;
const filters = Object.keys(filtersArg).reduce((obj, key) => {
const newObj = { ...obj };
newObj[key] = getValue(filtersArg[key]);
return newObj;
}, {});
const params = {
currentPage: pagination.current,
pageSize: pagination.pageSize,
...formValues,
...filters,
};
if (sorter.field) {
params.sorter = `${sorter.field}_${sorter.order}`;
}
dispatch({
type: 'fb/teams',
payload: params,
});
}
handleFormReset = () => {
const { form, dispatch } = this.props;
form.resetFields();
this.setState({
formValues: {},
});
dispatch({
type: 'fb/teams',
payload: {},
});
}
toggleForm = () => {
this.setState({
expandForm: !this.state.expandForm,
});
}
handleMenuClick = (e) => {
}
handleSelectRows = (rows) => {
}
handleSearch = (e) => {
e.preventDefault();
const { dispatch, form } = this.props;
form.validateFields((err, fieldsValue) => {
if (err) return;
const values = {
...fieldsValue,
updatedAt: fieldsValue.updatedAt && fieldsValue.updatedAt.valueOf(),
};
this.setState({
formValues: values,
});
dispatch({
type: 'fb/teams',
payload: values,
});
});
}
//地区信息的排序控制
leaguesort = (a,b) =>( a.league<b.league ? -1:1)
//加载地区属性的下来选择项目
renderSellectOption=(datas)=>{
return datas.map((item)=>{
return <Option key={`option_${item.id}`} value={item.id}>{item.league}</Option>
});
}
renderSimpleForm() {
const { getFieldDecorator } = this.props.form;
console.log(this.props);
const { fb:{seasons}} = this.props;
let seasons_SellectOption = (seasons==null || seasons==undefined)?[]:seasons;
return (
<Form onSubmit={this.handleSearch} layout="inline">
<Row gutter={{ md: 8, lg: 24, xl: 48 }}>
<Col md={8} sm={24}>
<FormItem label="联赛">
{getFieldDecorator('league_id')(
<Select placeholder="非精确查询" style={{ width: '100%' }}>
{this.renderSellectOption(seasons_SellectOption.sort(this.leaguesort))}
</Select>
)}
</FormItem>
</Col>
<Col md={8} sm={24}>
<span className={styles.submitButtons}>
<Button type="primary" htmlType="submit">查询</Button>
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>重置</Button>
</span>
</Col>
</Row>
</Form>
);
}
renderForm() {
return this.renderSimpleForm();
}
render() {
const { fb: {teams}, loading } = this.props;
const { selectedRows, modalVisible, addInputValue } = this.state;
console.log(this.props);
const columns = [
{
title: '球队名称',
dataIndex: 'team_name',
},
{
title: 'team_id',
dataIndex: 'key',
},
{
title:'sc_name',
dataIndex : 'sc_name',
render:val => <span> {val} </span>,
},
{
title: '操作',
dataIndex: 'team_id',
render: (val) => (
<Fragment>
<Divider type="vertical" />
<Link to={`/devutil/schoolmgr/${val}`} className={styles.logo} key="logo">
<span>查看</span>
</Link>
</Fragment>
),
},
];
const menu = (
<Menu onClick={this.handleMenuClick} selectedKeys={[]}>
<Menu.Item key="remove">删除</Menu.Item>
<Menu.Item key="approval">批量审批</Menu.Item>
</Menu>
);
return (
<PageHeaderLayout title="查询球队">
<Card bordered={false}>
<div className={styles.tableList}>
<div className={styles.tableListForm}>
{this.renderForm()}
</div>
<div className={styles.tableListOperator}>
{
selectedRows.length > 0 && (
<span>
<Button>批量操作</Button>
<Dropdown overlay={menu}>
<Button>
更多操作 <Icon type="down" />
</Button>
</Dropdown>
</span>
)
}
</div>
<StandardTable
selectedRows={selectedRows}
loading={loading}
data={teams}
columns={columns}
onSelectRow={this.handleSelectRows}
onChange={this.handleStandardTableChange}
/>
</div>
</Card>
</PageHeaderLayout>
);
}
}
@import "~antd/lib/style/themes/default.less";
@import "../../utils/utils.less";
.tableList {
.tableListOperator {
margin-bottom: 16px;
button {
margin-right: 8px;
}
}
}
.tableListForm {
:global {
.ant-form-item {
margin-bottom: 24px;
margin-right: 0;
display: flex;
> .ant-form-item-label {
width: auto;
line-height: 32px;
padding-right: 8px;
}
.ant-form-item-control {
line-height: 32px;
}
}
.ant-form-item-control-wrapper {
flex: 1;
}
}
.submitButtons {
white-space: nowrap;
margin-bottom: 24px;
}
}
@media screen and (max-width: @screen-lg) {
.tableListForm :global(.ant-form-item) {
margin-right: 24px;
}
}
@media screen and (max-width: @screen-md) {
.tableListForm :global(.ant-form-item) {
margin-right: 8px;
}
}
import { stringify } from 'qs';
import request from '../utils/request';
export async function qrySeasons(params) {
return request('/sea/'+params);
}
export async function qryTeams(params){
return request('/teams/'+params.league_id);
}
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!