调整用户绑定问题

wyd_branch
Your Name 2 years ago
parent 1d0d12b1f6
commit f41fd9dc5e

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,135 @@
// const app = getApp()
Page({
data: {
realName: '',
number: '',
isDisabled: true //表示页面加载完成时disabled为禁用状态
},
onLoad: function(options) {
let number = options.number
let realName = options.realName
this.setData({
number,
realName
})
},
save: function() {
let realName = this.data.realName;
let number=this.data.number
let skey = wx.getStorageSync('skey')
wx.request({
url: 'http://192.168.58.210:81/save',
method: 'GET',
data: {
skey:skey,
number:number,
realName:realName
},
success: function(res :any) {
if (res.data.error == true) {
wx.showToast({
title: res.data.message,
icon: 'none',
duration: 2000
})
} else {
wx.showToast({
title: res.data.message,
icon: 'success',
duration: 5000
})
wx.removeStorageSync('info')
wx.navigateBack({
delta: 2
})
}
}
})
},
inputRealName: function(e :any) {
var realName = e.detail.value
this.setData({
realName
})
console.log(realName)
if (realName !== '') {
this.setData({
isDisabled: false
})
} else {
this.setData({
isDisabled: true
})
}
},
inputNumber: function(e :any) {
var number = e.detail.value
this.setData({
number
})
// console.log()
if (number !== '') {
this.setData({
isDisabled: false
})
} else {
this.setData({
isDisabled: true
})
}
},
onReady: function() {
},
/**
* --
*/
onShow: function() {
},
/**
* --
*/
onHide: function() {
},
/**
* --
*/
onUnload: function() {
},
/**
* --
*/
onPullDownRefresh: function() {
},
/**
*
*/
onReachBottom: function() {
},
/**
*
*/
onShareAppMessage: function() {
}
})

@ -0,0 +1,15 @@
<!--pages/bd/bd.wxml-->
<view>
<view class="btn-area" id="buttonContainer">
<view class='binding-item'>
<view>姓名</view>
<input type="text" placeholder="请输入您的真实姓名" value="{{realName}}" bindinput="inputRealName"></input>
</view>
<view class='binding-item'>
<view>学号</view>
<input type="number" placeholder="请输入您的学号" value="{{number}}" bindinput="inputNumber"></input>
</view>
<button type="submit" bindtap="save" class="save" disabled='{{isDisabled}}'>提交</button>
</view>
</view>

@ -0,0 +1,30 @@
/* pages/bd/bd.wxss */
.binding-item {
margin: 40rpx;
padding-top: 20rpx;
padding-bottom: 40rpx;
display: flex;
font-size: 32rpx;
/* 在模拟器为iphone 6 时1px=2rpx 这里设置32rpx即16px */
border-bottom: 1rpx solid #dedede;
}
.binding-item input {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
padding-left: 20rpx;
}
.binding-btn{
background-color:#19be6b;
padding: 28rpx;
margin: 40rpx;
color: pink;
text-align: center;
}
.button{
margin-top: 30rpx;
margin-bottom: 30rpx;
}
Loading…
Cancel
Save