Explorar el Código

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager into dev

xujing hace 5 años
padre
commit
1b32e2f2e1

+ 2
- 2
config/config.js Ver fichero

@@ -83,8 +83,8 @@ export default {
83 83
   targets: {
84 84
     ie: 11,
85 85
   },
86
-  // publicPath: './',
87
-  publicPath: 'https://njcjweb.oss-accelerate.aliyuncs.com/admin/',
86
+  publicPath: './',
87
+  // publicPath: 'https://njcjweb.oss-accelerate.aliyuncs.com/admin/',
88 88
   history: 'hash',
89 89
   devtool: isAntDesignProPreview ? 'source-map' : false,
90 90
   // umi routes: https://umijs.org/zh/guide/router.html

+ 36
- 0
src/components/ModalButton/ModalButton.jsx Ver fichero

@@ -0,0 +1,36 @@
1
+import React from 'react';
2
+import { Modal, Button } from 'antd';
3
+
4
+export default function ModalButton(props) {
5
+  const {
6
+    method = 'confirm',
7
+    title = '',
8
+    content = '',
9
+    modalConfigs = {},
10
+    onClick,
11
+    onCancel,
12
+    okText = '确认',
13
+    cancelText = '取消',
14
+    ...btnProps
15
+  } = props || {}
16
+
17
+  const handleClick = e => {
18
+    Modal[method]({
19
+      title,
20
+      content,
21
+      okText,
22
+      cancelText,
23
+      ...modalConfigs,
24
+      onOk() {
25
+        // eslint-disable-next-line no-unused-expressions
26
+        onClick && onClick(e);
27
+      },
28
+      onCancel() {
29
+        // eslint-disable-next-line no-unused-expressions
30
+        onCancel && onCancel();
31
+      },
32
+    })
33
+  }
34
+
35
+  return <Button {...btnProps} onClick={handleClick}>{props.children}</Button>
36
+}

+ 9
- 0
src/components/ModalButton/index.jsx Ver fichero

@@ -0,0 +1,9 @@
1
+import React from 'react';
2
+import ModalButton from './ModalButton';
3
+
4
+const ConfirmButton = props => <ModalButton {...props} method="confirm" />
5
+
6
+export {
7
+  ModalButton,
8
+  ConfirmButton,
9
+}

+ 2
- 4
src/pages/activity/ActivityList.jsx Ver fichero

@@ -175,9 +175,7 @@ const header = props => {
175 175
           <EditIcon type={row.status === 1 ? 'cancel' : 'publish'} text={row.status === 1 ? '取消发布' : '发布'} onClick={sendOrPublicDynamic.bind(this, row)} />
176 176
         </AuthButton>,
177 177
 
178
-    
179
-          <EditIcon type="look" text="查看详情" onClick={getActivityDetail(row.dynamicId)} />,
180
-        
178
+        <EditIcon type="look" text="查看详情" onClick={getActivityDetail(row.dynamicId)} />,
181 179
 
182 180
         row.activityStatus === 0 ?
183 181
           <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
@@ -194,7 +192,7 @@ const header = props => {
194 192
 
195 193
         (row.activityStatus === 0 || row.activityStatus === 1) ?
196 194
           <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
197
-            <EditIcon type="edit" text="编辑" onClick={toEditGoods(row.dynamicId, row.count)} />,
195
+            <EditIcon type="edit" text="编辑" onClick={toEditGoods(row.dynamicId, row.count)} />
198 196
           </AuthButton> : null,
199 197
       ]),
200 198
     },

+ 1
- 1
src/pages/activity/groupActivity/list.jsx Ver fichero

