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,20 +631,28 @@ ...@@ -626,20 +631,28 @@
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 () {
var result = xhr.responseText; if(xhr.status==200){
var json = eval("(" + result + ")"); var result = xhr.responseText;
switch (json.code) { var json = eval("(" + result + ")");
case 1: switch (json.code) {
// var path=cdn+; case 1:
send(json.imgkey,2002); // var path=cdn+;
$("#img").val(''); send(json.imgkey,2002);
break; $("#img").val('');
default: break;
system(json.msg); default:
$("#img").val(''); system(json.msg);
break; $("#img").val('');
} 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,20 +630,28 @@ ...@@ -626,20 +630,28 @@
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 () {
var result = xhr.responseText; if(xhr.status==200){
var json = eval("(" + result + ")"); var result = xhr.responseText;
switch (json.code) { var json = eval("(" + result + ")");
case 1: switch (json.code) {
// var path=cdn+; case 1:
send(json.imgkey,2002); // var path=cdn+;
$("#img").val(''); send(json.imgkey,2002);
break; $("#img").val('');
default: break;
system(json.msg); default:
$("#img").val(''); system(json.msg);
break; $("#img").val('');
} 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,20 +632,28 @@ ...@@ -627,20 +632,28 @@
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 () {
var result = xhr.responseText; if(xhr.status==200){
var json = eval("(" + result + ")"); var result = xhr.responseText;
switch (json.code) { var json = eval("(" + result + ")");
case 1: switch (json.code) {
// var path=cdn+; case 1:
send(json.imgkey,2002); // var path=cdn+;
$("#img").val(''); send(json.imgkey,2002);
break; $("#img").val('');
default: break;
system(json.msg); default:
$("#img").val(''); system(json.msg);
break; $("#img").val('');
} 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