信呼OA版本v2.3.8
This commit is contained in:
33
js/anayrun.js
Normal file
33
js/anayrun.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 异步通信处理
|
||||
*/
|
||||
var anayrun = {
|
||||
init:function(){
|
||||
|
||||
},
|
||||
send:function(url,cans){
|
||||
var lx = (url.indexOf('?')<0) ? '?' : '&';
|
||||
url+=''+lx+'rnd='+js.getrand()+'';
|
||||
if(!cans)cans={};
|
||||
for(var i in cans)url+='&'+i+'='+cans[i]+'';
|
||||
$.ajax({
|
||||
url:url,
|
||||
type:'get',
|
||||
success:function(str){
|
||||
if(str!='success'){
|
||||
anayrun.senderror(str, url);
|
||||
}
|
||||
},
|
||||
error:function(e){
|
||||
anayrun.senderror(e.responseText, url);
|
||||
}
|
||||
});
|
||||
},
|
||||
senderror:function(str, url){
|
||||
notifyobj.show({
|
||||
title:'JS异步处理',
|
||||
type:'error',
|
||||
body:'地址:'+url+',处理出错:'+str+''
|
||||
});
|
||||
}
|
||||
};
|
||||
8
js/base64-min.js
vendored
Normal file
8
js/base64-min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* Copyright (c) 2016 rainrock
|
||||
* Date:2016-01-01
|
||||
*/
|
||||
function Jiami(){var c,d,e,f,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b="abcdefghijklmnopqrstuvwxyz";this.setJmstr=function(a){var e,c={"?":"v",'"':"s","[":"p","^":"g",_:"l","(":"j","-":"x",")":"k","+":"m","~":"a",":":"w",$:"e","{":"n","&":"h","<":"t","}":"o","@":"c",".":"z","#":"d","%":"f","!":"b","]":"q","*":"i",";":"r","=":"y",">":"u"},d=a.length,f="";for(e=0;d>e;e++)f+=c[a.substr(e,1)];return b=f,f},this.base64encode=function(b){var c,d,f,g,h,i,j,k,l,m;if(""==b||null==b)return"";for(c="",m=0,b=e(b);m<b.length;)d=b.charCodeAt(m++),f=b.charCodeAt(m++),g=b.charCodeAt(m++),h=d>>2,i=(3&d)<<4|f>>4,j=(15&f)<<2|g>>6,k=63&g,isNaN(f)?j=k=64:isNaN(g)&&(k=64),c=c+a.charAt(h)+a.charAt(i)+a.charAt(j)+a.charAt(k);return l=c,l=l.replace(/\+/g,"!"),l=l.replace(/\//g,"."),l=l.replace(/\=/g,":")},this.encrypt=function(a,b){if(!a)return"";var d=this.base64encode(a);return d=c(d,b)},this.uncrypt=function(a,b){if(!a)return"";var c=d(a,b);return c=this.base64decode(c)},c=function(a,c){var g,h,j,d="",e="",f=a.length,i=b,k=parseInt(14*Math.random())+1;for(c&&26==c.length&&(i=c),10==k&&k++,g=0;f>g;g++)for(e=a.charCodeAt(g).toString(),d+="0",h=0;h<e.length;h++)j=parseInt(e.substr(h,1))+k,d+=i.substr(j,1);return""!=d&&(d=d.substr(1),d+="0"+k),d},d=function(a,c){a=a.replace(/[^a-z0-9]/g,"");var f,g,j,k,l,m,n,d="",e="",h=b,i={};for(c&&26==c.length&&(h=c),j=0;j<h.length;j++)i[h.substr(j,1)]=j;for(l=a.split("0"),n=l.length,m=parseInt(l[n-1]),j=0;n-1>j;j++){for(e=l[j],f="",k=0;k<e.length;k++)g=parseInt(i[e.substr(k,1)])-m,f+=g.toString();f=parseInt(f),d+=String.fromCharCode(f).toString()}return d},this.base64decode=function(b){var c,d,e,g,h,i,j,k,l;if(""==b||null==b)return"";for(c="",l=0,b=b.replace(/\!/g,"+"),b=b.replace(/\./g,"/"),b=b.replace(/\:/g,"="),b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<b.length;)h=a.indexOf(b.charAt(l++)),i=a.indexOf(b.charAt(l++)),j=a.indexOf(b.charAt(l++)),k=a.indexOf(b.charAt(l++)),d=h<<2|i>>4,e=(15&i)<<4|j>>2,g=(3&j)<<6|k,c+=String.fromCharCode(d),64!=j&&(c+=String.fromCharCode(e)),64!=k&&(c+=String.fromCharCode(g));return c=f(c)},e=function(a){var b,c,d;for(a=a.replace(/\r\n/g,"\n"),b="",c=0;c<a.length;c++)d=a.charCodeAt(c),128>d?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(192|d>>6),b+=String.fromCharCode(128|63&d)):(b+=String.fromCharCode(224|d>>12),b+=String.fromCharCode(128|63&d>>6),b+=String.fromCharCode(128|63&d));return b},f=function(a){for(var b="",c=0,d=c1=c2=0;c<a.length;)d=a.charCodeAt(c),128>d?(b+=String.fromCharCode(d),c++):d>191&&224>d?(c2=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&c2),c+=2):(c2=a.charCodeAt(c+1),c3=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&c2)<<6|63&c3),c+=3);return b}}var jm=new Jiami;
|
||||
!function(n){"use strict";function t(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function r(n,t){return n<<t|n>>>32-t}function e(n,e,o,u,c,f){return t(r(t(t(e,n),t(u,f)),c),o)}function o(n,t,r,o,u,c,f){return e(t&r|~t&o,n,t,u,c,f)}function u(n,t,r,o,u,c,f){return e(t&o|r&~o,n,t,u,c,f)}function c(n,t,r,o,u,c,f){return e(t^r^o,n,t,u,c,f)}function f(n,t,r,o,u,c,f){return e(r^(t|~o),n,t,u,c,f)}function i(n,r){n[r>>5]|=128<<r%32,n[14+(r+64>>>9<<4)]=r;var e,i,a,d,h,l=1732584193,g=-271733879,v=-1732584194,m=271733878;for(e=0;e<n.length;e+=16)i=l,a=g,d=v,h=m,g=f(g=f(g=f(g=f(g=c(g=c(g=c(g=c(g=u(g=u(g=u(g=u(g=o(g=o(g=o(g=o(g,v=o(v,m=o(m,l=o(l,g,v,m,n[e],7,-680876936),g,v,n[e+1],12,-389564586),l,g,n[e+2],17,606105819),m,l,n[e+3],22,-1044525330),v=o(v,m=o(m,l=o(l,g,v,m,n[e+4],7,-176418897),g,v,n[e+5],12,1200080426),l,g,n[e+6],17,-1473231341),m,l,n[e+7],22,-45705983),v=o(v,m=o(m,l=o(l,g,v,m,n[e+8],7,1770035416),g,v,n[e+9],12,-1958414417),l,g,n[e+10],17,-42063),m,l,n[e+11],22,-1990404162),v=o(v,m=o(m,l=o(l,g,v,m,n[e+12],7,1804603682),g,v,n[e+13],12,-40341101),l,g,n[e+14],17,-1502002290),m,l,n[e+15],22,1236535329),v=u(v,m=u(m,l=u(l,g,v,m,n[e+1],5,-165796510),g,v,n[e+6],9,-1069501632),l,g,n[e+11],14,643717713),m,l,n[e],20,-373897302),v=u(v,m=u(m,l=u(l,g,v,m,n[e+5],5,-701558691),g,v,n[e+10],9,38016083),l,g,n[e+15],14,-660478335),m,l,n[e+4],20,-405537848),v=u(v,m=u(m,l=u(l,g,v,m,n[e+9],5,568446438),g,v,n[e+14],9,-1019803690),l,g,n[e+3],14,-187363961),m,l,n[e+8],20,1163531501),v=u(v,m=u(m,l=u(l,g,v,m,n[e+13],5,-1444681467),g,v,n[e+2],9,-51403784),l,g,n[e+7],14,1735328473),m,l,n[e+12],20,-1926607734),v=c(v,m=c(m,l=c(l,g,v,m,n[e+5],4,-378558),g,v,n[e+8],11,-2022574463),l,g,n[e+11],16,1839030562),m,l,n[e+14],23,-35309556),v=c(v,m=c(m,l=c(l,g,v,m,n[e+1],4,-1530992060),g,v,n[e+4],11,1272893353),l,g,n[e+7],16,-155497632),m,l,n[e+10],23,-1094730640),v=c(v,m=c(m,l=c(l,g,v,m,n[e+13],4,681279174),g,v,n[e],11,-358537222),l,g,n[e+3],16,-722521979),m,l,n[e+6],23,76029189),v=c(v,m=c(m,l=c(l,g,v,m,n[e+9],4,-640364487),g,v,n[e+12],11,-421815835),l,g,n[e+15],16,530742520),m,l,n[e+2],23,-995338651),v=f(v,m=f(m,l=f(l,g,v,m,n[e],6,-198630844),g,v,n[e+7],10,1126891415),l,g,n[e+14],15,-1416354905),m,l,n[e+5],21,-57434055),v=f(v,m=f(m,l=f(l,g,v,m,n[e+12],6,1700485571),g,v,n[e+3],10,-1894986606),l,g,n[e+10],15,-1051523),m,l,n[e+1],21,-2054922799),v=f(v,m=f(m,l=f(l,g,v,m,n[e+8],6,1873313359),g,v,n[e+15],10,-30611744),l,g,n[e+6],15,-1560198380),m,l,n[e+13],21,1309151649),v=f(v,m=f(m,l=f(l,g,v,m,n[e+4],6,-145523070),g,v,n[e+11],10,-1120210379),l,g,n[e+2],15,718787259),m,l,n[e+9],21,-343485551),l=t(l,i),g=t(g,a),v=t(v,d),m=t(m,h);return[l,g,v,m]}function a(n){var t,r="",e=32*n.length;for(t=0;t<e;t+=8)r+=String.fromCharCode(n[t>>5]>>>t%32&255);return r}function d(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var e=8*n.length;for(t=0;t<e;t+=8)r[t>>5]|=(255&n.charCodeAt(t/8))<<t%32;return r}function h(n){return a(i(d(n),8*n.length))}function l(n,t){var r,e,o=d(n),u=[],c=[];for(u[15]=c[15]=void 0,o.length>16&&(o=i(o,8*n.length)),r=0;r<16;r+=1)u[r]=909522486^o[r],c[r]=1549556828^o[r];return e=i(u.concat(d(t)),512+8*t.length),a(i(c.concat(e),640))}function g(n){var t,r,e="";for(r=0;r<n.length;r+=1)t=n.charCodeAt(r),e+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return e}function v(n){return unescape(encodeURIComponent(n))}function m(n){return h(v(n))}function p(n){return g(m(n))}function s(n,t){return l(v(n),v(t))}function C(n,t){return g(s(n,t))}function A(n,t,r){return t?r?s(t,n):C(t,n):r?m(n):p(n)}"function"==typeof define&&define.amd?define(function(){return A}):"object"==typeof module&&module.exports?module.exports=A:n.md5=A}(this);
|
||||
290
js/dingwei.js
Normal file
290
js/dingwei.js
Normal file
@@ -0,0 +1,290 @@
|
||||
/**
|
||||
* 定位文件
|
||||
* 创建人:雨中磐石(rainrock)
|
||||
*/
|
||||
|
||||
//jssdk回调过来的
|
||||
js.jssdkcall = function(bo){
|
||||
js.dw.start();//开始定位
|
||||
}
|
||||
var openfrom = '';
|
||||
function initApp(){
|
||||
js.dw.start();
|
||||
}
|
||||
js.dw = {
|
||||
|
||||
//开始定位
|
||||
init:function(isgzh){
|
||||
var dws = navigator.userAgent;
|
||||
if(dws.indexOf('REIMPLAT')>0)return;
|
||||
if(openfrom=='nppandroid' || openfrom=='nppios')return;
|
||||
if(isgzh==1){
|
||||
js.jssdkwxgzh();
|
||||
}else{
|
||||
js.jssdkwixin();
|
||||
}
|
||||
},
|
||||
|
||||
dwbool:false,
|
||||
dwtimeer:false,
|
||||
ondwcall:function(){},
|
||||
ondwstart:function(){},
|
||||
ondwerr:function(){},
|
||||
ondwwait:function(){return false},
|
||||
|
||||
start:function(){
|
||||
if(this.dwbool)return;
|
||||
this.dwbool = true;
|
||||
this.chaoshi();
|
||||
this.ondwstart(js.jssdkstate);
|
||||
if(js.jssdkstate != 1){
|
||||
this.htmldingw(0);
|
||||
}else{
|
||||
this.wxdingw();
|
||||
}
|
||||
},
|
||||
|
||||
//定位等待
|
||||
wait:function(msg){
|
||||
var bo = this.ondwwait(msg);
|
||||
if(!bo)js.msg('wait',msg);
|
||||
},
|
||||
|
||||
chaoshi:function(){
|
||||
clearTimeout(this.dwtimeer);
|
||||
this.dwtimeer = setTimeout(function(){
|
||||
var msg = '定位超时,请重新定位';
|
||||
js.msg('msg', msg);
|
||||
js.dw.ondwerr(msg);
|
||||
js.jssdkstate = 2;
|
||||
js.dw.dwbool=false;
|
||||
},20*1000);
|
||||
},
|
||||
clearchao:function(){
|
||||
clearTimeout(this.dwtimeer);
|
||||
this.dwbool = false;
|
||||
},
|
||||
|
||||
//html5定位
|
||||
htmldingw:function(lx){
|
||||
var msg;
|
||||
if(appobj1('startLocation','appbacklocation')){
|
||||
this.wait('原生app定位中...');
|
||||
return;
|
||||
}
|
||||
|
||||
if(api.startLocation){
|
||||
js.msg();
|
||||
if(api.systemType=='ios'){
|
||||
this.wait(''+api.systemType+'APP定位中...');
|
||||
api.startLocation({},function(ret,err){
|
||||
js.dw.appLocationSuc(ret,err);
|
||||
});
|
||||
return;
|
||||
}else if(lx==0){
|
||||
this.wait(''+api.systemType+'百度地图定位中...');
|
||||
if(!this.baiduLocation)this.baiduLocation = api.require('baiduLocation');
|
||||
if(this.baiduLocation){
|
||||
this.baiduLocation.startLocation({
|
||||
autoStop: false
|
||||
}, function(ret, err) {
|
||||
js.dw.baiduLocationSuc(ret,err);
|
||||
});
|
||||
}else{
|
||||
if(!this.bmLocation)this.bmLocation = api.require('bmLocation');
|
||||
if(this.bmLocation){
|
||||
this.bmLocation.configManager({
|
||||
coordinateType:'BMK09LL',accuracy:'hight_accuracy'
|
||||
});
|
||||
this.bmLocation.singleLocation({reGeocode:false},function(ret,err){
|
||||
var dtes = {};
|
||||
dtes.status = ret.status;
|
||||
if(ret.status){
|
||||
dtes.longitude = ret.location.longitude;
|
||||
dtes.latitude = ret.location.latitude;
|
||||
}
|
||||
js.dw.baiduLocationSuc(dtes,err);
|
||||
});
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(!navigator.geolocation){
|
||||
msg = '不支持浏览器定位';
|
||||
js.msg('msg',msg);
|
||||
this.clearchao();
|
||||
js.dw.ondwerr(msg);
|
||||
}else{
|
||||
this.wait('浏览器定位中...');
|
||||
navigator.geolocation.getCurrentPosition(this.showPosition,this.showError,{
|
||||
enableHighAccuracy: true,
|
||||
timeout: 19000,
|
||||
maximumAge: 3000
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
//微信定位
|
||||
wxdingw:function(){
|
||||
var msg = '微信定位中...';
|
||||
if(js.isqywx)msg='企业微信定位中...';
|
||||
this.wait(msg);
|
||||
wx.getLocation({
|
||||
type: 'gcj02',
|
||||
success: function (res,err){
|
||||
js.dw.dwsuccess(res,err);
|
||||
},
|
||||
error:function(){
|
||||
js.jssdkstate = 2;
|
||||
js.dw.dwbool=false;
|
||||
js.dw.start();
|
||||
}
|
||||
});
|
||||
},
|
||||
appLocationSuc:function(ret,err){
|
||||
if(ret.status){
|
||||
if(!ret.accuracy)ret.accuracy = 200;
|
||||
this.dwsuccess(ret);
|
||||
}else{
|
||||
this.dwshibai(err.msg);
|
||||
}
|
||||
},
|
||||
|
||||
baiduLocationSuc:function(ret,err){
|
||||
if(ret.status && ret.latitude){
|
||||
this.wait('定位成功,获取位置信息...');
|
||||
if(!ret.accuracy)ret.accuracy = 200;
|
||||
var center = new qq.maps.LatLng(ret.latitude,ret.longitude);
|
||||
this.translate(center, ret.accuracy, 3);
|
||||
}else{
|
||||
this.dwshibai('定位失败,检查是否给APP开定位权限');
|
||||
}
|
||||
},
|
||||
dwshibai:function(msg){
|
||||
this.clearchao();
|
||||
js.setmsg('');
|
||||
js.msg('msg', msg);
|
||||
this.ondwerr(msg);
|
||||
},
|
||||
dwsuccess:function(res){
|
||||
this.wait('定位成功,获取位置信息...');
|
||||
this.clearchao();
|
||||
var lat = parseFloat(res.latitude); // 纬度,浮点数,范围为90 ~ -90
|
||||
var lng = parseFloat(res.longitude); // 经度,浮点数,范围为180 ~ -180。
|
||||
var jid = parseFloat(res.accuracy); // 位置精度
|
||||
this.geocoder(lat,lng, jid);
|
||||
},
|
||||
|
||||
showError:function (error){
|
||||
js.dw.clearchao();
|
||||
js.setmsg('');
|
||||
var msg='无法定位';
|
||||
switch(error.code){
|
||||
case error.PERMISSION_DENIED:
|
||||
msg="用户拒绝对获取地理位置的请求。"
|
||||
break;
|
||||
case error.POSITION_UNAVAILABLE:
|
||||
msg="位置信息是不可用的。"
|
||||
break;
|
||||
case error.TIMEOUT:
|
||||
msg="请求用户地理位置超时。"
|
||||
break;
|
||||
case error.UNKNOWN_ERROR:
|
||||
msg="未知错误。"
|
||||
break;
|
||||
}
|
||||
if(NOWURL.substr(0,5)!='https')msg+='必须使用https访问';
|
||||
js.msg('msg', msg);
|
||||
js.dw.ondwerr(msg);
|
||||
},
|
||||
|
||||
showPosition:function(position){
|
||||
var res = position.coords;
|
||||
var latitude = res.latitude;
|
||||
var longitude = res.longitude;
|
||||
var accuracy = parseFloat(res.accuracy);
|
||||
var center = new qq.maps.LatLng(parseFloat(latitude), parseFloat(longitude));
|
||||
js.dw.translate(center, accuracy, 1);
|
||||
},
|
||||
|
||||
//坐标转化type1原始
|
||||
translate:function(center, accuracy, type){
|
||||
qq.maps.convertor.translate(center,type,function(res){
|
||||
var latitude = res[0].lat;
|
||||
var longitude = res[0].lng;
|
||||
if(latitude==0 || latitude==0){
|
||||
js.dw.dwshibai('无法获取位置信息失败');
|
||||
}else{
|
||||
js.dw.dwsuccess({
|
||||
latitude:latitude,
|
||||
longitude:longitude,
|
||||
accuracy:accuracy
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//搜索位置
|
||||
geocoder:function(lat,lng, jid){
|
||||
if(!this.geocoderObj)this.geocoderObj = new qq.maps.Geocoder();
|
||||
var center = new qq.maps.LatLng(lat, lng);
|
||||
this.geocoderObj.getAddress(center);
|
||||
this.geocoderObj.setComplete(function(result){
|
||||
var address = result.detail.address;
|
||||
var dzarr = result.detail.addressComponents;
|
||||
//address = ''+dzarr.province+''+dzarr.city+''+dzarr.district+''+dzarr.street+'';
|
||||
//if(dzarr.streetnumber)address+=dzarr.streetnumber;
|
||||
|
||||
//范围内地址
|
||||
var near = result.detail.nearPois,dist = 500,naddress,addressinfo;
|
||||
for(var i=0;i<near.length;i++){
|
||||
if(near[i].dist<dist){
|
||||
dist = near[i].dist;
|
||||
naddress = ''+near[i].name+'('+near[i].address+')';
|
||||
}
|
||||
}
|
||||
if(dist<500)address = naddress;
|
||||
addressinfo = ''+address;
|
||||
if(jid>0)addressinfo+='(精确'+jid+'米)';
|
||||
js.msg();
|
||||
js.dw.ondwcall({
|
||||
latitude:lat,
|
||||
longitude:lng,
|
||||
accuracy:jid,
|
||||
address:address,
|
||||
addressinfo:addressinfo,
|
||||
detail:result.detail,
|
||||
center:center
|
||||
});
|
||||
});
|
||||
|
||||
this.geocoderObj.setError(function() {
|
||||
//var msg = '无法获取位置';js.msg('msg', msg);js.dw.ondwerr(msg);
|
||||
js.msg();
|
||||
js.dw.ondwcall({
|
||||
latitude:lat,
|
||||
longitude:lng,
|
||||
accuracy:jid,
|
||||
address:'未知位置',
|
||||
addressinfo:'定位成功未知位置',
|
||||
detail:'未知位置',
|
||||
center:center
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//原生app定位中
|
||||
appbacklocation=function(res){
|
||||
var latitude = res.latitude;
|
||||
var longitude = res.longitude;
|
||||
var accuracy = parseFloat(res.accuracy);
|
||||
js.dw.dwsuccess({
|
||||
latitude:latitude,
|
||||
longitude:longitude,
|
||||
accuracy:accuracy
|
||||
});
|
||||
}
|
||||
11
js/jquery.js
vendored
Normal file
11
js/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
84
js/jsalert.js
Normal file
84
js/jsalert.js
Normal file
@@ -0,0 +1,84 @@
|
||||
js.tanbody=function(act,title,w,h,can1){
|
||||
var H = (document.body.scrollHeight<winHb())?winHb()-5:document.body.scrollHeight;
|
||||
var W = document.documentElement.scrollWidth+document.body.scrollLeft;
|
||||
if(!this.tanbodyindex)this.tanbodyindex=80;
|
||||
this.tanbodyindex++;
|
||||
var l=(winWb()-w)*0.5,t=(winHb()-h-20)*0.5;
|
||||
var s = '',mid = ''+act+'_main',i,d;
|
||||
var can = js.applyIf(can1,{html:'',btn:[]});
|
||||
if(w>winWb())w=winWb()-50;
|
||||
var s = '<div id="'+mid+'" style="position:fixed;background-color:#ffffff;left:'+l+'px;width:'+w+'px;top:'+t+'px;box-shadow:0px 0px 10px rgba(0,0,0,0.3);border-radius:5px">';
|
||||
s+=' <div style="-moz-user-select:none;-webkit-user-select:none;user-select:none;border-bottom:1px #eeeeee solid">';
|
||||
s+=' <table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>';
|
||||
s+=' <td height="50" style="font-size:16px; font-weight:bold;color:#000000; padding-left:10px" width="100%" onmousedown="js.move(\''+mid+'\')" id="'+act+'_title">'+title+'</td>';
|
||||
s+=' <td><div id="'+act+'_spancancel1" style="padding:0px 8px;height:50px;line-height:45px;overflow:hidden;cursor:pointer;color:gray;" onclick="js.tanclose(\''+act+'\')">✖</div></td>';
|
||||
s+=' </tr></table>';
|
||||
s+=' </div>';
|
||||
s+=' <div id="'+act+'_content" style="height">'+can.html+'</div>';
|
||||
s+=' <div id="'+act+'_bbar" style="height:60px;overflow:hidden;line-height:60px;padding:0px 10px;background:#f1f1f1;border-radius:0px 0px 5px 5px" align="right"> <span id="msgview_'+act+'"></span>';
|
||||
for(i=0; i<can.btn.length; i++){
|
||||
d = can.btn[i];
|
||||
if(!d.bgcolor)d.bgcolor='';
|
||||
s+='<button type="button" oi="'+i+'" style="border-radius:5px;padding:8px 15px;margin-left:10px;background:'+d.bgcolor+'" id="'+act+'_btn'+i+'" class="webbtn">'+d.text+'</button>';
|
||||
}
|
||||
s+=' <button type="button" id="'+act+'_spancancel" onclick="js.tanclose(\''+act+'\')" style="border-radius:5px;padding:8px 15px;background:gray;margin-left:10px" class="webbtn">取消</button>';
|
||||
s+=' ';
|
||||
s+=' </div>';
|
||||
s+='</div>';
|
||||
var str = '<div id="amain_'+act+'" oncontextmenu="return false" style="position:absolute;height:'+H+'px;width:'+W+'px;background:rgba(0,0,0,0.3);z-index:'+this.tanbodyindex+';left:0px;top:0px">'+s+'</div>';
|
||||
$('body').append(str);
|
||||
if(can.closed=='none'){
|
||||
$('#'+act+'_spancancel').remove();
|
||||
$('#'+act+'_spancancel1').remove();
|
||||
}
|
||||
if(can.bbar=='none'){
|
||||
var o1d = $('#'+act+'_bbar');
|
||||
o1d.html('');
|
||||
o1d.css({'height':'5px','background':'white'});
|
||||
}
|
||||
this.resizetan(act);
|
||||
}
|
||||
js.alert=function(msg,tit,fun,slx){
|
||||
if(!tit)tit='系统提示';
|
||||
var btn=[{text:'确定'}],act = 'alert';
|
||||
if(get(''+act+'_main'))act=''+act+''+this.getrand()+'';
|
||||
if(slx)btn.push({text:'取消',bgcolor:'gray'});
|
||||
this.tanbody(act,tit,400,300,{closed:'none',html:'<div style="padding:20px">'+msg+'</div>',btn:btn});
|
||||
$('#'+act+'_btn0').click(function(){
|
||||
var val = $('#rockpromptinput').val(),fbo=true;
|
||||
if(fun)fbo=fun('yes', val, act);
|
||||
if(fbo!==false)js.tanclose(act);
|
||||
});
|
||||
$('#'+act+'_btn1').click(function(){
|
||||
var val = $('#rockpromptinput').val();
|
||||
js.tanclose(act);
|
||||
if(fun)fun('no', val, act);
|
||||
});
|
||||
$('#'+act+'_spancancel1').remove();
|
||||
}
|
||||
js.alertclose=function(){
|
||||
this.tanclose('alert');
|
||||
}
|
||||
js.confirm=function(msg,fun,tit){
|
||||
js.alert(msg,fun,tit,1);
|
||||
}
|
||||
js.prompt=function(tit,msg,fun, txt,lxs){
|
||||
if(!txt)txt='';
|
||||
var msg1 = '<div>'+msg+'</div><div style="margin-top:5px">';
|
||||
if(!lxs)msg1 +='<input id="rockpromptinput" autocomplete="off" class="input" style="width:95%;border-radius:5px" value="'+txt+'" type="input">';
|
||||
if(lxs)msg1 +='<textarea id="rockpromptinput" autocomplete="off" class="input" style="width:95%;border-radius:5px;height:80px" type="input">'+txt+'</textarea>';
|
||||
msg1 += '</div>'
|
||||
js.alert(msg1,fun,tit,2);
|
||||
setTimeout("get('rockpromptinput').focus()",100);
|
||||
}
|
||||
js.resizetan=function(act){
|
||||
var mid = ''+act+'_main';
|
||||
var o1 = $('#'+mid+'');
|
||||
var h1 = o1.height();
|
||||
var w1 = o1.width();
|
||||
var l=(winWb()-w1)*0.5,t=(winHb()-h1-10)*0.5;if(t<0)t=5;
|
||||
o1.css({'left':''+l+'px','top':''+t+'px'});
|
||||
}
|
||||
js.tanclose=function(act){
|
||||
$('#amain_'+act+'').remove();
|
||||
}
|
||||
48
js/jsdd.js
Normal file
48
js/jsdd.js
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 钉钉jssdk授权
|
||||
*/
|
||||
js.jssdkddcall = function(bo){
|
||||
|
||||
}
|
||||
js.jssdkstate = 0;
|
||||
js.ddjsimport = function(funs){
|
||||
var wxurl = 'https://g.alicdn.com/dingding/open-develop/1.5.1/dingtalk.js';
|
||||
if(!funs)funs=function(){};
|
||||
$.getScript(wxurl,function(){
|
||||
funs();
|
||||
});
|
||||
}
|
||||
|
||||
//鉴权
|
||||
js.jssdkdingding = function(qxlist,afe){
|
||||
if(!afe)js.ddjsimport(function(){
|
||||
js.jssdkdingding(qxlist, true);
|
||||
});
|
||||
if(!afe)return;
|
||||
var surl= location.href;
|
||||
if(!qxlist)qxlist= ['runtime.info','device.geolocation.get','biz.util.open','biz.user.get','biz.contact.choose','biz.telephone.call','biz.ding.post'];
|
||||
var agentid=js.request('agentid');
|
||||
$.getJSON('api.php?m=login&a=ddsign&url='+jm.base64encode(surl)+'&agentid='+agentid+'',function(ret){
|
||||
ret = ret.data;//js.getarr(ret);
|
||||
if(ret.corpId==''|| !ret)return js.jssdkddcall(false);;
|
||||
js.ddcorpId = ret.corpId;
|
||||
js.ddqiyeid = ret.qiyeid;
|
||||
dd.config({
|
||||
agentId: ret.agentId,
|
||||
corpId: ret.corpId,
|
||||
timeStamp:ret.timestamp,
|
||||
nonceStr: ret.nonceStr,
|
||||
signature: ret.signature,
|
||||
jsApiList:qxlist
|
||||
});
|
||||
dd.ready(function(){
|
||||
if(js.jssdkstate==0)js.jssdkstate = 1;
|
||||
js.jssdkddcall(true);
|
||||
});
|
||||
dd.error(function(err){
|
||||
alert('dd error: ' + JSON.stringify(err));
|
||||
js.jssdkstate = 2;
|
||||
js.jssdkddcall(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
303
js/jsm.js
Normal file
303
js/jsm.js
Normal file
@@ -0,0 +1,303 @@
|
||||
var adminid='0',apiurl='',QOM='xinhu_',token='',adminname='',userinfo={},adminface='images/noface.png';
|
||||
var get=function(id){return document.getElementById(id)};
|
||||
var isempt=function(an){var ob = false;if(an==''||an==null||typeof(an)=='undefined'){ob=true;}return ob;}
|
||||
var form=function(an,fna){if(!fna)fna='myform';return document[fna][an]}
|
||||
var xy10=function(s){var s1=''+s+'';if(s1.length<2)s1='0'+s+'';return s1;};
|
||||
var isIE=true;
|
||||
if(!document.all)isIE=false;
|
||||
var js={};
|
||||
js.getarr=function(caa,bo){
|
||||
var s='';
|
||||
for(var a in caa)s+=' @@ '+a+'=>'+caa[a]+'';
|
||||
if(!bo)alert(s);
|
||||
return s;
|
||||
}
|
||||
function initbody(){}
|
||||
$(document).ready(function(){
|
||||
adminid=js.request('adminid');
|
||||
token=js.request('token');
|
||||
initbody();
|
||||
});
|
||||
if(typeof(api)=='undefined'){
|
||||
var api={};
|
||||
api.systemType='android';
|
||||
api.deviceId='';
|
||||
}
|
||||
js.getrand=function(){
|
||||
var r;
|
||||
r = ''+new Date().getTime()+'';
|
||||
r+='_'+parseInt(Math.random()*9999)+'';
|
||||
return r;
|
||||
}
|
||||
function winHb(){
|
||||
var winH=(!isIE)?window.innerHeight:document.documentElement.offsetHeight;
|
||||
return winH;
|
||||
}
|
||||
function winWb(){
|
||||
var winH=(!isIE)?window.innerWidth:document.documentElement.offsetWidth;
|
||||
return winH;
|
||||
}
|
||||
js.open=function(url,w,h,can){
|
||||
var ja=(url.indexOf('?')>=0)?'&':'?';
|
||||
if(!w)w=600;
|
||||
if(!h)h=500;
|
||||
if(!can)can='resizable=yes,scrollbars=yes';
|
||||
var l=(screen.width-w)*0.5;
|
||||
var t=(screen.height-h)*0.5;
|
||||
window.open(url,'','width='+w+'px,height='+h+'px,left='+l+'px,top='+t+'px,'+can+'');
|
||||
}
|
||||
js.request=function(name,url){
|
||||
if(!name)return '';
|
||||
if(!url)url=location.href;
|
||||
if(url.indexOf('\?')<0)return '';
|
||||
neurl=url.split('\?')[1];
|
||||
neurl=neurl.split('&');
|
||||
var value=''
|
||||
for(i=0;i<neurl.length;i++){
|
||||
val=neurl[i].split('=');
|
||||
if(val[0].toLowerCase()==name.toLowerCase()){
|
||||
value=val[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!value)value='';
|
||||
return value;
|
||||
}
|
||||
js.getajaxurl=function(a,m,d,can){
|
||||
if(!can)can={};
|
||||
if(!m)m='';
|
||||
if(!d)d='';
|
||||
if(d=='null')d='';
|
||||
var jga = a.substr(0,1);
|
||||
if(jga=='@')a = a.substr(1);
|
||||
var url = 'index.php?a='+a+'&m='+m+'&d='+d+'';
|
||||
for(var c in can)url+='&'+c+'='+can[c]+'';
|
||||
if(jga!='@')url+='&ajaxbool=true';
|
||||
url+='&rnd='+Math.random()+'';
|
||||
return url;
|
||||
}
|
||||
js.formatsize=function(size){
|
||||
var arr = new Array('Byte', 'KB', 'MB', 'GB', 'TB', 'PB');
|
||||
var e = Math.floor(Math.log(size)/Math.log(1024));
|
||||
var fs = size/Math.pow(1024,Math.floor(e));
|
||||
return js.float(fs)+' '+arr[e];
|
||||
}
|
||||
js.now=function(type,sj){
|
||||
if(!type)type='Y-m-d';
|
||||
if(type=='now')type='Y-m-d H:i:s';
|
||||
var dt,ymd,his,weekArr,Y,m,d,w,H=0,i=0,s=0,W;
|
||||
if(typeof(sj)=='string')sj=sj.replace(/\//gi,'-');
|
||||
if(/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}/.test(sj)){
|
||||
sj=sj.split(' ');
|
||||
ymd=sj[0];
|
||||
his=sj[1];if(!his)his='00:00:00';
|
||||
ymd=ymd.split('-');
|
||||
his=his.split(':');
|
||||
H = his[0];if(his.length>1)i = his[1];if(his.length>2)s = his[2];
|
||||
dt=new Date(ymd[0],ymd[1]-1,ymd[2],H,i,s);
|
||||
}else{
|
||||
dt=(typeof(sj)=='number')?new Date(sj):new Date();
|
||||
}
|
||||
weekArr=new Array('日','一','二','三','四','五','六');
|
||||
Y=dt.getFullYear();
|
||||
m=xy10(dt.getMonth()+1);
|
||||
d=xy10(dt.getDate());
|
||||
w=dt.getDay();
|
||||
H=xy10(dt.getHours());
|
||||
i=xy10(dt.getMinutes());
|
||||
s=xy10(dt.getSeconds());
|
||||
W=weekArr[w];
|
||||
if(type=='time'){
|
||||
return dt.getTime();
|
||||
}else{
|
||||
return type.replace('Y',Y).replace('m',m).replace('d',d).replace('H',H).replace('i',i).replace('s',s).replace('w',w).replace('W',W);
|
||||
}
|
||||
}
|
||||
js.float=function(num,w){
|
||||
if(isNaN(num)||num==''||!num||num==null)num='0';
|
||||
num=parseFloat(num);
|
||||
if(!w&&w!=0)w=2;
|
||||
var m=num.toFixed(w);
|
||||
return m;
|
||||
}
|
||||
|
||||
js.getformdata=function(na){
|
||||
var da ={};
|
||||
if(!na)na='myform';
|
||||
var obj = document[na];
|
||||
for(var i=0;i<obj.length;i++){
|
||||
var type = obj[i].type;
|
||||
var val = obj[i].value;
|
||||
if(type=='checkbox'){
|
||||
val = '0';
|
||||
if(obj[i].checked)val='1';
|
||||
}
|
||||
da[obj[i].name] = val;
|
||||
}
|
||||
return da;
|
||||
}
|
||||
|
||||
js.setoption=function(k,v){
|
||||
k=QOM+k;
|
||||
try{
|
||||
if(isempt(v)){
|
||||
localStorage.removeItem(k);
|
||||
}else{
|
||||
localStorage.setItem(k, v);
|
||||
}
|
||||
return true;
|
||||
}catch(e){return false}
|
||||
}
|
||||
js.getoption=function(k,dev){
|
||||
var s = '';
|
||||
k=QOM+k;
|
||||
try{s = localStorage.getItem(k);}catch(e){}
|
||||
if(isempt(dev))dev='';
|
||||
if(isempt(s))s=dev;
|
||||
return s;
|
||||
}
|
||||
js.msg = function(lx, txt,sj){
|
||||
clearTimeout(this.msgshowtime);
|
||||
if(typeof(sj)=='undefined')sj=5;
|
||||
$('#msgshowdivla').remove();
|
||||
if(lx == 'none' || !lx){
|
||||
return;
|
||||
}
|
||||
if(lx == 'wait'){
|
||||
txt = '<img src="images/loadings.gif" height="14" width="15" align="absmiddle"> '+txt;
|
||||
sj = 60;
|
||||
}
|
||||
if(lx=='msg')txt='<font color=red>'+txt+'</font>';var t=10;
|
||||
var s = '<div onclick="$(this).remove()" id="msgshowdivla" style="position:fixed;top:'+t+'px;z-index:20;" align="center"><div style="padding:8px 20px;background:rgba(0,0,0,0.7);color:white;font-size:16px;">'+txt+'</div></div>';
|
||||
$('body').append(s);
|
||||
var w=$('#msgshowdivla').width(),l=(winWb()-w)*0.5;
|
||||
$('#msgshowdivla').css('left',''+l+'px');
|
||||
if(sj>0)this.msgshowtime= setTimeout("$('#msgshowdivla').remove()",sj*1000);
|
||||
}
|
||||
js.decode=function(str){
|
||||
var arr = {length:-1};
|
||||
try{
|
||||
arr = new Function('return '+str+'')();
|
||||
}catch(e){}
|
||||
return arr;
|
||||
}
|
||||
js.apply=function(a,b){
|
||||
if(!a)a={};
|
||||
if(!b)b={};
|
||||
for(var c in b)a[c]=b[c];
|
||||
return a;
|
||||
}
|
||||
js.apiurl=function(m,a){
|
||||
var url='api.php?m='+m+'&a='+a+'&adminid='+adminid+'';
|
||||
var cfrom='app'+api.systemType+'';
|
||||
url+='&device='+api.deviceId+'';
|
||||
url+='&cfrom='+cfrom+'';
|
||||
url+='&token='+token+'';
|
||||
return url;
|
||||
}
|
||||
js.downshow=function(id){
|
||||
js.open('?id='+id+'&a=down',600,350);
|
||||
return false;
|
||||
}
|
||||
js.ajax=function(m,a,d,fun1,mod,checs,errf){
|
||||
if(js.ajaxbool)return;
|
||||
clearTimeout(js.ajaxrequestime);
|
||||
if(!fun1)fun1=function(){};
|
||||
if(!errf)errf=function(){};
|
||||
if(!checs)checs=function(){};
|
||||
var bs = checs(d);
|
||||
if(typeof(bs)=='string'&&bs!=''){
|
||||
js.msg('msg', bs);
|
||||
return;
|
||||
}
|
||||
if(typeof(bs)=='object')d=js.apply(d,bs);
|
||||
if(!mod)mod='wait';
|
||||
js.ajaxbool=true;
|
||||
var tsnr = '努力处理中...';
|
||||
if(mod=='wait'){
|
||||
js.msg(mod, tsnr);
|
||||
}
|
||||
var url=js.apiurl(m,a);if(m.indexOf('?')>0)url=m;
|
||||
$.ajax({
|
||||
url: url,method: 'post',dataType:'json',data: d,
|
||||
success:function(ret){
|
||||
js.ajaxbool=false;
|
||||
clearTimeout(js.ajaxrequestime);
|
||||
js.msg('none');
|
||||
if(ret){
|
||||
if(ret.code!=200){
|
||||
js.msg('msg', 'err1:'+ret.msg);
|
||||
errf(ret.msg);
|
||||
}else{
|
||||
fun1(ret.data);
|
||||
}
|
||||
}else{
|
||||
js.msg('msg', 'err:'+err.msg);
|
||||
errf(err);
|
||||
}
|
||||
},
|
||||
error:function(){
|
||||
js.msg('msg','内部错误:'+e.responseText);
|
||||
errf();
|
||||
}
|
||||
});
|
||||
js.ajaxrequestime=setTimeout(function(){
|
||||
js.ajaxbool=false;
|
||||
js.msg('msg', 'err:请求超时');
|
||||
errf();
|
||||
},1000*30);
|
||||
}
|
||||
js.backla=function(msg){
|
||||
if(msg)if(!confirm(msg))return;
|
||||
try{api.closeWin();}catch(e){}
|
||||
}
|
||||
js.sendevent=function(typ,na,d){
|
||||
if(!d)d={};
|
||||
d.opttype=typ;
|
||||
if(!na)na='xinhuhome';
|
||||
if(api.sendEvent)api.sendEvent({
|
||||
name: na,
|
||||
extra:d
|
||||
});
|
||||
}
|
||||
js.setmsg=function(txt,col,ids){
|
||||
if(!ids)ids='msgview';
|
||||
$('#'+ids+'').html(js.getmsg(txt,col));
|
||||
}
|
||||
js.getmsg = function(txt,col){
|
||||
if(!col)col='red';
|
||||
var s = '';
|
||||
if(!txt)txt='';
|
||||
if(txt.indexOf('...')>0){
|
||||
s='<img src="images/loading.gif" height="16" width="16" align="absmiddle"> ';
|
||||
col = '#ff6600';
|
||||
}
|
||||
s+='<span style="color:'+col+'">'+txt+'</span>';
|
||||
if(!txt)s='';
|
||||
return s;
|
||||
}
|
||||
|
||||
var changename_uuusw;
|
||||
function changeuser(na,lx){
|
||||
changename_uuusw=na;
|
||||
if(!lx)lx='';
|
||||
var url=''+apiurl+'task.php?fn=dept&adminid='+adminid+'&token='+token+'&changetype='+lx+'';
|
||||
var s='<div style="height:100%;width:100%;position:fixed;top:0px;left:0px;z-index:99; background:rgba(0,0,0,0.2)" align="center" id="changmodddid">';
|
||||
s+='<div style="max-width:300px;height:100%;max-height:450px;margin-top:5%; background:while;border:1px #dddddd solid">';
|
||||
s+='<iframe style="background:white" name="changdept" height="100%" frameborder="0" scrolling="auto" marginheight="0" marginwidth="0" width="100%" src="'+url+'"></iframe>';
|
||||
s+='</div>';
|
||||
s+='</div>';
|
||||
$('body').append(s);
|
||||
}
|
||||
function changecancel(){
|
||||
$('#changmodddid').remove();
|
||||
}
|
||||
function changeok(sna,sid){
|
||||
get(changename_uuusw).value=sna;
|
||||
get(changename_uuusw+'_id').value=sid;
|
||||
}
|
||||
function clearuser(na){
|
||||
get(na).value='';
|
||||
get(na+'_id').value='';
|
||||
get(na).focus();
|
||||
}
|
||||
9
js/jsmain.js
Normal file
9
js/jsmain.js
Normal file
File diff suppressed because one or more lines are too long
43
js/jsrock.js
Normal file
43
js/jsrock.js
Normal file
@@ -0,0 +1,43 @@
|
||||
//js下的扩展,如计算日期差等
|
||||
|
||||
/**
|
||||
* 计算2个日期时间差
|
||||
*/
|
||||
js.datediff=function(lx, start, end)
|
||||
{
|
||||
var time1 = this.now('time', start)*0.001,time2;
|
||||
time2 = (end)?this.now('time', end) : new Date().getTime();
|
||||
time2 = time2*0.001;
|
||||
var jg = 0;
|
||||
if(lx=='d'){
|
||||
jg = time2-time1;
|
||||
jg = Math.ceil(jg/3600/24);
|
||||
}
|
||||
if(lx=='H'){
|
||||
jg = time2-time1;
|
||||
jg = Math.ceil(jg/3600);
|
||||
}
|
||||
if(lx=='i'){
|
||||
jg = time2-time1;
|
||||
jg = Math.ceil(jg/60);
|
||||
}
|
||||
if(lx=='s'){
|
||||
jg = time2-time1;
|
||||
}
|
||||
return jg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期相加
|
||||
*/
|
||||
js.adddate=function(dt,lx,v,type)
|
||||
{
|
||||
var time1 = (dt) ? this.now('time', dt) : new Date().getTime();
|
||||
var jg = 0;
|
||||
if(lx=='d')jg=v*3600*24;
|
||||
if(lx=='H')jg=v*3600;
|
||||
if(lx=='i')jg=v*60;
|
||||
if(lx=='s')jg=v;
|
||||
time1 = time1 + (jg * 1000);
|
||||
return this.now(type,time1);
|
||||
}
|
||||
310
js/jswx.js
Normal file
310
js/jswx.js
Normal file
@@ -0,0 +1,310 @@
|
||||
QOM='xinhuwx_'
|
||||
js.wx={};
|
||||
js.wx.alert=function(msg,fun,tit, cof1){
|
||||
$('#weui_dialog_alert_div').remove();
|
||||
var s='';
|
||||
if(!tit)tit='系统提示';
|
||||
s+='<div id="weui_dialog_alert_div" class="weui_dialog_alert" >';
|
||||
s+='<div class="weui_mask"></div>';
|
||||
s+='<div class="weui_dialog">';
|
||||
s+=' <div class="weui_dialog_hd"><strong class="weui_dialog_title">'+tit+'</strong></div>';
|
||||
s+=' <div class="weui_dialog_bd">'+msg+'</div>';
|
||||
s+=' <div class="weui_dialog_ft">';
|
||||
s+=' <a href="javascript:;" id="confirm_btn" sattr="yes" class="weui_btn_dialog primary">确定</a>';
|
||||
if(cof1==1)s+=' <a href="javascript:;" id="confirm_btn1" sattr="no" class="weui_btn_dialog default">取消</a>';
|
||||
s+=' </div>';
|
||||
s+='</div>';
|
||||
s+='</div>';
|
||||
$('body').append(s);
|
||||
function backl(e){
|
||||
var jg = $(this).attr('sattr');
|
||||
if(typeof(fun)=='function')fun(jg,this);
|
||||
$('#weui_dialog_alert_div').remove();
|
||||
return false;
|
||||
}
|
||||
$('#confirm_btn1').click(backl);
|
||||
$('#confirm_btn').click(backl);
|
||||
}
|
||||
js.wx.confirm=function(msg,fun,tit){
|
||||
this.alert(msg,fun,tit, 1);
|
||||
}
|
||||
js.wx.prompt=function(tit,msg,fun,nr){
|
||||
if(!nr)nr='';
|
||||
if(apicloud){
|
||||
api.prompt({
|
||||
buttons: ['确定', '取消'],
|
||||
text:nr,title:tit,msg:msg
|
||||
}, function(ret, err) {
|
||||
var index = ret.buttonIndex;
|
||||
if(index==1)fun(ret.text);
|
||||
});
|
||||
return;
|
||||
}
|
||||
function func(lx){
|
||||
if(lx=='yes')fun(get('prompttxt').value);
|
||||
}
|
||||
var msg = '<div align="left">'+msg+'</div><div align="left"><input value="'+nr+'" class="r-input" id="prompttxt" type="text"></div>';
|
||||
this.alert(msg,func,tit, 1);
|
||||
}
|
||||
js.apiurl = function(m,a,cans){
|
||||
var url=''+apiurl+'api.php?m='+m+'&a='+a+'';
|
||||
var cfrom='mweb';
|
||||
if(adminid)url+='&adminid='+adminid+'';
|
||||
if(device)url+='&device='+device+'';
|
||||
url+='&cfrom='+cfrom+'';
|
||||
if(token)url+='&token='+token+'';
|
||||
if(!cans)cans={};
|
||||
for(var i in cans)url+='&'+i+'='+cans[i]+'';
|
||||
return url;
|
||||
}
|
||||
js.ajax = function(m,a,d,funs, mod,checs, erfs, glx){
|
||||
if(js.ajaxbool && !js.ajaxwurbo)return;
|
||||
clearTimeout(js.ajax_time);
|
||||
var url = js.apiurl(m,a);
|
||||
js.ajaxbool = true;
|
||||
if(!mod)mod='mode';
|
||||
if(typeof(erfs)!='function')erfs=function(){};
|
||||
if(typeof(funs)!='function')funs=function(){};
|
||||
if(!checs)checs=function(){};
|
||||
var bs = checs(d);
|
||||
if(typeof(bs)=='string'&&bs!=''){
|
||||
js.msg('msg', bs);
|
||||
return;
|
||||
}
|
||||
if(typeof(bs)=='object')d=js.apply(d,bs);
|
||||
var tsnr = '努力处理中...';
|
||||
if(mod=='wait')js.msg(mod, tsnr);
|
||||
if(mod=='mode')js.wx.load(tsnr);
|
||||
function errsoers(ts, ds){
|
||||
js.wx.unload();
|
||||
js.setmsg(ts);
|
||||
js.msg('msg',ts);
|
||||
js.ajaxbool = false;
|
||||
erfs(ts, ds);
|
||||
}
|
||||
var type=(!d)?'get':'post';if(glx)type=glx;
|
||||
var ajaxcan={
|
||||
type:type,dataType:'json',data:d,url:url,
|
||||
success:function(ret){
|
||||
js.ajaxbool=false;
|
||||
js.wx.unload();
|
||||
clearTimeout(js.ajax_time);
|
||||
if(ret.code==199){
|
||||
js.wx.alert(ret.msg, function(){
|
||||
js.location('?d=we&m=login&backurl='+jm.base64encode(location.href)+'');
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(ret.code!=200){
|
||||
errsoers(ret.msg, ret);
|
||||
}else{
|
||||
js.setmsg('');
|
||||
js.msg('none');
|
||||
funs(ret.data);
|
||||
}
|
||||
},
|
||||
error:function(e){
|
||||
errsoers('内部出错:'+e.responseText+'');
|
||||
}
|
||||
};
|
||||
$.ajax(ajaxcan);
|
||||
js.ajax_time = setTimeout(function(){
|
||||
if(js.ajaxbool){
|
||||
errsoers('Error:请求超时?');
|
||||
}
|
||||
}, 1000*30);
|
||||
}
|
||||
js.wx.load=function(txt){
|
||||
this.unload();
|
||||
if(txt=='none')return;
|
||||
if(!txt)txt='加载中...';
|
||||
var s='';
|
||||
var t = winHb()-150;
|
||||
s+='<div id="loadingToastsss" class="weui_loading_toast">'+
|
||||
'<div class="weui_mask_transparent"></div>'+
|
||||
'<div class="weui_toast" style="top:'+(t*0.5)+'px">'+
|
||||
' <div class="weui_loading">'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_0"></div>'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_1"></div>'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_2"></div>'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_3"></div>'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_4"></div>'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_5"></div>'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_6"></div>'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_7"></div>'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_8"></div>'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_9"></div>'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_10"></div>'+
|
||||
' <div class="weui_loading_leaf weui_loading_leaf_11"></div>'+
|
||||
' </div>'+
|
||||
' <p class="weui_toast_content">'+txt+'</p>'+
|
||||
'</div>'+
|
||||
'</div>';
|
||||
$('body').append(s);
|
||||
}
|
||||
js.wx.unload=function(){
|
||||
$('#loadingToastsss').remove();
|
||||
}
|
||||
js.loading=function(txt){
|
||||
this.wx.load(txt);
|
||||
}
|
||||
js.unloading=function(){
|
||||
this.wx.unload();
|
||||
}
|
||||
js.wx.msgok=function(txt,fun,ms){
|
||||
$('#toastssss').remove();
|
||||
clearTimeout(this.msgtime);
|
||||
if(txt=='none')return;
|
||||
if(!ms)ms=3;
|
||||
var t = winHb()-150;
|
||||
var s='<div id="toastssss">';
|
||||
s+='<div class="weui_mask_transparent"></div>';
|
||||
s+= '<div class="weui_toast" style="top:'+(t*0.5)+'px">';
|
||||
s+= '<i class="weui_icon_toast"></i>';
|
||||
s+= '<p class="weui_toast_content">'+txt+'</p>';
|
||||
s+= '</div>';
|
||||
s+='</div>';
|
||||
$('body').append(s);
|
||||
this.msgtime=setTimeout(function(){
|
||||
$('#toastssss').remove();
|
||||
if(typeof(fun)=='function')fun();
|
||||
|
||||
}, ms*1000);
|
||||
}
|
||||
|
||||
js.showmenu=function(d){
|
||||
$('#menulistshow').remove();
|
||||
var d=js.apply({width:200,top:'50%',renderer:function(){},align:'center',onclick:function(){},oncancel:function(){}},d);
|
||||
var a=d.data;
|
||||
if(!a)return;
|
||||
var h1=$(window).height(),h2=document.body.scrollHeight,s1;
|
||||
if(h2>h1)h1=h2;
|
||||
var col='';
|
||||
var s='<div onclick="$(this).remove();" align="center" id="menulistshow" style="background:rgba(0,0,0,0.6);height:'+h1+'px;width:100%;position:absolute;left:0px;top:0px;z-index:198" >';
|
||||
s+='<div id="menulistshow_s" style="width:'+d.width+'px;margin-top:'+d.top+';position:fixed;-webkit-overflow-scrolling:touch" class="menulist r-border-r r-border-l">';
|
||||
for(var i=0;i<a.length;i++){
|
||||
s+='<div oi="'+i+'" style="text-align:'+d.align+';color:'+a[i].color+'" class="r-border-t">';
|
||||
s1=d.renderer(a[i]);
|
||||
if(s1){s+=s1}else{s+=''+a[i].name+'';}
|
||||
s+='</div>';
|
||||
}
|
||||
s+='</div>';
|
||||
s+='</div>';
|
||||
$('body').append(s);
|
||||
var mh = $(window).height();
|
||||
var l=($(window).width()-d.width)*0.5,o1 = $('#menulistshow_s'),t = (mh-o1.height()-10)*0.5;
|
||||
if(t<10){
|
||||
t = 10;
|
||||
o1.css({height:''+(mh-20)+'px','overflow':'auto'});
|
||||
}
|
||||
o1.css({'left':''+l+'px','margin-top':''+t+'px'});
|
||||
$('#menulistshow div[oi]').click(function(){
|
||||
var oi=parseFloat($(this).attr('oi'));
|
||||
d.onclick(a[oi],oi);
|
||||
});
|
||||
$('#menulistshow').click(function(){
|
||||
$(this).remove();
|
||||
try{d.oncancel();}catch(e){}
|
||||
});
|
||||
};
|
||||
|
||||
js.wx.actionsheet=function(d){
|
||||
$('#actionsheetshow').remove();
|
||||
var d=js.apply({onclick:function(){},oncancel:function(){}},d);
|
||||
var a=d.data,s='';
|
||||
if(!a)return;
|
||||
s+='<div onclick="$(this).remove();" id="actionsheetshow">';
|
||||
s+='<div class="weui_mask_transition weui_fade_toggle" style="display:block"></div>';
|
||||
s+='<div class="weui_actionsheet weui_actionsheet_toggle" >';
|
||||
s+=' <div class="weui_actionsheet_menu">';
|
||||
for(var i=0;i<a.length;i++){
|
||||
s+='<div oi="'+i+'" style="color:'+a[i].color+'" class="weui_actionsheet_cell">'+a[i].name+'</div>';
|
||||
}
|
||||
s+=' </div>';
|
||||
s+=' <div class="weui_actionsheet_action"><div class="weui_actionsheet_cell" id="actionsheet_cancel">取消</div></div>';
|
||||
s+='</div>';
|
||||
s+='</div>';
|
||||
$('body').append(s);
|
||||
$('#actionsheetshow div[oi]').click(function(){
|
||||
var oi=parseFloat($(this).attr('oi'));
|
||||
d.onclick(a[oi],oi);
|
||||
});
|
||||
$('#actionsheetshow').click(function(){
|
||||
$(this).remove();
|
||||
try{d.oncancel();}catch(e){}
|
||||
});
|
||||
}
|
||||
|
||||
js.isqywx=false;
|
||||
js.iswxbo=function(){
|
||||
var bo = true;
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if(ua.indexOf('micromessenger')<0)bo=false;
|
||||
if(bo && ua.indexOf('wxwork')>0)js.isqywx=true;
|
||||
return bo;
|
||||
}
|
||||
js.jssdkcall = function(bo){
|
||||
|
||||
}
|
||||
js.jssdkstate = 0;
|
||||
js.jssdkwixin = function(qxlist,afe){
|
||||
if(!js.iswxbo())return js.jssdkcall(false);
|
||||
//if(js.isqywx)var wxurl = 'https://res.wx.qq.com/open/js/jweixin-1.1.0.js';
|
||||
var wxurl = 'https://res.wx.qq.com/open/js/jweixin-1.2.0.js';
|
||||
if(!afe)$.getScript(wxurl, function(){
|
||||
js.jssdkwixin(qxlist, true);
|
||||
});
|
||||
if(!afe)return;
|
||||
var surl= location.href;
|
||||
if(!qxlist)qxlist= ['openLocation','getLocation','chooseImage','getLocalImgData','previewImage'];
|
||||
js.ajax('weixin','getsign',{url:jm.base64encode(surl),agentid:js.request('agentid')},function(ret){
|
||||
if(!ret.appId)return js.jssdkcall(false);
|
||||
wx.config({
|
||||
debug: false,
|
||||
appId: ret.appId,
|
||||
timestamp:ret.timestamp,
|
||||
nonceStr: ret.nonceStr,
|
||||
signature: ret.signature,
|
||||
jsApiList:qxlist
|
||||
});
|
||||
wx.ready(function(){
|
||||
if(js.jssdkstate==0)js.jssdkstate = 1;
|
||||
js.jssdkcall(true);
|
||||
});
|
||||
wx.error(function(res){
|
||||
js.jssdkstate = 2;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信公众号jssdk授权
|
||||
*/
|
||||
js.jssdkwxgzh = function(qxlist,afe){
|
||||
if(!js.iswxbo())return js.jssdkcall(false);
|
||||
var wxurl = 'https://res.wx.qq.com/open/js/jweixin-1.2.0.js';
|
||||
if(!afe)$.getScript(wxurl, function(){
|
||||
js.jssdkwxgzh(qxlist, true);
|
||||
});
|
||||
if(!afe)return;
|
||||
var surl= location.href;
|
||||
if(!qxlist)qxlist= ['openLocation','getLocation','chooseImage','getLocalImgData','previewImage'];
|
||||
js.ajax('wxgzh','getsign',{url:jm.base64encode(surl)},function(ret){
|
||||
if(!ret.appId)return js.jssdkcall(false);
|
||||
wx.config({
|
||||
debug: false,
|
||||
appId: ret.appId,
|
||||
timestamp:ret.timestamp,
|
||||
nonceStr: ret.nonceStr,
|
||||
signature: ret.signature,
|
||||
jsApiList:qxlist
|
||||
});
|
||||
wx.ready(function(){
|
||||
if(js.jssdkstate==0)js.jssdkstate = 1;
|
||||
js.jssdkcall(true);
|
||||
});
|
||||
wx.error(function(res){
|
||||
js.jssdkstate = 2;
|
||||
});
|
||||
});
|
||||
}
|
||||
139
js/option.js
Normal file
139
js/option.js
Normal file
@@ -0,0 +1,139 @@
|
||||
/**
|
||||
* 系统选项分类操作
|
||||
*/
|
||||
function optionclass(cans){
|
||||
|
||||
var me = this;
|
||||
this.sspid = 0;
|
||||
this.typeid = 0;
|
||||
this.isguanli = true;
|
||||
|
||||
this.reloadtype = function(){
|
||||
this.at.reload();
|
||||
}
|
||||
this.clicktypeeidt = function(){
|
||||
var d = this.at.changedata;
|
||||
if(d.id)this.clicktypewin(false, 1, d);
|
||||
}
|
||||
|
||||
this.clicktypewin = function(o1, lx, da){
|
||||
var h = $.bootsform({
|
||||
title:this.title,height:250,width:300,
|
||||
tablename:'option',labelWidth:50,
|
||||
isedit:lx,submitfields:'name,sort,pid',cancelbtn:false,
|
||||
items:[{
|
||||
labelText:'名称',name:'name',required:true
|
||||
},{
|
||||
labelText:'上级id',name:'pid',value:0,type:'hidden'
|
||||
},{
|
||||
labelText:'排序号',name:'sort',type:'number',value:0
|
||||
}],
|
||||
success:function(){
|
||||
me.reloadtype();
|
||||
}
|
||||
});
|
||||
if(lx==1)h.setValues(da);
|
||||
if(lx==0)h.setValue('pid',this.typeid);
|
||||
h.form.name.focus();
|
||||
return h;
|
||||
}
|
||||
this.typedel = function(o1){
|
||||
this.at.del({
|
||||
url:js.getajaxurl('deloption','option','system'),params:{'stable':this.stable}
|
||||
});
|
||||
}
|
||||
|
||||
this.optionmove = function(){
|
||||
var d = this.at.changedata;
|
||||
if(!d || !d.id){js.msg('msg','没有选中行');return;}
|
||||
this.movedata = d;
|
||||
js.msg('success','请在5秒内选择其他分类确认移动');
|
||||
clearTimeout(this.cmoeefese);
|
||||
this.cmoeefese=setTimeout(function(){me.movedata=false;},5000);
|
||||
}
|
||||
this.ismoveok=function(d){
|
||||
var md = this.movedata;
|
||||
if(md && md.id && md.id!=d.id){
|
||||
js.confirm('确定要将['+md.name+']移动到['+d.name+']下吗?',function(jg){
|
||||
if(jg=='yes'){
|
||||
me.movetoss(md.id,d.id,0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.optionmoveto=function(){
|
||||
var d = this.at.changedata;
|
||||
if(!d || !d.id || this.sspid==0)return;
|
||||
js.confirm('确定要将['+d.name+']移动到顶级吗?',function(jg){
|
||||
if(jg=='yes'){
|
||||
me.movetoss(d.id,me.sspid,1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.movetoss=function(id,toid,lx){
|
||||
js.ajax(js.getajaxurl('movetype','option','system'),{'id':id,'toid':toid,'lx':lx},function(s){
|
||||
if(s!='ok'){
|
||||
js.msg('msg', s);
|
||||
}else{
|
||||
me.reloadtype();
|
||||
}
|
||||
},'get',false, '移动中...,移动成功');
|
||||
this.movedata=false;
|
||||
}
|
||||
|
||||
|
||||
this.createtable=function(){
|
||||
this.at = $('#'+this.optionview+'').bootstree({
|
||||
url:js.getajaxurl('gettreedata','option','system',{'num':this.optionnum}),
|
||||
columns:[{
|
||||
text:this.title,dataIndex:'name',align:'left',xtype:'treecolumn',width:'79%'
|
||||
},{
|
||||
text:'序号',dataIndex:'sort',width:'20%'
|
||||
}],
|
||||
load:function(d){
|
||||
if(me.sspid==0){
|
||||
me.sspid = d.pid;
|
||||
me.allshow();
|
||||
}
|
||||
},
|
||||
itemdblclick:function(d){
|
||||
me.typeid = d.id;
|
||||
me.loadfile(d.id,d.name);
|
||||
},
|
||||
itemclick:function(d){
|
||||
me.ismoveok(d);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.allshow=function(){
|
||||
this.typeid = this.sspid;
|
||||
this.at.changedata={};
|
||||
this.loadfile('0','所有'+this.title+'');
|
||||
}
|
||||
|
||||
this.loadfile=function(spd,nsd){
|
||||
$('#megss'+this.rand+'').html(nsd);
|
||||
this.mobj.setparams({'typeid':spd}, true);
|
||||
}
|
||||
this.showfooter=function(){
|
||||
var s = '<a href="javascript:;" style="TEXT-DECORATION:none" title="刷新" click="reloadtype" onclick="return false"><i class="icon-refresh"></i></a> <a href="javascript:;" style="TEXT-DECORATION:none" title="所有'+this.title+'" click="allshow" onclick="return false"><i class="icon-search"></i></a>';
|
||||
if(this.isguanli)s+= ' <a href="javascript:;" style="TEXT-DECORATION:none" title="新增" click="clicktypewin,0" onclick="return false"><i class="icon-plus"></i></a> <a href="javascript:;" style="TEXT-DECORATION:none" title="编辑" click="clicktypeeidt" onclick="return false"><i class="icon-edit"></i></a> <a href="javascript:;" style="TEXT-DECORATION:none" title="删除" click="typedel" onclick="return false"><i class="icon-trash"></i></a> <a href="javascript:;" style="TEXT-DECORATION:none" title="移动" click="optionmove" onclick="return false"><i class="icon-move"></i></a> <a href="javascript:;" title="移动到顶级" style="TEXT-DECORATION:none" click="optionmoveto" onclick="return false"><i class="icon-arrow-up"></i></a>';
|
||||
$('#'+this.optionview+'').after('<div class="panel-footer">'+s+'</div>');
|
||||
return true;
|
||||
}
|
||||
|
||||
//初始化
|
||||
this.init_option=function(){
|
||||
this.createtable(); //创建表格
|
||||
this.showfooter(); //显示底部
|
||||
|
||||
$('#'+this.optionview+'').css('height',''+(viewheight-70)+'px');
|
||||
}
|
||||
|
||||
for(var oc in cans)this[oc]=cans[oc];
|
||||
|
||||
this.init_option();
|
||||
}
|
||||
981
js/reim.js
Normal file
981
js/reim.js
Normal file
@@ -0,0 +1,981 @@
|
||||
/**
|
||||
* REIM即时通信主js
|
||||
* caratename:雨中磐石(rainrock)
|
||||
* caratetime:2017-07-20 21:40:00
|
||||
* homepage:www.rockoa.com
|
||||
*/
|
||||
|
||||
//打开聊天会话
|
||||
function openchat(id, lx,face){
|
||||
if(!lx)lx=0;var types=['user','group'];
|
||||
var sle = (types[lx]) ? types[lx] : lx;
|
||||
var url = '?d=reim&m=chat&uid='+id+'&type='+sle+'',csne={};
|
||||
if(face)csne.icon=face;
|
||||
js.open(url, 480,500, ''+sle+'_'+id+'',{},csne);
|
||||
}
|
||||
var windowfocus=true;
|
||||
var reim = {
|
||||
connectbool:false,
|
||||
otherlogin:false,
|
||||
timeloads:0,
|
||||
ruloadtime:10*60,
|
||||
userarr:{},
|
||||
deptarr:{},
|
||||
grouparr:{},
|
||||
maindata:{},
|
||||
agentarr:{},
|
||||
lastloaddt:'',
|
||||
apiurl:function(m,a){
|
||||
return 'api.php?m='+m+'&a='+a+'';
|
||||
},
|
||||
show:function(){
|
||||
nwjs.init();
|
||||
nwjs.createtray(''+systitle+'-'+adminname+'', 1);
|
||||
|
||||
bodyunload=function(){
|
||||
nwjs.removetray();
|
||||
}
|
||||
|
||||
nwjs.serverdata=function(d){
|
||||
return reim.serverdata(d);
|
||||
}
|
||||
|
||||
this.date = js.now();
|
||||
notifyobj=new notifyClass({
|
||||
title:'系统提醒',
|
||||
sound:'web/res/sound/todo.ogg',
|
||||
sounderr:'',
|
||||
soundbo:true,
|
||||
showbool:false
|
||||
});
|
||||
|
||||
this.mainshow();//显示主界面
|
||||
this.righthistroboj = $.rockmenu({
|
||||
data:[],
|
||||
itemsclick:function(d){
|
||||
reim.rightclick(d);
|
||||
}
|
||||
});
|
||||
$(window).resize(this.resize);
|
||||
$(window).focus(function(){windowfocus=true});
|
||||
$(window).blur(function(){windowfocus=false});
|
||||
//数秒
|
||||
setInterval('reim.timeload()', 1000);
|
||||
|
||||
document.ondragover=function(e){e.preventDefault();};
|
||||
document.ondrop=function(e){e.preventDefault();};
|
||||
},
|
||||
openrecord:function(){
|
||||
var url = '?homeurl=cmVpbSxyZWNvcmQsYXR5cGU9bXk:&homename=5oiR55qE5Lya6K!d6K6w5b2V&menuid=MjI3';
|
||||
js.open(url,1000,550,'chatrecord');
|
||||
},
|
||||
timeload:function(){
|
||||
this.timeloads++;
|
||||
//刷新
|
||||
if(this.timeloads >= this.ruloadtime){
|
||||
this.timeloads = 0;
|
||||
this.reload();
|
||||
}
|
||||
|
||||
if(this.timeloads==5)this.getonline();
|
||||
|
||||
//如果服务端断开,用ajax连接
|
||||
if(this.timeloads % 10==0){
|
||||
this.loadredata();
|
||||
}
|
||||
},
|
||||
|
||||
//内部服务处理
|
||||
serverdata:function(a){
|
||||
var lx = a.atype;
|
||||
if(lx=='cropfinish' && !this.cropScreenbo && a.filepath){
|
||||
nwjs.winshow();
|
||||
}
|
||||
if(lx=='focus')nwjs.winshow();
|
||||
if(lx=='crop')this.cropScreen(true);
|
||||
if(lx=='notify')this.shownotify(a);
|
||||
if(lx=='openchat')this.openchat(a.id,a.type);
|
||||
if(lx=='getlogin')return {uid:adminid,uname:adminname,face:adminface};
|
||||
if(lx=='getipmac')return nwjs.getipmac();
|
||||
if(lx=='office')nwjs.editoffice(a.paramsstr);
|
||||
if(lx=='upfile')return nwjs.filetobase64(a.path);
|
||||
if(lx=='gpath')return nwjs.getpath();
|
||||
},
|
||||
shownotify:function(d1){
|
||||
var d = js.apply({icon:'images/logo.png','title':'系统提醒',url:''}, d1);
|
||||
if(d.msg)notifyobj.showpopup(d.msg,{icon:d.icon,title:d.title,url:d.url,click:function(b){
|
||||
if(b.url)nwjs.openurl(b.url);
|
||||
return true;
|
||||
}});
|
||||
},
|
||||
resize:function(){
|
||||
var h = winHb()-140-40;
|
||||
$('#reim_mainview').css('height',''+h+'px');
|
||||
},
|
||||
|
||||
cropScreen:function(){
|
||||
var oatg = nwjs.getpath();
|
||||
nw.Shell.openItem(''+oatg+'/images/reimcaptScreen.exe');
|
||||
},
|
||||
|
||||
//显示聊天主界面
|
||||
mainshow:function(bo){
|
||||
if(get('reim_main')){
|
||||
this.connectservers();
|
||||
return;
|
||||
}
|
||||
var h = winHb()-140-40;
|
||||
var s = '<div id="reim_main" style="position:relative" class="reim_main">';
|
||||
|
||||
s+='<div class="gradienth" style="height:70px;overflow:hidden">';
|
||||
s+=' <table style="top:0px;left:0px" cellspacing="0" cellpadding="0" width="100%"><tr><td height="70" style="padding:0px 10px"><div style="height:40px;overflow:hidden"><img onclick="reim.openuserzl('+adminid+')" style="border-radius:50%;cursor:pointer" src="'+adminface+'" id="myface" width="40" height="40"></div></td><td width="100%"><div>'+adminname+'<span style="font-size:12px;color:#999999">('+adminranking+')</span></div><div style="font-size:12px;color:#999999" class="blank20">'+deptallname+'</div></tr></table>';
|
||||
s+='</div>';
|
||||
s+=' <div style="border-bottom:1px #dedede solid"><input placeholder="搜索联系人/会话/应用" id="reim_keysou" style="width:100%;padding:0px 5px;height:40px;line-height:30px;border:none;background:none url(web/images/im/sousuo.png) 200px 5px no-repeat;"></div>';
|
||||
s+=' <span class="badge red" style="position:absolute;top:100px;left:10%;display:none" id="chat_alltotal">0</span>';
|
||||
s+=' <span class="badge red" style="position:absolute;top:100px;left:35%;display:none" id="agent_alltotal">0</span>';
|
||||
s+=' <div class="headertab"><div style="width:25%" class="active" title="消息会话" onclick="reim.tabchagne(0, this)"><i class="icon-comment-alt"></i></div><div style="width:25%" title="应用" onclick="reim.tabchagne(3,this)"><i class="icon-th-large"></i></div><div style="width:25%" title="组织结构" onclick="reim.tabchagne(1,this)"><i class="icon-sitemap"></i></div><div style="width:25%" title="会话/群" onclick="reim.tabchagne(2,this)"><i class="icon-group"></i></div></div>';
|
||||
|
||||
s+=' <div id="reim_mainview" style="height:'+h+'px;overflow:auto">';
|
||||
s+=' <div id="reim_headercenter" style="position:relative">';
|
||||
s+=' <div tabdiv="0"><div id="historylist_tems" style="padding-top:50px;text-align:center;color:#cccccc"><span style="font-size:40px"><i class="icon-comment-alt"></i></span><br>暂无消息</div><div class="listviewt" id="historylist"></div> </div>';
|
||||
s+=' <div tabdiv="1" class="usersslist" style="display:none"><span id="showdept_0"></span></div>';
|
||||
s+=' <div tabdiv="2" id="reim_showgroupdiv" class="usersslist" style="display:none;"></div>';
|
||||
s+=' <div tabdiv="3" id="reim_showagetdiv" style="display:none;"></div>';
|
||||
s+=' </div>';
|
||||
s+=' </div>';
|
||||
|
||||
s+='<div style="height:30px;overflow:hidden;border-top:1px #dddddd solid; background-color:#eeeeee"><div class="toolsliao"><span onclick="reim.indexsyscog()" title="设置"><i class="icon-cog"></i></span><span onclick="reim.creategroup()" title="创建会话"><i class="icon-plus"></i></span><span onclick="location.reload()" title="刷新"><i class="icon-refresh"></i></span><span onclick="reim.openrecord()" title="会话记录"><i class="icon-file-alt"></i></span><span onclick="reim.loginexit()" style="float:right" title="退出"><i class="icon-signout"></i></span> <font id="reim_statusserver" style="font-size:12px"></font></div></div>';
|
||||
|
||||
s+='</div>';
|
||||
$('#reim_viewshow').html(s);
|
||||
this.resize();
|
||||
$('#reim_keysou').keyup(function(){reim.searchss();});
|
||||
$('#reim_keysou').click(function(){reim.searchss();});
|
||||
this.initdata(); //初始化数据
|
||||
},
|
||||
ajax:function(url,da,fun,type,efun){
|
||||
if(!da)da={};if(!type)type='get';
|
||||
if(typeof(fun)!='function')fun=function(){};
|
||||
if(typeof(efun)!='function')efun=function(){};
|
||||
var atyp = type.split(',');type=atyp[0];
|
||||
function errshow(esr){
|
||||
js.msg('msg',esr);
|
||||
efun(esr);
|
||||
}
|
||||
var ajaxcan={
|
||||
type:type,
|
||||
data:da,url:url+'&cfrom=reim',
|
||||
success:function(ret){
|
||||
if(ret.code==199){
|
||||
reim.loginexits();
|
||||
return;
|
||||
}
|
||||
if(ret.code==200){
|
||||
fun(ret.data);
|
||||
}else{
|
||||
errshow(ret.msg);
|
||||
}
|
||||
},error:function(e){
|
||||
errshow('处理出错:'+e.responseText+'');
|
||||
}
|
||||
};
|
||||
ajaxcan.dataType='json';
|
||||
$.ajax(ajaxcan);
|
||||
},
|
||||
//连接到服务端
|
||||
connectserver:function(){
|
||||
this.loaddata('config');
|
||||
},
|
||||
connectservers:function(){
|
||||
if(this.connectbool){
|
||||
this.serverstatus(1);
|
||||
return;
|
||||
}
|
||||
var bo = this.showconfig(this.showconfigarr);
|
||||
if(bo)js.msg('wait','连接中...');
|
||||
},
|
||||
showconfig:function(a){
|
||||
if(this.connectbool){
|
||||
this.serverstatus(1);
|
||||
return false;
|
||||
}
|
||||
if(!a){
|
||||
this.serverstatus(3);
|
||||
return false;
|
||||
}
|
||||
var wsurl = jm.base64decode(a.wsurl),receid = a.recid;
|
||||
this.showconfigarr = a;
|
||||
if(isempt(wsurl) || wsurl.indexOf('ws')!=0){
|
||||
this.serverstatus(3);
|
||||
return false;
|
||||
}
|
||||
clearTimeout(this.relianshotime_time);
|
||||
websocketobj = new websocketClass({
|
||||
adminid:adminid,
|
||||
reimfrom:receid,
|
||||
wshost:wsurl,
|
||||
sendname:adminname,
|
||||
onerror:function(o,ws){
|
||||
reim.connectbool=false;
|
||||
reim.serverstatus(0);
|
||||
js.msg('msg','REIM无法连接服务器1<br><span id="lianmiaoshoetime"></span><a href="javascript:;" onclick="reim.connectservers()">[重连]</a>',0);
|
||||
reim.relianshotime(30);
|
||||
},
|
||||
onmessage:function(str){
|
||||
reim.connectbool=true;
|
||||
clearTimeout(reim.relianshotime_time);
|
||||
var a=js.decode(str);
|
||||
reim.receivemesb(a);
|
||||
},
|
||||
onopen:function(){
|
||||
reim.connectbool=true;
|
||||
reim.serverstatus(1);
|
||||
clearTimeout(reim.relianshotime_time);
|
||||
js.msg('none');
|
||||
reim.initnotify();
|
||||
},
|
||||
onclose:function(o,e){
|
||||
reim.connectbool=false;
|
||||
if(reim.otherlogin)return;
|
||||
reim.serverstatus(0);
|
||||
js.msg('msg','REIM连接已经断开了<br><span id="lianmiaoshoetime"></span><a href="javascript:;" onclick="reim.connectservers()">[重连]</a>',0);
|
||||
reim.relianshotime(30);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
},
|
||||
|
||||
loginexit:function(){
|
||||
js.confirm('确定要退出'+systitle+'吗?',function(lx){
|
||||
if(lx=='yes')reim.loginexits();
|
||||
});
|
||||
},
|
||||
loginexits:function(){
|
||||
if(!nwjsgui){
|
||||
window.close();
|
||||
}else{
|
||||
this.ajax(this.apiurl('login','loginexit'),{},function(ret){
|
||||
js.setoption('autologin', '0');
|
||||
js.location('?d=reim&a=login');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
serverstatus:function(lx){
|
||||
var s = '<font color="green">已连接</font>';s='';
|
||||
if(lx==0)s='<font color="red">未连接</font>'
|
||||
if(lx==2)s='<font color="#ff6600">在别处连接</font>'
|
||||
if(lx==3)s='<font color="blue">没服务端</font>';
|
||||
$('#reim_statusserver').html(s);
|
||||
},
|
||||
relianshotime:function(oi){
|
||||
clearTimeout(this.relianshotime_time);
|
||||
$('#lianmiaoshoetime').html('('+oi+'秒后重连)');
|
||||
if(oi<=0){
|
||||
this.connectservers();
|
||||
}else{
|
||||
this.relianshotime_time=setTimeout('reim.relianshotime('+(oi-1)+')',1000);
|
||||
}
|
||||
},
|
||||
|
||||
//服务端发消息调用opener.reim.serversend(a);
|
||||
serversend:function(a){
|
||||
if(!this.connectbool)return false;
|
||||
websocketobj.send(a);
|
||||
return true;
|
||||
},
|
||||
|
||||
//获取在线人员
|
||||
getonline:function(){
|
||||
this.serversend({'atype':'getonline'});
|
||||
},
|
||||
|
||||
//加载数据
|
||||
loadhistory:function(){
|
||||
this.loaddata('history');
|
||||
},
|
||||
reload:function(){
|
||||
this.initdata();
|
||||
},
|
||||
initdatas:function(){
|
||||
this.initbackd(this.bdats);
|
||||
},
|
||||
|
||||
//没有服务端定时去ajax读取。
|
||||
loadredata:function(){
|
||||
if(this.connectbool)return;
|
||||
this.ajax(this.apiurl('indexreim','ldata'),{type:'history','loaddt':jm.base64encode(this.lastloaddt)}, function(ret){
|
||||
var hist = js.decode(ret.json);
|
||||
reim.lastloaddt = ret.loaddt;
|
||||
reim.reloadhistory(hist);
|
||||
});
|
||||
},
|
||||
reloadhistory:function(a){
|
||||
var i,len=a.length,d;
|
||||
for(i=0;i<len;i++){
|
||||
d = a[i];d.form = 'ajax';
|
||||
if(d.sendid!=adminid)this.receivemesb(d);
|
||||
}
|
||||
},
|
||||
|
||||
initdata:function(){
|
||||
this.ajax(this.apiurl('indexreim','indexinit'),{}, function(ret){
|
||||
reim.bdats = ret;
|
||||
js.servernow = ret.loaddt;
|
||||
js.getsplit();
|
||||
reim.initbackd(ret);
|
||||
});
|
||||
},
|
||||
firstpid:0,
|
||||
initbackd:function(ret){
|
||||
if(!ret.userjson)return;
|
||||
this.lastloaddt = ret.loaddt;
|
||||
this.maindata.darr = js.decode(ret.deptjson);
|
||||
this.maindata.uarr = js.decode(ret.userjson);
|
||||
this.maindata.garr = js.decode(ret.groupjson);
|
||||
this.maindata.aarr = js.decode(ret.agentjson);
|
||||
this.maindata.harr = js.decode(ret.historyjson);
|
||||
this.firstpid = this.maindata.darr[0].pid;
|
||||
this.myip = ret.ip;
|
||||
this.showuser(this.maindata.uarr);
|
||||
this.adminmyrs = this.userarr[adminid];
|
||||
adminname = this.adminmyrs.name;
|
||||
adminface = this.adminmyrs.face;
|
||||
|
||||
this.showgroup(this.maindata.garr);
|
||||
this.showagent(this.maindata.aarr);
|
||||
this.showhistory(this.maindata.harr);
|
||||
|
||||
this.shownowci = 0;
|
||||
this.showconfig(ret.config);
|
||||
if(ret.editpass==0)this.editpass('请先修改密码后在使用','none');
|
||||
},
|
||||
loaddata:function(type){
|
||||
this.ajax(this.apiurl('indexreim','ldata'),{type:type}, function(ret){
|
||||
var hist = js.decode(ret.json);
|
||||
reim['show'+ret.type+''](hist);
|
||||
});
|
||||
},
|
||||
//显示历史聊天列表
|
||||
showhistory:function(a){
|
||||
var i,len=a.length;
|
||||
$('#historylist_tems').show();
|
||||
$('#historylist').html('');
|
||||
for(i=0;i<len;i++){
|
||||
this.showhistorys(a[i]);
|
||||
}
|
||||
},
|
||||
showhistorys:function(d,pad, lex){
|
||||
if(!d)return;
|
||||
var s,ty,o=$('#historylist'),d1,st,attr,stst,cont,cls,nastr;
|
||||
ty = d.type;
|
||||
if(ty=='user')d1=this.userarr[d.receid];
|
||||
if(ty=='group')d1=this.grouparr[d.receid];
|
||||
if(d1){
|
||||
d.name = d1.name;
|
||||
d.face = d1.face;
|
||||
}else if(!lex && ty=='user'){
|
||||
this.ajax(this.apiurl('indexreim','loadinfo'),{type:ty,receid:d.receid}, function(ret){
|
||||
if(!ret){
|
||||
console.error('无法读取到'+ty+','+d.receid+'的信息');
|
||||
}else{
|
||||
reim.showuser(ret);
|
||||
reim.showhistorys(d, pad, true);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
var num = ''+ty+'_'+d.receid+'';
|
||||
$('#history_'+num+'').remove();
|
||||
var stotal = 0;
|
||||
cont = jm.base64decode(d.cont);
|
||||
var ops = d.optdt.substr(11,5);
|
||||
if(d.optdt.indexOf(this.date)!=0)ops=d.optdt.substr(5,5);
|
||||
attr = 'oncontextmenu="return reim.historyright(this,event);" tsaid="'+d.receid+'" tsaype="'+d.type+'" ';
|
||||
st = d.stotal;if(st=='0')st='';
|
||||
stotal+=parseFloat(d.stotal);
|
||||
stst = '';
|
||||
cls = '';
|
||||
nastr= d.name;
|
||||
if(d.type=='user'){
|
||||
stst='uid="'+d.receid+'"';
|
||||
if(d1.online=='0')cls=' offline';
|
||||
}
|
||||
if(d.type=='group' && d1){
|
||||
if(d1.deptid=='1')nastr+=' <span class="reimlabel">全员</span>';
|
||||
if(d1.deptid>'1')nastr+=' <span class="reimlabel1">部门</span>';
|
||||
}
|
||||
s = '<div '+attr+' '+stst+' class="lists'+cls+'" rtype="hist" id="history_'+num+'" onclick="reim.openchat('+d.receid+',\''+ty+'\')">';
|
||||
s+='<table cellpadding="0" border="0" width="100%"><tr>';
|
||||
s+='<td style="padding-right:8px"><div style="height:34px;overflow:hidden"><img src="'+d.face+'"></div></td>';
|
||||
s+='<td align="left" width="100%"><div class="name">'+nastr+'</div><div class="huicont">'+cont+'</div></td>';
|
||||
s+='<td align="center" nowrap><span id="chatstotal_'+num+'" class="badge red">'+d.stotal+'</span><br><span style="color:#cccccc;font-size:10px">'+ops+'</span></td>';
|
||||
s+='</tr></table>';
|
||||
s+='</div>';
|
||||
if(!pad){o.append(s);}else{o.prepend(s)}
|
||||
$('#historylist_tems').hide();
|
||||
this.showbadge('chat');
|
||||
},
|
||||
|
||||
//在线离线设置
|
||||
setonline:function(online){
|
||||
$('div[uid]').addClass('offline');
|
||||
var onlies = online.split(','),i,uid;
|
||||
for(i=0;i<onlies.length;i++){
|
||||
uid=onlies[i];
|
||||
this.setonlines(uid, 1);
|
||||
}
|
||||
},
|
||||
setonlines:function(uid, on){
|
||||
var d = this.userarr[uid];
|
||||
if(on==1){
|
||||
$('div[uid='+uid+']').removeClass('offline');
|
||||
}else{
|
||||
$('div[uid='+uid+']').addClass('offline');
|
||||
}
|
||||
this.userarr[uid].online = on;
|
||||
this.maindata.uarr[d.i].online = on;
|
||||
},
|
||||
|
||||
historyright:function(o1,e){
|
||||
var rt = $(o1).attr('rtype');
|
||||
if(isempt(rt))return false;
|
||||
this.rightdivobj = o1;
|
||||
var d=[{name:'打开',lx:0}];
|
||||
if(rt.indexOf('agent')>-1){
|
||||
d.push({name:'打开窗口',lx:1});
|
||||
}
|
||||
if(rt.indexOf('hist')>-1){
|
||||
d.push({name:'删除此记录',lx:2});
|
||||
}
|
||||
this.righthistroboj.setData(d);
|
||||
this.righthistroboj.showAt(e.clientX-3,e.clientY-3);
|
||||
return false;
|
||||
},
|
||||
rightclick:function(d){
|
||||
var o1 = $(this.rightdivobj),lx=d.lx;
|
||||
var tsaid = o1.attr('tsaid'),
|
||||
tsayp = o1.attr('tsaype');
|
||||
if(lx==0){
|
||||
if(tsayp=='user')this.openuser(tsaid);
|
||||
if(tsayp=='group')this.opengroup(tsaid);
|
||||
}
|
||||
if(lx==2){
|
||||
o1.remove();
|
||||
var tst=$('#historylist').text();if(tst=='')$('#historylist_tems').show();
|
||||
this.ajax(this.apiurl('reim','delhistory'),{type:tsayp,gid:tsaid},false);
|
||||
}
|
||||
},
|
||||
|
||||
//打开聊天界面
|
||||
openchat:function(id,type){
|
||||
this.showbadge('chat',''+type+'_'+id+'', 0);
|
||||
if(type=='agent'){
|
||||
this.openagent(id);
|
||||
}else{
|
||||
openchat(id,type);
|
||||
}
|
||||
this.setyd(type,id);
|
||||
},
|
||||
opengroup:function(id){
|
||||
this.openchat(id, 'group');
|
||||
},
|
||||
openuser:function(id){
|
||||
this.openchat(id, 'user');
|
||||
},
|
||||
|
||||
//会话标识已读
|
||||
setyd:function(type,id){
|
||||
this.ajax(this.apiurl('reim','yiduall'),{type:type,gid:id},false);
|
||||
},
|
||||
|
||||
//切换聊天主界面隐藏显示
|
||||
mainclose:function(){
|
||||
$('#reim_main').toggle();
|
||||
this.showzhu();
|
||||
},
|
||||
//隐藏主界面
|
||||
hidezhu:function(){
|
||||
$('#topheaderid').hide();
|
||||
$('.topcenter').hide();
|
||||
$('#zhutable').hide();
|
||||
},
|
||||
//显示主界面
|
||||
showzhu:function(){
|
||||
$('#topheaderid').show();
|
||||
$('.topcenter').show();
|
||||
$('#zhutable').show();
|
||||
},
|
||||
//选择卡切换
|
||||
tabchagne:function(oi,o1){
|
||||
$('.headertab div').removeClass();
|
||||
o1.className = 'active';
|
||||
$('#reim_headercenter').find("div[tabdiv]").hide();
|
||||
$('#reim_headercenter').find("div[tabdiv='"+oi+"']").show();
|
||||
if(oi=='1')this.showdept(this.firstpid,0);
|
||||
},
|
||||
//加载群会话列表
|
||||
loadgroup:function(){
|
||||
this.loaddata('group');
|
||||
},
|
||||
|
||||
loadagent:function(){
|
||||
this.loaddata('agent');
|
||||
},
|
||||
showgroup:function(a){
|
||||
var i=0,len=a.length,s,d,o=$('#reim_showgroupdiv'),msg='';
|
||||
o.html('');
|
||||
for(i=0;i<len;i++){
|
||||
d = a[i];
|
||||
s = '<div style="padding-left:10px" id="group_'+d.id+'" onclick="reim.opengroup('+d.id+')"><img src="'+d.face+'" align="absmiddle">'+d.name+'';
|
||||
if(d.deptid=='1')s+=' <span class="reimlabel">全员</span>';
|
||||
if(d.deptid>'1')s+=' <span class="reimlabel1">部门</span>';
|
||||
s +='</div>';
|
||||
this.grouparr[d.id] = d;
|
||||
o.append(s);
|
||||
}
|
||||
},
|
||||
|
||||
//显示组织结构
|
||||
showdept:function(pid, xu){
|
||||
var i=0,len,s='',a,wfj,cls;
|
||||
var sv= '#showdept_'+pid+'';if(xu==0)sv='#showdept_0';
|
||||
var o = $(sv);
|
||||
var tx= o.text();
|
||||
if(tx){if(xu!=0){o.toggle();}return;}
|
||||
|
||||
len=this.maindata.uarr.length;
|
||||
for(i=0;i<len;i++){
|
||||
a=this.maindata.uarr[i];
|
||||
if(pid==a.deptid || a.deptidss.indexOf(','+pid+',')>-1){
|
||||
cls='offline';if(a.online==1)cls='';
|
||||
s='<div uid="'+a.id+'" class="'+cls+'" style="padding-left:'+(xu*20+10)+'px" onclick="reim.openuserzl('+a.id+')">';
|
||||
s+=' <img src="'+a.face+'" align="absmiddle"> '+a.name+' <font color="#888888">('+a.ranking+')<font>';
|
||||
s+='</div>';
|
||||
o.append(s);
|
||||
}
|
||||
}
|
||||
|
||||
len = this.maindata.darr.length
|
||||
for(i=0;i<len;i++){
|
||||
a=this.maindata.darr[i];
|
||||
if(pid==a.pid){
|
||||
wfj = 'icon-folder-close-alt';
|
||||
if(a.ntotal=='0')wfj='icon-file-alt';
|
||||
s='<div style="padding-left:'+(xu*20+10)+'px" onclick="reim.showdept('+a.id+','+(xu+1)+')">';
|
||||
s+=' <i class="'+wfj+'"></i> '+a.name+'';
|
||||
s+='</div>';
|
||||
s+='<span id="showdept_'+a.id+'"></span>';
|
||||
o.append(s);
|
||||
if(xu==0)this.showdept(a.id, xu+1);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
//显示用户
|
||||
showuser:function(a){
|
||||
var i=0,len=a.length,d;
|
||||
for(i=0;i<len;i++){
|
||||
d = a[i];
|
||||
d.i = i;
|
||||
d.online=0;
|
||||
this.maindata.uarr[i] = d;
|
||||
this.userarr[d.id] = d;
|
||||
}
|
||||
},
|
||||
|
||||
//显示用户信息
|
||||
openuserzl:function(id){
|
||||
var d=this.userarr[id];
|
||||
if(!d)return;
|
||||
if(isempt(d.tel))d.tel='';if(isempt(d.email))d.email='';
|
||||
if(isempt(d.sex))d.sex='?';
|
||||
var s = '<div>';
|
||||
s+='<div align="center" style="padding:10px;"><img id="myfacess" onclick="$(this).imgview()" src="'+d.face+'" height="80" width="80" style="border-radius:40px;border:1px #eeeeee solid">';
|
||||
if(id==adminid)s+='<br><a href="javascript:;" id="fupbgonet" onclick="reim.upfaceobj.click()" style="font-size:12px">修改头像</a>';
|
||||
s+='</div>';
|
||||
s+='<div style="line-height:25px;padding:10px;padding-left:20px;"><font color=#888888>姓名:</font>'+d.name+'<br><font color=#888888>部门:</font>'+d.deptallname+'<br><font color=#888888>职位:</font>'+d.ranking+'<br><font color=#888888>性别:</font>'+d.sex+'<br><font color=#888888>电话:</font>'+d.tel+'<br><font color=#888888>手机:</font>'+d.mobile+'<br><font color=#888888>邮箱:</font>'+d.email+'</div>';
|
||||
s+='</div>';
|
||||
js.tanbody('userziliao',''+d.name+'', 240,350,{
|
||||
html:s,
|
||||
btn:[{text:'发消息'}]
|
||||
});
|
||||
$('#userziliao_btn0').click(function(){
|
||||
reim.openuser(id);
|
||||
});
|
||||
if(id==adminid){
|
||||
this.upfaceobj=$.rockupload({inputfile:'upfacess',uptype:'image',
|
||||
urlparams:{noasyn:'yes'},
|
||||
onsuccess:function(f,str){
|
||||
var a=js.decode(str);
|
||||
if(!a.id)return;
|
||||
reim.saveface(a.id);
|
||||
},
|
||||
onchange:function(){
|
||||
$('#fupbgonet').html('上传中...');
|
||||
}
|
||||
});
|
||||
};
|
||||
},
|
||||
saveface:function(fid){
|
||||
this.ajax(this.apiurl('reim','changeface'),{id:fid},function(face){
|
||||
get('myface').src=face;
|
||||
get('myfacess').src=face;
|
||||
adminface=face;
|
||||
js.setoption('adminface', face);
|
||||
$('#fupbgonet').html('修改成功');
|
||||
});
|
||||
},
|
||||
|
||||
//显示应用
|
||||
showagent:function(a){
|
||||
var i=0,len=a.length,d,types,ty,o=$('#reim_showagetdiv'),s='',oi,atr;
|
||||
o.html('');
|
||||
var typearr = {};
|
||||
for(i=0;i<len;i++){
|
||||
d = a[i];
|
||||
d.i = i;
|
||||
this.agentarr[d.id] = d;
|
||||
if(!typearr[d.types])typearr[d.types]=[];
|
||||
typearr[d.types].push(d);
|
||||
}
|
||||
var col = 3,wd = 100/col;
|
||||
for(ty in typearr){
|
||||
len = typearr[ty].length;
|
||||
s='<div class="reim_agent_types">'+ty+'</div><table class="reim_agent_grid" width="100%"><tr>';
|
||||
oi = 0;
|
||||
for(i=0;i<len;i++){
|
||||
oi++;atr='';
|
||||
if(oi==1)atr='style="border-left:none"';
|
||||
if(oi==col)atr='style="border-right:none"';
|
||||
d = typearr[ty][i];
|
||||
s+='<td '+atr+' onclick="reim.openagent('+d.id+')" width="'+wd+'%">';
|
||||
s+='<div class="reim_agent_div">';
|
||||
s+=' <span id="agentstotal_'+d.num+'" class="badge red">'+d.stotal+'</span>';
|
||||
s+=' <div class="reim_agent_img"><img src="'+d.face+'"></div>';
|
||||
s+=' <div class="reim_agent_text">'+d.name+'</div>';
|
||||
s+='</div>';
|
||||
s+='</td>';
|
||||
if(oi%col==0){
|
||||
if(i<len-1)s+='</tr><tr>';
|
||||
oi=0;
|
||||
}
|
||||
}
|
||||
if(oi>0)for(i=oi;i<col;i++){
|
||||
atr='';
|
||||
if(i==col-1)atr='style="border-right:none"';
|
||||
s+='<td '+atr+' width="'+wd+'%"> </td>';
|
||||
}
|
||||
s+='</tr></table>';
|
||||
o.append(s);
|
||||
}
|
||||
this.showbadge('agent');
|
||||
},
|
||||
showbadge:function(slx,num,lx){
|
||||
var to = 0,chanu=''+slx+'stotal_'+num+'';
|
||||
$("span[id^='"+slx+"stotal_']").each(function(){
|
||||
var o1,vd,ids;
|
||||
ids= this.id;
|
||||
o1 = $(this);
|
||||
vd = parseFloat(o1.text());
|
||||
if(ids==chanu){
|
||||
if(lx==0){vd=0;o1.text('0');}
|
||||
if(lx==1){vd++;o1.text(''+vd+'');}
|
||||
}
|
||||
if(vd==0){o1.hide();}else{o1.show();}
|
||||
to+=vd;
|
||||
});
|
||||
var o1 = $('#'+slx+'_alltotal');
|
||||
o1.text(''+to+'');
|
||||
if(to==0){o1.hide();}else{o1.show();}
|
||||
var oi = parseFloat($('#agent_alltotal').text()) + parseFloat($('#chat_alltotal').text());
|
||||
nwjs.changeicon(oi); //托盘图标
|
||||
},
|
||||
|
||||
//打开应用
|
||||
openagent:function(id){
|
||||
var d = this.agentarr[id];
|
||||
this.showbadge('agent',d.num,0);
|
||||
var w = 1000,h=570,url = d.urlpc;
|
||||
if(isempt(url)){
|
||||
url = d.urlm;
|
||||
if(isempt(url)){
|
||||
url = '?d=we&m=ying&num='+d.num+''; //先默认用移动端
|
||||
}
|
||||
w = 320;
|
||||
}
|
||||
var jg = (url.indexOf('?')>-1)?'&':'?';
|
||||
url+=''+jg+'openfrom=reim';
|
||||
//考勤打卡
|
||||
if(d.num=='kqdaka'){
|
||||
this.opendaka();return;
|
||||
}
|
||||
js.open(url, w,h,'agent'+d.num+'');
|
||||
},
|
||||
|
||||
//考勤打卡
|
||||
opendaka:function(bo){
|
||||
var url = '?d=reim&m=ying&a=daka',w = 550;h=300;
|
||||
js.open(url, w,h,'agentkqdaka',{},{icon:'images/adddk.png'});
|
||||
},
|
||||
|
||||
//显示到会话列表上
|
||||
addhistory:function(lx,id,sot,cont,opt,sne,name,face){
|
||||
if(!sne)sne='';
|
||||
if(sne)sne=jm.base64encode(sne+':');
|
||||
if(lx!='group')sne='';
|
||||
var d={type:lx,receid:id,stotal:sot,cont:sne+cont,optdt:opt};
|
||||
if(name)d.name = name;
|
||||
if(face)d.face = face;
|
||||
this.showhistorys(d, true);
|
||||
},
|
||||
editpass:function(bt,cse){
|
||||
if(!bt)bt='修改密码';
|
||||
if(!cse)cse='';
|
||||
js.tanbody('winiframe',bt,260,300,{
|
||||
html:'<div style="height:250px;overflow:hidden"><iframe src="" name="openinputiframe" width="100%" height="100%" frameborder="0"></iframe></div>',
|
||||
bbar:'none',
|
||||
closed:cse
|
||||
});
|
||||
openinputiframe.location.href='?m=index&d=we&a=editpass&hideheader=true&ofrom=reim';
|
||||
},
|
||||
//别的地方登录
|
||||
otherlogins:function(){
|
||||
this.otherlogin = true;
|
||||
var msg='已在别的地方连接了';
|
||||
js.msg('success', msg, -1);
|
||||
this.serverstatus(2);
|
||||
},
|
||||
|
||||
//服务端接收到推送消息
|
||||
receivemesb:function(d, lob){
|
||||
var lx=d.type,sendid=d.adminid,num,face,ops=false,msg='',ot,ots,garr,tits,gid;
|
||||
if(!sendid)sendid = d.sendid;
|
||||
if(lx=='offoline'){
|
||||
this.otherlogins();
|
||||
return;
|
||||
}
|
||||
if(lx=='getonline'){
|
||||
this.setonline(d.online);
|
||||
return;
|
||||
}
|
||||
var a = this.userarr[sendid];
|
||||
if(a){
|
||||
d.sendname=a.name;
|
||||
d.face = a.face;
|
||||
}else if(!lob){
|
||||
this.ajax(this.apiurl('indexreim','loadinfo'),{type:'user',receid:sendid}, function(ret){
|
||||
if(!ret){
|
||||
console.error('无法读取到'+sendid+'的信息');
|
||||
}else{
|
||||
reim.showuser(ret);
|
||||
reim.receivemesb(d, true);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
gid = d.gid;
|
||||
if(lx == 'user' || lx == 'group'){
|
||||
num = ''+lx+'_'+sendid+'';
|
||||
if(lx == 'group')num = ''+lx+'_'+gid+'';
|
||||
ops = js.openrun(num, 'recemess', d);
|
||||
|
||||
if(lx == 'group'){
|
||||
garr= this.grouparr[gid];
|
||||
if(!garr){
|
||||
this.loadgroup();
|
||||
garr={face:'images/group.png'};
|
||||
}
|
||||
face= garr.face;
|
||||
}
|
||||
this.setonlines(sendid,1);//说明是在线的
|
||||
var title = document.title+'消息';
|
||||
if(ops){
|
||||
ops.focus();
|
||||
}else{
|
||||
if(lx == 'user'){
|
||||
msg = '人员['+d.sendname+'],发来一条信息';
|
||||
notifyobj.showpopup(msg,{icon:d.face,sendid:sendid,title:title,rand:num,click:function(b){
|
||||
reim.openuser(b.sendid);
|
||||
return true;
|
||||
}});
|
||||
}
|
||||
if(lx == 'group'){
|
||||
if(!d.gname)d.gname = d.name;
|
||||
msg = '人员['+d.sendname+'],发来一条信息,来自['+d.gname+']';
|
||||
if(d.form=='ajax')d.sendname='';
|
||||
notifyobj.showpopup(msg,{icon:garr.face,gid:gid,title:title,rand:num,click:function(b){
|
||||
reim.opengroup(b.gid);
|
||||
return true;
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ot = $('#chatstotal_'+num+'');ots=ot.text();if(ots=='')ots='0';
|
||||
if(!ops)ots = parseFloat(ots)+1;
|
||||
|
||||
if(lx=='user')this.addhistory(lx,sendid,ots,d.cont,d.optdt);
|
||||
if(lx=='group')this.addhistory(lx,gid,ots,d.cont,d.optdt,d.sendname);
|
||||
}
|
||||
|
||||
//应用的通知提醒
|
||||
if(lx == 'agent'){
|
||||
garr = this.agentarr[gid];
|
||||
num = 'agent_'+gid+'';
|
||||
if(!garr){
|
||||
this.loadagent();
|
||||
garr={face:'images/logo.png',pid:0};
|
||||
}
|
||||
msg = ""+jm.base64decode(d.cont)+"";
|
||||
tits = d.title;
|
||||
if(!tits)tits = d.gname;
|
||||
notifyobj.showpopup(msg,{icon:garr.face,title:tits,gid:gid,rand:'agent_'+gid+'',url:d.url,click:function(b){
|
||||
if(b.url){
|
||||
js.open(b.url,760,500);
|
||||
return true;
|
||||
}else{
|
||||
//im.openagent(b.gid);
|
||||
return false;
|
||||
}
|
||||
}});
|
||||
|
||||
ot = $('#chatstotal_'+num+'');ots=ot.text();if(ots=='')ots='0';
|
||||
if(!ops)ots = parseFloat(ots)+1;
|
||||
this.addhistory(lx,gid,ots,d.cont,d.optdt,'', tits, garr.face);
|
||||
}
|
||||
|
||||
if(lx == 'loadgroup'){
|
||||
this.loadgroup();
|
||||
}
|
||||
},
|
||||
|
||||
//通知设置
|
||||
initnotify:function(){
|
||||
var lx=notifyobj.getaccess();
|
||||
if(lx!='ok'){
|
||||
js.msg('msg','为了可及时收到信息通知 <br>请开启提醒,<span class="zhu cursor" onclick="reim.indexsyscog()">[开启]</span>',-1);
|
||||
}
|
||||
},
|
||||
indexsyscogs:function(){
|
||||
var str = notifyobj.getnotifystr('reim.indexsyscogss()');
|
||||
return '桌面通知提醒'+str+'';
|
||||
},
|
||||
indexsyscogss:function(){
|
||||
notifyobj.opennotify(function(){
|
||||
$('#indexsyscog_msg').html(reim.indexsyscogs());
|
||||
});
|
||||
},
|
||||
getsound:function(){
|
||||
var lx = js.getoption('soundcog'),chs=false;
|
||||
if(lx=='')lx='1';
|
||||
if(lx==1)chs=true;
|
||||
return chs;
|
||||
},
|
||||
setsound:function(o1){
|
||||
var lx=(o1.checked)?'1':'2';
|
||||
js.setoption('soundcog', lx);
|
||||
notifyobj.setsound(o1.checked);
|
||||
},
|
||||
indexsyscog:function(){
|
||||
var chs= (this.getsound())?'checked':'';
|
||||
var s='<div style="height:160px;overflow:auto;padding:5px 10px">';
|
||||
s+='<div style="padding:5px 0px;" id="indexsyscog_msg">'+this.indexsyscogs()+'</div>';
|
||||
s+='<div style="padding:5px 0px;border-top:1px #eeeeee solid"><label><input '+chs+' onclick="reim.setsound(this)" type="checkbox">新信息声音提示</label></div>';
|
||||
if(nwjsgui){
|
||||
var ksj=js.getoption('kuaijj','Q');
|
||||
var strw='ABCEDFGHIJKLMNOPQRSTUVWYZ',s1,cls1='';
|
||||
s+='<div style="padding:5px 0px;border-top:1px #eeeeee solid">主窗口快捷键:Ctrl+Alt+<select onchange="nwjs.changekuai(this)">';
|
||||
for(var i=0;i<strw.length;i++){
|
||||
s1= strw.substr(i,1);
|
||||
cls1='';if(ksj==s1){cls1='selected';}
|
||||
s+='<option '+cls1+' value="'+s1+'">'+s1+'</option>';
|
||||
}
|
||||
s+='</select></div>';
|
||||
var ips = nwjs.getipmac();
|
||||
s+='<div style="padding:5px 0px;border-top:1px #eeeeee solid">我局域网IP:'+ips.ip+'</div>';
|
||||
s+='<div style="padding:5px 0px;border-top:1px #eeeeee solid">我的MAC地址:'+ips.mac+'</div>';
|
||||
}else{
|
||||
|
||||
}
|
||||
s+='<div style="padding:5px 0px;border-top:1px #eeeeee solid">网络IP:'+this.myip+'</div>';
|
||||
s+='</div>';
|
||||
js.tanbody('syscogshow','REIM设置',240,100,{html:s});
|
||||
},
|
||||
|
||||
//搜索联系人/会话/应用
|
||||
searchss:function(){
|
||||
clearTimeout(this.searchsstime);
|
||||
this.searchsstime=setTimeout('reim.searchssss()',500);
|
||||
if(!this.searchright)this.searchright=$.rockmenu({
|
||||
data:[],iconswh:20,
|
||||
itemsclick:function(d){
|
||||
reim.searchclick(d.type,d.id);
|
||||
}
|
||||
});
|
||||
},
|
||||
searchclick:function(ty,id){
|
||||
if(ty=='user')this.openuser(id);
|
||||
if(ty=='group')this.opengroup(id);
|
||||
if(ty=='agent')this.openagent(id);
|
||||
},
|
||||
searchssss:function(){
|
||||
var o = $('#reim_keysou'),val=strreplace(o.val());
|
||||
var d=[];
|
||||
if(val==''){
|
||||
this.searchright.hide();
|
||||
return;
|
||||
}
|
||||
val=val.toLowerCase();
|
||||
var off=o.offset(),sid,a,s1;
|
||||
for(sid in this.userarr){
|
||||
a=this.userarr[sid];
|
||||
if(a.name.indexOf(val)>-1 || a.pingyin.indexOf(val)==0 || a.deptname.indexOf(val)>-1 || a.ranking.indexOf(val)>-1){
|
||||
s1=''+a.name+'<font color=#888888>('+a.ranking+')</font>';
|
||||
d.push({name:s1,id:a.id,icons:a.face,type:'user'});
|
||||
}
|
||||
}
|
||||
for(sid in this.grouparr){
|
||||
a=this.grouparr[sid];
|
||||
if(a.name.indexOf(val)>-1){
|
||||
s1=''+a.name+'<font color=#888888>(会话)</font>';
|
||||
d.push({name:s1,id:a.id,icons:a.face,type:'group'});
|
||||
}
|
||||
}
|
||||
for(sid in this.agentarr){
|
||||
a=this.agentarr[sid];
|
||||
if(a.name.indexOf(val)>-1){
|
||||
s1=''+a.name+'<font color=#888888>(应用)</font>';
|
||||
d.push({name:s1,id:a.id,icons:a.face,type:'agent'});
|
||||
}
|
||||
}
|
||||
if(d.length==0){
|
||||
this.searchright.hide();
|
||||
return;
|
||||
}
|
||||
this.searchright.setData(d);
|
||||
this.searchright.showAt(off.left+1,off.top+40,$('#reim_headercenter').width()-2);
|
||||
},
|
||||
|
||||
//创建会话
|
||||
creategroup:function(){
|
||||
js.prompt('创建会话','请输入会话名称:',function(lx,v){
|
||||
if(lx=='yes'){
|
||||
if(!v){js.msg('msg','没有输入会话名称');return false;}
|
||||
js.msg('wait','创建中...');
|
||||
reim.ajax(reim.apiurl('reim','createlun'),{val:jm.base64encode(v)}, function(da){
|
||||
js.msg('success','创建成功,请打开会话窗口邀请人员加入');
|
||||
reim.loadgroup();
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
},
|
||||
|
||||
//退出会话
|
||||
exitgroup:function(gid){
|
||||
this.loadgroup();
|
||||
//$('#history_group_'+gid+'').remove();
|
||||
}
|
||||
};
|
||||
1701
js/reim_xin.js
Normal file
1701
js/reim_xin.js
Normal file
File diff suppressed because it is too large
Load Diff
2439
js/reim_xina.js
Normal file
2439
js/reim_xina.js
Normal file
File diff suppressed because it is too large
Load Diff
78
js/rmb.js
Normal file
78
js/rmb.js
Normal file
@@ -0,0 +1,78 @@
|
||||
function AmountInWords(dValue, maxDec)
|
||||
{
|
||||
// 验证输入金额数值或数值字符串:
|
||||
dValue = dValue.toString().replace(/,/g, ""); dValue = dValue.replace(/^0+/, ""); // 金额数值转字符、移除逗号、移除前导零
|
||||
if (dValue == "") { return "零元整"; } // (错误:金额为空!)
|
||||
else if (isNaN(dValue)) { return "错误:金额不是合法的数值!"; }
|
||||
|
||||
var minus = ""; // 负数的符号“-”的大写:“负”字。可自定义字符,如“(负)”。
|
||||
var CN_SYMBOL = ""; // 币种名称(如“人民币”,默认空)
|
||||
if (dValue.length > 1)
|
||||
{
|
||||
if (dValue.indexOf('-') == 0) { dValue = dValue.replace("-", ""); minus = "负"; } // 处理负数符号“-”
|
||||
if (dValue.indexOf('+') == 0) { dValue = dValue.replace("+", ""); } // 处理前导正数符号“+”(无实际意义)
|
||||
}
|
||||
|
||||
// 变量定义:
|
||||
var vInt = ""; var vDec = ""; // 字符串:金额的整数部分、小数部分
|
||||
var resAIW; // 字符串:要输出的结果
|
||||
var parts; // 数组(整数部分.小数部分),length=1时则仅为整数。
|
||||
var digits, radices, bigRadices, decimals; // 数组:数字(0~9——零~玖);基(十进制记数系统中每个数字位的基是10——拾,佰,仟);大基(万,亿,兆,京,垓,杼,穰,沟,涧,正);辅币 (元以下,角/分/厘/毫/丝)。
|
||||
var zeroCount; // 零计数
|
||||
var i, p, d; // 循环因子;前一位数字;当前位数字。
|
||||
var quotient, modulus; // 整数部分计算用:商数、模数。
|
||||
|
||||
// 金额数值转换为字符,分割整数部分和小数部分:整数、小数分开来搞(小数部分有可能四舍五入后对整数部分有进位)。
|
||||
var NoneDecLen = (typeof(maxDec) == "undefined" || maxDec == null || Number(maxDec) < 0 || Number(maxDec) > 5); // 是否未指定有效小数位(true/false)
|
||||
parts = dValue.split('.'); // 数组赋值:(整数部分.小数部分),Array的length=1则仅为整数。
|
||||
if (parts.length > 1)
|
||||
{
|
||||
vInt = parts[0]; vDec = parts[1]; // 变量赋值:金额的整数部分、小数部分
|
||||
|
||||
if(NoneDecLen) { maxDec = vDec.length > 5 ? 5 : vDec.length; } // 未指定有效小数位参数值时,自动取实际小数位长但不超5。
|
||||
var rDec = Number("0." + vDec);
|
||||
rDec *= Math.pow(10, maxDec); rDec = Math.round(Math.abs(rDec)); rDec /= Math.pow(10, maxDec); // 小数四舍五入
|
||||
var aIntDec = rDec.toString().split('.');
|
||||
if(Number(aIntDec[0]) == 1) { vInt = (Number(vInt) + 1).toString(); } // 小数部分四舍五入后有可能向整数部分的个位进位(值1)
|
||||
if(aIntDec.length > 1) { vDec = aIntDec[1]; } else { vDec = ""; }
|
||||
}
|
||||
else { vInt = dValue; vDec = ""; if(NoneDecLen) { maxDec = 0; } }
|
||||
if(vInt.length > 44) { return "错误:金额值太大了!整数位长【" + vInt.length.toString() + "】超过了上限——44位/千正/10^43(注:1正=1万涧=1亿亿亿亿亿,10^40)!"; }
|
||||
|
||||
// 准备各字符数组 Prepare the characters corresponding to the digits:
|
||||
digits = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"); // 零~玖
|
||||
radices = new Array("", "拾", "佰", "仟"); // 拾,佰,仟
|
||||
bigRadices = new Array("", "万", "亿", "兆", "京", "垓", "杼", "穰" ,"沟", "涧", "正"); // 万,亿,兆,京,垓,杼,穰,沟,涧,正
|
||||
decimals = new Array("角", "分", "厘", "毫", "丝"); // 角/分/厘/毫/丝
|
||||
|
||||
resAIW = ""; // 开始处理
|
||||
|
||||
// 处理整数部分(如果有)
|
||||
if (Number(vInt) > 0)
|
||||
{
|
||||
zeroCount = 0;
|
||||
for (i = 0; i < vInt.length; i++)
|
||||
{
|
||||
p = vInt.length - i - 1; d = vInt.substr(i, 1); quotient = p / 4; modulus = p % 4;
|
||||
if (d == "0") { zeroCount++; }
|
||||
else
|
||||
{
|
||||
if (zeroCount > 0) { resAIW += digits[0]; }
|
||||
zeroCount = 0; resAIW += digits[Number(d)] + radices[modulus];
|
||||
}
|
||||
if (modulus == 0 && zeroCount < 4) { resAIW += bigRadices[quotient]; }
|
||||
}
|
||||
resAIW += "元";
|
||||
}
|
||||
|
||||
// 处理小数部分(如果有)
|
||||
for (i = 0; i < vDec.length; i++) { d = vDec.substr(i, 1); if (d != "0") { resAIW += digits[Number(d)] + decimals[i]; } }
|
||||
|
||||
// 处理结果
|
||||
if (resAIW == "") { resAIW = "零" + "元"; } // 零元
|
||||
if (vDec == "") { resAIW += "整"; } // ...元整
|
||||
resAIW = CN_SYMBOL + minus + resAIW; // 人民币/负......元角分/整
|
||||
var len = resAIW.length;
|
||||
if(resAIW.substr(len-1)=='角')resAIW+='整';
|
||||
return resAIW;
|
||||
}
|
||||
81
js/worker.js
Normal file
81
js/worker.js
Normal file
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* 网址:www.rockoa.com
|
||||
* 异步url使用
|
||||
*/
|
||||
|
||||
var queue = {
|
||||
addqueuearr:[],
|
||||
yunoi:0,
|
||||
yunbool:false,
|
||||
callback:false,
|
||||
|
||||
//添加返回对应序号
|
||||
add:function(cans){
|
||||
if(!cans)cans={};
|
||||
var url = cans.url;
|
||||
if(!url)return -1;
|
||||
cans.url = url;
|
||||
this.addqueuearr.push(cans);
|
||||
if(!this.yunbool)this.runqueue(this.yunoi);//开始运行
|
||||
return this.addqueuearr.length-1;
|
||||
},
|
||||
//运行
|
||||
runqueue:function(i){
|
||||
this.yunbool = true;
|
||||
var da = this.addqueuearr[i];
|
||||
if(!da)return;
|
||||
$.ajax({
|
||||
type:'get',url:da.url,
|
||||
success:function(str){
|
||||
if(da.success)da.success(str, da, i);
|
||||
queue.nextqueue();
|
||||
},
|
||||
error:function(e){
|
||||
var str = '处理出错:'+e.responseText+''
|
||||
if(da.error)da.error(str, da, i);
|
||||
queue.nextqueue();
|
||||
}
|
||||
});
|
||||
},
|
||||
clearqueue:function(){
|
||||
this.addqueuearr=[];
|
||||
this.yunoi=0;
|
||||
this.yunbool=false;
|
||||
this.callback=false;
|
||||
},
|
||||
nextqueue:function(){
|
||||
this.addqueuearr[this.yunoi]=false;
|
||||
var len = this.addqueuearr.length;
|
||||
var oi = this.yunoi+1;
|
||||
this.yunoi=oi;
|
||||
if(oi<len){
|
||||
this.runqueue(oi);
|
||||
}else{
|
||||
this.yunbool=false;
|
||||
this.callback=false;
|
||||
}
|
||||
},
|
||||
//发送一组地址:
|
||||
addlist:function(darr,funb, lxs){
|
||||
var oi=0,zong=darr.length,i,bers;
|
||||
if(!lxs)lxs='处理';
|
||||
this.callback=false;
|
||||
if(!funb)funb=function(){};
|
||||
if(zong>0)js.msg('wait',''+lxs+'中(<span id="chulsss">0%</span>)...',0);
|
||||
for(i=0;i<zong;i++){
|
||||
bers = function(str){
|
||||
oi++;
|
||||
var bili = (oi/zong)*100;
|
||||
$('#chulsss').html(''+js.float(bili)+'%');
|
||||
if(bili==100){
|
||||
js.msg('success',''+lxs+'完成');
|
||||
funb();
|
||||
}
|
||||
if(queue.callback){
|
||||
queue.callback(str, bili);
|
||||
}
|
||||
};
|
||||
queue.add({url:darr[i],success:bers,error:bers});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user