Commit b087a5a0 by zhangleyuan

feat:课程分类退出登录等进行接口联调

parent 31522557
/* /*
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-31 09:34:25 * @Date: 2020-08-31 09:34:25
* @LastEditors: wufan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-02 16:00:39 * @LastEditTime: 2020-12-04 11:37:33
* @Description: * @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -43,7 +43,12 @@ class User { ...@@ -43,7 +43,12 @@ class User {
setToken(value:any) { setToken(value:any) {
return Storage.set(`${PREFIX}_token`,value); return Storage.set(`${PREFIX}_token`,value);
} }
removeToken(){
return Storage.remove(`${PREFIX}_token`);
}
removeUserId(){
return Storage.remove(`${PREFIX}_userId`);
}
} }
export default new User(); export default new User();
\ No newline at end of file
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-12-01 17:21:21 * @Date: 2020-12-01 17:21:21
* @LastEditors: wufan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-02 15:56:52 * @LastEditTime: 2020-12-04 11:42:52
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -14,4 +14,8 @@ export function getUserStore(params: object) { ...@@ -14,4 +14,8 @@ export function getUserStore(params: object) {
export function getUserPermission(params: object) { export function getUserPermission(params: object) {
return Service.Hades("public/store/getPermission", params); return Service.Hades("public/store/getPermission", params);
} }
\ No newline at end of file
export function logout(params: object) {
return Service.Hades("public/store/logout", params);
}
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-11-25 18:25:02 * @Date: 2020-11-25 18:25:02
<<<<<<< Updated upstream
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2020-12-04 10:52:49 * @LastEditTime: 2020-12-04 10:52:49
=======
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-04 11:11:50
>>>>>>> Stashed changes
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -35,3 +40,21 @@ export function editEmployee(params: object) { ...@@ -35,3 +40,21 @@ export function editEmployee(params: object) {
export function deleteEmployee(params: object) { export function deleteEmployee(params: object) {
return Service.Hades("public/store/delStoreUser", params); return Service.Hades("public/store/delStoreUser", params);
} }
export function getCourseCatalogList(params: object) {
return Service.Hades("public/store/getParentCategoryPage", params);
}
export function getAllSonCategory(params: object) {
return Service.Hades("public/store/getAllSonCategory", params);
}
export function addCourseCategory(params: object) {
return Service.Hades("public/store/addCourseCategory", params);
}
export function editCourseCategory(params: object) {
return Service.Hades("public/store/editCourseCategory", params);
}
export function delCourseCategory(params: object) {
return Service.Hades("public/store/delCourseCategory", params);
}
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-12-01 17:20:49 * @Date: 2020-12-01 17:20:49
* @LastEditors: wufan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-01 17:23:45 * @LastEditTime: 2020-12-04 11:44:19
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import { getUserStore, getUserPermission } from '@/data-source/base/request-apis'; import { getUserStore, getUserPermission ,logout} from '@/data-source/base/request-apis';
export default class StoreService { export default class StoreService {
// 获取员工列表 // 获取员工列表
...@@ -19,5 +19,8 @@ export default class StoreService { ...@@ -19,5 +19,8 @@ export default class StoreService {
static getUserPermission(params: any) { static getUserPermission(params: any) {
return getUserPermission(params); return getUserPermission(params);
} }
//退出登录
static logout(params: any) {
return logout(params);
}
} }
\ No newline at end of file
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-11-25 18:25:02 * @Date: 2020-11-25 18:25:02
<<<<<<< Updated upstream
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2020-12-04 10:52:26 * @LastEditTime: 2020-12-04 10:52:26
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import { getEmployeeList, getUserList, getStoreDecorationList, getStoreRole, addEmployee, editEmployee, deleteEmployee } from '@/data-source/store/request-apis'; import { getEmployeeList, getUserList, getStoreDecorationList, getStoreRole, addEmployee, editEmployee, deleteEmployee } from '@/data-source/store/request-apis';
=======
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-04 11:09:15
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import { getEmployeeList, getUserList, getStoreDecorationList, getStoreRole ,getCourseCatalogList,getAllSonCategory,addCourseCategory,delCourseCategory,editCourseCategory} from '@/data-source/store/request-apis';
>>>>>>> Stashed changes
export default class StoreService { export default class StoreService {
// 获取员工列表 // 获取员工列表
...@@ -44,5 +53,21 @@ export default class StoreService { ...@@ -44,5 +53,21 @@ export default class StoreService {
return getStoreDecorationList(params); return getStoreDecorationList(params);
} }
// 获取课程分类列表
static getCourseCatalogList(params: any) {
return getCourseCatalogList(params);
}
static getAllSonCategory(params: any) {
return getAllSonCategory(params);
}
static addCourseCategory(params: any) {
return addCourseCategory(params);
}
static editCourseCategory(params: any) {
return editCourseCategory(params);
}
static delCourseCategory(params: any) {
return delCourseCategory(params);
}
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zhangleyuan * @Author: zhangleyuan
* @Date: 2020-11-27 15:06:31 * @Date: 2020-11-27 15:06:31
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-11-30 17:00:39 * @LastEditTime: 2020-12-04 14:57:59
* @Description: 描述一下 * @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -28,9 +28,7 @@ function PersonalInfoPage() { ...@@ -28,9 +28,7 @@ function PersonalInfoPage() {
const [cropperModalVisible, setCropperModalVisible] = useState(false); const [cropperModalVisible, setCropperModalVisible] = useState(false);
const [IdentificationModalVisible, setIdentificationModalVisible] = useState(false); const [IdentificationModalVisible, setIdentificationModalVisible] = useState(false);
const [changePhoneModalVisible, setChangePhoneModalVisible] = useState(false); const [changePhoneModalVisible, setChangePhoneModalVisible] = useState(false);
const [phone,setPhone] = useState("");
//Todo
const [phone,setPhone] = useState("18226927277");
function _handleUpdateAvatar(e: any): any { function _handleUpdateAvatar(e: any): any {
const avatar = e.target.files[0]; const avatar = e.target.files[0];
...@@ -54,22 +52,17 @@ function PersonalInfoPage() { ...@@ -54,22 +52,17 @@ function PersonalInfoPage() {
} }
function identificationConfirm():any{ function identificationConfirm():any{
setIdentificationModalVisible(false); setIdentificationModalVisible(false);
console.log('111');
setChangePhoneModalVisible(true); setChangePhoneModalVisible(true);
} }
function changePhoneModalConfirm():any{ function changePhoneModalConfirm():any{
} }
return ( return (
<div className="page personal-info-page"> <div className="page personal-info-page">
<div className="page-content"> <div className="page-content">
<div className="content-header"> <div className="content-header">
<Breadcrumbs 个人设置
navList="个人设置"
goBack={() => {
window.RCHistory.goBack();
}}
/>
</div> </div>
<div className="box"> <div className="box">
<Form> <Form>
......
<<<<<<< Updated upstream
=======
/*
* @Author: 吴文洁
* @Date: 2019-07-10 10:30:49
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-02 19:47:15
* @Description:
*/
>>>>>>> Stashed changes
import React, { useContext, useEffect } from 'react'; import React, { useContext, useEffect } from 'react';
import { withRouter} from 'react-router-dom'; import { withRouter} from 'react-router-dom';
import {ConfigProvider } from 'antd'; import {ConfigProvider } from 'antd';
......
/* /*
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2019-09-10 18:26:03 * @Date: 2019-09-10 18:26:03
* @LastEditors: wangyixi * @LastEditors: zhangleyuan
* @LastEditTime: 2020-11-11 14:04:50 * @LastEditTime: 2020-12-04 15:09:25
* @Description: * @Description:
*/ */
import React from 'react'; import React from 'react';
...@@ -24,6 +24,9 @@ import { ...@@ -24,6 +24,9 @@ import {
} from 'antd'; } from 'antd';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import Bus from '@/core/bus'; import Bus from '@/core/bus';
import User from '@/common/js/user';
import axios from 'axios';
import BaseService from "@/domains/basic-domain/baseService";
// var $topContainer = $('#top-container'); // var $topContainer = $('#top-container');
class Header extends React.Component { class Header extends React.Component {
constructor(props) { constructor(props) {
...@@ -32,11 +35,37 @@ class Header extends React.Component { ...@@ -32,11 +35,37 @@ class Header extends React.Component {
menuType: 1, menuType: 1,
}; };
} }
componentWillMount() {
}
componentDidMount() { componentDidMount() {
console.log("ctx",window.ctx);
}
userMenu() {
const style = {
whiteSpace: "normal",
wordBreak: "break-all"
};
return (
<Menu
style={{
maxWidth: "250px",
marginTop: 5,
}}
onClick={e => {
if (e.key === '1') {
window.RCHistory.push('/user_info');
Bus.trigger('clearSearchText')
} else {
this.handleLogout();
}
}}
>
<Menu.Item
style={style}
key="2"
>
退出登录
</Menu.Item>
</Menu>
);
} }
handleMenu = () => { handleMenu = () => {
const menuType = !this.state.menuType; const menuType = !this.state.menuType;
...@@ -44,6 +73,29 @@ class Header extends React.Component { ...@@ -44,6 +73,29 @@ class Header extends React.Component {
Bus.trigger('menuTypeChange', menuType); Bus.trigger('menuTypeChange', menuType);
}); });
}; };
handleLogout() {
// const AxiosInstance = axios.create({
// headers: {
// xmToken: User.getToken(),
// }
// });
// AxiosInstance.post('https://dev-heimdall.xiaomai5.com/hades/public/store/logout').then((res) => {
// User.removeUserId();
// User.removeToken();
// window.RCHistory.push({
// pathname: `/login`,
// })
// })
BaseService.logout().then((res) => {
User.removeUserId();
User.removeToken();
window.RCHistory.push({
pathname: `/login`,
})
});
}
render() { render() {
const { const {
} = this.state; } = this.state;
...@@ -68,8 +120,19 @@ class Header extends React.Component { ...@@ -68,8 +120,19 @@ class Header extends React.Component {
</span> </span>
)} )}
<div className="message-help"> <div className="message-help">
<Dropdown> <Dropdown overlay={this.userMenu()}>
<div className="user"> <div className="user">
<Avatar
style={{
width: 32 + "px",
height: 32 + "px",
borderRadius: "50%",
overflow: "hidden",
flexShrink: 0,
}}
size="large"
src="@/common/images/xiaomai-IMG.png"
/>
<span className="name">张乐园</span> <span className="name">张乐园</span>
</div> </div>
</Dropdown> </Dropdown>
......
...@@ -68,7 +68,7 @@ function Login(props) { ...@@ -68,7 +68,7 @@ function Login(props) {
setWaitStatus(false) setWaitStatus(false)
clearTimeout(timer); clearTimeout(timer);
} else { } else {
setCodeText(`${waitTime }秒后重发`) setCodeText(`${waitTime}秒后重发`)
setWaitStatus(true) setWaitStatus(true)
timeSub(--waitTime, 1000); timeSub(--waitTime, 1000);
} }
...@@ -92,6 +92,9 @@ function Login(props) { ...@@ -92,6 +92,9 @@ function Login(props) {
} else { } else {
User.setUserId(data.result.userId); User.setUserId(data.result.userId);
User.setToken(data.result.xmToken); User.setToken(data.result.xmToken);
window.RCHistory.push({
pathname: `/personal-info`,
})
} }
}) })
} }
......
...@@ -35,7 +35,7 @@ function Aside(props: any) { ...@@ -35,7 +35,7 @@ function Aside(props: any) {
function taggleMenu(item: any) { function taggleMenu(item: any) {
window.RCHistory.push(item.link) window.RCHistory.push(item.link)
} }
function onOpenChange(openKeys: string[]) { function onOpenChange(openKeys:any){
setOpenKeys(openKeys) setOpenKeys(openKeys)
} }
return ( return (
......
...@@ -9,114 +9,77 @@ import React, { useEffect, useState } from "react"; ...@@ -9,114 +9,77 @@ import React, { useEffect, useState } from "react";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import _ from "underscore"; import _ from "underscore";
import PageControl from "@/components/PageControl"; import PageControl from "@/components/PageControl";
import { CheckBox } from "@/components"; import { Button, Table,Modal,message} from "antd";
import { Button, Table, Tooltip, Modal, message, Row, Col, Input } from "antd"; import { QuestionCircleOutlined } from '@ant-design/icons';
import StoreService from "@/domains/store-domain/storeService"; import StoreService from "@/domains/store-domain/storeService";
import CatalogAddOrEditModal from './modal/CatalogAddOrEditModal';
import SecondCatalogAddOrEditModal from './modal/SecondCatalogAddOrEditModal';
import "./CourseCatalogPage.less"; import "./CourseCatalogPage.less";
import User from '@/common/js/user';
const { confirm } = Modal; const { confirm } = Modal;
const { Search } = Input;
declare var window: any;
interface RecordTypes { interface RecordTypes {
storeUserId: string, children: any;
role: string
} }
function CourseCatalogPage() { function CourseCatalogPage() {
const [courseCatalogList, setCourseCatalogList] = useState([ const [courseCatalogList, setCourseCatalogList] = useState([]);
{
key: 1,
name: 'John Brown',
type: 'parent',
children: [
{
key: 11,
name: 'John Brown',
type: 'child'
},
{
key: 12,
name: 'John Brown',
type: 'child'
}
]
},
{
key: 2,
name: 'Jim Green',
type: 'parent',
children: [
{
key: 11,
name: 'John Brown',
type: 'child'
},
{
key: 12,
name: 'John Brown',
type: 'child'
}
]
},
{
key: 3,
name: 'Not Expandable',
type: 'parent',
children: [
{
key: 11,
name: 'John Brown',
type: 'child'
},
{
key: 12,
name: 'John Brown',
type: 'child'
}
]
},
{
key: 4,
name: 'Joe Black',
type: 'parent',
children: [
{
key: 11,
name: 'John Brown',
type: 'child'
},
{
key: 12,
name: 'John Brown',
type: 'child'
}
]
},
]);
const [query, setQuery] = useState({ const [query, setQuery] = useState({
current: 0, current: 0,
size: 10, size: 10,
name: "", storeId: User.getStoreId(),
phone: "",
identity: "ALL",
instId: "1837447" || window.currentUserInstInfo.instId,
}); });
const [total, setTotal] = useState(0); const [total, setTotal] = useState(0);
const [catalogModalVisible,setCatalogModalVisible] = useState(false);
const [catalogModalType,setCatalogModalType] = useState('');
const [secondCatalogModalVisible,setSecondCatalogModalVisible] = useState(false);
const [secondCatalogModalType,setSecondCatalogModalType] = useState('');
const [parentCatalogId,setParentCatalogId] = useState('');
const [choosedItem, setChooseItem] = useState({});
useEffect(() => { useEffect(() => {
getCourseCatalogList();
}, [query]); }, [query]);
function addCatalog(){
setChooseItem({});
setCatalogModalVisible(true) ;
setCatalogModalType('add');
}
function addSecondCatalog(record:any){
setChooseItem({});
setParentCatalogId(record.id)
setSecondCatalogModalVisible(true) ;
setSecondCatalogModalType('add')
}
function deleteCatalog(record:any){
return confirm({
title: record.type==='parent'? '你确定要删除此分类吗?':'你确定要删除此子分类吗?',
content: record.type==='parent' ? '删除后,此分类下包含的所有子分类都会被删除,此操作不可恢复。':'此操作不可恢复。',
icon: <QuestionCircleOutlined />,
okText: '删除',
okType: 'danger',
cancelText: '取消',
onOk: () => {
handleDeleteCatalog(record.id);
}
})
}
function handleDeleteCatalog(categoryId: string) {
const param ={
categoryId
}
StoreService.delCourseCategory(param).then((res: any) =>{
message.success("分类已删除");
getCourseCatalogList();
});
}
function parseColumn():any{ function parseColumn():any{
return [ return [
{ title: '分类名称', { title: '分类名称',
dataIndex: 'name', dataIndex: 'categoryName',
key: 'name', key: 'categoryName',
}, },
{ {
title: '操作', title: '操作',
...@@ -130,6 +93,7 @@ function CourseCatalogPage() { ...@@ -130,6 +93,7 @@ function CourseCatalogPage() {
<> <>
<span <span
className="add" className="add"
onClick={() => { addSecondCatalog(record) }}
> >
添加子分类 添加子分类
</span> </span>
...@@ -138,11 +102,12 @@ function CourseCatalogPage() { ...@@ -138,11 +102,12 @@ function CourseCatalogPage() {
} }
<span <span
onClick={()=>{editCatalog(record)}}
> >
编辑 编辑
</span> </span>
<span className="divider-line">{" | "}</span> <span className="divider-line" >{" | "}</span>
<span <span onClick={()=>{deleteCatalog(record)}}
> >
删除 删除
</span> </span>
...@@ -153,6 +118,61 @@ function CourseCatalogPage() { ...@@ -153,6 +118,61 @@ function CourseCatalogPage() {
}, },
] ]
} }
function getCourseCatalogList():any {
let _query = _.clone(query);
_query.current = query.current + 1;
StoreService.getCourseCatalogList(_query).then((res: any) => {
let resultData = handleCatalogListData(res.result.records)
setCourseCatalogList(resultData);
setTotal(res.result.total);
});
}
function handleCatalogListData(listData:any){
listData.map((item:any,index:any) => {
item.type = "parent"
item.key = item.id;
item.children = [];
return item
})
return listData
}
function editCatalog(record:any){
if(record.type ==="parent"){
setCatalogModalType('edit');
setCatalogModalVisible(true);
}else{
setSecondCatalogModalType('edit');
setSecondCatalogModalVisible(true);
}
setChooseItem(record);
}
function expandSecondCatalog(expanded:boolean,record:any){
const parentId = record.id;
const param = {
parentId,
}
StoreService.getAllSonCategory(param).then((res: any) => {
handleSecondCatalogData(parentId,res.result);
console.log(courseCatalogList);
});
}
function handleSecondCatalogData(parentId:any,listdata:any){
listdata.map((item:any,index:any) => {
item.key= item.id
return item
})
courseCatalogList.map((item:any,index:any) => {
if(item.id === parentId){
item.children = listdata;
}
return item
})
setCourseCatalogList(courseCatalogList)
}
return ( return (
<div className=" page employee-manage-page"> <div className=" page employee-manage-page">
<div className="page-content"> <div className="page-content">
...@@ -162,19 +182,25 @@ function CourseCatalogPage() { ...@@ -162,19 +182,25 @@ function CourseCatalogPage() {
<Button <Button
type="primary" type="primary"
className="add-show-btn" className="add-show-btn"
onClick={() => {addCatalog()}}
> >
添加分类 添加分类
</Button> </Button>
</div> </div>
<div className="box-body"> <div className="box-body">
<Table <Table
columns={ parseColumn() } columns={ parseColumn() }
pagination={false} pagination={false}
expandable={{ expandedRowRender={(record:RecordTypes) => {
rowExpandable: record => record.name !== '还未添加子分类', if (record.children.length !== 0){
return <div>{record.children[0].categoryName}</div>;
}else{
return <div>还未添加任何子分类</div>;
}
}} }}
dataSource={courseCatalogList} dataSource={courseCatalogList}
onExpand={(expanded, record)=>expandSecondCatalog(expanded, record)}
/> />
</div> </div>
<div className="box-footer"> <div className="box-footer">
...@@ -188,9 +214,12 @@ function CourseCatalogPage() { ...@@ -188,9 +214,12 @@ function CourseCatalogPage() {
/> />
</div> </div>
</div> </div>
{/* { {
isModalOpen && <EmployeeAddOrEditModal isOpen={isModalOpen} choosedItem={choosedItem} onClose={()=>{setIsModalOpen(false)}}/> catalogModalVisible && <CatalogAddOrEditModal modalType={catalogModalType} onClose={()=>{setCatalogModalVisible(false)}} getCourseCatalogList={()=> getCourseCatalogList()} choosedItem={choosedItem}/>
} */} }
{
secondCatalogModalVisible && <SecondCatalogAddOrEditModal modalType={secondCatalogModalType} parentId={parentCatalogId} onClose={()=>{setSecondCatalogModalVisible(false)}} choosedItem={choosedItem} />
}
</div> </div>
</div> </div>
); );
......
.catalog-add-edit-modal{
.ant-form-item-label > label{
color:#666;
}
}
\ No newline at end of file
/*
* @Author: wufan
* @Date: 2020-11-27 16:21:49
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-04 11:17:13
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import React, { useState, useEffect } from "react";
import { Modal,Form,Input,Button} from "antd";
import './CatalogAddOrEditModal.less'
import User from '@/common/js/user';
import StoreService from "@/domains/store-domain/storeService";
interface CatalogAddOrEditModalProps {
onClose:any;
modalType:string
getCourseCatalogList:any;
choosedItem:any;
}
function CatalogAddOrEditModal(props: CatalogAddOrEditModalProps) {
const {onClose,modalType,getCourseCatalogList,choosedItem} = props;
console.log("名称",choosedItem.categoryName);
const [catalogName,setCatalogName] = useState(choosedItem.categoryName);
console.log("catalogName",catalogName);
useEffect(() => {
});
function handleConfirm(){
if(modalType === "add"){
addCatalog();
}else{
editCatalog();
}
}
function addCatalog():any{
const param = {
storeId: User.getStoreId(),
categoryName:catalogName
}
StoreService.addCourseCategory(param).then((res: any) => {
onClose();
getCourseCatalogList();
});
}
function editCatalog():any{
const param = {
categoryId:choosedItem.id,
categoryName: catalogName,
}
StoreService.editCourseCategory(param).then((res: any) => {
onClose();
getCourseCatalogList();
});
}
return (
<Modal
visible={true}
title={modalType === "add" ? '添加分类' : '编辑分类' }
className="catalog-add-edit-modal"
onCancel={onClose}
width={448}
footer={[
<Button
id='cancel_allot_btn'
key="back" onClick={onClose}>取消</Button>,
<Button
id='confirm_allot_btn'
key="submit"
type="primary"
onClick={() => {
handleConfirm()
}}>
保存
</Button>
]}
>
<Form
labelCol={ {span:5 }}
>
<Form.Item
label="分类名称"
name="分类名称"
rules={[{ required: true}]}
>
<Input type="text" placeholder="请输入子分类名称,最多10个字" maxLength={10} style={{ width: 240 }}
defaultValue={catalogName}
onChange={(e) => {
setCatalogName(e.target.value);
}} />
</Form.Item>
</Form>
</Modal>
);
}
export default CatalogAddOrEditModal;
.second-catalog-add-edit-modal{
.ant-form-item-label > label{
color:#666;
}
}
\ No newline at end of file
/*
* @Author: wufan
* @Date: 2020-11-27 16:21:49
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-04 10:40:57
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import React, { useState, useEffect } from "react";
import { Modal,Form,Input,Button,Select} from "antd";
import './SecondCatalogAddOrEditModal.less'
import User from '@/common/js/user';
import StoreService from "@/domains/store-domain/storeService";
const { Option } = Select;
interface SecondCatalogAddOrEditModalProps {
onClose: (e: any) => void;
modalType:string
parentId:string
}
function SecondCatalogAddOrEditModal(props: SecondCatalogAddOrEditModalProps) {
const {onClose,modalType,parentId} = props;
const [secondCatalogName,setSecondCatalogName] = useState('');
useEffect(() => {
});
function handleConfirm(){
if(modalType === "add"){
addSecondcatalog();
}
}
function addSecondcatalog():any{
const param = {
parentId,
storeId: User.getStoreId(),
categoryName:secondCatalogName
}
StoreService.addCourseCategory(param).then((res: any) => {
});
}
return (
<Modal
visible={true}
title={modalType === "add" ? '添加子分类' : '编辑子分类' }
className="second-catalog-add-edit-modal"
onCancel={onClose}
width={448}
footer={[
<Button
id='cancel_allot_btn'
key="back" onClick={onClose}>取消</Button>,
<Button
id='confirm_allot_btn'
key="submit"
type="primary"
onClick={() => {
handleConfirm()
}}>
保存
</Button>
]}
>
<Form
labelCol={ {span:6 }}
>
<Form.Item
label="子分类名称"
name="子分类名称"
rules={[{ required: true}]}
>
<Input type="text"
placeholder="请输入子分类名称,最多10个字"
maxLength={10}
style={{ width: 240 }}
onChange={(e) => {
setSecondCatalogName(e.target.value);
}}
/>
</Form.Item>
<Form.Item
label="所属分类"
name="所属分类"
rules={[{ required: true}]}
>
<Select style={{ width: 240 }}>
<Option value="china">全部</Option>
<Option value="usa">一阶培训</Option>
</Select>
</Form.Item>
</Form>
</Modal>
);
}
export default SecondCatalogAddOrEditModal;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment