Commit a483459f by libai

测试

parent 5067204e
......@@ -287,7 +287,12 @@
});
function params(){
// 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('cid','wechat');
map.set('gzh','guodong');
......@@ -626,20 +631,28 @@
xhr.upload.addEventListener("progress", uploadProgress, false);
xhr.open("post", url, true);
xhr.onload = function () {
var result = xhr.responseText;
var json = eval("(" + result + ")");
switch (json.code) {
case 1:
// var path=cdn+;
send(json.imgkey,2002);
$("#img").val('');
break;
default:
system(json.msg);
$("#img").val('');
break;
}
if(xhr.status==200){
var result = xhr.responseText;
var json = eval("(" + result + ")");
switch (json.code) {
case 1:
// var path=cdn+;
send(json.imgkey,2002);
$("#img").val('');
break;
default:
system(json.msg);
$("#img").val('');
break;
}
}else{
system(xhr.status);
tips("上传发生错误"+xhr.status,"error",3000);
}
};
xhr.onerror = function(e) {
tips("上传发生错误"+e,"error",3000);
};
xhr.send(formdata);
}
......
......@@ -287,7 +287,11 @@
});
function params(){
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('cid','wechat');
// map.set('gzh','naicha');
......@@ -626,20 +630,28 @@
xhr.upload.addEventListener("progress", uploadProgress, false);
xhr.open("post", url, true);
xhr.onload = function () {
var result = xhr.responseText;
var json = eval("(" + result + ")");
switch (json.code) {
case 1:
// var path=cdn+;
send(json.imgkey,2002);
$("#img").val('');
break;
default:
system(json.msg);
$("#img").val('');
break;
}
if(xhr.status==200){
var result = xhr.responseText;
var json = eval("(" + result + ")");
switch (json.code) {
case 1:
// var path=cdn+;
send(json.imgkey,2002);
$("#img").val('');
break;
default:
system(json.msg);
$("#img").val('');
break;
}
}else{
system(xhr.status);
tips("上传发生错误"+xhr.status,"error",3000);
}
};
xhr.onerror = function(e) {
tips("上传发生错误"+e,"error",3000);
};
xhr.send(formdata);
}
......
......@@ -287,10 +287,15 @@
});
function params(){
// 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('cid','wechat');
map.set('gzh','naicha');
map.set('gzh','guodong');
// if (url.indexOf("?") != -1) {
// var p = url.substr(1);
// keys = p.split("&");
......@@ -627,20 +632,28 @@
xhr.upload.addEventListener("progress", uploadProgress, false);
xhr.open("post", url, true);
xhr.onload = function () {
var result = xhr.responseText;
var json = eval("(" + result + ")");
switch (json.code) {
case 1:
// var path=cdn+;
send(json.imgkey,2002);
$("#img").val('');
break;
default:
system(json.msg);
$("#img").val('');
break;
}
if(xhr.status==200){
var result = xhr.responseText;
var json = eval("(" + result + ")");
switch (json.code) {
case 1:
// var path=cdn+;
send(json.imgkey,2002);
$("#img").val('');
break;
default:
system(json.msg);
$("#img").val('');
break;
}
}else{
system(xhr.status);
tips("上传发生错误"+xhr.status,"error",3000);
}
};
xhr.onerror = function(e) {
tips("上传发生错误"+e,"error",3000);
};
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