|
@@ -1,9 +1,8 @@
|
1
|
1
|
import { Component } from "react";
|
2
|
|
-import { View, Text, Image,Input, Button } from "@tarojs/components";
|
|
2
|
+import { View, Text, Image, Input, Button } from "@tarojs/components";
|
3
|
3
|
import { AtInput } from "taro-ui";
|
4
|
4
|
import Taro from "@tarojs/taro";
|
5
|
|
-import { updateUserInfo,getUserInfo } from "../../../service";
|
6
|
|
-import avatar from "../../../images/mine/avatar.png";
|
|
5
|
+import { updateUserInfo, getUserInfo } from "../../../service";
|
7
|
6
|
import "./index.less";
|
8
|
7
|
|
9
|
8
|
export default class Index extends Component {
|
|
@@ -34,11 +33,11 @@ export default class Index extends Component {
|
34
|
33
|
return value;
|
35
|
34
|
}
|
36
|
35
|
// 昵称
|
37
|
|
- handleNickNameChange(value) {
|
|
36
|
+ handleNickNameChange(res) {
|
38
|
37
|
this.setState({
|
39
|
|
- nickName: value,
|
|
38
|
+ nickName: res.detail.value,
|
40
|
39
|
});
|
41
|
|
- return value;
|
|
40
|
+ return res.detail.value;
|
42
|
41
|
}
|
43
|
42
|
// 手机号
|
44
|
43
|
handlePhoneChange(value) {
|
|
@@ -52,7 +51,7 @@ export default class Index extends Component {
|
52
|
51
|
this.setState({
|
53
|
52
|
avatar: e.detail.avatarUrl,
|
54
|
53
|
});
|
55
|
|
- }
|
|
54
|
+ };
|
56
|
55
|
// 提交
|
57
|
56
|
handleSubmit = async () => {
|
58
|
57
|
const phoneRegex = /^1[3-9]\d{9}$/; // 中国大陆手机号正则
|
|
@@ -76,15 +75,15 @@ export default class Index extends Component {
|
76
|
75
|
wechat_account: this.state.wxAccount,
|
77
|
76
|
});
|
78
|
77
|
Taro.showToast({
|
79
|
|
- title: '修改成功',
|
80
|
|
- icon: 'none',
|
|
78
|
+ title: "修改成功",
|
|
79
|
+ icon: "none",
|
81
|
80
|
duration: 1000, // 显示持续时间,单位毫秒
|
82
|
81
|
success: () => {
|
83
|
82
|
// 等待 toast 显示完成后再返回上一页
|
84
|
83
|
setTimeout(() => {
|
85
|
84
|
Taro.navigateBack();
|
86
|
85
|
}, 1000);
|
87
|
|
- }
|
|
86
|
+ },
|
88
|
87
|
});
|
89
|
88
|
};
|
90
|
89
|
render() {
|
|
@@ -92,11 +91,14 @@ export default class Index extends Component {
|
92
|
91
|
<View className="index">
|
93
|
92
|
{/* 头像 */}
|
94
|
93
|
<View className="info-edit">
|
95
|
|
- <Image
|
96
|
|
- src={this.state.avatar||avatar}
|
97
|
|
- className="info-edit-img"
|
98
|
|
- />
|
99
|
|
- {/* <Button onChooseAvatar={this.handleChooseAvatar} open-type="chooseAvatar" className="info-edit-title">更换头像</Button> */}
|
|
94
|
+ <Image src={this.state.avatar || 'https://yushi.tos-cn-beijing.volces.com/mine/avatar.png'} className="info-edit-img" />
|
|
95
|
+ {/* <Button
|
|
96
|
+ onChooseAvatar={this.handleChooseAvatar}
|
|
97
|
+ open-type="chooseAvatar"
|
|
98
|
+ className="info-edit-title"
|
|
99
|
+ >
|
|
100
|
+ 更换头像
|
|
101
|
+ </Button> */}
|
100
|
102
|
</View>
|
101
|
103
|
{/* 内容 */}
|
102
|
104
|
<View className="info-edit-content">
|
|
@@ -109,19 +111,28 @@ export default class Index extends Component {
|
109
|
111
|
onChange={this.handleAccountChange.bind(this)}
|
110
|
112
|
/> */}
|
111
|
113
|
<AtInput
|
|
114
|
+ className="info-edit-input"
|
112
|
115
|
name="value"
|
113
|
116
|
title="鱼市昵称"
|
114
|
117
|
type="text"
|
115
|
118
|
placeholder="请输入鱼市昵称"
|
116
|
|
- value={this.state.nickName}
|
117
|
|
- onChange={this.handleNickNameChange.bind(this)}
|
118
|
|
- />
|
|
119
|
+ >
|
|
120
|
+ <Input
|
|
121
|
+ name="value"
|
|
122
|
+ title="鱼市昵称"
|
|
123
|
+ type="nickname"
|
|
124
|
+ placeholder="请输入鱼市昵称"
|
|
125
|
+ value={this.state.nickName}
|
|
126
|
+ onInput={this.handleNickNameChange.bind(this)}
|
|
127
|
+ />
|
|
128
|
+ </AtInput>
|
119
|
129
|
<AtInput
|
120
|
130
|
border={false}
|
121
|
131
|
name="value"
|
122
|
132
|
title="手机号"
|
123
|
133
|
type="number"
|
124
|
134
|
placeholder="请输入手机号"
|
|
135
|
+ placeholderStyle="color: #828282;"
|
125
|
136
|
value={this.state.phone}
|
126
|
137
|
onChange={this.handlePhoneChange.bind(this)}
|
127
|
138
|
/>
|