|
@@ -1,9 +1,11 @@
|
1
|
|
-import { View, Button, Form, Text, Image, Picker, Switch, Input, Radio, Label, ScrollView } from '@tarojs/components'
|
|
1
|
+import { View, Button, Text, Image, Switch, Input, Radio, Label, ScrollView } from '@tarojs/components'
|
2
|
2
|
import Taro from '@tarojs/taro';
|
3
|
3
|
import { useEffect, useState } from 'react';
|
4
|
|
-import { setPersons } from '../../services/dogAPI';
|
5
|
|
-import { useModel } from '../../store';
|
6
|
|
-import { uploadFile } from '../../utils/request';
|
|
4
|
+import { setPersons } from '@/services/dogAPI';
|
|
5
|
+import { useModel } from '@/store';
|
|
6
|
+import { uploadFile } from '@/utils/request';
|
|
7
|
+import Form from '@/components/Form';
|
|
8
|
+import Picker from '@/components/Picker';
|
7
|
9
|
|
8
|
10
|
import './style.less'
|
9
|
11
|
|
|
@@ -35,24 +37,24 @@ export default (props) => {
|
35
|
37
|
|
36
|
38
|
}
|
37
|
39
|
const formSubmit = e => {
|
38
|
|
- const formData = e.detail.value
|
|
40
|
+ const formData = e
|
39
|
41
|
console.log(e)
|
40
|
42
|
|
41
|
|
- // setPerson
|
42
|
|
- setPersons({ ...userInfo, ...formData, sex: userSex[formData.sex].value, }).then((e) => {
|
43
|
|
- console.log('e', e);
|
44
|
|
- setPerson(e)
|
45
|
|
- Taro.showToast({
|
46
|
|
- title: '保存成功',
|
47
|
|
- icon: 'none',
|
48
|
|
- duration: 1000
|
49
|
|
- })
|
50
|
|
- setTimeout(() => {
|
51
|
|
- Taro.navigateBack({
|
52
|
|
- delta: 1
|
53
|
|
- })
|
54
|
|
- }, 600);
|
55
|
|
- })
|
|
43
|
+ // // setPerson
|
|
44
|
+ // setPersons({ ...userInfo, ...formData, sex: userSex[formData.sex].value, }).then((e) => {
|
|
45
|
+ // console.log('e', e);
|
|
46
|
+ // setPerson(e)
|
|
47
|
+ // Taro.showToast({
|
|
48
|
+ // title: '保存成功',
|
|
49
|
+ // icon: 'none',
|
|
50
|
+ // duration: 1000
|
|
51
|
+ // })
|
|
52
|
+ // setTimeout(() => {
|
|
53
|
+ // Taro.navigateBack({
|
|
54
|
+ // delta: 1
|
|
55
|
+ // })
|
|
56
|
+ // }, 600);
|
|
57
|
+ // })
|
56
|
58
|
}
|
57
|
59
|
|
58
|
60
|
|
|
@@ -93,19 +95,15 @@ export default (props) => {
|
93
|
95
|
}}
|
94
|
96
|
>
|
95
|
97
|
<View class='page' >
|
96
|
|
- <Form onSubmit={formSubmit} >
|
97
|
|
- <mp-form >
|
|
98
|
+ <Form onSubmit={formSubmit}>
|
|
99
|
+ <mp-form>
|
98
|
100
|
<mp-cells title=' '>
|
99
|
101
|
<mp-cell title='姓名' extClass=''>
|
100
|
102
|
<Input name='nickName' placeholder='请输入姓名' value={person?.nickName} />
|
101
|
103
|
</mp-cell>
|
102
|
104
|
<mp-cell title='性别' extClass=''>
|
103
|
105
|
{/* <Input name='sex' placeholder='请输入卡号' /> */}
|
104
|
|
- <Picker name='sex' mode='selector' rangeKey='text' range={userSex} onChange={(e) => { handleSetUser('sex', e.detail.value) }}>
|
105
|
|
- <View className='picker'>
|
106
|
|
- {userInfo.sex == 1 ? '男' : userInfo.sex == 2 ? '女' : userInfo.sex}
|
107
|
|
- </View>
|
108
|
|
- </Picker>
|
|
106
|
+ <Picker name='sex' rangeKey='text' rangeValue='value' range={userSex} />
|
109
|
107
|
</mp-cell>
|
110
|
108
|
<mp-cell title='手机号' extClass=''>
|
111
|
109
|
<Input name='phone' type='number' placeholder='请输入手机号' maxlength={11} value={person?.phone} />
|
|
@@ -123,10 +121,9 @@ export default (props) => {
|
123
|
121
|
<Image className='userImg1' name='cardImg1' src={userInfo.cardImg1} onClick={(e) => handleSetUser('img', e.detail.value)} />
|
124
|
122
|
}
|
125
|
123
|
</mp-cell>
|
126
|
|
-
|
127
|
124
|
</mp-cells>
|
128
|
125
|
</mp-form>
|
129
|
|
- <View slot='button' style={{ margin: '4em 0 2em 0' }}>
|
|
126
|
+ <View style={{ margin: '4em 0 2em 0' }}>
|
130
|
127
|
<Button style={{ backgroundColor: '#fbd804', borderRadius: '40px', color: '#000', border: '0px' }} class='weui-btn' type='primary' loading={false} formType='submit'>确定</Button>
|
131
|
128
|
</View>
|
132
|
129
|
</Form>
|