Initial Commit
This commit is contained in:
204
pages/my/my_data/my_data.js
Normal file
204
pages/my/my_data/my_data.js
Normal file
@ -0,0 +1,204 @@
|
||||
// pages/my/my_data/my_data.js
|
||||
const app = getApp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
name:"",
|
||||
phone:"",
|
||||
company: '',//公司名
|
||||
companyId: '',//公司id
|
||||
showModal: false,//公司弹窗
|
||||
infoName: '',//搜索
|
||||
dataList: [],//公司列表
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
//个人信息
|
||||
wx.showLoading({
|
||||
title: '加载中..',
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/user/getTwoGoodsType',
|
||||
method: 'GET',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
userId: app.globalData.userId
|
||||
},
|
||||
success: res => {
|
||||
wx.hideLoading()
|
||||
console.log(res.data)
|
||||
if (res.data.code == 1) {
|
||||
this.setData({
|
||||
user: res.data.value,
|
||||
name: res.data.value.userName,
|
||||
phone: res.data.value.userPhone,
|
||||
company: res.data.value.companyName,
|
||||
companyId:res.data.value.companyId
|
||||
})
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '提示!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
//点击选择公司出现弹框
|
||||
show() {
|
||||
this.setData({
|
||||
infoName: '',
|
||||
showModal: true,
|
||||
})
|
||||
this.dataList()
|
||||
},
|
||||
confirm() {
|
||||
this.setData({
|
||||
showModal: false,
|
||||
})
|
||||
},
|
||||
searchGs() {
|
||||
this.dataList()
|
||||
},
|
||||
//选择公司
|
||||
select: function (e) {
|
||||
let index = e.currentTarget.dataset.index;
|
||||
let id = e.currentTarget.dataset.id;
|
||||
let dataList = this.data.dataList;
|
||||
for (let i = 0; i < dataList.length; i++) {
|
||||
dataList[i].select = false;
|
||||
}
|
||||
dataList[index].select = true;
|
||||
this.setData({
|
||||
dataList: dataList,
|
||||
showModal: false,
|
||||
company: dataList[index].companyName,
|
||||
companyId: id,
|
||||
infoName:''
|
||||
})
|
||||
},
|
||||
takname(e){
|
||||
this.setData({
|
||||
name:e.detail.value
|
||||
})
|
||||
},
|
||||
takphone(e){
|
||||
this.setData({
|
||||
phone:e.detail.value
|
||||
})
|
||||
},
|
||||
dataList: function (options) {
|
||||
wx.showLoading({
|
||||
title: '加载中..',
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/user/getCompany',
|
||||
method: 'GET',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
conpanyName: this.data.infoName
|
||||
},
|
||||
success: res => {
|
||||
wx.hideLoading()
|
||||
console.log(res)
|
||||
if (res.data.code == 1) {
|
||||
this.setData({
|
||||
dataList: res.data.value
|
||||
})
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '提示!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
taksubmit(){
|
||||
wx.showLoading({
|
||||
title: '加载中..',
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/user/updateInfo',
|
||||
method: 'PUT',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
companyId: this.data.companyId,
|
||||
phone: this.data.phone,
|
||||
userId: app.globalData.userId,
|
||||
userName: this.data.name,
|
||||
},
|
||||
success: res => {
|
||||
wx.hideLoading()
|
||||
console.log(res)
|
||||
if (res.data.code == 1) {
|
||||
wx.showToast({
|
||||
title: '修改成功!',
|
||||
})
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '提示!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
4
pages/my/my_data/my_data.json
Normal file
4
pages/my/my_data/my_data.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "个人主页"
|
||||
}
|
33
pages/my/my_data/my_data.wxml
Normal file
33
pages/my/my_data/my_data.wxml
Normal file
@ -0,0 +1,33 @@
|
||||
<!--pages/my/my_data/my_data.wxml-->
|
||||
<view style="height:30rpx;background-color: #f5f5f5;"></view>
|
||||
<view class="all">
|
||||
<view class="title">基本资料</view>
|
||||
<view class="data">真实姓名 <input type="text" bindinput="takname" value="{{name}}" placeholder='请输入姓名' /></view>
|
||||
<view class="data">联系方式 <input type="number" bindinput="takphone" value="{{phone}}" placeholder='请输入联系方式' /></view>
|
||||
<view class="title" style="margin-top:90rpx;">所属公司</view>
|
||||
<view class="data" bindtap="show">所属公司<text>{{company}}</text></view>
|
||||
<view class="height100"></view>
|
||||
<view class="btn" bindtap="taksubmit">保存</view>
|
||||
</view>
|
||||
|
||||
<!-- 遮罩层 -->
|
||||
<view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModal}}" bindtap="confirm"></view>
|
||||
<!-- 弹出层 -->
|
||||
<view class="modalDlg" wx:if="{{showModal}}">
|
||||
<view class="modal-title display_J_B display_A_C">
|
||||
<view class="modal-title-view display_J_S display_A_C">
|
||||
<image src="/icon/search.png" class="search"></image>
|
||||
<input type="text" bindinput="search" value='{{infoName}}' placeholder='搜索您想要的内容' class='search-int' placeholder-style='color:#ccc' />
|
||||
<image src="/icon/none.png" class="none" catchtap="del"></image>
|
||||
</view>
|
||||
<view class="search-right" catchtap="searchGs">搜索</view>
|
||||
</view>
|
||||
<view class="modal-main">
|
||||
<view class="modal-list" wx:for='{{dataList}}' wx:key="index">
|
||||
<view class="modal-list-mk" catchtap="select" data-index='{{index}}' data-id='{{item.id}}'>
|
||||
<view class="{{item.select?'text-xz':''}}">{{item.companyName}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="empty" wx:if="{{dataList.length==0}}">暂无数据~</view>
|
||||
</view>
|
||||
</view>
|
138
pages/my/my_data/my_data.wxss
Normal file
138
pages/my/my_data/my_data.wxss
Normal file
@ -0,0 +1,138 @@
|
||||
/* pages/my/my_data/my_data.wxss */
|
||||
.all{
|
||||
width: 690rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
.title{
|
||||
font-size: 36rpx;
|
||||
letter-spacing: 2rpx;
|
||||
color: #333333;
|
||||
margin:30rpx 0 15rpx;
|
||||
}
|
||||
.data{
|
||||
font-size: 28rpx;
|
||||
letter-spacing: 1rpx;
|
||||
color: #999999;
|
||||
height: 120rpx;
|
||||
line-height: 120rpx;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
}
|
||||
.data input{
|
||||
color: #333333;
|
||||
width:450rpx;
|
||||
margin-left: 50rpx;
|
||||
}
|
||||
.data text{
|
||||
color: #333333;
|
||||
margin-left: 50rpx;
|
||||
}
|
||||
.btn{
|
||||
width: 690rpx;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
background-color: #ee7b1e;
|
||||
border-radius: 44rpx;
|
||||
font-size: 36rpx;
|
||||
letter-spacing: 2rpx;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
position: fixed;
|
||||
bottom: 80rpx;
|
||||
left: 30rpx;
|
||||
}
|
||||
|
||||
/* 遮罩层 */
|
||||
|
||||
.mask {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: #000;
|
||||
z-index: 9000;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* 弹出层 */
|
||||
|
||||
.modalDlg {
|
||||
width: 750rpx;
|
||||
height: 911rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 40rpx 40rpx 0rpx 0rpx;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
width: 690rpx;
|
||||
height: 56rpx;
|
||||
margin: 60rpx 30rpx;
|
||||
}
|
||||
.modal-title-view{
|
||||
background-color: #f3f4f8;
|
||||
border-radius: 27rpx;
|
||||
padding-right:20rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
.search {
|
||||
width: 35rpx;
|
||||
height: 34rpx;
|
||||
margin-left: 26rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.search-int{
|
||||
width: 415rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
.empty{
|
||||
margin: 150rpx auto 0;
|
||||
text-align: center;
|
||||
color: #ccc;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.none{
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
.search-right{
|
||||
width: 120rpx;
|
||||
height: 56rpx;
|
||||
background-color: #ee7b1e;
|
||||
border-radius: 27rpx;
|
||||
font-size: 32rpx;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
line-height: 56rpx;
|
||||
}
|
||||
.modal-main {
|
||||
width: 690rpx;
|
||||
height: 620rpx;
|
||||
overflow-y: scroll;
|
||||
margin: 40rpx 0 0 30rpx;
|
||||
}
|
||||
|
||||
.modal-main::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.modal-list-mk {
|
||||
width: 690rpx;
|
||||
height: 80rpx;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.text-xz{
|
||||
color: #ee7b1e;
|
||||
}
|
Reference in New Issue
Block a user