dev
parent
d1dd294d58
commit
3253a76a15
@ -0,0 +1,301 @@
|
|||||||
|
// pages/mine/pages/register/register.js
|
||||||
|
const app = getApp()
|
||||||
|
import timer from '../../../../utils/timer'
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
sUserName: '',
|
||||||
|
sPhone: '',
|
||||||
|
sEmail: '',
|
||||||
|
companyName: '',
|
||||||
|
brandName: '',
|
||||||
|
sVerifycode: '',
|
||||||
|
expDate: '',
|
||||||
|
captchaLabel: '获取验证码',
|
||||||
|
captchaDisabled: false,
|
||||||
|
imageUrl: getApp().globalData.imageUrl,
|
||||||
|
status: 0 // 0查看 1编辑
|
||||||
|
},
|
||||||
|
//用户输入
|
||||||
|
usernameInput(e) {
|
||||||
|
this.setData({
|
||||||
|
sUserName: e.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//手机号输入
|
||||||
|
sPhoneInput(e) {
|
||||||
|
this.setData({
|
||||||
|
sPhone: e.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//邮箱输入
|
||||||
|
sEmailInput(e) {
|
||||||
|
this.setData({
|
||||||
|
sEmail: e.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//名称输入
|
||||||
|
companyInput(e) {
|
||||||
|
this.setData({
|
||||||
|
companyName: e.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//验证码输入
|
||||||
|
codeInput(e) {
|
||||||
|
this.setData({
|
||||||
|
sVerifycode: e.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
//获取验证码
|
||||||
|
captcha() {
|
||||||
|
let b = this.validPhone();
|
||||||
|
if (!b) return;
|
||||||
|
let obj = {
|
||||||
|
action: 'getVERCode',
|
||||||
|
sPhone: this.data.sPhone,
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
app.globalData.request(obj, (res) => {
|
||||||
|
// 定时60s
|
||||||
|
timer(this)
|
||||||
|
resolve(true)
|
||||||
|
}).catch(err => {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: err.Msg,
|
||||||
|
})
|
||||||
|
reject(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
//提交审核
|
||||||
|
toEdit() {
|
||||||
|
this.setData({status: 1});
|
||||||
|
},
|
||||||
|
Submit() {
|
||||||
|
let a = this.validfrom();
|
||||||
|
if (!a) return;
|
||||||
|
let obj = {
|
||||||
|
action: 'getUserDataVERCode',
|
||||||
|
token: wx.getStorageSync('token'),
|
||||||
|
UserName: this.data.sUserName,
|
||||||
|
Phone: this.data.sPhone,
|
||||||
|
Email: this.data.sEmail,
|
||||||
|
UnitName: this.data.companyName,
|
||||||
|
Code: this.data.sVerifycode,
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
app.globalData.request(obj, (res) => {
|
||||||
|
if (res.Code == 1) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: res.Msg,
|
||||||
|
success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
this.setData({status: 0});
|
||||||
|
this.getdata();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
resolve(true)
|
||||||
|
}).catch(err => {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: err.Msg,
|
||||||
|
})
|
||||||
|
reject(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getlist() {
|
||||||
|
let that = this
|
||||||
|
let obj = {
|
||||||
|
action: 'getUserDataVERCode',
|
||||||
|
UserName: this.data.sUserName,
|
||||||
|
Phone: this.data.sPhone,
|
||||||
|
Email: this.data.sEmail,
|
||||||
|
token: wx.getStorageSync('token')
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
app.globalData.request(obj, (res) => {
|
||||||
|
if (res.Code == 1) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: res.Msg,
|
||||||
|
success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
that.captcha()
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
resolve(true)
|
||||||
|
}).catch(err => {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: err.Msg,
|
||||||
|
})
|
||||||
|
reject(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
validPhone() {
|
||||||
|
let b = true;
|
||||||
|
let sPhone = this.data.sPhone;
|
||||||
|
//验证手机号
|
||||||
|
if (!this.data.sPhone) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: "手机号不能为空",
|
||||||
|
})
|
||||||
|
b = false;
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
//验证手机格式
|
||||||
|
if (!(/^1[345678]\d{9}$/.test(sPhone))) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: "手机格式错误",
|
||||||
|
})
|
||||||
|
b = false
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
},
|
||||||
|
validfrom() {
|
||||||
|
let a = true;
|
||||||
|
//验证用户名
|
||||||
|
if (!this.data.sUserName) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: "账号不能为空",
|
||||||
|
})
|
||||||
|
a = false;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
//验证手机号
|
||||||
|
if (!this.data.sPhone) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: "手机号不能为空",
|
||||||
|
})
|
||||||
|
a = false;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
//验证邮箱
|
||||||
|
if (!this.data.sEmail) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: "邮箱不能为空",
|
||||||
|
})
|
||||||
|
a = false;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
//验证公司名称
|
||||||
|
if (!this.data.companyName) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: "公司名称不能为空",
|
||||||
|
})
|
||||||
|
a = false;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
//验证验证码
|
||||||
|
if (!this.data.sVerifycode) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: "验证码不能为空",
|
||||||
|
})
|
||||||
|
a = false;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
handlerBack() {
|
||||||
|
if(this.data.status == 0) {
|
||||||
|
wx.navigateBack({ delta: 1 });
|
||||||
|
} else {
|
||||||
|
this.setData({status: 0});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
this.getdata()
|
||||||
|
},
|
||||||
|
getdata() {
|
||||||
|
app.globalData.request({
|
||||||
|
action: 'getUserData',
|
||||||
|
token: wx.getStorageSync('token')
|
||||||
|
}).then(res => {
|
||||||
|
this.setData({
|
||||||
|
sUserName: res.UserName,
|
||||||
|
sPhone: res.Phone,
|
||||||
|
sEmail: res.Email,
|
||||||
|
companyName: res.UnitName,
|
||||||
|
brandName: res.MainBrand,
|
||||||
|
expDate: res.ValidTime
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTitleText":"个人信息",
|
||||||
|
"navigationBarBackgroundColor":"#ffffff",
|
||||||
|
"navigationBarTextStyle":"black"
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
<!--pages/mine/pages/register/register.wxml-->
|
||||||
|
<van-nav-bar custom-class="nav-top" title="个人信息" left-text="返回" right-text="" left-arrow bind:click-left="handlerBack" />
|
||||||
|
<view class="bind_box">
|
||||||
|
<view style="font-size:28rpx;font-weight:bolder;margin-left: 32rpx">硕为思账号</view>
|
||||||
|
<input disabled="{{status == 0}}" value="{{sUserName}}" placeholder="请输入" placeholder-class="placeholder-style" bindinput="usernameInput"></input>
|
||||||
|
<view style="font-size:28rpx;font-weight:bolder;margin-top: 32rpx;margin-left: 32rpx">手机号</view>
|
||||||
|
<input disabled="{{status == 0}}" value="{{sPhone}}" placeholder="请输入手机号" placeholder-class="placeholder-style" bindinput="sPhoneInput"></input>
|
||||||
|
<view style="font-size:28rpx;font-weight:bolder;margin-top: 32rpx;margin-left: 32rpx">邮箱</view>
|
||||||
|
<input disabled="{{status == 0}}" value="{{sEmail}}" placeholder="请输入邮箱" placeholder-class="placeholder-style" bindinput="sEmailInput"></input>
|
||||||
|
<view style="font-size:28rpx;font-weight:bolder;margin-top: 32rpx;margin-left: 32rpx">公司名称</view>
|
||||||
|
<input disabled="{{status == 0}}" value="{{companyName}}" placeholder="请输入公司名称" placeholder-class="placeholder-style" bindinput="companyInput"></input>
|
||||||
|
<view>
|
||||||
|
<view style="font-size:28rpx;font-weight:bolder;margin-top: 32rpx;margin-left: 32rpx">公司品牌</view>
|
||||||
|
<view>
|
||||||
|
<input disabled value="{{brandName}}" placeholder="请输入公司品牌" placeholder-class="placeholder-style"></input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view wx:if="{{status == 1}}">
|
||||||
|
<view style="font-size:28rpx;font-weight:bolder;margin-top: 32rpx;margin-left: 32rpx">到期日期</view>
|
||||||
|
<view>
|
||||||
|
<input disabled value="{{expDate}}" placeholder="到期日期" placeholder-class="placeholder-style" ></input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view wx:if="{{status == 1}}">
|
||||||
|
<view style="font-size:28rpx;font-weight:bolder;margin-top: 32rpx;margin-left: 32rpx">验证码</view>
|
||||||
|
<view style="display: flex;">
|
||||||
|
<input width="260px" value="{{sVerifycode}}" placeholder="请输入验证码" placeholder-class="placeholder-style" bindinput="codeInput"></input>
|
||||||
|
<button class="captcha" bindtap="getlist" disabled="{{captchaDisabled}}" plain="true" disabled-class="disabled">{{captchaLabel}}</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<button wx:if="{{status == 0}}" class="bts" bindtap="toEdit">编辑</button>
|
||||||
|
<button wx:else class="bts" bindtap="Submit">完成</button>
|
||||||
|
</view>
|
||||||
|
<!-- <van-popup show="{{ show }}" custom-style="height: 80%;width: 100%;padding-bottom: 80rpx" position="bottom" bind:close="onClose">
|
||||||
|
<van-index-bar sticky="{{false}}" index-list="{{ [] }}">
|
||||||
|
<view wx:for="{{mockData}}" wx:key="idx">
|
||||||
|
<van-index-anchor index="{{item.name}}" />
|
||||||
|
<view class="my_cell" wx:for="{{item.data}}" data-brand="{{item2.brandname}}" wx:key="idx" wx:for-item="item2" bindtap="Brands">
|
||||||
|
<image slot="icon" class="bs-item-image" src="{{item2.img}}" lazy-load="{{true}}"></image>
|
||||||
|
<text>{{item2.brandname}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</van-index-bar>
|
||||||
|
</van-popup> -->
|
@ -0,0 +1,187 @@
|
|||||||
|
/* pages/mine/pages/register/register.wxss */
|
||||||
|
.bind_box{
|
||||||
|
margin-top: 34rpx;
|
||||||
|
width: 686rpx;
|
||||||
|
/* height: 528rpx; */
|
||||||
|
background: white;
|
||||||
|
margin-left:32rpx;
|
||||||
|
padding: 32rpx 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
.bind_box input{
|
||||||
|
height: 96rpx;
|
||||||
|
width: 590rpx;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
margin-top: 24rpx;
|
||||||
|
margin-left: 32rpx;
|
||||||
|
padding-left: 32rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
page{
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
.placeholder-style{
|
||||||
|
font-size: 28rpx;
|
||||||
|
/* margin-left: 32rpx; */
|
||||||
|
}
|
||||||
|
.bts{
|
||||||
|
margin-top: 48rpx;
|
||||||
|
width: 622rpx;
|
||||||
|
margin-left:32rpx ;
|
||||||
|
color: white;
|
||||||
|
background: #66b6ff;
|
||||||
|
font-size: 28rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
}
|
||||||
|
.bs-top-title {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 26rpx;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
.bs-top-title-ic {
|
||||||
|
position: absolute;
|
||||||
|
left: 16px;
|
||||||
|
font-size: 19px;
|
||||||
|
}
|
||||||
|
.captcha{
|
||||||
|
width: 40%;
|
||||||
|
height: 96rpx;
|
||||||
|
line-height: 96rpx;
|
||||||
|
/* margin: auto 0; */
|
||||||
|
margin-top: 24rpx;
|
||||||
|
color: #f9f9f9;
|
||||||
|
font-size: 25rpx;
|
||||||
|
margin-right: 25rpx;
|
||||||
|
border-radius: 0px;
|
||||||
|
}
|
||||||
|
button[plain] {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
border:0;
|
||||||
|
color: #66b6ff;
|
||||||
|
}
|
||||||
|
.add1{
|
||||||
|
width:686rpx;
|
||||||
|
overflow-x:scroll;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.add_box1 {
|
||||||
|
display: inline-block;
|
||||||
|
height: 208rpx;
|
||||||
|
width: 200rpx;
|
||||||
|
margin-left: 32rpx;
|
||||||
|
background-color: #339cff;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
border: 2rpx solid #85c3ff;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.heng1 {
|
||||||
|
height: 8rpx;
|
||||||
|
width: 72rpx;
|
||||||
|
background: white;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
position: relative;
|
||||||
|
left: 66rpx;
|
||||||
|
top: 82rpx
|
||||||
|
}
|
||||||
|
|
||||||
|
.shu1 {
|
||||||
|
width: 8rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
background: white;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
position: relative;
|
||||||
|
left: 98rpx;
|
||||||
|
top: 45rpx
|
||||||
|
}
|
||||||
|
|
||||||
|
.event1 {
|
||||||
|
display: inline-block;
|
||||||
|
color: white;
|
||||||
|
font-size: 28rpx;
|
||||||
|
margin-left: 32rpx;
|
||||||
|
margin-top: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btns {
|
||||||
|
margin-top: 32rpx;
|
||||||
|
width: 686rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 88rpx;
|
||||||
|
color: rgba(0, 132, 255, 1);
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
.event_recom1 {
|
||||||
|
margin-top: 32rpx;
|
||||||
|
min-height: 1000rpx;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
border-top-left-radius: 24rpx;
|
||||||
|
border-top-right-radius: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.van-index-bar .van-index-bar__sidebar{
|
||||||
|
top:480rpx;
|
||||||
|
transform:none;
|
||||||
|
}
|
||||||
|
.van-index-anchor text{
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: rgba(153, 153, 153, 1);
|
||||||
|
}
|
||||||
|
.event_recom1 .van-cell .van-cell__title{
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
.my_cell{
|
||||||
|
width: 686rpx;
|
||||||
|
height: 96rpx;
|
||||||
|
background: white;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 32rpx;
|
||||||
|
}
|
||||||
|
.van-checkbox{
|
||||||
|
display: inline-block !important;
|
||||||
|
}
|
||||||
|
.my_cell .van-checkbox__icon {
|
||||||
|
margin-left: 32rpx ;
|
||||||
|
font-size: 32rpx !important;
|
||||||
|
}
|
||||||
|
.my_cell .van-image{
|
||||||
|
margin-left: 48rpx;
|
||||||
|
margin-top: 4rpx;
|
||||||
|
}
|
||||||
|
.my_cell text{
|
||||||
|
font-size: 28rpx;
|
||||||
|
margin-left: 24rpx;
|
||||||
|
}
|
||||||
|
.event_box{
|
||||||
|
height: 36rpx;
|
||||||
|
background:white;
|
||||||
|
border-top-left-radius: 24rpx;
|
||||||
|
border-top-right-radius: 24rpx;
|
||||||
|
}
|
||||||
|
.bs-item-image {
|
||||||
|
display: inline-block;
|
||||||
|
width: 84rpx;
|
||||||
|
height: 84rpx;
|
||||||
|
padding: 12rpx;
|
||||||
|
margin-right: 24rpx;
|
||||||
|
}
|
||||||
|
.all{
|
||||||
|
background: #027AFF;
|
||||||
|
width: 72rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
line-height: 72rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in new issue