Initial Commit
This commit is contained in:
301
pages/bindCompany/bindCompany.js
Normal file
301
pages/bindCompany/bindCompany.js
Normal file
@ -0,0 +1,301 @@
|
||||
// pages/bindCompany/bindCompany.js
|
||||
var app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
sendyzm: "获取验证码",
|
||||
phone: '',
|
||||
yzm: '',
|
||||
name: '',
|
||||
company: '',//公司名
|
||||
companyId: '',//公司id
|
||||
showModal: false,//公司弹窗
|
||||
infoName: '',//搜索
|
||||
dataList: [],//公司列表
|
||||
},
|
||||
|
||||
//提交
|
||||
btn() {
|
||||
if (this.data.name == '') {
|
||||
wx.showToast({
|
||||
title: '请输入姓名~',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.data.phone.length != 11) {
|
||||
wx.showToast({
|
||||
title: '请输入正确的手机号~',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.data.yzm == '') {
|
||||
wx.showToast({
|
||||
title: '请输入验证码~',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.data.company == '') {
|
||||
wx.showToast({
|
||||
title: '请选择公司~',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
wx.showLoading({
|
||||
title: '发送中..',
|
||||
mask: true,
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/user/perfectInfo',
|
||||
method: 'PUT',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
code: this.data.yzm,
|
||||
companyId: this.data.companyId,
|
||||
phone: this.data.phone,
|
||||
userName: this.data.name,
|
||||
userId: app.globalData.userId,
|
||||
},
|
||||
success: res => {
|
||||
console.log(res)
|
||||
wx.hideLoading()
|
||||
if (res.data.code == 1) {
|
||||
wx.showToast({
|
||||
title: '绑定成功~',
|
||||
icon: 'none',
|
||||
success: ss => {
|
||||
setTimeout(() => {
|
||||
wx.navigateBack()
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '提示!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}, fail: f => {
|
||||
wx.hideLoading()
|
||||
wx.showToast({
|
||||
title: '请求异常',
|
||||
icon: "none",
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.dataList()
|
||||
},
|
||||
searchGs() {
|
||||
this.dataList()
|
||||
},
|
||||
//获取验证码
|
||||
sendyzm: function (e) {
|
||||
var phone = this.data.phone;
|
||||
if (phone.length != 11) {
|
||||
wx.showToast({
|
||||
title: '请输入正确的手机号~',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
wx.showLoading({
|
||||
title: '发送中..',
|
||||
mask: true,
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/user/sendSms',
|
||||
method: 'GET',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
phone: phone,
|
||||
},
|
||||
success: res => {
|
||||
console.log(res)
|
||||
wx.hideLoading()
|
||||
if (res.data.code == 1) {
|
||||
wx.showToast({
|
||||
title: '发送成功~',
|
||||
icon: 'none',
|
||||
})
|
||||
let time = 60;
|
||||
let codeV = setInterval(t => {
|
||||
this.setData({
|
||||
sendyzm: '重新获取' + (--time) + 's'
|
||||
})
|
||||
if (time == -1) {
|
||||
clearInterval(codeV)
|
||||
this.setData({
|
||||
sendyzm: '获取验证码'
|
||||
})
|
||||
}
|
||||
}, 1000)
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '提示!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}, fail: f => {
|
||||
wx.hideLoading()
|
||||
wx.showToast({
|
||||
title: '请求异常',
|
||||
icon: "none",
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//选择公司
|
||||
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:''
|
||||
})
|
||||
},
|
||||
confirm() {
|
||||
this.setData({
|
||||
showModal: false,
|
||||
})
|
||||
},
|
||||
//搜索
|
||||
search(e) {
|
||||
this.setData({
|
||||
infoName: e.detail.value
|
||||
})
|
||||
},
|
||||
del() {
|
||||
this.setData({
|
||||
infoName: ''
|
||||
})
|
||||
},
|
||||
//点击选择公司出现弹框
|
||||
show() {
|
||||
this.setData({
|
||||
infoName: '',
|
||||
showModal: true,
|
||||
})
|
||||
this.dataList()
|
||||
},
|
||||
//姓名
|
||||
name: function (e) {
|
||||
this.setData({
|
||||
name: e.detail.value
|
||||
})
|
||||
},
|
||||
//手机号
|
||||
phone: function (e) {
|
||||
this.setData({
|
||||
phone: e.detail.value
|
||||
})
|
||||
},
|
||||
//验证码
|
||||
yzm: function (e) {
|
||||
this.setData({
|
||||
yzm: 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,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
})
|
4
pages/bindCompany/bindCompany.json
Normal file
4
pages/bindCompany/bindCompany.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "绑定公司"
|
||||
}
|
55
pages/bindCompany/bindCompany.wxml
Normal file
55
pages/bindCompany/bindCompany.wxml
Normal file
@ -0,0 +1,55 @@
|
||||
<!--pages/bindCompany/bindCompany.wxml-->
|
||||
<view class="main">
|
||||
<view class="top">
|
||||
<image src="/icon/bind-logo.png"></image>
|
||||
</view>
|
||||
<view class="main">
|
||||
<view class="main-input">
|
||||
<view class='ipt display_J_S display_A_C'>
|
||||
<view class="input-text">姓名</view>
|
||||
<input type="text" bindinput="name" value="{{name}}" placeholder='请输入姓名' class="int"/>
|
||||
</view>
|
||||
<view class='ipt display_J_S display_A_C'>
|
||||
<view class="input-text">手机号</view>
|
||||
<input type="number" bindinput="phone" value="{{phone}}" placeholder='请输入手机号' class="int"/>
|
||||
</view>
|
||||
<view class="ipt display_J_B display_A_C">
|
||||
<view class="display_J_S iptl">
|
||||
<view class="input-text">验证码</view>
|
||||
<input type="text" bindinput="yzm" placeholder='请输入验证码' style="width:250rpx;" class='int'/>
|
||||
</view>
|
||||
<view class="fsyl" catchtap="{{sendyzm=='获取验证码'?'sendyzm':''}}">{{sendyzm}}</view>
|
||||
</view>
|
||||
<view class="ipt display_J_B display_A_C">
|
||||
<view class="display_J_S iptl">
|
||||
<view class="input-text">公司名</view>
|
||||
<view style="width:440rpx;font-size:28rpx;" catchtap="show" wx:if='{{company!=""}}'>{{company}}</view>
|
||||
<view style="color: #999999;width:440rpx;font-size:28rpx;" wx:if='{{company==""}}' catchtap="show">选择所属公司</view>
|
||||
</view>
|
||||
<image src="/icon/check-jt.png" class="check-jt" catchtap="show"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn" catchtap="btn">确认绑定</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>
|
162
pages/bindCompany/bindCompany.wxss
Normal file
162
pages/bindCompany/bindCompany.wxss
Normal file
@ -0,0 +1,162 @@
|
||||
/* pages/bindCompany/bindCompany.wxss */
|
||||
|
||||
.top {
|
||||
background: #f5f5f5;
|
||||
width: 750rpx;
|
||||
height: 286rpx;
|
||||
}
|
||||
|
||||
.top image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin: 40rpx 0rpx 0rpx 275rpx;
|
||||
}
|
||||
|
||||
.main {
|
||||
background: #fff;
|
||||
width: 750rpx;
|
||||
border-radius: 40rpx 40rpx 0rpx 0rpx;
|
||||
}
|
||||
|
||||
.main-input {
|
||||
width: 600rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.ipt {
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
margin-top: 30rpx;
|
||||
border-bottom: 1rpx solid #dce1eb;
|
||||
}
|
||||
.input-text {
|
||||
font-size: 28rpx;
|
||||
color: #8e8e93;
|
||||
width: 130rpx;
|
||||
}
|
||||
.int{
|
||||
color:#000;
|
||||
font-size: 28rpx;
|
||||
letter-spacing: 1rpx;
|
||||
width: 300rpx;
|
||||
}
|
||||
.fsyl{
|
||||
padding: 0 10rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 4rpx;
|
||||
border: solid 2rpx #ee7b1e;
|
||||
line-height: 48rpx;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #ee7b1e;
|
||||
}
|
||||
.check-jt{
|
||||
width: 26rpx;
|
||||
height: 14rpx;
|
||||
}
|
||||
.btn{
|
||||
width: 690rpx;
|
||||
height: 80rpx;
|
||||
background-image: linear-gradient(-90deg,
|
||||
#ee7b1e 0%,
|
||||
#fdae03 100%);
|
||||
border-radius: 40rpx;
|
||||
font-size: 32rpx;
|
||||
line-height: 80rpx;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
margin: 240rpx 0rpx 0rpx 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