Commit 83965c05 by zhangleyuan

feat:个人设置及身份相关接口联调

parent 3fe97617
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-12-02 10:39:36 * @Date: 2020-12-02 10:39:36
* @LastEditors: wufan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-02 17:46:27 * @LastEditTime: 2020-12-04 15:38:04
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -17,6 +17,5 @@ class Permission { ...@@ -17,6 +17,5 @@ class Permission {
} }
} }
export default Permission; export default Permission;
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-12-01 17:21:21 * @Date: 2020-12-01 17:21:21
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-04 11:42:52 * @LastEditTime: 2020-12-04 17:39:12
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -19,3 +19,15 @@ export function getUserPermission(params: object) { ...@@ -19,3 +19,15 @@ export function getUserPermission(params: object) {
export function logout(params: object) { export function logout(params: object) {
return Service.Hades("public/store/logout", params); return Service.Hades("public/store/logout", params);
} }
export function getStoreUser(params: object) {
return Service.Hades("public/store/getStoreUser", params);
}
export function sendBizAuthCode(params: object) {
return Service.Hades("public/store/sendBizAuthCode", params);
}
export function editUserPhone(params: object) {
return Service.Hades("public/store/editUserPhone", params);
}
export function checkBizAuthCode(params: object) {
return Service.Hades("public/store/checkBizAuthCode", params);
}
...@@ -2,19 +2,18 @@ ...@@ -2,19 +2,18 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-12-01 17:20:49 * @Date: 2020-12-01 17:20:49
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-04 11:44:19 * @LastEditTime: 2020-12-04 17:08:24
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import { getUserStore, getUserPermission ,logout} from '@/data-source/base/request-apis'; import { getUserStore, getUserPermission ,logout,getStoreUser,sendBizAuthCode,editUserPhone,checkBizAuthCode} from '@/data-source/base/request-apis';
export default class StoreService { export default class StoreService {
// 获取员工列表 // 获取员工列表
static getUserStore(params: any) { static getUserStore(params: any) {
return getUserStore(params); return getUserStore(params);
} }
// 获取员工列表 // 获取员工列表
static getUserPermission(params: any) { static getUserPermission(params: any) {
return getUserPermission(params); return getUserPermission(params);
...@@ -23,4 +22,20 @@ export default class StoreService { ...@@ -23,4 +22,20 @@ export default class StoreService {
static logout(params: any) { static logout(params: any) {
return logout(params); return logout(params);
} }
//退出登录
static getStoreUser(params: any) {
return getStoreUser(params);
}
//发送业务验证码
static sendBizAuthCode(params: any) {
return sendBizAuthCode(params);
}
//编辑手机号
static editUserPhone(params: any) {
return editUserPhone(params);
}
static checkBizAuthCode(params: any){
return checkBizAuthCode(params);
}
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ import { Modal, Button, Input} from 'antd'; ...@@ -3,7 +3,7 @@ import { Modal, Button, Input} from 'antd';
import _ from 'underscore'; import _ from 'underscore';
import './ChangePhoneModal.less'; import './ChangePhoneModal.less';
import Form from 'antd/lib/form/Form'; import Form from 'antd/lib/form/Form';
import BaseService from "@/domains/basic-domain/baseService";
interface changePhoneModalProps { interface changePhoneModalProps {
onClose:() => void, onClose:() => void,
...@@ -24,10 +24,6 @@ function ChangePhoneModal(props: changePhoneModalProps) { ...@@ -24,10 +24,6 @@ function ChangePhoneModal(props: changePhoneModalProps) {
useEffect(() => { useEffect(() => {
}) })
// function checkPhone():any{
// }
function checkPhoneVerify():any{ function checkPhoneVerify():any{
if(!phoneVerify){ if(!phoneVerify){
setErrorMessageText('请输入验证码'); setErrorMessageText('请输入验证码');
...@@ -47,8 +43,14 @@ function ChangePhoneModal(props: changePhoneModalProps) { ...@@ -47,8 +43,14 @@ function ChangePhoneModal(props: changePhoneModalProps) {
setNewPhoneError(true); setNewPhoneError(true);
return; return;
} }
let timer:any; let timer:any;
timeSub(60,0); const param ={
phone:newPhone,
bizType:'CLOUD_CLASS_MODIFY_PHONE'
}
BaseService.sendBizAuthCode(param).then((res) => {
timeSub(60,0);
});
function timeSub(waitTime:number, unit:number):any{ function timeSub(waitTime:number, unit:number):any{
clearTimeout(timer); clearTimeout(timer);
timer = setTimeout(function () { timer = setTimeout(function () {
...@@ -81,7 +83,18 @@ function ChangePhoneModal(props: changePhoneModalProps) { ...@@ -81,7 +83,18 @@ function ChangePhoneModal(props: changePhoneModalProps) {
setPhoneVerifyError(true); setPhoneVerifyError(true);
return; return;
} }
onClose(); const param ={
authCode: phoneVerify,
phone: "string",
storeUserId: 0
}
BaseService.editUserPhone(param).then((res) => {
if(res.success){
onClose();
}else{
setErrorMessageText(res.message);
}
});
} }
return ( return (
<Modal <Modal
......
...@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Modal, Form, Button, Input, Radio, Row, Col ,InputNumber } from 'antd'; import { Modal, Form, Button, Input, Radio, Row, Col ,InputNumber } from 'antd';
import _ from 'underscore'; import _ from 'underscore';
import './IdentificationModal.less'; import './IdentificationModal.less';
import BaseService from "@/domains/basic-domain/baseService";
interface IdentificationModalProps { interface IdentificationModalProps {
onClose:() => void, onClose:() => void,
phone:String, phone:String,
...@@ -27,14 +27,29 @@ function IdentificationModal(props: IdentificationModalProps) { ...@@ -27,14 +27,29 @@ function IdentificationModal(props: IdentificationModalProps) {
setErrorMessageText('请输入验证码'); setErrorMessageText('请输入验证码');
return; return;
} }
// 请求身份确定的接口 const param ={
onConfirm(); code:phoneVerify,
phone,
serverType:'CLOUD_CLASS_MODIFY_PHONE'
}
BaseService.checkBizAuthCode(param).then((res) => {
if(res.success){
onConfirm();
}else{
setErrorMessageText(res.message);
}
});
} }
function handleSendCode():any { function handleSendCode():any {
if (waitStatus) return; if (waitStatus) return;
let timer:any; let timer:any;
timeSub(60,0); const param ={
phone,
serverType:'CLOUD_CLASS_MODIFY_PHONE'
}
BaseService.sendBizAuthCode(param).then((res) => {
timeSub(60,0);
});
function timeSub(waitTime:number, unit:number):any{ function timeSub(waitTime:number, unit:number):any{
clearTimeout(timer); clearTimeout(timer);
timer = setTimeout(function () { timer = setTimeout(function () {
......
...@@ -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-12-04 14:57:59 * @LastEditTime: 2020-12-04 18:00:20
* @Description: 描述一下 * @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import {Form,Button,Input} from "antd"; import {Form,Button,Input,message} from "antd";
import Breadcrumbs from "@/components/Breadcrumbs"; import Breadcrumbs from "@/components/Breadcrumbs";
import UpLoad from "../common/UpLoad"; import UpLoad from "../common/UpLoad";
import _ from 'underscore'; import _ from 'underscore';
...@@ -19,17 +19,35 @@ import baseImg from '@/common/images/xiaomai-IMG.png'; ...@@ -19,17 +19,35 @@ import baseImg from '@/common/images/xiaomai-IMG.png';
import {CropperModal} from '@/components/'; import {CropperModal} from '@/components/';
import IdentificationModal from './IdentificationModal'; import IdentificationModal from './IdentificationModal';
import ChangePhoneModal from './ChangePhoneModal'; import ChangePhoneModal from './ChangePhoneModal';
import BaseService from "@/domains/basic-domain/baseService";
import StoreService from "@/domains/store-domain/storeService";
import User from '@/common/js/user';
import './index.less'; import './index.less';
const FormItem = Form.Item; const FormItem = Form.Item;
function PersonalInfoPage() { function PersonalInfoPage() {
const [avatar,setAvatar] = useState(baseImg); const [avatar,setAvatar] = useState(baseImg);
const [imgUrl, setImgUrl] = useState(avatar); const [imgUrl, setImgUrl] = useState(avatar);
const [nickName,setNickName] = useState('');
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 [roleCodes,setRoleCodes] = useState([])
const [phone,setPhone] = useState(""); const [phone,setPhone] = useState("");
const storeUserId = User.getStoreUserId()
useEffect(() => {
getUserInfo();
},[storeUserId])
function getUserInfo(){
const param ={
storeUserId:User.getStoreUserId()
}
BaseService.getStoreUser(param).then((res) => {
const {nickName,phone,roleCodes} = res.result;
setNickName(nickName);
setPhone(phone);
setRoleCodes(roleCodes)
});
}
function _handleUpdateAvatar(e: any): any { function _handleUpdateAvatar(e: any): any {
const avatar = e.target.files[0]; const avatar = e.target.files[0];
const newUrl = URL.createObjectURL(avatar); const newUrl = URL.createObjectURL(avatar);
...@@ -47,17 +65,25 @@ function PersonalInfoPage() { ...@@ -47,17 +65,25 @@ function PersonalInfoPage() {
setImgUrl(img); setImgUrl(img);
} }
function closeCropperModal():any{ function closeCropperModal():any {
setCropperModalVisible(false); setCropperModalVisible(false);
} }
function identificationConfirm():any{ function identificationConfirm():any {
setIdentificationModalVisible(false); setIdentificationModalVisible(false);
setChangePhoneModalVisible(true); setChangePhoneModalVisible(true);
} }
function changePhoneModalConfirm():any{ function saveUserInfo(){
const params = {
nickName,
phone: String(phone),
roleCodes:roleCodes,
// avatar,
storeUserId:User.getStoreUserId()
};
StoreService.editEmployee(params).then((res) => {
message.success("编辑成功");
});
} }
return ( return (
<div className="page personal-info-page"> <div className="page personal-info-page">
<div className="page-content"> <div className="page-content">
...@@ -86,7 +112,13 @@ function PersonalInfoPage() { ...@@ -86,7 +112,13 @@ function PersonalInfoPage() {
</div> </div>
<div className="name-item"> <div className="name-item">
<span className="label">姓名:</span> <span className="label">姓名:</span>
<Input placeholder="请输入姓名" style={{ width:300,height:32}} /> <Input
placeholder="请输入姓名"
style={{ width:300,height:32}} value={nickName}
onChange={(e) => {
setNickName(e.target.value);
}}
/>
</div> </div>
<div className="phone-item"> <div className="phone-item">
<span className="label">手机号:</span> <span className="label">手机号:</span>
...@@ -94,7 +126,7 @@ function PersonalInfoPage() { ...@@ -94,7 +126,7 @@ function PersonalInfoPage() {
<Button className="changePhoneBtn" onClick={()=>{setIdentificationModalVisible(true)}}>更换手机号</Button> <Button className="changePhoneBtn" onClick={()=>{setIdentificationModalVisible(true)}}>更换手机号</Button>
</div> </div>
<div> <div>
<Button type="primary">保存</Button> <Button type="primary" onClick={()=>{saveUserInfo()}}>保存</Button>
</div> </div>
</Form> </Form>
</div> </div>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2019-09-10 18:26:03 * @Date: 2019-09-10 18:26:03
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-04 15:09:25 * @LastEditTime: 2020-12-04 15:30:49
* @Description: * @Description:
*/ */
import React from 'react'; import React from 'react';
...@@ -36,7 +36,7 @@ class Header extends React.Component { ...@@ -36,7 +36,7 @@ class Header extends React.Component {
}; };
} }
componentDidMount() { componentDidMount() {
console.log("ctx",window.ctx);
} }
userMenu() { userMenu() {
const style = { const style = {
......
...@@ -48,9 +48,9 @@ function Login(props) { ...@@ -48,9 +48,9 @@ function Login(props) {
sessionId: checkData.csessionid, sessionId: checkData.csessionid,
token: checkData.token, token: checkData.token,
scene: 'nc_login', scene: 'nc_login',
serverType: "CLOUD_CLASS_LOGIN",
} }
axios.post('https://dev-heimdall.xiaomai5.com/hades/anon/store/sendLoginAuthCode', params).then((res) => { axios.post('https://dev-heimdall.xiaomai5.com/hades/anon/store/sendLoginAuthCode', params).then((res) => {
console.log('111',res.data.success);
if (!res.data.success) { if (!res.data.success) {
setErrorMessage(res.data.message); setErrorMessage(res.data.message);
} else { } else {
...@@ -83,7 +83,7 @@ function Login(props) { ...@@ -83,7 +83,7 @@ function Login(props) {
} }
const params = { const params = {
phone, phone,
authCode:phoneverify authCode:phoneverify,
} }
axios.post('https://dev-heimdall.xiaomai5.com/hades/anon/store/login', params).then((res) => { axios.post('https://dev-heimdall.xiaomai5.com/hades/anon/store/login', params).then((res) => {
const data = res.data; const data = res.data;
......
...@@ -119,11 +119,13 @@ function CourseCatalogPage() { ...@@ -119,11 +119,13 @@ function CourseCatalogPage() {
] ]
} }
function getCourseCatalogList():any { function getCourseCatalogList():any {
console.log('getCourseCatalogList')
let _query = _.clone(query); let _query = _.clone(query);
_query.current = query.current + 1; _query.current = query.current + 1;
StoreService.getCourseCatalogList(_query).then((res: any) => { StoreService.getCourseCatalogList(_query).then((res: any) => {
let resultData = handleCatalogListData(res.result.records) let resultData = handleCatalogListData(res.result.records)
setCourseCatalogList(resultData); setCourseCatalogList(resultData);
console.log("res",resultData);
setTotal(res.result.total); setTotal(res.result.total);
}); });
} }
...@@ -155,23 +157,12 @@ function CourseCatalogPage() { ...@@ -155,23 +157,12 @@ function CourseCatalogPage() {
parentId, parentId,
} }
StoreService.getAllSonCategory(param).then((res: any) => { StoreService.getAllSonCategory(param).then((res: any) => {
handleSecondCatalogData(parentId,res.result); record.children=res.result || [];
console.log(courseCatalogList); const _courseCatalogList =[...courseCatalogList]
setCourseCatalogList(_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">
...@@ -192,13 +183,15 @@ function CourseCatalogPage() { ...@@ -192,13 +183,15 @@ function CourseCatalogPage() {
columns={ parseColumn() } columns={ parseColumn() }
pagination={false} pagination={false}
expandedRowRender={(record:RecordTypes) => { expandedRowRender={(record:RecordTypes) => {
if(!record.children){
return
}
if (record.children.length !== 0){ if (record.children.length !== 0){
return <div>{record.children[0].categoryName}</div>; return <div>{record.children[0].categoryName}</div>;
}else{ }else{
return <div>还未添加任何子分类</div>; return <div>还未添加任何子分类</div>;
} }
}} }}
dataSource={courseCatalogList} dataSource={courseCatalogList}
onExpand={(expanded, record)=>expandSecondCatalog(expanded, record)} onExpand={(expanded, record)=>expandSecondCatalog(expanded, record)}
/> />
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-27 16:21:49 * @Date: 2020-11-27 16:21:49
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-04 10:40:57 * @LastEditTime: 2020-12-04 15:28:43
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -17,8 +17,9 @@ import StoreService from "@/domains/store-domain/storeService"; ...@@ -17,8 +17,9 @@ import StoreService from "@/domains/store-domain/storeService";
const { Option } = Select; const { Option } = Select;
interface SecondCatalogAddOrEditModalProps { interface SecondCatalogAddOrEditModalProps {
onClose: (e: any) => void; onClose: (e: any) => void;
modalType:string modalType:string;
parentId:string parentId:string;
} }
function SecondCatalogAddOrEditModal(props: SecondCatalogAddOrEditModalProps) { function SecondCatalogAddOrEditModal(props: SecondCatalogAddOrEditModalProps) {
......
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