@@ -163,7 +163,7 @@ const header = props => {
163 163
           </AuthButton>,
164 164
             
165 165
           <AuthButton name="admin.taShareActivity.top" noRight={null}>
166
-            <EditIcon type={row.sort === 1 ? 'cancel' : 'add'} text={row.sort === 1 ? '取消推荐首页' : '推荐首页'} onClick={recommendGroupActivity(row)} />
166
+            <EditIcon type={row.sort === 1 ? 'cancel' : 'top'} text={row.sort === 1 ? '取消推荐首页' : '推荐首页'} onClick={recommendGroupActivity(row)} />
167 167
           </AuthButton>,
168 168
 
169 169
           <EditIcon type="record" text="数据记录" onClick={() => toDataReacord(row.groupActivityId)} />,

+ 1
- 1
src/pages/activity/helpActivity/list.jsx Ver fichero

@@ -149,7 +149,7 @@ const header = props => {
149 149
         </AuthButton>,
150 150
 
151 151
         <AuthButton name="admin.help.top" noRight={null}>
152
-          <EditIcon type={row.isMain === 1 ? 'cancel' : 'add'} text={row.isMain === 1 ? '取消推首页' : '推首页'} onClick={topDynamic(row, 1)} />
152
+          <EditIcon type={row.isMain === 1 ? 'cancel' : 'top'} text={row.isMain === 1 ? '取消推首页' : '推首页'} onClick={topDynamic(row, 1)} />
153 153
         </AuthButton>,
154 154
 
155 155
         <EditIcon type="record" text="数据记录" onClick={() => toDataReacord(row.helpActivityId)} />,

+ 12
- 17
src/pages/news/type/NewsType.jsx Ver fichero

@@ -4,6 +4,7 @@ import router from 'umi/router';
4 4
 import AuthButton from '@/components/AuthButton';
5 5
 import withActions from '@/components/ActionList';
6 6
 import EditIcon from '@/components/EditIcon';
7
+import { ConfirmButton } from '@/components/ModalButton';
7 8
 import apis from '../../../services/apis';
8 9
 import request from '../../../utils/request'
9 10
 import BuildSelect from '../../../components/SelectButton/BuildSelect';
@@ -58,21 +59,13 @@ function NewsType(props) {
58 59
 
59 60
 
60 61
   const changeNewsStatus = (row, newsId) => () => {
61
-    Modal.confirm({
62
-      title: '确认删除?',
63
-      okText: '确认',
64
-      cancelText: '取消',
65
-      onOk() {
66
-        request({ ...apis.newsType.put, urlData: { id: newsId }, data: { ...row, status: -1 } }).then((data) => {
67
-          message.info('操作成功!')
68
-          getList({ pageNum: 1, pageSize: 10 });
69
-        }).catch((err) => {
70
-          console.log(err)
71
-          message.info(err.msg || err.message)
72
-        })
73
-
74
-      }
75
-    });
62
+    request({ ...apis.newsType.put, urlData: { id: newsId }, data: { ...row, status: -1 } }).then((data) => {
63
+      message.info('操作成功!')
64
+      getList({ pageNum: 1, pageSize: 10 });
65
+    }).catch((err) => {
66
+      console.log(err)
67
+      message.info(err.msg || err.message)
68
+    })
76 69
   }
77 70
   /**
78 71
    *
@@ -102,7 +95,9 @@ function NewsType(props) {
102 95
       align: 'center',
103 96
       render: withActions((x, row) => [
104 97
         <AuthButton name="admin.taNewsType.id.delete" noRight={null}>
105
-          <EditIcon text={row.status === 1 ? '删除' : '上架'} type={row.status === 1 ? 'delete' : 'up'} onClick={changeNewsStatus(row, row.newsTypeId)} />
98
+          <ConfirmButton type="link" title="确认删除?" onClick={changeNewsStatus(row, row.newsTypeId)}>
99
+            <EditIcon text="删除" type="delete" />
100
+          </ConfirmButton>
106 101
         </AuthButton>,
107 102
         <AuthButton name="admin.taNewsType.id.put" noRight={null}>
108 103
           <EditIcon text="编辑" type="edit" onClick={toEditNews(row.newsTypeId)} />
@@ -110,7 +105,7 @@ function NewsType(props) {
110 105
       ]),
111 106
     },
112 107
   ];
113
-  
108
+
114 109
   function handleReset() {
115 110
     props.form.resetFields();
116 111
     getList({ pageNum: 1, pageSize: 10 })

+ 3
- 3
src/pages/system/document/list.jsx Ver fichero

@@ -1,11 +1,11 @@
1 1
 import React, { useState, useEffect } from 'react'
2 2
 import { Table, Form, Icon, Input, Button, message  } from 'antd'
3
-import request from '../../../utils/request';
4
-import apis from '../../../services/apis';
5 3
 import { router } from 'umi';
6 4
 import moment from 'moment';
7
-import AuthButton from '../../../components/AuthButton';
8 5
 import Navigate from '@/components/Navigate';
6
+import request from '../../../utils/request';
7
+import apis from '../../../services/apis';
8
+import AuthButton from '../../../components/AuthButton';
9 9
 
10 10
 
11 11
 function body(props) {