12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import BaseStore from '@src/stores/base';
- export default class UserStore extends BaseStore {
- initState() {
-
-
-
-
- return { login: false };
- }
- originInviteCode(inviteCode) {
- this.setState({
- inviteCode,
- });
- }
-
- token() {
- return this.apiPost('/auth/token');
- }
-
- login(area, mobile, mobileVerifyCode, inviteCode) {
- if (!inviteCode) {
- ({ inviteCode } = this.state);
- }
- return this.apiPost('/auth/login', { area, mobile, mobileVerifyCode, inviteCode });
- }
- loginWechat(code) {
- return this.apiGet('/auth/wechat', { code }).then((info) => {
- this.setState({ login: true, info });
- return info;
- });
- }
-
- logout() {
- return this.apiPost('/auth/logout');
- }
-
- bind(area, mobile, mobileVerifyCode, inviteCode) {
- if (!inviteCode) {
- ({ inviteCode } = this.state);
- }
- return this.apiPost('/auth/bind', { area, mobile, mobileVerifyCode, inviteCode });
- }
-
- validInviteCode(code) {
- return this.apiGet('/auth/valid/invite_code', { code });
- }
-
- validMobile(area, mobile) {
- return this.apiGet('/auth/valid/mobile', { area, mobile });
- }
-
- validWechat(area, mobile) {
- return this.apiGet('/auth/valid/wechat', { area, mobile });
- }
- }
- export const User = new UserStore({ key: 'user', local: true });
|