From 7603d8c96ce19704517b1c75dd64a60920d074a8 Mon Sep 17 00:00:00 2001 From: chen-xin-zhi <3588068430@qq.com> Date: Sun, 15 Jun 2025 21:51:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=86=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E8=81=94=E7=B3=BB=E4=B8=8A=E7=BA=A7=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=88=E7=82=B9=E5=87=BB=E6=89=8B=E6=9C=BA=E5=8F=B7?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=8B=A8=E5=8F=B7=E9=A1=B5=E9=9D=A2=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../personCenter/contactSuper/contactSuper.js | 89 ++++++++----------- .../contactSuper/contactSuper.wxml | 10 ++- pages/personCenter/mine/mine.js | 39 ++------ pages/personCenter/mine/mine.wxml | 2 +- request.js | 3 +- 5 files changed, 53 insertions(+), 90 deletions(-) diff --git a/pages/personCenter/contactSuper/contactSuper.js b/pages/personCenter/contactSuper/contactSuper.js index a772ff6..58bad87 100644 --- a/pages/personCenter/contactSuper/contactSuper.js +++ b/pages/personCenter/contactSuper/contactSuper.js @@ -1,66 +1,55 @@ -// pages/personCenter/contactSuper/contactSuper.js -Page({ +const { baseUrl } = require("../../../request"); +Page({ /** * 页面的初始数据 */ data: { - + nickName: '', // 后端返回的昵称 + phoneNumber: '' // 后端返回的手机号 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - + this.fetchSupervisorInfo(); }, - - /** - * 生命周期函数--监听页面初次渲染完成 + /** + * 请求后端接口,获取上级联系人信息 */ - onReady() { - + fetchSupervisorInfo() { + const token = wx.getStorageSync('token'); + wx.request({ + url: baseUrl + '/userInfo/getSuper', + method: 'POST', + header: { + Authorization: token + }, + success: (res) => { + if (res.data.code === 1) { + const { nickName, phoneNumber } = res.data.data; + this.setData({ nickName, phoneNumber }); + } else { + wx.showToast({ + title: res.data.message || '获取信息失败', + icon: 'none' + }); + } + }, + fail: (err) => { + console.error('fetchSupervisorInfo error:', err); + wx.showToast({ + title: '请求失败,请稍后重试', + icon: 'none' + }); + } + }); }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - + + gotoCall() { + wx.makePhoneCall({ + phoneNumber: this.data.phoneNumber + }) } }) \ No newline at end of file diff --git a/pages/personCenter/contactSuper/contactSuper.wxml b/pages/personCenter/contactSuper/contactSuper.wxml index 853efb5..99131aa 100644 --- a/pages/personCenter/contactSuper/contactSuper.wxml +++ b/pages/personCenter/contactSuper/contactSuper.wxml @@ -1,9 +1,11 @@ - CHENXINZHI - - 联系电话 15123967648 + + {{nickName}} + + + 联系电话 {{phoneNumber}} - \ No newline at end of file + diff --git a/pages/personCenter/mine/mine.js b/pages/personCenter/mine/mine.js index 2bb56cf..e737110 100644 --- a/pages/personCenter/mine/mine.js +++ b/pages/personCenter/mine/mine.js @@ -177,39 +177,10 @@ Page({ onShow() { this.getUserMainInfo() }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - + gotoCall() { + wx.makePhoneCall({ + phoneNumber: this.data.phoneNumber + }) } + }) \ No newline at end of file diff --git a/pages/personCenter/mine/mine.wxml b/pages/personCenter/mine/mine.wxml index d2c4b6a..a2a2a59 100644 --- a/pages/personCenter/mine/mine.wxml +++ b/pages/personCenter/mine/mine.wxml @@ -3,7 +3,7 @@ {{ nickName }} - +