From 0b05c0bf5139d0a9fa0bf2ff2b89fab02b33af79 Mon Sep 17 00:00:00 2001 From: SelfRidicule Date: Mon, 8 Apr 2024 15:59:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=8F=E8=BF=B0:=E4=B8=AA=E4=BA=BA=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E6=98=BE=E7=A4=BA=E4=BC=81=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/my/personalData/personalData.js | 67 ++++++++----------- .../pages/my/personalData/personalData.wxml | 8 +-- 2 files changed, 30 insertions(+), 45 deletions(-) diff --git a/miniprogram/pages/my/personalData/personalData.js b/miniprogram/pages/my/personalData/personalData.js index cd186cb..2c1f22b 100644 --- a/miniprogram/pages/my/personalData/personalData.js +++ b/miniprogram/pages/my/personalData/personalData.js @@ -1,9 +1,11 @@ let app = getApp() import { - userProfile + userProfile, + getUserInfoRq } from "../../../api/user/user.js" + Page({ data: { @@ -13,57 +15,42 @@ Page({ ifName: true, DOMAIN_NAME: app.IMG_NAME, park: [], - parkindex: 0 + parkindex: 0, + parkName: '', + customerName: '' }, /** * 生命周期函数--监听页面加载 */ onShow(e) { - var that = this + let _this = this; + let that = this that.setData({ DOMAIN_NAME: app.img_Name }) - app.AjaxRequest('get', { - 'content-type': 'application/json' - }, '/park/list', {}, function (res) { - if (res.code == 0) { - res.data.forEach(item => { - let park = that.data.park - park.push(item.parkName) - that.setData({ - park - }) - }) - that.setData({ - parkList: res.data - }) - that.parkIdtype(res.data, wx.getStorageSync('parkId')) - } - }) that.getList() + // + let userId = wx.getStorageSync('userId'); + if (userId) { + getUserInfoRq(userId).then(res => { + console.log('getUserInfoRq', res); + let userDetail = res.data; + _this.setData({ + customerName: userDetail.customerName, + parkName: wx.getStorageSync('parkName') + }) + }) + } else { + app.getlogin() + return + } }, - parkIdtype(list, id) { - list.forEach((item, index) => { - if (item.id == id) { - this.setData({ - parkindex: index - }) - } - }) - }, - - parkChange(e) { - let that = this - that.data.parkList.forEach(item => { - if (that.data.park[e.detail.value] == item.parkName) { - that.setData({ - parkindex: e.detail.value - }) - wx.setStorageSync('parkId', item.id) - wx.setStorageSync('parkName', item.parkName) - } + // 跳转园区 + jumpPark() { + wx.navigateTo({ + url: '/pages/index/parkList/parkList', }) }, diff --git a/miniprogram/pages/my/personalData/personalData.wxml b/miniprogram/pages/my/personalData/personalData.wxml index 5523fe4..a56eba3 100644 --- a/miniprogram/pages/my/personalData/personalData.wxml +++ b/miniprogram/pages/my/personalData/personalData.wxml @@ -56,18 +56,16 @@ --> - + 园区 - - {{park[parkindex]}} - + {{parkName ? parkName : ''}} 企业 - {{memberInfo.customerName? memberInfo.customerName : ''}} + {{customerName? customerName : ''}}