From ecc5cf8887fcee426d88b65252ae1bc403891947 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Sun, 17 Mar 2019 22:50:04 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=89=8D=E7=AB=AF=EF=BC=9A=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=B7=BB=E5=8A=A0=E3=80=82=E6=8F=90=E4=BA=A4=E9=83=A8?= =?UTF-8?q?=E5=88=86=EF=BC=8C=E8=AE=A9=E5=B0=8F=E8=8C=83=E5=B8=AE=E5=BF=99?= =?UTF-8?q?=E7=9C=8B=E7=9C=8B~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/product/productSpuAddOrUpdate.js | 23 +++++++-- .../pages/Product/ProductSpuAddOrUpdate.js | 50 ++++++++++++++----- 2 files changed, 57 insertions(+), 16 deletions(-) diff --git a/admin-web/src/models/product/productSpuAddOrUpdate.js b/admin-web/src/models/product/productSpuAddOrUpdate.js index af7409534..f457e333c 100644 --- a/admin-web/src/models/product/productSpuAddOrUpdate.js +++ b/admin-web/src/models/product/productSpuAddOrUpdate.js @@ -6,9 +6,7 @@ export default { state: { list: [], - attrTree: [{ - - } + attrTree: [ // { // id: // // name: // @@ -73,17 +71,34 @@ export default { }, }); }, + *selectAttr({ payload }, { call, put }) { + // const { queryParams } = payload; + // const response = yield call(productCategoryTree, queryParams); + message.info('调试:添加规格成功!'); + yield put({ + type: 'selectAttrSuccess', + payload: payload, + }); + }, }, reducers: { addAttrSuccess(state, {payload}) { // debugger; - console.log(state.attrTree); + // console.log(state.attrTree); state.attrTree.push(payload.attrAdd); return { ...state } }, + selectAttrSuccess(state, {payload}) { + // debugger; + // console.log(state.attrTree); + state.attrTree[payload.attrIndex] = payload.attr; + return { + ...state + } + }, treeSuccess(state, { payload }) { return { ...state, diff --git a/admin-web/src/pages/Product/ProductSpuAddOrUpdate.js b/admin-web/src/pages/Product/ProductSpuAddOrUpdate.js index 77bf53911..7308e0474 100644 --- a/admin-web/src/pages/Product/ProductSpuAddOrUpdate.js +++ b/admin-web/src/pages/Product/ProductSpuAddOrUpdate.js @@ -1,6 +1,6 @@ /* eslint-disable */ -import React, { PureComponent, Fragment } from 'react'; +import React, {PureComponent, Fragment, Component} from 'react'; import { connect } from 'dva'; import moment from 'moment'; import {Card, Form, Input, Radio, Button, Table, Select} from 'antd'; @@ -16,12 +16,14 @@ const Option = Select.Option; @connect(({ productSpuList, productAttrList, productSpuAddOrUpdate, loading }) => ({ // list: productSpuList.list.spus, // loading: loading.models.productSpuList, + productAttrList, + productSpuAddOrUpdate, allAttrTree: productAttrList.tree, attrTree: productSpuAddOrUpdate.attrTree })) @Form.create() -class ProductSpuAddOrUpdate extends PureComponent { +class ProductSpuAddOrUpdate extends Component { state = { modalVisible: false, modalType: 'add', //add update @@ -65,9 +67,30 @@ class ProductSpuAddOrUpdate extends PureComponent { }); } + handleSelectAttr = (value, option) => { + console.log(value); + console.log(option); + debugger; + const { dispatch } = this.props; + let attrIndex = option.key.substring(option.key.indexOf('option-attr-') + 'option-attr-'.length, option.key.lastIndexOf('-')); + console.log('attrIndex: ' + attrIndex); + debugger; + dispatch({ + type: 'productSpuAddOrUpdate/selectAttr', + payload: { + attrIndex: attrIndex, + attr: { + id: option.props.value, + name: option.props.children, + } + }, + }); + } + render() { // debugger; - const { form, data, attrTree } = this.props; + const { form, data, attrTree, allAttrTree } = this.props; + const that = this; // 规格明细 const columns = [ @@ -94,19 +117,22 @@ class ProductSpuAddOrUpdate extends PureComponent { if (attrTree && attrTree.length > 0) { for (let i in attrTree) { let attr = attrTree[i]; - attr =
- + {options}
; attrTreeHTML.push(attr); - // debugger; } } From 92b5f6baff9495b89d01133960f6d99f217b7866 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Mon, 18 Mar 2019 19:05:43 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=89=8D=E7=AB=AF=EF=BC=9A=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=B7=BB=E5=8A=A0=E3=80=82=E6=8F=90=E4=BA=A4=E9=83=A8?= =?UTF-8?q?=E5=88=86=EF=BC=8C=E8=AE=A9=E5=B0=8F=E8=8C=83=E5=B8=AE=E5=BF=99?= =?UTF-8?q?=E7=9C=8B=E7=9C=8B~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Product/ProductAttrSelectFormItem.js | 101 ++++++++ .../Product/ProductSkuAddOrUpdateTable.js | 85 ++++++ admin-web/src/locales/zh-CN/menu.js | 5 + .../models/product/productSpuAddOrUpdate.js | 106 +++++++- .../pages/Product/ProductSpuAddOrUpdate.js | 245 ++++++++++++------ admin-web/src/services/product.js | 7 + .../admins/AdminsProductSpuController.java | 2 +- 7 files changed, 474 insertions(+), 77 deletions(-) create mode 100644 admin-web/src/components/Product/ProductAttrSelectFormItem.js create mode 100644 admin-web/src/components/Product/ProductSkuAddOrUpdateTable.js diff --git a/admin-web/src/components/Product/ProductAttrSelectFormItem.js b/admin-web/src/components/Product/ProductAttrSelectFormItem.js new file mode 100644 index 000000000..3c019d940 --- /dev/null +++ b/admin-web/src/components/Product/ProductAttrSelectFormItem.js @@ -0,0 +1,101 @@ +import React, {PureComponent} from "react"; +import {Select} from "antd"; + +const Option = Select.Option; + +export default class ProductAttrSelectFormItem extends PureComponent { + + handleSelectAttr = (value, option) => { + // console.log(value); + // console.log(option); + // debugger; + const { dispatch, index } = this.props; + // let attrIndex = option.key.substring(option.key.indexOf('option-attr-') + 'option-attr-'.length, option.key.lastIndexOf('-')); + // console.log('attrIndex: ' + attrIndex); + // debugger; + dispatch({ + type: 'productSpuAddOrUpdate/selectAttr', + payload: { + attrIndex: index, + attr: { + id: option.props.value, + name: option.props.children, + values: [] + } + }, + }); + } + + handleSelectAttrValue = (values, options) => { + let attrValues = []; + const { dispatch, index } = this.props; + // debugger; + // console.log('x' + this.children[0]); + // let firstOption = this.children[0]; + // let attrIndex = firstOption.key.substring(firstOption.key.indexOf('option-attr-value-') + 'option-attr-value-'.length, firstOption.key.lastIndexOf('-')); + for (let i in options) { + let option = options[i]; + attrValues.push({ + id: parseInt(option.props.value), + name: option.props.children, + }); + } + dispatch({ + type: 'productSpuAddOrUpdate/selectAttrValues', + payload: { + attrIndex: index, + attrValues: attrValues, + }, + }); + // debugger; + + // console.log(value); + } + + render() { + const {attr, allAttrTree, selectedAttrIds, index} = this.props; + // console.log('i: ' + i); + // 1. 规格 + let attrOptions = []; + // allAttrTree.unshift(attr); + // debugger; + for (let j in allAttrTree) { + let allAttr = allAttrTree[j]; + if (selectedAttrIds.has(allAttr.id) && allAttr.id !== attr.id) { + continue; + } + attrOptions.push(); + } + // 2. 规格值 + let attrValueOptions = []; + // debugger; + if (attr.id) { + // 2.1 先找到规格值的数组 + let attrValues = []; + for (let j in allAttrTree) { + let allAttr = allAttrTree[j]; + if (attr.id === allAttr.id) { + attrValues = allAttr.values; + break; + } + } + // 2.2 生成规格值的 HTML + for (let j in attrValues) { + let attrValue = attrValues[j]; + attrValueOptions.push(); // + '' 的原因是,多选必须是字符串 + } + } + // 3. 拼装最终,添加到 attrTreeHTML 中 + return
+ + +
; + } + +} \ No newline at end of file diff --git a/admin-web/src/components/Product/ProductSkuAddOrUpdateTable.js b/admin-web/src/components/Product/ProductSkuAddOrUpdateTable.js new file mode 100644 index 000000000..8e9452b92 --- /dev/null +++ b/admin-web/src/components/Product/ProductSkuAddOrUpdateTable.js @@ -0,0 +1,85 @@ +import React, {PureComponent} from "react"; +import {InputNumber, Select, Table} from "antd"; +import Input from "antd/es/input"; + +const Option = Select.Option; + +class SkuInputNumber extends PureComponent { + + handleChange = value => { + // debugger; + const { dispatch, index, dataIndex } = this.props; + if (dataIndex === 'price') { + dispatch({ + type: 'productSpuAddOrUpdate/inputSkuPrice', + payload: { + index: index, + price: value + }, + }); + } else if (dataIndex === 'quantity') { + dispatch({ + type: 'productSpuAddOrUpdate/inputSkuQuantity', + payload: { + index: index, + quantity: value + }, + }); + } + } + + render() { + return + } + +} + +export default class ProductSkuAddOrUpdateTable extends PureComponent { + + render() { + let that = this; + // debugger; + // console.log('ProductSkuAddOrUpdateTable'); + const {attrTree, skus, dispatch} = this.props; + let columns = []; + for (let i in attrTree) { + let attr = attrTree[i]; + columns.push({ + title: attr.name, + dataIndex: 'attrs[i]', + render(value, record) { + return record.attrs[i].name; + } + }) + } + columns.push({ + title: '价格', + dataIndex: 'price', + render(value, record, index) { + let props = { + record: record, + index: index, + dispatch: dispatch, + dataIndex: 'price' + }; + return ; + } + }); + columns.push({ + title: '库存', + dataIndex: 'quantity', + render(value, record, index) { + let props = { + record: record, + index: index, + dispatch: dispatch, + dataIndex: 'quantity' + }; + return ; + } + }); + return ; + // return
; + } + +} \ No newline at end of file diff --git a/admin-web/src/locales/zh-CN/menu.js b/admin-web/src/locales/zh-CN/menu.js index be480f4df..44bdf9a3f 100644 --- a/admin-web/src/locales/zh-CN/menu.js +++ b/admin-web/src/locales/zh-CN/menu.js @@ -44,4 +44,9 @@ export default { 'menu.account.settings': '个人设置', 'menu.account.trigger': '触发报错', 'menu.account.logout': '退出登录', + // 商品相关 + 'menu.product': '商品管理', + 'menu.product.product-spu-list': '商品管理', + 'menu.product.product-spu-add': '商品添加', + 'menu.product.product-category-list': '商品分类', }; diff --git a/admin-web/src/models/product/productSpuAddOrUpdate.js b/admin-web/src/models/product/productSpuAddOrUpdate.js index f457e333c..da9f0afc8 100644 --- a/admin-web/src/models/product/productSpuAddOrUpdate.js +++ b/admin-web/src/models/product/productSpuAddOrUpdate.js @@ -1,5 +1,5 @@ import { message } from 'antd'; -import { productCategoryTree, productCategoryAdd, productCategoryUpdate, productCategoryUpdateStatus, productCategoryDelete } from '../../services/product'; +import { productCategoryTree, productSpuAdd, productCategoryUpdate, productCategoryUpdateStatus, productCategoryDelete } from '../../services/product'; export default { namespace: 'productSpuAddOrUpdate', @@ -15,6 +15,16 @@ export default { // name: // // }] // } + ], + skus: [ + // { + // attrs: [{ + // id: // 规格值编号 + // name: // 规格值名 + // }], + // price: // 价格 + // quantity: // 数量 + // } ] }, @@ -63,7 +73,7 @@ export default { *addAttr({ payload }, { call, put }) { // const { queryParams } = payload; // const response = yield call(productCategoryTree, queryParams); - message.info('调试:添加规格成功!'); + // message.info('调试:添加规格成功!'); yield put({ type: 'addAttrSuccess', payload: { @@ -74,12 +84,46 @@ export default { *selectAttr({ payload }, { call, put }) { // const { queryParams } = payload; // const response = yield call(productCategoryTree, queryParams); - message.info('调试:添加规格成功!'); + // message.info('调试:选择规格成功!'); yield put({ type: 'selectAttrSuccess', payload: payload, }); }, + *selectAttrValues({ payload }, { call, put }) { + // const { queryParams } = payload; + // const response = yield call(productCategoryTree, queryParams); + // message.info('调试:选择规格值成功!'); + yield put({ + type: 'selectAttrValueSuccess', + payload: payload, + }); + }, + *inputSkuPrice({ payload }, { call, put }) { + // debugger; + yield put({ + type: 'inputSkuPriceSuccess', + payload: payload, + }); + }, + *inputSkuQuantity({ payload }, { call, put }) { + // debugger; + yield put({ + type: 'inputSkuQuantitySuccess', + payload: payload, + }); + }, + *add({ payload }, { call, put }) { + const { callback, body } = payload; + const response = yield call(productSpuAdd, body); + if (callback) { + callback(response); + } + yield put({ + type: 'tree', + payload: {}, + }); + }, }, reducers: { @@ -99,6 +143,62 @@ export default { ...state } }, + selectAttrValueSuccess(state, {payload}) { + // debugger; + // console.log(state); + state.attrTree[payload.attrIndex].values = payload.attrValues; + // 生成 skus 值 + let skus = []; + let skuSize = 1; + for (let i in state.attrTree) { // 先计算 sku 数量 + let attr = state.attrTree[i]; + skuSize = skuSize * attr.values.length; + } + // console.log('skuSize: ' + skuSize); + for (let i = 0; i < skuSize; i++) { // 初始化 sku 格子 + skus.push({ + attrs: [], + price: undefined, + quantity: undefined, + }); + } + for (let i = 0; i < state.attrTree.length; i++) { // 初始化 sku 格子里的 attrs + for (let j = 0; j < skuSize; j++) { + // let values = state.attrTree[i].values; + // let attr = values[j % values.length]; + // skus[i].attrs.push({ + // id: attr.id, + // name: attr.name, + // }); + let values = state.attrTree[i].values; + let attr = values[j % values.length]; + skus[j].attrs.push({ + id: attr.id, + name: attr.name, + }); + } + } + state.skus = skus; + // debugger; + // console.l og('skus: ' + skus); + return { + ...state + } + }, + inputSkuPriceSuccess(state, {payload}) { + // debugger; + state.skus[payload.index].price = payload.price; + return { + ...state + } + }, + inputSkuQuantitySuccess(state, {payload}) { + // debugger; + state.skus[payload.index].quantity = payload.quantity; + return { + ...state + } + }, treeSuccess(state, { payload }) { return { ...state, diff --git a/admin-web/src/pages/Product/ProductSpuAddOrUpdate.js b/admin-web/src/pages/Product/ProductSpuAddOrUpdate.js index 7308e0474..2aa0d6660 100644 --- a/admin-web/src/pages/Product/ProductSpuAddOrUpdate.js +++ b/admin-web/src/pages/Product/ProductSpuAddOrUpdate.js @@ -7,6 +7,8 @@ import {Card, Form, Input, Radio, Button, Table, Select} from 'antd'; import PageHeaderWrapper from '@/components/PageHeaderWrapper'; import styles from './ProductSpuAddOrUpdate.less'; +import ProductAttrSelectFormItem from "../../components/Product/ProductAttrSelectFormItem"; +import ProductSkuAddOrUpdateTable from "../../components/Product/ProductSkuAddOrUpdateTable"; const FormItem = Form.Item; const RadioGroup = Radio.Group; @@ -19,7 +21,8 @@ const Option = Select.Option; productAttrList, productSpuAddOrUpdate, allAttrTree: productAttrList.tree, - attrTree: productSpuAddOrUpdate.attrTree + attrTree: productSpuAddOrUpdate.attrTree, + skus: productSpuAddOrUpdate.skus, })) @Form.create() @@ -44,18 +47,18 @@ class ProductSpuAddOrUpdate extends Component { }); } - handleSubmit = e => { - const { dispatch, form } = this.props; - e.preventDefault(); - form.validateFieldsAndScroll((err, values) => { - if (!err) { - dispatch({ - type: 'form/submitRegularForm', - payload: values, - }); - } - }); - } + // handleSubmit = e => { + // const { dispatch, form } = this.props; + // e.preventDefault(); + // form.validateFieldsAndScroll((err, values) => { + // if (!err) { + // dispatch({ + // type: 'form/submitRegularForm', + // payload: values, + // }); + // } + // }); + // } handleAddAttr = e => { // alert('你猜'); @@ -67,74 +70,171 @@ class ProductSpuAddOrUpdate extends Component { }); } - handleSelectAttr = (value, option) => { - console.log(value); - console.log(option); + handleSubmit = e => { debugger; - const { dispatch } = this.props; - let attrIndex = option.key.substring(option.key.indexOf('option-attr-') + 'option-attr-'.length, option.key.lastIndexOf('-')); - console.log('attrIndex: ' + attrIndex); - debugger; - dispatch({ - type: 'productSpuAddOrUpdate/selectAttr', - payload: { - attrIndex: attrIndex, - attr: { - id: option.props.value, - name: option.props.children, - } - }, + e.preventDefault(); + const { skus, dispatch } = this.props; + // 生成 skuStr 格式 + let skuStr = []; // 因为提交是字符串格式 + for (let i in skus) { + let sku = skus[i]; + if (!sku.price || !sku.quantity) { + continue; + } + let newAttr = { + attrs: [], + price: sku.price, + quantity: sku.quantity, + } + for (let j in sku.attrs) { + newAttr.attrs.push(sku.attrs[j].id); + } + skuStr.push(newAttr); + } + if (skuStr.length === 0) { + alert('请设置商品规格!'); + return; + } + this.props.form.validateFields((err, values) => { + if (!err) { + dispatch({ + type: 'productSpuAddOrUpdate/add', + payload: { + body: { + ...values, + skuStr: JSON.stringify(skuStr) + } + }, + }); + } }); + // console.log(fields); } + // handleSelectAttr = (value, option) => { + // // console.log(value); + // // console.log(option); + // // debugger; + // const { dispatch } = this.props; + // let attrIndex = option.key.substring(option.key.indexOf('option-attr-') + 'option-attr-'.length, option.key.lastIndexOf('-')); + // // console.log('attrIndex: ' + attrIndex); + // // debugger; + // dispatch({ + // type: 'productSpuAddOrUpdate/selectAttr', + // payload: { + // attrIndex: attrIndex, + // attr: { + // id: option.props.value, + // name: option.props.children, + // values: [] + // } + // }, + // }); + // } + // + // handleSelectAttrValue = (values, options) => { + // let attrValues = []; + // const { dispatch } = this.props; + // debugger; + // // console.log('x' + this.children[0]); + // let firstOption = this.children[0]; + // // let attrIndex = firstOption.key.substring(firstOption.key.indexOf('option-attr-value-') + 'option-attr-value-'.length, firstOption.key.lastIndexOf('-')); + // let attrIndex = 0; + // for (let i in options) { + // let option = options[i]; + // attrValues.push({ + // id: parseInt(option.props.value), + // name: option.props.children, + // }); + // } + // dispatch({ + // type: 'productSpuAddOrUpdate/selectAttrValues', + // payload: { + // attrIndex: attrIndex, + // attrValues: attrValues, + // }, + // }); + // // debugger; + // + // // console.log(value); + // } + render() { // debugger; - const { form, data, attrTree, allAttrTree } = this.props; - const that = this; - - // 规格明细 - const columns = [ - { - title: '颜色', - dataIndex: 'price' - }, - { - title: '价格', - dataIndex: 'price', - render(val) { - return {status[val]}; - }, - }, - { - title: '库存', - dataIndex: 'quantity', - } - ]; + const { form, skus, attrTree, allAttrTree, dispatch } = this.props; + // const that = this; // 添加规格 // debugger; let attrTreeHTML = []; if (attrTree && attrTree.length > 0) { + // 已选择的的规格集合 + let selectedAttrIds = new Set(); for (let i in attrTree) { let attr = attrTree[i]; - // console.log('i: ' + i); - // 1. 规格 - let options = []; - for (let j in allAttrTree) { - let attr = allAttrTree[j]; - options.push(); - } - // 2. 规格值 - - // 3. 拼装最终,添加到 attrTreeHTML 中 - attr =
- -
; - attrTreeHTML.push(attr); + selectedAttrIds.add(attr.id); + } + // 创建每个规格下拉框的 HTML + for (let i in attrTree) { + let attr = attrTree[i]; + let itemProps = { + attr: attr, + allAttrTree: allAttrTree, + dispatch: dispatch, + selectedAttrIds: selectedAttrIds, + index: i // 位置。不然无法正确修改 Model 指定位置的数据 + }; + attrTreeHTML.push(); } } + // if (attrTree && attrTree.length > 0) { + // for (let i in attrTree) { + // let attr = attrTree[i]; + // // console.log('i: ' + i); + // // 1. 规格 + // let attrOptions = []; + // for (let j in allAttrTree) { + // let attr = allAttrTree[j]; + // attrOptions.push(); + // } + // // 2. 规格值 + // let attrValueOptions = []; + // // debugger; + // if (attr.id) { + // // 2.1 先招到规格值的数组 + // let attrValues = []; + // for (let j in allAttrTree) { + // let allAttr = allAttrTree[j]; + // if (attr.id === allAttr.id) { + // attrValues = allAttr.values; + // break; + // } + // } + // // 2.2 生成规格值的 HTML + // for (let j in attrValues) { + // let attrValue = attrValues[j]; + // attrValueOptions.push(); // + '' 的原因是,多选必须是字符串 + // } + // } + // // 3. 拼装最终,添加到 attrTreeHTML 中 + // attr =
+ // + // + //
; + // attrTreeHTML.push(attr); + // } + // } + // 规格明细 + let productSkuProps = { + attrTree: attrTree, + skus: skus, + dispatch: dispatch, + }; + // console.log(productSkuProps); return ( @@ -189,13 +289,12 @@ class ProductSpuAddOrUpdate extends Component {
)} - {/**/} - {/*{form.getFieldDecorator('visible', {*/} - {/*initialValue: 1, // TODO 修改*/} - {/*})(*/} - {/*
*/} - {/*)}*/} - {/**/} + + {/*
*/} + + + + diff --git a/admin-web/src/services/product.js b/admin-web/src/services/product.js index c0a51274e..f8181bf02 100644 --- a/admin-web/src/services/product.js +++ b/admin-web/src/services/product.js @@ -44,6 +44,13 @@ export async function productSpuPage(params) { }); } +export async function productSpuAdd(params) { + return request(`/product-api/admins/spu/add?${stringify(params)}`, { + method: 'POST', + body: {}, + }); +} + // product attr + attr value export async function productAttrTree(params) { diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductSpuController.java b/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductSpuController.java index 0c64f6dab..d598b03dd 100644 --- a/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductSpuController.java +++ b/product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductSpuController.java @@ -52,7 +52,7 @@ public class AdminsProductSpuController { @RequestParam("sellPoint") String sellPoint, @RequestParam("description") String description, @RequestParam("cid") Integer cid, - @RequestParam("picURLs") List picUrls, + @RequestParam("picUrls") List picUrls, @RequestParam("visible") Boolean visible, @RequestParam("skuStr") String skuStr) { // TODO 芋艿,因为考虑不使用 json 接受参数,所以这里手动转。 // 创建 ProductSpuAddDTO 对象 From 344623e0c97fbd1cd095a0673f7aa86d00d76d81 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Mon, 18 Mar 2019 20:17:10 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=89=8D=E7=AB=AF=EF=BC=9A=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=B7=BB=E5=8A=A0=E3=80=82=E6=8F=90=E4=BA=A4=E9=83=A8?= =?UTF-8?q?=E5=88=86=EF=BC=8C=E8=AE=A9=E5=B0=8F=E8=8C=83=E5=B8=AE=E5=BF=99?= =?UTF-8?q?=E7=9C=8B=E7=9C=8B~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/product/productSpuAddOrUpdate.js | 21 ++++- .../src/models/product/productSpuList.js | 85 ++++++++++--------- admin-web/src/pages/Product/ProductSpuList.js | 49 ++--------- 3 files changed, 67 insertions(+), 88 deletions(-) diff --git a/admin-web/src/models/product/productSpuAddOrUpdate.js b/admin-web/src/models/product/productSpuAddOrUpdate.js index da9f0afc8..6ceaa56e7 100644 --- a/admin-web/src/models/product/productSpuAddOrUpdate.js +++ b/admin-web/src/models/product/productSpuAddOrUpdate.js @@ -119,10 +119,23 @@ export default { if (callback) { callback(response); } - yield put({ - type: 'tree', - payload: {}, - }); + // yield put({ + // type: 'tree', + // payload: {}, + // }); + alert('添加成功!后续改成跳转到手机站的详情'); + }, + *update({ payload }, { call, put }) { + const { callback, body } = payload; + const response = yield call(productSpuAdd, body); + if (callback) { + callback(response); + } + // yield put({ + // type: 'tree', + // payload: {}, + // }); + alert('修改成功!后续改成跳转到手机站的详情'); }, }, diff --git a/admin-web/src/models/product/productSpuList.js b/admin-web/src/models/product/productSpuList.js index d4492f3cb..cc9ad9607 100644 --- a/admin-web/src/models/product/productSpuList.js +++ b/admin-web/src/models/product/productSpuList.js @@ -1,5 +1,6 @@ import { message } from 'antd'; import { productSpuPage, productCategoryAdd, productCategoryUpdate, productCategoryUpdateStatus, productCategoryDelete } from '../../services/product'; +import {routerRedux} from "dva/router"; export default { namespace: 'productSpuList', @@ -9,46 +10,50 @@ export default { }, effects: { - *add({ payload }, { call, put }) { - const { callback, body } = payload; - const response = yield call(productCategoryAdd, body); - if (callback) { - callback(response); - } - yield put({ - type: 'tree', - payload: {}, - }); - }, - *update({ payload }, { call, put }) { - const { callback, body } = payload; - const response = yield call(productCategoryUpdate, body); - if (callback) { - callback(response); - } - yield put({ - type: 'tree', - payload: {}, - }); - }, - *updateStatus({ payload }, { call, put }) { - const { callback, body } = payload; - const response = yield call(productCategoryUpdateStatus, body); - if (callback) { - callback(response); - } - yield put({ - type: 'tree', - payload: {}, - }); - }, - *delete({ payload }, { call, put }) { - const response = yield call(productCategoryDelete, payload); - message.info('删除成功!'); - yield put({ - type: 'tree', - payload: {}, - }); + // *add({ payload }, { call, put }) { + // const { callback, body } = payload; + // const response = yield call(productCategoryAdd, body); + // if (callback) { + // callback(response); + // } + // yield put({ + // type: 'tree', + // payload: {}, + // }); + // }, + // *update({ payload }, { call, put }) { + // const { callback, body } = payload; + // const response = yield call(productCategoryUpdate, body); + // if (callback) { + // callback(response); + // } + // yield put({ + // type: 'tree', + // payload: {}, + // }); + // }, + // *updateStatus({ payload }, { call, put }) { + // const { callback, body } = payload; + // const response = yield call(productCategoryUpdateStatus, body); + // if (callback) { + // callback(response); + // } + // yield put({ + // type: 'tree', + // payload: {}, + // }); + // }, + // *delete({ payload }, { call, put }) { + // const response = yield call(productCategoryDelete, payload); + // message.info('删除成功!'); + // yield put({ + // type: 'tree', + // payload: {}, + // }); + // }, + *redirectToAdd({ payload }, { call, put }) { + // const { callback, body } = payload; + yield put(routerRedux.replace('/product/product-spu-add')); }, *page({ payload }, { call, put }) { const { queryParams } = payload; diff --git a/admin-web/src/pages/Product/ProductSpuList.js b/admin-web/src/pages/Product/ProductSpuList.js index 6435529fc..6abb3de4a 100644 --- a/admin-web/src/pages/Product/ProductSpuList.js +++ b/admin-web/src/pages/Product/ProductSpuList.js @@ -77,52 +77,13 @@ class ProductSpuList extends PureComponent { }); } - handleModalVisible = (flag, modalType, initValues) => { - this.setState({ - modalVisible: !!flag, - initValues: initValues || {}, - modalType: modalType || 'add', + redirectToAdd = () => { + const { dispatch } = this.props; + dispatch({ + type: 'productSpuList/redirectToAdd', }); }; - handleAdd = ({ fields, modalType, initValues }) => { - const { dispatch, data } = this.props; - const queryParams = { - pageNo: data.pageNo, - pageSize: data.pageSize, - }; - if (modalType === 'add') { - dispatch({ - type: 'roleList/add', - payload: { - body: { - ...fields, - }, - queryParams, - callback: () => { - message.success('添加成功'); - this.handleModalVisible(); - }, - }, - }); - } else { - dispatch({ - type: 'roleList/update', - payload: { - body: { - ...initValues, - ...fields, - }, - queryParams, - callback: () => { - message.success('更新成功'); - this.handleModalVisible(); - }, - }, - }); - } - }; - render() { // debugger; const { list, data } = this.props; @@ -199,7 +160,7 @@ class ProductSpuList extends PureComponent { From e2619ce5d4f71a13d9a996f2bab607364ee52c87 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Tue, 19 Mar 2019 01:38:17 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=89=8D=E7=AB=AF=EF=BC=9A=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E7=AE=A1=E7=90=86=E7=9A=84=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin-web/README-antd.md | 136 ------------------------ admin-web/README.md | 29 +++++ admin-web/README.ru-RU.md | 103 ------------------ admin-web/README.zh-CN.md | 121 --------------------- admin-web/src/models/admin/adminList.js | 1 - admin-web/src/pages/Admin/AdminList.js | 33 +++--- 6 files changed, 45 insertions(+), 378 deletions(-) delete mode 100644 admin-web/README-antd.md delete mode 100644 admin-web/README.ru-RU.md delete mode 100644 admin-web/README.zh-CN.md diff --git a/admin-web/README-antd.md b/admin-web/README-antd.md deleted file mode 100644 index ce0725dfd..000000000 --- a/admin-web/README-antd.md +++ /dev/null @@ -1,136 +0,0 @@ -English | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) - -

