[添加转账,提现等新功能]
This commit is contained in:
72
pages/password/password.js
Normal file
72
pages/password/password.js
Normal file
@@ -0,0 +1,72 @@
|
||||
// pages/password/password.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
passSource : '', //设置密码跳转来源favourUrl为转账跳转
|
||||
passType : '', //是否是首次设置密码
|
||||
disabled : false, //设置支付密码
|
||||
password : '', //支付密码
|
||||
confirmation: '' //确认密码
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad (options) {
|
||||
// 检查用户登录状态
|
||||
const Paypass = wx.getStorageSync("hasPaypass")
|
||||
|
||||
this.setData({
|
||||
passType : Paypass,
|
||||
passSource: options.source
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置密码
|
||||
*/
|
||||
formSubmit(e) {
|
||||
let newoldPassword= e.detail.value.oldPassword,
|
||||
newPassword = e.detail.value.password,
|
||||
newFormSubmit = e.detail.value.confirmation
|
||||
|
||||
let newUrl = '' //定义接口来源名称
|
||||
|
||||
if(this.data.passType == false) newUrl = wx.$api.user.setPassword(newPassword, newFormSubmit)
|
||||
if(this.data.passType == true) newUrl = wx.$api.user.changePassword(newoldPassword, newPassword, newFormSubmit)
|
||||
|
||||
newUrl.then(res=>{
|
||||
// 已设置密码缓存
|
||||
wx.setStorage({
|
||||
key : 'hasPaypass',
|
||||
data : true
|
||||
})
|
||||
|
||||
this.setData({
|
||||
disabled: true
|
||||
})
|
||||
wx.showToast({
|
||||
title: '设置成功',
|
||||
})
|
||||
|
||||
// 只有从转账页面跳转才回到上一页
|
||||
if(this.data.passSource == "favourUrl") {
|
||||
setTimeout(()=>{
|
||||
wx.navigateBack({delta: 1})
|
||||
},2000)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 其他跳转回到用户中心
|
||||
setTimeout(()=>{
|
||||
wx.switchTab({
|
||||
url: '/pages/user/user'
|
||||
})
|
||||
},2000)
|
||||
})
|
||||
}
|
||||
})
|
||||
6
pages/password/password.json
Normal file
6
pages/password/password.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "支付密码",
|
||||
"navigationBarBackgroundColor": "#000000",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
20
pages/password/password.wxml
Normal file
20
pages/password/password.wxml
Normal file
@@ -0,0 +1,20 @@
|
||||
<view class="pass">
|
||||
<form bindsubmit="formSubmit">
|
||||
<view class="favourCont-label" wx:if="{{passType}}">
|
||||
<view class="favourCont-name">旧密码:</view>
|
||||
<input type="number" password name="oldPassword" placeholder="请输入旧密码" />
|
||||
</view>
|
||||
<view class="favourCont-label">
|
||||
<view class="favourCont-name">{{passType ? '新密码' : '输入密码'}}:</view>
|
||||
<input type="number" password name="password" placeholder="请输入支付密码" />
|
||||
</view>
|
||||
<view class="favourCont-label">
|
||||
<view class="favourCont-name">确认密码:</view>
|
||||
<input type="number" password name="confirmation" placeholder="请再次输入支付密码" />
|
||||
</view>
|
||||
<view class="favourCont-btn">
|
||||
<button formType="submit" disabled="{{disabled}}">确认设置</button>
|
||||
<navigator hover-class="none" url="/pages/password_forget/password_forget" class="forget" wx:if="{{passType}}">忘记密码, 立即找回?</navigator>
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
48
pages/password/password.wxss
Normal file
48
pages/password/password.wxss
Normal file
@@ -0,0 +1,48 @@
|
||||
.favourCont-label {
|
||||
background-color: #fff;
|
||||
height: 120rpx;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.favourCont-label input {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
font-size: 30rpx;
|
||||
padding-left: 220rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.favourCont-name {
|
||||
line-height: 100rpx;
|
||||
}
|
||||
|
||||
.favourCont-btn {
|
||||
width: 100%;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
margin-top: 50rpx;
|
||||
|
||||
}
|
||||
|
||||
.favourCont-btn button {
|
||||
background-color: #3a3b3e;
|
||||
color: #fff;
|
||||
width: 100% !important;
|
||||
line-height: 60rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.forget {
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
font-size: 30rpx;
|
||||
color: #d6571f;
|
||||
font-weight: 600;
|
||||
}
|
||||
Reference in New Issue
Block a user