描述:个人中心显示企业

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() let app = getApp()
import { import {
userProfile userProfile,
getUserInfoRq
} from "../../../api/user/user.js" } from "../../../api/user/user.js"
Page({ Page({
data: { data: {
@ -13,57 +15,42 @@ Page({
ifName: true, ifName: true,
DOMAIN_NAME: app.IMG_NAME, DOMAIN_NAME: app.IMG_NAME,
park: [], park: [],
parkindex: 0 parkindex: 0,
parkName: '',
customerName: ''
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onShow(e) { onShow(e) {
var that = this let _this = this;
let that = this
that.setData({ that.setData({
DOMAIN_NAME: app.img_Name 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() 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) => { jumpPark() {
if (item.id == id) { wx.navigateTo({
this.setData({ url: '/pages/index/parkList/parkList',
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)
}
}) })
}, },

View File

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