Commit a483459f by libai

测试

parent 5067204e
...@@ -287,7 +287,12 @@ ...@@ -287,7 +287,12 @@
}); });
function params(){ function params(){
// var url = window.location.search; // var url = window.location.search;
// map.set('ua',window.navigator.userAgent.toLowerCase()); var ua = window.navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == 'micromessenger'){
map.set('ua','wechat');
}else{
map.set('ua','other');
}
map.set('pkg','wechat'); map.set('pkg','wechat');
map.set('cid','wechat'); map.set('cid','wechat');
map.set('gzh','guodong'); map.set('gzh','guodong');
...@@ -626,6 +631,7 @@ ...@@ -626,6 +631,7 @@
xhr.upload.addEventListener("progress", uploadProgress, false); xhr.upload.addEventListener("progress", uploadProgress, false);
xhr.open("post", url, true); xhr.open("post", url, true);
xhr.onload = function () { xhr.onload = function () {
if(xhr.status==200){
var result = xhr.responseText; var result = xhr.responseText;
var json = eval("(" + result + ")"); var json = eval("(" + result + ")");
switch (json.code) { switch (json.code) {
...@@ -639,6 +645,13 @@ ...@@ -639,6 +645,13 @@
$("#img").val(''); $("#img").val('');
break; break;
} }
}else{
system(xhr.status);
tips("上传发生错误"+xhr.status,"error",3000);
}
};
xhr.onerror = function(e) {
tips("上传发生错误"+e,"error",3000);
}; };
xhr.send(formdata); xhr.send(formdata);
} }
......
...@@ -287,7 +287,11 @@ ...@@ -287,7 +287,11 @@
}); });
function params(){ function params(){
var url = window.location.search; var url = window.location.search;
map.set('ua',window.navigator.userAgent.toLowerCase()); if(ua.match(/MicroMessenger/i) == 'micromessenger'){
map.set('ua','wechat');
}else{
map.set('ua','other');
}
// map.set('pkg','wechat'); // map.set('pkg','wechat');
// map.set('cid','wechat'); // map.set('cid','wechat');
// map.set('gzh','naicha'); // map.set('gzh','naicha');
...@@ -626,6 +630,7 @@ ...@@ -626,6 +630,7 @@
xhr.upload.addEventListener("progress", uploadProgress, false); xhr.upload.addEventListener("progress", uploadProgress, false);
xhr.open("post", url, true); xhr.open("post", url, true);
xhr.onload = function () { xhr.onload = function () {
if(xhr.status==200){
var result = xhr.responseText; var result = xhr.responseText;
var json = eval("(" + result + ")"); var json = eval("(" + result + ")");
switch (json.code) { switch (json.code) {
...@@ -639,6 +644,13 @@ ...@@ -639,6 +644,13 @@
$("#img").val(''); $("#img").val('');
break; break;
} }
}else{
system(xhr.status);
tips("上传发生错误"+xhr.status,"error",3000);
}
};
xhr.onerror = function(e) {
tips("上传发生错误"+e,"error",3000);
}; };
xhr.send(formdata); xhr.send(formdata);
} }
......
...@@ -287,10 +287,15 @@ ...@@ -287,10 +287,15 @@
}); });
function params(){ function params(){
// var url = window.location.search; // var url = window.location.search;
// map.set('ua',window.navigator.userAgent.toLowerCase()); var ua = window.navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == 'micromessenger'){
map.set('ua','wechat');
}else{
map.set('ua','other');
}
map.set('pkg','wechat'); map.set('pkg','wechat');
map.set('cid','wechat'); map.set('cid','wechat');
map.set('gzh','naicha'); map.set('gzh','guodong');
// if (url.indexOf("?") != -1) { // if (url.indexOf("?") != -1) {
// var p = url.substr(1); // var p = url.substr(1);
// keys = p.split("&"); // keys = p.split("&");
...@@ -627,6 +632,7 @@ ...@@ -627,6 +632,7 @@
xhr.upload.addEventListener("progress", uploadProgress, false); xhr.upload.addEventListener("progress", uploadProgress, false);
xhr.open("post", url, true); xhr.open("post", url, true);
xhr.onload = function () { xhr.onload = function () {
if(xhr.status==200){
var result = xhr.responseText; var result = xhr.responseText;
var json = eval("(" + result + ")"); var json = eval("(" + result + ")");
switch (json.code) { switch (json.code) {
...@@ -640,6 +646,13 @@ ...@@ -640,6 +646,13 @@
$("#img").val(''); $("#img").val('');
break; break;
} }
}else{
system(xhr.status);
tips("上传发生错误"+xhr.status,"error",3000);
}
};
xhr.onerror = function(e) {
tips("上传发生错误"+e,"error",3000);
}; };
xhr.send(formdata); xhr.send(formdata);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment