Showing
1 changed file
with
22 additions
and
79 deletions
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | </view> |
| 9 | 9 | <view class="u-m-t-20 basic-text"><text class="text">基本资料</text></view> |
| 10 | 10 | <view class="basic-main"> |
| 11 | - <u--form labelPosition="left" :model="myInfoModel" :rules="rules" ref="myInfoFormRef"> | |
| 11 | + <u--form labelPosition="left" :model="myInfoModel"> | |
| 12 | 12 | <u-form-item labelWidth="80px" label="真实姓名" prop="userInfo.realName" borderBottom ref="item1"> |
| 13 | 13 | <u--input placeholder="请输入真实姓名" v-model="myInfoModel.userInfo.realName" border="none"></u--input> |
| 14 | 14 | </u-form-item> |
| ... | ... | @@ -86,54 +86,6 @@ export default { |
| 86 | 86 | dateTime: Number(new Date()), |
| 87 | 87 | avatar: '', |
| 88 | 88 | id: '', |
| 89 | - rules: { | |
| 90 | - 'userInfo.realName': [ | |
| 91 | - { | |
| 92 | - type: 'string', | |
| 93 | - required: true, | |
| 94 | - message: '请填写姓名', | |
| 95 | - trigger: ['blur', 'change'] | |
| 96 | - }, | |
| 97 | - { | |
| 98 | - validator: (rule, value, callback) => { | |
| 99 | - return uni.$u.test.chinese(value); | |
| 100 | - }, | |
| 101 | - message: '姓名必须为中文', | |
| 102 | - trigger: ['change', 'blur'] | |
| 103 | - } | |
| 104 | - ], | |
| 105 | - 'userInfo.phoneNumber': [ | |
| 106 | - { | |
| 107 | - type: 'string', | |
| 108 | - required: true, | |
| 109 | - message: '请填写手机号码', | |
| 110 | - trigger: ['blur', 'change'] | |
| 111 | - }, | |
| 112 | - { | |
| 113 | - // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明 | |
| 114 | - validator: (rule, value, callback) => { | |
| 115 | - return uni.$u.test.mobile(value); | |
| 116 | - }, | |
| 117 | - message: '手机必须为数字', | |
| 118 | - trigger: ['change', 'blur'] | |
| 119 | - } | |
| 120 | - ], | |
| 121 | - 'userInfo.email': [ | |
| 122 | - { | |
| 123 | - type: 'string', | |
| 124 | - required: true, | |
| 125 | - message: '请填写邮箱', | |
| 126 | - trigger: ['blur', 'change'] | |
| 127 | - }, | |
| 128 | - { | |
| 129 | - validator: (rule, value, callback) => { | |
| 130 | - return uni.$u.test.email(value); | |
| 131 | - }, | |
| 132 | - message: '邮箱必须带有@', | |
| 133 | - trigger: ['change', 'blur'] | |
| 134 | - } | |
| 135 | - ] | |
| 136 | - }, | |
| 137 | 89 | info: {}, |
| 138 | 90 | openIds: '' |
| 139 | 91 | }; |
| ... | ... | @@ -153,7 +105,6 @@ export default { |
| 153 | 105 | }, |
| 154 | 106 | onShow() { |
| 155 | 107 | let getOpenId = getApp().globalData.openId; |
| 156 | - console.log('获取全局openId', getOpenId); | |
| 157 | 108 | if (getOpenId) { |
| 158 | 109 | this.openIds = getOpenId; |
| 159 | 110 | } |
| ... | ... | @@ -161,7 +112,6 @@ export default { |
| 161 | 112 | methods: { |
| 162 | 113 | confrimBind(e) { |
| 163 | 114 | if (e) { |
| 164 | - console.log('Bind', e.third?.thirdUserId); | |
| 165 | 115 | //解绑 |
| 166 | 116 | let httpData = { |
| 167 | 117 | appUserId: e.data?.userId, |
| ... | ... | @@ -231,37 +181,30 @@ export default { |
| 231 | 181 | }); |
| 232 | 182 | }, |
| 233 | 183 | onSubmitFunc() { |
| 234 | - this.$refs.myInfoFormRef | |
| 235 | - .validate() | |
| 184 | + let httpData = { | |
| 185 | + avatar: this.avatar, | |
| 186 | + email: this.myInfoModel.userInfo.email, | |
| 187 | + id: this.id, | |
| 188 | + phoneNumber: this.myInfoModel.userInfo.phoneNumber, | |
| 189 | + realName: this.myInfoModel.userInfo.realName | |
| 190 | + }; | |
| 191 | + uni.$u.http | |
| 192 | + .put('/yt/user/center', httpData) | |
| 236 | 193 | .then(res => { |
| 237 | - let httpData = { | |
| 238 | - avatar: this.avatar, | |
| 239 | - email: this.myInfoModel.userInfo.email, | |
| 240 | - id: this.id, | |
| 241 | - phoneNumber: this.myInfoModel.userInfo.phoneNumber, | |
| 242 | - realName: this.myInfoModel.userInfo.realName | |
| 243 | - }; | |
| 244 | - uni.$u.http | |
| 245 | - .put('/yt/user/center', httpData) | |
| 246 | - .then(res => { | |
| 247 | - if (res) { | |
| 248 | - uni.showToast({ | |
| 249 | - title: '更新个人资料成功~', | |
| 250 | - icon: 'none' | |
| 251 | - }); | |
| 252 | - setTimeout(() => { | |
| 253 | - uni.navigateBack({ | |
| 254 | - delta: 1 | |
| 255 | - }); | |
| 256 | - }, 500); | |
| 257 | - } | |
| 258 | - }) | |
| 259 | - .catch(e => { | |
| 260 | - uni.$u.toast(e.data.message); | |
| 194 | + if (res) { | |
| 195 | + uni.showToast({ | |
| 196 | + title: '更新个人资料成功~', | |
| 197 | + icon: 'none' | |
| 261 | 198 | }); |
| 199 | + setTimeout(() => { | |
| 200 | + uni.navigateBack({ | |
| 201 | + delta: 1 | |
| 202 | + }); | |
| 203 | + }, 500); | |
| 204 | + } | |
| 262 | 205 | }) |
| 263 | - .catch(errors => { | |
| 264 | - uni.$u.toast('校验失败'); | |
| 206 | + .catch(e => { | |
| 207 | + uni.$u.toast(e.data.message); | |
| 265 | 208 | }); |
| 266 | 209 | }, |
| 267 | 210 | dateClose() { | ... | ... |