From 85df7bfc4ef9273452f2e87c7fd36dff2b9cfbf5 Mon Sep 17 00:00:00 2001 From: chen-xin-zhi <3588068430@qq.com> Date: Fri, 8 Aug 2025 13:48:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../overviewPerformance.js | 2 +- .../employeeAccountApply.js | 14 +++- .../employeeAccountApply.wxml | 1 + .../employeeAccountApply.wxss | 10 +-- pages/personCenter/mine/mine.js | 67 ++++++++++++++++--- pages/personCenter/mine/mine.wxml | 19 +++--- pages/personCenter/mine/mine.wxss | 20 ++++-- request.js | 1 + 8 files changed, 107 insertions(+), 27 deletions(-) diff --git a/pages/dashboardModule/overviewPerformance/overviewPerformance.js b/pages/dashboardModule/overviewPerformance/overviewPerformance.js index b8ac9da..1081c49 100644 --- a/pages/dashboardModule/overviewPerformance/overviewPerformance.js +++ b/pages/dashboardModule/overviewPerformance/overviewPerformance.js @@ -47,7 +47,7 @@ Page({ break; } this.setData({ showRole }); - if (options.role === 'manger') this.setData({isShowArr: [true, true, true]}) + if (options.role === 'manager') this.setData({isShowArr: [true, true, true]}) else if (options.role === 'supervisor') this.setData({isShowArr: [false, true, true]}) else if (options.role === 'staff') this.setData({isShowArr: [false, false, true]}) const trueCount = this.data.isShowArr.filter(v => v === true).length; diff --git a/pages/loginModule/employeeAccountApply/employeeAccountApply.js b/pages/loginModule/employeeAccountApply/employeeAccountApply.js index 7b764da..3d40f8a 100644 --- a/pages/loginModule/employeeAccountApply/employeeAccountApply.js +++ b/pages/loginModule/employeeAccountApply/employeeAccountApply.js @@ -157,6 +157,16 @@ Page({ wx.showToast({ title: '姓名只能为中英文', icon: 'none' }); return; } + + // 校验身份证号 + const idCardReg = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/ + if (!idCardReg.test(idcard)) { + wx.showToast({ + title: '身份证号格式不正确', + icon: 'none' + }) + return ; + } // 提交表单数据到后端 wx.request({ @@ -175,7 +185,7 @@ Page({ success: res => { console.log('后端返回的申请---->', res); if (res.data.code === 1) { - wx.showToast({ title: '验证通过,提交成功', icon: 'success' }); + wx.showToast({ title: '提交成功', icon: 'success' }); // 清空表单内容 this.setData({ @@ -189,7 +199,7 @@ Page({ credential: '' // 清空凭证 }); } else { - wx.showToast({ title: '系统错误', icon: 'error' }); + wx.showToast({ title: res.data.message, icon: 'none' }); } } }); diff --git a/pages/loginModule/employeeAccountApply/employeeAccountApply.wxml b/pages/loginModule/employeeAccountApply/employeeAccountApply.wxml index 10c7a21..f239d5c 100644 --- a/pages/loginModule/employeeAccountApply/employeeAccountApply.wxml +++ b/pages/loginModule/employeeAccountApply/employeeAccountApply.wxml @@ -54,6 +54,7 @@ bindinput="onInput" data-field="code" value="{{code}}" + maxlength="6" /> { + wx.hideLoading(); + let result = JSON.parse(res.data); + console.log(result) + if (result.code === 1) { + this.setData({userAvatar: result.data}) + this.updateUserInfo(result.data) + } else { + wx.showToast({ + title: result.message || '上传失败', + icon: 'none' + }); + } + }, + fail: err => { + wx.hideLoading(); + console.error('uploadFile fail', err); + wx.showToast({ title: '网络错误,上传失败', icon: 'none' }); + } + }); + }, + updateUserInfo(view) { + const token = wx.getStorageSync('token') + wx.request({ + url: baseUrl + '/userInfo/modify/avatar', + method: 'POST', + header: { + Authorization: token + }, + data: { + templateString: view + }, + success: res => { + console.log(res.data) + }, + fail: err => { + wx.showToast({ title: '用户头像更新失败', icon: 'none' }); + } + }) + }, // 跳转结算记录页面 gotoSettlementRecord() { wx.navigateTo({ @@ -142,7 +194,6 @@ Page({ let result = res.data.data this.setData({ nickName: result.nickName, - // TODO 头像未连接 userAvatar: result.userAvatar, phoneNumber: result.phoneNumber, userAccount: result.userAccount, @@ -214,10 +265,10 @@ Page({ // 跳转主管排名 gotoSupervisorRank(e) { - console.log(e); + console.log(e) const {userRole} = this.data - console.log('========fds===>', userRole) - if (userRole === 'staff' || userRole === 'user') { + console.log('===========>', userRole) + if (userRole === 'staff') { wx.showToast({ title: '无权限', icon: 'error' @@ -225,7 +276,7 @@ Page({ return ; } wx.navigateTo({ - url: `/pages/dashboardModule/performanceRanking/performanceRanking?role=${userRole}`, + url: `/pages/dashboardModule/performanceRanking/performanceRanking?role=manager`, }) }, @@ -242,7 +293,7 @@ Page({ return ; } wx.navigateTo({ - url: `/pages/dashboardModule/performanceRanking/performanceRanking?role=${userRole}`, + url: `/pages/dashboardModule/performanceRanking/performanceRanking?role=staff`, }) }, diff --git a/pages/personCenter/mine/mine.wxml b/pages/personCenter/mine/mine.wxml index df3e69a..20189e6 100644 --- a/pages/personCenter/mine/mine.wxml +++ b/pages/personCenter/mine/mine.wxml @@ -212,13 +212,16 @@ + {{ nickName }} - + - + {{title}} - + 主管排名 - + - + - + - +