dingxin il y a 5 ans
Parent
révision
a554f73db2

+ 1
- 1
config/config.js Voir le fichier

@@ -479,7 +479,7 @@ export default {
479 479
 
480 480
   proxy: {
481 481
     '/api/': {
482
-      target: 'http://192.168.0.11:8080/',
482
+      target: 'http://192.168.0.84:8080/',
483 483
       changeOrigin: true,
484 484
       // pathRewrite: { '^/server': '' },
485 485
     },

+ 1
- 0
package.json Voir le fichier

@@ -55,6 +55,7 @@
55 55
     "path-to-regexp": "^3.0.0",
56 56
     "qs": "^6.7.0",
57 57
     "react": "^16.8.6",
58
+    "react-amap": "^1.2.8",
58 59
     "react-copy-to-clipboard": "^5.0.1",
59 60
     "react-document-title": "^2.0.3",
60 61
     "react-dom": "^16.8.6",

+ 18
- 0
src/app.js Voir le fichier

@@ -1,3 +1,21 @@
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 >= 750) {
8
+//         docEl.style.fontSize = '100px';
9
+//       } else {
10
+//         docEl.style.fontSize = 100 * (clientWidth / 750) + 'px';
11
+//       }
12
+//     };
13
+
14
+//   if (!doc.addEventListener) return;
15
+//   win.addEventListener(resizeEvt, recalc, false);
16
+//   doc.addEventListener('DOMContentLoaded', recalc, false);
17
+// })(document, window);
18
+
1 19
 export const dva = {
2 20
   config: {
3 21
     onError(e) {

+ 15
- 2
src/components/SelectButton/BuildSelect.jsx Voir le fichier

@@ -1,10 +1,18 @@
1
-import React, { useState, useEffect } from 'react';
1
+import React, { useState, useEffect, useRef } from 'react';
2 2
 import { Select } from 'antd';
3 3
 
4 4
 import request from '../../utils/request'
5 5
 
6 6
 const { Option } = Select;
7 7
 
8
+function usePrevious(props) {
9
+  const ref = useRef();
10
+  useEffect(() => {
11
+    ref.current = props;
12
+  });
13
+  return ref.current;
14
+}
15
+
8 16
 /**
9 17
  *
10 18
  *
@@ -13,7 +21,12 @@ const { Option } = Select;
13 21
  */
14 22
 const BuildingSelect = (props) => {
15 23
   const [ data, setData ] = useState([])
16
-  const [ value, setValue ] = useState(props.value)
24
+  const [ value, setValue ] = useState('')
25
+  const preProps = usePrevious(props)
26
+  
27
+  if ((!preProps || !preProps.value) && props.value && !value) {
28
+    setValue(props.value)
29
+  }
17 30
 
18 31
   useEffect(() => {
19 32
     getCityList();

+ 4
- 1
src/global.less Voir le fichier

@@ -79,9 +79,12 @@ ol {
79 79
 .ant-menu-vertical-left .ant-menu-submenu-title,
80 80
 .ant-menu-vertical-right .ant-menu-submenu-title,
81 81
 .ant-menu-inline .ant-menu-submenu-title,
82
-.ant-input ,.ant-btn{
82
+.ant-input ,.ant-btn,.ant-select,.ant-table,.ant-form-item,.ant-form label,.ant-tabs-nav-container {
83 83
   font-size: 16px;
84 84
 }
85
+.ant-row.ant-form-item .ant-form-item-label.ant-col-sm-3{
86
+  min-width: 100px;
87
+}
85 88
 .ant-breadcrumb{
86 89
   font-size: 16px;
87 90
   .anticon {

+ 1
- 1
src/models/login.js Voir le fichier

@@ -50,7 +50,7 @@ const Model = {
50 50
     *logout(_, { put, call }) {
51 51
       const { redirect } = getPageQuery(); // redirect
52 52
 
53
-      yield call(signout, { logout: true });
53
+      yield call(signout);
54 54
 
55 55
       if (window.location.pathname !== '/user/login' && !redirect) {
56 56
         yield put(

+ 1
- 1
src/pages/activity/editActivity.jsx Voir le fichier

@@ -245,7 +245,7 @@ const Edit = (props) => {
245 245
               textOverflow: 'ellipsis'
246 246
             }}>{inputValue ? inputValue : '海报标题'}</p>
247 247
 
248
-            <img src={yinhao} style={{ width: '30px', marginLeft: '10px' }} alt="" />
248
+            <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
249 249
             <p style={{
250 250
               margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
251 251
               display: '-webkit-box', lineClamp: '3', height: '76px',

+ 20
- 0
src/pages/building/list/add/components/amap.jsx Voir le fichier

@@ -0,0 +1,20 @@
1
+import React from 'react';
2
+import ReactDOM from 'react-dom';
3
+import { Map } from 'react-amap';
4
+
5
+class Amap extends React.Component {
6
+  constructor(props) {
7
+    super(props)
8
+    this.state = { coordinates: [] }
9
+  }
10
+
11
+  render() {
12
+    return (
13
+      <div style={{ width: '100%', height: '400px' }}>
14
+        <Map amapkey="f0d1d4f82432504003ebf46e5e36ff03"/>
15
+      </div>
16
+    )
17
+  }
18
+}
19
+
20
+export default Amap

+ 4
- 2
src/pages/building/list/add/components/base.jsx Voir le fichier

@@ -9,6 +9,7 @@ import ImageUpload from '../../../../../components/XForm/ImageUpload'
9 9
 import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
10 10
 import Wangedit from '../../../../../components/Wangedit/Wangedit'
11 11
 import TagGroup from './tags'
12
+import Amap from './amap'
12 13
 import BudildingProjectType from './buildingProjectType'
13 14
 
14 15
 const { Option } = Select
@@ -79,6 +80,7 @@ function AddBuilding(props) {
79 80
     const api = data.buildingId === undefined ? apis.building.addBuilding : apis.building.updateBuilding
80 81
     request({ ...api, data: { ...data } }).then(() => {
81 82
       openNotificationWithIcon('success', '操作成功')
83
+      router.go(-1)
82 84
     }).catch(err => {
83 85
       openNotificationWithIcon('error', err.message)
84 86
     })
@@ -104,7 +106,7 @@ function AddBuilding(props) {
104 106
           <Form.Item label="均价" hasFeedback>
105 107
             {getFieldDecorator('price')(<Input />)}
106 108
           </Form.Item>
107
-          <Form.Item label="开盘时间" hasFeedback>
109
+          <Form.Item label="开盘时间"  hasFeedback>
108 110
             {getFieldDecorator('openingDate')(<DatePicker format="YYYY/MM/DD" />)}
109 111
           </Form.Item>
110 112
           <Form.Item label="电话" hasFeedback>
@@ -176,7 +178,7 @@ function AddBuilding(props) {
176 178
             {getFieldDecorator('coordinate')(<Input disabled />)}
177 179
           </Form.Item>
178 180
           <Form.Item label="地图位置" hasFeedback>
179
-            {(<Input />)}
181
+            {(<Amap />)}
180 182
           </Form.Item>
181 183
           <Form.Item label="周边交通" hasFeedback>
182 184
             {getFieldDecorator('buildingTransport')(

+ 57
- 74
src/pages/building/list/add/components/buildingProjectType.jsx Voir le fichier

@@ -51,35 +51,33 @@ class TypeForm extends React.Component {
51 51
 
52 52
     return (
53 53
       <>
54
-        <div>
55
-          <Row>
56
-            <Col span={8}>{ this.props.type.buildingTypeName || ''}</Col>
57
-            <Col span={1}>
58
-              <Button type="link" icon="close" onClick={() => this.close()} />
59
-            </Col>
60
-          </Row>
61
-          <Row>
62
-            <Col span={12}>
63
-              <Form {...formItemLayout}>
64
-                <Form.Item label="类型编号" style={{ display: 'none' }}>
65
-                  {getFieldDecorator('buildingTypeId')(<Input disabled />)}
66
-                </Form.Item>
67
-                <Form.Item label="状态" style={{ display: 'none' }}>
68
-                  {getFieldDecorator('status')(<Input disabled />)}
69
-                </Form.Item>
70
-                <Form.Item label="价格">
71
-                  {getFieldDecorator('price')(<Input type="number" placeholder="元/㎡" onChange={e => this.onChange(e, 'price')}/>)}
72
-                </Form.Item>
73
-                <Form.Item label="装修标准">
74
-                  {getFieldDecorator('decoration')(<Input onChange={e => this.onChange(e, 'decoration')}/>)}
75
-                </Form.Item>
76
-                <Form.Item label="产权年限">
77
-                  {getFieldDecorator('rightsYear')(<Input onChange={e => this.onChange(e, 'rightsYear')}/>)}
78
-                </Form.Item>
79
-              </Form>
80
-            </Col>
81
-          </Row>
82
-        </div>
54
+        <Col span={11} style={{
55
+          position: 'relative',
56
+          border: '1px solid #eee',
57
+          borderRadius: '4px',
58
+          marginTop:'16px'
59
+        }}>
60
+
61
+          <p style={{ padding: '20px', borderBottom: '1px solid #eee' }}>{this.props.type.buildingTypeName || ''}  <Button type="link" style={{ position: 'absolute', right: '16px' }} icon="close" onClick={() => this.close()} /></p>
62
+
63
+          <Form {...formItemLayout} style={{ padding: '10px 0px 10px 10px' }}>
64
+            <Form.Item label="类型编号" style={{ display: 'none' }}>
65
+              {getFieldDecorator('buildingTypeId')(<Input disabled />)}
66
+            </Form.Item>
67
+            <Form.Item label="状态" style={{ display: 'none' }}>
68
+              {getFieldDecorator('status')(<Input disabled />)}
69
+            </Form.Item>
70
+            <Form.Item label="价格">
71
+              {getFieldDecorator('price')(<Input type="number" placeholder="元/㎡" onChange={e => this.onChange(e, 'price')} />)}
72
+            </Form.Item>
73
+            <Form.Item label="装修标准">
74
+              {getFieldDecorator('decoration')(<Input onChange={e => this.onChange(e, 'decoration')} />)}
75
+            </Form.Item>
76
+            <Form.Item label="产权年限">
77
+              {getFieldDecorator('rightsYear')(<Input onChange={e => this.onChange(e, 'rightsYear')} />)}
78
+            </Form.Item>
79
+          </Form>
80
+        </Col>
83 81
       </>
84 82
     )
85 83
   }
@@ -119,10 +117,7 @@ class ProjectTypeBody extends React.Component {
119 117
   }
120 118
 
121 119
   onSuccess = (values, item) => {
122
-    console.log('values: ', values)
123
-    console.log('data: ', this.state.data, 'item: ', item)
124 120
     const newData = this.getNewProjectType(values)
125
-    console.log('newData: ', newData)
126 121
     this.setState({ data: newData })
127 122
     if (typeof this.props.onChange === 'function') {
128 123
       this.props.onChange(newData)
@@ -130,22 +125,20 @@ class ProjectTypeBody extends React.Component {
130 125
   }
131 126
 
132 127
   onCheckboxChange = checkedValues => {
133
-      const checked = (`${checkedValues}` || '').split(',')
134
-      const { projectType } = this.state
135
-      const buildingType = projectType.filter(item => checked.includes(`${item.buildingTypeId}`))
128
+    // console.log('checkedValues: ', checkedValues)
129
+    const checked = (`${checkedValues}` || '').split(',')
130
+    const { projectType } = this.state
131
+    const buildingType = projectType.filter(item => checked.includes(`${item.buildingTypeId}`))
136 132
 
137
-      // 这里会把值替换掉
138
-
139
-      const tempDate = buildingType.map(item => ({ buildingTypeId: item.buildingTypeId, buildingTypeName: item.buildingTypeName, price: '', decoration: '', rightsYear: '', status: '1' }))
140
-      const updateProjectDate = this.updateProjectType(checkedValues)
141
-      console.log('updateProjectDate: ', updateProjectDate)
142
-      this.setState({ data: updateProjectDate })
133
+    const tempDate = buildingType.map(item => ({ buildingTypeId: item.buildingTypeId, buildingTypeName: item.buildingTypeName, price: '', decoration: '', rightsYear: '', status: '1' }))
134
+    const updateProjectDate = this.updateProjectType(tempDate)
135
+    console.log('updateProjectDate: ', updateProjectDate)
136
+    this.setState({ data: updateProjectDate })
143 137
   }
144 138
 
145 139
   onClose = e => {
146 140
     const { data } = this.state
147 141
     const buildingType = data.filter(item => e.buildingTypeId !== item.buildingTypeId)
148
-    console.log('buildingType: ', buildingType)
149 142
     this.setState({ data: buildingType })
150 143
     this.setState({ defaultCheckboxValue: buildingType.map(item => item.buildingTypeId) })
151 144
   }
@@ -153,7 +146,6 @@ class ProjectTypeBody extends React.Component {
153 146
   getNewProjectType = values => {
154 147
     const data = []
155 148
     this.state.data.map(item => {
156
-      console.log('item: ', item)
157 149
       if (item.buildingTypeId === values.buildingTypeId) {
158 150
         data.push(values)
159 151
       } else {
@@ -165,18 +157,22 @@ class ProjectTypeBody extends React.Component {
165 157
   }
166 158
 
167 159
   updateProjectType = values => {
168
-    const data = []
169
-    this.state.data.map(item => {
170
-      values.map(va => {
171
-        if (item.buildingTypeId === va.buildingTypeId) {
172
-          data.push(va)
173
-        } else {
174
-          data.push(item)
175
-        }
176
-      })
177
-    })
160
+    // 获取所有复选框选中的id
161
+    const valueIdArray = values.map(item => item.buildingTypeId)
162
+    // console.log('valueIdArray: ', valueIdArray)
178 163
 
179
-    return data
164
+    // 获取 data 中已经赋值的数据  交集
165
+    const valueData = this.state.data.filter(item => valueIdArray.includes(item.buildingTypeId))
166
+    // console.log('valueData: ', valueData)
167
+
168
+    // 获取 非 data中数据(也就是没有赋值),交集
169
+    const trueValueArr = valueData.map(item => item.buildingTypeId)
170
+    const trueValueData = values.filter(item => !trueValueArr.includes(item.buildingTypeId))
171
+
172
+    // console.log('trueValueData: ', trueValueData)
173
+
174
+    // 把两个 数组的值,合并返回
175
+    return valueData.concat(trueValueData)
180 176
   }
181 177
 
182 178
   getList = params => {
@@ -196,11 +192,7 @@ class ProjectTypeBody extends React.Component {
196 192
       tempData = value
197 193
       tempCheckboxValue = tempData.map(item => item.buildingTypeId)
198 194
       this.setState({ defaultCheckboxValue: tempCheckboxValue })
199
-      this.setState({ data: tempData }, () => {
200
-        console.log("state: ", this.state.data)
201
-      })
202
-
203
-      console.log("tempData: ", tempData, "tempCheckboxValue: ", tempCheckboxValue, "value: ", value)
195
+      this.setState({ data: tempData })
204 196
     }
205 197
   }
206 198
 
@@ -228,18 +220,7 @@ class ProjectTypeBody extends React.Component {
228 220
     this.getList({ pageNum: 1, pageSize: 999 })
229 221
   }
230 222
 
231
-  render () {
232
-
233
-    // let tempData = []
234
-    // let tempCheckboxValue = []
235
-    // const { value } = this.props
236
-    // if (value !== undefined && value !== null) {
237
-    //   tempData = value
238
-    // } else {
239
-    //   tempData = this.state.data
240
-    // }
241
-
242
-    // tempCheckboxValue = tempData.map(item => item.buildingTypeId)
223
+  render() {
243 224
     return (
244 225
       <>
245 226
         <Button type="primary" icon="plus" size="large" onClick={() => this.showMadel()} />
@@ -251,9 +232,11 @@ class ProjectTypeBody extends React.Component {
251 232
         >
252 233
           <Checkbox.Group options={this.state.projectType.map(item => ({ label: item.buildingTypeName, value: item.buildingTypeId }))} defaultValue={this.state.defaultCheckboxValue} onChange={e => this.onCheckboxChange(e)} />
253 234
         </Modal>
254
-        {
255
-          this.state.data.map(item => <WrappedTypeForm type={item} key={item.id} onSuccess={(e) => this.onSuccess(e, item)} onClose={(e) => this.onClose(e)} />)
256
-        }
235
+        <Row type="flex" justify="space-between">
236
+          {
237
+            this.state.data.map(item => <WrappedTypeForm type={item} key={item.id} onSuccess={(e) => this.onSuccess(e, item)} onClose={(e) => this.onClose(e)} />)
238
+          }
239
+        </Row>
257 240
       </>
258 241
     )
259 242
   }

+ 10
- 1
src/pages/building/list/add/components/imageSet.jsx Voir le fichier

@@ -61,6 +61,15 @@ function imageSet(props) {
61 61
     })
62 62
   }
63 63
 
64
+  /**
65
+   *回调事件
66
+   *
67
+   */
68
+  function onModalChange() {
69
+    getList()
70
+    setVisibleData({ visible: false, apartmentId: '', buildingId: '' })
71
+  }
72
+
64 73
   /**
65 74
    *打开编辑页
66 75
    *
@@ -138,7 +147,7 @@ function imageSet(props) {
138 147
 
139 148
       {/* 编辑页 */}
140 149
       {/*  onSuccess是子组件传递事件信息  */}
141
-      <ModalImage visibleData={visibleData} key={1} onSuccess={getList}/>
150
+      <ModalImage visibleData={visibleData} key={1} onSuccess={() => onModalChange()}/>
142 151
     </>
143 152
   )
144 153
 }

+ 6
- 5
src/pages/building/list/add/components/modalImage.jsx Voir le fichier

@@ -5,6 +5,7 @@ import request from '../../../../../utils/request';
5 5
 import apis from '../../../../../services/apis';
6 6
 import Styles from '../style.less';
7 7
 import ImageUpload from '../../../../../components/XForm/ImageUpload'
8
+import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
8 9
 import Wangedit from '../../../../../components/Wangedit/Wangedit'
9 10
 
10 11
 
@@ -61,8 +62,8 @@ class ModalImage extends React.Component {
61 62
   // }
62 63
 
63 64
   componentDidUpdate(preProps, preState) {
64
-    console.log(this.props.visibleData)
65 65
     if (this.props.visibleData.visible !== preState.visibleData.visible) {
66
+      console.log(this.props.visibleData)
66 67
       this.getById()
67 68
       this.setState({ visibleData: this.props.visibleData });
68 69
     }
@@ -91,7 +92,7 @@ class ModalImage extends React.Component {
91 92
 
92 93
     request({ url: tempUrl, method, params: { ...params } }).then(res => {
93 94
       // res.img = res.buildingImgList.map((item, _) => item.url)
94
-      res.img = res.buildingImgList[0].url
95
+      res.img = res.buildingImgList.map(item => item.url)
95 96
       this.props.form.setFieldsValue(res)
96 97
     }).catch(err => {
97 98
      this.openNotificationWithIcon('error', err)
@@ -118,7 +119,7 @@ class ModalImage extends React.Component {
118 119
 
119 120
   submitData(data) {
120 121
     // TODO 这里应该是要支持多图,但是封装的控件没有
121
-    data.img = [{ imgType: 'aparment', url: data.img, orderNo: 1 }]
122
+    data.img = data.img.map((item, index) => ({ imgType: 'aparment', url: item, orderNo: index }))
122 123
     data.buildingId = this.props.visibleData.buildingId;
123 124
     const api = data.apartmentId !== undefined ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
124 125
 
@@ -131,7 +132,7 @@ class ModalImage extends React.Component {
131 132
       // onSuccess() 是自定义
132 133
       this.props.onSuccess()
133 134
 
134
-      this.handleCancel()
135
+      // this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } }, () => console.log('回调:', this.state.visibleData))
135 136
     }).catch(err => {
136 137
       // eslint-disable-next-line no-unused-expressions
137 138
       this.openNotificationWithIcon('error', err)
@@ -186,7 +187,7 @@ class ModalImage extends React.Component {
186 187
               </Form.Item>
187 188
               <Form.Item label="图片">
188 189
               {getFieldDecorator('img')(
189
-                <ImageUpload />,
190
+                <ImageListUpload />,
190 191
               )}
191 192
               </Form.Item>
192 193
               <Form.Item label="面积">

+ 129
- 0
src/pages/building/list/add/components/poster.jsx Voir le fichier

@@ -0,0 +1,129 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import BuildSelect from '../../../../../components/SelectButton/BuildSelect'
7
+import XForm, { FieldTypes } from '../../../../../components/XForm';
8
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
9
+import request from '../../../../../utils/request'
10
+import PosterBottom from '../../../../../assets/bottom.png'
11
+import yinhao from '../../../../../assets/yinhao.png'
12
+import ImageUploader from '../../../../../components/XForm/ImageUpload';
13
+import poster1 from '../../../../../assets/poster1.png';
14
+import poster2 from '../../../../../assets/poster2.png';
15
+import Styles from '../style.less';
16
+
17
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
18
+const { TextArea } = Input;
19
+
20
+const Poster = props => {
21
+  const [inputValue, changeInput] = useState('')
22
+  const [textAreaValue, changeTextArea] = useState('')
23
+  const [imgValue, changeImg] = useState('')
24
+  const [posterId, setPosterId] = useState('')
25
+
26
+  const { buildingId } = props.building
27
+
28
+  if (buildingId) {
29
+    // eslint-disable-next-line react-hooks/rules-of-hooks
30
+    useEffect(() => {
31
+      request({
32
+        url: '/api/admin/poster',
33
+        method: 'GET',
34
+        params: { targetId: buildingId, targetType: 'building' },
35
+      }).then(data => {
36
+        console.log(data, '2222')
37
+        if (data.length > 0) {
38
+          setPosterId(data[0].posterId)
39
+          changeImg(data[0].posterImg)
40
+          changeTextArea(data[0].posterDescription)
41
+          changeInput(data[0].posterTitle)
42
+        }
43
+      }).catch(err => {
44
+        message.info(err.msg || err.message)
45
+      })
46
+    }, [])
47
+  }
48
+
49
+  const submitPoster = () => {
50
+    if (buildingId) {
51
+      if (posterId) {
52
+        request({
53
+          url: `/api/admin/poster/${posterId}`,
54
+          method: 'PUT',
55
+          data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
56
+        }).then(() => {
57
+          message.info('保存成功')
58
+        }).catch(err => {
59
+          message.info(err.msg || err.message)
60
+        })
61
+      } else {
62
+        request({
63
+          url: '/api/admin/poster',
64
+          method: 'POST',
65
+          data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
66
+        }).then(data => {
67
+          setPosterId(data.posterId)
68
+          message.info('保存成功')
69
+        }).catch(err => {
70
+          message.info(err.msg || err.message)
71
+        })
72
+      }
73
+    } else {
74
+      message.warn('请先保存基本信息数据')
75
+    }
76
+  }
77
+
78
+  return <div>
79
+    <div style={{ display: 'flex' }}>
80
+      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
81
+        <div style={{ width: '375px', height: '785px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
82
+          <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
83
+
84
+          <p className={Styles.tagLabel}><span>全朝南</span><span>品牌开发商</span><span>轨交房</span></p>
85
+          <p style={{
86
+            margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
87
+            display: '-webkit-box', lineClamp: '3', height: '36px',lineHeight:'36px',
88
+            WebkitLineClamp: '1',
89
+            WebkitBoxOrient: 'vertical',
90
+            overflow: 'hidden',
91
+            textOverflow: 'ellipsis',
92
+          }}>{inputValue || '海报标题'}</p>
93
+          <p style={{ color: '#999',padding:' 0 20px' }}>约<span style={{ color: '#fd0d0c', fontSize: '24px',marginLeft:'6px' }}>41505</span><span style={{ color: '#fd0d0c', fontSize: '20px' }}>元/m²</span></p>
94
+
95
+          <img src={yinhao} style={{ width: '30px', marginLeft: '22px' }} alt="" />
96
+          <p style={{
97
+            margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
98
+            display: '-webkit-box', lineClamp: '3', height: '76px',
99
+            WebkitLineClamp: '3',
100
+            WebkitBoxOrient: 'vertical',
101
+            overflow: 'hidden',
102
+            textOverflow: 'ellipsis',
103
+          }}>{textAreaValue || '海报描述'}</p>
104
+          <img src={PosterBottom} style={{ width: '100%' }} alt="" />
105
+        </div>
106
+        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
107
+      </div>
108
+      <div >
109
+        <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
110
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
111
+          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
112
+        </div>
113
+        <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
114
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
115
+          <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
116
+        </div>
117
+        <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
118
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
119
+          <TextArea rows={5} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
120
+        </div>
121
+
122
+      </div>
123
+    </div>
124
+    <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
125
+    <Button onClick={() => router.go(-1)}>取消</Button>
126
+  </div>
127
+}
128
+
129
+export default Poster

+ 97
- 0
src/pages/building/list/add/components/share.jsx Voir le fichier

@@ -0,0 +1,97 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import BuildSelect from '../../../../../components/SelectButton/BuildSelect'
7
+import XForm, { FieldTypes } from '../../../../../components/XForm';
8
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
9
+import request from '../../../../../utils/request'
10
+import PosterBottom from '../../../../../assets/bottom.png'
11
+import yinhao from '../../../../../assets/yinhao.png'
12
+import ImageUploader from '../../../../../components/XForm/ImageUpload';
13
+import logo from '../../../../../assets/logo.png';
14
+import touxiang from '../../../../../assets/touxiang.jpg';
15
+import poster1 from '../../../../../assets/poster1.png';
16
+import poster2 from '../../../../../assets/poster2.png';
17
+
18
+const Share = props => {
19
+  const [inputValue, changeInput] = useState('')
20
+  const [imgValue, changeImg] = useState('')
21
+  const [shareContentId, setShareContentId] = useState('')
22
+
23
+  const { buildingId } = props.building
24
+  if (buildingId) {
25
+    // eslint-disable-next-line react-hooks/rules-of-hooks
26
+    useEffect(() => {
27
+      request({
28
+        url: '/api/admin/shareContent',
29
+        method: 'GET',
30
+        params: { targetId: buildingId, targetType: 'building' },
31
+      }).then(data => {
32
+        if (data.length > 0) {
33
+          setShareContentId(data[0].shareContentId)
34
+          changeImg(data[0].shareContentImg)
35
+          changeInput(data[0].shareContentTitle)
36
+        }
37
+      }).catch(err => {
38
+        message.info(err.msg || err.message)
39
+      })
40
+    }, [])
41
+  }
42
+
43
+  const submitShare = () => {
44
+    if (buildingId) {
45
+      if (shareContentId) {
46
+        request({
47
+          url: `/api/admin/shareContent/${shareContentId}`,
48
+          method: 'PUT',
49
+          data: { targetId: buildingId, shareContentType: 'building',shareContentImg: imgValue,shareContentTitle: inputValue },
50
+        }).then(data => {
51
+          message.info('保存成功')
52
+        }).catch(err => {
53
+          message.info(err.msg || err.message)
54
+        })
55
+       } else {
56
+        request({
57
+          url: '/api/admin/shareContent',
58
+          method: 'POST',
59
+          data: { targetId: buildingId, shareContentType: 'building',shareContentImg: imgValue,shareContentTitle: inputValue },
60
+        }).then(data => {
61
+          setShareContentId(data.shareContentId)
62
+          message.info('保存成功')
63
+        }).catch(err => {
64
+          message.info(err.msg || err.message)
65
+        })
66
+       }
67
+     } else {
68
+      message.warn('请先保存基本信息数据')
69
+     }
70
+  }
71
+
72
+  return <div style={{ padding: '20px' }}>
73
+    <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
74
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
75
+      <div>
76
+        <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}>
77
+          <img src={logo} style={{ width: '22px', marginRight: '10px' }} />
78
+          知与行互动
79
+        </p>
80
+        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
81
+        <img style={{ width: '200px', height: '140px' }} src={imgValue ? imgValue : poster2} alt="" />
82
+      </div>
83
+    </div>
84
+    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
85
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
86
+      <Input placeholder="请输入海报标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
87
+    </div>
88
+    <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
89
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
90
+      <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
91
+    </div>
92
+    <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
93
+    <Button onClick={() => router.go(-1)}>取消</Button>
94
+  </div>
95
+}
96
+
97
+export default Share

+ 42
- 15
src/pages/building/list/add/index.jsx Voir le fichier

@@ -12,6 +12,8 @@ import Wangedit from '../../../../components/Wangedit/Wangedit'
12 12
 import TagGroup from './components/tags'
13 13
 import Base from './components/base'
14 14
 import ImageSet from './components/imageSet'
15
+import Poster from './components/poster'
16
+import Share from './components/share'
15 17
 
16 18
 
17 19
 const { Option } = Select
@@ -29,25 +31,50 @@ const formItemLayout = {
29 31
 };
30 32
 
31 33
 function AddBuilding(props) {
32
-  function tabsCallback(key) {
33
-    console.log(key);
34
+
35
+  const [tab, setTab] = useState('base')
36
+
37
+  function tabsCallback(e) {
38
+    console.log(e);
39
+    setTab(e.target.value)
34 40
   }
35 41
 
36
-  console.log(props.location)
42
+  // console.log(props.location)
37 43
 
38 44
   return (
39
-    <Tabs defaultActiveKey="1" onChange={tabsCallback}>
40
-      <TabPane tab="基本信息" key="1">
41
-        <Base building={{ buildingId: props.location.query && props.location.query.id }} />
42
-      </TabPane>
43
-      {
44
-        props.location.query.id &&
45
-        <TabPane tab="图片" key="2">
46
-          {/* '159fd19bb973b6972c10fbebf07ddeb1' */}
47
-          <ImageSet building={{ buildingId: props.location.query && props.location.query.id }} />
48
-        </TabPane>
49
-      }
50
-    </Tabs>
45
+    <>
46
+      <Radio.Group value={ tab } buttonStyle="solid" onChange={e => tabsCallback(e)}>
47
+        <Radio.Button value="base">基本信息</Radio.Button>
48
+        {
49
+          props.location.query.id &&
50
+          (
51
+            <>
52
+              <Radio.Button value="image">图片</Radio.Button>
53
+              <Radio.Button value="poster">海报图片</Radio.Button>
54
+              <Radio.Button value="share">分享设置</Radio.Button>
55
+            </>
56
+          )
57
+        }
58
+      </Radio.Group>
59
+      <div style={{ marginTop: '20px' }}>
60
+        { tab === 'base' && <Base building={{ buildingId: props.location.query && props.location.query.id }} /> }
61
+        { props.location.query.id && (tab === 'image' && <ImageSet building={{ buildingId: props.location.query && props.location.query.id }} />)}
62
+        { props.location.query.id && (tab === 'poster' && <Poster building={{ buildingId: props.location.query && props.location.query.id }} />)}
63
+        { props.location.query.id && (tab === 'share' && <Share building={{ buildingId: props.location.query && props.location.query.id }} />)}
64
+      </div>
65
+    </>
66
+    // <Tabs defaultActiveKey="1" onChange={tabsCallback}>
67
+    //   <TabPane tab="基本信息" key="1">
68
+    //     <Base building={{ buildingId: props.location.query && props.location.query.id }} />
69
+    //   </TabPane>
70
+    //   {
71
+    //     props.location.query.id &&
72
+    //     <TabPane tab="图片" key="2">
73
+    //       {/* '159fd19bb973b6972c10fbebf07ddeb1' */}
74
+    //       <ImageSet building={{ buildingId: props.location.query && props.location.query.id }} />
75
+    //     </TabPane>
76
+    //   }
77
+    // </Tabs>
51 78
   )
52 79
 }
53 80
 

+ 20
- 0
src/pages/building/list/add/style.less Voir le fichier

@@ -0,0 +1,20 @@
1
+.tagLabel{
2
+  padding: 14px 20px 0 20px;
3
+  margin: 0 0 5px 0;
4
+  span{
5
+    padding: 2px 8px;
6
+    font-size: 10px;
7
+    background-color: #e1f7eb;
8
+    color: #3de180;
9
+    border-radius: 2px;
10
+    margin-right: 10px;
11
+  }
12
+  span:nth-child(3n+2){
13
+    color: #72a0d1;
14
+    background-color: #eaeff5;
15
+  }
16
+  span:nth-child(3n+3){
17
+    color: #ff5858;
18
+    background-color: #fff0f1;
19
+  }
20
+}

+ 4
- 4
src/pages/building/type/index.jsx Voir le fichier

@@ -20,7 +20,7 @@ function body() {
20 20
       title: '类型名称',
21 21
       dataIndex: 'buildingTypeName',
22 22
       key: 'buildingTypeName',
23
-      render: (_, record) => <Tag color="blue" onClick={() => toEdi(record.buildingTypeId)}>{ record.buildingTypeName }</Tag>,
23
+      render: (_, record) => <Tag color="blue" onClick={() => toEdi(record.buildingTypeId)}>{record.buildingTypeName}</Tag>,
24 24
     },
25 25
     {
26 26
       title: '创建时间',
@@ -35,9 +35,9 @@ function body() {
35 35
       render: (_, record) => (
36 36
         <span onClick={() => deleteType(record)}>
37 37
           <span style={{
38
-              color: '#FF4A4A', right: '0',
38
+            color: '#FF4A4A', right: '0',
39 39
           }} >
40
-              删除
40
+            删除
41 41
           <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
42 42
           </span>
43 43
         </span>
@@ -97,7 +97,7 @@ function body() {
97 97
   return (
98 98
     <>
99 99
       <Button type="danger" onClick={() => toEdi()}>新增类型</Button>
100
-      <Table style={{marginTop:'30px'}} dataSource={data.records} columns={columns} pagination={false}/>
100
+      <Table style={{ marginTop: '30px' }} dataSource={data.records} columns={columns} pagination={false} />
101 101
       {/* 分页 */}
102 102
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
103 103
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={onChange} />

+ 31
- 31
src/pages/staff/list/StaffList.jsx Voir le fichier

@@ -29,16 +29,16 @@ const toEditStaff = (userId) => () => {
29 29
  */
30 30
 const CartBody = (props) => {
31 31
   const { data } = props
32
-    
32
+
33 33
   const confirm = () => {
34 34
     Modal.confirm({
35 35
       title: '确认停用该角色?',
36 36
       okText: '确认',
37 37
       cancelText: '取消',
38
-      onOk () {
38
+      onOk() {
39 39
         console.log('OK');
40 40
       },
41
-      onCancel () {
41
+      onCancel() {
42 42
         console.log('Cancel');
43 43
       },
44 44
     });
@@ -49,14 +49,18 @@ const CartBody = (props) => {
49 49
       <div>
50 50
 
51 51
         <Avatar src={data.avatar} style={{ width: 94, height: 94 }} />
52
-        <span className={Styles.ediText} style={{ marginLeft: '20px' }} onClick={toEditStaff(data.userId)}>
52
+        <Button type="link" style={{ marginLeft: '10px', color: '#FF925C', fontSize: '18px' }} onClick={toEditStaff(data.userId)}>
53 53
           编辑
54
-                <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
55
-        </span>
56
-        <span className={Styles.ediText} style={{ marginLeft: '50px' }} onClick={confirm}>
54
+                <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
55
+        </Button>
56
+        <Button type="link" style={{ fontSize: '18px', color: '#cacaca', position: 'absolute', top: '50px', right: '0' }} onClick={confirm}>
57 57
           停用
58
-                <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
59
-        </span>
58
+                <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
59
+        </Button>
60
+        <Button type="link" style={{ fontSize: '18px', color: '#FF925C', position: 'absolute', top: '50px', right: '0' }} onClick={confirm}>
61
+          启用
62
+                <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
63
+        </Button>
60 64
 
61 65
       </div>
62 66
       <div>
@@ -69,14 +73,11 @@ const CartBody = (props) => {
69 73
           }
70 74
         </span>
71 75
 
72
-        <p className={Styles.cardText} style={{ width: '300px' }}>
73
-          <span>姓名:{data.userName}</span>
74
-
75
-          <span style={{ float: "right" }}>状态:{data.status === '1' ? '启用' : '停用'}</span>
76
-
76
+        <p className={Styles.cardText} >姓名 : {data.userName}
77 77
         </p>
78
-        <p className={Styles.cardText} style={{ width: '300px' }}>
79
-          <span>电话:{data.phone}</span>
78
+        <p className={Styles.statusText} > 状态 : {data.status === '1' ? '启用' : '停用'} </p>
79
+        <p className={Styles.phoneText} >
80
+          电话 : {data.phone}
80 81
         </p>
81 82
       </div>
82 83
 
@@ -86,10 +87,10 @@ const CartBody = (props) => {
86 87
 
87 88
 
88 89
 const header = (props) => {
89
-  const [tempData,setTempData] = useState([])
90
+  const [tempData, setTempData] = useState([])
90 91
   useEffect(() => {
91 92
     getList({ pageNum: 1, pageSize: 10 });
92
-  },[])
93
+  }, [])
93 94
 
94 95
   const getList = (params) => {
95 96
     request({
@@ -97,8 +98,8 @@ const header = (props) => {
97 98
       method: 'GET',
98 99
       params: { ...params },
99 100
     }).then((data) => {
100
-        console.log(data,"listData")
101
-        setTempData(data.records)
101
+      console.log(data, "listData")
102
+      setTempData(data.records)
102 103
     })
103 104
   }
104 105
 
@@ -108,15 +109,15 @@ const header = (props) => {
108 109
   }
109 110
 
110 111
   // 提交事件
111
-const handleSubmit = (e, props) => {
112
-  e.preventDefault();
113
-  props.form.validateFields((err, values) => {
114
-    if (!err) {
115
-      console.log('提交数据: ', values)
116
-      getList({ pageNum: 1, pageSize: 10, ...values })
117
-    }
118
-  });
119
-}
112
+  const handleSubmit = (e, props) => {
113
+    e.preventDefault();
114
+    props.form.validateFields((err, values) => {
115
+      if (!err) {
116
+        console.log('提交数据: ', values)
117
+        getList({ pageNum: 1, pageSize: 10, ...values })
118
+      }
119
+    });
120
+  }
120 121
 
121 122
   const { getFieldDecorator } = props.form
122 123
   return (
@@ -156,8 +157,7 @@ const handleSubmit = (e, props) => {
156 157
           </Button>
157 158
         </Form.Item>
158 159
       </Form>
159
-      <Button type="danger" className={styles.addBtn} onClick={toEditStaff()}>新增</Button>
160
-
160
+      <Button type="danger" style={{ margin: '20px 0', padding: '2px 36px' }} onClick={toEditStaff()}>新增</Button>
161 161
       <Row style={{ padding: ' 0 10px' }}>
162 162
         {
163 163
           tempData.map((item, index) => (

+ 3
- 11
src/pages/staff/list/editStaff.jsx Voir le fichier

@@ -26,8 +26,6 @@ const Edit = (props) => {
26 26
   const [userData, setUserData] = useState({})
27 27
   const [tagData, setTagData] = useState([])
28 28
 
29
-  console.log(userData,"user----》")
30
-
31 29
   const getTagList = () => {
32 30
     request({
33 31
       url: '/api/admin/taTags',
@@ -61,7 +59,6 @@ const Edit = (props) => {
61 59
   }
62 60
 
63 61
   const handleSubmit = val => {
64
-    window.console.log('submit data --->', val)
65 62
     if(userId){
66 63
       request({
67 64
         url: '/api/admin/taUser/' + userId,
@@ -148,10 +145,7 @@ const Edit = (props) => {
148 145
       label: '授权项目',
149 146
       name: 'buildingId',
150 147
       render: <BuildSelect />,
151
-      value: userData.buildingId,
152
-      rules: [
153
-        { required: true, message: '请选择所属项目' },
154
-      ],
148
+      value: userData.buildingId
155 149
     },
156 150
     {
157 151
       label: '图片',
@@ -180,11 +174,9 @@ const Edit = (props) => {
180 174
     },
181 175
   ]
182 176
 
183
-  return <XForm onSubmit={handleSubmit} fields={fields}></XForm>
184
-
185
-
186
-
177
+  console.log('--------->', fields)
187 178
 
179
+  return <XForm onSubmit={handleSubmit} fields={fields}></XForm>
188 180
 }
189 181
 
190 182
 

+ 22
- 30
src/pages/staff/list/style.less Voir le fichier

@@ -11,33 +11,37 @@
11 11
   border: 1px solid #dbdbdb;
12 12
 }
13 13
 
14
-.addButton {
15
-  // background: #50be00;
16
-  border-radius: 4px;
17
-  border: 0px;
18
-  margin: 10px 0px;
19
-}
20 14
 
21 15
 .card {
22
-  width: 348px;
16
+  min-width: 330px;
17
+  margin-right: 2vw;
23 18
   height: 244px;
24 19
   background: rgba(255, 255, 255, 1);
25 20
   box-shadow: 0px 0px 16px 2px rgba(0, 0, 0, 0.12);
26 21
   border-radius: 12px;
27 22
   margin-bottom: 40px;
28
-
23
+  position: relative;
29 24
 }
30 25
 
31
-.cardText {
32 26
 
33
-  height: 28px;
27
+.cardText {
34 28
   font-size: 20px;
35
-  font-weight: 400;
36 29
   color: rgba(102, 102, 102, 1);
37
-  line-height: 28px;
38
-  margin-top: 10px;
39
-  margin-bottom: 0;
40
-
30
+  position: absolute;
31
+  bottom:36px;
32
+}
33
+.statusText {
34
+  font-size: 20px;
35
+  color: rgba(102, 102, 102, 1);
36
+  position: absolute;
37
+  bottom:36px;
38
+  right: 20px;
39
+}
40
+.phoneText{
41
+  font-size: 20px;
42
+  color: rgba(102, 102, 102, 1);
43
+  position: absolute;
44
+  bottom:0px;
41 45
 }
42 46
 
43 47
 .cardItem {
@@ -49,26 +53,15 @@
49 53
   align-items: center;
50 54
 }
51 55
 
52
-.ediText {
53
-  width: 36px;
54
-  height: 25px;
55
-  font-size: 18px;
56
-
57
-  font-weight: 400;
58
-  color: rgba(255, 146, 92, 1);
59
-  line-height: 25px;
60
-
61
-}
62 56
 
63 57
 .cardTag {
64
-  height: 18px;
65 58
   font-size: 10px;
66
-  // background: #fdce22;
67 59
   border-radius: 4px;
68 60
   color: #ffffff;
69
-  line-height: 14px;
61
+  line-height: 16px;
70 62
   margin-top: 10px;
71 63
   padding: 1px 3px;
64
+
72 65
 }
73 66
 
74 67
 .title {
@@ -76,13 +69,12 @@
76 69
   width: 84px;
77 70
   justify-content: space-between;
78 71
   text-align: justify;
79
-  text-align-last: justify
72
+  text-align-last: justify;
80 73
 }
81 74
 
82 75
 
83 76
 .roletext {
84 77
   font-size: 20px;
85
-
86 78
   font-weight: 400;
87 79
   color: rgba(51, 51, 51, 1);
88 80
   line-height: 28px;

+ 2
- 0
src/services/apis.js Voir le fichier

@@ -19,10 +19,12 @@ export default {
19 19
     signin: {
20 20
       method: 'POST',
21 21
       url: `${prefix}/taUser/signin`,
22
+      login: true
22 23
     },
23 24
     signout: {
24 25
       method: 'POST',
25 26
       url: `${prefix}/taUser/signout`,
27
+      logout: true
26 28
     },
27 29
   },
28 30
   building: {

+ 1
- 1
src/utils/mixStr.js Voir le fichier

@@ -12,7 +12,7 @@ const fill2Len = (str, len) => {
12 12
   return str.repeat(Math.floor(len / orginLen)) + str.substr(0, len % orginLen)
13 13
 }
14 14
 
15
-const mixChars = window.navigator.userAgent + (new Date).toUTCString().replace(/\d{2}:\d{2}:\d{2}/, '')
15
+const mixChars = window.navigator.userAgent // + (new Date).toUTCString().replace(/\d{2}:\d{2}:\d{2}/, '')
16 16
 
17 17
 const strXOR = (str, mix) => {
18 18
   if (!str) return str

+ 4
- 3
src/utils/request.js Voir le fichier

@@ -33,15 +33,16 @@ const replaceURLParams = (url, params = {}) => {
33 33
 }
34 34
 
35 35
 request.interceptors.request.use((url, options) => {
36
-  const { urlData, headers = {}, logout = false, data, ...opts } = options
36
+  const { urlData, headers = {}, logout = false, login = false, data, ...opts } = options
37 37
   const apiURL = urlData ? replaceURLParams(url, urlData) : url
38 38
   const token = mixStr(window.localStorage.getItem('test-foobar'))
39
-  const authHeader = token ? { Authorization: `Bearer ${token}` } : {}
40 39
 
41
-  if (logout) {
40
+  if (login || logout) {
42 41
     window.localStorage.removeItem('test-foobar')
43 42
   }
44 43
 
44
+  const authHeader = !login ? { Authorization: `Bearer ${token}` } : {}
45
+
45 46
   return (
46 47
     {
47 48
       url: apiURL,