银花优选微信小程序修改后的最新版本代码
This commit is contained in:
203
pages/forgetPassword/index.js
Normal file
203
pages/forgetPassword/index.js
Normal file
@@ -0,0 +1,203 @@
|
||||
var app=getApp()
|
||||
var that=null
|
||||
var sopenFrame=null
|
||||
var wait=120
|
||||
var username=""
|
||||
var phone=""
|
||||
Page( {
|
||||
data: {
|
||||
getcode:"获取验证码",
|
||||
savebutton:"重置密码"
|
||||
},
|
||||
|
||||
onLoad: function() {
|
||||
that = this
|
||||
that.rdata()
|
||||
|
||||
},rdata: function() {
|
||||
|
||||
|
||||
},login:function(e) {
|
||||
var username = "";//e.detail.value.username
|
||||
var phone = e.detail.value.phone
|
||||
var code = e.detail.value.code
|
||||
var psd=e.detail.value.psd
|
||||
var psd2=e.detail.value.psd2
|
||||
var b=true
|
||||
|
||||
/*if(username==null || username==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "用户名不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}*/
|
||||
if(b){
|
||||
if(phone==null || phone==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "手机号码不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(code==null || code==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "手机验证码不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(psd==null || psd==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "新密码不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
var patrn =/^(?=.{6,16}$)[0-9a-zA-Z_]+$/;
|
||||
if(!patrn.exec(psd)) {
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "新密码由6-16位数字、字母、下划线组成!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(psd2==null || psd2==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "确认密码不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(psd!=psd2){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "两次输入新密码不一致!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
that.setData({
|
||||
savebutton:"请稍候..."
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"forgetPassword",
|
||||
//username:username,
|
||||
phone:phone,
|
||||
code:code,
|
||||
password:psd
|
||||
},
|
||||
method:"POST",
|
||||
dataType:"json",
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded" // 默认值
|
||||
},
|
||||
success (res) {
|
||||
that.setData({
|
||||
savebutton:"保存"
|
||||
})
|
||||
if(res.data.status==1){
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "success",
|
||||
duration: 3000
|
||||
})
|
||||
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},getcode:function(e) {
|
||||
|
||||
var b=true
|
||||
|
||||
if(b){
|
||||
if(phone==null || phone==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "手机号码不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"sendphonecode0",
|
||||
username:phone,
|
||||
phone:phone
|
||||
},
|
||||
method:"POST",
|
||||
dataType:"json",
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded" // 默认值
|
||||
},
|
||||
success (res) {
|
||||
if(res.data.status==1){
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "success",
|
||||
duration: 3000
|
||||
})
|
||||
that.gettime()
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
gettime:function() {
|
||||
if (wait == 0) {
|
||||
that.setData({
|
||||
getcode:"获取验证码"
|
||||
})
|
||||
wait = 120;
|
||||
} else {
|
||||
that.setData({
|
||||
getcode: "重新发送(" + wait + ")"
|
||||
})
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
that.gettime()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
},getusernameValue:function(e) {
|
||||
username=e.detail.value
|
||||
},getphoneValue:function(e) {
|
||||
phone=e.detail.value
|
||||
}
|
||||
})
|
||||
3
pages/forgetPassword/index.json
Normal file
3
pages/forgetPassword/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "忘记密码"
|
||||
}
|
||||
31
pages/forgetPassword/index.wxml
Normal file
31
pages/forgetPassword/index.wxml
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
<view class="container">
|
||||
|
||||
<view class="login-box">
|
||||
|
||||
<view class="frombody">
|
||||
<form bindsubmit='login'>
|
||||
<!--<view>
|
||||
<text>用户名:</text><input name="username" bindinput='getusernameValue' type="text" placeholder="请填写用户名" value="" />
|
||||
</view>-->
|
||||
<view>
|
||||
<text>手机号码:</text><input name="phone" bindinput='getphoneValue' type="text" placeholder="请填写手机号码" value="" />
|
||||
</view>
|
||||
<view>
|
||||
<text>手机验证码:</text><input name="code" type="text" placeholder="请填写手机验证码" value="" class="code" /><view class="getcode" bindtap="getcode">{{getcode}}</view>
|
||||
</view>
|
||||
<view>
|
||||
<text>新密码:</text><input name="psd" type="password" placeholder="请填写登录密码" value="" />
|
||||
</view>
|
||||
<view>
|
||||
<text>确认新密码:</text><input name="psd2" type="password" placeholder="请填写登录密码" value="" />
|
||||
</view>
|
||||
<view class="button">
|
||||
<button form-type="submit">{{savebutton}}</button>
|
||||
</view>
|
||||
|
||||
</form>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
27
pages/forgetPassword/index.wxss
Normal file
27
pages/forgetPassword/index.wxss
Normal file
@@ -0,0 +1,27 @@
|
||||
/**index.wxss**/
|
||||
page{
|
||||
background: #ccc;
|
||||
}
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
background-size: 100% 100%
|
||||
}
|
||||
.clear{clear: both;height: 0;width:100%;}
|
||||
.fromtitle{width:100%; background-color:#fff; padding:1em; box-sizing: border-box;}
|
||||
.fromtitle text{float:left;}
|
||||
.fromtitle image{float:left;width:1.2em; height:1.2em;}
|
||||
.fromtitle image.arrowdown{float:right; }
|
||||
.login-box .frombody{margin-top: 1em; padding:0.5em 1em;width:100%; display: flex;flex-direction: column; align-items: center; background-color:#fff;box-sizing: border-box;}
|
||||
.login-box .frombody view{position: relative;float:left; width:100%;display: flex;flex-direction:row;border-bottom:1px solid #f1f1f1;padding:0.5em 0; box-sizing: border-box;}
|
||||
.login-box .frombody view view{width:auto;border-bottom:0;}
|
||||
.login-box .frombody view text{padding:0; width:6em; height:2.5em; line-height: 2.5em;}
|
||||
.login-box .frombody view input{width:12em;height:2.5em; line-height: 2.5em;}
|
||||
.login-box .frombody view input.code{width:9em;}
|
||||
.login-box .frombody view.area input{width:12.8em;}
|
||||
.login-box .frombody view.area image{position: absolute; top:1.1em; right:0; width:1.2em;height:1.2em;}
|
||||
.login-box .frombody view.button{border: 0;}
|
||||
.login-box .frombody view.button button{width:100%;height:2.5em; line-height: 2.5em; background:linear-gradient(to right,#00B050,#00B050); color:#fff; border-radius:0.5em;}
|
||||
Reference in New Issue
Block a user