HasDocumented.js 2.31 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
// 已有建档

var numberUtil = require('../../utils/numberUtil.js')
// 网络请求工具类
var networkUtil = require('../../utils/network_util.js')
var api = require('../../utils/apiFile.js')

Page({
data: {
inputFocus: {nameInput:false,
phoneInput:false}
},
formSubmit: function(e) {
console.log('form发生了submit事件,携带数据为:', e.detail.value.name)
// 校验
if(e.detail.value.name == '' || e.detail.value.phone == ''){
wx.showModal({
title: '提示',
content: '请输入姓名与手机号',
showCancel:false,
success: function(res) {
}
})
return
}
if(!numberUtil.IsTelPhoneNumber(e.detail.value.phone)) {
wx.showModal({
title: '提示',
content: '请输入正确的手机号',
showCancel:false,
success: function(res) {
}
})
return
}
// 请求
networkUtil.showLoading()
var username = e.detail.value.name
var self = this
var param = {
username : e.detail.value.name,
phone : e.detail.value.phone,
}
networkUtil._post(api.bindDoc,param,function(res){
console.log(res)
wx.navigateTo({
url: '../HasDocumentedVerify/HasDocumentedVerify?name=' + e.detail.value.name + '&phone=' + e.detail.value.phone + ''
})
},function(res){
if(res.errorcode == 4100){
networkUtil.showErrorToast('您的手机号获取验证码超过限制')
} else if (res.errorcode == 404){
networkUtil.showErrorToast('暂未连接到服务器,请稍后再试')
} else {
networkUtil.showErrorToast('暂未查询到您的建档信息,请前往医院建档或稍后再试')
}
})
},

getFocus:function(e) {
var that = this
var focus = that.data.inputFocus
if(e.target.id == 'name') {

focus.nameInput = true
focus.phoneInput = false
} else {
focus.phoneInput = true
focus.nameInput = false
}
that.setData({
inputFocus:focus
})
},
blurInput:function(e) {
var that = this
var focus = that.data.inputFocus
if(e.target.id == 'name') {

focus.nameInput = false
} else {
focus.phoneInput = false
}
that.setData({
inputFocus:focus
})
}
})