Commit 9b6bc4f6 by zhangleyuan

feat:删除没有用的文件

parent 26bbb950
import PropTypes from 'prop-types';
import { Modal, Input, Form, Button, message, Row, Col } from 'antd';
import md5 from 'blueimp-md5';
import User from '@/core/user';
import { resolve } from 'url';
const FormItem = Form.Item;
export default class PasswordModal extends BaseComponent {
constructor(props) {
super(props);
this.state = {
newpwd: "",
renewpwd: "",
verifyCode: "",
phone: Number(LS.get("uPhone")) || Number(LS.get("bindingPhone")),
openEye: false,
showTip: false,
isSetPwd: window.currentUserInstInfo.isSetPwd,
openSetForm: false,
};
}
handleChange = e => {
let newState = {};
newState[e.target.name] = e.target.value.trim();
this.setState(newState);
};
//点击保存
handleSave = () => {
let newpwd = this.state.newpwd,
renewpwd = this.state.renewpwd,
verifyCode = this.state.verifyCode,
phone = this.state.phone;
if (verifyCode == "" && this.state.isSetPwd) {
message.warning("验证码不能为空!");
return new Promise((resolve, reject) => { });
}
if (newpwd == "") {
message.error("请输入密码");
return new Promise((resolve, reject) => { });
}
if (newpwd.match(/^[0-9]*$/) || newpwd.match(/^[a-zA-Z]*$/)) {
message.warning("密码不能为纯数字或纯字母!");
return new Promise((resolve, reject) => { });
}
else if (!newpwd.match(/^[a-zA-Z0-9]{6,16}$/)) {
message.warning("密码为6-16位数字与字母!");
return new Promise((resolve, reject) => { });
} else {
if (newpwd.length < 6 || newpwd.length > 20) {
message.error("密码长度为6-20个字符");
return new Promise((resolve, reject) => { });
}
return axios.post("api-b/b/changePassword", {
phone: phone,
newpwd: md5(newpwd),
code: verifyCode
})
.then(res => {
if (res.resultCode == 0) {
message.success("修改成功, 即将退出重新登录~");
setTimeout(() => {
User.logout();
}, 500);
} else {
message.error(res.resultMsg);
}
});
}
};
sendVoiceCode() {
let phone = Number(LS.get("uPhone")) || Number(LS.get("bindingPhone"));
return window.axios.post('api-b/b/send/voiceAuthCode', { phone }).then(() => {
message.warning('验证码将以电话的形式通知到您,请注意接听');
});
}
//获取验证码
getVerifyCode = () => {
const self = this;
let phone = Number(LS.get("uPhone")) || Number(LS.get("bindingPhone"));
axios
.post("api-b/b/changePassword/authcode", {
phone: phone
})
.then(() => {
message.success("验证码已发送");
});
let haveSend = $(".sendVerifyCodes");
if (haveSend.hasClass("wait")) return;
let timer;
let timeSub = (waitTime, unit) => {
clearTimeout(timer);
timer = setTimeout(function () {
if (waitTime == 0) {
haveSend.removeClass("wait").text("发送验证码");
clearTimeout(timer);
} else {
if (waitTime < 40) {
if (!self.state.showTip) {
self.setState({ showTip: true });
setTimeout(() => self.setState({ showTip: false }), 40000);
}
}
haveSend.addClass("wait").text(waitTime + "秒后重发");
timeSub(--waitTime, 1000);
}
}, unit || 0);
};
if (true) {
timeSub(60);
}
};
render() {
const { phone, openEye, showTip, isSetPwd, openSetForm } = this.state;
return (
<Form>
<FormItem
label="手机号"
labelCol={{ span: 2 }}
>
<span>{phone}</span>
</FormItem>
{openSetForm ?
[isSetPwd && <FormItem
label="验证码"
labelCol={{ span: 2 }}
>
<Input
id="verify_code_input"
type="text"
name="verifyCode"
value={this.state.verifyCode}
placeholder="请输入验证码"
onChange={this.handleChange}
style={{ width: 240 }}
/>
<Button
id="send_verify_codes_btn"
type="button"
className='sendVerifyCodes'
style={{ marginLeft: 8 }}
onClick={this.getVerifyCode}
>
获取验证码
</Button>
{showTip && <div style={{ fontSize: '12px' }}>
<span style={{ color: "#686868" }}>收不到短信?</span>
<span
style={{ color: "#FFAB1A", cursor: "pointer" }}
id="sendRegVoiceVerifyCode"
onClick={this.sendVoiceCode}
>
使用语音验证码
</span>
</div>}
</FormItem>,
<FormItem
label={!isSetPwd ? '登录密码' : '新密码'}
labelCol={{ span: 2 }}
>
<input style={{ display: 'none' }} />
<Input
id="new_password_input"
type={openEye ? 'string' : 'password'}
value={this.state.newpwd}
name="newpwd"
style={{ width: 240 }}
onChange={this.handleChange}
placeholder="6-16位数字或字母,区分大小写"
suffix={openEye ?
<span
className="icon iconfont"
onClick={() => this.setState({ openEye: false })}
style={{ cursor: 'pointer', color: '#999' }}
>&#xe6b5;</span>
: <span
className="icon iconfont"
onClick={() => this.setState({ openEye: true })}
style={{ cursor: 'pointer', color: '#999' }}
>&#xe6dc;</span>
}
/>
</FormItem>,
<Row>
<Col span={2}>
</Col>
<Col span={18}>
<div style={{ display: 'block', lineHeight: 2.5 }}>
<Button
id="save_new_password_btn"
type="primary"
onClick={() => {
this.handleSave().then(() => {
this.setState({ isSetPwd: true, openSetForm: false });
});
}}
>
保存
</Button>
<Button
id="cancel_new_password_btn"
type=""
style={{ marginLeft: 16 }}
onClick={() => {
this.setState({ openSetForm: false })
}}
>
取消
</Button>
</div>
</Col>
</Row>
]
: <FormItem
label="登录密码"
labelCol={{ span: 2 }}
>
{!isSetPwd ?
<Button id="edit_password_btn" onClick={() => this.setState({ openSetForm: true })}>
设置密码
</Button>
: <div>
******
<Button
id="reedit_password_btn"
style={{ marginLeft: 8 }}
onClick={() => this.setState({ openSetForm: true })}
>
重设密码
</Button>
</div>
}
</FormItem>
}
</Form>
);
}
}
PasswordModal.propTypes = {
};
\ No newline at end of file
import PropTypes from 'prop-types';
import { Form, Button, message, Switch, Input, Row, Col } from 'antd';
import {
withRouter
} from 'react-router-dom';
import UpLoad from "../common/UpLoad";
import PasswordModal from './PasswordModal';
import './UserInfo.less';
import Bus from '../../core/bus';
import { HookContext } from '../../routes';
const FormItem = Form.Item;
class UserInfo extends BaseComponent {
constructor(props) {
super(props);
this.state = {
avatar: window.currentUserInstInfo.avatar || '',
nickName: window.currentUserInstInfo.nickName || '',
homeworkNotice: false,
commentNotice: false,
submitNotice: false,
fileNotice: false,
};
}
componentDidMount() {
window.NewVersion ? this.newFetchMessageControl(): this.fetchMessageControl();
}
newFetchMessageControl() {
axios.Business('public/config/getAdminConfigs').then((res) => {
let data = {};
_.map(res.result, (item) => {
if (item.configType == 'HOMEWORK_REVERT') {
data.homeworkNotice = item.configValue == 'TRUE';
} else if (item.configType == 'ASSESSMENT_REVERT') {
data.commentNotice = item.configValue == 'TRUE';
} else if (item.configType == 'MI_PUSH_T_SUBMIT_HOMEWORK') {
data.submitNotice = item.configValue == 'TRUE';
} else if (item.configType == 'MI_PUSH_T_ARCHIVES_REVERT') {
data.fileNotice = item.configValue == 'TRUE';
}
})
this.setState(data);
})
}
fetchMessageControl() {
axios.post('api-b/b/inst/adminConfig').then((res) => {
if (res.data) {
try {
const homeworkNotice = !!(_.find(res.data, (item) => {
return item.code == '1';
})).status;
const commentNotice = !!(_.find(res.data, (item) => {
return item.code == '2';
})).status;
this.setState({ homeworkNotice, commentNotice });
} catch (error) {
// this._disconnected(ERROR.INTERNAL_ERROR.code, format(ERROR.INTERNAL_ERROR, [error.message, error.stack.toString()]));
// return;
}
}
});
}
changeMessageControl(messageType, status) {
window.NewVersion ?
axios.Business('public/config/modifyAdminConfig', { configType: ENUM.adminConfig[messageType], configValue: status == 1 ? 'TRUE' : 'FALSE' }).then(() => {
this.FetchMessageControl();
})
: axios.post('api-b/b/inst/edit/adminConfig', { messageType, status }).then(() => {
this.fetchMessageControl();
});
}
handleEditNickName = () => {
// if (!this.state.nickName) {
// message.warning('请填写昵称');
// return
// }
const query = {
nickName: this.state.nickName
}
axios.post('api-b/b/inst/edit/nickName', query).then((res) => {
message.success('保存成功');
Bus.trigger('changeNickName')
})
}
render() {
const { avatar, homeworkNotice, commentNotice, submitNotice, fileNotice } = this.state;
return (
<div className="page user-info">
<div className="page-content">
<section className="content-header">
<h1>个人信息</h1>
</section>
</div>
<div className="box first">
<Form>
<header className="title">个人信息</header>
<FormItem
label="个人头像"
labelCol={{ span: 2 }}
>
<div id="avatar_edit" className="img-box" style={{ width: 54, height: 54, display: 'inline-block' }}>
<UpLoad
addIcon={avatar ?
<span className="icon iconfont">&#xe60b;</span>
: <span
className="icon iconfont"
style={{ fontSize: '12px' }}
>上传头像</span>
}
width={54}
height={54}
img={avatar}
radius="50%"
onChange={img => {
this.state.banner = img;
axios.post("api-b/b/inst/edit/avatar", {
avatar: img,
adminId: window.currentUserInstInfo.adminId,
})
.then(res => {
this.setState({ avatar: img });
Bus.trigger('update_avatar', img);
message.success("头像上传成功");
});
}}
/>
</div>
</FormItem>
<FormItem
label="姓名"
labelCol={{ span: 2 }}
>
<span>{window.currentUserInstInfo.adminName}</span>
</FormItem>
<FormItem
label="昵称"
labelCol={{ span: 2 }}
>
<Input
id="nick_name_input"
value={this.state.nickName}
placeholder="昵称不能超过10个字符"
style={{ width: 200 }}
onChange={(event) => {
let nickName = event.target.value;
this.setState({ nickName });
}} />
<Row>
<Col span={2}></Col>
<Col>
<span className="icon iconfont" style={{ color: '#20A1FF', marginRight: 10 }}>&#xe64d;</span>“昵称”将用于家长端中的家校互动展示
</Col>
</Row>
</FormItem>
<FormItem>
<Col span={2}></Col>
<Button
id="update_user_info_btn"
onClick={this.handleEditNickName}
type="primary" >
更新信息
</Button>
</FormItem>
</Form>
</div>
<div className="box">
<header className="title">账号与密码</header>
<PasswordModal />
</div>
<div className="box" style={{ marginBottom: 24 }}>
<header className="title">新消息通知</header>
<Form>
{window.NewVersion && <FormItem
label="作业提交提醒"
labelCol={{ span: 3 }}
>
<Switch
id="homework_notice_switch"
checked={submitNotice}
onChange={() => this.changeMessageControl(38, submitNotice ? 0 : 1)}
style={{ marginLeft: 30 }}
/>
</FormItem>}
<FormItem
label="作业回复提醒"
labelCol={{ span: 3 }}
>
<Switch
id="homework_notice_switch"
checked={homeworkNotice}
onChange={() => this.changeMessageControl(1, homeworkNotice ? 0 : 1)}
style={{ marginLeft: 30 }}
/>
</FormItem>
<FormItem
label="点评回复提醒"
labelCol={{ span: 3 }}
>
<Switch
id="comment_notice_switch"
checked={commentNotice}
onChange={() => this.changeMessageControl(2, commentNotice ? 0 : 1)}
style={{ marginLeft: 30 }}
/>
</FormItem>
{window.NewVersion && <FormItem
label="成长档案回复提醒"
labelCol={{ span: 3 }}
>
<Switch
id="homework_notice_switch"
checked={fileNotice}
onChange={() => this.changeMessageControl(31, fileNotice ? 0 : 1)}
style={{ marginLeft: 30 }}
/>
</FormItem>}
</Form>
</div>
</div>
);
}
}
UserInfo.contextType = HookContext;
export default withRouter(UserInfo);
\ No newline at end of file
.user-info {
.box {
margin-top: 36px;
padding-top: 0;
&.first {
margin-top: 50px;
}
.title {
font-weight: 500;
display: block;
font-size: 18px;
color: #333;
line-height: 50px;
border-bottom: 1px solid #e8e8e8;
margin-bottom: 24px;
}
.img-box {
.icon {
cursor: pointer;
}
}
}
}
\ No newline at end of file
......@@ -40,22 +40,22 @@ function CourseCatalogPage() {
useEffect(() => {
getCourseCatalogList();
}, [query]);
function addCatalog(){
setChooseItem({});
setCatalogModalVisible(true) ;
setCatalogModalType('add');
}
function addSecondCatalog(record:any){
setChooseItem({});
setParentCatalogId(record.id)
setSecondCatalogModalVisible(true) ;
setSecondCatalogModalType('add')
setParentCatalogId(record.id);
setSecondCatalogModalVisible(true);
setSecondCatalogModalType('add');
}
function deleteCatalog(record:any){
return confirm({
title: record.type==='parent'? '你确定要删除此分类吗?':'你确定要删除此子分类吗?',
content: record.type==='parent' ? '删除后,此分类下包含的所有子分类都会被删除,此操作不可恢复。':'此操作不可恢复。',
title: record.hasSon? '你确定要删除此分类吗?':'你确定要删除此子分类吗?',
content: record.hasSon? '删除后,此分类下包含的所有子分类都会被删除,此操作不可恢复。':'此操作不可恢复。',
icon: <QuestionCircleOutlined />,
okText: '删除',
okType: 'danger',
......@@ -119,7 +119,6 @@ function CourseCatalogPage() {
]
}
function getCourseCatalogList():any {
console.log('getCourseCatalogList')
let _query = _.clone(query);
_query.current = query.current + 1;
StoreService.getCourseCatalogList(_query).then((res: any) => {
......@@ -129,6 +128,33 @@ function CourseCatalogPage() {
setTotal(res.result.total);
});
}
function refreshCatalogList(data:any):any{
// const _courseCatalogList = [...courseCatalogList];
// setCourseCatalogList(_courseCatalogList)
const { type} = data;
switch (type){
case 'addCatalog':
const item = {
categoryName:data.catalogName,
id:data.id,
hasSon:true,
key:data.id
}
const _courseCatalogList:any = [...courseCatalogList];
console.log('1',_courseCatalogList);
_courseCatalogList.push(item);
console.log('2',_courseCatalogList);
setCourseCatalogList(_courseCatalogList)
break;
default:
break;
}
}
function handleCatalogListData(listData:any){
listData.map((item:any,index:any) => {
item.type = "parent"
......@@ -163,7 +189,6 @@ function CourseCatalogPage() {
return item
})
const _courseCatalogList =[...courseCatalogList];
console.log("_courseCatalogList",_courseCatalogList);
setCourseCatalogList(_courseCatalogList)
});
}
......@@ -217,7 +242,7 @@ function CourseCatalogPage() {
</div>
</div>
{
catalogModalVisible && <CatalogAddOrEditModal modalType={catalogModalType} onClose={()=>{setCatalogModalVisible(false)}} getCourseCatalogList={()=> getCourseCatalogList()} choosedItem={choosedItem}/>
catalogModalVisible && <CatalogAddOrEditModal modalType={catalogModalType} onClose={()=>{setCatalogModalVisible(false)}} refreshCatalogList={refreshCatalogList} choosedItem={choosedItem}/>
}
{
secondCatalogModalVisible && <SecondCatalogAddOrEditModal modalType={secondCatalogModalType} parentId={parentCatalogId} onClose={()=>{setSecondCatalogModalVisible(false)}} choosedItem={choosedItem} />
......
......@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-11-27 16:21:49
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-04 11:17:13
* @LastEditTime: 2020-12-07 17:46:39
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -14,13 +14,12 @@ import StoreService from "@/domains/store-domain/storeService";
interface CatalogAddOrEditModalProps {
onClose:any;
modalType:string
getCourseCatalogList:any;
refreshCatalogList:any;
choosedItem:any;
}
function CatalogAddOrEditModal(props: CatalogAddOrEditModalProps) {
const {onClose,modalType,getCourseCatalogList,choosedItem} = props;
console.log("名称",choosedItem.categoryName);
const {onClose,modalType,refreshCatalogList,choosedItem} = props;
const [catalogName,setCatalogName] = useState(choosedItem.categoryName);
console.log("catalogName",catalogName);
useEffect(() => {
......@@ -39,7 +38,12 @@ function CatalogAddOrEditModal(props: CatalogAddOrEditModalProps) {
}
StoreService.addCourseCategory(param).then((res: any) => {
onClose();
getCourseCatalogList();
const data = {
type:'addCatalog',
catalogName:catalogName,
id:res.result
}
refreshCatalogList(data);
});
}
function editCatalog():any{
......@@ -49,7 +53,8 @@ function CatalogAddOrEditModal(props: CatalogAddOrEditModalProps) {
}
StoreService.editCourseCategory(param).then((res: any) => {
onClose();
getCourseCatalogList();
const data = {}
refreshCatalogList(data);
});
}
return (
......
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