Quellcode durchsuchen

Merge branch 'master' of http://git.ycjcjy.com/estateagents/pc-channel

顾绍勇 vor 5 Jahren
Ursprung
Commit
4c8e1b94ca

+ 1
- 1
config/config.js Datei anzeigen

@@ -133,7 +133,7 @@ export default {
133 133
 
134 134
   proxy: {
135 135
     '/api': {
136
-      target: 'http://192.168.2.49:8080/',
136
+      target: 'http://127.0.0.1:8080/',
137 137
       changeOrigin: true,
138 138
       // pathRewrite: { '^/server': '' },
139 139
     },

+ 21
- 0
src/app.js Datei anzeigen

@@ -1,3 +1,24 @@
1
+(function (doc, win) {
2
+  var docEl = doc.documentElement,
3
+    resizeEvt = 'onorientationchange' in window ? 'onorientationchange' : 'resize',
4
+    recalc = function () {
5
+      var clientWidth = docEl.clientWidth;
6
+      if (!clientWidth) return;
7
+      if (clientWidth < 1700) {
8
+        docEl.style.fontSize = '150px';
9
+      } else if ( 1700>=clientWidth>2000 ){
10
+        docEl.style.fontSize = '170px';
11
+      }else{
12
+        docEl.style.fontSize = '170px';
13
+        // docEl.style.fontSize = 100 * (clientWidth / 1400) + 'px';
14
+      }
15
+    };
16
+
17
+  if (!doc.addEventListener) return;
18
+  win.addEventListener(resizeEvt, recalc, false);
19
+  doc.addEventListener('DOMContentLoaded', recalc, false);
20
+})(document, window);
21
+
1 22
 export const dva = {
2 23
   config: {
3 24
     onError(e) {

+ 81
- 0
src/components/uploadImage/ImageUpload.jsx Datei anzeigen

@@ -0,0 +1,81 @@
1
+import React from 'react';
2
+import { Upload, Icon, message, Modal } from 'antd';
3
+import './style.less';
4
+import { uploaderProps } from '../../utils/upload';
5
+
6
+
7
+
8
+class ImageUpload extends React.Component {
9
+
10
+  state = {
11
+    loading: false,
12
+    previewVisible: false,
13
+    previewImage: '',
14
+    fileList: this.getPropsFileList(),
15
+  };
16
+
17
+  componentDidUpdate(prevProps) {
18
+    // 直接 setState 会死循环
19
+    if (prevProps.value !== this.props.value) {
20
+      this.setState({ fileList: this.getPropsFileList() })
21
+    }
22
+  }
23
+
24
+  getPropsFileList() {
25
+    return !this.props.value ? [] : [{
26
+      uid: '-1',
27
+      name: 'image.png',
28
+      status: 'done',
29
+      url: this.props.value,
30
+    }]
31
+  }
32
+
33
+
34
+  handleChange = ({ file, fileList }) => {
35
+    const { status, response } = file
36
+    this.setState({ fileList, loading: status === "uploading" })
37
+
38
+    if (typeof this.props.onChange === 'function' && status != "uploading") {
39
+      const image = status === 'done' ? response : undefined
40
+      this.props.onChange(image);
41
+    }
42
+  };
43
+
44
+  handleCancel = () => this.setState({ previewVisible: false });
45
+
46
+  handlePreview = async file => {
47
+    console.log(file)
48
+    this.setState({
49
+      previewImage: file.url,
50
+      previewVisible: true,
51
+    });
52
+  };
53
+
54
+  render() {
55
+    const uploadButton = (
56
+      <div>
57
+        <Icon style={{ fontSize: '2em', color: '#aaa' }} type={this.state.loading ? "loading" : "plus"} />
58
+      </div>
59
+    );
60
+
61
+    return (
62
+      <>
63
+      <Upload
64
+        {...uploaderProps}
65
+        listType="picture-card"
66
+        className="avatar-uploader"
67
+        onChange={this.handleChange}
68
+        fileList={this.state.fileList}
69
+        onPreview={this.handlePreview}
70
+      >
71
+        {this.state.fileList.length >= 1 ? null : uploadButton}  
72
+      </Upload>
73
+      <Modal visible={this.state.previewVisible} footer={null} onCancel={this.handleCancel}>
74
+      <img alt="example" style={{ width: '100%' }} src={this.state.previewImage} />
75
+      </Modal>
76
+      </>
77
+    );
78
+  }
79
+}
80
+
81
+export default ImageUpload;

+ 8
- 0
src/components/uploadImage/style.less Datei anzeigen

@@ -0,0 +1,8 @@
1
+:global {
2
+  .avatar-uploader {
3
+    & > .ant-upload {
4
+      width: 128px;
5
+      height: 128px;
6
+    }
7
+  }
8
+}

+ 1
- 1
src/layouts/BasicLayout.jsx Datei anzeigen

@@ -103,7 +103,7 @@ const BasicLayout = props => {
103 103
 
104 104
         return <Link to={menuItemProps.path}>{defaultDom}</Link>;
105 105
       }}
106
-      breadcrumbRender={(routers = []) => [
106
+      breadcrumbRender={(routers = []) => console.log('---------menuList---->', routers) ||[
107 107
         {
108 108
           path: '/',
109 109
           breadcrumbName: formatMessage({

+ 16
- 1
src/layouts/BlankLayout.jsx Datei anzeigen

@@ -1,5 +1,20 @@
1 1
 import React from 'react';
2
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
2 3
 
3
-const Layout = ({ children }) => <div>{children}</div>;
4
+const Layout = ({ children }) => (
5
+  <PageHeaderWrapper style={{height:'auto',background:'rgba(240,240,240,1)',paddingTop:'15px'}}>
6
+    <div
7
+      style={{
8
+        backgroundColor: '#fff',
9
+        padding: '32PX 28px',
10
+        boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)',
11
+        borderRadius: '12px',
12
+        minHeight:'60vh'
13
+      }}
14
+    >
15
+      {children}
16
+    </div>
17
+  </PageHeaderWrapper>
18
+);
4 19
 
5 20
 export default Layout;

+ 14
- 2
src/pages/sample/demand/edit.jsx Datei anzeigen

@@ -37,30 +37,35 @@ const header = props => {
37 37
         name: 'sampleName',
38 38
         type: FieldTypes.Text,
39 39
         value: data.sampleName,
40
+        props: {disabled: true}
40 41
       },    
41 42
       {
42 43
         label: '下单组织',
43 44
         name: 'orgName',
44 45
         type: FieldTypes.Text,
45 46
         value: data.orgName,
47
+        props: {disabled: true}
46 48
       },
47 49
       {
48 50
         label: '下单人',
49 51
         name: 'orderer',
50 52
         value: data.orderer,
51 53
         type: FieldTypes.Text,
54
+        props: {disabled: true}
52 55
       },
53 56
       {
54 57
         label: '联系方式',
55 58
         name: 'phone',
56 59
         value: data.phone,
57 60
         type: FieldTypes.Text,
61
+        props: {disabled: true}
58 62
       },
59 63
       {
60 64
         label: '下单时间',
61 65
         name: 'createDate',
62 66
         type: FieldTypes.DatePicker ,
63 67
         value: data.createDate != null ? moment(data.createDate, 'YYYY-MM-DD') : null,
68
+        props: {disabled: true}
64 69
       },
65 70
       {
66 71
         label: '需求单状态',
@@ -76,14 +81,21 @@ const header = props => {
76 81
       {
77 82
         label: '备注',
78 83
         name: 'remark',
79
-        type: FieldTypes.Text,
80 84
         value: data.remark,
85
+        render: <Input placeholder="不超过100个字" maxLength = "100"/>
86
+      },
87
+      {
88
+        label: '最后修改时间',
89
+        name: 'updateDate',
90
+        type: FieldTypes.DatePicker ,
91
+        value: data.updateDate != null ? moment(data.updateDate, 'YYYY-MM-DD') : null,
92
+        props: {disabled: true}
81 93
       },
82 94
       {
83 95
         label: '需求描述',
84 96
         name: 'demandContent',
85 97
         value: data.demandContent,
86
-        render: <Wangedit />
98
+        render: <Wangedit contenteditable={false}/>
87 99
       },
88 100
     ]
89 101
   

+ 11
- 2
src/pages/sample/demand/index.jsx Datei anzeigen

@@ -50,7 +50,16 @@ function header(props) {
50 50
   }
51 51
 
52 52
   const changePageNum = (pageNumber) => {
53
-    getList({ pageNum: pageNumber, pageSize: 10 })
53
+    let {createDate, ...submitValue}  = props.form.getFieldsValue()
54
+    if(null != createDate && createDate.length > 0){
55
+      const [startCreateDate, endCreateDate] = createDate
56
+      submitValue.startCreateDate = moment(startCreateDate).format('YYYY-MM-DD');
57
+      submitValue.endCreateDate = moment(endCreateDate).format('YYYY-MM-DD');
58
+    }else{
59
+      submitValue.startCreateDate = null
60
+      submitValue.endCreateDate = null
61
+    }
62
+    getList({ pageNum: pageNumber, pageSize: 10, ...submitValue })
54 63
   }
55 64
 
56 65
   const rowSelection = {
@@ -131,7 +140,7 @@ function header(props) {
131 140
       dataIndex: 'createDate',
132 141
       key: 'createDate',
133 142
       align: 'center',
134
-      render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD')}`}</span></>,
143
+      render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
135 144
     },
136 145
     {
137 146
       title: '需求单状态',

+ 23
- 12
src/pages/sample/h5/components/H5Card.jsx Datei anzeigen

@@ -12,7 +12,7 @@ const { Meta } = Card
12 12
 const H5Card = props => {
13 13
   const { h5Data } = props
14 14
 
15
-  const colerArr = ["#2db7f5","#87d068","#108ee9","magenta","red","volcano","orange","green","geekblue","purple"]
15
+  const colerArr = ["#2db7f5", "#87d068", "#108ee9", "magenta", "red", "volcano", "orange", "green", "geekblue", "purple"]
16 16
   const toEdit = () => {
17 17
     router.push({
18 18
       pathname: '/sample/h5/edit',
@@ -29,7 +29,7 @@ const H5Card = props => {
29 29
       okText: '确认',
30 30
       cancelText: '取消',
31 31
       onOk() {
32
-        request({ ...apis.sample.puth5, urlData: { id: h5Data.sampleId }}).then((data) => {
32
+        request({ ...apis.sample.puth5, urlData: { id: h5Data.sampleId } }).then((data) => {
33 33
           message.info('操作成功!')
34 34
           props.onChange()
35 35
         }).catch((err) => {
@@ -40,24 +40,35 @@ const H5Card = props => {
40 40
     });
41 41
   }
42 42
 
43
-    return (
44
-      <>
43
+  return (
44
+    <>
45 45
       <Card
46 46
         hoverable
47
-        style={{ width: 480,height: 450,marginTop: 50,position: "relative" }}
48
-        cover={<img height="335px" alt="example" onClick={toEdit} src={h5Data.coverImg} />}
47
+        style={{
48
+          minWidth: '240px',
49
+          marginRight: '0.1rem',
50
+          height: '2.1rem',
51
+          background: 'rgba(255, 255, 255, 1)',
52
+          boxShadow: '0px 0px 16px 2px rgba(0, 0, 0, 0.12)',
53
+          borderRadius: '12px',
54
+          marginBottom: '0.1rem',
55
+          position: 'relative',
56
+          padding: '0.1rem'
57
+        }}
58
+        // style={{ width: 480,height: 450,marginTop: 50,position: "relative" }}
59
+        cover={<img  width="100%" style={{height:'1.3rem'}} alt="example" onClick={toEdit} src={h5Data.coverImg} />}
49 60
         extra={<a onClick={deleteSample}>删除</a>}
50 61
         title={h5Data.status == 1 ? '已发布' : h5Data.status == 0 ? '未发布' : ''}
51 62
       >
52 63
         <Meta onClick={toEdit} title={h5Data.sampleName} />
53
-        <div style={{position: "absolute", bottom: "50px", right: "20px", margin: '20px 0'}}>
54
-          {(h5Data.tags || []).map((x,i) => {
64
+        <div style={{ position: "absolute", bottom: "50px", right: "20px", margin: '20px 0' }}>
65
+          {(h5Data.tags || []).map((x, i) => {
55 66
             return <Tag color={colerArr[i]}>{x}</Tag>
56 67
           })}
57 68
         </div>
58 69
       </Card>
59 70
     </>
60
-    )
61
-  }
62
- 
63
-  export default H5Card
71
+  )
72
+}
73
+
74
+export default H5Card

+ 3
- 4
src/pages/sample/h5/components/SelectContact.jsx Datei anzeigen

@@ -76,7 +76,6 @@ const SelectContact = props => {
76 76
       key: 'drainageId',
77 77
       align: 'center',
78 78
       ellipsis: true,
79
-      render: text => <a>{text}</a>,
80 79
     },
81 80
     {
82 81
       title: '性别',
@@ -84,7 +83,7 @@ const SelectContact = props => {
84 83
       key: 'drainageId',
85 84
       align: 'center',
86 85
       ellipsis: true,
87
-      render: text => <a>{text}</a>,
86
+    render: text => <span>{text == 1 ? '男' : text == 2 ? '女' : '' }</span>,
88 87
     },
89 88
     {
90 89
       title: '头像',
@@ -92,7 +91,7 @@ const SelectContact = props => {
92 91
       key: 'drainageId',
93 92
       align: 'center',
94 93
       ellipsis: true,
95
-      render: text => <a>{text}</a>,
94
+      render: text => <img src={text} width="40px" height="40px"/>,
96 95
     },
97 96
     {
98 97
       title: '固话',
@@ -135,7 +134,7 @@ const SelectContact = props => {
135 134
   return (
136 135
     <div>
137 136
       <Row gutter={24}>
138
-        <Col span={2}><div onClick={() => setVisible(true)}>{group.groupName}</div></Col>
137
+        <Col span={2}><div onClick={() => setVisible(true)}><a>{group.groupName}</a></div></Col>
139 138
         <Col span={16}><div>
140 139
         {selectedData.map(x => {
141 140
           return <Tag size="large" key={x.contactId} closable onClose={() => removeSelected(x)}>{x.contactName}</Tag>

+ 16
- 13
src/pages/sample/h5/edit.jsx Datei anzeigen

@@ -1,23 +1,23 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert, Radio } from 'antd';
2
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert, Radio, InputNumber } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import XForm, { FieldTypes } from '../../../components/XForm';
5 5
 import router from 'umi/router';
6 6
 import apis from '../../../services/apis';
7 7
 import request from '../../../utils/request';
8 8
 import Wangedit from '../../../components/Wangedit/Wangedit'
9
-import ImageUpload from '../../../components/XForm/ImageUpload'
9
+import ImageUpload from '../../../components/uploadImage/ImageUpload'
10 10
 import SelectContact from './components/SelectContact';
11 11
 import moment from 'moment';
12 12
 
13 13
 const formItemLayout = {
14 14
   labelCol: {
15
-    xs: { span: 24 },
16
-    sm: { span: 2 },
15
+    xs: { span: 6 },
16
+    sm: { span: 6 },
17 17
   },
18 18
   wrapperCol: {
19
-    xs: { span: 24 },
20
-    sm: { span: 16 },
19
+    xs: { span: 18 },
20
+    sm: { span: 18 },
21 21
   },
22 22
 };
23 23
 
@@ -52,7 +52,6 @@ const header = props => {
52 52
       // e.stopPropagation();
53 53
       props.form.validateFieldsAndScroll((err, values) => {
54 54
         console.log(values,"valuesvaluesvaluesvaluesvaluesvaluesvalues")
55
-        debugger
56 55
         if (!err) {
57 56
           if(sampleId){
58 57
             request({ ...apis.sample.updateh5, urlData: { id: sampleId }, data: { ...values }}).then((data) => {
@@ -79,6 +78,7 @@ const header = props => {
79 78
     }
80 79
 
81 80
     function sampleTypeChange(e) {
81
+      console.log(data,"111111111111")
82 82
       setTypeState(e.target.value)
83 83
     }
84 84
   
@@ -116,19 +116,19 @@ const header = props => {
116 116
           </Form.Item>
117 117
           <Form.Item label="发布状态" >
118 118
             {getFieldDecorator('status', {
119
-              initialValue: "1",
119
+              initialValue: 1,
120 120
             })(
121 121
             <Select style={{ width: '180px' }}>
122
-              <Select.Option value="1">是</Select.Option>
123
-              <Select.Option value="0">否</Select.Option>
122
+              <Select.Option value={1}>是</Select.Option>
123
+              <Select.Option value={0}>否</Select.Option>
124 124
             </Select>)}
125 125
           </Form.Item>
126 126
           <Form.Item label="权重" help="数值越大越靠前">
127
-            {getFieldDecorator('orderNo')(<Input />)}
127
+            {getFieldDecorator('orderNo')(<InputNumber placeholder="权重越大,在列表中的排序越靠前" />)}
128 128
           </Form.Item>
129 129
           <Form.Item label="标签" help="标签长度6个字,最多3个标签">
130 130
             {getFieldDecorator('tags')(
131
-              <Select mode="tags" placeholder="输入后选中" style={{ width: '1016px' }}>
131
+              <Select mode="tags" placeholder="输入标签,回车确认后再输入下一个" style={{ width: '1016px' }}>
132 132
 
133 133
               </Select>,
134 134
             )}
@@ -145,11 +145,14 @@ const header = props => {
145 145
           </Form.Item>
146 146
           {typeState === 'link' && <Form.Item label="外部链接">
147 147
             {getFieldDecorator('sampleContentLink',{
148
+              initialValue: data.sampleContentLink,
148 149
               rules: [{ max: 300, message: '外部链接不超过300个字符' }],
149 150
             })(<Input placeholder="填写外部链接,如公众号链接或135编辑器生成的页面链接" />)}
150 151
           </Form.Item>}
151 152
           {typeState === 'rich' && <Form.Item label="样例内容" >
152
-            {getFieldDecorator('sampleContent')(
153
+            {getFieldDecorator('sampleContent', {
154
+              rules: [{ required: true, message: '请输入样例内容' }],
155
+            })(
153 156
               <Wangedit />,
154 157
             )}
155 158
           </Form.Item> }

+ 2
- 1
src/pages/sample/h5/index.jsx Datei anzeigen

@@ -33,6 +33,7 @@ function header(props) {
33 33
   // 提交事件
34 34
   const handleSubmit = (e, props) => {
35 35
     e.preventDefault();
36
+    e.stopPropagation();
36 37
     props.form.validateFields((err, values) => {
37 38
       if (!err) {
38 39
         let {createDate, ...submitValue} = values
@@ -44,7 +45,7 @@ function header(props) {
44 45
           submitValue.startCreateDate = null
45 46
           submitValue.endCreateDate = null
46 47
         }
47
-        getList({ pageNum: 1, pageSize: 10, ...values })
48
+        getList({ pageNum: 1, pageSize: 10, ...submitValue })
48 49
       }
49 50
     });
50 51
   }