From 4baebbbd206599b036c304429fd29de00d98524a Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 5 Jun 2025 10:59:09 +0800
Subject: [PATCH] =?UTF-8?q?feat(api):=20=E6=B7=BB=E5=8A=A0=E5=AD=A6?=
=?UTF-8?q?=E7=94=9F=E8=AF=A6=E6=83=85=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF?=
=?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 apiRoute.js 中新增 xy_memberEdit 方法,用于修改学生详情
- 修改 personal_data.vue 中的表单提交逻辑:
- 更改电话号码字段名为 phone_number
- 优化头像上传逻辑 - 重构 submit 方法,使用新增的 xy_memberEdit 接口进行数据提交
- 优化提交成功后的提示信息
---
api/apiRoute.js | 7 +++++
pages/student/my/personal_data.vue | 49 +++++++++++++-----------------
2 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/api/apiRoute.js b/api/apiRoute.js
index 5f0f4a2..06904fa 100644
--- a/api/apiRoute.js
+++ b/api/apiRoute.js
@@ -417,6 +417,13 @@ export default {
return res;
})
},
+ //学生详情-修改
+ xy_memberEdit(data = {}) {
+ let url = '/customerResourcesAuth/edit'
+ return http.post(url, data).then(res => {
+ return res;
+ })
+ },
diff --git a/pages/student/my/personal_data.vue b/pages/student/my/personal_data.vue
index cfe9868..a525d0c 100644
--- a/pages/student/my/personal_data.vue
+++ b/pages/student/my/personal_data.vue
@@ -92,7 +92,7 @@
手机 *
-
+
@@ -294,7 +294,6 @@
if (extraData.input_name == 'headimg') {
console.log('收到的图片地址:', resData.url);
this.editHeadimg = resData.url;
- alert(this.formData.headimg)
}
},
@@ -307,32 +306,26 @@
},
//提交信息
- submit() {
- console.log(this.editHeadimg, '111')
- // if(this.editHeadimg == ''){
- // this.editHeadimg = this.formData.headimg
- // }
- member.member_edit({
- header: this.editHeadimg,
- name: this.formData.name,
- address: this.formData.address,
- gender: this.sex_name,
- birthday: this.formData.birthday,
- email: this.formData.email,
- phone: this.formData.phone,
- }).then(res => {
- if (res.code == 1) {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- }
- })
+ async submit() {
+ if (this.editHeadimg) {
+ this.formData.headimg = this.editHeadimg
+ }
+ let params = {
+ ...this.formData
+ }
+
+ let res = await apiRoute.xy_memberEdit(params)
+ if(res.code != 1){
+ uni.showToast({
+ title: res.msg,
+ icon: 'none'
+ })
+ return
+ }
+ uni.showToast({
+ title: res.msg,
+ icon: 'success'
+ })
},