diff --git a/admin-web/config/proxy/proxy.dev.js b/admin-web/config/proxy/proxy.dev.js
index fd07c075a..0608bd7b3 100644
--- a/admin-web/config/proxy/proxy.dev.js
+++ b/admin-web/config/proxy/proxy.dev.js
@@ -2,7 +2,8 @@
export default {
'/admin-api/': {
- target: 'http://180.167.213.26:18083/',
+ // target: 'http://180.167.213.26:18083/',
+ target: 'http://127.0.0.1:18083/',
changeOrigin: true,
pathRewrite: {},
},
@@ -11,4 +12,9 @@ export default {
changeOrigin: true,
pathRewrite: {},
},
+ '/promotion-api/': {
+ target: 'http://127.0.0.1:18085/',
+ changeOrigin: true,
+ pathRewrite: {},
+ },
};
diff --git a/admin-web/config/router.config.js b/admin-web/config/router.config.js
index db32843b6..920467940 100644
--- a/admin-web/config/router.config.js
+++ b/admin-web/config/router.config.js
@@ -94,6 +94,29 @@ export default [
},
],
},
+ // promotion
+ {
+ path: '/promotion',
+ name: 'promotion',
+ icon: 'user',
+ routes: [
+ {
+ path: '/promotion/banner-list',
+ name: 'promotion-banner-list',
+ component: './Promotion/BannerList',
+ },
+ // {
+ // path: '/product/product-spu-add',
+ // name: 'product-spu-add',
+ // component: './Product/ProductSpuAddOrUpdate',
+ // },
+ // {
+ // path: '/product/product-category-list',
+ // name: 'product-category-list',
+ // component: './Product/ProductCategoryList',
+ // },
+ ],
+ },
{
path: '/dashboard',
name: 'dashboard',
diff --git a/admin-web/mock/admin.js b/admin-web/mock/admin.js
index be9c114b2..96a6da174 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': 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/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/data_dict/tree': getDictionaryTree,
+ // 'GET /admin-api/admins/data_dict/tree': getDictionaryTree,
};
diff --git a/admin-web/src/locales/zh-CN/menu.js b/admin-web/src/locales/zh-CN/menu.js
index 37dee7786..111932c6a 100644
--- a/admin-web/src/locales/zh-CN/menu.js
+++ b/admin-web/src/locales/zh-CN/menu.js
@@ -52,4 +52,6 @@ export default {
// 订单
'menu.order': '订单管理',
'menu.order.order-list': '订单管理',
+ // 营销相关
+ 'menu.promotion.promotion-banner-list': 'Banner 管理'
};
diff --git a/admin-web/src/models/promotion/bannerList.js b/admin-web/src/models/promotion/bannerList.js
new file mode 100644
index 000000000..ce4d46ada
--- /dev/null
+++ b/admin-web/src/models/promotion/bannerList.js
@@ -0,0 +1,256 @@
+import {message} from 'antd';
+import {buildTreeNode, findCheckedKeys} from '../../utils/tree.utils';
+import {
+ addBanner,
+ adminRoleAssign,
+ deleteBanner,
+ queryBanner,
+ queryBannerRoleList,
+ updateBanner,
+ updateBannerStatus,
+} from '../../services/promotion';
+import {arrayToStringParams} from '../../utils/request.qs';
+import PaginationHelper from '../../../helpers/PaginationHelper';
+
+const SEARCH_PARAMS_DEFAULT = {
+ title: '',
+};
+
+export default {
+ namespace: 'bannerList',
+
+ state: {
+ // 分页列表相关
+ list: [],
+ listLoading: false,
+ pagination: PaginationHelper.defaultPaginationConfig,
+ searchParams: SEARCH_PARAMS_DEFAULT,
+
+ // 添加 or 修改表单相关
+ modalVisible: false,
+ modalType: undefined, // 'add' or 'update' 表单
+ formVals: {}, // 当前表单值
+ modalLoading: false,
+
+ // 分配角色表单相关
+ roleList: [],
+ roleModalVisible: false,
+ roleCheckedKeys: [], // 此处的 Key ,就是角色编号
+ roleAssignLoading: false,
+ },
+
+ effects: {
+ // 查询列表
+ * query({ payload }, { call, put }) {
+ // 显示加载中
+ yield put({
+ type: 'changeListLoading',
+ payload: true,
+ });
+
+ // 请求
+ const response = yield call(queryBanner, payload);
+ // 响应
+ yield put({
+ type: 'setAll',
+ payload: {
+ list: response.data.list,
+ pagination: PaginationHelper.formatPagination(response.data, payload),
+ searchParams: {
+ title: payload.title || ''
+ }
+ },
+ });
+
+ // 隐藏加载中
+ yield put({
+ type: 'changeListLoading',
+ payload: false,
+ });
+ },
+ * add({ payload }, { call, put }) {
+ const { callback, body } = payload;
+ // 显示加载中
+ yield put({
+ type: 'changeModalLoading',
+ payload: true,
+ });
+
+ // 请求
+ const response = yield call(addBanner, body);
+ // 响应
+ if (response.code === 0) {
+ if (callback) {
+ callback(response);
+ }
+ // 刷新列表
+ yield put({
+ type: 'query',
+ payload: {
+ ...PaginationHelper.defaultPayload
+ },
+ });
+ }
+
+ // 隐藏加载中
+ yield put({
+ type: 'changeModalLoading',
+ payload: false,
+ });
+ },
+ * update({ payload }, { call, put }) {
+ const { callback, body } = payload;
+ // 显示加载中
+ yield put({
+ type: 'changeModalLoading',
+ payload: true,
+ });
+
+ // 请求
+ const response = yield call(updateBanner, body);
+ // 响应
+ if (response.code === 0) {
+ if (callback) {
+ callback(response);
+ }
+ // 刷新列表
+ yield put({
+ type: 'query',
+ payload: {
+ ...PaginationHelper.defaultPayload
+ },
+ });
+ }
+
+ // 隐藏加载中
+ yield put({
+ type: 'changeModalLoading',
+ payload: false,
+ });
+ },
+
+ * updateStatus({ payload }, { call, put }) {
+ // 请求
+ const response = yield call(updateBannerStatus, payload);
+ // 响应
+ if (response.code === 0) {
+ message.info('更新状态成功!');
+ // 刷新列表
+ yield put({
+ type: 'query',
+ payload: {
+ ...PaginationHelper.defaultPayload
+ },
+ });
+ }
+ },
+
+ * delete({ payload }, { call, put }) {
+ // 请求
+ const response = yield call(deleteBanner, payload);
+ // 响应
+ if (response.code === 0) {
+ message.info('删除成功!');
+ // 刷新列表
+ yield put({
+ type: 'query',
+ payload: {
+ ...PaginationHelper.defaultPayload
+ },
+ });
+ }
+ },
+
+ * queryRoleList({ payload }, { call, put }) {
+ // 显示加载中
+ yield put({
+ type: 'changeRoleAssignLoading',
+ payload: true,
+ });
+
+ // 请求
+ const response = yield call(queryBannerRoleList, payload);
+ // 响应
+ if (response.code === 0) {
+ const roleList = response.data;
+ const roleTreeData = buildTreeNode(roleList, 'name', 'id');
+ const roleCheckedKeys = findCheckedKeys(roleList);
+ yield put({
+ type: 'setAll',
+ payload: {
+ roleList: roleTreeData,
+ roleCheckedKeys,
+ },
+ });
+ }
+
+ // 隐藏加载中
+ yield put({
+ type: 'changeRoleAssignLoading',
+ payload: false,
+ });
+ },
+
+ * roleAssign({ payload }, { call, put }) {
+ const { callback, body } = payload;
+ // 显示加载中
+ yield put({
+ type: 'changeRoleAssignLoading',
+ payload: true,
+ });
+
+ // 请求
+ const response = yield call(adminRoleAssign, {
+ id: body.id,
+ roleIds: arrayToStringParams(body.roleIds),
+ });
+ // 响应
+ if (response.code === 0) {
+ if (callback) {
+ callback(response);
+ }
+ }
+
+ // 隐藏加载中
+ yield put({
+ type: 'changeRoleAssignLoading',
+ payload: false,
+ });
+ },
+ },
+
+ reducers: {
+ changeRoleCheckedKeys(state, { payload }) {
+ return {
+ ...state,
+ roleCheckedKeys: payload,
+ };
+ },
+ // 修改加载中的状态
+ changeRoleAssignLoading(state, { payload }) {
+ return {
+ ...state,
+ roleAssignLoading: payload,
+ };
+ },
+ changeModalLoading(state, { payload }) {
+ return {
+ ...state,
+ modalLoading: payload,
+ };
+ },
+ changeListLoading(state, { payload }) {
+ return {
+ ...state,
+ listLoading: payload,
+ };
+ },
+ // 设置所有属性
+ setAll(state, { payload }) {
+ return {
+ ...state,
+ ...payload,
+ };
+ }
+ },
+};
diff --git a/admin-web/src/pages/Product/ProductCategoryList.js b/admin-web/src/pages/Product/ProductCategoryList.js
index 2709c7dcf..b5738a29f 100644
--- a/admin-web/src/pages/Product/ProductCategoryList.js
+++ b/admin-web/src/pages/Product/ProductCategoryList.js
@@ -209,7 +209,6 @@ class ProductCategoryList extends PureComponent {
{
title: '排序值',
dataIndex: 'sort',
- render: sort => {sort},
},
{
title: '创建时间',
diff --git a/admin-web/src/pages/Promotion/BannerList.js b/admin-web/src/pages/Promotion/BannerList.js
new file mode 100644
index 000000000..3643eca25
--- /dev/null
+++ b/admin-web/src/pages/Promotion/BannerList.js
@@ -0,0 +1,416 @@
+/* eslint-disable */
+
+import React, { PureComponent, Fragment } from 'react';
+import { connect } from 'dva';
+import {
+ Card,
+ Form,
+ Input,
+ Button,
+ Modal,
+ message,
+ Table,
+ Divider,
+ Tree,
+ Spin,
+ Row,
+ Col,
+ Select,
+ Icon,
+ InputNumber
+} from 'antd';
+import { checkTypeWithEnglishAndNumbers } from '../../../helpers/validator'
+import PageHeaderWrapper from '@/components/PageHeaderWrapper';
+
+import styles from './BannerList.less';
+import moment from "moment";
+import PaginationHelper from "../../../helpers/PaginationHelper";
+
+const FormItem = Form.Item;
+const { TreeNode } = Tree;
+const status = ['未知', '正常', '禁用'];
+
+// 列表
+function List ({ dataSource, loading, pagination, searchParams, dispatch,
+ handleModalVisible}) {
+
+ function handleStatus(record) {
+ Modal.confirm({
+ title: record.status === 1 ? '确认禁用' : '取消禁用',
+ content: `${record.username}`,
+ onOk() {
+ dispatch({
+ type: 'bannerList/updateStatus',
+ payload: {
+ id: record.id,
+ status: record.status === 1 ? 2 : 1,
+ },
+ });
+ },
+ onCancel() {},
+ });
+ }
+
+ function handleDelete(record) {
+ Modal.confirm({
+ title: `确认删除?`,
+ content: `${record.title}`,
+ onOk() {
+ dispatch({
+ type: 'bannerList/delete',
+ payload: {
+ id: record.id,
+ },
+ });
+ },
+ onCancel() {},
+ });
+ }
+
+ const columns = [
+ {
+ title: '标题',
+ dataIndex: 'title'
+ },
+ {
+ title: '跳转链接',
+ dataIndex: 'url',
+ },
+ {
+ title: '图片',
+ dataIndex: 'picUrl',
+ render(val) {
+ return ;
+ },
+ },
+ {
+ title: '排序值',
+ dataIndex: 'sort',
+ },
+ {
+ title: '状态',
+ dataIndex: 'status',
+ render(val) {
+ return {status[val]}; // TODO 芋艿,此处要改
+ },
+ },
+ {
+ title: '备注',
+ dataIndex: 'memo',
+ },
+ {
+ title: '创建时间',
+ dataIndex: 'createTime',
+ render: val => {moment(val).format('YYYY-MM-DD HH:mm')},
+ },
+ {
+ title: '操作',
+ width: 360,
+ render: (text, record) => {
+ const statusText = record.status === 1 ? '禁用' : '开启'; // TODO 芋艿,此处要改
+ return (
+