银花优选微信小程序修改后的最新版本代码
This commit is contained in:
184
pages/mypassword2/index.js
Normal file
184
pages/mypassword2/index.js
Normal file
@@ -0,0 +1,184 @@
|
||||
var app = getApp()
|
||||
var that=null
|
||||
var sopenFrame=null
|
||||
Page( {
|
||||
data: {
|
||||
savebutton:"保存",
|
||||
phone:"",
|
||||
getcode:"获取验证码",
|
||||
IFDefault:0
|
||||
},
|
||||
|
||||
onLoad: function() {
|
||||
that = this
|
||||
that.rdata()
|
||||
|
||||
},rdata: function() {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
var userInfodata = wx.getStorageSync("userInfo")
|
||||
if(userId&&LoginId&&userInfodata){
|
||||
var userInfo = JSON.parse(userInfodata)
|
||||
that.setData({
|
||||
phone:userInfo.Phone
|
||||
})
|
||||
}
|
||||
|
||||
},getcode:function(e) {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
var b=true
|
||||
|
||||
if(b){
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"sendphonecode1",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId)
|
||||
},
|
||||
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)
|
||||
}
|
||||
|
||||
},bsubmit:function(e) {
|
||||
var code = e.detail.value.code
|
||||
var newpwd=e.detail.value.newpwd
|
||||
var newconfpwd=e.detail.value.newconfpwd
|
||||
var b=true
|
||||
|
||||
if(b){
|
||||
if(code==null || code==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "手机验证码不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(newpwd==null || newpwd==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "新密码不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
var patrn =/^(?=.{6,16}$)[0-9a-zA-Z_]+$/;
|
||||
if(!patrn.exec(newpwd)) {
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "新密码由6-16位数字、字母、下划线组成!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(newconfpwd==null || newconfpwd==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "确认新密码不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(newconfpwd!=newpwd){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "两次输入新密码不一致!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
that.setData({
|
||||
savebutton:"请稍候..."
|
||||
})
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"editpwd2",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId),
|
||||
code:code,
|
||||
newpwd:newpwd
|
||||
},
|
||||
method:"POST",
|
||||
dataType:"json",
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded" // 默认值
|
||||
},
|
||||
success (res) {
|
||||
if(res.data.status==1){
|
||||
wx.showModal({
|
||||
title: "操作提示",
|
||||
content: res.data.msg,
|
||||
showCancel:false,
|
||||
success (res0) {
|
||||
if (res0.confirm) {
|
||||
wx.navigateBack({})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
that.setData({
|
||||
savebutton:"保存"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
3
pages/mypassword2/index.json
Normal file
3
pages/mypassword2/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "修改安全密码"
|
||||
}
|
||||
29
pages/mypassword2/index.wxml
Normal file
29
pages/mypassword2/index.wxml
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
<view class="container">
|
||||
|
||||
<view class="login-box">
|
||||
|
||||
<view class="frombody">
|
||||
<form bindsubmit='bsubmit'>
|
||||
<view>
|
||||
<text>手机号码:</text><input name="phone" type="text" value="{{phone}}" disabled="true" />
|
||||
</view>
|
||||
<view>
|
||||
<text>手机验证码:</text><input name="code" class="code" type="text" placeholder="请填写手机验证码" value="" /> <view bindtap="getcode">{{getcode}}</view>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<text>新密码:</text><input name="newpwd" type="password" placeholder="请填写新密码" value="" />
|
||||
</view>
|
||||
<view>
|
||||
<text>确认新密码:</text><input name="newconfpwd" type="password" placeholder="请填写确认新密码" value="" />
|
||||
</view>
|
||||
<view class="button">
|
||||
<button form-type="submit">{{savebutton}}</button>
|
||||
</view>
|
||||
|
||||
</form>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
29
pages/mypassword2/index.wxss
Normal file
29
pages/mypassword2/index.wxss
Normal file
@@ -0,0 +1,29 @@
|
||||
/**index.wxss**/
|
||||
page{
|
||||
background: #ccc;
|
||||
}
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
background-size: 100% 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.nobottom{border-bottom:0;padding-bottom: 0;}
|
||||
.login-box .frombody view.nobottom_line{padding-left:4em;padding-top:0;color:#000;}
|
||||
.login-box .frombody view view{display: block; width: auto;padding:0; border-bottom:0;line-height: 2.5em;}
|
||||
.login-box .frombody view text{padding:0;height:2.5em; width:6em; line-height: 2.5em;}
|
||||
.login-box .frombody view input{width:14em;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:1em;}
|
||||
Reference in New Issue
Block a user