信呼OA版本v2.3.8
This commit is contained in:
72
web/res/js/autograph.js
Normal file
72
web/res/js/autograph.js
Normal file
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* 签名调用函数
|
||||
*/
|
||||
function autographClass(cans){
|
||||
var me = this;
|
||||
this.fid = 'absss';
|
||||
if(cans)for(var i in cans)this[i] = cans[i];
|
||||
this.qmimgstr = '';
|
||||
this.onsuccess= function(){}
|
||||
this.create=function(){
|
||||
var w = 300,h=200;
|
||||
if(ismobile==0){w=450;h=250}
|
||||
js.tanbody('qianming','请在空白区域写上签名',w,h,{
|
||||
html:'<div style="height:'+(h-50)+'px;overflow:hidden"><iframe src="" name="qianmingiframe" width="100%" height="100%" frameborder="0"></iframe></div>',
|
||||
btn:[{text:'确定签名'},{text:'重写'}]
|
||||
});
|
||||
qianmingiframe.location.href='index.php?m=view&a=autograph&d=main&ism='+ismobile+'';
|
||||
$('#qianming_btn0').click(function(){
|
||||
me.qianmingok();
|
||||
});
|
||||
$('#qianming_btn1').click(function(){
|
||||
me.qianmingre();
|
||||
});
|
||||
}
|
||||
this.qianmingok=function(){
|
||||
var str = qianmingiframe.autographok();
|
||||
if(str){
|
||||
this.showqian(str);
|
||||
js.tanclose('qianming');
|
||||
}
|
||||
}
|
||||
this.showqian=function(str){
|
||||
var s = '<div><img id="imgqianming_'+this.fid+'" src="'+str+'" height="90"></div>';
|
||||
this.qmimgstr = str;
|
||||
$('#imgqianming_'+this.fid+'').parent().remove();
|
||||
$('#graphview_'+this.fid+'').append(s);
|
||||
if(form(this.fid))form(this.fid).value = str;
|
||||
this.onsuccess(str);
|
||||
}
|
||||
this.qianmingre=function(){
|
||||
qianmingiframe.autographre();
|
||||
|
||||
}
|
||||
this.getqmimgstr=function(){
|
||||
return this.qmimgstr;
|
||||
}
|
||||
|
||||
//引入
|
||||
this.imports=function(){
|
||||
js.msg('wait','引入中...');
|
||||
js.ajax('?a=qianyin&m=flowopt&d=flow&ajaxbool=true',{},function(a){
|
||||
if(a.success){
|
||||
js.msg('success', '引入成功');
|
||||
$('#imgqianming').remove();
|
||||
var dataUrl = a.data;
|
||||
me.showqian(dataUrl);
|
||||
}else{
|
||||
js.msg('msg', a.msg);
|
||||
}
|
||||
},'get,json',function(s){
|
||||
js.msg('msg','操作失败');
|
||||
});
|
||||
}
|
||||
|
||||
this.clear=function(){
|
||||
$('#imgqianming_'+this.fid+'').parent().remove();
|
||||
this.qmimgstr = '';
|
||||
if(form(this.fid))form(this.fid).value = '';
|
||||
}
|
||||
}
|
||||
7
web/res/js/header.js
Normal file
7
web/res/js/header.js
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* Copyright (c) 2016 rainrock (xh829.com)
|
||||
* Date:2016-01-01
|
||||
*/
|
||||
|
||||
676
web/res/js/jquery-changeuser.js
vendored
Normal file
676
web/res/js/jquery-changeuser.js
vendored
Normal file
@@ -0,0 +1,676 @@
|
||||
/**
|
||||
edittable 选择人员插件
|
||||
caratename:chenxihu
|
||||
caratetime:2014-04-06 21:40:00
|
||||
email:admin@rockoa.com
|
||||
homepage:www.rockoa.com
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
function _getstyles(){
|
||||
var s='<style>.changeuserlist div.listsss{padding:10px; background:white;border-bottom:1px #eeeeee solid;cursor:default}.changeuserlist td{color:#333333}.changeuserlist div:active{ background:#f1f1f1}.changeuserbotton{height:30px;width:50px; background:#d9534f;color:white;font-size:14px;border:none;padding:0px;margin:0px;line-height:20px;cursor:default;opacity:1;outline:none;border-radius:5px}.changeuserbotton:active{color:white;border:none;opacity:0.8}.changeuserxuan span{background:white;border:1px #cccccc solid;padding:3px;border-radius:5px;font-size:12px;margin-left:5px;cursor:pointer}</style>';
|
||||
return s;
|
||||
}
|
||||
|
||||
function chnageuser(sobj, options){
|
||||
var obj = sobj;
|
||||
var rand = ''+parseInt(Math.random()*9999999)+'';
|
||||
var me = this;
|
||||
this.rand = rand;
|
||||
this.changesel = '';
|
||||
this.firstpid = 0;
|
||||
|
||||
this._init = function(){
|
||||
for(var i in options)this[i]=options[i];
|
||||
this.oveob = false;
|
||||
if(this.showview!='' && get(this.showview))this.oveob=true;
|
||||
|
||||
if(!this.oveob){
|
||||
window.onhashchange=function(){
|
||||
var has = location.hash;
|
||||
if(has.indexOf('#changeuser')==-1)me.hide();
|
||||
}
|
||||
js.location('#changeuser');
|
||||
}
|
||||
|
||||
this.userarr = [];
|
||||
this.deptarr = [];
|
||||
this.grouparr= [];
|
||||
if(isempt(this.changerange) && isempt(this.changerangeno)){
|
||||
var us = js.getoption('userjson');
|
||||
if(us)this.userarr = js.decode(us);
|
||||
|
||||
us = js.getoption('deptjson');
|
||||
if(us)this.deptarr = js.decode(us);
|
||||
us = js.getoption('groupjson');
|
||||
if(us)this.grouparr = js.decode(us);
|
||||
}
|
||||
this.show();
|
||||
};
|
||||
|
||||
this.creatediv=function(){
|
||||
var type='checkbox';
|
||||
if(this.changetype.indexOf('check')==-1)type='radio';
|
||||
this.inputtype = type;
|
||||
$('#changeuser_'+rand+'').remove();
|
||||
var hei = $(window).height(),jhei=50,atts='position:fixed;';
|
||||
if(this.oveob){
|
||||
hei = $('#'+this.showview+'').height();
|
||||
atts='';
|
||||
}
|
||||
var s='<div style="'+atts+'z-index:100;width:100%;height:100%;overflow:hidden;left:0px;top:0px; background:white" id="changeuser_'+rand+'">';
|
||||
if(this.titlebool){
|
||||
s+='<div style="height:50px;line-height:50px;text-align:center; background:white;border-bottom:1px #cccccc solid"><b>'+this.title+'</b></div>';
|
||||
jhei+=50;
|
||||
}
|
||||
if(this.changetype.indexOf('user')>=0){
|
||||
s+='<div style="height:50px;overflow:hidden;border-bottom:1px #cccccc solid"><table width="100%" style="background:none"><tr><td width="100%" height="50" style="background:none"><input id="changekey_'+this.rand+'" placeholder="部门/姓名/职位" style="height:30px;border:none;background:none;width:100%;margin:0px 10px;outline:none"></td><td><button style="background:none;border:none;color:#666666" class="changeuserbotton" id="changesoubtn_'+this.rand+'" type="button" >查找</button></td></tr></table></div>';
|
||||
jhei+=50;
|
||||
}
|
||||
s+='<div style="-webkit-overflow-scrolling:touch;height:'+(hei-jhei)+'px;overflow:auto; background:#f1f1f1" class="changeuserlist">';
|
||||
s+='<span id="showdiv'+rand+'_0"></span>';
|
||||
s+='<span id="showdiv'+rand+'_search"></span>';
|
||||
s+='</div>';
|
||||
var s3= '<input id="changeboxs_'+rand+'" style="width:18px;height:18px;" align="absmiddle" type="checkbox" >';
|
||||
if(type!='checkbox1')s3='';
|
||||
if(1==1){
|
||||
s3='<select id="changesel_'+rand+'" style="height:30px;border:none;background:none;outline:none">';
|
||||
s3+='<option value="">默认显示</option>';
|
||||
if(this.changetype.indexOf('user')>=0)s3+='<option value="1">仅限显示人员</option>';
|
||||
if(this.changetype.indexOf('dept')>=0)s3+='<option value="2">仅限显示部门</option>';
|
||||
if(this.changetype.indexOf('user')>=0)s3+='<option value="3">显示组</option>';
|
||||
s3+='</select>';
|
||||
}
|
||||
if(type=='checkbox'){
|
||||
s+='<div class="changeuserxuan" style="padding:5px;border-right:1px #cccccc solid;border-top:1px #cccccc solid;line-height:30px;position:absolute;bottom:49px;background:white;"><font style="cursor:pointer" id="yixuanbtn_'+rand+'">∨</font><font id="yixuan_'+rand+'"></font></div>';
|
||||
}
|
||||
var cold = window['maincolor'];if(!cold)cold='#1389D3';
|
||||
s+='<div style="height:50px;line-height:50px;border-top:1px #cccccc solid" align="right"><table width="100%" style="background:none"><tr><td width="10" nowrap> </td><td width="80%">'+s3+'</td><td><button style="width:70px;border:none" type="button" id="changereload_'+rand+'" class="changeuserbotton" >刷新数据</button></td><td width="10" nowrap> </td><td><button class="changeuserbotton" type="button" id="changecancl_'+rand+'" >取消</button></td><td width="10" nowrap> </td><td height="50"><button style="background:'+cold+';" id="changeok_'+rand+'" type="button" class="changeuserbotton">确定</button></td><td width="10" nowrap> </td></tr></table></div>';
|
||||
s+=_getstyles();
|
||||
s+='</div>';
|
||||
if(atts==''){
|
||||
$('#'+this.showview+'').html(s);
|
||||
}else{
|
||||
obj.append(s);
|
||||
}
|
||||
|
||||
$('#changecancl_'+this.rand+'').click(function(){
|
||||
me._clickcancel();
|
||||
});
|
||||
$('#changereload_'+this.rand+'').click(function(){
|
||||
me._loaddata();
|
||||
});
|
||||
$('#changeok_'+this.rand+'').click(function(){
|
||||
me.queding();
|
||||
});
|
||||
$('#changesoubtn_'+this.rand+'').click(function(){
|
||||
me._searchkey(true);
|
||||
});
|
||||
$('#changekey_'+this.rand+'').keydown(function(e){
|
||||
me._searchkeys(e)
|
||||
});
|
||||
$('#changeboxs_'+this.rand+'').click(function(){
|
||||
me._changboxxuan(this)
|
||||
});
|
||||
$('#changesel_'+this.rand+'').change(function(){
|
||||
me._changesel(this)
|
||||
});
|
||||
if(type=='checkbox'){
|
||||
$('#yixuanbtn_'+rand+'').click(function(){
|
||||
$('#yixuan_'+rand+'').toggle();
|
||||
});
|
||||
this._initmrvel();
|
||||
}
|
||||
rchanguserclick=function(o1){
|
||||
me._changexuan(o1);
|
||||
}
|
||||
rchanguserquxiao=function(o1){
|
||||
me._changequxiao(o1);
|
||||
}
|
||||
};
|
||||
this.showlist=function(pid,oi){
|
||||
var type=this.inputtype,hw=24;
|
||||
var s='',ssu='',s1='';
|
||||
var sel = this.changesel;
|
||||
var dob = this.changetype.indexOf('dept')==-1;
|
||||
var uob = this.changetype.indexOf('user')>=0;
|
||||
this.fid = 1;
|
||||
|
||||
if(sel=='1'){
|
||||
ssu = this._showuser(0,'',type,sel);
|
||||
}else if(sel=='2'){
|
||||
s = this._showdept(pid,oi,s1,type,sel,dob,uob);
|
||||
}else if(sel=='3'){
|
||||
s = this._showgorup(type);
|
||||
}else{
|
||||
s1='<div style="width:'+(hw*oi)+'px"></div>';
|
||||
s = this._showdept(pid,oi,s1,type,sel,dob,uob);
|
||||
if(uob){
|
||||
ssu+=this._showuser(pid,s1,type,sel);
|
||||
}
|
||||
}
|
||||
var xud = (oi==0)?'0' : pid;
|
||||
$('#showdiv'+rand+'_'+xud+'').html(ssu+s).attr('show','true');
|
||||
if(sel==''){
|
||||
if(oi==0)this.showlist(this.fid, 1);
|
||||
$('#showdiv'+rand+'_0 [deptxu]').unbind('click').click(function(){
|
||||
me._deptclicks(this);
|
||||
});
|
||||
}
|
||||
if(sel=='3'){
|
||||
$('#showdiv'+rand+'_0 [groupxu]').unbind('click').click(function(){
|
||||
me._groupclicks(this);
|
||||
});
|
||||
}
|
||||
};
|
||||
this._showuser=function(pid,s1,type,sel){
|
||||
var a,len,i,ssu='',dids,zoi=0,ids,chk='';
|
||||
a=this.userarr;
|
||||
len=a.length;
|
||||
for(i=0;i<len;i++){
|
||||
dids = ','+a[i].deptids+',';
|
||||
if(
|
||||
((a[i].deptid==pid || dids.indexOf(','+pid+',')>-1 || sel=='1') && sel!='3')
|
||||
||
|
||||
(sel=='3' && (','+a[i].groupname+',').indexOf(','+pid+',')>-1)//显示组下人员
|
||||
){
|
||||
chk='';
|
||||
if(get('show'+rand+'_u'+a[i].id+''))chk='checked ';
|
||||
ssu+='<div class="listsss">';
|
||||
ssu+='<table style="background:none" width="100%"><tr><td>'+s1+'</td><td width="100%"><img align="absmiddle" height="24" height="24" src="'+a[i].face+'"> '+a[i].name+'<span style="font-size:12px;color:#888888">('+a[i].ranking+')</span></td><td><input name="changeuserinput_'+rand+'" xxu="'+i+'" xls="u" xname="'+a[i].name+'" value="'+a[i].id+'" style="width:18px;height:18px;" '+chk+'onclick="rchanguserclick(this)" type="'+type+'"></td></tr></table>';
|
||||
ssu+='</div>';
|
||||
zoi++;
|
||||
if(zoi>=200)break;
|
||||
}
|
||||
}
|
||||
return ssu;
|
||||
};
|
||||
this._showdept=function(pid,oi,s1,type,sel,dob,uob){
|
||||
var a,len,i,wwj,s2='',s='';
|
||||
a=this.deptarr;
|
||||
len=a.length;
|
||||
for(i=0;i<len;i++){
|
||||
if(a[i].pid==pid || sel=='2'){
|
||||
this.fid = a[i].id;
|
||||
wjj= 'images/files.png';
|
||||
if(a[i].ntotal=='0' && uob)wjj= 'images/file.png';
|
||||
s2 = '<input name="changeuserinput_'+rand+'" xls="d" xname="'+a[i].name+'" xu="'+i+'" value="'+a[i].id+'" style="width:18px;height:18px;" onclick="rchanguserclick(this)" type="'+type+'">';
|
||||
if(dob)s2='';
|
||||
if(s2!='' && !this._isdeptcheck(a[i]))s2='';
|
||||
s+='<div class="listsss">';
|
||||
s+='<table style="background:none" width="100%"><tr><td>'+s1+'</td><td deptxu="'+i+'_'+oi+'" width="100%"><img align="absmiddle" height="20" height="20" src="'+wjj+'"> '+a[i].name+'</td><td>'+s2+'</td></tr></table>';
|
||||
s+='</div>';
|
||||
s+='<span show="false" id="showdiv'+rand+'_'+a[i].id+'"></span>';
|
||||
}
|
||||
}
|
||||
return s;
|
||||
};
|
||||
this._showgorup=function(type){
|
||||
var a,len,i,ssu='',s1;
|
||||
a=this.grouparr;
|
||||
len=a.length;
|
||||
for(i=0;i<len;i++){
|
||||
s1 = '<input name="changeuserinput_'+rand+'" xls="g" xname="'+a[i].name+'" value="'+a[i].id+'" style="width:18px;height:18px;" onclick="rchanguserclick(this)" type="'+type+'">';
|
||||
if(this.changetype.indexOf('deptuser')==-1)s1='';
|
||||
ssu+='<div class="listsss">';
|
||||
ssu+='<table style="background:none" width="100%"><tr><td></td><td groupxu="'+i+'" width="100%"><img align="absmiddle" height="24" height="24" src="images/group.png"> '+a[i].name+' <span style="font-size:12px;color:#888888">('+a[i].usershu+'人)</span></td><td>'+s1+'</td></tr></table>';
|
||||
ssu+='</div>';
|
||||
ssu+='<span show="false" id="showgroup'+rand+'_'+a[i].id+'"></span>';
|
||||
}
|
||||
return ssu;
|
||||
};
|
||||
this._groupclicks=function(o){
|
||||
if(this.changetype.indexOf('user')==-1)return;
|
||||
var sxu = $(o).attr('groupxu');
|
||||
var a = this.grouparr[sxu];
|
||||
var o1 = $('#showgroup'+rand+'_'+a.id+'');
|
||||
var lx = o1.attr('show');
|
||||
if(lx=='false'){
|
||||
var s1='<div style="width:24px"></div>';
|
||||
var s = this._showuser(a.id,s1,this.inputtype, this.changesel);
|
||||
o1.html(s).attr('show','true');
|
||||
}else{
|
||||
o1.toggle();
|
||||
}
|
||||
};
|
||||
this._changexuan=function(o1){
|
||||
if(this.inputtype!='checkbox')return;
|
||||
var o = $(o1),xls=o.attr('xls'),val=o.val();
|
||||
var sid = 'show'+rand+'_'+xls+''+val+'';
|
||||
if(o1.checked){
|
||||
var str='<span id="'+sid+'" xls="'+xls+'" xvl="'+val+'" onclick="rchanguserquxiao(this)">';
|
||||
str+='<input name="yixuancheck_'+rand+'" value="'+val+'" align="absmiddle" xls="'+xls+'" type="checkbox" checked xxu="" xname="'+o.attr('xname')+'">'+o.attr('xname')+'';
|
||||
str+='</span>';
|
||||
if(!get(sid))$('#yixuan_'+rand+'').append(str);
|
||||
}else{
|
||||
$('#'+sid+'').remove();
|
||||
}
|
||||
};
|
||||
this._changequxiao=function(o1){
|
||||
var o = $(o1),xls=o.attr('xls'),xvl=o.attr('xvl');
|
||||
o.remove();
|
||||
$("input[name='changeuserinput_"+rand+"'][xls='"+xls+"'][value='"+xvl+"']").attr('checked', false);
|
||||
};
|
||||
this._initmrvel=function(){
|
||||
var sid ='',sna='',i,str='',xls,val;
|
||||
if(this.idobj)sid=this.idobj.value;
|
||||
if(this.nameobj)sna=this.nameobj.value;
|
||||
if(!sid || !sna)return;
|
||||
var sida = sid.split(','),snaa=sna.split(',');
|
||||
var ob1=this.changetype.indexOf('dept')>-1,ob2=this.changetype.indexOf('user')>-1;
|
||||
for(i=0;i<sida.length;i++){
|
||||
xls=sida[i].substr(0,1);
|
||||
if(!isNaN(xls)){
|
||||
if(ob1)xls='d';
|
||||
if(ob2)xls='u';
|
||||
}
|
||||
val=sida[i].replace('u','').replace('g','').replace('d','');
|
||||
str+='<span id="show'+rand+'_'+xls+''+val+'" xls="'+xls+'" xvl="'+val+'" onclick="rchanguserquxiao(this)">';
|
||||
str+='<input name="yixuancheck_'+rand+'" value="'+val+'" align="absmiddle" xls="'+xls+'" type="checkbox" checked xxu="" xname="'+snaa[i]+'">'+snaa[i]+'';
|
||||
str+='</span>';
|
||||
}
|
||||
$('#yixuan_'+rand+'').html(str);
|
||||
};
|
||||
this._changesel=function(o1){
|
||||
var val = o1.value;
|
||||
this.changesel = val;
|
||||
this.showlist(this.firstpid, 0);
|
||||
};
|
||||
this._searchkeys=function(e){
|
||||
clearTimeout(this._searchkeystime);
|
||||
this._searchkeystime=setTimeout(function(){
|
||||
me._searchkey(false);
|
||||
},500);
|
||||
};
|
||||
this._isdeptcheck=function(a){
|
||||
if(this.inputtype=='checkbox' && this.changetype.indexOf('user')>=0 && this.changetype.indexOf('dept')>=0){
|
||||
var stotal,i,nstotal=0,len=this.userarr.length,spath;
|
||||
stotal = parseFloat(a.stotal);
|
||||
for(i=0;i<len;i++){
|
||||
spath = this.userarr[i].deptpath;
|
||||
if(spath.indexOf('['+a.id+']')>=0)nstotal++;
|
||||
}
|
||||
return nstotal>=stotal;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
},
|
||||
this._clickcheckbox=function(o1){
|
||||
var o = $(o1),xu,a,stotal,i,nstotal=0,len=this.userarr.length,spath;
|
||||
if(o.attr('xls')!='d')return;
|
||||
xu = parseFloat(o.attr('xu'));
|
||||
a = this.deptarr[xu];
|
||||
stotal = parseFloat(a.stotal);
|
||||
for(i=0;i<len;i++){
|
||||
spath = this.userarr[i].deptpath;
|
||||
if(spath.indexOf('['+a.id+']')>=0)nstotal++;
|
||||
}
|
||||
if(nstotal<stotal){
|
||||
o1.checked=false;
|
||||
o1.disabled=true;
|
||||
js.msg('msg','无权选择部门['+a.name+']');
|
||||
}
|
||||
},
|
||||
this._searchkey = function(bo){
|
||||
var key = $('#changekey_'+this.rand+'').val(),s='',a=[],d=[],len,i;
|
||||
a=this.userarr;
|
||||
len=a.length;
|
||||
if(key!='')for(i=0;i<len;i++)if(a[i].name.indexOf(key)>-1 || a[i].pingyin.indexOf(key)==0 || a[i].deptname.indexOf(key)>-1 || a[i].ranking.indexOf(key)>-1){a[i].xu=i;d.push(a[i])};
|
||||
len = d.length;
|
||||
for(i=0;i<len;i++){
|
||||
s+='<div class="listsss">';
|
||||
s+='<table style="background:none" width="100%"><tr><td></td><td width="100%"><img align="absmiddle" height="24" height="24" src="'+d[i].face+'"> '+d[i].name+'<span style="font-size:12px;color:#888888">('+d[i].ranking+')</span></td><td><input name="changeuserinput_'+rand+'_soukey" xxu="'+d[i].xu+'" xls="u" xname="'+d[i].name+'" value="'+d[i].id+'" style="width:18px;height:18px;" onclick="rchanguserclick(this)" type="'+this.inputtype+'"></td></tr></table>';
|
||||
s+='</div>';
|
||||
}
|
||||
if(bo && s=='' && key!='')js.msg('msg','无相关['+key+']的记录', 2);
|
||||
$('#showdiv'+rand+'_search').html(s);
|
||||
var o1 = $('#showdiv'+rand+'_0');
|
||||
if(s==''){o1.show();}else{o1.hide();}
|
||||
};
|
||||
this._clickcancel=function(){
|
||||
if(!this.oveob)history.back();
|
||||
this.hide();
|
||||
};
|
||||
this.hide=function(){
|
||||
$('#changeuser_'+rand+'').remove();
|
||||
this.oncancel();
|
||||
};
|
||||
this.show=function(){
|
||||
this.creatediv();
|
||||
if(this.deptarr.length>0){
|
||||
this.firstpid = this.deptarr[0].pid;
|
||||
this.showlist(this.firstpid,0);
|
||||
}else{
|
||||
this._loaddata();
|
||||
}
|
||||
};
|
||||
this._deptclicks=function(o){
|
||||
var sxu = $(o).attr('deptxu').split('_');
|
||||
var a = this.deptarr[sxu[0]];
|
||||
var o1 = $('#showdiv'+rand+'_'+a.id+'');
|
||||
var lx = o1.attr('show');
|
||||
if(lx=='false'){
|
||||
this.showlist(a.id, parseFloat(sxu[1])+1);
|
||||
}else{
|
||||
o1.toggle();
|
||||
}
|
||||
};
|
||||
|
||||
this._loaddata=function(){
|
||||
var o1 = $('#showdiv'+rand+'_0'),url;
|
||||
o1.html('<div align="center" style="padding:30px"><img src="images/mloading.gif"></div>');
|
||||
var url = 'index.php?a=deptuserjson&m=dept&d=system&ajaxbool=true&changerange='+this.changerange+'&changerangeno='+this.changerangeno+'>ype=change';
|
||||
$.getJSON(url, function(ret){
|
||||
if(ret.code==200){
|
||||
ret = ret.data;
|
||||
me._loaddatashow(ret);
|
||||
}else{
|
||||
o1.html(ret.msg);
|
||||
}
|
||||
});
|
||||
};
|
||||
this._loaddatashow=function(ret){
|
||||
if(isempt(this.changerange) && isempt(this.changerangeno)){
|
||||
js.setoption('deptjson', ret.deptjson);
|
||||
js.setoption('userjson', ret.userjson);
|
||||
js.setoption('groupjson', ret.groupjson);
|
||||
}
|
||||
this.userarr = js.decode(ret.userjson);
|
||||
this.deptarr = js.decode(ret.deptjson);
|
||||
this.grouparr = js.decode(ret.groupjson);
|
||||
this.firstpid = 0;
|
||||
if(this.deptarr[0])this.firstpid = this.deptarr[0].pid;
|
||||
this.showlist(this.firstpid, 0);
|
||||
};
|
||||
this._changboxxuan=function(os){
|
||||
var ns= 'changeuserinput_'+rand+'';
|
||||
if($('#showdiv'+rand+'_search').html()!='')ns+='_soukey';
|
||||
var ob = os.checked,o=$("input[name='"+ns+"']"),i;
|
||||
for(i=0;i<o.length;i++)o[i].checked=ob;
|
||||
};
|
||||
this.queding=function(){
|
||||
var ns= 'changeuserinput_'+rand+'';
|
||||
if($('#showdiv'+rand+'_search').html()!='')ns+='_soukey';
|
||||
if(this.inputtype=='checkbox')ns='yixuancheck_'+rand+'';
|
||||
var o = $("input[name='"+ns+"']");
|
||||
var i,len=o.length,o1,xls,xna,xal,xxu,sid='',sna='',ob1=this.changetype.indexOf('dept')==-1,ob2=this.changetype.indexOf('user')==-1,xzarr=[];
|
||||
var ob3=ob1 || ob2;
|
||||
for(i=0;i<len;i++){
|
||||
o1 = $(o[i]);
|
||||
if(o[i].checked){
|
||||
xls= o1.attr('xls');
|
||||
xna= o1.attr('xname');
|
||||
xxu= o1.attr('xxu');
|
||||
xal= o1.val();
|
||||
if(ob3)xls='';
|
||||
sid+=','+xls+''+xal+'';
|
||||
sna+=','+xna+'';
|
||||
if(!isempt(xxu))xzarr.push(this.userarr[parseFloat(xxu)]);
|
||||
}
|
||||
}
|
||||
if(sid!=''){
|
||||
sid=sid.substr(1);
|
||||
sna=sna.substr(1);
|
||||
}
|
||||
if(this.idobj)this.idobj.value=sid;
|
||||
if(this.nameobj){
|
||||
this.nameobj.value=sna;
|
||||
this.nameobj.focus();
|
||||
}
|
||||
if(!this.oveob)history.back();
|
||||
this.onselect(sna, sid, xzarr);
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function selectdata(sobj, options){
|
||||
var obj = sobj;
|
||||
var rand = ''+parseInt(Math.random()*9999999)+'';
|
||||
var me = this;
|
||||
this.rand = rand;
|
||||
this.ismobile = false;
|
||||
this.selvalue = '';
|
||||
|
||||
this._init = function(){
|
||||
for(var i in options)this[i]=options[i];
|
||||
if(typeof(ismobile) && ismobile==1)this.ismobile = true;
|
||||
this._showcreate();
|
||||
};
|
||||
this._showcreate = function(){
|
||||
var ws = '350px';
|
||||
if(this.ismobile)ws='90%';
|
||||
var cold = window['maincolor'];if(!cold)cold='#1389D3';
|
||||
var s='<div style="width:100%;height:100%;overflow:hidden;left:0px;top:0px; background:rgba(0,0,0,0.3);position:fixed;z-index:11" id="selectdata_'+rand+'">';
|
||||
s+='<div tsid="main" id="mints_'+rand+'" style="position:absolute;top:30%; background:white;width:'+ws+';box-shadow:0px 0px 10px rgba(0,0,0,0.3);border-radius:5px">';
|
||||
s+=' <div onmousedown="js.move(\'mints_'+rand+'\')" style="line-height:50px;color:'+cold+';font-size:16px;border-bottom:1px #eeeeee solid;font-weight:bold;"> '+this.title+'</div>';
|
||||
s+=' <div style="height:40px;overflow:hidden;border-bottom:1px #cccccc solid;"><table width="100%" style="background:none"><tr><td><select id="selxuan_'+this.rand+'" style="width:120px;border:none;background:none;display:none"><option value="">选择所有</option></select></td><td width="100%" height="40"><input id="changekey_'+this.rand+'" placeholder="搜索关键词" style="height:30px;border:none;background:none;width:100%;margin:0px 10px;outline:none"></td><td><button style="background:none;color:#666666;" class="changeuserbotton" id="changesoubtn_'+this.rand+'" type="button" >查找</button></td></tr></table></div>';
|
||||
s+=' <div style="-webkit-overflow-scrolling:touch;height:300px;overflow:auto; background:#f1f1f1" id="selectlist_'+rand+'" class="changeuserlist"></div>';
|
||||
s+=' <div style="height:50px;line-height:50px;border-top:1px #cccccc solid;" align="right"><table width="100%" style="background:none"><tr><td width="10" nowrap> </td><td width="80%"><font color="#888888" tsid="count"></font></td><td><button type="button" id="changereload_'+rand+'" class="changeuserbotton">刷新</button></td><td width="10" nowrap> </td><td><button class="changeuserbotton" type="button" id="changecancl_'+rand+'">取消</button></td><td width="10" nowrap> </td><td height="50"><button style="background:'+cold+';" id="changeok_'+rand+'" type="button" class="changeuserbotton">确定</button></td><td width="10" nowrap> </td></tr></table></div>';
|
||||
s+='</div>';
|
||||
s+='</div>';
|
||||
s+=_getstyles();
|
||||
$('body').append(s);
|
||||
this.showdata(this.data);
|
||||
var o = this._getobj('main');
|
||||
var l = ($(window).width()-o.width())*0.5,t = ($(window).height()-o.height())*0.5;
|
||||
o.css({'left':''+l+'px','top':''+t+'px'});
|
||||
$('#changecancl_'+this.rand+'').click(function(){
|
||||
me._clickcancel();
|
||||
});
|
||||
$('#changeok_'+this.rand+'').click(function(){
|
||||
me.queding();
|
||||
});
|
||||
$('#changereload_'+this.rand+'').click(function(){
|
||||
me.reload();
|
||||
});
|
||||
$('#changesoubtn_'+this.rand+'').click(function(){
|
||||
me._searchkey(true);
|
||||
});
|
||||
$('#changekey_'+this.rand+'').keydown(function(e){
|
||||
me._searchkeys(e)
|
||||
});
|
||||
$('#changekey_'+this.rand+'').keyup(function(e){
|
||||
me._searchkeys(e)
|
||||
});
|
||||
};
|
||||
this._getobj=function(lx){
|
||||
var o = $('#selectdata_'+rand+'').find("[tsid='"+lx+"']");
|
||||
return o;
|
||||
};
|
||||
this._clickcancel=function(){
|
||||
this.hide();
|
||||
};
|
||||
this.hide=function(){
|
||||
$('#selectdata_'+rand+'').remove();
|
||||
this.oncancel();
|
||||
};
|
||||
this.queding=function(){
|
||||
var ns= 'changeuserinput_'+rand+'';
|
||||
var o = $("input[name='"+ns+"']");
|
||||
var i,len=o.length,o1,xna,xu,xal,sid='',sna='',seld=[];
|
||||
for(i=0;i<len;i++){
|
||||
o1 = $(o[i]);
|
||||
if(o[i].checked){
|
||||
xna= o1.attr('xname');
|
||||
xu = parseFloat(o1.attr('xu'));
|
||||
if(this.checked){
|
||||
seld.push(this.nowdata[xu]);
|
||||
}else{
|
||||
seld=this.nowdata[xu];
|
||||
}
|
||||
xal= o1.val();
|
||||
sid+=','+xal+'';
|
||||
sna+=','+xna+'';
|
||||
}
|
||||
}
|
||||
if(sid!=''){
|
||||
sid=sid.substr(1);
|
||||
sna=sna.substr(1);
|
||||
}
|
||||
if(this.idobj)this.idobj.value=sid;
|
||||
if(this.nameobj){
|
||||
this.nameobj.value=sna;
|
||||
this.nameobj.focus();
|
||||
}
|
||||
this.onselect(seld,sna, sid);
|
||||
this.hide();
|
||||
};
|
||||
this.showdata=function(a,inb){
|
||||
if(!a)a=[];
|
||||
this.showselectdata(a.selectdata);
|
||||
if(a.rows)a = a.rows;
|
||||
var s='',len=a.length,s1='';
|
||||
if(len==0){
|
||||
s='<div align="center" style="margin-top:30px;color:#cccccc;font-size:16px">无记录</div>';
|
||||
}else{
|
||||
s = this.showhtml(a);
|
||||
s1='共'+len+'条';
|
||||
}
|
||||
this._getobj('count').html(s1);
|
||||
var o = $('#selectlist_'+rand+'');
|
||||
o.html(s);
|
||||
if(!inb && len==0)this.loaddata();
|
||||
};
|
||||
this.seldatsse=[];
|
||||
this.showselectdata=function(da){
|
||||
if(this.showselbo || !da)return;
|
||||
var o = get('selxuan_'+this.rand+'');
|
||||
js.setselectdata(o,da,'value');
|
||||
if(da.length>0){
|
||||
this.showselbo=true;
|
||||
}
|
||||
$(o).change(function(){
|
||||
me._changeselval(this);
|
||||
}).show();
|
||||
};
|
||||
this._changeselval=function(o){
|
||||
this.selvalue = o.value;
|
||||
this.loaddata(o.value);
|
||||
};
|
||||
this.showhtml=function(a,ks){
|
||||
this.nowdata = a;
|
||||
var i,len=a.length,s='',s2,s1='',atr,oldvel='',d;
|
||||
if(this.nameobj)oldvel=this.nameobj.value;
|
||||
if(this.idobj)oldvel=this.idobj.value;
|
||||
var type='checkbox',ched='';
|
||||
if(!ks)ks=0;
|
||||
if(!this.checked)type='radio';
|
||||
oldvel = ','+oldvel+',';
|
||||
for(i=ks;i<len && i<this.maxshow+ks;i++){
|
||||
ched='';
|
||||
d = a[i];
|
||||
if(!isempt(d.value) && oldvel.indexOf(','+d.value+',')>-1)ched='checked';
|
||||
if(d.disabled)ched+=' disabled';
|
||||
s2 = '<input xu="'+i+'" '+ched+' name="changeuserinput_'+rand+'" xname="'+d.name+'" value="'+d.value+'" style="width:18px;height:18px;" align="absmiddle" type="'+type+'">';
|
||||
atr = '';
|
||||
if(d.padding)atr='style="padding-left:'+d.padding+'px"';
|
||||
if(!d.iconswidth)d.iconswidth=18;
|
||||
if(d.iconsimg)s2+=' <img align="absmiddle" src="'+d.iconsimg+'" height="'+d.iconswidth+'" width="'+d.iconswidth+'">';
|
||||
s+='<div class="listsss" '+atr+'><label>'+s2+' '+d.name+'';
|
||||
if(d.subname)s+=' <span style="font-size:12px;color:#888888">('+d.subname+')</span>';
|
||||
s+='</label></div>';
|
||||
}
|
||||
if(len>i){
|
||||
s+='<div align="center" id="moreadd_'+rand+'" style="padding:10px;font-size:12px;color:#aaaaaa;cursor:pointer">还有'+(len-i)+'条,点我加载</div>';
|
||||
setTimeout(function(){$('#moreadd_'+rand+'').click(function(){me.moregegd(i);});},10);
|
||||
}
|
||||
return s;
|
||||
};
|
||||
this.moregegd=function(i1){
|
||||
$('#moreadd_'+rand+'').remove();
|
||||
var s = this.showhtml(this.nowdata, i1);
|
||||
if(s)$('#selectlist_'+rand+'').append(s);
|
||||
};
|
||||
this.reload=function(){
|
||||
this.loaddata(this.selvalue);
|
||||
};
|
||||
this.loaddata=function(svel){
|
||||
var url = this.url;
|
||||
if(svel)url+='&selvalue='+svel+'';
|
||||
if(url=='')return;
|
||||
$('#selectlist_'+rand+'').html('<div align="center" style="margin-top:30px"><img src="images/mloading.gif"></div>');
|
||||
$.ajax({
|
||||
type:'get',dataType:'json',url:url,
|
||||
success:function(ret){
|
||||
me.data = ret;
|
||||
me.onloaddata(ret);
|
||||
me.showdata(ret, true);
|
||||
},
|
||||
error:function(e){
|
||||
$('#selectlist_'+rand+'').html('加载错误:<br><textarea style="width:95%;height:60%;color:red">'+e.responseText+'</textarea>');
|
||||
}
|
||||
});
|
||||
};
|
||||
this._searchkeys=function(e){
|
||||
clearTimeout(this._searchkeystime);
|
||||
this._searchkeystime=setTimeout(function(){
|
||||
me._searchkey(false);
|
||||
},500);
|
||||
};
|
||||
this._searchkey = function(bo){
|
||||
var key = $('#changekey_'+this.rand+'').val(),a=[],d=[],d1,len,i,oi=0,s;
|
||||
a=this.data;
|
||||
if(a.rows)a=a.rows;
|
||||
len=a.length;if(len==0)return;
|
||||
if(key)key = key.toLowerCase();
|
||||
if(key!='')for(i=0;i<len;i++){
|
||||
d1 = a[i];
|
||||
if(d1.name.indexOf(key)>-1 || d1.name.toLowerCase().indexOf(key)>-1 || d1.value==key || (d1.subname && d1.subname.indexOf(key)>-1)){
|
||||
d.push(d1);
|
||||
oi++;
|
||||
if(oi>20)break;//最多显示搜索
|
||||
}
|
||||
}
|
||||
len = d.length;
|
||||
if(len==0){
|
||||
if(key){
|
||||
s='<div align="center" style="margin-top:30px;color:#cccccc;font-size:16px">无相关['+key+']的记录</div>';
|
||||
}else{
|
||||
s=this.showhtml(a);
|
||||
}
|
||||
}else{
|
||||
s=this.showhtml(d);
|
||||
}
|
||||
$('#selectlist_'+rand+'').html(s);
|
||||
if(bo && len==0 && key!='')js.msg('msg','无相关['+key+']的记录', 2);
|
||||
};
|
||||
}
|
||||
|
||||
$.fn.chnageuser = function(options){
|
||||
var defaultVal = {
|
||||
'title' : '请选择...',
|
||||
'titlebool':true,
|
||||
'showview':'',
|
||||
'changerange':'', //从哪些人员中选择
|
||||
'changerangeno':'', //不从哪些人选择
|
||||
'changetype' : 'user',
|
||||
'idobj':false,'nameobj':false,
|
||||
'onselect':function(){},
|
||||
'oncancel':function(){}
|
||||
};
|
||||
var can = $.extend({}, defaultVal, options);
|
||||
var funcls = new chnageuser($(this), can);
|
||||
funcls._init();
|
||||
return funcls;
|
||||
};
|
||||
|
||||
$.selectdata = function(options){
|
||||
var defaultVal = {
|
||||
'showview': '',
|
||||
'title' : '请选择...',
|
||||
'maxshow' : 100, //最多显示防止卡死浏览器
|
||||
'data' : [], 'url' : '',
|
||||
'checked' : false,
|
||||
'idobj' : false, 'nameobj':false,
|
||||
'onselect': function(){},
|
||||
'oncancel': function(){},
|
||||
'onloaddata':function(){}
|
||||
};
|
||||
var can = $.extend({}, defaultVal, options);
|
||||
var funcls = new selectdata(false, can);
|
||||
funcls._init();
|
||||
return funcls;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
206
web/res/js/jquery-imgview.js
vendored
Normal file
206
web/res/js/jquery-imgview.js
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
* 图片查看
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* Copyright (c) 2016 rainrock (xh829.com)
|
||||
* Date:2016-01-01
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
function get(id){return document.getElementById(id)};
|
||||
|
||||
function funclass(opts, obj){
|
||||
if(!opts)opts={};
|
||||
var me = this;
|
||||
this.ismobile = false;
|
||||
this.downbool = true;
|
||||
this.dushu = 0;
|
||||
this.onloadsuccess=function(){};
|
||||
this.init=function(){
|
||||
for(var i in opts)this[i]=opts[i];
|
||||
if(obj)this.url=obj.attr('src');
|
||||
this.mheiht = document.body.scrollHeight,sed=$(window).height();
|
||||
if(this.mheiht<sed)this.mheiht=sed;
|
||||
this.showview();
|
||||
};
|
||||
this.remove=function(){
|
||||
$('#imgview_main').remove();
|
||||
};
|
||||
this.showview=function(){
|
||||
var s='<div id="imgview_main" style="position:absolute;left:0px;top:0px;width:100%;height:100%;z-index:800">';
|
||||
s+='<div style="position:absolute;z-index:0;left:0px;top:0px;width:100%;height:'+this.mheiht+'px;background-color:rgba(0,0,0,0.6)" id="imgview_mask"></div>';
|
||||
s+='<span onclick="$(this).parent().remove()" style="position:fixed;z-index:2;top:2px;right:5px;color:white"><i class="icon-remove"></i></span>';
|
||||
s+='<div id="imgview_span" style="position:fixed;z-index:1;left:47%;top:47%;overflow:hidden;color:white">';
|
||||
s+=' <div id="imgview_spanmask" style="position:absolute;z-index:1;left:0px;top:0px;background-color:rgba(0,0,0,0);width:100%;height:100%;cursor:move;user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-khtml-user-select:none;"></div>';
|
||||
s+=' <img style="position:absolute;z-index:0;left:0px;top:0px" id="imgview_spanimg" width="100%" height="100%" src="images/mloading.gif" >';
|
||||
s+='</div>';
|
||||
s+='<div style="position:fixed;z-index:2;left:0px;bottom:0px;text-align:center;color:white;width:100%;font-size:20px;background-color:rgba(0,0,0,0.2);height:40px;line-height:40px;overflow:hidden"><i style="cursor:pointer" id="imgview_zoom-out" class="icon-zoom-out" title="缩小"></i> <span id="imgview_nowbili" style="font-size:14px">100%</span> <i style="cursor:pointer" class="icon-zoom-in" title="放大" id="imgview_zoom-in"></i>';
|
||||
s+=' <i style="cursor:pointer" class="icon-move" title="原始大小" id="imgview_zoom-move"></i>';
|
||||
if(!this.ismobile && this.downbool)s+=' <a target="_blank" download="" style="color:white;font-size:20px" href="'+this.url+'"><i style="cursor:pointer" class="icon-download-alt" title="下载"></i></a>';
|
||||
s+=' <i style="cursor:pointer" class="icon-refresh" title="旋转90度" id="imgview_zoom-refresh"></i>';
|
||||
s+='</div>';
|
||||
s+='</div>';
|
||||
$('body').append(s);
|
||||
$('#imgview_mask').click(function(){
|
||||
$('#imgview_main').remove();
|
||||
});
|
||||
this.showez(32,32,0);
|
||||
var img = new Image();
|
||||
img.src = this.url;
|
||||
img.onload = function(){
|
||||
if(get('imgview_main')){
|
||||
me.showez(this.width,this.height, 1);
|
||||
try{
|
||||
$('#imgview_span').mousewheel(function(e){
|
||||
me.bilixxx(e.deltaY*0.1);
|
||||
});}catch(e){}
|
||||
me.rotate(me.dushu);
|
||||
me.initmove();
|
||||
}
|
||||
me.onloadsuccess(this);
|
||||
}
|
||||
img.onerror=function(e){
|
||||
$('#imgview_span').html('无图');
|
||||
}
|
||||
$('#imgview_zoom-out').click(function(){
|
||||
me.bilixxx(-0.1);
|
||||
});
|
||||
$('#imgview_zoom-in').click(function(){
|
||||
me.bilixxx(0.1);
|
||||
});
|
||||
$('#imgview_zoom-refresh').click(function(){
|
||||
me.clickrotate();
|
||||
});
|
||||
$('#imgview_zoom-move').click(function(){
|
||||
me.bl=1;
|
||||
me.rotate(0);
|
||||
me.bilixxx(0);
|
||||
});
|
||||
};
|
||||
this.showez=function(w, h, lx){
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
var zw = $(window).width(),zh=$(window).height();
|
||||
var wm = zw-50,wh = zh-50;
|
||||
var bl= 1,nw=w,nh=h;
|
||||
if(w>wm){
|
||||
bl=wm/w;
|
||||
nh = h*bl;
|
||||
}
|
||||
if(nh>wh){
|
||||
bl= wh/h;
|
||||
}
|
||||
this.showbl(bl,lx);
|
||||
};
|
||||
this.showbl=function(bl,lx){
|
||||
this.bl = bl;
|
||||
$('#imgview_nowbili').html(''+parseInt(bl*100)+'%');
|
||||
var zw = $(window).width(),zh=$(window).height();
|
||||
var nw = this.width*this.bl,nh=this.height*this.bl;
|
||||
var l = (zw-nw)*0.5,t = (zh-nh)*0.5;
|
||||
var arr = {left:''+l+'px',top:''+t+'px',width:''+nw+'px',height:''+nh+'px'};
|
||||
var o1 = $('#imgview_span');
|
||||
if(lx!=2){
|
||||
if(lx==1)get('imgview_spanimg').src=this.url;
|
||||
o1.css(arr);
|
||||
}else{
|
||||
o1.stop();
|
||||
o1.animate(arr,300);
|
||||
}
|
||||
};
|
||||
this.bilixxx=function(lx){
|
||||
var bl = this.bl+lx;
|
||||
if(bl<0)bl=0.05;
|
||||
if(bl>3)bl=3;
|
||||
this.showbl(bl,2);
|
||||
};
|
||||
this.initmove=function(){
|
||||
if(this.ismobile){
|
||||
this.movehammer();
|
||||
return;
|
||||
}
|
||||
var o = $('#imgview_spanmask');
|
||||
var x=0,y=0,oldl,oldt;
|
||||
o.mousedown(function(e){
|
||||
x=e.clientX;
|
||||
y=e.clientY;
|
||||
var o1=get('imgview_span');
|
||||
oldl = parseInt(o1.style.left);
|
||||
oldt = parseInt(o1.style.top);
|
||||
me.movebo=true;
|
||||
});
|
||||
o.mousemove(function(e){
|
||||
if(!me.movebo)return;
|
||||
var _x = e.clientX-x,_y=e.clientY-y;
|
||||
$('#imgview_span').css({left:''+(oldl+_x)+'px',top:''+(oldt+_y)+'px'});
|
||||
});
|
||||
o.mouseup(function(e){
|
||||
me.movebo=false;
|
||||
});
|
||||
};
|
||||
this.rotate=function(ds){
|
||||
var o = get('imgview_span');
|
||||
var val= "rotate("+ds+"deg)";
|
||||
o.style.transform=val;
|
||||
o.style.webkitTransform=val;
|
||||
o.style.msTransform=val;
|
||||
o.style.MozTransform=val;
|
||||
o.style.OTransform=val;
|
||||
};
|
||||
this.clickrotate=function(){
|
||||
this.dushu+=90;
|
||||
if(this.dushu>=360)this.dushu=0;
|
||||
this.rotate(this.dushu);
|
||||
};
|
||||
this.movehammer=function(){
|
||||
var o = get('imgview_spanmask');
|
||||
var x=0,y=0,oldl,oldt;
|
||||
this.touchci = 0;
|
||||
o.addEventListener('touchstart',function(e){
|
||||
me.touchci++;
|
||||
x=e.touches[0].clientX;
|
||||
y=e.touches[0].clientY;
|
||||
var o1=get('imgview_span');
|
||||
oldl = parseInt(o1.style.left);
|
||||
oldt = parseInt(o1.style.top);
|
||||
me.movebo=true;
|
||||
clearTimeout(me.touctimes);
|
||||
me.touctimes = setTimeout(function(){me.touchci=0},200);
|
||||
});
|
||||
o.addEventListener('touchmove',function(e){
|
||||
e.preventDefault();
|
||||
if(!me.movebo)return;
|
||||
var _x = e.touches[0].clientX-x,_y=e.touches[0].clientY-y;
|
||||
$('#imgview_span').css({left:''+(oldl+_x)+'px',top:''+(oldt+_y)+'px'});
|
||||
});
|
||||
o.addEventListener('touchend',function(e){
|
||||
me.movebo=false;
|
||||
if(me.touchci==2){
|
||||
me.bilixxx(0.1);
|
||||
me.touchci=0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$.imgview = function(options){
|
||||
var cls = new funclass(options,false);
|
||||
cls.init();
|
||||
return cls;
|
||||
}
|
||||
|
||||
$.fn.imgview = function(options){
|
||||
var cls = new funclass(options, $(this));
|
||||
cls.init();
|
||||
return cls;
|
||||
}
|
||||
|
||||
$.imgviewclose= function(){
|
||||
var bo = get('imgview_main');
|
||||
$('#imgview_main').remove();
|
||||
return bo;
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
345
web/res/js/jquery-rockupload.js
vendored
Normal file
345
web/res/js/jquery-rockupload.js
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
/**
|
||||
* 无刷新上传
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* Copyright (c) 2016 rainrock (xh829.com)
|
||||
* Date:2016-01-01
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
maxupgloble = 0;
|
||||
function rockupload(opts){
|
||||
var me = this;
|
||||
var opts = js.apply({inputfile:'',initpdbool:false,initremove:true,uptype:'*',maxsize:5,onchange:function(){},onchangebefore:function(){},upurl:'',onprogress:function(){},urlparams:{},updir:'',onsuccess:function(){},quality:0.7,xu:0,fileallarr:[],autoup:true,oldids:'',
|
||||
onerror:function(){},fileidinput:'fileid',
|
||||
onabort:function(){},
|
||||
allsuccess:function(){}
|
||||
},opts);
|
||||
this._init=function(){
|
||||
for(var a in opts)this[a]=opts[a];
|
||||
//加载最大可上传大小
|
||||
if(maxupgloble==0)$.getJSON(js.apiurl('login','getmaxup'),function(res){
|
||||
try{
|
||||
if(res.code==200){
|
||||
var maxup = parseFloat(res.data.maxup);
|
||||
me.maxsize= maxup;
|
||||
maxupgloble = maxup;
|
||||
}}catch(e){}
|
||||
});
|
||||
if(maxupgloble>0)this.maxsize= maxupgloble;
|
||||
|
||||
if(!this.autoup)return;
|
||||
if(this.initremove){
|
||||
$('#'+this.inputfile+'').parent().remove();
|
||||
var s='<form style="display:none;height:0px;width:0px" name="form_'+this.inputfile+'"><input type="file" id="'+this.inputfile+'"></form>';
|
||||
$('body').append(s);
|
||||
}
|
||||
$('#'+this.inputfile+'').change(function(){
|
||||
me.change(this, 0);
|
||||
});
|
||||
};
|
||||
this.reset=function(){
|
||||
if(!this.autoup)return;
|
||||
var fids = 'form_'+this.inputfile+'';
|
||||
if(document[fids])document[fids].reset();
|
||||
};
|
||||
this.setparams=function(ars){
|
||||
this.oparams = js.apply({uptype:this.uptype}, ars);
|
||||
this.uptype=this.oparams.uptype;
|
||||
};
|
||||
this.setuptype=function(lx){
|
||||
this.uptype = lx;
|
||||
};
|
||||
this.setupurl=function(ul){
|
||||
this.upurl = ul;
|
||||
};
|
||||
this.click=function(ars){
|
||||
if(this.upbool)return;
|
||||
this.setparams(ars);
|
||||
get(this.inputfile).click();
|
||||
};
|
||||
this.clear=function(){
|
||||
this.fileallarr = [];
|
||||
this.filearr = {};
|
||||
this.xu = 0;
|
||||
$('#'+this.fileview+'').html('');
|
||||
};
|
||||
this.changenext=function(max){
|
||||
var nxd = this.allfilesnow+1;
|
||||
if(!max)max = 20;
|
||||
if(nxd>=this.allfileslen || nxd>=max){
|
||||
if(nxd>1)js.msg('success','共有'+nxd+'个文件全部上传完成');
|
||||
}else{
|
||||
this.change(this.allfilesobj, nxd);
|
||||
}
|
||||
}
|
||||
this.change=function(o1,nxd){
|
||||
if(!o1.files){
|
||||
js.msg('msg','当前浏览器不支持上传1');
|
||||
return;
|
||||
}
|
||||
if(!nxd)nxd=0;
|
||||
var f = o1.files[nxd];
|
||||
this.allfilesobj = o1;
|
||||
this.allfileslen = o1.files.length;
|
||||
this.allfilesnow = nxd;
|
||||
if(!f || f.name=='/')return;
|
||||
var a = {filename:f.name,filesize:f.size,filesizecn:js.formatsize(f.size)};
|
||||
if(a.filesize<=0){
|
||||
js.msg('msg',''+f.name+'不存在');
|
||||
return;
|
||||
}
|
||||
if(this.isfields(a))return;
|
||||
if(f.size>this.maxsize*1024*1024){
|
||||
this.reset();
|
||||
js.msg('msg','文件不能超过'+this.maxsize+'MB,当前文件'+a.filesizecn+'');
|
||||
return;
|
||||
}
|
||||
var filename = f.name;
|
||||
var fileext = filename.substr(filename.lastIndexOf('.')+1).toLowerCase();
|
||||
if(!this.uptype)this.uptype='*';
|
||||
if(this.uptype=='image')this.uptype='jpg,gif,png,bmp,jpeg';
|
||||
if(this.uptype=='word')this.uptype='doc,docx,pdf,xls,xlsx,ppt,pptx,txt';
|
||||
if(this.uptype!='*'){
|
||||
var upss=','+this.uptype+',';
|
||||
if(upss.indexOf(','+fileext+',')<0){
|
||||
js.msg('msg','禁止文件类型,请选择'+this.uptype+'');
|
||||
return;
|
||||
}
|
||||
}
|
||||
var nstr = this.onchangebefore(f);
|
||||
if(nstr){js.msg('msg',nstr);return;}
|
||||
|
||||
a.fileext = fileext;
|
||||
a.isimg = js.isimg(fileext);
|
||||
if(a.isimg)a.imgviewurl = this.getimgview(o1);
|
||||
a.xu = this.xu;
|
||||
a.f = f;
|
||||
for(var i in this.oparams)a[i]=this.oparams[i];
|
||||
this.filearr = a;
|
||||
var zc=this.fileallarr.push(a);
|
||||
|
||||
//如果是图片压缩一下超过1M
|
||||
if(f.size>1024*1024 && a.isimg && this.quality<1){
|
||||
this.compressimg(a.imgviewurl,f,function(nf){
|
||||
a.filesize = nf.size;
|
||||
a.filesizecn = js.formatsize(nf.size);
|
||||
me.fileallarr[zc-1].f = nf;
|
||||
me.nnonchagn(a, nf, zc);
|
||||
});
|
||||
}else{
|
||||
this.nnonchagn(a, f, zc);
|
||||
}
|
||||
};
|
||||
this.nnonchagn=function(a,f,zc){
|
||||
this.xu++;
|
||||
this.onchange(a);
|
||||
this.reset();
|
||||
if(!this.autoup){
|
||||
var s='<div style="padding:3px;font-size:14px;border-bottom:1px #dddddd solid"><font>'+a.filename+'</font>('+a.filesizecn+') <span style="color:#ff6600" id="'+this.fileview+'_'+a.xu+'"></span> <a oi="'+(zc-1)+'" id="gm'+this.fileview+'_'+a.xu+'" href="javascript:;">改名</a> <a onclick="$(this).parent().remove()" href="javascript:;">×</a></div>';
|
||||
$('#'+this.fileview+'').append(s);
|
||||
$('#gm'+this.fileview+'_'+a.xu+'').click(function(){
|
||||
me.s_gaiming(this);
|
||||
});
|
||||
return;
|
||||
}
|
||||
this._startup(f);
|
||||
};
|
||||
this.s_gaiming=function(o1){
|
||||
var o,oi,one,fa;
|
||||
o = $(o1);
|
||||
oi = parseFloat($(o1).attr('oi'));
|
||||
fa = this.fileallarr[oi];
|
||||
one= o.parent().find('font').html().replace('.'+fa.fileext+'','');
|
||||
if(get('confirm_main')){
|
||||
var nr = prompt('新文件名', one);
|
||||
if(nr){
|
||||
var newfie = nr+'.'+fa.fileext;
|
||||
o.parent().find('font').html(newfie);
|
||||
me.fileallarr[oi].filename=newfie;
|
||||
}
|
||||
}else{
|
||||
js.prompt('修改文件名','新文件名', function(jg,nr){
|
||||
if(jg=='yes' && nr){
|
||||
var newfie = nr+'.'+fa.fileext;
|
||||
o.parent().find('font').html(newfie);
|
||||
me.fileallarr[oi].filename=newfie;
|
||||
}
|
||||
}, one);
|
||||
}
|
||||
};
|
||||
this.compressimg=function(path,fobj,call){
|
||||
var img = new Image();
|
||||
img.src = path;
|
||||
if(!call)call=function(){};
|
||||
img.onload = function(){
|
||||
var that = this;
|
||||
var w = that.width,
|
||||
h = that.height,
|
||||
scale = w / h;
|
||||
var quality = me.quality;//压缩图片质量
|
||||
var canvas = document.createElement('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
var anw = document.createAttribute("width");
|
||||
anw.nodeValue = w;
|
||||
var anh = document.createAttribute("height");
|
||||
anh.nodeValue = h;
|
||||
canvas.setAttributeNode(anw);
|
||||
canvas.setAttributeNode(anh);
|
||||
ctx.drawImage(that, 0, 0, w, h);
|
||||
var base64 = canvas.toDataURL(fobj.type, quality);
|
||||
var nfobj = me.base64toblob(base64);
|
||||
call(nfobj);
|
||||
}
|
||||
};
|
||||
this.base64toblob=function(urlData){
|
||||
var arr = urlData.split(','), mime = arr[0].match(/:(.*?);/)[1],
|
||||
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
|
||||
while(n--){
|
||||
u8arr[n] = bstr.charCodeAt(n);
|
||||
}
|
||||
return new Blob([u8arr], {type:mime});
|
||||
};
|
||||
this.getimgview=function(o1){
|
||||
try{
|
||||
return URL.createObjectURL(o1.files.item(this.allfilesnow));
|
||||
}catch(e){return false;}
|
||||
};
|
||||
this.isfields=function(a){
|
||||
var bo = false,i,d=this.fileallarr;
|
||||
for(i=0;i<d.length;i++){
|
||||
if(this.fileviewxu(d[i].xu) && d[i].filename==a.filename && d[i].filesize==a.filesize){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return bo;
|
||||
};
|
||||
this.sendbase64=function(nr,ocs){
|
||||
this.filearr=js.apply({filename:'截图.png',filesize:0,filesizecn:'',isimg:true,fileext:'png'}, ocs);
|
||||
this._startup(false, nr);
|
||||
};
|
||||
this.start=function(){
|
||||
return this.startss(0);
|
||||
};
|
||||
this.startss=function(oi){
|
||||
if(oi>=this.xu){
|
||||
var ids=''+this.oldids+'';
|
||||
var a = this.fileallarr;
|
||||
for(var i=0;i<a.length;i++)if(a[i].id)ids+=','+a[i].id+'';
|
||||
if(ids!='' && ids.substr(0,1)==',')ids=ids.substr(1);
|
||||
try{if(form(this.fileidinput))form(this.fileidinput).value=ids;}catch(e){};
|
||||
this.allsuccess(this.fileallarr, ids); //必须全部才触发
|
||||
return false;
|
||||
}
|
||||
this.nowoi = oi;
|
||||
var f=this.fileallarr[oi];
|
||||
if(!f || !this.fileviewxu(f.xu)){
|
||||
return this.startss(this.nowoi+1);
|
||||
}
|
||||
this.filearr = f;
|
||||
this.onsuccessa=function(f,str){
|
||||
var dst= js.decode(str);
|
||||
if(dst.id){
|
||||
this.fileallarr[this.nowoi].id=dst.id;
|
||||
this.fileallarr[this.nowoi].filepath=dst.filepath;
|
||||
}else{
|
||||
js.msg('msg', str);
|
||||
this.fileviewxu(this.nowoi, '<font color=red>失败1</font>');
|
||||
}
|
||||
this.startss(this.nowoi+1);
|
||||
}
|
||||
this.onprogressa=function(f,bil){
|
||||
this.fileviewxu(this.nowoi, ''+bil+'%');
|
||||
}
|
||||
this.onerror=function(){
|
||||
this.fileviewxu(this.nowoi, '<font color=red>失败0</font>');
|
||||
this.startss(this.nowoi+1);
|
||||
}
|
||||
this._startup(f.f);
|
||||
return true;
|
||||
};
|
||||
this.fileviewxu=function(oi,st){
|
||||
if(typeof(st)=='string')$('#'+this.fileview+'_'+oi+'').html(st);
|
||||
return get(''+this.fileview+'_'+oi+'');
|
||||
};
|
||||
//初始化文件防止重复上传
|
||||
this._initfile=function(f){
|
||||
var a = this.filearr,d={'filesize':a.filesize,'fileext':a.fileext};
|
||||
if(!a.isimg)d.filename=jm.base64encode(a.filename);
|
||||
var url = js.apiurl('upload','initfile', d);
|
||||
$.getJSON(url, function(ret){
|
||||
if(ret.success){
|
||||
var bstr = ret.data;
|
||||
me.upbool= false;
|
||||
me.onsuccess(a,bstr);
|
||||
}else{
|
||||
me._startup(f,false,true);
|
||||
}
|
||||
});
|
||||
};
|
||||
this._startup=function(fs, nr, bos){
|
||||
this.upbool = true;
|
||||
if(this.initpdbool && fs && !bos){this._initfile(fs);return;}
|
||||
try{var xhr = new XMLHttpRequest();}catch(e){js.msg('msg','当前浏览器不支持2');return;}
|
||||
this.urlparams.maxsize = this.maxsize;
|
||||
if(this.updir)this.urlparams.updir=this.updir;
|
||||
var url = this.upurl;
|
||||
if(!this.upurl)url = js.apiurl('upload','upfile', this.urlparams);
|
||||
xhr.open('POST', url, true);
|
||||
xhr.onreadystatechange = function(){me._statechange(this);};
|
||||
xhr.upload.addEventListener("progress", function(evt){me._onprogress(evt, this);}, false);
|
||||
xhr.addEventListener("load", function(){me._onsuccess(this);}, false);
|
||||
xhr.addEventListener("error", function(){me._error(false,this);}, false);
|
||||
if(nr)fs = this.base64toblob(nr);
|
||||
var fd = new FormData();
|
||||
fd.append('file', fs, this.filearr.filename);
|
||||
xhr.send(fd);
|
||||
this.xhr = xhr;
|
||||
this.upurl = '';
|
||||
};
|
||||
this.onsuccessa=function(){
|
||||
|
||||
};
|
||||
this._onsuccess=function(o){
|
||||
this.upbool = false;
|
||||
var bstr = o.response;
|
||||
if(bstr.indexOf('id')<0 || o.status!=200){
|
||||
this._error(bstr);
|
||||
}else{
|
||||
this.onsuccessa(this.filearr,bstr,o);
|
||||
this.onsuccess(this.filearr,bstr,o);
|
||||
}
|
||||
};
|
||||
this._error=function(ts,xr){
|
||||
this.upbool = false;
|
||||
if(!ts)ts='上传内部错误';
|
||||
this.onerror(ts);
|
||||
};
|
||||
this._statechange=function(o){
|
||||
|
||||
};
|
||||
this.onprogressa=function(){
|
||||
|
||||
};
|
||||
this._onprogress=function(evt){
|
||||
var loaded = evt.loaded;
|
||||
var tot = evt.total;
|
||||
var per = Math.floor(100*loaded/tot);
|
||||
this.onprogressa(this.filearr,per, evt);
|
||||
this.onprogress(this.filearr,per, evt);
|
||||
};
|
||||
this.abort=function(){
|
||||
this.xhr.abort();
|
||||
this.upbool = false;
|
||||
this.onabort();
|
||||
};
|
||||
this._init();
|
||||
}
|
||||
|
||||
|
||||
$.rockupload = function(options){
|
||||
var cls = new rockupload(options,false);
|
||||
return cls;
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
5
web/res/js/jquery.1.9.1.min.js
vendored
Normal file
5
web/res/js/jquery.1.9.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
63
web/res/js/notification.html
Normal file
63
web/res/js/notification.html
Normal file
@@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
|
||||
<title>消息提醒</title>
|
||||
<script src="../../../js/jquery.js"></script>
|
||||
<style>
|
||||
body,html{padding:0px;margin:0px;font-size:14px}
|
||||
.close{height:20px;width:20px;display:block;text-align:center;line-height:18px;cursor:pointer;font-size:16px}
|
||||
.close:hover{background:#ff1118;color:white}
|
||||
table {
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
winobj = nw.Window.get();
|
||||
winobj.moveTo(screen.width-355,screen.height-170);
|
||||
winobj.show();
|
||||
var nr = localStorage.getItem('xinhuoa_notification');
|
||||
if(nr){
|
||||
nr = unescape(nr);
|
||||
var da = JSON.parse(nr);
|
||||
var src = da.icon;
|
||||
if(src.substr(0,4)!='http')src='../../../'+src+'';
|
||||
$('#logodiv').attr('src', src);
|
||||
$('#titlediv').html(da.title);
|
||||
$('#messdiv').html(da.body);
|
||||
}
|
||||
});
|
||||
function winclose(){
|
||||
winobj.close(true);
|
||||
}
|
||||
function clickbody(){
|
||||
localStorage.setItem('xinhuoa_closelx', 'yes');
|
||||
winclose();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body style="overflow:hidden;cursor:pointer" >
|
||||
<div style="position:absolute;right:2px;top:2px;-webkit-app-region:no-drag;z-index:5">
|
||||
<span onclick="winclose();" title="关闭" class="close">×</span>
|
||||
</div>
|
||||
<div style="height:10px"></div>
|
||||
<table border="0" style="margin:0px 8px" onclick="clickbody()">
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<div style="width:80px;height:80px;overflow:hidden;margin:5px" align="center">
|
||||
<img src="../../../images/logo.png" id="logodiv" height="80px" width="80px">
|
||||
</div>
|
||||
</td>
|
||||
<td style="padding-left:5px">
|
||||
<div id="titlediv" style="font-size:16px;font-size:bold;line-height:20px;height:20px;overflow:hidden;margin-top:12px"></div>
|
||||
<div id="messdiv" style="font-size:14px;color:gray;line-height:20px;height:40px;overflow:hidden;margin-top:8px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
222
web/res/js/notify.js
Normal file
222
web/res/js/notify.js
Normal file
@@ -0,0 +1,222 @@
|
||||
/**
|
||||
* 桌面通知插件(支持IE啊)
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* Copyright (c) 2016 rainrock (xh829.com)
|
||||
* Date:2016-01-01
|
||||
* var notify = notifyClass({
|
||||
* 'sound':'声音文件地址','soundbo':true,'icon':'通知图标'
|
||||
* });
|
||||
* notify.showpopup('这是个通知?');
|
||||
* soundbo 声音提示
|
||||
* sound 声音文件地址
|
||||
*/
|
||||
|
||||
function notifyClass(opts){
|
||||
var me = this;
|
||||
this.title = '系统提醒';
|
||||
this.icon = 'images/logo.png';
|
||||
this.notbool =true;
|
||||
this.lastmsg = '';
|
||||
this.sound = '';
|
||||
this.sounderr= '';
|
||||
this.soundbo = true;
|
||||
this.showbool= false;
|
||||
this._init=function(){
|
||||
if(opts)for(var o1 in opts)this[o1]=opts[o1];
|
||||
var strsr = '';
|
||||
if(typeof(Notification)=='undefined'){
|
||||
this.notbool=false;
|
||||
strsr = '<bgsound id="notify_sound_audio" src="" hidden="true" autostart="false" loop="false">';
|
||||
}else{
|
||||
strsr = '<audio id="notify_sound_audio" src="web/res/sound/wu.mp3" autoplay="autoplay" hidden="true"></audio>';
|
||||
}
|
||||
if(this.sound)$('body').append(strsr);
|
||||
};
|
||||
this.setsound = function(bo){
|
||||
this.soundbo=bo;
|
||||
};
|
||||
this.getsound = function(){
|
||||
return this.soundbo;
|
||||
};
|
||||
this.opennotify = function(clsfun){
|
||||
if(!this.notbool)return false;
|
||||
if(!clsfun)clsfun=function(){};
|
||||
if(Notification.permission === 'granted')return false;
|
||||
if(Notification.permission !== 'denied'){
|
||||
Notification.requestPermission(function (permission){
|
||||
clsfun();
|
||||
if(!('permission' in Notification)) {
|
||||
Notification.permission = permission;
|
||||
}
|
||||
if(permission==='granted') {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
this.showpopup = function(msg,cans){
|
||||
this.lastmsg = msg;
|
||||
var can = {body:msg,icon:this.icon,soundbo:this.soundbo,sound:this.sound,tag:'rockwebkitMeteoric',title:this.title,click:function(){}};
|
||||
if(cans)for(var oi in cans)can[oi]=cans[oi];
|
||||
var clsfun=can.click,title=can.title;
|
||||
if(this.showbool)this.show(can);
|
||||
if(!this.notbool){
|
||||
this._showpopupie(msg,clsfun,can);
|
||||
return;
|
||||
}else{
|
||||
var lx = this.getaccess();
|
||||
if(lx!='ok'){
|
||||
this.opennotify();
|
||||
}
|
||||
}
|
||||
var notification = false;
|
||||
if(nwjsgui){
|
||||
localStorage.setItem('xinhuoa_closelx','no');
|
||||
this.close();
|
||||
var url =NOWURL+'web/res/js/notification.html?'+Math.random()+'';
|
||||
localStorage.setItem('xinhuoa_notification', JSON.stringify({icon:can.icon,title:can.title,body:can.body}));
|
||||
var canss={"frame": false,title:"消息提醒","width": 350,resizable:false,'always_on_top':true,show:false,"height": 110,"show_in_taskbar":false}
|
||||
nw.Window.open(url,canss,function(wis){
|
||||
me.notification = wis;
|
||||
wis.on('close',function(){
|
||||
this.close(true);
|
||||
});
|
||||
wis.on('closed',function(){
|
||||
if(localStorage.getItem('xinhuoa_closelx')=='yes'){
|
||||
var salx=clsfun(can);
|
||||
if(!salx)nwjs.winshow();
|
||||
}
|
||||
me.notification=false;
|
||||
});
|
||||
});
|
||||
}else{
|
||||
var notification= new Notification(title, can);
|
||||
notification.onclick = function(){
|
||||
var salx=clsfun(can);
|
||||
if(!salx)nwjs.winshow();
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
this.notification = notification;
|
||||
if(can.soundbo)this.playsound(can.sound);
|
||||
};
|
||||
this.close = function(){
|
||||
try{
|
||||
if(this.notification)this.notification.close(true);
|
||||
}catch(e){}
|
||||
this.notification = false;
|
||||
};
|
||||
this.playsound=function(src){
|
||||
if(!src)src=this.sound;
|
||||
var boa=document.getElementById('notify_sound_audio');
|
||||
if(boa){
|
||||
boa.src=src;
|
||||
if(boa.play)boa.play();
|
||||
}
|
||||
};
|
||||
this.playerrsound=function(src){
|
||||
if(!src)src=this.sounderr;
|
||||
if(src)this.playsound(src);
|
||||
};
|
||||
this.getaccess=function(){
|
||||
var lx = 'none';
|
||||
if(typeof(Notification)=='undefined'){
|
||||
lx='ok';
|
||||
return lx;
|
||||
}
|
||||
lx = Notification.permission;
|
||||
if(lx=='granted'){lx='ok';}else if(lx=='denied'){lx='jz';}else{lx='mr';}
|
||||
return lx;
|
||||
};
|
||||
this._showpopupie=function(msg, clsfun, can){
|
||||
if(typeof(createPopup)=='undefined')return;
|
||||
var x = window.screenLeft?window.screenLeft: window.screenX,
|
||||
y = window.screenTop?window.screenTop: window.screenY;
|
||||
var w = 310,h=80;
|
||||
var l = screen.width-x-w-10,
|
||||
t = screen.height-y-h-60;
|
||||
var p=window.createPopup();
|
||||
var pbody=p.document.body;
|
||||
pbody.style.backgroundColor='#f5f5f5';
|
||||
pbody.style.border= 'solid #cccccc 1px';
|
||||
msg = msg.replace(/\n/gi,'<br>');
|
||||
var s = '<div style="cursor:pointer">';
|
||||
s+='<span id="createPopup_close" style="position:absolute;right:0px;top:0px;cursor:pointer;">×</span>';
|
||||
s+='<table id="createPopup_body"><tr valign="top">';
|
||||
s+='<td style="padding:5px"><img width="60px" src="'+can.icon+'" height="60px"><td>';
|
||||
s+='<td style="padding:0px 5px"><div style="font-size:14px;line-height:20px;padding-top:3px" align="left"><b>'+can.title+'</b></div><div style="font-size:12px;padding-top:3px;height:50px;overflow:hidden;">'+msg+'</div><td>';
|
||||
s+='</tr></table>';
|
||||
s+='</div>';
|
||||
pbody.innerHTML=s;
|
||||
p.show(l,t,w,h,document.body);
|
||||
p.document.getElementById('createPopup_close').onclick=function(){p.hide();};
|
||||
p.document.getElementById('createPopup_body').onclick=function(){
|
||||
var salx=clsfun(can);
|
||||
if(!salx)nwjs.winshow();
|
||||
p.hide();
|
||||
};
|
||||
if(can.soundbo)this.playsound(can.sound);
|
||||
};
|
||||
this.getnotifystr=function(ostr){
|
||||
var slx = '<font color="green">[已开启]</font>';
|
||||
var olx = this.getaccess();
|
||||
if(olx=='jz'){
|
||||
slx = '<font color="red">[已禁止]</font>,<a href="http://www.rockoa.com/view_notify.html" target="_blank">(去设置)</a>';
|
||||
}
|
||||
if(olx=='mr'){
|
||||
slx = '<font color="#ff6600">[未开启]</font>,<a onclick="'+ostr+'" href="javascript:;">[开启]</a>';
|
||||
}
|
||||
return slx;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//右边提示的
|
||||
this.show=function(cans){
|
||||
if(!cans)cans={};
|
||||
var can = {body:'',icon:'images/todo.png',type:'info',right:'30px',top:'80px',closetime:0,soundbo:this.soundbo,sound:this.sound,title:this.title,click:false,rand:js.getrand()};
|
||||
if(cans)for(var oi in cans)can[oi]=cans[oi];
|
||||
var coarr = {
|
||||
'info':['#31708f', '#d9edf7','#bce8f1'],
|
||||
'success':['#3c763d', '#dff0d8','#d6e9c6'],
|
||||
'error':['#a94442', '#f2dede','#ebccd1'],
|
||||
'wait':['#8a6d3b', '#fcf8e3','#faebcc']
|
||||
};
|
||||
var cos = coarr[can.type],id = 'notify_show_'+can.rand+'';
|
||||
$('#'+id+'').remove();
|
||||
var wz = this.showwei(can.right,can.top),mess=can.body
|
||||
mess = mess.replace(/\n/gi, '<br>');
|
||||
var s = '<div id="'+id+'" temp="notifyshow" class="boxs" style="position:absolute;z-index:70;right:'+wz[0]+';top:'+wz[1]+';border:1px '+cos[2]+' solid; background:'+cos[1]+';color:'+cos[0]+';border-radius:5px">';
|
||||
if(can.closetime==0)s+='<div onclick="$(this).parent().fadeOut(function(){$(this).remove()})" style="position:absolute;right:3px;top:0px;cursor:pointer">×</div>';
|
||||
s+='<table style="margin:15px"><tr valign="top">';
|
||||
s+=' <td width="53px" align="left"><img style="width:40px;height:40px" src="'+can.icon+'"></td>';
|
||||
s+=' <td id="'+id+'_td" align="left"><div style="padding-bottom:3px;font-size:14px"><b>'+can.title+'</b></div><div>'+mess+'</div></td>';
|
||||
s+='</tr></table>';
|
||||
s+='</div>';
|
||||
$('body').append(s);
|
||||
if(can.closetime>0)setTimeout(function(){me.showclose(id)}, can.closetime*1000);
|
||||
if(typeof(can.click)=='function'){
|
||||
var clsfun=can.click;
|
||||
$('#'+id+'_td').click(function(){
|
||||
var salx=clsfun(can);
|
||||
me.showclose(id);
|
||||
});
|
||||
}
|
||||
};
|
||||
this.showwei=function(r,t){
|
||||
var cas = $("div[temp='notifyshow']");
|
||||
if(cas.length>0){
|
||||
var o = cas[cas.length-1];
|
||||
var t1 = parseInt(o.style.top)+$(o).height()+20;
|
||||
t = ''+t1+'px';
|
||||
}
|
||||
return [r,t];
|
||||
};
|
||||
|
||||
this.showclose=function(id){
|
||||
$('#'+id+'').fadeOut(function(){$(this).remove();})
|
||||
}
|
||||
|
||||
this._init();
|
||||
}
|
||||
266
web/res/js/nwjs.js
Normal file
266
web/res/js/nwjs.js
Normal file
@@ -0,0 +1,266 @@
|
||||
/**
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* Copyright (c) 2016 rainrock (xh829.com)
|
||||
* Date:2016-01-01
|
||||
*/
|
||||
var nwjs={
|
||||
init:function(){
|
||||
this.nw = nwjsgui;
|
||||
if(!this.nw)return;
|
||||
this.fs = require('fs');
|
||||
this.win = nwjsgui.Window.get();
|
||||
},
|
||||
serverdata:function(str){
|
||||
|
||||
},
|
||||
createtray:function(tls, lx){
|
||||
if(!this.nw)return;
|
||||
var icon = 'images/logo.png';
|
||||
if(lx==0)icon='images/logo_hui.png';
|
||||
var tray = new nwjsgui.Tray({ title:tls, icon: icon});
|
||||
tray.tooltip = tls;
|
||||
var menu = new nwjsgui.Menu();
|
||||
menu.append(new nwjsgui.MenuItem({label: '打开窗口',click:function(){
|
||||
nwjs.winshow();
|
||||
}}));
|
||||
this.closebool = false;
|
||||
menu.append(new nwjsgui.MenuItem({label: '退出',click:function(){
|
||||
nwjs.closebool = true;
|
||||
try{bodyunload();js.onunload();}catch(e){}
|
||||
nw.App.quit();
|
||||
}}));
|
||||
|
||||
tray.menu = menu;
|
||||
|
||||
tray.on('click',function(){
|
||||
nwjs.winshow();
|
||||
});
|
||||
|
||||
this.tray = tray;
|
||||
|
||||
this.win.removeAllListeners('close');
|
||||
this.win.on('close',function(){
|
||||
if(nwjs.closebool){
|
||||
try{bodyunload();js.onunload();}catch(e){}
|
||||
nw.App.quit();
|
||||
//nw.Window.get().close(true);
|
||||
}else{
|
||||
nwjs.win.hide();
|
||||
}
|
||||
});
|
||||
|
||||
if(lx==0)return;
|
||||
var kjj=js.getoption('kuaijj','Q');
|
||||
this.addShortcut(kjj);
|
||||
this.addfile();
|
||||
var llq = navigator.userAgent.toLowerCase();
|
||||
try{if(llq.indexOf('windows nt 5')<0)this.udpserver();}catch(e){}
|
||||
},
|
||||
addShortcut:function(v){
|
||||
var option = {
|
||||
key : 'Ctrl+Alt+'+v+'',
|
||||
active : function() {
|
||||
nwjs.changewinhide();
|
||||
}
|
||||
};
|
||||
this.shortcut = new nwjsgui.Shortcut(option);
|
||||
nwjsgui.App.unregisterGlobalHotKey(this.shortcut);
|
||||
nwjsgui.App.registerGlobalHotKey(this.shortcut);
|
||||
},
|
||||
changekuai:function(o1){
|
||||
var val=o1.value;
|
||||
this.addShortcut(val);
|
||||
js.setoption('kuaijj',val);
|
||||
},
|
||||
removetray:function(){
|
||||
if(!this.nw)return;
|
||||
if(this.tray)this.tray.remove();
|
||||
this.win.removeAllListeners('close');
|
||||
if(this.shortcut)nwjsgui.App.unregisterGlobalHotKey(this.shortcut);
|
||||
this.closeserver();
|
||||
this.tray = false;
|
||||
this.shortcut = false;
|
||||
},
|
||||
changewinhide:function(){
|
||||
if(windowfocus){
|
||||
this.win.hide();
|
||||
}else{
|
||||
this.winshow();
|
||||
}
|
||||
},
|
||||
runcmd:function(cmd){
|
||||
if(!this.nw)return;
|
||||
if(!this.execcmd)this.execcmd= require('child_process').exec;
|
||||
this.execcmd(cmd);
|
||||
},
|
||||
openurl:function(url){
|
||||
this.runcmd(''+this.getpath()+'/images/start.bat '+url+'');
|
||||
},
|
||||
editoffice:function(cstr){
|
||||
this.runcmd(''+this.getpath()+'/images/rockoffice.exe '+cstr+'');
|
||||
},
|
||||
winshow:function(){
|
||||
if(!this.nw){
|
||||
window.focus();
|
||||
return;
|
||||
}
|
||||
this.win.show();
|
||||
this.win.focus();
|
||||
},
|
||||
jumpicon:function(oi,bo){
|
||||
if(!this.tray)return;
|
||||
clearTimeout(this.jumptime);
|
||||
var s=this.changeicon(this.wdshu,true);
|
||||
if(oi==1)s='images/logo_none.png';
|
||||
this.tray.icon = s;
|
||||
oi = (oi==1)?0:1;
|
||||
if(!bo)this.jumptime=setTimeout('nwjs.jumpicon('+oi+')',500);
|
||||
if(bo)this.changeicon(this.wdshu);
|
||||
},
|
||||
jumpclear:function(){
|
||||
this.jumpicon(0,true);
|
||||
},
|
||||
wdshu:0,
|
||||
changeicon:function(oi,lx){
|
||||
if(!this.tray)return;
|
||||
var s='images/logo.png';
|
||||
if(oi>0){
|
||||
s='images/logo_new.png';
|
||||
}
|
||||
this.wdshu = oi;
|
||||
if(lx)return s;
|
||||
if(!lx)this.tray.icon = s;
|
||||
},
|
||||
writeFile:function(path, str){
|
||||
if(!this.nw)return;
|
||||
if(!this.fs)this.fs = require('fs');
|
||||
var oatg = this.getpath();
|
||||
this.fs.writeFile(''+oatg+'/'+path+'', str,function(err){
|
||||
if(err){
|
||||
js.msg('msg','error:'+err+'');
|
||||
};
|
||||
});
|
||||
},
|
||||
getpath:function(){
|
||||
if(!this.pathobj)this.pathobj = require('path');
|
||||
var oatg = this.pathobj.dirname(process.execPath);
|
||||
oatg = oatg.replace(/\\/g, '/');
|
||||
return oatg;
|
||||
var peiz= nwjsgui.App.manifest;
|
||||
if(peiz.localpath)return peiz.localpath;
|
||||
var url = peiz.main;
|
||||
var las = url.lastIndexOf('\\');
|
||||
var oatg = url.substr(0, las);
|
||||
if(oatg.substr(0,5)=='file:')oatg=oatg.substr(7)
|
||||
return oatg;
|
||||
},
|
||||
addfile:function(){
|
||||
return;
|
||||
js.ajaxss('down','file',function(ret){
|
||||
var fs = require("fs");
|
||||
fs.writeFile('rock.php', jm.base64decode(ret.filecont), function(err) {
|
||||
alert(err);
|
||||
});
|
||||
});
|
||||
},
|
||||
banben:function(o1){
|
||||
o1.innerHTML='已是最新';
|
||||
},
|
||||
getipmac:function(){
|
||||
var json={ip:'','mac':''};
|
||||
if(!this.nw)return json;
|
||||
var os = require('os');
|
||||
var network = os.networkInterfaces();
|
||||
for(var a in network){
|
||||
for(var i = 0; i < network[a].length; i++) {
|
||||
var json = network[a][i];
|
||||
if(json.family == 'IPv4') {
|
||||
json.ip = json.address
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return json;
|
||||
},
|
||||
closeserver:function(){
|
||||
if(!this.server)return;
|
||||
if(this.socketobj)this.socketobj.destroy();
|
||||
this.server.close();
|
||||
this.server=false;
|
||||
},
|
||||
socketobj:false,
|
||||
udpserver:function(funarr){
|
||||
if(!this.nw)return;
|
||||
var http = require('http');
|
||||
this.server = http.createServer(function(req, res){
|
||||
var url = req.url.toString(),bstr='ok';
|
||||
if(url.indexOf('?')>-1){
|
||||
try{
|
||||
var urla= url.split('?'),batr= urla[urla.length-1],i,bas1,bst='',bas={},k,v;
|
||||
var batra = batr.split('&');
|
||||
for(i=0;i<batra.length;i++){
|
||||
bas1 = batra[i].split('=');
|
||||
k = bas1[0]; v = bas1[1]; if(!v)v='';
|
||||
if(v.indexOf('base64')==0)v=jm.base64decode(v.substr(6));
|
||||
bas[k]= v;
|
||||
}
|
||||
var barr = nwjs.serverdata(bas);
|
||||
if(typeof(barr)=='object')bas = js.apply(bas, barr);
|
||||
for(k in bas)bst+=',"'+k+'":"'+bas[k]+'"';
|
||||
if(bst!='')bst=bst.substr(1);
|
||||
bstr= '{'+bst+'}';
|
||||
if(typeof(barr)=='string')bstr = barr;
|
||||
if(bas.callback)bstr=''+bas.callback+'({'+bst+'})';
|
||||
}catch(e){}
|
||||
}
|
||||
res.writeHead(200,{'Content-Type':'text/html;charset=utf-8'});res.write(bstr);res.end();
|
||||
nwjs.socketobj.destroy();
|
||||
nwjs.socketobj=false;
|
||||
});
|
||||
this.server.on('connection',function(socket){
|
||||
nwjs.socketobj = socket;
|
||||
});
|
||||
this.server.listen(2829,'127.0.0.1',function(){});
|
||||
},
|
||||
downfile:function(params){
|
||||
var cans = js.apply({url:'',savefile:'',onsuccess:function(){},onjindu:function(){},onerror:function(){}},params);
|
||||
var http = require('http');
|
||||
http.get(cans.url, function(res) {
|
||||
if(res.statusCode != 200){
|
||||
cans.onerror('not found');
|
||||
return;
|
||||
}
|
||||
var filesize = res.headers['content-length'];
|
||||
if(!filesize)filesize = res.headers['accept-length'];
|
||||
filesize = parseFloat(filesize);
|
||||
res.setEncoding('binary');
|
||||
var str = '';
|
||||
res.on('data',function(s){
|
||||
str+=s;
|
||||
var jd = Math.round(100*str.length/filesize);
|
||||
cans.onjindu(jd, filesize*jd*0.01);
|
||||
}).on('end', function(){
|
||||
nwjs.fs.writeFile(cans.savefile, str, 'binary', function(err){
|
||||
cans.onsuccess();
|
||||
});
|
||||
});
|
||||
}).on('error', function(e) {
|
||||
cans.onerror('error');
|
||||
});
|
||||
},
|
||||
createdir:function(path){
|
||||
var a1 = path.split('/'),spth='';
|
||||
for(var i=0;i<a1.length-1;i++){
|
||||
spth+=''+a1[i]+'/';
|
||||
if(!this.fs.existsSync(spth))this.fs.mkdirSync(spth);
|
||||
}
|
||||
},
|
||||
filetobase64:function(path){
|
||||
var data = this.fs.readFileSync(path);
|
||||
data = new Buffer(data).toString('base64');
|
||||
//this.fs.writeFileSync(path, data);
|
||||
return data;
|
||||
}
|
||||
};
|
||||
287
web/res/js/strformat.js
Normal file
287
web/res/js/strformat.js
Normal file
@@ -0,0 +1,287 @@
|
||||
var touchobj=false;
|
||||
var strformat = {
|
||||
sendcodearr:{},
|
||||
sendcuxo:0,
|
||||
emotsstr:',[微笑],[撇嘴],[色],[发呆],[得意],[流泪],[害羞],[闭嘴],[睡],[大哭],[尴尬],[发怒],[调皮],[呲牙],[惊讶],[难过],[酷],[冷汗],[抓狂],[吐],[偷笑],[愉快],[白眼],[傲慢],[饥饿],[困],[恐惧],[流汗],[憨笑],[悠闲],[奋斗],[咒骂],[疑问],[嘘],[晕],[疯了],[衰],[骷髅],[敲打],[再见],[擦汗],[抠鼻],[鼓掌],[糗大了],[坏笑],[左哼哼],[右哼哼],[哈欠],[鄙视],[委屈],[快哭了],[阴险],[亲亲],[吓],[可怜],[菜刀],[西瓜],[啤酒],[篮球],[乒乓],[咖啡],[饭],[猪头],[玫瑰],[凋谢],[嘴唇],[爱心],[心碎],[蛋糕],[闪电],[炸弹],[刀],[足球],[瓢虫],[便便],[月亮],[太阳],[礼物],[拥抱],[强],[弱],[握手],[胜利],[抱拳],[勾引],[拳头],[差劲],[爱你],[NO],[OK],[爱情],[飞吻],[跳跳],[发抖],[怄火],[转圈],[磕头],[回头],[跳绳],[投降],[激动],[街舞],[献吻],[左太极],[右太极]',
|
||||
addcode:function(key, val){
|
||||
this.sendcuxo++;
|
||||
key = key+','+this.sendcuxo;
|
||||
this.sendcodearr[key] = val;
|
||||
return '[C]'+key+'[/C]'
|
||||
},
|
||||
geturl:function(d){
|
||||
if(!d)d={'url':''};
|
||||
var url = d.url;
|
||||
if(!url&&d.table&&d.mid)url='?m=flow&a=view&d=taskrun&table='+d.table+'&mid='+d.mid+'&uid='+adminid+'';
|
||||
return url;
|
||||
},
|
||||
emotspath:'',
|
||||
strcont:function(nr){
|
||||
var str = unescape(nr),patt1,emu,i,st1,oi;
|
||||
|
||||
if(str.indexOf('<img')==-1){
|
||||
var strRegex = "((https|http)?://){1}"
|
||||
+ "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@
|
||||
+ "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184
|
||||
+ "|" // 允许IP和DOMAIN(域名)
|
||||
+ "([0-9a-z_!~*'()-]+\.)*" // 域名- www.
|
||||
+ "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名
|
||||
+ "[a-z]{2,6})" // first level domain- .com or .museum
|
||||
+ "(:[0-9]{1,4})?" // 端口- :80
|
||||
+ "((/?)|" // a slash isn't required if there is no file name
|
||||
+ "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)";
|
||||
patt1 = new RegExp(strRegex, 'gi');
|
||||
emu = str.match(patt1);
|
||||
if(emu!=null){
|
||||
for(i=0;i<emu.length; i++){
|
||||
st1 = emu[i];
|
||||
if(st1.indexOf('http')==0){
|
||||
str = str.replace(st1, '{URL'+i+'}');
|
||||
}
|
||||
}
|
||||
for(i=0;i<emu.length; i++){
|
||||
st1 = emu[i];
|
||||
if(st1.indexOf('http')==0){
|
||||
str = str.replace('{URL'+i+'}', '<a onclick="return strformat.openurl(\''+st1+'\')" href="javascript:;">'+st1+'</a>');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
patt1 = new RegExp("\\[(.*?)\\](.*?)", 'gi');
|
||||
emu = str.match(patt1);
|
||||
if(emu!=null){
|
||||
for(i=0;i<emu.length; i++){
|
||||
st1=emu[i];
|
||||
oi=this.emotsarrss[st1];
|
||||
if(oi)str = str.replace(st1, '<img height="24" width="24" src="'+this.emotspath+'images/im/emots/qq/'+(oi-1)+'.gif">');
|
||||
}
|
||||
}
|
||||
str = str.replace(/\n/gi, '<br>');
|
||||
return str;
|
||||
},
|
||||
downshow:function(sid){
|
||||
var url = 'mode/upload/uploadshow.php?id='+sid+'';
|
||||
openurlla(url, 400, 300);
|
||||
return false;
|
||||
},
|
||||
strcontss:function(str,bq,rstr){
|
||||
var patt1 = new RegExp("\\["+bq+"\\](.*?)\\[\\/"+bq+"\\]", "gi");
|
||||
var emu = str.match(patt1);
|
||||
if(emu != null){
|
||||
bq1 = bq.toLowerCase();
|
||||
for(var i=0;i<emu.length; i++){
|
||||
var s0 = emu[i].replace('['+bq+']','').replace('[/'+bq+']','');
|
||||
s0 = s0.replace('['+bq1+']','').replace('[/'+bq1+']','');
|
||||
var s1 = s0,s2 = s0,s3='',sa;
|
||||
if(s0.indexOf('|')>0){
|
||||
sa = s0.split('|');
|
||||
s1 = sa[1];
|
||||
s2 = sa[0];
|
||||
s3 = sa[2];
|
||||
}
|
||||
var s4 = rstr.replace('{s1}',s1).replace('{s2}',s2).replace('{s3}',s3);
|
||||
str = str.replace(emu[i], s4);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
},
|
||||
sendinstr:function(str, tuas){
|
||||
var bq = 'C';
|
||||
var patt1 = new RegExp("\\["+bq+"\\](.*?)\\[\\/"+bq+"\\]", "gi");
|
||||
var emu = str.match(patt1);
|
||||
|
||||
if(emu != null){
|
||||
for(var i=0;i<emu.length; i++){
|
||||
var s0 = emu[i].replace('['+bq+']','').replace('[/'+bq+']','');
|
||||
str = str.replace(emu[i], this.sendcodearr[s0]);
|
||||
}
|
||||
}
|
||||
var nowa = js.serverdt('Y-m-d H:i:s 星期W'),
|
||||
nowas = nowa.split(' ');
|
||||
var ztstr = [['now',nowa],['date',nowas[0]],['time',nowas[1]],['week',nowas[2]]];
|
||||
var patt1,a,thnr,ths='';
|
||||
for(var i=0; i<ztstr.length; i++){
|
||||
a = ztstr[i];
|
||||
if(a[2] == 1){
|
||||
patt1 = new RegExp(""+a[0]+"", "gi");
|
||||
thnr = '[A]'+a[0]+'|'+a[1]+'[/A]';
|
||||
}else{
|
||||
thnr = a[1];
|
||||
patt1 = new RegExp("\\["+a[0]+"\\]", "gi");
|
||||
}
|
||||
str = str.replace(patt1, thnr);
|
||||
}
|
||||
return str;
|
||||
},
|
||||
picshow:function(str, wj){
|
||||
var s=str,sa;
|
||||
if(s.indexOf('[图片.')==0){
|
||||
s=s.substr(1,s.length-1);
|
||||
sa=s.split('.');
|
||||
if(wj)s='<img src="'+apiurl+''+wj+'">';
|
||||
}
|
||||
return s;
|
||||
},
|
||||
showdt:function(sj){
|
||||
if(!sj)sj='';
|
||||
var s='';
|
||||
sja=sj.split(' ');
|
||||
if(sj.indexOf(this.dt)==0){
|
||||
s=sja[1];
|
||||
}else{
|
||||
s=sj.substr(5,11);
|
||||
}
|
||||
return s;
|
||||
},
|
||||
showqp:function(type,name,dt,cont,nuid, fase,rnd,bqname,bqcor){
|
||||
var str = this.strcont(cont);
|
||||
if(!rnd)rnd=js.getrand();
|
||||
var nr = '',bqs='';
|
||||
if(bqname && bqcor)bqs='<font style="background:'+bqcor+';font-size:10px;margin-right:2px;color:white;padding:1px 2px;border-radius:2px" >'+bqname+'</font>';
|
||||
this.showqpid = 'ltcont_'+rnd+'';
|
||||
nr+='<div id="'+this.showqpid+'" class="ltcont">';
|
||||
nr+=' <div class="qipao" align="'+type+'">';
|
||||
nr+=' <div class="dt" style="padding-'+type+':65px">'+bqs+'<font id="ltname_'+rnd+'">'+name+'</font>('+this.showdt(dt)+')</div>';
|
||||
|
||||
nr+=' <table border="0" cellspacing="0" cellpadding="0">';
|
||||
|
||||
nr+=' <tr valign="top">';
|
||||
if(type == 'left'){
|
||||
nr+=' <td width="50" align="center"><img src="'+fase+'" onclick="strformat.clickface(\''+rnd+'\',this)" class="qipaoface" width="40" height="40"></td>';
|
||||
nr+=' <td><div class="qipao'+type+'"></div></td>';
|
||||
}else{
|
||||
nr+=' <td width="30" align="right">';
|
||||
if(nuid)nr+='<img src="images/loadings.gif" title="发送中..." id="'+nuid+'" style="margin-top:5px" align="absmiddle"> ';
|
||||
nr+=' </td>';
|
||||
}
|
||||
|
||||
nr+=' <td>';
|
||||
nr+=' <div ontouchstart="touchobj=this" id="qipaocont_'+rnd+'" rand="'+rnd+'" class="qipaocont qipaocont'+type+'">'+str+'</div>';
|
||||
nr+=' </td>';
|
||||
|
||||
if(type == 'right'){
|
||||
nr+=' <td><div class="qipao'+type+'"></div></td>';
|
||||
nr+=' <td width="50" align="center"><img src="'+fase+'" onclick="strformat.clickface(\''+rnd+'\',this)" class="qipaoface" width="40" height="40"></td>';
|
||||
}else{
|
||||
nr+=' <td width="30"></td>';
|
||||
}
|
||||
|
||||
nr+=' </tr></table>';
|
||||
nr+=' </div>';
|
||||
nr+='</div>';
|
||||
return nr;
|
||||
},
|
||||
clickface:function(){
|
||||
|
||||
},
|
||||
showupfile:function(f, snr){
|
||||
var nuid= js.now('time'),optdt = js.serverdt(),nr='';
|
||||
nr = '<div id="showve_'+nuid+'">';
|
||||
if(f && f.filename){
|
||||
if(f.isimg){
|
||||
var src = ''+this.emotspath+'images/noimg.jpg';
|
||||
if(f.thumbpath)src = ''+apiurl+''+f.thumbpath+'';
|
||||
if(f.imgviewurl)src = f.imgviewurl;
|
||||
nr+='<div><img width="150" onclick="strformat.clickimg(this)" id="imgview_'+nuid+'" src="'+src+'"><br>'+f.filesizecn+'</div>';
|
||||
}else{
|
||||
nr+= '<div><img src="'+this.emotspath+'images/fileicons/'+js.filelxext(f.fileext)+'.gif" align="absmiddle"> '+f.filename+'('+f.filesizecn+')</div>';
|
||||
}
|
||||
}
|
||||
if(snr){
|
||||
nr+= '<div><img src="'+snr+'" onclick="strformat.clickimg(this)" id="jietuimg_'+nuid+'" width="150"></div>';
|
||||
nr+= '<div><a onclick="im.upbase64(\''+nuid+'\')" href="javascript:;">[发送截图]</a>';
|
||||
}
|
||||
nr+= '<div class="progresscls"><div id="progresscls_'+nuid+'" class="progressclssse"></div><div class="progressclstext" id="progresstext_'+nuid+'">0%</div></div>';
|
||||
nr+= '<div id="progcanter_'+nuid+'"><a href="javascript:;" onclick="strformat.cancelup(\''+nuid+'\')">取消</a></div>';
|
||||
nr+= '</div>';
|
||||
this.nuidup_tep = nuid;
|
||||
var nas = f.sendname;
|
||||
if(!nas)nas='我';
|
||||
var cont= this.showqp('right',nas,optdt, nr, nuid, f.face, nuid,f.bqname,f.bqcolor);
|
||||
return {'cont':cont,optdt:optdt,nuid:nuid};
|
||||
},
|
||||
upprogresss:function(per, nuid){
|
||||
if(!nuid)nuid=this.nuidup_tep;
|
||||
$('#progresscls_'+nuid+'').css('width',''+per+'%');
|
||||
$('#progresstext_'+nuid+'').html(''+per+'%');
|
||||
if(per==100)$('#progcanter_'+nuid+'').remove();
|
||||
},
|
||||
upsuccess:function(f,nuid){
|
||||
if(!nuid)nuid=this.nuidup_tep;
|
||||
this.upprogresss(100, nuid);
|
||||
$('#progresstext_'+nuid+'').html('上传成功');
|
||||
var contss;
|
||||
if(js.isimg(f.fileext)){
|
||||
contss = '[图片 '+f.filesizecn+']';
|
||||
}else{
|
||||
contss = '['+f.filename+' '+f.filesizecn+']';
|
||||
}
|
||||
var s = this.contshozt(f);
|
||||
$('#showve_'+nuid+'').html(s);
|
||||
return contss;
|
||||
},
|
||||
uperror:function(nuid){
|
||||
if(!nuid)nuid=this.nuidup_tep;
|
||||
$('#progresstext_'+nuid+'').html('<font color=red>上传失败</font>');
|
||||
$('#progcanter_'+nuid+'').remove();
|
||||
},
|
||||
cancelup:function(nuid){
|
||||
if(!nuid)nuid=this.nuidup_tep;
|
||||
try{if(this.upobj)this.upobj.abort();}catch(e){}
|
||||
$('#ltcont_'+nuid+'').remove();
|
||||
},
|
||||
openimg:function(src){
|
||||
var img = src;
|
||||
if(src.indexOf('thumb')>0){
|
||||
var ext = src.substr(src.lastIndexOf('.')+1);
|
||||
img = src.substr(0,src.lastIndexOf('_'))+'.'+ext;
|
||||
}
|
||||
js.open(img);
|
||||
},
|
||||
emotsarrss:{},
|
||||
init:function(){
|
||||
var a = this.emotsstr.split(',');
|
||||
this.emotsarr=a;
|
||||
var len = a.length,i;
|
||||
for(i=1;i<len;i++){
|
||||
this.emotsarrss[a[i]]=i;
|
||||
}
|
||||
this.dt=js.now();
|
||||
},
|
||||
contshozt:function(d, lj){
|
||||
var s='',slx,sttr;
|
||||
if(!d)return s;
|
||||
if(!d.fileid)d.fileid=d.id;
|
||||
if(js.isimg(d.fileext)){
|
||||
sttr='';
|
||||
if(d.thumbpath){
|
||||
s='<img src="'+d.thumbpath+'" style="max-width:250px" onclick="strformat.clickimg(this)" fid="'+d.fileid+'">';
|
||||
}else{
|
||||
if(d.width){
|
||||
if(d.width>150)sttr='width="150"';
|
||||
}else{
|
||||
sttr='width="150"';
|
||||
}
|
||||
s='<img src="'+d.filepath+'" onclick="strformat.clickimg(this)" '+sttr+' fid="'+d.fileid+'">';
|
||||
}
|
||||
}else if(d.fileext=='amr'){
|
||||
s+='<i class="icon-volume-up"></i> '+(parseInt(d.filesize/1000))+'"';
|
||||
s+=' <a href="javascript:;" style="font-size:12px" onclick="js.fileopt('+d.fileid+',1)">下载</a>';
|
||||
}else{
|
||||
slx = d.fileext;if(!lj)lj='';
|
||||
if(js.fileall.indexOf(','+slx+',')<0)slx='wz';
|
||||
//s=''+d.filename+'<br><a href="javascript:;" onclick="js.fileopt('+d.fileid+',1)">下载</a> <a href="javascript:;" onclick="js.fileopt('+d.fileid+',0)">预览</a> '+d.filesizecn+'';
|
||||
s='<table><tr><td><div class="qipaofile">'+d.fileext.toUpperCase()+'</div></td><td>'+d.filename+'<br><span style="font-size:12px;color:#888888">('+d.filesizecn+') <a href="javascript:;" onclick="strformat.clickfile(\''+d.fileid+'\',1)">下载</a> <a href="javascript:;" onclick="strformat.clickfile(\''+d.fileid+'\',0)">预览</a></span></td></tr></table>';
|
||||
}
|
||||
return s;
|
||||
},
|
||||
clickfile:function(fid){
|
||||
js.msg('msg','没有开发打开');
|
||||
},
|
||||
clickimg:function(){
|
||||
|
||||
}
|
||||
}
|
||||
strformat.init();
|
||||
401
web/res/js/swfobject.js
Normal file
401
web/res/js/swfobject.js
Normal file
File diff suppressed because one or more lines are too long
8
web/res/js/websocket.js
Normal file
8
web/res/js/websocket.js
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* Copyright (c) 2016 rainrock (xh829.com)
|
||||
* Date:2016-01-01
|
||||
*/
|
||||
|
||||
function websocketClass(a){var b=this;this.wsobj=!1,this.wshost="",this.onopen=function(){},this.onmessage=function(){},this.onclose=function(){},this.onerror=function(){},this.reimfrom="rockdemo",this.adminid="1",this.sendname="1",this._init=function(){if(a)for(var c in a)this[c]=a[c];"undefined"==typeof WebSocket?(WEB_SOCKET_SWF_LOCATION="",WEB_SOCKET_DEBUG=!0,$.getScript("res/js/swfobject.js",function(){b._contect()})):this._contect()},this._contect=function(){this.wsobj=new WebSocket(this.wshost),this.wsobj.onopen=function(a){b._onopen(a)},this.wsobj.onmessage=function(a){b._onmessage(a)},this.wsobj.onclose=function(a){b._onclose(a)},this.wsobj.onerror=function(a){b._onerror(a)}},this.connect=function(){this._contect()},this._onopen=function(a){this.onopen(this,a),this.send({atype:"connect"})},this._onmessage=function(a){var b=a.data;this.onmessage(b,this)},this._onclose=function(a){this.onclose(this,a)},this._onerror=function(a){this.onerror(this,a)},this.send=function(a){var b=this.objecttostr(a);return this.wsobj.send(b)},this.objecttostr=function(a){var b,d,c="",e=js.apply({from:this.reimfrom,adminid:this.adminid,atype:"send",sendname:this.sendname},a);for(b in e)d=e[b],c+=',"'+b+'":"'+d+'"';return""!=c&&(c=c.substr(1)),"{"+c+"}"},this._init()}
|
||||
Reference in New Issue
Block a user