Ant Design Pro

- -
- -An out-of-box UI solution for enterprise applications as a React boilerplate. - -[![Build With Umi](https://img.shields.io/badge/build%20with-umi-028fe4.svg?style=flat-square)](http://umijs.org/) -[![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) -[![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) -[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) -[![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjEyMzUiIGhlaWdodD0iNjUwIiB2aWV3Qm94PSIwIDAgNzQxMCAzOTAwIj4NCjxyZWN0IHdpZHRoPSI3NDEwIiBoZWlnaHQ9IjM5MDAiIGZpbGw9IiNiMjIyMzQiLz4NCjxwYXRoIGQ9Ik0wLDQ1MEg3NDEwbTAsNjAwSDBtMCw2MDBINzQxMG0wLDYwMEgwbTAsNjAwSDc0MTBtMCw2MDBIMCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjMwMCIvPg0KPHJlY3Qgd2lkdGg9IjI5NjQiIGhlaWdodD0iMjEwMCIgZmlsbD0iIzNjM2I2ZSIvPg0KPGcgZmlsbD0iI2ZmZiI%2BDQo8ZyBpZD0iczE4Ij4NCjxnIGlkPSJzOSI%2BDQo8ZyBpZD0iczUiPg0KPGcgaWQ9InM0Ij4NCjxwYXRoIGlkPSJzIiBkPSJNMjQ3LDkwIDMxNy41MzQyMzAsMzA3LjA4MjAzOSAxMzIuODczMjE4LDE3Mi45MTc5NjFIMzYxLjEyNjc4MkwxNzYuNDY1NzcwLDMwNy4wODIwMzl6Ii8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB5PSI0MjAiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHk9Ijg0MCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTI2MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTY4MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjczQiIHg9IjI0NyIgeT0iMjEwIi8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzOSIgeD0iNDk0Ii8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzMTgiIHg9Ijk4OCIvPg0KPHVzZSB4bGluazpocmVmPSIjczkiIHg9IjE5NzYiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3M1IiB4PSIyNDcwIi8%2BDQo8L2c%2BDQo8L3N2Zz4%3D)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -[![Join the chat at https://gitter.im/ant-design/ant-design-pro](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAzMCAyMCI%2BDQo8ZGVmcz4NCjxwYXRoIGlkPSJzIiBkPSJNMCwtMSAwLjU4Nzc4NSwwLjgwOTAxNyAtMC45NTEwNTcsLTAuMzA5MDE3SDAuOTUxMDU3TC0wLjU4Nzc4NSwwLjgwOTAxN3oiIGZpbGw9IiNmZmRlMDAiLz4NCjwvZGVmcz4NCjxyZWN0IHdpZHRoPSIzMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RlMjkxMCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNSw1KSBzY2FsZSgzKSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsMikgcm90YXRlKDIzLjAzNjI0MykiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyLDQpIHJvdGF0ZSg0NS44Njk4OTgpIi8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiw3KSByb3RhdGUoNjkuOTQ1Mzk2KSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsOSkgcm90YXRlKDIwLjY1OTgwOCkiLz4NCjwvc3ZnPg%3D%3D)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - -![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) - -
- -- Preview: http://preview.pro.ant.design -- Home Page: http://pro.ant.design -- Documentation: http://pro.ant.design/docs/getting-started -- ChangeLog: http://pro.ant.design/docs/changelog -- FAQ: http://pro.ant.design/docs/faq -- Mirror Site in China: http://ant-design-pro.gitee.io - -## 2.0 Released Now! 🎉🎉🎉 -[Announcing Ant Design Pro 2.0.0](https://medium.com/ant-design/beautiful-and-powerful-ant-design-pro-2-0-release-51358da5af95) - -## Translation Recruitment :loudspeaker: - -We need your help: https://github.com/ant-design/ant-design-pro/issues/120 - -## Features - -- :gem: **Neat Design**: Follow [Ant Design specification](http://ant.design/) -- :triangular_ruler: **Common Templates**: Typical templates for enterprise applications -- :rocket: **State of The Art Development**: Newest development stack of React/umi/dva/antd -- :iphone: **Responsive**: Designed for variable screen sizes -- :art: **Theming**: Customizable theme with simple config -- :globe_with_meridians: **International**: Built-in i18n solution -- :gear: **Best Practices**: Solid workflow to make your code healthy -- :1234: **Mock development**: Easy to use mock development solution -- :white_check_mark: **UI Test**: Fly safely with unit and e2e tests - -## Templates - -``` -- Dashboard - - Analytic - - Monitor - - Workspace -- Form - - Basic Form - - Step Form - - Advanced From -- List - - Standard Table - - Standard List - - Card List - - Search List (Project/Applications/Article) -- Profile - - Simple Profile - - Advanced Profile -- Account - - Account Center - - Account Settings -- Result - - Success - - Failed -- Exception - - 403 - - 404 - - 500 -- User - - Login - - Register - - Register Result -``` - -## Usage - -### Use bash - -```bash -$ git clone https://github.com/ant-design/ant-design-pro.git --depth=1 -$ cd ant-design-pro -$ npm install -$ npm start # visit http://localhost:8000 -``` - -### Use by docker - -```bash -# preview -$ docker pull antdesign/ant-design-pro -$ docker run -p 80:80 antdesign/ant-design-pro -# open http://localhost - -# dev -$ npm run docker:dev - -# build -$ npm run docker:build - - -# production dev -$ npm run docker-prod:dev - -# production build -$ npm run docker-prod:build -``` - -### Use Gitpod - -Open the project in Gitpod (free online dev environment for GitHub) and start coding immediately. - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/ant-design/ant-design-pro) - -More instructions at [documentation](http://pro.ant.design/docs/getting-started). - -## Browsers support - -Modern browsers and IE11. - -| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Opera](http://godban.github.io/browsers-support-badges/)
Opera | -| --------- | --------- | --------- | --------- | --------- | -| IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions - -## Contributing - -Any type of contribution is welcome, here are some examples of how you may contribute to this project: - -- Use Ant Design Pro in your daily work. -- Submit [issues](http://github.com/ant-design/ant-design-pro/issues) to report bugs or ask questions. -- Propose [pull requests](http://github.com/ant-design/ant-design-pro/pulls) to improve our code. diff --git a/admin-web/README.md b/admin-web/README.md index 43e8a3284..b40101c02 100644 --- a/admin-web/README.md +++ b/admin-web/README.md @@ -3,3 +3,32 @@ > 采用 antd pro 快速开发 > TODO + +## 命名规范 + +#### 1.文件夹命名 + +文件夹命名全部小写,单词之间以中划线隔离 例如: node-modules + + +#### 2.文件命名 + +文件以小写开头,以驼峰格式连接单词 例如: dashBoard.js +component目录下的文件 以大写开头 +route目录下的文件以大写开头 +model目录下的文件大写开头 + + +#### 3.标点符号 + +对于字符串统一用单引号 例如: 'hello world' + +#### 4.语法规范 + +JS语法规范遵守ES6规范 +http://www.tuicool.com/articles/YrQ7j2a + +#### 5.注释 + +1.route目录下的文件需要加上文件头部注释(写清楚文件是什么功能) +2.component文件需要加上头部注释 (写清楚改控件的用处) \ No newline at end of file diff --git a/admin-web/README.ru-RU.md b/admin-web/README.ru-RU.md deleted file mode 100644 index 22d16c9ac..000000000 --- a/admin-web/README.ru-RU.md +++ /dev/null @@ -1,103 +0,0 @@ -[English](./README.md) | [简体中文](./README.zh-CN.md) | Русский - -

Ant Design Pro

- -
- -UI-решение "из коробки" для корпоративных приложений как React boilerplate - -[![Build With Umi](https://img.shields.io/badge/build%20with-umi-028fe4.svg?style=flat-square)](http://umijs.org/) -[![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) -[![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) -[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) -[![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjEyMzUiIGhlaWdodD0iNjUwIiB2aWV3Qm94PSIwIDAgNzQxMCAzOTAwIj4NCjxyZWN0IHdpZHRoPSI3NDEwIiBoZWlnaHQ9IjM5MDAiIGZpbGw9IiNiMjIyMzQiLz4NCjxwYXRoIGQ9Ik0wLDQ1MEg3NDEwbTAsNjAwSDBtMCw2MDBINzQxMG0wLDYwMEgwbTAsNjAwSDc0MTBtMCw2MDBIMCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjMwMCIvPg0KPHJlY3Qgd2lkdGg9IjI5NjQiIGhlaWdodD0iMjEwMCIgZmlsbD0iIzNjM2I2ZSIvPg0KPGcgZmlsbD0iI2ZmZiI%2BDQo8ZyBpZD0iczE4Ij4NCjxnIGlkPSJzOSI%2BDQo8ZyBpZD0iczUiPg0KPGcgaWQ9InM0Ij4NCjxwYXRoIGlkPSJzIiBkPSJNMjQ3LDkwIDMxNy41MzQyMzAsMzA3LjA4MjAzOSAxMzIuODczMjE4LDE3Mi45MTc5NjFIMzYxLjEyNjc4MkwxNzYuNDY1NzcwLDMwNy4wODIwMzl6Ii8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB5PSI0MjAiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHk9Ijg0MCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTI2MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTY4MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjczQiIHg9IjI0NyIgeT0iMjEwIi8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzOSIgeD0iNDk0Ii8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzMTgiIHg9Ijk4OCIvPg0KPHVzZSB4bGluazpocmVmPSIjczkiIHg9IjE5NzYiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3M1IiB4PSIyNDcwIi8%2BDQo8L2c%2BDQo8L3N2Zz4%3D)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -[![Join the chat at https://gitter.im/ant-design/ant-design-pro](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAzMCAyMCI%2BDQo8ZGVmcz4NCjxwYXRoIGlkPSJzIiBkPSJNMCwtMSAwLjU4Nzc4NSwwLjgwOTAxNyAtMC45NTEwNTcsLTAuMzA5MDE3SDAuOTUxMDU3TC0wLjU4Nzc4NSwwLjgwOTAxN3oiIGZpbGw9IiNmZmRlMDAiLz4NCjwvZGVmcz4NCjxyZWN0IHdpZHRoPSIzMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RlMjkxMCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNSw1KSBzY2FsZSgzKSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsMikgcm90YXRlKDIzLjAzNjI0MykiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyLDQpIHJvdGF0ZSg0NS44Njk4OTgpIi8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiw3KSByb3RhdGUoNjkuOTQ1Mzk2KSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsOSkgcm90YXRlKDIwLjY1OTgwOCkiLz4NCjwvc3ZnPg%3D%3D)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - -![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) - -
- -- Демо: http://preview.pro.ant.design -- Домашняя страница: http://pro.ant.design -- Документация: http://pro.ant.design/docs/getting-started -- История изменений: http://pro.ant.design/docs/changelog -- FAQ: http://pro.ant.design/docs/faq -- Китайское зеркало сайта: http://ant-design-pro.gitee.io - -## Поиск переводчиков :loudspeaker: - -Нам нужна ваша помощь: https://github.com/ant-design/ant-design-pro/issues/120 - -## Возможности - -- :gem: **Аккуратный дизайн**: Посмотрите [спецификацию Ant Design](http://ant.design/) -- :triangular_ruler: **Общие шаблоны**: Стандартные шаблоны для корпоративных приложений -- :rocket: **Разработка, как искусство**: Новейший стек технологий React/umi/dva/antd -- :iphone: **Отзывчивая верстка**: Создан для экранов разных размеров -- :art: **Темизация**: Возможность изменения темы с помощью конфигурации -- :globe_with_meridians: **Мультиязычность**: Встроенное i18n решение -- :gear: **Лучшие практики**: Надежные процессы для хорошего кода -- :1234: **Разработка по шаблону**: Простое в использовании решение для разработки -- :white_check_mark: **UI тесты**: Разрабатывайте безопасно с юнит и e2e тестами - -## Шаблоны - -``` -- Dashboard - - Analytic - - Monitor - - Workspace -- Form - - Basic Form - - Step Form - - Advanced From -- List - - Standard Table - - Standard List - - Card List - - Search List (Project/Applications/Article) -- Profile - - Simple Profile - - Advanced Profile -- Account - - Account Center - - Account Settings -- Result - - Success - - Failed -- Exception - - 403 - - 404 - - 500 -- User - - Login - - Register - - Register Result -``` - -## Использование - -```bash -$ git clone https://github.com/ant-design/ant-design-pro.git --depth=1 -$ cd ant-design-pro -$ npm install -$ npm start # visit http://localhost:8000 -``` - -Больше информации в [документации](http://pro.ant.design/docs/getting-started). - -## Совместимость - -Современные браузеры и IE11. - -| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Opera](http://godban.github.io/browsers-support-badges/)
Opera | -| --------- | --------- | --------- | --------- | --------- | -| IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions - -## Распространение - -Любые варианты распространения приветствуются! Вот несколько примеров того, как вы можете помочь распространению проекта: - -- Использовать Ant Design Pro в ежедневной работе. -- Создавать [задачи](http://github.com/ant-design/ant-design-pro/issues) заводить баги или отвечать на вопросы. -- Делать [pull-реквесты](http://github.com/ant-design/ant-design-pro/pulls) для совершенствования нашего кода. diff --git a/admin-web/README.zh-CN.md b/admin-web/README.zh-CN.md deleted file mode 100644 index 6b1505061..000000000 --- a/admin-web/README.zh-CN.md +++ /dev/null @@ -1,121 +0,0 @@ -[English](./README.md) | 简体中文 | [Русский](./README.ru-RU.md) - -

Ant Design Pro

- -
- -开箱即用的中台前端/设计解决方案。 - -[![Build With Umi](https://img.shields.io/badge/build%20with-umi-028fe4.svg?style=flat-square)](http://umijs.org/) -[![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) -[![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) -[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) -[![Join the chat at https://gitter.im/ant-design/ant-design-pro](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAzMCAyMCI%2BDQo8ZGVmcz4NCjxwYXRoIGlkPSJzIiBkPSJNMCwtMSAwLjU4Nzc4NSwwLjgwOTAxNyAtMC45NTEwNTcsLTAuMzA5MDE3SDAuOTUxMDU3TC0wLjU4Nzc4NSwwLjgwOTAxN3oiIGZpbGw9IiNmZmRlMDAiLz4NCjwvZGVmcz4NCjxyZWN0IHdpZHRoPSIzMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RlMjkxMCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNSw1KSBzY2FsZSgzKSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsMikgcm90YXRlKDIzLjAzNjI0MykiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyLDQpIHJvdGF0ZSg0NS44Njk4OTgpIi8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiw3KSByb3RhdGUoNjkuOTQ1Mzk2KSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsOSkgcm90YXRlKDIwLjY1OTgwOCkiLz4NCjwvc3ZnPg%3D%3D)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - -![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) - -
- -- 预览:http://preview.pro.ant.design -- 首页:http://pro.ant.design/index-cn -- 使用文档:http://pro.ant.design/docs/getting-started-cn -- 更新日志: http://pro.ant.design/docs/changelog-cn -- 常见问题:http://pro.ant.design/docs/faq-cn -- 国内镜像:http://ant-design-pro.gitee.io - -## 特性 - -- :gem: **优雅美观**:基于 Ant Design 体系精心设计 -- :triangular_ruler: **常见设计模式**:提炼自中后台应用的典型页面和场景 -- :rocket: **最新技术栈**:使用 React/umi/dva/antd 等前端前沿技术开发 -- :iphone: **响应式**:针对不同屏幕大小设计 -- :art: **主题**:可配置的主题满足多样化的品牌诉求 -- :globe_with_meridians: **国际化**:内建业界通用的国际化方案 -- :gear: **最佳实践**:良好的工程实践助您持续产出高质量代码 -- :1234: **Mock 数据**:实用的本地数据调试方案 -- :white_check_mark: **UI 测试**:自动化测试保障前端产品质量 - -## 模板 - -``` -- Dashboard - - 分析页 - - 监控页 - - 工作台 -- 表单页 - - 基础表单页 - - 分步表单页 - - 高级表单页 -- 列表页 - - 查询表格 - - 标准列表 - - 卡片列表 - - 搜索列表(项目/应用/文章) -- 详情页 - - 基础详情页 - - 高级详情页 -- 用户 - - 用户中心页 - - 用户设置页 -- 结果 - - 成功页 - - 失败页 -- 异常 - - 403 无权限 - - 404 找不到 - - 500 服务器出错 -- 帐户 - - 登录 - - 注册 - - 注册成功 -``` - -## 使用 - -### 使用命令行 -```bash -$ git clone https://github.com/ant-design/ant-design-pro.git --depth=1 -$ cd ant-design-pro -$ npm install -$ npm start # 访问 http://localhost:8000 -``` - -### 使用 docker - -```bash -# preview -$ docker pull antdesign/ant-design-pro -$ docker run -p 80:80 antdesign/ant-design-pro -# open http://localhost - -# dev -$ npm run docker:dev - -# build -$ npm run docker:build - - -# production dev -$ npm run docker-prod:dev - -// production build -$ npm run docker-prod:build -``` - -更多信息请参考 [使用文档](http://pro.ant.design/docs/getting-started)。 - -## 支持环境 - -现代浏览器及 IE11。 - -| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Opera](http://godban.github.io/browsers-support-badges/)
Opera | -| --------- | --------- | --------- | --------- | --------- | -| IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions - -## 参与贡献 - -我们非常欢迎你的贡献,你可以通过以下方式和我们一起共建 :smiley:: - -- 在你的公司或个人项目中使用 Ant Design Pro。 -- 通过 [Issue](http://github.com/ant-design/ant-design-pro/issues) 报告 bug 或进行咨询。 -- 提交 [Pull Request](http://github.com/ant-design/ant-design-pro/pulls) 改进 Pro 的代码。 diff --git a/admin-web/src/models/admin/adminList.js b/admin-web/src/models/admin/adminList.js index 6adf934fe..89d6d316b 100644 --- a/admin-web/src/models/admin/adminList.js +++ b/admin-web/src/models/admin/adminList.js @@ -76,7 +76,6 @@ export default { }, *query({ payload }, { call, put }) { const response = yield call(queryAdmin, payload); - message.info('查询成功!'); const { count, admins } = response.data; yield put({ type: 'querySuccess', diff --git a/admin-web/src/pages/Admin/AdminList.js b/admin-web/src/pages/Admin/AdminList.js index d2da4e2ab..b11fbff44 100644 --- a/admin-web/src/pages/Admin/AdminList.js +++ b/admin-web/src/pages/Admin/AdminList.js @@ -6,6 +6,7 @@ import { Card, Form, Input, Button, Modal, message, Table, Divider, Tree, Spin } import PageHeaderWrapper from '@/components/PageHeaderWrapper'; import styles from './AdminList.less'; +import moment from "moment"; const FormItem = Form.Item; const { TreeNode } = Tree; @@ -31,20 +32,19 @@ const CreateForm = Form.create()(props => { width: 200, }; - const title = modalType === 'add' ? '添加一个 Resource' : '更新一个 Resource'; - const okText = modalType === 'add' ? '添加' : '更新'; + const title = modalType === 'add' ? '新建管理员' : '更新管理员'; return ( handleModalVisible()} > - + {form.getFieldDecorator('username', { - rules: [{ required: true, message: '请输入名称!', min: 2 }], + rules: [{ required: true, message: '请输入用户名!', min: 2 }], initialValue: initValues.username, })()} @@ -323,15 +323,9 @@ class ResourceList extends PureComponent { }; const columns = [ - { - title: 'id', - dataIndex: 'id', - render: text => {text}, - }, { title: '用户名', - dataIndex: 'username', - render: text => {text}, + dataIndex: 'username' }, { title: '昵称', @@ -344,14 +338,19 @@ class ResourceList extends PureComponent { return {status[val]}; }, }, + { + title: '创建时间', + dataIndex: 'createTime', + render: val => {moment(val).format('YYYY-MM-DD HH:mm')}, + }, { title: '操作', - width: 300, + width: 360, render: (text, record) => { - const statusText = record.status === 1 ? '确认禁用' : '取消禁用'; + const statusText = record.status === 1 ? '禁用' : '禁用'; return ( - this.handleModalVisible(true, 'update', record)}>更新 + this.handleModalVisible(true, 'update', record)}>编辑 this.handleRoleAssign(record)}>角色分配 @@ -369,7 +368,7 @@ class ResourceList extends PureComponent { ]; return ( - +
@@ -378,7 +377,7 @@ class ResourceList extends PureComponent { type="primary" onClick={() => this.handleModalVisible(true, 'add', {})} > - 新建 + 新建管理员
From 76818dab18b5ea44139d963275608362ef47c5f1 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Tue, 19 Mar 2019 03:39:17 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=89=8D=E7=AB=AF=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=AE=A1=E7=90=86=E5=91=98=E6=97=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin-web/helpers/validator.js | 10 ++++++ admin-web/mock/admin.js | 4 +-- .../components/Dictionary/DictionaryText.js | 1 + admin-web/src/models/admin/adminList.js | 1 + admin-web/src/pages/Admin/AdminList.js | 36 ++++++++++++++++--- .../controller/admins/AdminController.java | 4 ++- .../controller/admins/PassportController.java | 16 ++++----- .../mall/admin/service/OAuth2ServiceImpl.java | 1 - 8 files changed, 55 insertions(+), 18 deletions(-) create mode 100644 admin-web/helpers/validator.js diff --git a/admin-web/helpers/validator.js b/admin-web/helpers/validator.js new file mode 100644 index 000000000..02bc4b81c --- /dev/null +++ b/admin-web/helpers/validator.js @@ -0,0 +1,10 @@ + +// 校验必须是英文或者数字 +export function checkTypeWithEnglishAndNumbers (rule, value, callback, text) { + let char = /^[a-zA-Z0-9]+$/ + if (char.test(value)) { + callback() + } else { + callback(text) + } +} \ No newline at end of file diff --git a/admin-web/mock/admin.js b/admin-web/mock/admin.js index aa30f8d3d..be9c114b2 100644 --- a/admin-web/mock/admin.js +++ b/admin-web/mock/admin.js @@ -49,10 +49,10 @@ function getDictionaryTree(req, res) { } export default { - 'GET /admin-api/admins/admin/menu_resource_tree': getAdminMenu, + 'GET /admin-api/admins/admin/menu_resource_tree': getAdminMenuAll, 'GET /admin-api/admins/admin/url_resource_list': getAdminUrls, 'GET /admin-api/admins/resource/tree': getResourceTree, 'GET /admin-api/admins/role/page': getQueryRole, - 'GET /admin-api/admins/admin/page': getQueryRole, + // 'GET /admin-api/admins/admin/page': getQueryRole, 'GET /admin-api/admins/data_dict/tree': getDictionaryTree, }; diff --git a/admin-web/src/components/Dictionary/DictionaryText.js b/admin-web/src/components/Dictionary/DictionaryText.js index 9ee99f2df..7faf7e329 100644 --- a/admin-web/src/components/Dictionary/DictionaryText.js +++ b/admin-web/src/components/Dictionary/DictionaryText.js @@ -5,6 +5,7 @@ export default class DictionaryText extends PureComponent { componentDidMount() {} render() { + debugger; const { dicKey, dicValue } = this.props; return ( diff --git a/admin-web/src/models/admin/adminList.js b/admin-web/src/models/admin/adminList.js index 89d6d316b..bd1455f36 100644 --- a/admin-web/src/models/admin/adminList.js +++ b/admin-web/src/models/admin/adminList.js @@ -82,6 +82,7 @@ export default { payload: { list: admins, count, + pageNo: payload.pageNo + 1 }, }); }, diff --git a/admin-web/src/pages/Admin/AdminList.js b/admin-web/src/pages/Admin/AdminList.js index b11fbff44..3be15d9fe 100644 --- a/admin-web/src/pages/Admin/AdminList.js +++ b/admin-web/src/pages/Admin/AdminList.js @@ -3,10 +3,12 @@ import React, { PureComponent, Fragment } from 'react'; import { connect } from 'dva'; import { Card, Form, Input, Button, Modal, message, Table, Divider, Tree, Spin } from 'antd'; +import { checkTypeWithEnglishAndNumbers } from '../../../helpers/validator' import PageHeaderWrapper from '@/components/PageHeaderWrapper'; import styles from './AdminList.less'; import moment from "moment"; +import Pagination from "antd/es/pagination"; const FormItem = Form.Item; const { TreeNode } = Tree; @@ -44,18 +46,24 @@ const CreateForm = Form.create()(props => { > {form.getFieldDecorator('username', { - rules: [{ required: true, message: '请输入用户名!', min: 2 }], + rules: [{ required: true, message: '请输入用户名!'}, + {max: 16, min:6, message: '长度为6-16位'}, + { validator: (rule, value, callback) => checkTypeWithEnglishAndNumbers(rule, value, callback, '数字以及字母')} + ], initialValue: initValues.username, })()} {form.getFieldDecorator('nickname', { - rules: [{ required: true, message: '请输入昵称!', min: 2 }], + rules: [{ required: true, message: '请输入昵称!'}, + {max: 10, message: '姓名最大长度为10'}], initialValue: initValues.nickname, })()} {form.getFieldDecorator('password', { + rules: [{ required: modalType === 'add', message: '请填写密码'}, // 添加时,必须输入密码 + {max: 16, min: 6, message: '长度为6-18位'}], initialValue: initValues.password, })()} @@ -304,9 +312,21 @@ class ResourceList extends PureComponent { }); }; + onPageChange = (page = {}) => { + const { dispatch } = this.props; + // debugger; + dispatch({ + type: 'adminList/query', + payload: { + pageNo: page - 1, + pageSize: 10, + } + }); + } + render() { - const { list, data } = this.props; - const { roleList, roleCheckedKeys, roleAssignLoading } = data; + const { list, data } = this.props; + const { count, pageNo, pageSize, roleList, roleCheckedKeys, roleAssignLoading } = data; const { modalVisible, modalType, @@ -335,7 +355,7 @@ class ResourceList extends PureComponent { title: '状态', dataIndex: 'status', render(val) { - return {status[val]}; + return {status[val]}; // TODO 芋艿,此处要改 }, }, { @@ -386,6 +406,12 @@ class ResourceList extends PureComponent { columns={columns} dataSource={list} rowKey="id" + pagination={{ + current: pageNo, + pageSize: pageSize, + total: count, + onChange: this.onPageChange + }} />
diff --git a/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/AdminController.java b/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/AdminController.java index 041671d41..00e92bbfc 100644 --- a/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/AdminController.java +++ b/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/AdminController.java @@ -42,6 +42,8 @@ public class AdminController { // =========== 当前管理员相关的资源 API =========== + // TODO 功能:当前管理员 + @SuppressWarnings("Duplicates") @GetMapping("/menu_resource_tree") @ApiOperation(value = "获得当前登陆的管理员拥有的菜单权限", notes = "以树结构返回") @@ -120,7 +122,7 @@ public class AdminController { public CommonResult update(@RequestParam("id") Integer id, @RequestParam("username") String username, @RequestParam("nickname") String nickname, - @RequestParam("password") String password) { + @RequestParam(value = "password", required = false) String password) { AdminUpdateDTO adminUpdateDTO = new AdminUpdateDTO().setId(id).setUsername(username).setNickname(nickname).setPassword(password); return adminService.updateAdmin(AdminSecurityContextHolder.getContext().getAdminId(), adminUpdateDTO); } diff --git a/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/PassportController.java b/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/PassportController.java index d555f23eb..2c52286f9 100644 --- a/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/PassportController.java +++ b/admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/PassportController.java @@ -3,17 +3,17 @@ package cn.iocoder.mall.admin.application.controller.admins; import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.mall.admin.api.OAuth2Service; import cn.iocoder.mall.admin.api.bo.OAuth2AccessTokenBO; -import cn.iocoder.mall.admin.application.convert.AdminConvert; import cn.iocoder.mall.admin.application.convert.PassportConvert; -import cn.iocoder.mall.admin.application.vo.AdminInfoVO; import cn.iocoder.mall.admin.application.vo.PassportLoginVO; -import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder; import com.alibaba.dubbo.config.annotation.Reference; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("admins/passport") @@ -35,10 +35,8 @@ public class PassportController { return PassportConvert.INSTANCE.convert(result); } - // TODO 艿艿:后续继续完善 - @GetMapping("/info") - public CommonResult info() { - return CommonResult.success(AdminConvert.INSTANCE.convert(AdminSecurityContextHolder.getContext())); - } + // TODO 功能 logout + + // TODO 功能 refresh_token } \ No newline at end of file diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/OAuth2ServiceImpl.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/OAuth2ServiceImpl.java index ca88f7da4..3215002dc 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/OAuth2ServiceImpl.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/OAuth2ServiceImpl.java @@ -77,7 +77,6 @@ public class OAuth2ServiceImpl implements OAuth2Service { } // 获得管理员拥有的角色 List adminRoleDOs = adminService.getAdminRoles(accessTokenDO.getAdminId()); - // TODO 芋艿,有个 bug ,要排除掉已经失效的角色 return CommonResult.success(OAuth2Convert.INSTANCE.convertToAuthentication(accessTokenDO, adminRoleDOs)); } From bb612cac644482591c5d2d24adb87a76b76c7ed2 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Tue, 19 Mar 2019 04:04:20 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=89=8D=E7=AB=AF=EF=BC=9A=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E6=A8=A1=E5=9D=97=E5=A2=9E=E5=8A=A0=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8A=9F=E8=83=BD=E7=9A=84=20ui=20=E3=80=82=E5=85=B7?= =?UTF-8?q?=E4=BD=93=E6=93=8D=E4=BD=9C=E6=9C=AA=E5=AE=8C=E6=88=90~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin-web/src/pages/Admin/AdminList.js | 31 ++++++++++++++++++++++- admin-web/src/pages/Admin/AdminList.less | 32 ++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/admin-web/src/pages/Admin/AdminList.js b/admin-web/src/pages/Admin/AdminList.js index 3be15d9fe..26eb689c6 100644 --- a/admin-web/src/pages/Admin/AdminList.js +++ b/admin-web/src/pages/Admin/AdminList.js @@ -2,7 +2,7 @@ import React, { PureComponent, Fragment } from 'react'; import { connect } from 'dva'; -import { Card, Form, Input, Button, Modal, message, Table, Divider, Tree, Spin } from 'antd'; +import {Card, Form, Input, Button, Modal, message, Table, Divider, Tree, Spin, Row, Col, Select, Icon} from 'antd'; import { checkTypeWithEnglishAndNumbers } from '../../../helpers/validator' import PageHeaderWrapper from '@/components/PageHeaderWrapper'; @@ -324,7 +324,35 @@ class ResourceList extends PureComponent { }); } + renderSimpleForm() { // TODO 芋艿,搜索功能未完成 + const { + form: { getFieldDecorator }, + } = this.props; + return ( +
+ +
+ + {getFieldDecorator('name')()} + + + + + + + + + + + ); + } + render() { + let that = this; const { list, data } = this.props; const { count, pageNo, pageSize, roleList, roleCheckedKeys, roleAssignLoading } = data; const { @@ -391,6 +419,7 @@ class ResourceList extends PureComponent {
+
{that.renderSimpleForm()}