123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822 |
- {extend name="common/common2" /}
- {block name="main"}
- <style>
- .col-xs-3{
- padding: 10px 20px;
- }
- .model-btn{
- display: block;
- width: 100%;
- height: 200px;
- text-align: center;
- color: #fff;
- text-decoration: none;
- padding: 40px;
- }
- .model-btn:hover,.model-btn:focus,.model-btn:active{
- color: #fff;
- text-decoration: none;
- }
- .model-btn .model-btn-icon{
- font-size: 500%;
- margin: 0;
- }
- .model-btn .model-btn-title{
- font-size: 150%;
- margin: 0;
- }
- .bg-color-green{
- background-color: #0BB20C;
- }
- .bg-color-green:hover{
- background-color: #339933;
- }
- .bg-color-purple{
- background-color: #6a47d5;
- }
- .bg-color-purple:hover{
- /*background-color: #603cba;*/
- background-color: #6600CC;
- }
- .bg-color-red{
- background-color: #FF0000;
- }
- .bg-color-red:hover{
- background-color: #e1113d;
- }
- .bg-color-blue{
- background-color: #3366FF;
- }
- .bg-color-blue:hover{
- background-color: #3333CC;
- }
- </style>
- <div class="row">
- <div class="col-sm-12">
- <div class="ibox float-e-margins" style="display: block;">
- <div class="ibox-title">
- <h5>电话监控日志</h5>
- </div>
- <div class="ibox-content">
- <textarea id="StatusArea" rows="13" name="S1" class="form-control" readonly></textarea>
- <br>
- <input type="button" value="检查本地驱动是否安装" name="B0" onClick="I_CheckActiveX()">
- <input type="button" value="弹出电话" onClick="openPhone()">
- </div>
- </div>
- <div class="ibox float-e-margins" style="display: none;">
- <div class="ibox-title">
- <h5>监控信息</h5>
- </div>
- <div class="ibox-content">
- <div style="margin-top: 10px;margin-bottom: 10px;"></div>
- <div class="row metro">
- {foreach $worktype as $k=>$v}
- <div class="col-xs-3">
- <a
- href="javascript:;" onclick="layer_open(this,1)" url="{:url('orders/dispatchadd',[],'')}/mode/{$v.id}"
- data-title="{$v.title}"
- {if $v['id'] == 1}
- class="model-btn bg-color-green btn-dialog-form"
- {/if}
- {if $v['id'] == 2}
- class="model-btn bg-color-purple btn-dialog-form"
- {/if}
- {if $v['id'] == 3}
- class="model-btn bg-color-blue btn-dialog-form"
- {/if}
- {if $v['id'] == 4}
- class="model-btn bg-color-red btn-dialog-form"
- {/if} >
- <p class="model-btn-icon">
- {if $v['id'] == 1}
- <i class="glyphicon glyphicon-wrench"></i>
- {/if}
- {if $v['id'] == 2}
- <i class="glyphicon glyphicon-plus"></i>
- {/if}
- {if $v['id'] == 3}
- <i class="glyphicon glyphicon-transfer"></i>
- {/if}
- {if $v['id'] == 4}
- <i class="glyphicon glyphicon-ban-circle"></i>
- {/if}
- </p>
- <p class="model-btn-title">{$v.title}</p>
- </a>
- </div>
- {/foreach}
- </div>
- <div style="margin-top: 10px;margin-bottom: 20px;"></div>
- </div>
- </div>
- <div class="panel-group">
- <div class="panel panel-default">
- <div class="panel-heading clearfix">
- <div class="btn-group pull-right"></div>
- <div class="btn-group pull-left">
- 近50条电话记录
- </div>
- </div>
- <div class="panel-body" style="max-height: 300px;overflow: auto">
- <table class="table table-striped">
- <tr>
- <th>时间</th>
- <th>科室</th>
- <th>负责人</th>
- <th>电话</th>
- <th>备注</th>
- <th>操作</th>
- </tr>
- <tbody id="slistphone">
- <!-- <tr>-->
- <!-- <td>时间</td>-->
- <!-- <td>科室</td>-->
- <!-- <td>负责人</td>-->
- <!-- <td>电话</td>-->
- <!-- <td>-->
- <!-- <a href="#">报修</a> -->
- <!-- <a href="#">保洁</a> -->
- <!-- <a href="#">运送</a> -->
- <!-- <a href="#">应急</a> -->
- <!-- </td>-->
- <!-- </tr>-->
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- {/block}
- {block name="script"}
- <script language="javascript" type="text/javascript" src="/static/phonejs/qnviccub.js"></script>
- <script language="javascript" type="text/javascript" src="/static/phonejs/qnvfunc.js"></script>
- <script language="javascript" type="text/javascript" src="/static/phonejs/json2.js"></script>
- <script language="javascript" type="text/javascript" src="/static/phonejs/deviceapi.js"></script>
- <script>
- $(document).ready(function(){
- // TV_Initialize();
- // getEvent(T_GetEvent);
- });
- $(window).unload(function(){
- // TV_Disable();
- });
- setInterval(function () {
- // OpenDevice(ODT_LBRIDGE,function(nResult){AppendStatus('打开设备.');});
- },30000);
- //离开页面
- $(window).bind('beforeunload',function(){
- // TV_Disable();
- });
- var plist = {:json_encode($list)};
- var id = 0;
- var name = '';
- var dep = '';
- var phone = '';
- var remark = '';
- var time = '';
- var slphone = localStorage.slist;
- var slist = slphone ? JSON.parse(slphone) : [];
- slistPhoneHtml();
- function openPhone() {
- let gphone = "13838379499";
- check_phone(gphone);
- setTimeout(function () {
- check_phone(gphone);
- },3000);
- }
- function selectPhone(){
- slist.unshift({
- id: id,
- name: name,
- dep: dep,
- phone: phone,
- time: time,
- remark:remark
- });
- if(slist.length > 50){
- slist.pop();
- }
- localStorage.slist = JSON.stringify(slist);
- slistPhoneHtml();
- }
- function slistPhoneHtml(){
- console.log('slistPhoneHtml',slist);
- if(slist.length > 0){
- let str = '';
- for (let o in slist){
- str += '<tr>';
- str += '<td>' + slist[o].time + '</td>';
- str += '<td>' + slist[o].dep + '</td>';
- str += '<td>' + slist[o].name + '</td>';
- str += '<td>' + slist[o].phone + '</td>';
- str += '<td>' + slist[o].remark + '</td>';
- str += '<td>';
- str += '<a href="javascript:;" data-title="创建报修订单" onclick="layer_open(this,1)" url="{:url("Orders/dispatchAdd",[],"")}/mode/1?id='+slist[o].id+'">报修</a> ';
- str += '<a href="javascript:;" data-title="创建保洁订单" onclick="layer_open(this,1)" url="{:url("Orders/dispatchAdd",[],"")}/mode/2?id='+slist[o].id+'">保洁</a> ';
- str += '<a href="javascript:;" data-title="创建运送订单" onclick="layer_open(this,1)" url="{:url("Orders/dispatchAdd",[],"")}/mode/3?id='+slist[o].id+'">运送</a> ';
- str += '<a href="javascript:;" data-title="创建应急订单" onclick="layer_open(this,1)" url="{:url("Orders/dispatchAdd",[],"")}/mode/4?id='+slist[o].id+'">应急</a> ';
- str += '</td>';
- str += '</tr>';
- }
- $('#slistphone').html(str);
- }
- }
- $('.btn-dialog-myform').click(function (e) {
- /*if(id <= 0){
- layer.msg('未测到科室信息');
- return false;
- }*/
- var url = $(this).attr('href') + '&id=' + id;
- var title = '添加' + $(this).attr('data-title');
- // jFlyer.show_dialog_form(title, url);
- layer.open({
- type: 2,
- shade: 0.8,
- title: title,
- area: 'auto',
- area: ['800px', '90%'],
- fix: false, //不固定
- maxmin: true,
- content: url,
- skin: 'layer-ext-moon',
- success: function(layero, index) {
- layer.iframeAuto(index);
- //设置标题
- //layer.title($this.text(), index);
- },
- btn: ['取消']
- });
- return false;
- });
- function check_phone(gphone) {
- var url = '{:url("orders/phone")}?phone=' + gphone;
- var title = '添加订单';
- layer.open({
- type: 2,
- shade: 0.8,
- title: title,
- area: 'auto',
- area: ['800px', '90%'],
- fix: false, //不固定
- maxmin: true,
- content: url,
- skin: 'layer-ext-moon',
- success: function(layero, index) {
- layer.iframeAuto(index);
- //设置标题
- //layer.title($this.text(), index);
- },
- btn: ['取消']
- });
- return false;
- }
- //check_phone('13800000000')
- function check_phone_old(gphone) {
- id = 0;
- name = '';
- dep = '';
- phone = '';
- time = '';
- remark = '';
- if(plist.length <= 0){
- return false;
- }
- for (let o in plist){
- if(gphone == plist[o].phone){
- id = plist[o].id;
- name = plist[o].real_name;
- dep = plist[o].dep;
- phone = plist[o].phone;
- remark = plist[o].remark;
- time = getCurrentDate(2);
- break;
- }
- }
- if(id > 0){
- // $('#dep').html('科室:' + dep);
- // $('#name').html(' 负责人:' + name);
- // $('#phone').html(' 电话:' + phone);
- // $('#time').html(' 来电时间:' + time);
- selectPhone();
- var url = '{:url("orders/phoneAdd")}?id=' + id;
- var title = '添加订单';
- // jFlyer.show_dialog_form(title, url);
- layer.open({
- type: 2,
- shade: 0.8,
- title: title,
- area: 'auto',
- area: ['800px', '90%'],
- fix: false, //不固定
- maxmin: true,
- content: url,
- skin: 'layer-ext-moon',
- success: function(layero, index) {
- layer.iframeAuto(index);
- //设置标题
- //layer.title($this.text(), index);
- },
- btn: ['取消']
- });
- return false;
- }else{
- // $('#dep').html('');
- // $('#name').html('');
- // $('#phone').html('');
- // $('#time').html('');
- }
- }
- function AppendStatus(szStatus)
- {
- $("#StatusArea").append(szStatus+"\r\n" );
- var scrollTop = $("#StatusArea")[0].scrollHeight;
- $("#StatusArea").scrollTop(scrollTop);
- }
- function AppendStatusEx(uID,szStatus)
- {
- uID=uID+1;
- AppendStatus("通道"+uID+":"+szStatus);
- }
- function showDlg(flag)
- {
- var urlStr=prompt("请输入上传的文件的URL,格式如php文件上传","");
- if (urlStr!=null && urlStr != "")
- {
- if(flag==0)
- TV_uploadFile(urlStr);
- else
- ali_uploadFile(urlStr);
- }
- else{
- alert('上传url不能为空!');
- }
- }
- function T_GetEvent(uID,uEventType,uHandle,uResult,szdata)
- {
- // console.log(uID,uEventType,uHandle,uResult,szdata);
- //var vValueArray=qnviccub.QNV_Event(0,2,0,"","",1024);
- if(uEventType == -1)
- return;
- var vValue=" type="+uEventType+" Handle="+uHandle+" Result="+uResult+" szdata="+szdata;
- switch(uEventType)
- {
- case BriEvent_PhoneHook:// 本地电话机摘机事件
- AppendStatusEx(uID,"本地电话机摘机"+vValue);
- break;
- case BriEvent_PhoneDial:// 只有在本地话机摘机,没有调用软摘机时,检测到DTMF拨号
- AppendStatusEx(uID,"本地话机拨号"+vValue);
- break;
- case BriEvent_PhoneHang:// 本地电话机挂机事件
- TV_HangUpCtrl(uID);
- AppendStatusEx(uID,"本地电话机挂机"+vValue);
- break;
- case BriEvent_CallIn:// 外线通道来电响铃事件
- AppendStatusEx(uID,"外线通道来电响铃事件"+vValue);
- break;
- case BriEvent_GetCallID://得到来电号码
- AppendStatusEx(uID,"得到来电号码"+vValue);
- check_phone(szdata);
- break;
- case BriEvent_StopCallIn:// 对方停止呼叫(产生一个未接电话)
- AppendStatusEx(uID,"对方停止呼叫(产生一个未接电话)"+vValue);
- break;
- case BriEvent_DialEnd:// 调用开始拨号后,全部号码拨号结束
- AppendStatusEx(uID,"调用开始拨号后,全部号码拨号结束"+vValue);
- break;
- case BriEvent_PlayFileEnd:// 播放文件结束事件
- AppendStatusEx(uID,"播放文件结束事件"+vValue);
- break;
- case BriEvent_PlayMultiFileEnd:// 多文件连播结束事件
- AppendStatusEx(uID,"多文件连播结束事件"+vValue);
- break;
- case BriEvent_PlayStringEnd://播放字符结束
- AppendStatusEx(uID,"播放字符结束"+vValue);
- break;
- case BriEvent_RepeatPlayFile:// 播放文件结束准备重复播放
- AppendStatusEx(uID,"播放文件结束准备重复播放"+vValue);
- break;
- case BriEvent_SendCallIDEnd:// 给本地设备发送震铃信号时发送号码结束
- AppendStatusEx(uID,"给本地设备发送震铃信号时发送号码结束"+vValue);
- break;
- case BriEvent_RingTimeOut://给本地设备发送震铃信号时超时
- AppendStatusEx(uID,"给本地设备发送震铃信号时超时"+vValue);
- break;
- case BriEvent_Ringing://正在内线震铃
- AppendStatusEx(uID,"正在内线震铃"+vValue);
- break;
- case BriEvent_Silence:// 通话时检测到一定时间的静音.默认为5秒
- AppendStatusEx(uID,"通话时检测到一定时间的静音"+vValue);
- break;
- case BriEvent_GetDTMFChar:// 线路接通时收到DTMF码事件
- AppendStatusEx(uID,"线路接通时收到DTMF码事件"+vValue);
- break;
- case BriEvent_RemoteHook:// 拨号后,被叫方摘机事件
- AppendStatusEx(uID,"拨号后,被叫方摘机事件"+vValue);
- break;
- case BriEvent_RemoteHang://对方挂机事件
- TV_HangUpCtrl(uID);
- AppendStatusEx(uID,"对方挂机事件"+vValue);
- break;
- case BriEvent_Busy:// 检测到忙音事件,表示PSTN线路已经被断开
- AppendStatusEx(uID,"检测到忙音事件,表示PSTN线路已经被断开"+vValue);
- break;
- case BriEvent_DialTone:// 本地摘机后检测到拨号音
- AppendStatusEx(uID,"本地摘机后检测到拨号音"+vValue);
- break;
- case BriEvent_RingBack:// 电话机拨号结束呼出事件。
- AppendStatusEx(uID,"电话机拨号结束呼出事件"+vValue);
- break;
- case BriEvent_MicIn:// MIC插入状态
- AppendStatusEx(uID,"MIC插入状态"+vValue);
- break;
- case BriEvent_MicOut:// MIC拔出状态
- AppendStatusEx(uID,"MIC拔出状态"+vValue);
- break;
- case BriEvent_FlashEnd:// 拍插簧(Flash)完成事件,拍插簧完成后可以检测拨号音后进行二次拨号
- AppendStatusEx(uID,"拍插簧(Flash)完成事件,拍插簧完成后可以检测拨号音后进行二次拨号"+vValue);
- break;
- case BriEvent_RefuseEnd:// 拒接完成
- AppendStatusEx(uID,"拒接完成"+vValue);
- break;
- case BriEvent_SpeechResult:// 语音识别完成
- AppendStatusEx(uID,"语音识别完成"+vValue);
- break;
- case BriEvent_FaxRecvFinished:// 接收传真完成
- AppendStatusEx(uID,"接收传真完成"+vValue);
- break;
- case BriEvent_FaxRecvFailed:// 接收传真失败
- AppendStatusEx(uID,"接收传真失败"+vValue);
- break;
- case BriEvent_FaxSendFinished:// 发送传真完成
- AppendStatusEx(uID,"发送传真完成"+vValue);
- break;
- case BriEvent_FaxSendFailed:// 发送传真失败
- AppendStatusEx(uID,"发送传真失败"+vValue);
- break;
- case BriEvent_OpenSoundFailed:// 启动声卡失败
- AppendStatusEx(uID,"启动声卡失败"+vValue);
- break;
- case BriEvent_UploadSuccess://远程上传成功
- AppendStatusEx(uID,"远程上传成功"+vValue);
- break;
- case BriEvent_UploadFailed://远程上传失败
- AppendStatusEx(uID,"远程上传失败"+vValue);
- break;
- case BriEvent_EnableHook:// 应用层调用软摘机/软挂机成功事件
- AppendStatusEx(uID,"应用层调用软摘机/软挂机成功事件"+vValue);
- break;
- case BriEvent_EnablePlay:// 喇叭被打开或者/关闭
- AppendStatusEx(uID,"喇叭被打开或者/关闭"+vValue);
- break;
- case BriEvent_EnableMic:// MIC被打开或者关闭
- AppendStatusEx(uID,"MIC被打开或者关闭"+vValue);
- break;
- case BriEvent_EnableSpk:// 耳机被打开或者关闭
- AppendStatusEx(uID,"耳机被打开或者关闭"+vValue);
- break;
- case BriEvent_EnableRing:// 电话机跟电话线(PSTN)断开/接通
- AppendStatusEx(uID,"电话机跟电话线(PSTN)断开/接通"+vValue);
- break;
- case BriEvent_DoRecSource:// 修改录音源
- AppendStatusEx(uID,"修改录音源"+vValue);
- break;
- case BriEvent_DoStartDial:// 开始软件拨号
- AppendStatusEx(uID,"开始软件拨号"+vValue);
- break;
- case BriEvent_RecvedFSK:// 接收到FSK信号,包括通话中FSK/来电号码的FSK
- AppendStatusEx(uID,"接收到FSK信号,包括通话中FSK/来电号码的FSK"+vValue);
- break;
- case BriEvent_PlugOut:
- AppendStatusEx(uID,"设备移除");
- // alert('设备移除');
- break;
- case BriEvent_DevErr://设备错误
- AppendStatusEx(uID,"设备错误"+ decodeURIComponent(vValue) );
- // alert('设备错误');
- break;
- default:
- if(uEventType < BriEvent_EndID)
- AppendStatusEx(uID,"忽略其它事件发生:ID=" + uEventType+ vValue);
- break;
- }
- }
- //编码问题
- var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var base64DecodeChars = new Array(
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
- -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
- function base64encode(str) {
- var out, i, len;
- var c1, c2, c3;
- len = str.length;
- i = 0;
- out = "";
- while(i < len) {
- c1 = str.charCodeAt(i++) & 0xff;
- if(i == len)
- {
- out += base64EncodeChars.charAt(c1 >> 2);
- out += base64EncodeChars.charAt((c1 & 0x3) << 4);
- out += "==";
- break;
- }
- c2 = str.charCodeAt(i++);
- if(i == len)
- {
- out += base64EncodeChars.charAt(c1 >> 2);
- out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
- out += base64EncodeChars.charAt((c2 & 0xF) << 2);
- out += "=";
- break;
- }
- c3 = str.charCodeAt(i++);
- out += base64EncodeChars.charAt(c1 >> 2);
- out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
- out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6));
- out += base64EncodeChars.charAt(c3 & 0x3F);
- }
- return out;
- }
- function base64decode(str) {
- var c1, c2, c3, c4;
- var i, len, out;
- len = str.length;
- i = 0;
- out = "";
- while(i < len) {
- /* c1 */
- do {
- c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
- } while(i < len && c1 == -1);
- if(c1 == -1)
- break;
- /* c2 */
- do {
- c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
- } while(i < len && c2 == -1);
- if(c2 == -1)
- break;
- out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
- /* c3 */
- do {
- c3 = str.charCodeAt(i++) & 0xff;
- if(c3 == 61)
- return out;
- c3 = base64DecodeChars[c3];
- } while(i < len && c3 == -1);
- if(c3 == -1)
- break;
- out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
- /* c4 */
- do {
- c4 = str.charCodeAt(i++) & 0xff;
- if(c4 == 61)
- return out;
- c4 = base64DecodeChars[c4];
- } while(i < len && c4 == -1);
- if(c4 == -1)
- break;
- out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
- }
- return out;
- }
- function utf16to8(str) {
- var out, i, len, c;
- out = "";
- len = str.length;
- for(i = 0; i < len; i++) {
- c = str.charCodeAt(i);
- if ((c >= 0x0001) && (c <= 0x007F)) {
- out += str.charAt(i);
- } else if (c > 0x07FF) {
- out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
- out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
- out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
- } else {
- out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
- out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
- }
- }
- return out;
- }
- function utf8to16(str) {
- var out, i, len, c;
- var char2, char3;
- out = "";
- len = str.length;
- i = 0;
- while(i < len) {
- c = str.charCodeAt(i++);
- switch(c >> 4)
- {
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- // 0xxxxxxx
- out += str.charAt(i-1);
- break;
- case 12: case 13:
- // 110x xxxx 10xx xxxx
- char2 = str.charCodeAt(i++);
- out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
- break;
- case 14:
- // 1110 xxxx 10xx xxxx 10xx xxxx
- char2 = str.charCodeAt(i++);
- char3 = str.charCodeAt(i++);
- out += String.fromCharCode(((c & 0x0F) << 12) |
- ((char2 & 0x3F) << 6) |
- ((char3 & 0x3F) << 0));
- break;
- }
- }
- return out;
- }
- function getCurrentDate(format) {
- var now = new Date();
- var year = now.getFullYear(); //得到年份
- var month = now.getMonth();//得到月份
- var date = now.getDate();//得到日期
- var day = now.getDay();//得到周几
- var hour = now.getHours();//得到小时
- var minu = now.getMinutes();//得到分钟
- var sec = now.getSeconds();//得到秒
- month = month + 1;
- if (month < 10) month = "0" + month;
- if (date < 10) date = "0" + date;
- if (hour < 10) hour = "0" + hour;
- if (minu < 10) minu = "0" + minu;
- if (sec < 10) sec = "0" + sec;
- var time = "";
- //精确到天
- if(format==1){
- time = year + "-" + month + "-" + date;
- }
- //精确到分
- else if(format==2){
- time = year + "-" + month + "-" + date+ " " + hour + ":" + minu + ":" + sec;
- }
- return time;
- }
- </script>
- {/block}
|