浏览代码

微信绑定

li 7 年之前
父节点
当前提交
f1e1de0f41
共有 3 个文件被更改,包括 46 次插入6 次删除
  1. 8 0
      app/html/backBindUn.html
  2. 38 5
      app/js/backBindUn.js
  3. 0 1
      app/js/register.js

+ 8 - 0
app/html/backBindUn.html

@ -24,6 +24,14 @@
24 24
		        <div class="mui-input-row frm-input">
25 25
		            <input type="tel" class="mui-input-clear frmtype" placeholder="请输入手机号码" id="phone">
26 26
		        </div>
27
		        <div class="mui-row mui-input-row frm-input">
28
		        	<div class="mui-col-xs-8">
29
		        		<input type="text" class="frmtype" placeholder="请输入图形验证码" id="imgCode">
30
		        	</div>
31
					<div class="mui-col-xs-4">
32
						<img src="http://www.ekexiu.com/ajax/PictureVC" alt="" id="changImage" width="100%" height="48"/>
33
					</div>
34
				</div>
27 35
		        <div class="mui-row mui-input-row frm-input">
28 36
		        	<div class="mui-col-xs-8">
29 37
		        		<input type="number" class="frmtype" placeholder="请输入验证码" id="phoneCode">

+ 38 - 5
app/js/backBindUn.js

@ -6,6 +6,7 @@ var oPhoneCode=document.getElementById("phoneCode");
6 6
var weiChatName=document.getElementById("weiChatName");
7 7
var setpassword=document.getElementById("setpassword");
8 8
var binding=document.getElementById("binding");
9
var changImage = document.getElementById("changImage")
9 10
var state = 0;
10 11
var phoneCode = false;
11 12
document.getElementById("weiChatName").value=ws.name;
@ -20,7 +21,7 @@ phone.addEventListener("keyup",function(){
20 21
	}
21 22
})
22 23
/*校验提交按钮显示状态*/
23
		mui('.frmboxNew').on('keyup', "#weiChatName,#phone,#phoneCode,#setpassword", function() {
24
		mui('.frmboxNew').on('keyup', "#weiChatName,#imgCode,#phone,#phoneCode,#setpassword", function() {
24 25
			if(weiChatName.value == "" || phone.value == "" || oPhoneCode.value == "" || setpassword.value == "") {
25 26
				binding.setAttribute("disabled","disabled");
26 27
			} else {
@ -30,12 +31,18 @@ phone.addEventListener("keyup",function(){
30 31
				binding.removeAttribute("disabled");
31 32
			}
32 33
		});
33
		
34
		changImage.addEventListener("tap",function(){ 
35
			this.setAttribute("src","http://www.ekexiu.com/ajax/PictureVC?"+new Date().getTime());
36
		})
34 37
		/*校验手机号*/
35 38
		getPhoneCode.addEventListener("tap",function(){
36 39
			phoneVal();
37 40
		})
38 41
		function phoneVal() {
42
			if(imgCode.value=="") {
43
				plus.nativeUI.toast("请输入图形验证码", toastStyle);
44
				return;
45
			}
39 46
			var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
40 47
			if(hunPhone.test(phone.value)) {
41 48
				isReg();
@ -80,10 +87,15 @@ phone.addEventListener("keyup",function(){
80 87
		}
81 88
		/*手机发送验证码*/
82 89
		function sendAuthentication() {
83
			console.log("send code")
84
			mui.ajax(baseUrl + '/ajax/regmobilephone_onlyphone', {
90
			var cookieValue=plus.navigator.getCookie("http://www.ekexiu.com/ajax/PictureVC");
91
			console.log(cookieValue)
92
			mui.ajax(baseUrl + '/ajax/regmobilephone', {
93
				header:{
94
					"Cookie":cookieValue
95
				},
85 96
				data: {
86
					mobilePhone: phone.value
97
					mobilePhone: phone.value,
98
					vcode: imgCode.value
87 99
				},
88 100
				dataType: 'json', //数据格式类型
89 101
				type: 'GET', //http请求类型
@ -95,6 +107,11 @@ phone.addEventListener("keyup",function(){
95 107
						state = data.data;
96 108
						console.log(state);
97 109
						doClick();
110
					}else{
111
						if(data.code==20001) {
112
							plus.nativeUI.toast("请输入正确的图形验证码", toastStyle);
113
							changImage.setAttribute("src","http://www.ekexiu.com/ajax/PictureVC?"+new Date().getTime());
114
						}
98 115
					}
99 116
				},
100 117
				error: function() {
@ -120,6 +137,7 @@ phone.addEventListener("keyup",function(){
120 137
					getPhoneCode.style.display = "block";
121 138
					getCodeOff.style.display = "none";
122 139
					getPhoneCode.value = "获取验证码";
140
					changImage.setAttribute("src","http://www.ekexiu.com/ajax/PictureVC?"+new Date().getTime());
123 141
				}
124 142
			}, 1000);
125 143
		}
@ -175,6 +193,15 @@ phone.addEventListener("keyup",function(){
175 193
				plus.nativeUI.toast("请输入正确的手机号码", toastStyle);
176 194
				return;
177 195
			}
196
			if(imgCode.value.length==0) {
197
				plus.nativeUI.toast("请输入图形验证码", toastStyle);
198
				return;
199
			}else if(imgCode.value.length==4){
200
				
201
			}else{
202
				plus.nativeUI.toast("图形验证码4位", toastStyle);
203
				return;
204
			}
178 205
			if(!oNum.test(oPhoneCode.value)) {
179 206
				plus.nativeUI.toast("验证码为4位数字", toastStyle);
180 207
				return;
@ -220,6 +247,12 @@ phone.addEventListener("keyup",function(){
220 247
								aniShow: "slide-in-right"
221 248
							}
222 249
						});
250
					}else{
251
						if(data.code==-1){
252
							plus.nativeUI.toast("验证码已过期,请重新获取", toastStyle);
253
						}else if(data.code==-2 || data.code==-3 ||data.code==0){
254
							plus.nativeUI.toast("验证码错误,请检查后重试", toastStyle);
255
						}
223 256
					}
224 257
				},
225 258
				error: function() {

+ 0 - 1
app/js/register.js

@ -250,7 +250,6 @@ mui.ready(function() {
250 250
					if(data.success) {
251 251
						var userId = data.data;
252 252
						plus.storage.setItem('userid', userId);
253
						client()
254 253
						plus.storage.setItem('name', name.value);
255 254
						plus.nativeUI.toast("已完成注册,请填写个人信息", toastStyle);
256 255
						mui.openWindow({