|
@@ -139,11 +139,21 @@
|
|
|
this.phoneError = true;
|
|
|
this.loading = false;
|
|
|
return;
|
|
|
+ } else if (!isNumber(this.phone)) {
|
|
|
+ Toast.fail("请输入正确格式的手机号");
|
|
|
+ this.phoneError = true;
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ } else if (isEmojiCharacter(this.username)) {
|
|
|
+ Toast.fail('不支持表情哦');
|
|
|
+ this.usernameError = true;
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
} else if (this.username.length < 1) {
|
|
|
this.usernameError = true;
|
|
|
this.loading = false;
|
|
|
return;
|
|
|
- } else if (this.wechat.length < 6) {
|
|
|
+ } else if (isEmojiCharacter(this.wechat) || this.wechat.length < 6) {
|
|
|
this.wechatError = true;
|
|
|
Toast.fail('请输入正确格式的微信号');
|
|
|
this.loading = false;
|
|
@@ -166,62 +176,81 @@
|
|
|
BasicFunction.get_data("http://gift.fogice.com/server/fileserver/upload?sign=abcdefg", function (res) {
|
|
|
// console.log('----- upload photo result -----');
|
|
|
// console.log(res);
|
|
|
- if (res.model === undefined || res.model.length === 0) {
|
|
|
- Toast.fail('上传失败,请重试');
|
|
|
- return;
|
|
|
- }
|
|
|
- if (res.ret === '10000') {
|
|
|
- let imgURL = res.model; // TODO: 把imgurl也加入用户信息
|
|
|
- let userId = localStorage.getItem('frontend-userid');
|
|
|
- // console.log('----- User Identity -----');
|
|
|
- BasicFunction.get_data("smartIdentity/list?userId=" + userId, function (res) {
|
|
|
- if (res.ret === '10000') {
|
|
|
- let useridentity = res.model.list[0];
|
|
|
- useridentity.userWxAccount = that.wechat;
|
|
|
- useridentity.dormDistrict = that.dorId;
|
|
|
- useridentity.userSex = parseInt(that.radio);
|
|
|
- useridentity.userSchoolCardPic = imgURL;
|
|
|
- useridentity.userReviewStatus = 100;
|
|
|
- useridentity.reviewerNote = "未审核";
|
|
|
- useridentity.reviewerNoteToUser = "未审核";
|
|
|
- BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
|
|
|
- // console.log(useridentity);
|
|
|
- // console.log(response);
|
|
|
- if (response.ret === "10000") {
|
|
|
- // console.log('----- User Info -----');
|
|
|
- BasicFunction.get_data('smartUsers/list?uid=' + userId, function (res) {
|
|
|
- // console.log(res);
|
|
|
- if (res.ret === '10000') {
|
|
|
- let user = res.model.list[0];
|
|
|
- user.name = that.username;
|
|
|
- user.phone = that.phone;
|
|
|
- // console.log('----- Update User Info -----');
|
|
|
- // console.log(user);
|
|
|
- BasicFunction.get_data('smartUsers/updateBatch', function (res) {
|
|
|
+ // if (res.model === undefined || res.model.length === 0) {
|
|
|
+ // Toast.fail('上传失败,请重试');
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ try {
|
|
|
+ let imgURL = res.model;
|
|
|
+ if (res.ret === '10000') {
|
|
|
+ let userId = localStorage.getItem('frontend-userid');
|
|
|
+ // console.log('----- User Identity -----');
|
|
|
+ BasicFunction.get_data("smartIdentity/list?userId=" + userId, function (res) {
|
|
|
+ try {
|
|
|
+ let useridentity = res.model.list[0];
|
|
|
+ if (res.ret === '10000') {
|
|
|
+ useridentity.userWxAccount = that.wechat;
|
|
|
+ useridentity.dormDistrict = that.dorId;
|
|
|
+ useridentity.userSex = parseInt(that.radio);
|
|
|
+ useridentity.userSchoolCardPic = imgURL;
|
|
|
+ useridentity.userReviewStatus = 100;
|
|
|
+ useridentity.reviewerNote = "未审核";
|
|
|
+ useridentity.reviewerNoteToUser = "未审核";
|
|
|
+ BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
|
|
|
+ // console.log(useridentity);
|
|
|
+ // console.log(response);
|
|
|
+ if (response.ret === "10000") {
|
|
|
+ // console.log('----- User Info -----');
|
|
|
+ BasicFunction.get_data('smartUsers/list?uid=' + userId, function (res) {
|
|
|
// console.log(res);
|
|
|
- if (res.ret === '10000') {
|
|
|
- Toast.success("注册成功");
|
|
|
- that.$router.push('presentRegister');
|
|
|
- } else {
|
|
|
- Toast.fail('注册失败');
|
|
|
+ try {
|
|
|
+ let user = res.model.list[0];
|
|
|
+ if (res.ret === '10000') {
|
|
|
+ user.name = that.username;
|
|
|
+ user.phone = that.phone;
|
|
|
+ // console.log('----- Update User Info -----');
|
|
|
+ // console.log(user);
|
|
|
+ BasicFunction.get_data('smartUsers/updateBatch', function (res) {
|
|
|
+ // console.log(res);
|
|
|
+ if (res.ret === '10000') {
|
|
|
+ Toast.success("注册成功");
|
|
|
+ that.$router.push('presentRegister');
|
|
|
+ } else {
|
|
|
+ Toast.fail('注册失败');
|
|
|
+ that.loading = false;
|
|
|
+ }
|
|
|
+ }, [user]);
|
|
|
+ } else {
|
|
|
+ Toast.fail('获取用户信息失败');
|
|
|
+ that.loading = false;
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.warn(e);
|
|
|
+ Toast.fail('获取用户信息失败');
|
|
|
that.loading = false;
|
|
|
}
|
|
|
- }, [user]);
|
|
|
+ }, {});
|
|
|
} else {
|
|
|
- Toast.fail('获取用户信息失败');
|
|
|
+ Toast.fail("注册失败,请检查网络");
|
|
|
that.loading = false;
|
|
|
}
|
|
|
- }, {});
|
|
|
+ }, [useridentity]);
|
|
|
} else {
|
|
|
- Toast.fail("注册失败,请检查网络");
|
|
|
+ Toast.fail('获取信息失败');
|
|
|
that.loading = false;
|
|
|
}
|
|
|
- }, [useridentity]);
|
|
|
- } else {
|
|
|
- Toast.fail('获取信息失败');
|
|
|
- }
|
|
|
- }, {});
|
|
|
- } else {
|
|
|
+ } catch (e) {
|
|
|
+ console.warn(e);
|
|
|
+ Toast.fail('获取信息失败');
|
|
|
+ that.loading = false;
|
|
|
+ }
|
|
|
+ }, {});
|
|
|
+ } else {
|
|
|
+ Toast.fail('上传图片失败,请检查网络');
|
|
|
+ that.loading = false;
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.warn(e);
|
|
|
Toast.fail('上传图片失败,请检查网络');
|
|
|
that.loading = false;
|
|
|
}
|
|
@@ -284,6 +313,14 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 判断是否是数字
|
|
|
+ function isNumber(str) {
|
|
|
+ for (let i = 0; i < str.length; i++) {
|
|
|
+ if (str[i] < '0' || str[i] > '9') return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|