Commit c9e1c443 authored by wangxuelai's avatar wangxuelai

''

parent 91e5778c
......@@ -19,6 +19,7 @@ export default {
getVerifyCode: `${api}service/user/verify_code`,
resetPassword: `${api}service/user/reset_password`,
replenish: `${api}v1/user/replenish`,
verifyCodeLogin: `${api}service/user/clock_login`,
login: `${api}service/user/login`,
videoupload: `${dakaapi}member/media_access`,
imgupload: `${dakaapi}member/oss/access`,
......
......@@ -1183,7 +1183,7 @@ export default {
},
* saveClass({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const { classSubmitting, classId } = yield select(state => state.classdetail);
const { classSubmitting, classId, classDetail } = yield select(state => state.classdetail);
if (classSubmitting) {
return;
}
......@@ -1218,6 +1218,20 @@ export default {
yield put({
type: 'queryClassDetail',
});
if (classDetail.course_id != values.course_id) {
yield put({
type: 'queryCoursePlansList',
payload: {
params: {},
},
});
yield put({
type: 'queryClassStudentList',
payload: {
params: {},
},
});
}
} else {
yield put({
type: 'webapp/errorrequestresolve',
......
......@@ -60,12 +60,15 @@ export default {
mobile,
union_id: 1,
};
let ajax = null;
if (type == 'verify') {
param.verify_code = verifycode;
ajax = login.verifyCodeLogin;
} else {
param.password = password;
ajax = login.login;
}
const loginData = yield call(login.login, param);
const loginData = yield call(ajax, param);
// 判断用户是否完善信息
if (!loginData.code) {
if (loginData.data && loginData.data.token) {
......@@ -80,7 +83,6 @@ export default {
logining: false,
},
});
console.log(userInfo, 'userInfo1');
if (newLoginData.code == 200) {
if (newLoginData.data && newLoginData.data.token) {
LocalStorage.setItem('user', {
......
......@@ -39,6 +39,8 @@ export default {
previewQrcode: '',
businessIsBind: false,
checkoutVerifyCode: false,
nicknameChangeShow: false,
nicknameSubmitting: false,
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
......@@ -161,13 +163,62 @@ export default {
message.error(errorcode[data.code].cn, 1);
}
},
* updateNickname({ payload }, { call, put, select }) {
const { nickname, callBack } = payload;
const { userInfo } = yield select(state => state.webapp);
const { nicknameSubmitting } = yield select(state => state.usersetting);
if (nicknameSubmitting) {
return;
}
yield put({
type: 'updateState',
payload: {
nicknameSubmitting: true,
},
});
const loading = message.loading('昵称修改中...');
const updateAvatarDate = yield call(usersettingajax.updateAvatar, {
nickname,
});
setTimeout(loading);
yield put({
type: 'updateState',
payload: {
nicknameSubmitting: false,
},
});
if (updateAvatarDate.code == 200) {
message.success('修改成功', 1);
userInfo.nickname = nickname;
yield put({
type: 'webapp/updateState',
payload: {
userInfo: { ...userInfo },
nicknameChangeShow: false,
},
});
yield put({
type: 'updateState',
payload: {
nicknameChangeShow: false,
},
});
const user = LocalStorage.getItem('user');
user.nickname = nickname;
LocalStorage.setItem('user', user);
if (callBack && (typeof callBack == 'function')) {
callBack();
}
} else {
message.error('昵称修改失败');
}
},
* updateUserAvatar({ payload }, { call, put, select }) {
const { userInfo } = yield select(state => state.webapp);
const { avatar } = payload;
const loading = message.loading('头像上传中...');
const updateAvatarDate = yield call(usersettingajax.updateAvatar, {
avatar,
nickname: userInfo.nickname,
});
setTimeout(loading);
if (updateAvatarDate.code == 200) {
......
......@@ -117,7 +117,7 @@ class EditClassModal extends React.Component {
initialValue: editClassInfo.course_id,
rules: [{ required: true, message: '课程不能为空' }],
})(
(isEdit == 1 || isStudentClass == 1) ?
(isStudentClass == 1) ?
<span>{ courseList.find(ele => ele.id == editClassInfo.course_id) && courseList.find(ele => ele.id == editClassInfo.course_id).title }</span> :
<Select>
<Option value="">请选择课程名称</Option>
......
......@@ -75,7 +75,7 @@ class LoginForm extends React.Component {
dispatch({
type: 'register/getverifycode',
payload: {
type: 4,
type: 5,
mobile,
dispatch,
},
......
import React from 'react';
import { connect } from 'dva';
import { Row, Col, Modal, Form, Input, Button, message } from 'antd';
import pageStyles from './BindWx.less';
import Cropper from '../../components/Cropper';
import { pageIn, imagify } from '../../utils/index';
const { Search } = Input;
const FormItem = Form.Item;
class UpdateNicknameForm extends React.Component {
constructor(props) {
super(props);
this.state = {
};
}
componentDidMount() {
}
componentWillUnmount() {
const { dispatch } = this.props;
}
sureBindWx = () => {
const { form, updateNickname } = this.props;
form.validateFields((err, values) => {
if (!err) {
updateNickname(values, () => {
form.resetFields();
});
}
});
}
onCancel = () => {
const { form, onCancel } = this.props;
form.resetFields();
onCancel(false);
}
render() {
const {
nickname,
nicknameChangeShow,
nicknameSubmitting,
} = this.props;
const { getFieldDecorator } = this.props.form;
return (
<div>
<Modal
visible={nicknameChangeShow}
title="绑定微信"
okText={nicknameSubmitting ? '提交中...' : '提交'}
cancelText="关闭"
zIndex={110}
onOk={this.sureBindWx}
onCancel={this.onCancel}
maskClosable={false}
confirmLoading={nicknameSubmitting}
width="540px"
>
<Form className="modalform" labelAlign="left">
<Form.Item
label="昵称"
labelCol={{ span: 3 }}
wrapperCol={{ span: 21 }}
>
<Row gutter={8}>
<Col span={15}>
{getFieldDecorator('nickname', {
initialValue: nickname,
rules: [
{ required: true, message: '请输入昵称' },
],
})(<Input type="text" maxLength={20} placeholder="请输入昵称" />)}
</Col>
</Row>
</Form.Item>
</Form>
</Modal>
</div>
);
}
}
UpdateNicknameForm.propTypes = {
};
const UpdateNickname = Form.create()(UpdateNicknameForm);
export default UpdateNickname;
......@@ -3,6 +3,7 @@ import { connect } from 'dva';
import { Row, Col, Modal, Form, Input, Button, message } from 'antd';
import pageStyles from './index.less';
import BindWx from './BindWx';
import UpdateNickname from './UpdateNickname';
import Cropper from '../../components/Cropper';
import QrcodeShow from '../../components/qrcodeShow';
import { pageIn, imagify } from '../../utils/index';
......@@ -201,6 +202,25 @@ class UserSettingForm extends React.Component {
},
});
}
updateNickname = (value, callBack) => {
const { dispatch } = this.props;
dispatch({
type: 'usersetting/updateNickname',
payload: {
nickname: value.nickname,
callBack,
},
});
}
toupdateNickanem = (visible) => {
const { dispatch } = this.props;
dispatch({
type: 'usersetting/updateState',
payload: {
nicknameChangeShow: visible,
},
});
}
render() {
const {
cropperboxShow,
......@@ -218,6 +238,8 @@ class UserSettingForm extends React.Component {
previewQrcode,
businessIsBind,
checkoutVerifyCode,
nicknameChangeShow,
nicknameSubmitting,
} = this.props;
const { getFieldDecorator } = this.props.form;
return (
......@@ -243,11 +265,15 @@ class UserSettingForm extends React.Component {
</div>
</div>
<div className={pageStyles.infoline}>
<div className={pageStyles.infodetail}>&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;{userInfo.mobile}</div>
<div className={pageStyles.infodetail}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称:&nbsp;&nbsp;{userInfo.nickname}</div>
<div className={pageStyles.infooperate} onClick={() => this.toupdateNickanem(true)}>修改昵称</div>
</div>
<div className={pageStyles.infoline}>
<div className={pageStyles.infodetail}>&nbsp;&nbsp;&nbsp;&nbsp;号:&nbsp;&nbsp;{userInfo.mobile}</div>
<div className={pageStyles.infooperate} onClick={() => this.toResetPsd(true)}>修改密码</div>
</div>
<div className={pageStyles.infoline}>
<div className={pageStyles.infodetail}>绑定微信:&nbsp;&nbsp;{businessIsBind ? '已绑定' : '未绑定'}</div>
<div className={pageStyles.infodetail}>绑定微信&nbsp;&nbsp;{businessIsBind ? '已绑定' : '未绑定'}</div>
{!businessIsBind && <div className={pageStyles.infooperate} onClick={() => this.BindWxDiaVisible(true)}>立即绑定</div>}
{businessIsBind && <div className={pageStyles.infooperate} style={{ opacity: 0 }}>立即绑定</div>}
</div>
......@@ -378,6 +404,13 @@ class UserSettingForm extends React.Component {
bindWxPost={this.bindWxPost}
checkoutVerifyCode={checkoutVerifyCode}
/>
<UpdateNickname
nickname={userInfo.nickname}
updateNickname={this.updateNickname}
nicknameChangeShow={nicknameChangeShow}
onCancel={() => this.toupdateNickanem(false)}
nicknameSubmitting={nicknameSubmitting}
/>
</Row>
);
}
......@@ -411,6 +444,8 @@ function mapStateToProps(state) {
previewQrcode,
businessIsBind,
checkoutVerifyCode,
nicknameChangeShow,
nicknameSubmitting,
} = state.usersetting;
return {
cropperboxShow,
......@@ -430,6 +465,8 @@ function mapStateToProps(state) {
previewQrcode,
businessIsBind,
checkoutVerifyCode,
nicknameChangeShow,
nicknameSubmitting,
};
}
export default connect(mapStateToProps)(UserSetting);
......@@ -10,6 +10,15 @@ export function login(params) {
data,
});
}
export function verifyCodeLogin(params) {
const data = qs.stringify(params);
return request({
url: `${api.verifyCodeLogin}`,
method: 'POST',
needAuth: false,
data,
});
}
export function newLogin(params) {
const data = qs.stringify(params);
return request({
......
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