描述:个人中心显示企业

This commit is contained in:
SelfRidicule 2024-04-08 15:59:13 +08:00
parent fa73c631c2
commit 0b05c0bf51
2 changed files with 30 additions and 45 deletions

View File

@ -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',
})
},

View File

@ -56,18 +56,16 @@
<text class="iconfont iconyou" style="font-size:28rpx;color:#B2B2B2"></text>
</view>
</view> -->
<view class="listBox">
<view class="listBox" bindtap='jumpPark' data-name="园区">
<view style="width:24%;">园区</view>
<picker bindchange="parkChange" name="park" value="{{parkindex}}" range="{{park}}">
<text class="picker-txt">{{park[parkindex]}}</text>
</picker>
<view style="width:70%;text-align:right;color:#888888">{{parkName ? parkName : ''}}</view>
<view style="width:6%;text-align:right">
<text class="iconfont iconyou" style="font-size:28rpx;color:#B2B2B2"></text>
</view>
</view>
<view class="listBox" data-name="企业">
<view style="width:24%;">企业</view>
<view style="width:70%;text-align:right;color:#888888">{{memberInfo.customerName? memberInfo.customerName : ''}}</view>
<view style="width:70%;text-align:right;color:#888888">{{customerName? customerName : ''}}</view>
</view>
<!-- <view class="listBox" style="border:none;">
<view style="width:24%;">公司</view>