Browse Source

feat(api): 添加学生详情修改功能并优化个人信息提交逻辑

- 在 apiRoute.js 中新增 xy_memberEdit 方法,用于修改学生详情
- 修改 personal_data.vue 中的表单提交逻辑:
  - 更改电话号码字段名为 phone_number
  - 优化头像上传逻辑 - 重构 submit 方法,使用新增的 xy_memberEdit 接口进行数据提交
  - 优化提交成功后的提示信息
master
liutong 10 months ago
parent
commit
4baebbbd20
  1. 7
      api/apiRoute.js
  2. 35
      pages/student/my/personal_data.vue

7
api/apiRoute.js

@ -417,6 +417,13 @@ export default {
return res; return res;
}) })
}, },
//学生详情-修改
xy_memberEdit(data = {}) {
let url = '/customerResourcesAuth/edit'
return http.post(url, data).then(res => {
return res;
})
},

35
pages/student/my/personal_data.vue

@ -92,7 +92,7 @@
手机 <text class="required">*</text> 手机 <text class="required">*</text>
</view> </view>
<view class="input"> <view class="input">
<input v-model="formData.phone" placeholder="请输入手机" /> <input v-model="formData.phone_number" placeholder="请输入手机" />
</view> </view>
</view> </view>
</view> </view>
@ -294,7 +294,6 @@
if (extraData.input_name == 'headimg') { if (extraData.input_name == 'headimg') {
console.log('收到的图片地址:', resData.url); console.log('收到的图片地址:', resData.url);
this.editHeadimg = resData.url; this.editHeadimg = resData.url;
alert(this.formData.headimg)
} }
}, },
@ -307,31 +306,25 @@
}, },
// //
submit() { async submit() {
console.log(this.editHeadimg, '111') if (this.editHeadimg) {
// if(this.editHeadimg == ''){ this.formData.headimg = this.editHeadimg
// this.editHeadimg = this.formData.headimg }
// } let params = {
member.member_edit({ ...this.formData
header: this.editHeadimg, }
name: this.formData.name,
address: this.formData.address, let res = await apiRoute.xy_memberEdit(params)
gender: this.sex_name, if(res.code != 1){
birthday: this.formData.birthday,
email: this.formData.email,
phone: this.formData.phone,
}).then(res => {
if (res.code == 1) {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none' icon: 'none'
}) })
} else { return
}
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none' icon: 'success'
})
}
}) })
}, },

Loading…
Cancel
Save