|
|
|
|
@ -30,7 +30,6 @@ import Navbar from "../../components/navbar/navbar";
|
|
|
|
|
import PopupAlert from "../../components/popup/popup-alert";
|
|
|
|
|
/** 自定义组件 **/
|
|
|
|
|
|
|
|
|
|
import { getGlobalData, setGlobalData } from "../../utils/global";
|
|
|
|
|
import { loading, msg } from "../../utils/traoAPI";
|
|
|
|
|
import FormData from "../../utils/wxFormdata/formData";
|
|
|
|
|
|
|
|
|
|
@ -49,6 +48,7 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
isShowIntegralText: false,
|
|
|
|
|
cityShow: false,
|
|
|
|
|
timeShow: false,
|
|
|
|
|
isSubmit: false,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
values: [],
|
|
|
|
|
@ -78,7 +78,7 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
city: this.props.userInfo.city, // 市
|
|
|
|
|
areaId: this.props.userInfo.areaId, // 县区
|
|
|
|
|
area: this.props.userInfo.area, // 县区
|
|
|
|
|
headimg: null,
|
|
|
|
|
file: null,
|
|
|
|
|
},
|
|
|
|
|
pickerCityValue: [],
|
|
|
|
|
// maxDate: new Date().getTime(),
|
|
|
|
|
@ -98,6 +98,8 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
this.setState({ titleHeight, menu });
|
|
|
|
|
|
|
|
|
|
this.initData();
|
|
|
|
|
|
|
|
|
|
console.log("userInfo.birthday", this.state.userInfo.birthday);
|
|
|
|
|
}
|
|
|
|
|
componentDidMount() {}
|
|
|
|
|
|
|
|
|
|
@ -132,6 +134,7 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
this.GetAreaListByPid_level2(res.data.data[0].id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.isSubmitCheck();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
GetAreaListByPid_level2 = async (level2 = 0, isInit = false) => {
|
|
|
|
|
@ -185,11 +188,13 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
formData.append("areaId", form.areaId);
|
|
|
|
|
formData.append("birthday", userInfo.birthday);
|
|
|
|
|
formData.append("nickname", userInfo.nickname);
|
|
|
|
|
formData.append("headimg", userInfo.headimg);
|
|
|
|
|
if (userInfo.headimg) {
|
|
|
|
|
console.log("userInfo.headimg", userInfo.headimg);
|
|
|
|
|
console.log("indexOf", userInfo.headimg.indexOf("//tmp/"));
|
|
|
|
|
// 如果头像是小程序相对路径,则上传文件
|
|
|
|
|
if (userInfo.headimg.indexOf("//tmp/") > -1) {
|
|
|
|
|
formData.appendFile("headimg", userInfo.headimg, "headimg.png");
|
|
|
|
|
formData.appendFile("file", userInfo.headimg, "headimg.png");
|
|
|
|
|
} else {
|
|
|
|
|
formData.append("file", null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let data = formData.getData();
|
|
|
|
|
@ -216,7 +221,7 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
goUser = () => {
|
|
|
|
|
Taro.switchTab({
|
|
|
|
|
Taro.reLaunch({
|
|
|
|
|
url: "/pages/user/user",
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
@ -225,6 +230,7 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
let { userInfo } = this.state;
|
|
|
|
|
userInfo.headimg = event.detail.avatarUrl;
|
|
|
|
|
this.setState({ userInfo });
|
|
|
|
|
this.isSubmitCheck();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onSubmit = async () => {
|
|
|
|
|
@ -239,7 +245,9 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
await this.UpdateUser();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onSkip = () => {};
|
|
|
|
|
onSkip = () => {
|
|
|
|
|
this.goUser();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
pickerChange = (event) => {
|
|
|
|
|
console.log("pickerChange", event);
|
|
|
|
|
@ -283,6 +291,7 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
form.areaId = this.state.leve3region[index[2]].id;
|
|
|
|
|
this.setState({ form });
|
|
|
|
|
this.onCityCancel();
|
|
|
|
|
this.isSubmitCheck();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onCityCancel = () => {
|
|
|
|
|
@ -303,8 +312,8 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
this.setState({ timeShow: false });
|
|
|
|
|
};
|
|
|
|
|
onTimePickerCancel = () => {
|
|
|
|
|
console.log("onTimePickerCancel");
|
|
|
|
|
this.closeTime();
|
|
|
|
|
this.isSubmitCheck();
|
|
|
|
|
};
|
|
|
|
|
onTimePickerConfirm = (picker) => {
|
|
|
|
|
let { userInfo } = this.state;
|
|
|
|
|
@ -313,18 +322,38 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
this.setState({ userInfo });
|
|
|
|
|
}
|
|
|
|
|
this.closeTime();
|
|
|
|
|
this.isSubmitCheck();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onNicknameChange = (event) => {
|
|
|
|
|
console.log("onNicknameChange", event);
|
|
|
|
|
// console.log("onNicknameChange", event);
|
|
|
|
|
let { userInfo } = this.state;
|
|
|
|
|
userInfo.nickname = event.detail.value;
|
|
|
|
|
this.setState({ userInfo });
|
|
|
|
|
this.isSubmitCheck();
|
|
|
|
|
};
|
|
|
|
|
onNickNameReview = (event) => {
|
|
|
|
|
console.log("onNickNameReView", event);
|
|
|
|
|
// console.log("onNickNameReview", event);
|
|
|
|
|
this.isSubmitCheck();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
isSubmitCheck() {
|
|
|
|
|
let { userInfo, form } = this.state;
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
userInfo.nickname &&
|
|
|
|
|
userInfo.headimg &&
|
|
|
|
|
form.province &&
|
|
|
|
|
form.city &&
|
|
|
|
|
form.area &&
|
|
|
|
|
userInfo.birthday
|
|
|
|
|
) {
|
|
|
|
|
this.setState({ isSubmit: true });
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({ isSubmit: false });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
closeIntegralText = () => {
|
|
|
|
|
this.setState({ isShowIntegralText: false });
|
|
|
|
|
|
|
|
|
|
@ -342,6 +371,7 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
form,
|
|
|
|
|
minDate,
|
|
|
|
|
isShowIntegralText,
|
|
|
|
|
isSubmit,
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
const formatter = (type, value) => {
|
|
|
|
|
@ -380,14 +410,6 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
></Image>
|
|
|
|
|
)}
|
|
|
|
|
</Button>
|
|
|
|
|
{/* <Input
|
|
|
|
|
type="nickname"
|
|
|
|
|
className="nickname"
|
|
|
|
|
placeholder="请填写您的昵称"
|
|
|
|
|
value={userInfo.nickname}
|
|
|
|
|
maxlength={20}
|
|
|
|
|
onInput={this.onNicknameChange}
|
|
|
|
|
></Input> */}
|
|
|
|
|
<Input
|
|
|
|
|
type="nickname"
|
|
|
|
|
className="ipt nickname"
|
|
|
|
|
@ -435,7 +457,8 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
</View>
|
|
|
|
|
<View className="value">
|
|
|
|
|
{/* <picker className="picker" mode="date" bindchange="bindbirthdayPickerChange" end="{{dateend}}" value="{{ageindex}}" range="{{age}}">picker</picker> */}
|
|
|
|
|
<View>{userInfo.birthday}</View>
|
|
|
|
|
|
|
|
|
|
<View>{userInfo.birthday || dayjs().format("YYYY-MM-DD")}</View>
|
|
|
|
|
<View className="righticon">
|
|
|
|
|
<Image
|
|
|
|
|
src={require("../../img/user/right.png")}
|
|
|
|
|
@ -447,9 +470,16 @@ class UserInfoDetail extends Component<any, any> {
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
<View className="btn_box flex aitems jcenter">
|
|
|
|
|
<View className="btn" onClick={this.onSubmit}>
|
|
|
|
|
{/* <View className="btn" onClick={this.onSubmit}>
|
|
|
|
|
保存
|
|
|
|
|
</View>
|
|
|
|
|
</View> */}
|
|
|
|
|
{isSubmit ? (
|
|
|
|
|
<View className="btn" onClick={this.onSubmit}>
|
|
|
|
|
保存
|
|
|
|
|
</View>
|
|
|
|
|
) : (
|
|
|
|
|
<View className="btn btn-disable">保存</View>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
<Popup show={cityShow} position={"bottom"} onClose={this.closeShow}>
|
|
|
|
|
|