liuyongli 3 years ago
parent 69f95221ca
commit 81a3ed4c4f

@ -28,6 +28,7 @@
"pages/mine/pages/bindUser/index",
"pages/mine/pages/myReport/index",
"pages/mine/pages/helpCenter/index",
"pages/mine/pages/register/register",
"pages/varComm/pages/theme/index",
"pages/brandCrisis/index",
"pages/brandCrisis/crisiSet/index",

@ -185,6 +185,12 @@ Page({
})
})
},
//注册
register(){
wx.navigateTo({
url: '/pages/mine/pages/register/register',
})
},
handlerBack() {
if(this.data.isHome == 1) {
wx.switchTab({

@ -6,4 +6,8 @@
<view style="font-size:28rpx;font-weight:bolder;margin-top: 32rpx;margin-left: 32rpx">密码</view>
<input value="{{pwd}}" placeholder="请输入密码" placeholder-class="placeholder-style" type="password" bindinput="passwordInput"></input>
<button class="bts" bindtap="login">立即绑定</button>
<view style="height: 80rpx;line-height: 80rpx;text-align: center;font-size: 28rpx;">
<text style="color: #999999;">没有绑定账号?</text>
<text style="color: #0084ff;" bindtap="register">注册</text>
</view>
</view>

@ -5,7 +5,7 @@
height: 528rpx;
background: white;
margin-left:32rpx;
padding-top: 32rpx;
padding: 32rpx 0;
}
.bind_box input{

@ -0,0 +1,277 @@
// pages/mine/pages/register/register.js
const app = getApp()
import timer from '../../../../utils/timer'
Page({
/**
* 页面的初始数据
*/
data: {
sUserName: '',
sPwd: '',
sPhone: '',
sEmail: '',
companyName: '',
brandName: '',
sVerifycode: '',
captchaLabel: '获取验证码',
seconds: timer.length,
captchaDisabled: false
},
//用户输入
usernameInput(e) {
this.setData({
sUserName: e.detail.value
})
},
//密码输入
passwordInput(e) {
this.setData({
sPwd: 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
})
},
//品牌输入
brandInput(e) {
this.setData({
brandName: e.detail.value
})
},
//验证码输入
codeInput(e) {
this.setData({
sVerifycode: e.detail.value
})
},
//获取验证码
captcha() {
let b = this.validPhone();
if (!b) return;
// 禁用按钮点击
this.setData({
captchaDisabled: true
});
// 立刻显示重发提示,不必等待倒计时启动
this.setData({
captchaLabel: timer.length + '秒后重新发送'
});
// 启动以1s为步长的倒计时
var interval = setInterval(() => {
timer.countdown(this);
}, 1000);
// 停止倒计时
setTimeout(function () {
clearInterval(interval);
}, timer.length * 1000);
let obj = {
action: 'getVERCode',
sPhone: this.data.sPhone,
}
app.globalData.request(obj).then((res) => {
if (res.Code == 1) {
wx.showModal({
title: '提示',
content: data.Msg,
})
}
}).catch(err => {
wx.showModal({
title: '提示',
content: err.Msg,
})
})
},
/**
* 生命周期函数--监听页面加载
*/
//提交审核
Submit() {
let a = this.validfrom();
if (!a) return;
let obj = {
action: 'regUser',
sUserName: this.data.sUserName,
sPwd: this.data.sPwd,
sPhone: this.data.sPhone,
sEmail: this.data.sEmail,
companyName: this.data.companyName,
brandName: this.data.brandName,
sVerifycode: this.data.sVerifycode,
}
app.globalData.request(obj).then((res) => {
wx.showModal({
title: '提示',
content: data.Msg,
})
}).catch(err => {
wx.showModal({
title: '提示',
content: err.Msg,
})
})
},
validPhone() {
let b = true;
let sPhone = this.data.sPhone;
//验证手机号
if (!this.data.sPhone) {
wx.showModal({
title: '提示',
content: "手机号不能为空",
})
b = false;
return b;
}
//验证手机格式
if (!(/^1[34578]\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.sPwd) {
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.brandName) {
wx.showModal({
title: '提示',
content: "公司品牌不能为空",
})
a = false;
return a;
}
//验证验证码
if (!this.data.sVerifycode) {
wx.showModal({
title: '提示',
content: "公司品牌不能为空",
})
a = false;
return a;
}
},
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

@ -0,0 +1,7 @@
{
"usingComponents": {},
"navigationStyle": "custom",
"navigationBarTitleText":"注册",
"navigationBarBackgroundColor":"#ffffff",
"navigationBarTextStyle":"black"
}

@ -0,0 +1,23 @@
<!--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 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 value="{{sPwd}}" placeholder="请输入密码" placeholder-class="placeholder-style" bindinput="passwordInput"></input>
<view style="font-size:28rpx;font-weight:bolder;margin-top: 32rpx;margin-left: 32rpx">手机号</view>
<input 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 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 value="{{companyName}}" placeholder="请输入公司名称" placeholder-class="placeholder-style" bindinput="companyInput"></input>
<view style="font-size:28rpx;font-weight:bolder;margin-top: 32rpx;margin-left: 32rpx">公司品牌</view>
<input value="{{brandName}}" placeholder="请输入公司品牌" placeholder-class="placeholder-style" bindinput="brandInput"></input>
<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="captcha" disabled="{{captchaDisabled}}" plain="true" disabled-class="disabled">{{captchaLabel}}</button>
</view>
<button class="bts" bindtap="Submit">提交审核</button>
</view>

@ -0,0 +1,61 @@
/* 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: 30%;
height: 60rpx;
line-height: 60rpx;
margin: auto 0;
color: #fff;
font-size: 25rpx;
}

@ -5,6 +5,18 @@
"compileHotReLoad": true,
"urlCheck": false
},
"condition": {},
"condition": {
"miniprogram": {
"list": [
{
"name": "",
"pathName": "pages/mine/pages/register/register",
"query": "",
"launchMode": "default",
"scene": null
}
]
}
},
"libVersion": "2.25.2"
}

@ -0,0 +1,24 @@
var length = 59;
function countdown(that) {
    var seconds = that.data.seconds;
    var captchaLabel = that.data.captchaLabel;
    if (seconds <= 1) {
        captchaLabel = '获取验证码';
        seconds = length;
        that.setData({
            captchaDisabled: false
        });
    } else {
        captchaLabel = --seconds + '秒后重新发送'
    }
    that.setData({
        seconds: seconds,
        captchaLabel: captchaLabel
    });
}
module.exports = {
    countdown: countdown,
    length: length
}
Loading…
Cancel
Save