Browse Source

课件资源选择,增加过滤类型处理

zhanghe 7 years ago
parent
commit
437597dc7a

+ 23 - 2
src/routes/Order/Add/index.js

@@ -124,6 +124,15 @@ export default class CreateOrder extends Component {
           merchantPrice: 800,
           terminalPrice: 1000,
         }],
+      },{
+        id: 'package-1',
+        code: '课程包-01',
+        name: '小学一年级语文课程包',
+        type: 'PACKAGE',
+        coverUrl: 'https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png',
+        goods: [{
+
+        }]
       }],
     };
     const { userCode, userName, campusName, merchantName, merchantId, products } = currentItem;
@@ -179,6 +188,7 @@ export default class CreateOrder extends Component {
       render: (text, record) => (
         <InputNumber
           min={0}
+          defaultValue={0}
           formatter={value => `¥ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
           parser={value => value.replace(/\¥\s?|(,*)/g, '')}
         />
@@ -194,8 +204,9 @@ export default class CreateOrder extends Component {
       render: (text, record) => (
         <InputNumber
           min={1}
-          formatter={value => `X ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
-          parser={value => value.replace(/\X\s?|(,*)/g, '')}
+          defaultValue={1}
+          formatter={value => `x ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
+          parser={value => value.replace(/\x\s?|(,*)/g, '')}
         />
       ),
     },{
@@ -229,6 +240,7 @@ export default class CreateOrder extends Component {
             <Form.Item label="添加商品" {...formItemLayout}>
               <Button onClick={this.handleProductSelectBtnClick} disabled={merchantId ? false : true} type="primary" size="small" icon="plus-circle-o">添加</Button>
               <Table
+                size="large"
                 className={styles.table}
                 rowKey={record => record.id}
                 pagination={false}
@@ -268,6 +280,15 @@ export default class CreateOrder extends Component {
           />
         </Card>
         <FooterToolbar>
+          <Dropdown.Button
+            overlay={
+              <Menu>
+                <Menu.Item>¥1000 / 年</Menu.Item>
+                <Menu.Item>¥2000 / 季</Menu.Item>
+              </Menu>
+            }
+          >
+          </Dropdown.Button>
           <Button>取消</Button>
           <Button type="primary">完成</Button>
         </FooterToolbar>

+ 1 - 1
src/routes/Resource/gallery/modal.js

@@ -35,7 +35,7 @@ export default class ModalForm extends PureComponent {
     const {
       form: {
         validateFields,
-        getFieldsValue
+        getFieldsValue,
       },
       item,
       onOk,

+ 7 - 1
src/routes/Ware/Edit/index.js

@@ -26,7 +26,13 @@ export default class WareDetail extends PureComponent {
   handleModalShow = () => {
     const { dispatch } = this.props;
     dispatch({ type: 'wareDetail/showModal' });
-    dispatch({ type: 'resource/query', payload: { pageNo: 1, pageSize: 10 } });
+    dispatch({
+      type: 'resource/query',
+      payload: {
+        pageNo: 1,
+        pageSize: 10,
+      }
+    });
   }
 
   // 取消/关闭 - 隐藏模态框

+ 5 - 3
src/routes/Ware/Edit/modal.js

@@ -70,7 +70,7 @@ export default class ResourceSelectSortModal extends PureComponent {
         dataIndex: 'name',
         key: 'name',
       },{
-        title: '资源类型',
+        title: '类型',
         dataIndex: 'type',
         key: 'type',
         render: (text, record) => (resourceType[record.type]),
@@ -85,7 +85,7 @@ export default class ResourceSelectSortModal extends PureComponent {
         dataIndex: 'url',
         key: 'url',
         render: (text, record) => (
-          Number(record.type) !== Codes.CODE_IMAGE ? <Icon type="video-camera" style={{ fontSize: 40}} /> :
+          record.type !== Codes.CODE_IMAGE ? <Icon type="video-camera" style={{ fontSize: 40}} /> :
             <Popover
               content={<img alt="" src={record.url} width={350} />}
               title={record.name}
@@ -102,10 +102,12 @@ export default class ResourceSelectSortModal extends PureComponent {
         dataIndex: 'name',
         key: 'name',
       },{
-        title: '资源类型',
+        title: '类型',
         dataIndex: 'type',
         key: 'type',
         render: (text, record) => (resourceType[record.type]),
+        filters: Object.keys(resourceType).map(key => ({ text: resourceType[key], value: key })),
+        filterMultiple: false,
       }],
       ...fsTableOpts,
     }

+ 2 - 2
src/services/resource.js

@@ -16,8 +16,8 @@ export async function getSignature (params) {
   }
   */
   // 每次都重新请求签名  TODO: 保存签名到本地减少请求次数
-  // return request(`${signature}?${stringify(params)}`);
-  return request(`http://127.0.0.1:8700`);
+  return request(`${signature}?${stringify(params)}`);
+  // return request(`http://127.0.0.1:8700`);
 }
 
 export async function query (params) {

+ 1 - 1
src/utils/config.js

@@ -30,7 +30,7 @@ Codes.CODE_SEASON = '季';
 Codes.CODE_ITEM = '件';
 
 module.exports = {
-  apiHost: 'http://lj.dev.cms.api.com:8500',
+  apiHost: 'http://47.95.197.36:8500',
   // apiHost: '/api',
   // 每页返回数据量
   pageSize: 10,