miaofuhao месяцев назад: 11
Родитель
Сommit
9f35ed4897
3 измененных файлов с 35 добавлено и 35 удалено
  1. BIN
      双汇APP-andriod.zip
  2. 2 2
      双汇APP-h5/js/huayi.config.js
  3. 33 33
      双汇APP-h5/js/login.js

BIN
双汇APP-andriod.zip


+ 2 - 2
双汇APP-h5/js/huayi.config.js

@@ -2,9 +2,9 @@ if(huayi == undefined) {
2 2
 	var huayi = {};
3 3
 }
4 4
 huayi.config = {
5
-	 callcenter_url: "http://oa.shuanghui.net:8046/",//生产环境
5
+	 // callcenter_url: "http://oa.shuanghui.net:8046/",//生产环境
6 6
 	//callcenter_url: "http://121.196.219.217:8046/",//生产环境
7
-	// callcenter_url: "http://192.168.8.9:1001/",//生产环境
7
+	callcenter_url: "http://192.168.8.9:1001/",//生产环境
8 8
 	socket_ip: "222.143.137.63", //ip
9 9
 	socket_port: "8081", //端口
10 10
 	indexOutTime: 2000, //菜单工单数量刷新间隔

+ 33 - 33
双汇APP-h5/js/login.js

@@ -1,5 +1,6 @@
1 1
 mui.init();
2
-mui.plusReady(function() {
2
+
3
+window.onload = function () {
3 4
 	var usercode = localStorage.getItem("user"); //获取本地存储
4 5
 	var psw = localStorage.getItem("psw"); //获取本地存储s
5 6
 	
@@ -18,50 +19,49 @@ mui.plusReady(function() {
18 19
 			" extensionphone": 1
19 20
 		};
20 21
 		if(!username) {
21
-			plus.nativeUI.toast('输入账号');
22
+			mui.toast('输入账号');
22 23
 		} else if(!password) {
23
-			plus.nativeUI.toast('密码不能为空');
24
+			mui.toast('密码不能为空');
24 25
 		} else {
25
-			if(plus.networkinfo.getCurrentType() == plus.networkinfo.CONNECTION_NONE) {
26
-				mui.toast("网络连接中断!");
27
-			}
28
-			// 调用ajax  
29
-			mui.ajax(huayi.config.callcenter_url + '/WorkorderApp/login', {
26
+			$.ajax({
27
+				type: "post",
28
+				url: huayi.config.callcenter_url + "/WorkorderApp/login",
29
+				dataType: 'json',
30
+				async: true,
30 31
 				data: data,
31
-				dataType: 'json', //服务器返回json格式数据
32
-				type: 'post', //HTTP请求类型
33
-				timeout: 10000, //超时时间设置为10秒
34
-				success: function(data) {
35
-					if(data.state == "success") {
36
-
32
+				success: function (data) {
33
+					/*验证请求*/
34
+					if (data.state == "success") {
37 35
 						localStorage.setItem("token", data.data.token);
38 36
 						localStorage.setItem("user", username);
39 37
 						localStorage.setItem("psw", password);
40
-						var nwaiting = plus.nativeUI.showWaiting();
41
-						webviewShow = plus.webview.create("Leader-index.html"); //后台创建webview并打开show.html  
38
+						mui.openWindow({
39
+							id: 'personal',
40
+							url: 'personal.html', 
41
+							createNew: true,
42
+							show: {
43
+								autoShow: false
44
+							},
45
+							waiting: {
46
+								autoShow: true //自动显示等待框,默认为true
47
+							},
48
+							extras: {
49
+								index: 0,
50
+							}
51
+						});
52
+						// var nwaiting = plus.nativeUI.showWaiting();
53
+						// webviewShow = plus.webview.create("Leader-index.html"); //后台创建webview并打开show.html  
42 54
 						document.getElementById('account').value = "";
43 55
 						document.getElementById('password').value = "";
44 56
 					} else {
45
-						mui.alert(data.message);
46
-						document.getElementById('account').value = "";
47
-						document.getElementById('password').value = "";
57
+						layer.msg("登录失败");
48 58
 					}
49
-				},
50
-				error: function(xhr, type, errorThrown) {
51
-					alert(JSON.stringify(xhr), type,JSON.stringify(errorThrown) )
52 59
 				}
53 60
 			});
54
-
55 61
 		}
56 62
 	});
63
+}
64
+
65
+
66
+
57 67
 
58
-	//监听系统通知栏消息点击事件  
59
-	plus.push.addEventListener('click', function(msg){  
60
-	    //处理点击消息的业务逻辑代码  
61
-	    plus.webview.create('personal.html')
62
-	}, false);  
63
-	//监听接收透传消息事件  
64
-	plus.push.addEventListener('receive', function(msg){  
65
-	    //处理透传消息的业务逻辑代码  
66
-	}, false);
67
-});