Commit 8831e48b authored by 前端-许佳敏's avatar 前端-许佳敏

暂存

parent c710903d
This diff is collapsed.
......@@ -6,6 +6,7 @@
"start:analyze": "ANALYZE=1 umi dev",
"clean": "rimraf node_modules",
"start": "yarn scripts:build && umi dev",
"start:dev": "umi dev",
"build": "umi build",
"build:analyze": "ANALYZE=1 umi build",
"postinstall": "umi generate tmp",
......@@ -25,13 +26,12 @@
"dependencies": {
"@ant-design/icons": "^4.2.1",
"@ant-design/pro-layout": "^5.0.16",
"@formily/antd": "^1.2.7",
"@formily/antd-components": "^1.2.7",
"@formily/antd": "^1.2.8",
"@formily/antd-components": "^1.2.8",
"@umijs/preset-react": "1.x",
"@umijs/test": "^3.2.0",
"bizcharts": "^4.0.7",
"god": "0.1.7",
"god-tool": "2.4.0",
"god": "0.1.13",
"lint-staged": "^10.0.7",
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
......@@ -50,7 +50,7 @@
"chalk": "^4.1.0",
"clone": "^2.1.2",
"fs-extra": "^9.0.1",
"god-yapi2ts": "^1.5.0",
"god-yapi2ts": "^1.6.0",
"gulp": "^4.0.2",
"json2ts": "^0.0.7",
"ora": "^4.0.4"
......
......@@ -7,7 +7,9 @@ import '@/global/styles/global.less'; // 导入全局样式
// 默认引入所有的ant样式, 不引入css因为无法做到变量覆盖
import 'antd/dist/antd.less'
import { setup } from '@formily/antd-components';
setup()
let extraRoutes = []
/**
......
......@@ -17,7 +17,7 @@ export interface Element {
id: number;
fieldName: string;
fieldCNName: string;
fieldType?: any;
fieldType: string;
fieldLength: number;
fieldEmpty: number;
fieldOrder: number;
......
export interface IUserModule {
name: string;
age: number;
export interface ILoginModule {
username: string;
password: string;
res: object;
printNameAndAge: string;
setName(name: string):void;
getAsyncAge(): Promise<number>;
}
\ No newline at end of file
handleLogin(): Promise<object>;
}
......@@ -129,7 +129,8 @@
.registerForm {
max-width: 335px;
margin: 40px auto;
margin: 0px auto;
padding-top: 40px;
}
.registerBox {
......@@ -138,14 +139,15 @@
padding-bottom: 40px;
background: #fff;
padding-bottom: 40px;
.stepWrap {
height: 72px;
background: #FAFBFC;
padding: 0 115px;
.make-center(flexAlign);
}
}
.stepWrap {
height: 72px;
background: #FAFBFC;
padding: 0 115px;
.make-center(flexAlign);
}
.formBoxStep1 {
width: 324px;
......
......@@ -11,7 +11,7 @@ import { FormPage } from 'god'
import { IFormControllers, IFormButtonTypes } from 'god/dist/src/form-page'
import { Link, history } from 'umi'
import im_success from '../../../mockStatic/im_success.png'
import { FormStep, FormBlock, Input, Password, Checkbox } from '@formily/antd-components'
import { FormStep, FormBlock, Input, Password, Checkbox, setup } from '@formily/antd-components'
import SchemaForm, { Field, FormMegaLayout, FormButtonGroup, createFormActions, FormEffectHooks } from '@formily/antd';
import useCountDown from '@/utils/hooks';
import { GlobalConfig } from '@/global/config';
......@@ -49,7 +49,6 @@ const CustomCheckbox = props => {
const CustomInput = props => {
const { help, ...restProps } = props
console.log(props)
return (
<AntdInput
{...restProps}
......@@ -100,36 +99,10 @@ const UserRegistry = () => {
{ title: '注册成功', key: 'success', name: 'success' },
]
const handleOneSubmit = (values: any) => {
let obj = { ...values }
delete obj.readme
delete obj.confirm
console.log(obj, 'values')
PublicApi.postRegister(obj).then(res => {
console.log(res,'res')
// if(res.data.id) setCurrent(1)
})
if(values.phone) setCurrent(1)
}
const handleJumpLogin = () => {
history.push('/user/login')
}
const onChange = (value: any) => {
console.log(value.target.value,'value')
}
const handleSecondSubmit = (values: any) => {
console.log(values,'values')
setCurrent(1.1)
}
const handleLicenseSubmit = (values: any) => {
console.log(values, 'values')
setCurrent(2)
}
const [time, setTime] = useState(5); // timer
// useEffect(() => {
// clearInterval(timeChange)
......@@ -204,6 +177,7 @@ const UserRegistry = () => {
label: v.typeName
}
})
console.log(mapMemberType)
const mapServerType = GlobalConfig.userRegister.useType.businessType.map(v => {
return {
......@@ -220,7 +194,7 @@ const UserRegistry = () => {
// 写死传入的区号
formCache.countryCode = '+86'
const params = omit(formCache, ['isRead', 'confirmPassword'])
PublicApi.postRegister(params).then(() => {
PublicApi.postMemberRegister(params).then(() => {
actions.dispatch('onFormStepNext', {})
setCurrent(current + 1)
})
......@@ -253,7 +227,7 @@ const UserRegistry = () => {
current={current}
>
</FormStep>
<FormMegaLayout className={styles.registerForm} name='message'>
<FormMegaLayout className={styles.registerForm} name='message' visible={current === 0}>
<Field name="phone" x-rules={{required: true, pattern: PATTERN_MAPS.phone}} x-component-props={{placeholder: '请输入你的手机号码', size: 'large'}} x-props={{addonBefore: <div className={styles.formBefore}>+86</div>}} x-component="Input" />
<Field name="smsCode" x-rules={{required: true, pattern: PATTERN_MAPS.smsCode}} x-component-props={{ size: 'large', style: {width: 220}}} x-props={{addonAfter: <Button disabled={isActive} style={{minWidth: 110, marginLeft: 8}} size='large' onClick={start}>{text}</Button>}} x-component="Input" />
<Field name="password" x-rules={{required: true, pattern: PATTERN_MAPS.password}} x-component-props={{ placeholder: '设置你的登录密码', size: 'large'}} x-component="Password" />
......
This source diff could not be displayed because it is too large. You can view the blob instead.
import {action, computed, observable, runInAction} from 'mobx'
import { IUserModule } from '@/module/userModule';
import { action, computed, observable, runInAction } from 'mobx'
import { ILoginModule } from '@/module/userModule';
// import { userDetailGet } from '@/services/user'
const demoAsync = ():Promise<number> => new Promise(resolve => setTimeout(() => resolve(100), 2000))
const userInfo = localStorage.getItem('userInfo')
class UserStore implements IUserModule {
@observable public name: string = 'Bob';
@observable public age: number = 0;
class LoginStore implements ILoginModule {
@observable public username: string = 'admin';
@observable public password: string = "123456";
@observable public res: object = {};
@observable public userInfo = userInfo ? JSON.parse(userInfo) : {}
// 可以改变对应的状态值
// @todo 接入更新用户信息接口
@action.bound
public async updateUserInfo() {
// try {
// const res = await userDetailGet()
// runInAction(() => {
// this.userInfo = res.data;
// localStorage.setItem('userInfo', JSON.stringify(this.userInfo))
// })
// } catch (error) {
// return error
// }
}
// 当有时需要拼接状态,但又不希望改变原有状态,可以采取如下, 类似vue中的computed
@computed
public get printNameAndAge(): string {
return `hello, ${this.name}, your age is ${this.age}`
public get printInfo(): string {
return `hello, ${this.username}, your password is ${this.password}`
}
// 可以改变对应的状态值
@action.bound
public setUsername(username: string) {
this.username = username;
}
// 可以改变存在name中的值
@action.bound
public setName(name: string) {
this.name = name;
public setPassword(password: string) {
this.password = password;
}
// 异步修改数据, 需要使用bound,保持this指向当前store
@action.bound
public async getAsyncAge() {
public async handleLogin() {
try {
const result = await demoAsync()
let params = {
username: this.username,
password: this.password
}
const result = {}
runInAction(() => {
this.age = result
this.res = result
})
return result
......@@ -35,4 +62,4 @@ class UserStore implements IUserModule {
}
}
export default UserStore
\ No newline at end of file
export default LoginStore
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