diff --git a/plugin/release/diy/Demo.php b/plugin/release/diy/Demo.php index c7660ec..c0f3ccd 100644 --- a/plugin/release/diy/Demo.php +++ b/plugin/release/diy/Demo.php @@ -11,7 +11,7 @@ class Demo extends BaseDiy{ 'db_pwd' => '', //密码 'db_port' => 3306, //端口 'db_prefix' => '', //表前缀 - 'db_charset' => 'utf8', //编码 + 'db_charset' => 'utf8mb4', //编码 ); /** * 导入数据 diff --git a/public/static/css/admin.css b/public/static/css/admin.css index 221854b..0596308 100644 --- a/public/static/css/admin.css +++ b/public/static/css/admin.css @@ -6,6 +6,56 @@ .info-box-content .info-box-number{font-weight:normal;line-height:25px;} .info-box-content .info-box-number .tips{margin-left:5px;font-size:14px;display:inline;} .help-block{color:#aaa;} +/*左侧宽度*/ +.content-wrapper,.main-footer{margin-left: 200px;} +.main-header .navbar { + margin-left: 200px; +} +.main-header .logo { + width: 200px; + font-size:19px; + text-shadow: 1px 1px 1px rgba(0,0,0,0.5); + font-family:'Microsoft YaHei'; +} +.main-sidebar { + width: 200px; +} +.control-sidebar-bg,.control-sidebar { + right: -200px; + width: 200px; +} +@media (min-width: 768px) { + .sidebar-collapse .content-wrapper,.sidebar-collapse .main-footer { + margin-left:0 + } + .sidebar-collapse .main-sidebar { + -webkit-transform:translate(-200px, 0); + -ms-transform: translate(-200px, 0); + -o-transform: translate(-200px, 0); + transform: translate(-200px, 0) + } + .control-sidebar-open .content-wrapper,.control-sidebar-open .right-side,.control-sidebar-open .main-footer { + margin-right:200px + } +} +@media (max-width: 767px) { + .content-wrapper,.main-footer { + margin-left:0 + } + .sidebar-open .content-wrapper,.sidebar-open .main-footer { + -webkit-transform:translate(200px, 0); + -ms-transform: translate(200px, 0); + -o-transform: translate(200px, 0); + transform: translate(200px, 0) + } + .main-sidebar { + -webkit-transform:translate(-200px, 0); + -ms-transform: translate(-200px, 0); + -o-transform: translate(-200px, 0); + transform: translate(-200px, 0) + } + +} /*取消动画*/ .content-wrapper, .main-footer, @@ -27,6 +77,11 @@ transition:none!important; } /*全局*/ +.treeview>ul.treeview-menu>li:FIRST-CHILD{padding-top:5px!important;} +.treeview>ul.treeview-menu>li:LAST-CHILD{padding-bottom:5px!important;} +.treeview>ul.treeview-menu>li>ul.treeview-menu>li:FIRST-CHILD{padding-top:0px!important;} +.treeview>ul.treeview-menu>li>ul.treeview-menu>li:LAST-CHILD{padding-bottom:0px!important;} + .modal-body .form-group:last-child>button[type="submit"]{margin-bottom:-15px;} .modal-body .form-group .help-block:last-child{margin-bottom:0;} @@ -103,6 +158,9 @@ div.in-line-mg{display:inline;margin-right:5px;} .echo-msg-lt{float:left;} .echo-msg-lurl{float:left;margin-right:3px;height:17px;max-width:70%;overflow:hidden;text-overflow:ellipsis;word-wrap:break-word;word-break:break-all;} +.login-logo{ + font-family:'Microsoft YaHei'; +} /*皮肤*/ .skin-blue-light .treeview-skins,.skin-black-light .treeview-skins,.skin-red-light .treeview-skins,.skin-yellow-light .treeview-skins,.skin-purple-light .treeview-skins,.skin-green-light .treeview-skins{ color:#000; @@ -140,6 +198,16 @@ div.in-line-mg{display:inline;margin-right:5px;} .skin-purple .steps-bar .current .round,.skin-purple .steps-bar .current .bar,.skin-purple-light .steps-bar .current .round,.skin-purple-light .steps-bar .current .bar{background:#605ca8;color:#fff;border-color:#605ca8;} .skin-purple .steps-bar .current a,.skin-purple-light .steps-bar .current a {color: #555299;} +.skin-black .nav-tabs-color li.active,.skin-black-light .nav-tabs-color li.active{border-top-color:#5A6E82!important;} + +.skin-green .nav-tabs-color li.active,.skin-green-light .nav-tabs-color li.active{border-top-color:#00a65a!important;} + +.skin-red .nav-tabs-color li.active,.skin-red-light .nav-tabs-color li.active{border-top-color:#dd4b39!important;} + +.skin-yellow .nav-tabs-color li.active,.skin-yellow-light .nav-tabs-color li.active{border-top-color:#f39c12!important;} + +.skin-purple .nav-tabs-color li.active,.skin-purple-light .nav-tabs-color li.active{border-top-color:#605ca8!important;} + /*数据表*/ .datatable .sub{padding-left:50px; background:url('../images/bg_column.gif') no-repeat 15px 10px;} .datatable td .dropdown{display:inline;} @@ -209,218 +277,19 @@ table.table thead .sorting_desc:after { .modal-title{font-size:16px;} .myModal .modal-body iframe{width:100%;height:100%;min-height:200px;} .myModal button.close{font-size:18px;} -/*采集器面板*/ -.coll-panel .panel-heading{background-color:#d2d6de;} -.coll-panel .panel-default .panel-default .panel-heading{background-color:#efefef;} -.coll-panel .panel-heading a{color:#333;} - -.coll-alert{color:#333!important;background-color:#f5f5f5!important;border-color:#ddd!important;} - -.c-p-source-urls>.form-group:first-child{margin-top:10px;} - -#c_p_level_urls tbody{ - counter-reset:levelcounter; -} -#c_p_level_urls .level:before{ - content:counter(levelcounter); - counter-increment:levelcounter; - font-weight:bold; -} - -#c_p_front_urls td.sign,#c_p_level_urls td.sign,#c_p_relation_urls td.sign{ - width:50%;overflow:hidden;padding-bottom:0; -} -#c_p_front_urls .sign-th,#c_p_level_urls .sign-th,#c_p_relation_urls .sign-th{ - padding-left:5px; -} -#c_p_front_urls .signs,#c_p_level_urls .signs,#c_p_relation_urls .signs{ - border:0;padding:0px 5px;height:20px;line-height:14px;font-size:12px;color:#555;background:#fff; -} - -/*采集器选项卡*/ -.coll-tab > li:nth-child(2).active > a,.coll-tab > li:nth-child(3).active > a{background:#f5f5f5;} -.coll-tab > li{ - -moz-user-select:none; - -webkit-user-select:none; - -ms-user-select:none; - -khtml-user-select:none; - user-select:none; -} -.coll-tab>li>a{ - border-bottom:0; -} -/*请求头信息*/ -.c-p-request-headers table,.c-p-request-headers-img table,.c-p-request-headers-file table{margin-bottom:0} -.c-p-request-headers .delete-request-header,.c-p-request-headers-img .delete-request-header-img,.c-p-request-headers-file .delete-request-header-file{margin-top:8px;} -.c-p-request-headers td:first-child,.c-p-request-headers-img td:first-child,.c-p-request-headers-file td:first-child{width:200px;} -.c-p-request-headers td:last-child,.c-p-request-headers-img td:last-child,.c-p-request-headers-file td:last-child{width:50px;text-align:center;} -/*内容标签*/ -.c-p-url-content-signs{ - width:auto; - overflow:hidden; -} - -/*页面源码表单和请求头*/ -.c-p-url-web-form table,.c-p-url-web-header table{margin-bottom:0;} -.c-p-url-web-form .delete-url-web-form,.c-p-url-web-header .delete-url-web-header{margin-top:8px;} -.c-p-url-web-form td:first-child,.c-p-url-web-header td:first-child{width:200px;} -.c-p-url-web-form td:last-child,.c-p-url-web-header td:last-child{width:50px;text-align:center;} -/*页面渲染动作*/ -.c-p-url-renderer-list table{margin-bottom:0;} -.c-p-url-renderer-list .td-renderer-element,.c-p-url-renderer-list .td-renderer-content{display:none;} -.c-p-url-renderer-list .td-renderer-op{width:65px;text-align:center;} -.c-p-url-renderer-list .td-renderer-op .input-group-addon:last-child{border-left:1px solid #d2d6de;} - -/*显示标签列表,input-group-btn必须position:static,否则dropdown-menu定位太窄*/ -.c-p-url-page-signs>.input-group-btn{position:static;} -.c-p-url-page-signs .dropdown-menu{padding:0;box-shadow:none;border:0;} -.c-p-url-page-signs .c-p-url-ps-table{padding:10px;box-shadow:0 0 2px 2px #eee;border:1px solid #ddd;border-radius:4px;} -.c-p-url-page-signs .c-p-url-ps-table .table{margin-bottom:0;} -.c-p-url-page-signs .c-p-url-ps-table .table td>a,.c-p-url-page-signs .dropdown-menu .table td>span{margin-right:5px;} -.c-p-url-page-signs .c-p-url-ps-table .table td>*:last-child{margin-right:0;} -.c-p-url-page-signs .c-p-url-ps-table .table td{white-space:normal!important;width:auto!important;} -.c-p-url-page-signs .c-p-url-ps-table .table td:first-child{white-space:nowrap!important;} -.c-p-url-page-signs .c-p-url-ps-table .table td:last-child{text-align:left!important;} - -/*分页字段*/ -.c-p-url-pagination-fields{ - width:auto; - overflow:hidden; -} - -/*参数标签样式*/ -.param-label{ - font-size:14px; - font-weight:normal; - padding: 4px 8px; - text-decoration: none; - border-bottom: none; - color: #3c8dbc; - border: 1px #ccc solid; - margin:7px 15px 5px 0; - position:relative; - float:left; -} -.param-label em.delete{ - font-style: normal; - display: block; - position: absolute; - top: -7px; - right: -5px; - z-index: 999; - background:#fff; -} -/*采集器字段*/ -.c-p-field-list .field-name{color:#3c8dbc;cursor:pointer;} -.c-p-field-list .exist-process{color:green;} -.c-p-field-list thead .sort-field{font-size:12px;color:#cdcdcd;margin-left:5px;display:none;} +/*杂项*/ .form-inline label{font-weight:normal;} -.c-p-field-list td .field-process{vertical-align:middle;} -.c-p-field-list td .glyphicon.icon-drag-move{font-size:12px;vertical-align:middle;} -.c-p-field-list td .glyphicon.field-clone{font-size:12px;top:0.3px;vertical-align:middle;} -.c-p-field-list td .glyphicon.field-del{font-size:12px;top:1.1px;vertical-align:middle;} - -#coll_tab_content td .glyphicon.icon-drag-move{font-size:12px;vertical-align:middle;} -#coll_tab_content td .glyphicon.clone{font-size:12px;top:0.3px;vertical-align:middle;} -#coll_tab_content td .glyphicon.delete{font-size:12px;top:1.1px;vertical-align:middle;} - -.c-p-process-accordion .panel-heading .glyphicon.c-p-process-title{font-size:11px;vertical-align:middle;} -.c-p-process-accordion .panel-heading .glyphicon.icon-drag-move{font-size:12px;vertical-align:middle;} -.c-p-process-accordion .panel-heading .glyphicon.c-p-process-clone{font-size:12px;top:0.3px;vertical-align:middle;} -.c-p-process-accordion .panel-heading .glyphicon.c-p-process-del{font-size:12px;top:1.1px;vertical-align:middle;} -.c-p-process-accordion .panel-heading .panel-title-title{float:left;} -.c-p-process-accordion .panel-heading .panel-title-title input{display:none;border-radius:2px;border:1px solid #ccc;line-height:14px;font-size:12px;margin-left:5px;padding:1px 1px 1px 2px;} -.c-p-process-accordion .panel-heading .panel-title-ops{float:right;line-height:19px;} - - -#task_list_folder .taskgroup-opened .icon-folder-pre:before{content:"\2212"} -#task_list_folder .taskgroup-opened .icon-folder:before{content:"\e118"} - -#task_list_folder .icon-folder-pre:before{font-size:12px;content:"\002b"} -#task_list_folder .icon-folder:before{content:"\e117";margin-right:5px;} - - .box-header .navbar-toggle{background:#efefef;margin-top:0;} .box-header .navbar-toggle .icon-bar{background:#aaa;} .form-item .form-horizontal .control-label{text-align:left;width:120px;font-weight:normal;} - .loading{background:url('../images/loading.gif') no-repeat 5px 0;background-size:27px 27px;width:32px;height:27px;} .loading-sm{background:url('../images/load1.gif') no-repeat 0 0;background-size:11px 11px;width:11px;height:11px;display:inline-block;} -.iga-rt{text-align:left;line-height:20px;} -.iga-rt .blk{display:block;} -.iga-rt .mgr{margin-right:5px;} - -.iga-rt1{padding:0;vertical-align:top;} -.iga-rt1 .slt{width:100%;min-width:58px;height:24px;display:block;color:#555;font-weight:bold;padding:1px;margin:0;border:0;background:#F1F1F1;} -.iga-rt1 .op{margin:0;padding:3px 6px;list-style:none;} -.iga-rt1 .op li{display:none;} - -.nav-save-rule{float:right!important;} -/*数据处理*/ -.form-control-slt{width:30px!important;text-align:center;} -.form-control-slt select.form-control{min-width:20px!important;width:20px!important;height:30px!important;float:none!important;border:0!important;padding:0!important;margin:0!important;text-indent:-20px!important;} - -.p-m-func-field{display:inline;width:80px;border:0;cursor:pointer;margin:0;padding:0;height:auto;color:#555;} - -.p-m-api-val-field,.p-m-api-header-field{display:none;margin-left:-1px;padding:0;} - -.p-m-api-table table,.p-m-api-header-table table{margin-bottom:0;} -.p-m-api-table td:first-child,.p-m-api-header-table td:first-child{width:200px;} -.p-m-api-table td:last-child,.p-m-api-header-table td:last-child{width:50px;text-align:center;} -.p-m-api-rule-module{display:none;} - -.p-m-html-tags{} -.p-m-html-tags a{font-size:12px;font-weight:normal;cursor:pointer;margin-right:5px;} -.p-m-html-tags a span{margin-right:2px;color:#999;} -.p-m-if-val-func{position:relative;} -.p-m-if-val-func a.input-group-addon{border-left:0;} -.p-m-if-val-func .input-group-btn>select{margin-left:-1px;width:auto;padding:0;padding-left:5px;text-align:center;} -.p-m-if-op{width:70px;padding:15px 0 0 8px!important;font-size:11px;} -.p-m-if-add{font-size:12px;} - -.p-m-download-op{display:none;margin-top:15px;} -/*发布设置*/ -.rele-db-error{margin-top:10px;color:red;font-weight:bold;} -.db-table-bind-params{padding:0;margin-bottom:0;border:0;} -.db-table-bind-params .table{margin-bottom:0;} -.db-table-bind-params .table tr>th:first-child,.db-table-bind-params .table tr>td:first-child{padding-left:15px;} -.db-table-bind-params .table thead th{padding-top:13px;padding-bottom:13px;} -.db-table-bind-op{width:auto;height:auto;display:inline;padding:0;} -.db-table-bind-where-tpl,.db-table-bind-query-tpl{display:none;} - -.db-table-bind-where,.db-table-bind-query{display:none;} -.db-table-bind-data-seq{display:none;} -.db-table-bind-where,.db-table-bind-query,.db-table-bind-data{border:0;} - -.db-table-bind-signs>.input-group-btn{position:static;} - -.dm-db-charset li {padding:5px 15px;} -.dm-db-charset li.divider{padding:0;} -.dm-db-charset li span{padding:5px; cursor:pointer;color:#555;} -.dm-db-charset li span:hover{background:#eee;} - -.toapi-param-table table,.toapi-header-table table{margin-bottom:0;} -.toapi-param-table td:first-child,.toapi-header-table td:first-child{width:200px;} -.toapi-param-table td:last-child,.toapi-header-table td:last-child{width:50px;text-align:center;} - -#toapi_resp_module_help .help-block{display:none;margin:0;} - -.toapi-app-table table tr td{height:50px;vertical-align:middle!important;} -.toapi-field-txt>.input-group-addon{padding:0;} -.toapi-field-txt>.input-group-addon a.dropdown-toggle{border-color:#fff;padding:6px 12px;color:#666;} -.toapi-field-txt>.input-group-addon a.dropdown-toggle:hover{color:#000;} -.toapi-field-txt>.input-group-addon a.dropdown-toggle .caret{margin-top:-2px;} - -.toapi-field-slt select.form-control{min-width:120px!important;margin-right:-1px;min-height:34px;max-height:90px;} -.toapi-field-slt textarea.form-control{height:90px;} -.toapi-field-slt input.form-control,.toapi-field-slt textarea.form-control,.toapi-field-slt .input-group-addon{display:none!important;} - -.toapi-field-slt-txt input.form-control,.toapi-field-slt-txt textarea.form-control,.toapi-field-slt-txt .input-group-addon{display:table-cell!important;} +footer.footer-end{display:none;} /*步骤条*/ .steps-bar{width:100%;overflow:hidden;color:#999;} .steps-bar a{color:#999;} @@ -496,11 +365,6 @@ table.table thead .sorting_desc:after { border-radius: 4px; background:#d3d3d3; } -/**/ -#cms_bind em{color:red;} -#cms_bind .box{margin-bottom:0;} -#cms_bind .table{margin-bottom:0;} -#toapi_app_params em{color:red;} /*my store*/ .nav-tabs-color li.active{border-top-color:#3c8dbc!important;} @@ -552,39 +416,6 @@ table.table thead .sorting_desc:after { .deve-editor-apps li{padding:2px 0;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;} .deve-editor-apps li a{color:#333;} .deve-editor-apps li.cur a{font-weight:bold;} -/**/ -.table-test-loop thead{background:#fafafa;} -.table-test-loop thead th,.table-test-loop thead td{ - padding:0!important; - -moz-user-select:none; - -webkit-user-select:none; - -ms-user-select:none; - -khtml-user-select:none; - user-select:none; -} -.table-test-loop thead th>div{ - cursor:w-resize; - padding:8px; -} -.table-test-loop tbody td{ - position:relative; -} -.table-test-loop input{border:0;overflow:hidden;width:100%;min-width:150px;} -.table-test-loop .view-box{padding-left:20px;} -.table-test-loop .view-ipt{} -.table-test-loop .view-btn{position:absolute;font-size:12px;top:12px;left:5px;} - -footer.footer-end{display:none;} - -.skin-black .nav-tabs-color li.active,.skin-black-light .nav-tabs-color li.active{border-top-color:#5A6E82!important;} - -.skin-green .nav-tabs-color li.active,.skin-green-light .nav-tabs-color li.active{border-top-color:#00a65a!important;} - -.skin-red .nav-tabs-color li.active,.skin-red-light .nav-tabs-color li.active{border-top-color:#dd4b39!important;} - -.skin-yellow .nav-tabs-color li.active,.skin-yellow-light .nav-tabs-color li.active{border-top-color:#f39c12!important;} - -.skin-purple .nav-tabs-color li.active,.skin-purple-light .nav-tabs-color li.active{border-top-color:#605ca8!important;} /*采集窗口*/ .win-cem-process-body{position:relative;} @@ -625,30 +456,6 @@ footer.footer-end{display:none;} .win-cem-ifr-box iframe{width:100%;height:100%;margin:0;border:0;} -@media (min-width: 1200px) { - /*table-responsive设置overflow:inherit;可正常显示dropdown-menu*/ - .c-p-url-renderer-list{overflow:inherit;} - .db-table-bind-where,.db-table-bind-query,.db-table-bind-data{overflow:inherit;} -} - -@media (max-width: 1199px) { - /*dropdown-menu用fixed避免被table-responsive的overflow:hidden;影响*/ - .c-p-url-renderer-list .c-p-url-page-signs .dropdown-menu{padding:0;border:4px solid #ddd;border-radius:4px;background:transparent;position:fixed;left:10px;right:10px;bottom:10px;top:auto;max-height:80%;overflow-y:scroll;} - .c-p-url-renderer-list .c-p-url-page-signs .dropdown-menu .c-p-url-ps-table{background:#fff;} - - .db-table-bind-signs .dropdown-menu{padding:0;border:4px solid #ddd;border-radius:4px;background:transparent;position:fixed;left:10px;right:10px;bottom:10px;top:auto;max-height:80%;overflow-y:scroll;} - .db-table-bind-signs .dropdown-menu table{margin:0;} -} - -@media (min-width: 900px) { - .toapi-app-table .table tr td:FIRST-CHILD{width:200px;white-space:nowrap;padding-right:10px;} - #cms_bind .table tr td:FIRST-CHILD{width:200px;white-space:nowrap;padding-right:10px;} -} - -@media (min-width: 768px) { - .c-p-url-web-form,.c-p-url-web-header{overflow:inherit;} /*table-responsive设置overflow:inherit;可正常显示dropdown-menu*/ -} - @media (max-width: 767px){ .main-header .logo{ width:140px; @@ -663,40 +470,14 @@ footer.footer-end{display:none;} padding-top:50px; } .content-wrapper .content{padding-top:8px;} - - .c-p-url-page-signs .dropdown-menu .table td>a,.c-p-url-page-signs .dropdown-menu .table td>span{display:block;margin-right:0;} .deve-editor-left,.deve-editor-right{padding-left:15px;padding-right:15px;margin-bottom:10px;} - /*dropdown-menu用fixed避免被table-responsive的overflow:hidden;影响*/ - .c-p-url-web-form .c-p-url-page-signs .dropdown-menu,.c-p-url-web-header .c-p-url-page-signs .dropdown-menu{padding:0;border:4px solid #ddd;border-radius:4px;background:transparent;position:fixed;left:10px;right:10px;bottom:10px;top:auto;max-height:80%;overflow-y:scroll;} - .c-p-url-web-form .c-p-url-page-signs .dropdown-menu .c-p-url-ps-table,.c-p-url-web-header .c-p-url-page-signs .dropdown-menu .c-p-url-ps-table{background:#fff;} /*元素最小宽度,防止太窄无法输入*/ .table-responsive .table input.form-control{min-width:100px;} .table-responsive .table textarea.form-control{min-width:100px;} } @media (max-width: 550px){ - /*采集器tab*/ - .coll-tab>li{margin-bottom:5px;width:33%;} - .coll-tab>li>a{padding:7px 0;border:solid 1px #ddd;text-align:center;} - .coll-tab>li:nth-child(3).active>a{background:#fff;} - .coll-tab>li.active>a{border-radius:3px;border-bottom-color:#ddd!important;} - .coll-tab .nav-save-rule{float:left!important;} - .coll-tab .nav-save-rule>a{color:#999;} - - .c-p-source-tab>li{margin-bottom:5px;margin-right:3px;width:auto;} - .c-p-source-tab>li>a{padding:5px 7px;border:solid 1px #ddd;text-align:center;} - .c-p-source-tab>li.active>a{border-radius:3px;border-bottom-color:#ddd!important;background-color:#efefef!important;} - - .mobile-input-group{width:100%;} - .mobile-input-group>.input-group-addon{display:table-caption;width:100%;background:#fafafa;margin-bottom:5px;border-right:1px solid #ccc;} - .mobile-input-group1>.input-group-addon{display:block;} - /*自适应第一个td宽度*/ - .c-p-request-headers td:first-child,.c-p-request-headers-img td:first-child{width:auto;} - .c-p-url-web-form td:first-child,.c-p-url-web-header td:first-child{width:auto;} - .p-m-api-table td:first-child,.p-m-api-header-table td:first-child{width:auto;} - .toapi-param-table td:first-child,.toapi-header-table td:first-child{width:auto;} - .list-footer .form-control{width:100%!important;} } \ No newline at end of file diff --git a/public/static/css/collector.css b/public/static/css/collector.css new file mode 100644 index 0000000..aed1d15 --- /dev/null +++ b/public/static/css/collector.css @@ -0,0 +1,220 @@ +@CHARSET "UTF-8"; +/*采集器面板*/ +.coll-panel .panel-heading{background-color:#d2d6de;} +.coll-panel .panel-default .panel-default .panel-heading{background-color:#efefef;} +.coll-panel .panel-heading a{color:#333;} + +.coll-alert{color:#333!important;background-color:#f5f5f5!important;border-color:#ddd!important;} + +.c-p-source-urls>.form-group:first-child{margin-top:10px;} + +#c_p_level_urls tbody{ + counter-reset:levelcounter; +} +#c_p_level_urls .level:before{ + content:counter(levelcounter); + counter-increment:levelcounter; + font-weight:bold; +} +#c_p_front_urls td.sign,#c_p_level_urls td.sign,#c_p_relation_urls td.sign{ + width:50%;overflow:hidden;padding-bottom:0; +} +#c_p_front_urls .sign-th,#c_p_level_urls .sign-th,#c_p_relation_urls .sign-th{ + padding-left:5px; +} +#c_p_front_urls .signs,#c_p_level_urls .signs,#c_p_relation_urls .signs{ + border:0;padding:0px 5px;height:20px;line-height:14px;font-size:12px;color:#555;background:#fff; +} +/*采集器选项卡*/ +.coll-tab > li:nth-child(2).active > a,.coll-tab > li:nth-child(3).active > a{background:#f5f5f5;} +.coll-tab > li{ + -moz-user-select:none; + -webkit-user-select:none; + -ms-user-select:none; + -khtml-user-select:none; + user-select:none; +} +.coll-tab>li>a{ + border-bottom:0; +} +/*请求头信息*/ +.c-p-request-headers table,.c-p-request-headers-img table,.c-p-request-headers-file table{margin-bottom:0} +.c-p-request-headers .delete-request-header,.c-p-request-headers-img .delete-request-header-img,.c-p-request-headers-file .delete-request-header-file{margin-top:8px;} +.c-p-request-headers td:first-child,.c-p-request-headers-img td:first-child,.c-p-request-headers-file td:first-child{width:200px;} +.c-p-request-headers td:last-child,.c-p-request-headers-img td:last-child,.c-p-request-headers-file td:last-child{width:50px;text-align:center;} +/*内容标签*/ +.c-p-url-content-signs{ + width:auto; + overflow:hidden; +} +/*页面源码表单和请求头*/ +.c-p-url-web-form table,.c-p-url-web-header table{margin-bottom:0;} +.c-p-url-web-form .delete-url-web-form,.c-p-url-web-header .delete-url-web-header{margin-top:8px;} +.c-p-url-web-form td:first-child,.c-p-url-web-header td:first-child{width:200px;} +.c-p-url-web-form td:last-child,.c-p-url-web-header td:last-child{width:50px;text-align:center;} +/*页面渲染动作*/ +.c-p-url-renderer-list table{margin-bottom:0;} +.c-p-url-renderer-list .td-renderer-element,.c-p-url-renderer-list .td-renderer-content{display:none;} +.c-p-url-renderer-list .td-renderer-op{width:65px;text-align:center;vertical-align:middle;} +.c-p-url-renderer-list .td-renderer-op .icon-drag-move{font-size:14px!important;} +.c-p-url-renderer-list .td-renderer-op .input-group-addon:last-child{border-left:1px solid #d2d6de;} +/*显示标签列表,input-group-btn必须position:static,否则dropdown-menu定位太窄*/ +.c-p-url-page-signs>.input-group-btn{position:static;} +.c-p-url-page-signs .dropdown-menu{padding:0;box-shadow:none;border:0;} +.c-p-url-page-signs .c-p-url-ps-table{padding:10px;box-shadow:0 0 2px 2px #eee;border:1px solid #ddd;border-radius:4px;} +.c-p-url-page-signs .c-p-url-ps-table .table{margin-bottom:0;} +.c-p-url-page-signs .c-p-url-ps-table .table td>a,.c-p-url-page-signs .dropdown-menu .table td>span{margin-right:5px;} +.c-p-url-page-signs .c-p-url-ps-table .table td>*:last-child{margin-right:0;} +.c-p-url-page-signs .c-p-url-ps-table .table td{white-space:normal!important;width:auto!important;} +.c-p-url-page-signs .c-p-url-ps-table .table td:first-child{white-space:nowrap!important;} +.c-p-url-page-signs .c-p-url-ps-table .table td:last-child{text-align:left!important;} + +/*分页字段*/ +.c-p-url-pagination-fields{ + width:auto; + overflow:hidden; +} + +/*参数标签样式*/ +.param-label{ + font-size:14px; + font-weight:normal; + padding: 4px 8px; + text-decoration: none; + border-bottom: none; + color: #3c8dbc; + border: 1px #ccc solid; + margin:7px 15px 5px 0; + position:relative; + float:left; +} +.param-label em.delete{ + font-style: normal; + display: block; + position: absolute; + top: -7px; + right: -5px; + z-index: 999; + background:#fff; +} + +/*采集器字段*/ +.c-p-field-list .field-name{color:#3c8dbc;cursor:pointer;} +.c-p-field-list .exist-process{color:green;} +.c-p-field-list thead .sort-field{font-size:12px;color:#cdcdcd;margin-left:5px;display:none;} + + +.c-p-field-list td .field-process{vertical-align:middle;} +.c-p-field-list td .glyphicon.icon-drag-move{font-size:12px;vertical-align:middle;} +.c-p-field-list td .glyphicon.field-clone{font-size:12px;top:0.3px;vertical-align:middle;} +.c-p-field-list td .glyphicon.field-del{font-size:12px;top:1.1px;vertical-align:middle;} + +#coll_tab_content td .glyphicon.icon-drag-move{font-size:12px;vertical-align:middle;} +#coll_tab_content td .glyphicon.clone{font-size:12px;top:0.3px;vertical-align:middle;} +#coll_tab_content td .glyphicon.delete{font-size:12px;top:1.1px;vertical-align:middle;} + +.c-p-process-accordion .panel-heading .glyphicon.c-p-process-title{font-size:11px;vertical-align:middle;} +.c-p-process-accordion .panel-heading .glyphicon.icon-drag-move{font-size:12px;vertical-align:middle;} +.c-p-process-accordion .panel-heading .glyphicon.c-p-process-clone{font-size:12px;top:0.3px;vertical-align:middle;} +.c-p-process-accordion .panel-heading .glyphicon.c-p-process-del{font-size:12px;top:1.1px;vertical-align:middle;} +.c-p-process-accordion .panel-heading .panel-title-title{float:left;} +.c-p-process-accordion .panel-heading .panel-title-title input{display:none;border-radius:2px;border:1px solid #ccc;line-height:14px;font-size:12px;margin-left:5px;padding:1px 1px 1px 2px;} +.c-p-process-accordion .panel-heading .panel-title-ops{float:right;line-height:19px;} + + +.iga-rt{text-align:left;line-height:20px;} +.iga-rt .blk{display:block;} +.iga-rt .mgr{margin-right:5px;} + +.iga-rt1{padding:0;vertical-align:top;} +.iga-rt1 .slt{width:100%;min-width:58px;height:24px;display:block;color:#555;font-weight:bold;padding:1px;margin:0;border:0;background:#F1F1F1;} +.iga-rt1 .op{margin:0;padding:3px 6px;list-style:none;} +.iga-rt1 .op li{display:none;} + +.nav-save-rule{float:right!important;} + + +/*数据处理*/ +.form-control-slt{width:30px!important;text-align:center;} +.form-control-slt select.form-control{min-width:20px!important;width:20px!important;height:30px!important;float:none!important;border:0!important;padding:0!important;margin:0!important;text-indent:-20px!important;} + +.p-m-func-field,.p-m-insert-field{display:inline;width:80px;border:0;cursor:pointer;margin:0;padding:0;height:auto;color:#555;} + +.p-m-api-val-field,.p-m-api-header-field{display:none;margin-left:-1px;padding:0;} + +.p-m-api-table table,.p-m-api-header-table table{margin-bottom:0;} +.p-m-api-table td:first-child,.p-m-api-header-table td:first-child{width:200px;} +.p-m-api-table td:last-child,.p-m-api-header-table td:last-child{width:50px;text-align:center;} +.p-m-api-rule-module{display:none;} + +.p-m-html-tags{} +.p-m-html-tags a{font-size:12px;font-weight:normal;cursor:pointer;margin-right:5px;} +.p-m-html-tags a span{margin-right:2px;color:#999;} +.p-m-if-val-func{position:relative;} +.p-m-if-val-func a.input-group-addon{border-left:0;} +.p-m-if-val-func .input-group-btn>select{margin-left:-1px;width:auto;padding:0;padding-left:5px;text-align:center;} +.p-m-if-op{width:70px;padding:15px 0 0 8px!important;font-size:11px;} +.p-m-if-add{font-size:12px;} + +.p-m-download-op{display:none;margin-top:15px;} +/*测试*/ +.table-test-loop thead{background:#fafafa;} +.table-test-loop thead th,.table-test-loop thead td{ + padding:0!important; + -moz-user-select:none; + -webkit-user-select:none; + -ms-user-select:none; + -khtml-user-select:none; + user-select:none; +} +.table-test-loop thead th>div{ + cursor:w-resize; + padding:8px; +} +.table-test-loop tbody td{ + position:relative; +} +.table-test-loop input{border:0;overflow:hidden;width:100%;min-width:150px;} +.table-test-loop .view-box{padding-left:20px;} +.table-test-loop .view-ipt{} +.table-test-loop .view-btn{position:absolute;font-size:12px;top:12px;left:5px;} + +@media (min-width: 1200px) { + /*table-responsive设置overflow:inherit;可正常显示dropdown-menu*/ + .c-p-url-renderer-list{overflow:inherit;} +} + +@media (max-width: 1199px) { + /*dropdown-menu用fixed避免被table-responsive的overflow:hidden;影响*/ + .c-p-url-renderer-list .c-p-url-page-signs .dropdown-menu{padding:0;border:4px solid #ddd;border-radius:4px;background:transparent;position:fixed;left:10px;right:10px;bottom:10px;top:auto;max-height:80%;overflow-y:scroll;} + .c-p-url-renderer-list .c-p-url-page-signs .dropdown-menu .c-p-url-ps-table{background:#fff;} +} + +@media (min-width: 768px) { + .c-p-url-web-form,.c-p-url-web-header{overflow:inherit;} /*table-responsive设置overflow:inherit;可正常显示dropdown-menu*/ +} + +@media (max-width: 767px){ + .c-p-url-page-signs .dropdown-menu .table td>a,.c-p-url-page-signs .dropdown-menu .table td>span{display:block;margin-right:0;} + /*dropdown-menu用fixed避免被table-responsive的overflow:hidden;影响*/ + .c-p-url-web-form .c-p-url-page-signs .dropdown-menu,.c-p-url-web-header .c-p-url-page-signs .dropdown-menu{padding:0;border:4px solid #ddd;border-radius:4px;background:transparent;position:fixed;left:10px;right:10px;bottom:10px;top:auto;max-height:80%;overflow-y:scroll;} + .c-p-url-web-form .c-p-url-page-signs .dropdown-menu .c-p-url-ps-table,.c-p-url-web-header .c-p-url-page-signs .dropdown-menu .c-p-url-ps-table{background:#fff;} +} + +@media (max-width: 550px){ + /*采集器tab*/ + .coll-tab>li{margin-bottom:5px;width:33%;} + .coll-tab>li>a{padding:7px 0;border:solid 1px #ddd;text-align:center;} + .coll-tab>li:nth-child(3).active>a{background:#fff;} + .coll-tab>li.active>a{border-radius:3px;border-bottom-color:#ddd!important;} + .coll-tab .nav-save-rule{float:left!important;} + .coll-tab .nav-save-rule>a{color:#999;} + + .c-p-source-tab>li{margin-bottom:5px;margin-right:3px;width:auto;} + .c-p-source-tab>li>a{padding:5px 7px;border:solid 1px #ddd;text-align:center;} + .c-p-source-tab>li.active>a{border-radius:3px;border-bottom-color:#ddd!important;background-color:#efefef!important;} + /*自适应第一个td宽度*/ + .c-p-request-headers td:first-child,.c-p-request-headers-img td:first-child{width:auto;} + .c-p-url-web-form td:first-child,.c-p-url-web-header td:first-child{width:auto;} + .p-m-api-table td:first-child,.p-m-api-header-table td:first-child{width:auto;} +} \ No newline at end of file diff --git a/public/static/css/cpattern_browser.css b/public/static/css/cpattern_browser.css index 49aa185..de727a5 100644 --- a/public/static/css/cpattern_browser.css +++ b/public/static/css/cpattern_browser.css @@ -39,7 +39,7 @@ #skycaiji_console .skycaiji-block{width:100%;overflow:hidden;line-height:20px;padding-top:5px;} #skycaiji_console .skycaiji-block>.skycaiji-b-l{float:left;width:130px;} #skycaiji_console .skycaiji-block>.skycaiji-b-c{margin-left:130px;margin-right:260px;} -#skycaiji_console .skycaiji-block>.skycaiji-b-c .skycaiji-b-c-i{margin-right:20px;} +#skycaiji_console .skycaiji-block>.skycaiji-b-c .skycaiji-b-c-i{margin-right:20px;min-width:300px;} #skycaiji_console .skycaiji-block>.skycaiji-b-c input{width:100%;height:20px;float:left;} #skycaiji_console .skycaiji-block>.skycaiji-b-c select{width:20px;height:20px;overflow:hidden;float:left;} #skycaiji_console .skycaiji-block>.skycaiji-b-r{padding-left:5px;float:left;} diff --git a/public/static/css/dataapi.css b/public/static/css/dataapi.css new file mode 100644 index 0000000..fc6e3b3 --- /dev/null +++ b/public/static/css/dataapi.css @@ -0,0 +1,13 @@ +@CHARSET "UTF-8"; + + +#dataapi_list .status{color:green;} +#dataapi_list .status-close{color:red;} + +#config_conds tr>th:first-child,#config_conds tr>td:first-child{padding-left:15px;} +#config_conds thead th{padding-top:13px;padding-bottom:13px;} +#config_conds tbody tr>td:last-child{vertical-align:middle;font-size:14px;} +#config_conds .config-cond-move{font-size:12px;} +#config_conds .config-cond-dlt{margin-left:2px;margin-right:2px;} +#config_conds .config-cond-sub td:FIRST-CHILD{padding-left:50px; background:url('../images/bg_column.gif') no-repeat 15px 15px;} +#config_conds .config-cond-sub .config-cond-add{display:none;} diff --git a/public/static/css/dataset.css b/public/static/css/dataset.css new file mode 100644 index 0000000..01c1e2c --- /dev/null +++ b/public/static/css/dataset.css @@ -0,0 +1,51 @@ +@CHARSET "UTF-8"; +/*数据集*/ +#dataset_list .fields{ + border:0;padding:0px 5px;height:20px;line-height:14px;font-size:12px;color:#555;background:#fff; +} +#dataset_db_list td .txt-big{height:100px!important;} +#dataset_db_list td{vertical-align:middle;} +#dataset_db_list td .form-control{ + height: 30px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} + +.dataset-db-list::-webkit-scrollbar{ + width: 12px; + height: 12px; +} +.dataset-search::-webkit-scrollbar{ + width: 8px; + height: 8px; +} +.dataset-db-list::-webkit-scrollbar-button,.dataset-search::-webkit-scrollbar-button{ + background-color:#efefef; +} +.dataset-db-list::-webkit-scrollbar-track,.dataset-search::-webkit-scrollbar-track{ + background:#efefef; +} +.dataset-db-list::-webkit-scrollbar-thumb,.dataset-search::-webkit-scrollbar-thumb{ + background: #ccc; + border-radius: 4px; +} + +.dataset-search{width:100%;overflow-x:scroll;white-space:nowrap;padding-bottom:5px;padding-right:5px;} + +#dataset_db_list input::placeholder,#dataset_db_list textarea::placeholder{color:#bbb!important;} + +#dataset_fields tr>th:first-child,#dataset_fields tr>td:first-child{padding-left:15px;} +#dataset_fields thead th{padding-top:13px;padding-bottom:13px;} + + +.dataset-sep{ + color: #999; + text-indent: -9999px; + display: inline-block; + width: 3px; + line-height: 12px; + margin-left: 2px; + border-left: 1px solid #aaa; +} diff --git a/public/static/css/release.css b/public/static/css/release.css new file mode 100644 index 0000000..f33736b --- /dev/null +++ b/public/static/css/release.css @@ -0,0 +1,78 @@ +@CHARSET "UTF-8"; + +/*发布设置*/ +#dataset_config table tr td{height:50px;vertical-align:middle!important;} +.dataset-field-txt>.input-group-addon{padding:0;} +.dataset-field-txt>.input-group-addon a.dropdown-toggle{border-color:#fff;padding:6px 12px;color:#666;} +.dataset-field-txt>.input-group-addon a.dropdown-toggle:hover{color:#000;} +.dataset-field-txt>.input-group-addon a.dropdown-toggle .caret{margin-top:-2px;} + +.rele-db-error{margin-top:10px;color:red;font-weight:bold;} +.db-table-bind-params{padding:0;margin-bottom:0;border:0;} +.db-table-bind-params .table{margin-bottom:0;} +.db-table-bind-params .table tr>th:first-child,.db-table-bind-params .table tr>td:first-child{padding-left:15px;} +.db-table-bind-params .table thead th{padding-top:13px;padding-bottom:13px;} +.db-table-bind-op{width:auto;height:auto;display:inline;padding:0;} +.db-table-bind-where-tpl,.db-table-bind-query-tpl{display:none;} + +.db-table-bind-where,.db-table-bind-query{display:none;} +.db-table-bind-data-seq{display:none;} +.db-table-bind-where,.db-table-bind-query,.db-table-bind-data{border:0;} + +.db-table-bind-signs>.input-group-btn{position:static;} + +.dm-db-charset li {padding:5px 15px;} +.dm-db-charset li.divider{padding:0;} +.dm-db-charset li span{padding:5px; cursor:pointer;color:#555;} +.dm-db-charset li span:hover{background:#eee;} + +.toapi-param-table table,.toapi-header-table table{margin-bottom:0;} +.toapi-param-table td:first-child,.toapi-header-table td:first-child{width:200px;} +.toapi-param-table td:last-child,.toapi-header-table td:last-child{width:50px;text-align:center;} + +#toapi_resp_module_help .help-block{display:none;margin:0;} + +.toapi-app-table table tr td{height:50px;vertical-align:middle!important;} +.toapi-field-txt>.input-group-addon{padding:0;} +.toapi-field-txt>.input-group-addon a.dropdown-toggle{border-color:#fff;padding:6px 12px;color:#666;} +.toapi-field-txt>.input-group-addon a.dropdown-toggle:hover{color:#000;} +.toapi-field-txt>.input-group-addon a.dropdown-toggle .caret{margin-top:-2px;} + +.toapi-field-slt select.form-control{min-width:120px!important;margin-right:-1px;min-height:34px;max-height:90px;} +.toapi-field-slt textarea.form-control{height:90px;} +.toapi-field-slt input.form-control,.toapi-field-slt textarea.form-control,.toapi-field-slt .input-group-addon{display:none!important;} + +.toapi-field-slt-txt input.form-control,.toapi-field-slt-txt textarea.form-control,.toapi-field-slt-txt .input-group-addon{display:table-cell!important;} + +/**/ +#cms_bind em{color:red;} +#cms_bind .box{margin-bottom:0;} +#cms_bind .table{margin-bottom:0;} +#toapi_app_params em{color:red;} + + + +@media (min-width: 1200px) { + /*table-responsive设置overflow:inherit;可正常显示dropdown-menu*/ + .db-table-bind-where,.db-table-bind-query,.db-table-bind-data{overflow:inherit;} +} + +@media (max-width: 1199px) { + /*dropdown-menu用fixed避免被table-responsive的overflow:hidden;影响*/ + .db-table-bind-signs .dropdown-menu{padding:0;border:4px solid #ddd;border-radius:4px;background:transparent;position:fixed;left:10px;right:10px;bottom:10px;top:auto;max-height:80%;overflow-y:scroll;} + .db-table-bind-signs .dropdown-menu table{margin:0;} +} + +@media (min-width: 900px) { + #dataset_config .table tr td:FIRST-CHILD{width:200px;white-space:nowrap;padding-right:10px;} + .toapi-app-table .table tr td:FIRST-CHILD{width:200px;white-space:nowrap;padding-right:10px;} + #cms_bind .table tr td:FIRST-CHILD{width:200px;white-space:nowrap;padding-right:10px;} +} + +@media (max-width: 550px){ + .mobile-input-group{width:100%;} + .mobile-input-group>.input-group-addon{display:table-caption;width:100%;background:#fafafa;margin-bottom:5px;border-right:1px solid #ccc;} + .mobile-input-group1>.input-group-addon{display:block;} + + .toapi-param-table td:first-child,.toapi-header-table td:first-child{width:auto;} +} \ No newline at end of file diff --git a/public/static/css/task.css b/public/static/css/task.css new file mode 100644 index 0000000..1d6e0a5 --- /dev/null +++ b/public/static/css/task.css @@ -0,0 +1,7 @@ +@CHARSET "UTF-8"; + +#task_list_folder .taskgroup-opened .icon-folder-pre:before{content:"\2212"} +#task_list_folder .taskgroup-opened .icon-folder:before{content:"\e118"} + +#task_list_folder .icon-folder-pre:before{font-size:12px;content:"\002b"} +#task_list_folder .icon-folder:before{content:"\e117";margin-right:5px;} diff --git a/public/static/js/admin.js b/public/static/js/admin.js index 4c0feff..9558255 100644 --- a/public/static/js/admin.js +++ b/public/static/js/admin.js @@ -7,10 +7,10 @@ | 使用协议 https://www.skycaiji.com/licenses |-------------------------------------------------------------------------- */ -'use strict';var admincpOp={init:function(){var bodyWidth=$(document.body).width();var cpConfig=window.site_config.admincp;cpConfig=cpConfig?cpConfig:{};if(cpConfig.skin){$('body').removeClass('skin-blue').addClass(cpConfig.skin)} +'use strict';var admincpOp={getConfig:function(key){var cpConfig=window.site_config.admincp;cpConfig=cpConfig?cpConfig:{};return key?cpConfig[key]:cpConfig},init:function(){var bodyWidth=$(document.body).width();var cpConfig=admincpOp.getConfig(null);if(cpConfig.skin){$('body').removeClass('skin-blue').addClass(cpConfig.skin)} var menuOpts={};if(bodyWidth>767){if(cpConfig.mini==1){$('body').addClass('sidebar-collapse').addClass('sidebar-mini')} if(cpConfig.narrow==1){$('body').addClass('layout-boxed')} -menuOpts={};if(window.navigator.userAgent.indexOf('MSIE')>-1){menuOpts={animationSpeed:0}}}else{menuOpts={animationSpeed:0}} +menuOpts={animationSpeed:300};if(window.navigator.userAgent.indexOf('MSIE')>-1){menuOpts={animationSpeed:0}}}else{menuOpts={animationSpeed:0}} $('.sidebar-menu').tree(menuOpts);$(document).ready(function(){$('#treeview_skins').bind('click',function(){if($('#sidebar_skins').html().length<=0){admincpOp.skins()}});if(bodyWidth>767){if(cpConfig.mini==1){$('#chk_sidebar_mini').prop('checked',!0)} $('#chk_sidebar_mini').bind('click',function(){var setMini=$(this).is(':checked')?1:0;admincpOp.config('mini',setMini,function(){if(setMini){$('body').addClass('sidebar-collapse').addClass('sidebar-mini')}else{$('body').removeClass('sidebar-collapse').removeClass('sidebar-mini')}})});$('.sidebar-toggle[data-toggle="push-menu"]').bind('click',function(){$('body').addClass('sidebar-mini')});if(cpConfig.narrow==1){$('#chk_sidebar_narrow').prop('checked',!0)} $('#chk_sidebar_narrow').bind('click',function(){var setNarrow=$(this).is(':checked')?1:0;admincpOp.config('narrow',setNarrow,function(){if(setNarrow){$('body').addClass('layout-boxed')}else{$('body').removeClass('layout-boxed')}})})}else{$('#chk_sidebar_mini').parents('li').eq(0).hide();$('#chk_sidebar_narrow').parents('li').eq(0).hide()} @@ -20,8 +20,12 @@ $('body').addClass(skin)})})}};function insertAtCaret(myField,myValue){myField=$ function urlUsertoken(){return'_usertoken_='+encodeURIComponent(window.site_config.usertoken)} function openStoreUrl(url){if(url.indexOf('clientinfo=')<0&&window.site_config.clientinfo){url+=(url.indexOf('?')>-1?'&':'?')+'clientinfo='+encodeURIComponent(window.site_config.clientinfo)} window.open(url,'_blank')} -function eleExchange(box,move,ele){if(!window.ele_exchange_is_touch){window.ele_exchange_is_touch=1;if('ontouchstart' in window||navigator.maxTouchPoints){window.ele_exchange_is_touch=2}} -if(window.ele_exchange_is_touch==2){$(box).on('click',move,function(){var obj=$(this).parents(ele).eq(0);var next=obj.next(ele);if(next.length>0){next.after(obj)}})}else{$(box).sortable({items:ele,handle:move,axis:'y'})}} +function eleExchange(box,move,ele,options){if(!isObject(options)){options={}} +if(!window.ele_exchange_is_touch){window.ele_exchange_is_touch=1;if('ontouchstart' in window||navigator.maxTouchPoints){window.ele_exchange_is_touch=2}} +if(window.ele_exchange_is_touch==2){$(box).on('click',move,function(){var obj=$(this).parents(ele).eq(0);var next=obj.next(ele);if(next.length>0){next.after(obj)}})}else{var curTrTds={};$(box).on('mousedown',move,function(){var obj=$(this).parents(ele).eq(0);if(obj.is('tr')){curTrTds={};obj.children('th,td').each(function(index){curTrTds[index]={width:$(this).width(),colspan:toInt($(this).attr('colspan')),hidden:$(this).is(':hidden')?true:!1}})}});var sOpts={items:ele,handle:move,axis:'y',start:function(event,ui){if(ui&&ui.item){var obj=$(ui.item[0]);if(obj.is('tr')){obj.children('th,td').each(function(index){var curTrTd=curTrTds[index];if(isObject(curTrTd)){$(this).width(curTrTd.width);if(curTrTd.colspan>0){$(this).attr('colspan',curTrTd.colspan)} +if(curTrTd.hidden){$(this).hide()}}});$('.ui-sortable-placeholder').children('th,td').each(function(index){var curTrTd=curTrTds[index];if(isObject(curTrTd)){$(this).width(curTrTd.width);if(curTrTd.colspan>0){$(this).attr('colspan',curTrTd.colspan)} +if(curTrTd.hidden){$(this).hide()}}})}}}};for(var i in options){sOpts[i]=options[i]} +$(box).sortable(sOpts)}} function showPanelCollapse(id){$(id).parent().find('a[data-toggle][href="'+id+'"]').attr('aria-expanded',!0).removeClass('collapsed');$(id).addClass('in').attr('aria-expanded',!0).attr('style','')} function inputSelectCustom(sltObj,iptName,onOptions,customName,changeFunc){customName=customName?customName:'custom';var onChangeFunc=function(curObj,iptEle){var ipt=$(curObj).parents('.input-select-custom').eq(0).find(iptEle);if($(curObj).val()==customName){ipt.show()}else{ipt.hide()} if(changeFunc&&typeof(changeFunc)=='function'){changeFunc()}};if(sltObj&&iptName){$(sltObj).bind('change',function(){onChangeFunc(this,'[name="'+iptName+'"]')})}else if(onOptions&&typeof(onOptions)=='object'){$(onOptions.box).on('change',onOptions.slt,function(){onChangeFunc(this,onOptions.ipt)})}} @@ -70,8 +74,8 @@ if(!url){url=ulink('admin/backstage/backstageTask?op=collected&tid='+taskId)} ajaxOpen({type:'get',dataType:'html',async:!0,url:url,success:function(data){$('#win_bk_collected_'+taskId).html(data)},complete:function(){if(!isNull(taskType)&&0==toInt(taskType)){winBackstageTask.collected_set_timeout=window.setTimeout(function(){var isEnd=$('#win_bk_tasks_box_0').find('a[href="#win_bk_collected_'+taskId+'"]').attr('data-is-end');var isVisible=$('#win_bk_tasks_box_0 #win_bk_collected_'+taskId).is(':visible');if(!isEnd&&isVisible){winBackstageTask.collected(taskId,taskType,url)}else{window.clearTimeout(winBackstageTask.collected_set_timeout)}},3000)}}})},init_collected:function(taskStatus,taskId){$('[id^="win_bk_collected_"] .pagination').addClass('pagination-sm');$('[id^="win_bk_collected_"] .pagination a').bind('click',function(){var curTaskId=$(this).parents('[id^="win_bk_collected_"]').eq(0).attr('data-task-id');var curTaskType=$(this).parents('[id^="win_bk_tasks_nav_"]').eq(0).attr('data-task-type');winBackstageTask.collected(curTaskId,curTaskType,$(this).attr('href'));return!1});if(taskStatus&&taskId){winBackstageTask.set_task_end(taskId,taskStatus);winBackstageTask.count();winBackstageTask.status()}},set_task_end:function(taskId,status){if(taskId&&status){$('#win_bk_tasks_box_0').find('a[href="#win_bk_collected_'+taskId+'"]').attr('data-is-end','1').find('.is_loading').html(''+status+'')}},status_set_timeout:null,status:function(isLoop){if(!isLoop){window.clearTimeout(winBackstageTask.status_set_timeout)} var taskIds=[];$('#win_bk_tasks_box_0').find('[id^="win_bk_collected_"]').each(function(){var taskId=$(this).attr('data-task-id');taskIds.push(taskId)});if(taskIds.length>0){ajaxOpen({type:'post',dataType:'json',async:!0,data:{tids:taskIds},url:ulink('admin/backstage/backstageTask?op=status'),success:function(data){var statusList=data.data;if(isObject(statusList)){for(var tid in statusList){if(statusList[tid]){winBackstageTask.set_task_end(tid,statusList[tid])}}} var isVisible=$('#win_bk_tasks_box_0').is(':visible');var isEnd=!0;$('#win_bk_tasks_box_0').find('a[href^="#win_bk_collected_"]').each(function(){if(!$(this).attr('data-is-end')){isEnd=!1;return!1}});if(!isEnd&&isVisible){winBackstageTask.status_set_timeout=window.setTimeout(function(){winBackstageTask.status(!0)},3000)}else{window.clearTimeout(winBackstageTask.status_set_timeout)}}})}}};function ajax_check_userpwd(ajaxSet){var oldSuccess=ajaxSet.success;ajaxSet.success=function(data){if(data.data&&data.data._check_pwd_){if(data.msg){toastr.error(data.msg)} -var msg='
该操作需要验证您的登录密码
'+''+'
';confirmRight({closeAfterFunc:!0,yes:'确定',no:'取消',msg:msg},function(){var ajaxSetData=isNull(ajaxSet.data)?{}:ajaxSet.data;var checkPwd=$('#confirm_ipt_check_pwd').val();var checkSkip=$('#confirm_ipt_check_skip').is(':checked')?1:'';if(typeof(ajaxSetData)=='object'){ajaxSetData._check_pwd_=checkPwd;ajaxSetData._check_skip_=checkSkip}else{ajaxSetData=ajaxSetData?(ajaxSetData+'&'):'';ajaxSetData+='_check_pwd_='+encodeURIComponent(checkPwd);ajaxSetData+='&_check_skip_='+encodeURIComponent(checkSkip)} -ajaxSet.data=ajaxSetData;ajaxSet.success=oldSuccess;ajax_check_userpwd(ajaxSet)});$('body').on('keyup','#confirm_ipt_check_pwd',function(event){if(event.keyCode=="13"){$('#confirm_right .cr-btn-yes').trigger("click")}})}else{if(oldSuccess&&typeof(oldSuccess)=='function'){oldSuccess(data)}}};ajaxOpen(ajaxSet)} +var msg='
该操作需要验证您的登录密码
'+''+'
';confirmRight({closeAfterFunc:!0,yes:'确定',no:'取消',msg:msg},function(){var ajaxSetData=isNull(ajaxSet.data)?{}:ajaxSet.data;var checkPwd=$('#confirm_ipt_check_pwd').val();var checkSkip=$('#confirm_ipt_check_skip').is(':checked')?1:'';if(typeof(ajaxSetData)=='object'){ajaxSetData._check_pwd_=checkPwd;ajaxSetData._check_skip_=checkSkip}else{ajaxSetData=ajaxSetData?(ajaxSetData+'&'):'';ajaxSetData+='_check_pwd_='+encodeURIComponent(checkPwd);ajaxSetData+='&_check_skip_='+encodeURIComponent(checkSkip)} +ajaxSet.data=ajaxSetData;ajaxSet.success=oldSuccess;ajax_check_userpwd(ajaxSet)});$('#confirm_ipt_check_skip').bind('click',function(){admincpOp.config('check_skip',$(this).is(':checked')?1:0)});$('body').on('keyup','#confirm_ipt_check_pwd',function(event){if(event.keyCode=="13"){$('#confirm_right .cr-btn-yes').trigger("click")}})}else{if(oldSuccess&&typeof(oldSuccess)=='function'){oldSuccess(data)}}};ajaxOpen(ajaxSet)} function editorCodeIfr(ifrEle,options){options=isObject(options)?options:{};if(options.set_value!=null&&typeof(options.set_value)!='undefined'){$(document).ready(function(){$(ifrEle).attr('src','');$(ifrEle).attr('src',ulink('develop/editor_code'));$(ifrEle).off('load').bind('load',function(){if(options.set_value&&$(ifrEle)[0].contentWindow.editor_code_op){$(ifrEle)[0].contentWindow.editor_code_op.set(options.set_value)}})})}else if(options.get_value){var ifrEle=$(ifrEle)[0];var val='';if(ifrEle&&ifrEle.contentWindow.editor_code_op){val=ifrEle.contentWindow.editor_code_op.get()} return val}} var ruleInsertSign={match:function(toObj,options){if(!options){options={}} diff --git a/public/static/js/admin/collector.js b/public/static/js/admin/collector.js index efb0362..3e5aa76 100644 --- a/public/static/js/admin/collector.js +++ b/public/static/js/admin/collector.js @@ -8,7 +8,7 @@ |-------------------------------------------------------------------------- */ 'use strict';function CollectorPattern(){this.formid='#form_coll';this.cpFrontUrl=null;this.cpLevelUrl=null;this.cpRelationUrl=null;this.cpUrlWeb=null;this.cpRenderer=null;this.cpContentSign=null;this.cpPagination=null;this.cpField=null;this.cpProcess=null} -CollectorPattern.prototype={constructor:CollectorPattern,init:function(){var $_o=this;$($_o.formid).bind('submit',function(){$('#coll_tab_content').find('.tab-pane[id^="coll_pattern_"]').each(function(){if($(this).hasClass('active')){$($_o.formid+' [name="tab_link"]').val($(this).attr('id'));return}});var settings=getFormAjaxSettings($(this));settings.data={'_post_data_':settings.data};ajaxOpen(settings);return!1});$_o.cpFrontUrl=new CpFrontUrl($_o);$_o.cpLevelUrl=new CpLevelUrl($_o);$_o.cpRelationUrl=new CpRelationUrl($_o);$_o.cpUrlWeb=new CpUrlWeb($_o);$_o.cpRenderer=new CpRenderer($_o);$_o.cpContentSign=new CpContentSign($_o);$_o.cpPagination=new CpPagination($_o);$_o.cpField=new CpField($_o);$_o.cpProcess=new CpProcess($_o);inputSelectCustom($_o.formid+' select[name="config[charset]"]','config[charset_custom]',null,null,function(){$_o.cpUrlWeb.def_config_charset('')});inputSelectCustom($_o.formid+' select[name="config[encode]"]','config[encode_custom]',null,null,function(){$_o.cpUrlWeb.def_config_encode('')});$($_o.formid+' [name="config[page_render]"]').bind('click',function(){$_o.cpRenderer.def_config_renderer_open('')});$($_o.formid+' [name="config[request_headers][open]"]').bind('click',function(){$_o.cpUrlWeb.def_config_header_global('')});$($_o.formid+' #coll_pattern_request_headers .dm-useragent li a').bind('click',function(){$($_o.formid+' [name="config[request_headers][useragent]"]').val($(this).attr('data-useragent'))});$($_o.formid+' #coll_pattern_request_headers .add-request-header').bind('click',function(){$_o.add_request_header('','')});$($_o.formid+' #coll_pattern_request_headers .add-request-header-img').bind('click',function(){$_o.add_request_header_img('','')});$($_o.formid+' #coll_pattern_request_headers .add-request-header-file').bind('click',function(){$_o.add_request_header_file('','')});$($_o.formid+' .c-p-request-headers').on('click','.delete-request-header',function(){$(this).parents('tr').eq(0).remove()});$($_o.formid+' .c-p-request-headers-img').on('click','.delete-request-header-img',function(){$(this).parents('tr').eq(0).remove()});$($_o.formid+' .c-p-request-headers-file').on('click','.delete-request-header-file',function(){$(this).parents('tr').eq(0).remove()});$_o.init_page_list_op('front_url');$(this.formid+' #coll_pattern_source_url .add-source-url').bind('click',function(){windowModal('添加起始网址',ulink("cpattern/source"),{lg:1})});$(this.formid+' #coll_pattern_source_url .clear-source-url').bind('click',function(){$_o.source_op('clear_all')});$(this.formid+' #coll_pattern_source_url').on('click','.edit-source-url',function(){var parent=$(this).parents('[id^="source_url_"]').eq(0);var objid=parent.attr('id');var sourceUrl=parent.find('[name="config[source_url][]"]').val();sourceUrl=sourceUrl?sourceUrl:'';var url=ulink("cpattern/source");var options={lg:1};if(objid||sourceUrl){options.ajax={type:'post',data:{'source_url':sourceUrl,'objid':objid}}} +CollectorPattern.prototype={constructor:CollectorPattern,init:function(){var $_o=this;$($_o.formid).bind('submit',function(){$('#coll_tab_content').find('.tab-pane[id^="coll_pattern_"]').each(function(){if($(this).hasClass('active')){$($_o.formid+' [name="tab_link"]').val($(this).attr('id'));return}});var settings=getFormAjaxSettings($(this));settings.data={'_post_data_':settings.data};ajaxOpen(settings);return!1});$_o.cpFrontUrl=new CpFrontUrl($_o);$_o.cpLevelUrl=new CpLevelUrl($_o);$_o.cpRelationUrl=new CpRelationUrl($_o);$_o.cpUrlWeb=new CpUrlWeb($_o);$_o.cpRenderer=new CpRenderer($_o);$_o.cpContentSign=new CpContentSign($_o);$_o.cpPagination=new CpPagination($_o);$_o.cpField=new CpField($_o);$_o.cpProcess=new CpProcess($_o);inputSelectCustom($_o.formid+' select[name="config[charset]"]','config[charset_custom]',null,null,function(){$_o.cpUrlWeb.def_config_charset('')});inputSelectCustom($_o.formid+' select[name="config[encode]"]','config[encode_custom]',null,null,function(){$_o.cpUrlWeb.def_config_encode('')});$($_o.formid+' [name="config[page_render]"]').bind('click',function(){$_o.cpRenderer.def_config_renderer_open('')});$($_o.formid+' [name="config[request_headers][open]"]').bind('click',function(){$_o.cpUrlWeb.def_config_header_global('')});$($_o.formid+' #coll_pattern_request_headers .dm-useragent li a').bind('click',function(){$($_o.formid+' [name="config[request_headers][useragent]"]').val($(this).attr('data-useragent'))});$($_o.formid+' #coll_pattern_request_headers .add-request-header').bind('click',function(){$_o.add_request_header('','')});$($_o.formid+' #coll_pattern_request_headers .add-request-header-img').bind('click',function(){$_o.add_request_header_img('','')});$($_o.formid+' #coll_pattern_request_headers .add-request-header-file').bind('click',function(){$_o.add_request_header_file('','')});$($_o.formid+' .c-p-request-headers').on('click','.delete-request-header',function(){var curObj=$(this);confirmRight('确定删除?',function(){curObj.parents('tr').eq(0).remove()})});$($_o.formid+' .c-p-request-headers-img').on('click','.delete-request-header-img',function(){var curObj=$(this);confirmRight('确定删除?',function(){curObj.parents('tr').eq(0).remove()})});$($_o.formid+' .c-p-request-headers-file').on('click','.delete-request-header-file',function(){var curObj=$(this);confirmRight('确定删除?',function(){curObj.parents('tr').eq(0).remove()})});$_o.init_page_list_op('front_url');$(this.formid+' #coll_pattern_source_url .add-source-url').bind('click',function(){windowModal('添加起始网址',ulink("cpattern/source"),{lg:1})});$(this.formid+' #coll_pattern_source_url .clear-source-url').bind('click',function(){$_o.source_op('clear_all')});$(this.formid+' #coll_pattern_source_url').on('click','.edit-source-url',function(){var parent=$(this).parents('[id^="source_url_"]').eq(0);var objid=parent.attr('id');var sourceUrl=parent.find('[name="config[source_url][]"]').val();sourceUrl=sourceUrl?sourceUrl:'';var url=ulink("cpattern/source");var options={lg:1};if(objid||sourceUrl){options.ajax={type:'post',data:{'source_url':sourceUrl,'objid':objid}}} windowModal('添加起始网址',url,options)});$(this.formid+' #coll_pattern_source_url').on('click','.delete-source-url',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){obj.parents('[id^="source_url_"]').eq(0).remove()})});eleExchange(this.formid+' #coll_pattern_source_url','.icon-drag-move','[id^="source_url_"]');$(this.formid+' [name="config[source_is_url]"]').bind('click',function(){if($_o.source_is_url()){$('#coll_pattern_source_url').css('margin-bottom','0px');$('#alert_coll_pattern_link').show();$('#panel_coll_pattern_source_url_web').hide();$('#panel_coll_pattern_source_url_renderer').hide();$('#panel_coll_pattern_source_url_content_sign').hide();$('#panel_coll_pattern_source_url_pagination').hide();$('#panel_coll_pattern_level_url').hide();$('#panel_coll_pattern_url_content_sign').siblings('.panel').hide();$('#panel_coll_pattern_url_web').show();$('#panel_coll_pattern_url_renderer').show()}else{$('#coll_pattern_source_url').css('margin-bottom','15px');$('#alert_coll_pattern_link').hide();$('#panel_coll_pattern_source_url_web').show();$('#panel_coll_pattern_source_url_renderer').show();$('#panel_coll_pattern_source_url_content_sign').show();$('#panel_coll_pattern_source_url_pagination').show();$('#panel_coll_pattern_level_url').show();$('#panel_coll_pattern_url_content_sign').siblings('.panel').show()}});$_o.init_page('source_url');$_o.init_page('url');$($_o.formid).on('click','.c-p-url-page-signs .btn-page-signs',function(){$_o.parent_page_signs(this)});$_o.init_page_list_op('level_url');$_o.init_page_list_op('relation_url');$(this.formid+' #coll_pattern_field').on('click','.add-field',function(){$_o.field_editor(null,null)});$(this.formid+' #coll_pattern_field').on('click','.field-name',function(){$_o.field_editor($(this),null)});$(this.formid+' #coll_pattern_field').on('click','.add-field-default',function(){$_o.cpField.add_default()});$(this.formid+' #coll_pattern_field').on('click','.sort-field',function(){var fieldNames=$_o.get_field_names(!0);for(var i in fieldNames){var fieldTr=$($_o.formid+' #coll_pattern_field').find('.field-name[data-val="'+fieldNames[i]+'"]').parents('tr[id^="field_"]').eq(0);if(fieldTr.length>0){$($_o.formid+' #coll_pattern_field .c-p-field-list tbody').append(fieldTr)}} toastr.success('调整完成')});$(this.formid+' #coll_pattern_field').on('click','.field-del',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){$_o.field_delete_tr(obj)})});$(this.formid+' #coll_pattern_field').on('click','.field-clone',function(){var tr=$(this).parents('tr[id^="field_"]').eq(0);var field=tr.find('[name="config[field_list][]"]').val();var process=tr.find('[name="config[field_process][]"]').val();confirmRight('确定复制字段?',function(){ajaxOpen({type:'POST',dataType:'json',url:ulink("cpattern/clone_field"),data:{field:field,process:process},success:function(data){if(data.code==1){data=data.data;var hasField=!1;do{data.field.name+='_1';hasField=$('#coll_pattern_field .c-p-field-list').find('.field-name[data-val="'+data.field.name+'"]');if(hasField&&hasField.length>0){hasField=!0}else{hasField=!1}}while(hasField);$_o.cpField.add(null,data.field,data.process);toastr.success('字段复制成功:'+data.field.name)}else{toastr.error(data.msg)}}})})});$(this.formid+' #coll_pattern_field').on('click','.field-process',function(){var process=$(this).parent().find('input[name="config[field_process][]"]').val();var prt=$(this).parents('tr[id^="field_"]').eq(0);var objid=prt.attr('id');var field=prt.find('.field-name').attr('data-val');var url=ulink("cpattern/process?task_id=_tid_&field=_field_",{'_tid_':$_o.get_task_id(),'_field_':field});windowModal('数据处理:'+field+'',url,{lg:1,ajax:{type:'post',data:{objid:objid,process:process}}});$_o.process_paste()});$(this.formid+' #coll_pattern_process').on('click','.add-process',function(){var url=ulink("cpattern/process?task_id=_tid_&type=common",{'_tid_':$_o.get_task_id()});windowModal('数据处理(通用)',url,{lg:1});$_o.process_paste()});eleExchange(this.formid+' #coll_pattern_field','.icon-drag-move','tr[id^="field_"]');$(this.formid+' [name="effective"]').val(1)},init_test:function(){var $_o=this;$_o.formid='#win_form_cache';$_o.cpUrlWeb=new CpUrlWeb($_o);$_o.cpRenderer=new CpRenderer($_o);$_o.cpUrlWeb.page_init('test');$_o.cpRenderer.page_init('test')},init_echo_url_msg:function(dataUrlWeb,dataRenderer){this.init_test();if(!isObject(dataUrlWeb)){dataUrlWeb={}} if(!isObject(dataRenderer)){dataRenderer={}} @@ -123,7 +123,7 @@ ajaxOpen({type:'POST',dataType:'json',url:$($_o.formObj).attr('action'),data:$($ function CpUrlWeb(cpClass){this.$_cp=cpClass} CpUrlWeb.prototype={constructor:CpUrlWeb,page_init:function(pageType,isPagination){var $_o=this;var pageVars=$_o.$_cp.get_page_vars(pageType,null,isPagination);var boxId=pageVars.boxId;var namePre=pageVars.namePre;if(!boxId||!namePre){return} var boxUrlWebId=boxId+'_web';$(boxUrlWebId+' [name="'+namePre+'[url_web][open]"]').bind('click',function(){if($(this).val()==1){$(boxUrlWebId+'_open').show()}else{$(boxUrlWebId+'_open').hide()} -$_o.def_config_use_url_web(pageType)});inputSelectCustom(boxUrlWebId+' select[name="'+namePre+'[url_web][charset]"]',namePre+'[url_web][charset_custom]');inputSelectCustom(boxUrlWebId+' select[name="'+namePre+'[url_web][encode]"]',namePre+'[url_web][encode_custom]');$_o.def_config_charset(pageType);$_o.def_config_encode(pageType);$(boxUrlWebId+' select[name="'+namePre+'[url_web][form_method]"]').bind('change',function(){var obj=$(boxUrlWebId+' .c-p-url-web-content-type');if($(this).val()=='post'){obj.show()}else{obj.hide()}});$_o.def_config_header_global(pageType);$(boxUrlWebId+' .add-url-web-form').bind('click',function(){$_o.add_page_url_web(pageType,isPagination,'form','','')});$(boxUrlWebId+' .c-p-url-web-form').on('click','.delete-url-web-form',function(){$(this).parents('tr').eq(0).remove()});$(boxUrlWebId+' .add-url-web-header').bind('click',function(){$_o.add_page_url_web(pageType,isPagination,'header','','')});$(boxUrlWebId+' .c-p-url-web-header').on('click','.delete-url-web-header',function(){$(this).parents('tr').eq(0).remove()})},page_load:function(pageType,urlWebConfig,isPagination){var $_o=this;var pageVars=$_o.$_cp.get_page_vars(pageType,null,isPagination);var formId=pageVars.formId;var boxId=pageVars.boxId;var namePre=pageVars.namePre;if(!formId||!boxId||!namePre){return} +$_o.def_config_use_url_web(pageType)});inputSelectCustom(boxUrlWebId+' select[name="'+namePre+'[url_web][charset]"]',namePre+'[url_web][charset_custom]');inputSelectCustom(boxUrlWebId+' select[name="'+namePre+'[url_web][encode]"]',namePre+'[url_web][encode_custom]');$_o.def_config_charset(pageType);$_o.def_config_encode(pageType);$(boxUrlWebId+' select[name="'+namePre+'[url_web][form_method]"]').bind('change',function(){var obj=$(boxUrlWebId+' .c-p-url-web-content-type');if($(this).val()=='post'){obj.show()}else{obj.hide()}});$_o.def_config_header_global(pageType);$(boxUrlWebId+' .add-url-web-form').bind('click',function(){$_o.add_page_url_web(pageType,isPagination,'form','','')});$(boxUrlWebId+' .c-p-url-web-form').on('click','.delete-url-web-form',function(){var curObj=$(this);confirmRight('确定删除?',function(){curObj.parents('tr').eq(0).remove()})});$(boxUrlWebId+' .add-url-web-header').bind('click',function(){$_o.add_page_url_web(pageType,isPagination,'header','','')});$(boxUrlWebId+' .c-p-url-web-header').on('click','.delete-url-web-header',function(){var curObj=$(this);confirmRight('确定删除?',function(){curObj.parents('tr').eq(0).remove()})})},page_load:function(pageType,urlWebConfig,isPagination){var $_o=this;var pageVars=$_o.$_cp.get_page_vars(pageType,null,isPagination);var formId=pageVars.formId;var boxId=pageVars.boxId;var namePre=pageVars.namePre;if(!formId||!boxId||!namePre){return} if(!isObject(urlWebConfig)){urlWebConfig={}} var urlWebNamePre=namePre+'[url_web]';urlWebConfig.open=toInt(urlWebConfig.open);$(formId+' [name="'+urlWebNamePre+'[open]"][value="'+urlWebConfig.open+'"]').trigger('click');if(urlWebConfig.open>0){showPanelCollapse(boxId+'_web')} if(urlWebConfig.charset){$(formId+' select[name="'+urlWebNamePre+'[charset]"]').val(urlWebConfig.charset).trigger('change')} @@ -149,7 +149,7 @@ CpRenderer.prototype={constructor:CpRenderer,page_init:function(pageType,isPagin $_o.def_config_renderer_open(pageType);var rdBoxId=boxId+'_renderer';$(rdBoxId+' .add-url-renderer').bind('click',function(){$_o.add(pageType,isPagination)});$(rdBoxId+' [name="'+namePre+'[renderer][open]"]').bind('click',function(){$_o.def_config_use_renderer(pageType)});if(isPagination){$(rdBoxId+' [name="'+namePre+'[renderer][open_pn]"]').bind('click',function(){if($(this).val()==1){$(rdBoxId+'_open_pn').show()}else{$(rdBoxId+'_open_pn').hide()}})} $(rdBoxId+' .c-p-url-renderer-list').on('change','select[name="'+namePre+'[renderer][types][]"]',function(){var type=$(this).val();var tr=$(this).parents('tr').eq(0);var types={'wait_time':{content:1,content_tips:'输入数字'},'scroll_top':{content:1,content_tips:'输入数字'},'click':{element:1},'val':{element:1,content:1,content_tips:'输入值'}};var tdTypeCols=3;tr.find('.td-renderer-element,.td-renderer-content').hide();tr.find('input[name="'+namePre+'[renderer][contents][]"]').attr('placeholder','');var curType=types[type];if(isObject(curType)){if(curType.element){tr.find('.td-renderer-element').show();tdTypeCols-=1} if(curType.content){tr.find('.td-renderer-content').show();tdTypeCols-=1;if(curType.content_tips){tr.find('input[name="'+namePre+'[renderer][contents][]"]').attr('placeholder',curType.content_tips)}}} -tr.find('.td-renderer-type').attr('colspan',tdTypeCols)});$(rdBoxId+' .c-p-url-renderer-list').on('click','.delete-url-renderer',function(){$(this).parents('tr').eq(0).remove()});eleExchange(rdBoxId+' .c-p-url-renderer-list','.icon-drag-move','tr')},page_load:function(pageType,rdConfig,isPagination){var $_o=this;var pageVars=$_o.$_cp.get_page_vars(pageType,null,isPagination);var boxId=pageVars.boxId;var namePre=pageVars.namePre;if(!boxId||!namePre){return} +tr.find('.td-renderer-type').attr('colspan',tdTypeCols)});$(rdBoxId+' .c-p-url-renderer-list').on('click','.delete-url-renderer',function(){var curObj=$(this);confirmRight('确定删除?',function(){curObj.parents('tr').eq(0).remove()})});eleExchange(rdBoxId+' .c-p-url-renderer-list','.icon-drag-move','tr')},page_load:function(pageType,rdConfig,isPagination){var $_o=this;var pageVars=$_o.$_cp.get_page_vars(pageType,null,isPagination);var boxId=pageVars.boxId;var namePre=pageVars.namePre;if(!boxId||!namePre){return} var rdBoxId=boxId+'_renderer';if(isObject(rdConfig)){$(rdBoxId).find('[name="'+namePre+'[renderer][open]"][value="'+rdConfig.open+'"]').prop('checked',!0).trigger('click');var rdTypes=isObject(rdConfig.types)?rdConfig.types:[];var rdElements=isObject(rdConfig.elements)?rdConfig.elements:[];var rdContents=isObject(rdConfig.contents)?rdConfig.contents:[];var showPanel=!1;var openVal=rdConfig.open=='y'?true:!1;var openDef=$($_o.$_cp.formid+' [name="config[page_render]"]:checked').val();openDef=toInt(openDef);openDef=openDef>0?true:!1;if(rdTypes&&rdTypes.length>0){for(var i in rdTypes){$_o.add(pageType,isPagination,rdTypes[i],rdElements[i],rdContents[i])} if((!rdConfig.open&&openDef)||openVal){showPanel=!0}}else{if(rdConfig.open){if(openVal!=openDef){showPanel=!0}}} if(isPagination){$(rdBoxId+' [name="'+namePre+'[renderer][open_pn]"][value="'+rdConfig.open_pn+'"]').prop('checked',!0).trigger('click');if(rdConfig.open_pn){showPanel=!0}else{showPanel=!1}} @@ -186,12 +186,13 @@ $($_o.formObj+' #c_p_field_time_format_list').on('click','a[data-val]',function( if(!fieldData.hasOwnProperty('source')){$($_o.formObj+' [name="field[source]"]').trigger("change")} $($_o.formObj+' [name="field[num_start]"]').val(toInt(fieldData.num_start));$($_o.formObj+' [name="field[num_end]"]').val(toInt(fieldData.num_end));$($_o.formObj+' [name="field[auto]"][value="'+fieldData.auto+'"]').prop('checked',!0);if(fieldData.time_stamp){$($_o.formObj+' [name="field[time_stamp]"]').prop('checked',!0)} cpRuleModuleLoad($_o.formObj,'field','',fieldData);cpRuleModuleLoad($_o.formObj,'field','extract_',fieldData)}},add:function(objid,fieldData,processData){var $_o=this;var fieldSource='内容页';if(fieldData.source){var fsource=fieldData.source.split(':');fieldSource=$_o.$_cp.get_page_vars(fsource[0],'title');if(fsource[1]){fieldSource+=':'+fsource[1]}} -var isLoop='';if(fieldData.module=='rule'){if(fieldData.rule_multi&&fieldData.rule_multi_type=='loop'){isLoop=' - 循环入库'}}else if(fieldData.module=='xpath'){if(fieldData.xpath_multi&&fieldData.xpath_multi_type=='loop'){isLoop=' - 循环入库'}}else if(fieldData.module=='json'){if(fieldData.json_loop){isLoop=' - 循环入库'}}else if(fieldData.module=='extract'||fieldData.module=='merge'){$($_o.$_cp.formid+' #coll_pattern_field').find('.sort-field').show()} -if(isLoop){$('#c_p_field_loop_tips').show()} -if(objid){var eleObj=$($_o.$_cp.formid+' #'+objid);eleObj.find('.field-name').attr('data-val',fieldData.name).text(fieldData.name);eleObj.find('.field-source').attr('data-val',fieldData.source).text(fieldSource);eleObj.find('.field-module').attr('data-val',fieldData.module).text(window.tpl_lang['field_module_'+fieldData.module]+isLoop);if(isLoop){eleObj.find('.field-module').attr('data-is-loop',1)}else{eleObj.find('.field-module').removeAttr('data-is-loop')} +var fieldModule=window.tpl_lang['field_module_'+fieldData.module];var isLoop=!1;if(fieldData.module=='rule'){if(fieldData.rule_multi&&fieldData.rule_multi_type=='loop'){isLoop=!0}}else if(fieldData.module=='xpath'){if(fieldData.xpath_multi&&fieldData.xpath_multi_type=='loop'){isLoop=!0}}else if(fieldData.module=='json'){if(fieldData.json_loop){isLoop=!0}}else if(fieldData.module=='extract'||fieldData.module=='merge'){$($_o.$_cp.formid+' #coll_pattern_field').find('.sort-field').show();if(fieldData.module=='extract'){if(fieldData.extract_module=='rule'){if(fieldData.extract_rule_multi&&fieldData.extract_rule_multi_type=='loop'){isLoop=!0}}else if(fieldData.extract_module=='xpath'){if(fieldData.extract_xpath_multi&&fieldData.extract_xpath_multi_type=='loop'){isLoop=!0}}else if(fieldData.extract_module=='json'){if(fieldData.extract_json_loop){isLoop=!0}} +fieldModule+=' » '+(fieldData.extract?fieldData.extract:'')}} +if(isLoop){$('#c_p_field_loop_tips').show();fieldModule+='(循环入库)'} +if(objid){var eleObj=$($_o.$_cp.formid+' #'+objid);eleObj.find('.field-name').attr('data-val',fieldData.name).text(fieldData.name);eleObj.find('.field-source').attr('data-val',fieldData.source).text(fieldSource);eleObj.find('.field-module').attr('data-val',fieldData.module).text(fieldModule);if(isLoop){eleObj.find('.field-module').attr('data-is-loop',1)}else{eleObj.find('.field-module').removeAttr('data-is-loop')} eleObj.find('input[name="config[field_list][]"]').val(encode_json2urlbase(fieldData))}else{var ptitle='';if(processData){ptitle=[];for(var i in processData){ptitle.push(window.tpl_lang['process_module_'+processData[i].module]+(processData[i].title?(':'+processData[i].title):''))} ptitle=ptitle.join(' / ')} -var html=$_o.$_cp.clone_tpl('#coll_tpl_field');html.attr('id','field_'+generateUUID());html.find('.field-name').attr('data-val',fieldData.name).text(fieldData.name);html.find('.field-source').attr('data-val',fieldData.source).text(fieldSource);html.find('.field-module').attr('data-val',fieldData.module).text(window.tpl_lang['field_module_'+fieldData.module]+isLoop);if(isLoop){html.find('.field-module').attr('data-is-loop',1)}else{html.find('.field-module').removeAttr('data-is-loop')} +var html=$_o.$_cp.clone_tpl('#coll_tpl_field');html.attr('id','field_'+generateUUID());html.find('.field-name').attr('data-val',fieldData.name).text(fieldData.name);html.find('.field-source').attr('data-val',fieldData.source).text(fieldSource);html.find('.field-module').attr('data-val',fieldData.module).text(fieldModule);if(isLoop){html.find('.field-module').attr('data-is-loop',1)}else{html.find('.field-module').removeAttr('data-is-loop')} html.find('[name="config[field_list][]"]').val(encode_json2urlbase(fieldData));html.find('[name="config[field_process][]"]').val(processData?encode_json2urlbase(processData):'');if(processData&&ptitle){html.find('.field-process').addClass('exist-process')} html.find('.field-process').attr('title',ptitle);html.find('[name="config[field_title]"]').val(fieldData.name);html.find('[name="config[field_content][]"]').val(fieldData.name);$($_o.$_cp.formid+' #coll_pattern_field .c-p-field-list tbody').append(html)}},add_sub:function(){var $_o=this;var objid=$($_o.formObj+' input[name="objid"]').val();var checkName=!0;if(objid){var fname=$($_o.$_cp.formid+' #'+objid).find('.field-name').attr('data-val');if(fname==$($_o.formObj+' input[name="field[name]"]').val()){checkName=!1}} if(checkName){var hasName=!1;var fieldNames=$_o.$_cp.get_field_names();for(var i in fieldNames){if($($_o.formObj+' input[name="field[name]"]').val()==fieldNames[i]){hasName=!0;break}} @@ -202,7 +203,7 @@ function CpProcess(cpClass){this.$_cp=cpClass;this.processForm='';this.processBo CpProcess.prototype={constructor:CpProcess,init:function(processData,isCommon,isCommonLoad){var $_o=this;$_o.processForm=isCommon?$_o.processFormCommon:$_o.processFormField;if(isCommon&&isCommonLoad){$_o.processBox=$_o.processBoxCommon}else{$_o.processBox=$_o.processBoxField} if($($_o.processForm).is('form')){$($_o.processForm).bind('submit',function(){$_o.add_sub();return!1})} $($_o.processBox+' .process-add').bind('click',function(){var module=$($_o.processBox+' select[name="process[module]"]').val();$_o.add({'add_new':1,'module':module})});if($($_o.processForm).prop('inited')==1){return!0} -$($_o.processForm).on('click','.p-m-html-tags a[data-val]',function(){var tag=$(this).attr('data-val');var moduleHtml=$(this).parents('.p-m-html-tags').eq(0).attr('module-html');var tagsObj=$(this).parents('section').eq(0).find('input[data-process="html:'+moduleHtml+'"]');var tags=tagsObj.val()+','+tag;tags=tags.replace(/(^,+)|(,+$)/,'');tagsObj.val(tags)});$($_o.processForm).on('change','[data-process="insert:insert_loc"]',function(){var helpEle=$(this).siblings('.help-block');if($(this).val()=='rand'){helpEle.show()}else{helpEle.hide()}});inputSelectCustom(null,null,{box:$_o.processForm,slt:'[data-process="translate:translate_from"]',ipt:'[data-process="translate:translate_from_custom"]'});inputSelectCustom(null,null,{box:$_o.processForm,slt:'[data-process="translate:translate_to"]',ipt:'[data-process="translate:translate_to_custom"]'});$_o.txt_insert_field($_o.processForm,'.p-m-func-field',function(sltObj){return $(sltObj).parents('section').eq(0).find('[data-process="func:func_param"]')});$($_o.processForm).on('click','.p-m-if-add',function(){var ifTable=$(this).parents('section').eq(0).find('.p-m-if-table');ifTable.append(''+ifTable.attr('data-tpl')+'')});$($_o.processForm).on('click','.p-m-if-del',function(){var tr=$(this).parents('tr').eq(0);confirmRight('确定删除?',function(){tr.remove()})});$($_o.processForm).on('change','[data-process="if:if_cond:"]',function(){var ifCond=$(this).val();var ifTr=$(this).parents('tr').eq(0);var ifTd=ifTr.find('.p-m-if-val').eq(0);var ifVal=ifTd.find('[data-process="if:if_val:"]').eq(0);var ifValInfo={name:ifVal.attr('name'),val:ifVal.val(),process:ifVal.attr('data-process')};var ifValType='def';if(ifCond=='func'){ifValType='func'}else if(ifCond.indexOf('time_')>-1){ifValType='time'} +$($_o.processForm).on('click','.p-m-html-tags a[data-val]',function(){var tag=$(this).attr('data-val');var moduleHtml=$(this).parents('.p-m-html-tags').eq(0).attr('module-html');var tagsObj=$(this).parents('section').eq(0).find('input[data-process="html:'+moduleHtml+'"]');var tags=tagsObj.val()+','+tag;tags=tags.replace(/(^,+)|(,+$)/,'');tagsObj.val(tags)});$($_o.processForm).on('change','[data-process="insert:insert_loc"]',function(){var helpEle=$(this).siblings('.help-block');if($(this).val()=='rand'){helpEle.show()}else{helpEle.hide()}});$_o.txt_insert_field($_o.processForm,'.p-m-insert-field',function(sltObj){return $(sltObj).parents('section').eq(0).find('[data-process="insert:insert_txt"]')});inputSelectCustom(null,null,{box:$_o.processForm,slt:'[data-process="translate:translate_from"]',ipt:'[data-process="translate:translate_from_custom"]'});inputSelectCustom(null,null,{box:$_o.processForm,slt:'[data-process="translate:translate_to"]',ipt:'[data-process="translate:translate_to_custom"]'});$_o.txt_insert_field($_o.processForm,'.p-m-func-field',function(sltObj){return $(sltObj).parents('section').eq(0).find('[data-process="func:func_param"]')});$($_o.processForm).on('click','.p-m-if-add',function(){var ifTable=$(this).parents('section').eq(0).find('.p-m-if-table');ifTable.append(''+ifTable.attr('data-tpl')+'')});$($_o.processForm).on('click','.p-m-if-del',function(){var tr=$(this).parents('tr').eq(0);confirmRight('确定删除?',function(){tr.remove()})});$($_o.processForm).on('change','[data-process="if:if_cond:"]',function(){var ifCond=$(this).val();var ifTr=$(this).parents('tr').eq(0);var ifTd=ifTr.find('.p-m-if-val').eq(0);var ifVal=ifTd.find('[data-process="if:if_val:"]').eq(0);var ifValInfo={name:ifVal.attr('name'),val:ifVal.val(),process:ifVal.attr('data-process')};var ifValType='def';if(ifCond=='func'){ifValType='func'}else if(ifCond.indexOf('time_')>-1){ifValType='time'} ifTd.find('.p-m-if-val-def,.p-m-if-val-time,.p-m-if-val-func').hide();ifTd.find('[data-process="if:if_val:"]').removeAttr('name').removeAttr('data-process');var ifValBox=ifTd.find('.p-m-if-val-'+ifValType);var ifValEle=ifValBox.find('.p-m-if-val-ele');ifValEle.attr('name',ifValInfo.name).attr('data-process',ifValInfo.process).val(ifValInfo.val);ifValBox.show();if(ifValType=='func'){$_o.load_if_func(ifTd,null)}});$($_o.processForm).on('change','.p-m-if-val-time-date select',function(){$(this).parents('tr').eq(0).find('[data-process="if:if_val:"]').val($(this).val())});$($_o.processForm).on('click','.p-m-if-val-func-info',function(){pluginFuncOp.tips('processIf')});$_o.txt_insert_field($_o.processForm,'.p-m-if-val-func-field select',function(sltObj){return $(sltObj).parents('td').eq(0).find('[data-process="if:if_val:"]')});$($_o.processForm).on('click','.p-m-if-info',function(){var tips='

执行顺序:从上至下判断,逻辑符“并且”的优先级高于“或者”

'+'

例如(字母表示条件):

'+'

a && b || c && d && e || f || g && h && i && j 等同于

'+'

(a && b) || (c && d && e) || f || (g && h && i && j)

'+'

括号中的条件都为真时才是真否则为假,整条语句中任意一个括号的结果为真最终结果为真,都为假最终结果为假

';confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})});$_o.txt_insert_field($_o.processForm,'.p-m-api-url-field select',function(sltObj){return $(sltObj).parents('section').eq(0).find('[data-process="api:api_url"]')});$($_o.processForm).on('click','.p-m-api-add',function(){var apiTable=$(this).parents('section').eq(0).find('.p-m-api-table table');apiTable.find('tbody').append(''+apiTable.attr('data-tpl')+'')});$($_o.processForm).on('click','.p-m-api-del',function(){var tr=$(this).parents('tr').eq(0);tr.remove()});inputSelectCustom(null,null,{box:$_o.processForm,slt:'[data-process="api:api_charset"]',ipt:'[data-process="api:api_charset_custom"]'});inputSelectCustom(null,null,{box:$_o.processForm,slt:'[data-process="api:api_encode"]',ipt:'[data-process="api:api_encode_custom"]'});$($_o.processForm).on('change','[data-process="api:api_params:val:"],[data-process="api:api_headers:val:"]',function(){var isHeader=!1;if($(this).attr('data-process')=='api:api_headers:val:'){isHeader=!0} var val=$(this).val();var tdObj=$(this).parents('td').eq(0);var iptObj=tdObj.find('[data-process="api:'+(isHeader?'api_headers':'api_params')+':addon:"]');var sltObj=tdObj.find('.p-m-api-'+(isHeader?'header':'val')+'-field');iptObj.hide();sltObj.hide();if(val=='time'||val=='custom'){if(val=='time'){iptObj.attr('placeholder','默认格式:Y-m-d H:i:s')}else if(val=='custom'){iptObj.attr('placeholder','输入任何内容');sltObj.css('display','table-cell')} iptObj.show()}});$_o.txt_insert_field($_o.processForm,'.p-m-api-val-field select',function(sltObj){return $(sltObj).parents('td').eq(0).find('[data-process="api:api_params:addon:"]')});$_o.txt_insert_field($_o.processForm,'.p-m-api-header-field select',function(sltObj){return $(sltObj).parents('td').eq(0).find('[data-process="api:api_headers:addon:"]')});$($_o.processForm).on('click','.p-m-api-header-add',function(){var apiHdTable=$(this).parents('section').eq(0).find('.p-m-api-header-table table');apiHdTable.find('tbody').append(''+apiHdTable.attr('data-tpl')+'')});$($_o.processForm).on('click','.p-m-api-header-del',function(){var tr=$(this).parents('tr').eq(0);tr.remove()});$($_o.processForm).on('change','[data-process="api:api_type"]',function(){var obj=$(this).parents('section').eq(0).find('.p-m-api-content-type');if($(this).val()=='post'){obj.show()}else{obj.hide()}});$($_o.processForm).on('change','[data-process="api:api_rule_module"]',function(){var ruleModule=$(this).val();ruleModule=ruleModule?ruleModule:'';var obj=$(this).parents('section').eq(0);obj.find('.p-m-api-rule-module').hide();obj.find('.p-m-api-rule-module[data-rule-module="'+ruleModule+'"]').show()});cpRuleModuleInit($_o.processForm,'data-process','api:api_');$($_o.processForm).on('change','[data-process="download:download_op"]',function(){var obj=$(this).parents('section').eq(0);var val=$(this).val();obj.find('.p-m-download-op').hide();obj.find('.p-m-download-op[data-op="'+val+'"]').show()});$($_o.processForm).on('click','.p-m-download-file-tag .dropdown-menu a[data-val]',function(){var prt=$(this).parents('.p-m-download-file-tag').eq(0);var obj=prt.find('[data-process="download:download_file_tag"]');var val=obj.val();if(val){val=val.split(',')}else{val=new Array()} diff --git a/public/static/js/admin/dataapi.js b/public/static/js/admin/dataapi.js new file mode 100644 index 0000000..e3fa9f5 --- /dev/null +++ b/public/static/js/admin/dataapi.js @@ -0,0 +1,21 @@ +/* + |-------------------------------------------------------------------------- + | SkyCaiji (蓝天采集器) + |-------------------------------------------------------------------------- + | Copyright (c) 2018 https://www.skycaiji.com All rights reserved. + |-------------------------------------------------------------------------- + | 使用协议 https://www.skycaiji.com/licenses + |-------------------------------------------------------------------------- + */ +'use strict';function DataapiClass(){this.formid='#form_dataapi'} +DataapiClass.prototype={constructor:DataapiClass,init_list:function(search){$('#dataapi_list .delete').bind('click',function(){var curTr=$(this).parents('tr[data-da-id]').eq(0);confirmRight('删除后将无法请求该接口!确定删除?',function(){ajaxOpen({type:'post',url:ulink('dataapi/op?op=delete'),data:{'id':curTr.attr('data-da-id')},success:function(data){ajaxDataMsg(data);if(data.code==1){curTr.remove()}}})})});$('#dataapi_list .status').bind('click',function(){var curTr=$(this).parents('tr[data-da-id]').eq(0);var curObj=$(this);ajaxOpen({type:'post',url:ulink('dataapi/op?op=status'),data:{'id':curTr.attr('data-da-id'),'status':(curObj.hasClass('status-close')?0:1)},success:function(data){ajaxDataMsg(data);data=data.data;if(data.status){curObj.removeClass('status-close').html('开启')}else{curObj.addClass('status-close').html('关闭')}}})});if(isObject(search)){for(var i in search){$('#form_search').find('[name="'+i+'"]').val(search[i])}}},init:function(dataapi){var $_o=this;$('#btn_dataset').bind('click',function(){windowModal('数据集',ulink('dataset/select?from=dataapi'))});$('#tips_config_cond').bind('click',function(){confirmRight({msg:'传入参数名:请求接口时url中传入或post提交数据中的参数名称',yes:'确定',textAlign:'left'})});$('#add_config_cond').bind('click',function(){$_o.add_cond(null)});$('#config_conds').on('click','.config-cond-add',function(){$_o.add_cond({sub:1},this)});$('#config_conds').on('change','[name="conds[field][]"]',function(){var curTr=$(this).parents('tr[id^="cond_"]').eq(0);var fname=$(this).val();fname=fname?('默认:'+fname):'';curTr.find('[name="conds[name][]"]').attr('placeholder',fname)});$('#config_conds').on('click','.config-cond-dlt',function(){var curObj=$(this);confirmRight('确定删除?',function(){curObj.parents('tr[id^="cond_"]').remove();$_o.first_cond()})});eleExchange('#config_conds','.config-cond-move','tr[id^="cond_"]',{stop:function(event,ui){$_o.first_cond()}});if(isObject(dataapi)){$($_o.formid).find('[name="name"]').val(dataapi.name?dataapi.name:'');$($_o.formid).find('[name="route"]').val(dataapi.route?dataapi.route:'');$($_o.formid).find('[name="desc"]').val(dataapi.desc?dataapi.desc:'');$($_o.formid).find('[name="sort"]').val(dataapi.sort?toInt(dataapi.sort):0);$($_o.formid).find('[name="status"][value="'+toInt(dataapi.status)+'"]').prop('checked',!0);var config=dataapi.config;$_o.dataset_load({'dataset_id':dataapi.ds_id},dataapi.config)}},first_cond:function(){var firstObj=$('#config_conds').find('tr[id^="cond_"]:first').eq(0);if(firstObj.hasClass('config-cond-sub')){firstObj.removeClass('config-cond-sub');firstObj.find('[name="conds[sub][]"]').val('')}},add_cond:function(cond,curObj){cond=isObject(cond)?cond:null;var trId='cond_'+generateUUID();var tr=$('#tpl_config_cond').clone();tr.attr('id',trId);trId='#'+trId;var isSub=!1;if(cond){for(var i in cond){tr.find('[name="conds['+i+'][]"]').val(cond[i]?cond[i]:'')} +if(cond.sub){isSub=!0}} +if(isSub&&curObj){var endTr=null;var curTr=$(curObj).parents('tr[id^="cond_"]').eq(0);curTr.nextAll().each(function(){if(!$(this).hasClass('config-cond-sub')){return!1} +endTr=$(this)});if(!endTr){endTr=curTr} +endTr.after(tr)}else{$('#config_conds tbody').append(tr)} +if(cond){$(trId).find('[name="conds[field][]"]').trigger('change')} +if(isSub){$(trId).addClass('config-cond-sub')}},dataset_load:function(dsConfig,daConfig){var $_o=this;dsConfig=isObject(dsConfig)?dsConfig:{};daConfig=isObject(daConfig)?daConfig:null;var dsId=toInt(dsConfig.dataset_id);if(dsId>0){ajaxOpen({url:ulink('dataapi/dataset?ds_id='+dsId),success:function(data){var dsData=data.data;if(isObject(dsData)){var fields=isObject(dsData.fields)?dsData.fields:{};$('#config_conds_box').show();$($_o.formid).find('[name="ds_id"]').val(dsData.id);$('#btn_dataset').html('数据集:'+dsData.name);var opts='';var chks='';for(var i in fields){opts+='';chks+=''} +$('#tpl_config_cond').find('[name="conds[field][]"]').html(opts);$($_o.formid+' [name="config[order_field]"]').html(opts);$('#config_hide_fields').html(chks);$('#config_conds').find('[name="conds[field][]"]').each(function(){var curVal=$(this).val();$(this).html(opts).val(curVal)});if(daConfig){var conds=daConfig.conds;if(isObject(conds)){for(var i in conds.logic){$_o.add_cond({sub:conds.sub[i],logic:conds.logic[i],field:conds.field[i],op:conds.op[i],name:conds.name[i]})}} +delete daConfig.conds}} +$('#myModal').modal('hide');if(daConfig){for(var i in daConfig){var curObj=$($_o.formid).find('[name="config['+i+']"]').eq(0);if(curObj.length>0&&!curObj.is('input:radio')&&!curObj.is('input:checkbox')){curObj.val(daConfig[i])}} +$($_o.formid).find('[name="config[order_sort]"][value="'+daConfig.order_sort+'"]').prop('checked',!0);if(isObject(daConfig.hide_fields)){for(var i in daConfig.hide_fields){$($_o.formid).find('[name="config[hide_fields][]"][value="'+daConfig.hide_fields[i]+'"]').prop('checked',!0)}}}}})}},};var dataapiClass=new DataapiClass() \ No newline at end of file diff --git a/public/static/js/admin/dataset.js b/public/static/js/admin/dataset.js new file mode 100644 index 0000000..cbdb744 --- /dev/null +++ b/public/static/js/admin/dataset.js @@ -0,0 +1,27 @@ +/* + |-------------------------------------------------------------------------- + | SkyCaiji (蓝天采集器) + |-------------------------------------------------------------------------- + | Copyright (c) 2018 https://www.skycaiji.com All rights reserved. + |-------------------------------------------------------------------------- + | 使用协议 https://www.skycaiji.com/licenses + |-------------------------------------------------------------------------- + */ +'use strict';function DatasetClass(){this.formid='#form_dataset'} +DatasetClass.prototype={constructor:DatasetClass,init_list:function(search){$('#dataset_list .delete').bind('click',function(){var curTr=$(this).parents('tr[data-ds-id]').eq(0);confirmRight('将清空该数据集的所有数据,确定删除?',function(){ajax_check_userpwd({type:'post',url:ulink('dataset/op?op=delete'),data:{'id':curTr.attr('data-ds-id')},success:function(data){ajaxDataMsg(data);if(data.code==1){curTr.remove()}}})})});var dsIds=[];$('tr[data-ds-id]').each(function(){dsIds.push($(this).attr('data-ds-id'))});ajaxOpen({type:'post',url:ulink('dataset/dbCount'),data:{ids:dsIds},success:function(data){if(data.code==1){var ids=data.data;if(isObject(ids)){for(var i in ids){$('tr[data-ds-id="'+i+'"]').find('.db-count').text(ids[i])}}}}});if(isObject(search)){for(var i in search){$('#form_search').find('[name="'+i+'"]').val(search[i])}}},init:function(dataset){var $_o=this;$('#form_dataset').bind('submit',function(){var formObj=$(this);var settings=getFormAjaxSettings(formObj);settings.complete=function(){formObj.find('button[type="submit"]').removeAttr('disabled')};ajax_check_userpwd(settings);return!1});$('#add_dataset_field').bind('click',function(){windowModal('添加字段',ulink('dataset/field'))});$('#set_dataset_indexes').bind('click',function(){windowModal('合理设置索引可提升数据查询速度',ulink('dataset/indexes?ds_id='+$('#form_dataset').find('[name="id"]').val()),{lg:1})});$('#dataset_fields').on('click','.field-name',function(){var tr=$_o.field_tr(this);var objid=tr.attr('id');var field=tr.find('[name="fields[]"]').val();var options={};options.ajax={type:'post',data:{objid:objid,field:field}};windowModal('编辑字段',ulink('dataset/field'),options)});$('#dataset_fields').on('click','.field-dlt',function(){var tr=$_o.field_tr(this);confirmRight('会清空该字段的所有数据,确定删除?',function(){tr.remove()})});eleExchange('#dataset_fields','.field-move','[id^="field_"]');if(isObject(dataset)){$($_o.formid).find('[name="name"]').val(dataset.name?dataset.name:'');$($_o.formid).find('[name="desc"]').val(dataset.desc?dataset.desc:'');var config=dataset.config;if(isObject(config)){var fields=config.fields;if(isObject(fields)){for(var i in fields){var field=fields[i];if(isObject(field)){field.name_original=field.name;$_o.field_add(field,null)}}}}}},db_init:function(list,search){var $_o=this;$('#dataset_db_list').on('change','input[type="text"],input[type="number"],textarea',function(){$(this).parents('tr').eq(0).find('input[name="ids[]"]').prop('checked',!0)});$('#dataset_db_list').on('focus','textarea',function(){$(this).addClass('txt-big')});$('#dataset_db_list').on('blur','textarea',function(){$(this).removeClass('txt-big')});$.datetimepicker.setLocale('zh');$('#addnew').bind('click',function(){var minId=0;$('[name="ids[]"]').each(function(){var val=toInt($(this).val());if(minId>val){minId=val}});minId=minId-1;$_o.db_add([{id:minId}])});$('#deleteall').bind('click',function(){confirmRight('确定删除选中的数据?',function(){var ids=[];$('input[name="ids[]"]:checked').each(function(){ids.push($(this).val())});$_o.db_delete(ids)})});$('#dataset_db_list').on('click','.db-delete',function(){var tr=$(this).parents('tr').eq(0);var id=tr.find('[name="ids[]"]').val();confirmRight('确定删除数据?',function(){$_o.db_delete(id)})});$_o.db_add(list);if(isObject(search)){for(var i in search){$('#form_search').find('[name="'+i+'"]').val(search[i])}}},db_add:function(list){if(!isObject(list)){list=[]} +var tr=$('#tpl_db').clone();tr.removeAttr('id');var trHtmls='';for(var i in list){var item=list[i];if(!isObject(item)){item={}} +var id=item.id?item.id:'';trHtmls+=''+tr.html().replace(/\[_id_\]/g,'['+id+']')+''} +$('#dataset_db_list tbody').append(trHtmls);$('#dataset_db_list').find('.db-time').datetimepicker({format:'Y-m-d H:i:s'});for(var i in list){var item=list[i];if(!isObject(item)){item={}} +var id=item.id?item.id:'';var trObj=$('#dataset_db_list').find('[data-db-id="'+id+'"]');trObj.find('[data-field="id"]').html(id>0?id:'  ');trObj.find('[name="ids[]"]').val(id);trObj.find('input[data-field],textarea[data-field]').each(function(){var name=$(this).attr('data-field');$(this).val(item[name]?item[name]:'')})} +$('#form_list').find('.overlay').hide()},db_delete:function(ids){if(!isObject(ids)){ids=isNull(ids)?[]:[ids]} +if(ids.length>0){var ids1=[];for(var i in ids){if(ids[i]<0){$('tr[data-db-id="'+ids[i]+'"]').remove()}else{ids1.push(ids[i])}} +ids=ids1} +if(ids.length>0){ajaxOpen({type:'post',url:ulink('dataset/dbDelete?ds_id='+$('#form_list').find('[name="ds_id"]').val()),data:{ids:ids},success:function(data){ajaxDataMsg(data);if(data.code==1){var ids=data.data;if(isObject(ids)){for(var i in ids){$('tr[data-db-id="'+ids[i]+'"]').remove()}}}}})}},field_add:function(field,objid){var tr=null;if(objid){tr=$('#'+objid)}else{tr=$('#tpl_field').clone();tr.attr('id','field_'+generateUUID())} +var fname=field.name;if(field.type=='varchar'&&field.len>0){fname+=' ('+field.len+')'} +tr.find('.field-name').text(fname).attr('data-dbname',field.name_dbname);tr.find('.field-type').text(window.tpl_lang['ds_f_type_'+field.type]);tr.find('.field-desc').text(field.desc);tr.find('[name="fields[]"]').val(encode_json2urlbase(field));if(!objid){$('#dataset_fields tbody').append(tr)}},field_init:function(objid,fieldData){var $_o=this;inputSelectCustom('#form_field [name="type"]','len',null,'varchar');$('#form_field').bind('submit',function(){ajaxOpen({type:'POST',dataType:'json',url:$('#form_field').attr('action'),data:$('#form_field').serialize(),success:function(data){if(data.code==1){data=data.data;if(isObject(data)){var objid=data.objid;var field=data.field;if(isObject(field)){var hasField=!1;var totalLen=0;if(field.type=='varchar'){field.len=toInt(field.len);field.len=field.len>0?field.len:500;totalLen+=field.len} +$('#dataset_fields tr[id^="field_"]').each(function(){var curId=$(this).attr('id');var dbname=$(this).find('.field-name').attr('data-dbname');if(dbname==field.name_dbname){if(objid&&objid==curId){hasField=!1}else{hasField=!0}} +if(!objid||objid!=curId){var fData=$(this).find('[name="fields[]"]').val();fData=decode_urlbase2json(fData);if(fData.type=='varchar'){fData.len=toInt(fData.len);fData.len=fData.len>0?fData.len:500;totalLen+=fData.len}}});if(hasField){toastr.error('字段名称已存在!')}else if(totalLen>16383){toastr.error('所有字符串字段的总长度不能超过16383')}else{$_o.field_add(field,objid);$('#myModal').modal('hide')}}}}else{toastr.error(data.msg)}}});return!1});if(objid&&isObject(fieldData)){$('#form_field [name="objid"]').val(objid);$('#form_field [name="name"]').val(fieldData.name?fieldData.name:'');$('#form_field [name="name_original"]').val(fieldData.name_original?fieldData.name_original:'');$('#form_field [name="desc"]').val(fieldData.desc?fieldData.desc:'');$('#form_field [name="type"]').val(fieldData.type?fieldData.type:'').trigger('change');fieldData.len=toInt(fieldData.len);$('#form_field [name="len"]').val(fieldData.len>0?fieldData.len:'')}},field_tr:function(curObj){return $(curObj).parents('tr[id^="field_"]').eq(0)},indexes_init:function(indexes){var $_o=this;var tplIndex='#win_dataset_indexes .index-tpl [data-tpl="index"]';var tplFields='#win_dataset_indexes .index-tpl [data-tpl="fields"]';var tableEle='#win_dataset_indexes form table.index-list';$('#win_dataset_indexes .index-add-index').bind('click',function(){$_o.indexes_add(tplIndex,tplFields,tableEle,null)});$('#win_dataset_indexes').on('change','.index-field',function(){var curTr=$(this).parents('tr[id^="index_"]').eq(0);if($(this).val()=='-1'){if(curTr.find('.index-field').length<=1){toastr.error('最少保留一个字段!');$(this).val('')}else{$(this).parents('td').eq(0).remove()}} +var ixSlt=curTr.find('.index-type');var ixVal=ixSlt.val();ixSlt.find('option').prop('disabled',!1).show();var allowIxs={};curTr.find('.index-field').each(function(){var type=$(this).find('option[value="'+$(this).val()+'"]').attr('data-type');var allowTypes={bigint:['index','unique'],double:['index','unique'],mediumtext:['fulltext'],datetime:['index','unique']};if(isObject(allowTypes[type])){ixSlt.find('option').each(function(){if(!$(this).is(':disabled')){var optVal=$(this).attr('value');if(optVal&&allowTypes[type].indexOf(optVal)<0){$(this).prop('disabled',!0).hide()}}})}});if(ixSlt.find('option[value="'+ixVal+'"]').is(':disabled')){var showVal='';ixSlt.find('option').each(function(){var optVal=$(this).attr('value');if(optVal&&!$(this).is(':disabled')){showVal=optVal;return!1}});ixSlt.val(showVal)}});$(tableEle).on('click','.index-add-field',function(){var curTr=$(this).parents('tr[id^="index_"]').eq(0);var indexId=curTr.attr('id');var fieldsObj=$(tplFields).clone();fieldsObj.find('.index-field').attr('name','indexes['+indexId+'][fields][]');curTr.find('.index-fields').append(fieldsObj)});$(tableEle).on('click','.index-delete-index',function(){var curObj=$(this);confirmRight('确定删除?',function(){curObj.parents('tr[id^="index_"]').eq(0).remove()})});if(!isObject(indexes)){indexes={}} +for(var i in indexes){var index=indexes[i];if(isObject(index)){$_o.indexes_add(tplIndex,tplFields,tableEle,index)}}},indexes_add:function(tplIndex,tplFields,tableEle,indexData){if(!isObject(indexData)){indexData={}} +var trObj=$(tplIndex).clone();var indexId='index_'+generateUUID();trObj.attr('id',indexId);trObj.find('.index-type').attr('name','indexes['+indexId+'][type]').val(indexData.type?indexData.type:'');if(isObject(indexData.fields)){for(var fi in indexData.fields){var fieldsObj=$(tplFields).clone();fieldsObj.find('.index-field').attr('name','indexes['+indexId+'][fields][]').val(fi);trObj.find('.index-fields').append(fieldsObj)}}else{var fieldsObj=$(tplFields).clone();fieldsObj.find('.index-field').attr('name','indexes['+indexId+'][fields][]');trObj.find('.index-fields').append(fieldsObj)} +$(tableEle).append(trObj)}};var datasetClass=new DatasetClass() \ No newline at end of file diff --git a/public/static/js/admin/release.js b/public/static/js/admin/release.js index 7d6674c..887ae39 100644 --- a/public/static/js/admin/release.js +++ b/public/static/js/admin/release.js @@ -9,21 +9,21 @@ */ 'use strict';function ReleaseClass(formid,releid){this.formid='#'+formid;this.releid=releid;this.curFocusResIpt=''} ReleaseClass.prototype={constructor:ReleaseClass,init:function(){var $_o=this;$($_o.formid).bind('submit',function(){var module=$($_o.formid+' select[name="module"]').val();if(module=='diy'&&$_o.has_diy_editor()){var diyCode=editorCodeIfr('#diy_editor_ifr',{'get_value':1});if(diyCode){$($_o.formid+' [name="diy[code]"]').val(diyCode)}} -var settings=getFormAjaxSettings($(this));settings.data={'_post_data_':settings.data};ajaxOpen(settings);return!1});$($_o.formid+' select[name="module"]').bind('change',function(){var module=$(this).val();$($_o.formid+' .rele-module').hide();$($_o.formid+' .rele-module[module="'+module+'"]').show()});$('#rele_module_cms .btn-cms-detect').bind('click',function(){$_o.cms_detect()});$('#rele_module_cms .btn-cms-bind').bind('click',function(){$_o.cms_bind()});$('#rele_module_cms').on('change','select[name="cms[app]"]',function(){var cmsApp=$(this).val();$_o.cms_bind({cms:{app:cmsApp}})});$('#cms_list').on('click','li a',function(){var path=$(this).attr('path');if(path){$($_o.formid+' [name="cms[path]"]').val(path);$('#cms_tab a[href="#cms_tab_bind"]').tab('show');$_o.cms_bind()}});inputSelectCustom(null,null,{box:'#rele_module_cms',slt:'select[name^="cms_app[param]"]',ipt:'input[name^="cms_app[custom]"]'},'custom:');$('#db_tab_config .dm-db-charset li span').bind('click',function(){var charset=$(this).attr('data-val');charset=charset?charset:'';$('#db_tab_config [name="db[charset]"]').val(charset)});$('#db_tab_config .btn-db-names').bind('click',function(){$_o.db_connect('db_names')});$('#db_tab_config .btn-db-connect').bind('click',function(){$_o.db_connect()});$('#rele_module_file').on('click','.btn-file-rand-path',function(){var randStr=$_o.rand_str(10);$($_o.formid+' [name="file[path]"]').val(randStr)});$('#rele_module_api').on('click','.btn-api-rand-url',function(){var randStr=$_o.rand_str(10);$($_o.formid+' [name="api[key]"]').val(randStr)});$('#diy_tab').on('click','[data-type]',function(){var type=$(this).attr('data-type');$($_o.formid+' [name="diy[type]"]').val(type);if(type=='code'&&$_o.has_diy_editor()){var diyCode=$($_o.formid+' [name="diy[code]"]').val();diyCode=diyCode?diyCode:'';editorCodeIfr('#diy_editor_ifr',{'set_value':diyCode})}});$('#toapi_tab').on('click','[data-module]',function(){var module=$(this).attr('data-module');$($_o.formid+' [name="toapi[module]"]').val(module)});$('#rele_module_toapi').on('change','[name="toapi[type]"]',function(){if($(this).val()=='post'){$('#rele_module_toapi .toapi-content-type').show()}else{$('#rele_module_toapi .toapi-content-type').hide()}});$('#rele_module_toapi').on('click','.toapi-add-param',function(){$_o.toapi_add_param(null,null)});$('#rele_module_toapi').on('click','.toapi-del-param',function(){$(this).parents('tr').eq(0).remove()});$('#rele_module_toapi').on('click','.toapi-field-txt a[data-val]',function(){insertAtCaret($(this).parents('.toapi-field-txt').eq(0).find('input:text,textarea').eq(0),$(this).attr('data-val'))});inputSelectCustom('#rele_module_toapi [name="toapi[charset]"]','toapi[charset_custom]');inputSelectCustom('#rele_module_toapi [name="toapi[encode]"]','toapi[encode_custom]');$('#rele_module_toapi').on('click','.toapi-add-header',function(){$_o.toapi_add_header(null,null)});$('#rele_module_toapi').on('click','.toapi-del-header',function(){$(this).parents('tr').eq(0).remove()});$('#toapi_url_field').bind('change',function(){var val=$(this).val();$(this).val('');insertAtCaret($('#rele_module_toapi [name="toapi[url]"]'),val)});$('#toapi_app_url_field').bind('change',function(){var val=$(this).val();$(this).val('');insertAtCaret($('#rele_module_toapi [name="toapi[app_url]"]'),val)});$($_o.formid).find('[name="toapi[response][module]"]').bind('change',function(){var module=$(this).val();var resNames=['id','target','desc','error'];for(var i in resNames){var obj=$($_o.formid).find('[name="toapi[response]['+resNames[i]+']"]');var objPh=obj.attr('data-placeholder');if(!module){objPh+=',默认:'+resNames[i]} +var settings=getFormAjaxSettings($(this));settings.data={'_post_data_':settings.data};ajaxOpen(settings);return!1});$($_o.formid+' select[name="module"]').bind('change',function(){var module=$(this).val();$($_o.formid+' .rele-module').hide();$($_o.formid+' .rele-module[module="'+module+'"]').show()});$('#rele_module_dataset #btn_dataset_list').bind('click',function(){windowModal('数据集',ulink('dataset/select?from=release'))});$('#rele_module_dataset #btn_dataset_create').bind('click',function(){confirmRight('确定自动创建数据集?',function(){$($_o.formid+' [name="dataset[auto_create]"]').val(1);$($_o.formid).trigger('submit')})});$('#rele_module_cms .btn-cms-detect').bind('click',function(){$_o.cms_detect()});$('#rele_module_cms .btn-cms-bind').bind('click',function(){$_o.cms_bind()});$('#rele_module_cms').on('change','select[name="cms[app]"]',function(){var cmsApp=$(this).val();$_o.cms_bind({cms:{app:cmsApp}})});$('#cms_list').on('click','li a',function(){var path=$(this).attr('path');if(path){$($_o.formid+' [name="cms[path]"]').val(path);$('#cms_tab a[href="#cms_tab_bind"]').tab('show');$_o.cms_bind()}});inputSelectCustom(null,null,{box:'#rele_module_cms',slt:'select[name^="cms_app[param]"]',ipt:'input[name^="cms_app[custom]"]'},'custom:');$('#db_tab_config .dm-db-charset li span').bind('click',function(){var charset=$(this).attr('data-val');charset=charset?charset:'';$('#db_tab_config [name="db[charset]"]').val(charset)});$('#db_tab_config .btn-db-names').bind('click',function(){$_o.db_connect('db_names')});$('#db_tab_config .btn-db-connect').bind('click',function(){$_o.db_connect()});$('#rele_module_file').on('click','.btn-file-rand-path',function(){var randStr=$_o.rand_str(10);$($_o.formid+' [name="file[path]"]').val(randStr)});$('#rele_module_api').on('click','.btn-api-rand-url',function(){var randStr=$_o.rand_str(10);$($_o.formid+' [name="api[key]"]').val(randStr)});$('#diy_tab').on('click','[data-type]',function(){var type=$(this).attr('data-type');$($_o.formid+' [name="diy[type]"]').val(type);if(type=='code'&&$_o.has_diy_editor()){var diyCode=$($_o.formid+' [name="diy[code]"]').val();diyCode=diyCode?diyCode:'';editorCodeIfr('#diy_editor_ifr',{'set_value':diyCode})}});$('#toapi_tab').on('click','[data-module]',function(){var module=$(this).attr('data-module');$($_o.formid+' [name="toapi[module]"]').val(module)});$('#rele_module_toapi').on('change','[name="toapi[type]"]',function(){if($(this).val()=='post'){$('#rele_module_toapi .toapi-content-type').show()}else{$('#rele_module_toapi .toapi-content-type').hide()}});$('#rele_module_toapi').on('click','.toapi-add-param',function(){$_o.toapi_add_param(null,null)});$('#rele_module_toapi').on('click','.toapi-del-param',function(){$(this).parents('tr').eq(0).remove()});$('#rele_module_toapi').on('click','.toapi-field-txt a[data-val]',function(){insertAtCaret($(this).parents('.toapi-field-txt').eq(0).find('input:text,textarea').eq(0),$(this).attr('data-val'))});inputSelectCustom('#rele_module_toapi [name="toapi[charset]"]','toapi[charset_custom]');inputSelectCustom('#rele_module_toapi [name="toapi[encode]"]','toapi[encode_custom]');$('#rele_module_toapi').on('click','.toapi-add-header',function(){$_o.toapi_add_header(null,null)});$('#rele_module_toapi').on('click','.toapi-del-header',function(){$(this).parents('tr').eq(0).remove()});$('#toapi_url_field').bind('change',function(){var val=$(this).val();$(this).val('');insertAtCaret($('#rele_module_toapi [name="toapi[url]"]'),val)});$('#toapi_app_url_field').bind('change',function(){var val=$(this).val();$(this).val('');insertAtCaret($('#rele_module_toapi [name="toapi[app_url]"]'),val)});$($_o.formid).find('[name="toapi[response][module]"]').bind('change',function(){var module=$(this).val();var resNames=['id','target','desc','error'];for(var i in resNames){var obj=$($_o.formid).find('[name="toapi[response]['+resNames[i]+']"]');var objPh=obj.attr('data-placeholder');if(!module){objPh+=',默认:'+resNames[i]} obj.attr('placeholder',objPh);$('#toapi_resp_module_help').find('[data-module]').hide();$('#toapi_resp_module_help').find('[data-module="'+module+'"]').show()}});$($_o.formid).find('input[name^="toapi[response]"]').bind('focus',function(){$_o.curFocusResIpt=$(this).attr('name')});$('#toapi_resp_module_help').find('[data-rule-sign]').bind('click',function(){var curName=$_o.curFocusResIpt?$_o.curFocusResIpt:'toapi[response][id]';var ruleSign=$(this).attr('data-rule-sign');if(ruleSign=='sign_wildcard'){ruleInsertSign.wildcard('[name="'+curName+'"]')}else if(ruleSign=='sign_match'){ruleInsertSign.match('[name="'+curName+'"]')}else if(ruleSign=='sign_group'){ruleInsertSign.match('[name="'+curName+'"]',{group:1})}});$('#btn_toapi_app').bind('click',function(){$('#toapi_app_params').html('
');ajaxOpen({type:'post',url:ulink("release/toapiApp"),data:{'task_id':$($_o.formid+' [name="task_id"]').val(),'app_url':$('#rele_module_toapi [name="toapi[app_url]"]').val()},success:function(data){$('#toapi_app_params').html('');if(dataIsJson(data)){var html=data.data?data.data.html:'';if(html){modal(''+data.msg+'',html)}else{ajaxDataMsg(data)}}else{$('#toapi_app_params').html(data)}},error:function(){$('#toapi_app_params').html('')}})});$('#toapi_tab a[href="#toapi_tab_app"]').bind('click',function(){ajaxOpen({type:'get',url:ulink("release/toapiApp?task_id=_id_",{'_id_':$($_o.formid+' [name="task_id"]').val()}),success:function(data){if(dataIsJson(data)){ajaxDataMsg(data)}else{$('#toapi_app_params').html(data)}}})});$('#btn_rele_test').bind('click',function(){collectorWindow('测试','admin/release/test?id='+$_o.releid,null,{lg:1})})},load:function(data){var $_o=this;if(data.module){$($_o.formid+' select[name="module"]').val(data.module).trigger('change')} -if(data.config){if('cms'==data.module){$_o.cms_bind(data.config);$(document).ready(function(){$('#cms_tab a[href="#cms_tab_bind"]').tab('show')})}else if('db'==data.module){$_o.db_bind(data.config)}else if('file'==data.module){if(data.config.file){$($_o.formid+' [name="file[path]"]').val(data.config.file.path);$($_o.formid+' [name="file[type]"]').each(function(){if($(this).val()==data.config.file.type){$(this).prop('checked',!0)}});$($_o.formid+' [name="file[txt_implode]"]').val(data.config.file.txt_implode);$($_o.formid+' [name="file[max_line]"]').val(toInt(data.config.file.max_line));if(data.config.file.hide_fields){for(var fi in data.config.file.hide_fields){$($_o.formid+' [name="file[hide_fields][]"][value="'+data.config.file.hide_fields[fi]+'"]').prop('checked',!0)}}}}else if('api'==data.module){if(data.config.api){$($_o.formid+' [name="api[key]"]').val(data.config.api.key);$($_o.formid+' [name="api[cache_time]"]').val(data.config.api.cache_time);if(data.config.api.hide_fields){for(var fi in data.config.api.hide_fields){$($_o.formid+' [name="api[hide_fields][]"][value="'+data.config.api.hide_fields[fi]+'"]').prop('checked',!0)}}}}else if('diy'==data.module){if(data.config.diy){$(document).ready(function(){$('#diy_tab a[href="#diy_tab_'+data.config.diy.type+'"]').tab('show').trigger('click');for(var i in data.config.diy){$($_o.formid+' [name="diy['+i+']"]').val(data.config.diy[i])} +if(data.config){if('dataset'==data.module){$_o.dataset_load(data.config.dataset)}else if('cms'==data.module){$_o.cms_bind(data.config);$(document).ready(function(){$('#cms_tab a[href="#cms_tab_bind"]').tab('show')})}else if('db'==data.module){$_o.db_bind(data.config)}else if('file'==data.module){if(data.config.file){$($_o.formid+' [name="file[path]"]').val(data.config.file.path);$($_o.formid+' [name="file[type]"]').each(function(){if($(this).val()==data.config.file.type){$(this).prop('checked',!0)}});$($_o.formid+' [name="file[txt_implode]"]').val(data.config.file.txt_implode);$($_o.formid+' [name="file[max_line]"]').val(toInt(data.config.file.max_line));if(data.config.file.hide_fields){for(var fi in data.config.file.hide_fields){$($_o.formid+' [name="file[hide_fields][]"][value="'+data.config.file.hide_fields[fi]+'"]').prop('checked',!0)}}}}else if('api'==data.module){if(data.config.api){$($_o.formid+' [name="api[key]"]').val(data.config.api.key);$($_o.formid+' [name="api[cache_time]"]').val(data.config.api.cache_time);if(data.config.api.hide_fields){for(var fi in data.config.api.hide_fields){$($_o.formid+' [name="api[hide_fields][]"][value="'+data.config.api.hide_fields[fi]+'"]').prop('checked',!0)}}}}else if('diy'==data.module){if(data.config.diy){$(document).ready(function(){$('#diy_tab a[href="#diy_tab_'+data.config.diy.type+'"]').tab('show').trigger('click');for(var i in data.config.diy){$($_o.formid+' [name="diy['+i+']"]').val(data.config.diy[i])} if(data.config.diy.app){var appName=data.config.diy.app;if(appName.length>1){appName=appName.substr(0,1).toUpperCase()+appName.substr(1).toLowerCase()}else{appName=appName.toUpperCase()} $($_o.formid+' [name="diy[app]"]').parent().find('.diy-app-name').text(appName+'.php');$($_o.formid+' [name="diy[app]"]').parent().find('.diy-app-editor').show().find('.btn_diy_editor').attr('href',ulink('develop/editor?type=release&module=diy&app=_app_',{'_app_':appName}))} if($_o.has_diy_editor()&&data.config.diy.code){editorCodeIfr('#diy_editor_ifr',{'set_value':data.config.diy.code})}})}}else if('toapi'==data.module){var config=data.config.toapi;if(config){$($_o.formid+' [name="toapi[module]"]').val(config.module);$($_o.formid+' [name="toapi[url]"]').val(config.url);$($_o.formid+' [name="toapi[type]"]').val(config.type).trigger('change');$($_o.formid+' [name="toapi[content_type]"]').val(config.content_type);$($_o.formid+' [name="toapi[charset_custom]"]').val(config.charset_custom);$($_o.formid+' [name="toapi[charset]"]').val(config.charset).trigger('change');$($_o.formid+' [name="toapi[encode_custom]"]').val(config.encode_custom);$($_o.formid+' [name="toapi[encode]"]').val(config.encode).trigger('change');if(config.response){for(var i in config.response){$($_o.formid+' [name="toapi[response]['+i+']"]').val(config.response[i])}} $($_o.formid+' [name="toapi[response][module]"]').trigger('change');if(config.param_name){config.param_val=config.param_val?config.param_val:{};for(var i in config.param_name){var pname=config.param_name[i]?config.param_name[i]:'';var pval=config.param_val[i]?config.param_val[i]:'';$_o.toapi_add_param({name:pname,val:pval},i)}} if(config.header_name){config.header_val=config.header_val?config.header_val:{};for(var i in config.header_name){var hname=config.header_name[i]?config.header_name[i]:'';var hval=config.header_val[i]?config.header_val[i]:'';$_o.toapi_add_header({name:hname,val:hval},i)}} -$($_o.formid+' [name="toapi[app_url]"]').val(config.app_url);config.interval=toInt(config.interval);config.wait=toInt(config.wait);config.retry=toInt(config.retry);$($_o.formid+' [name="toapi[interval]"]').val(config.interval);$($_o.formid+' [name="toapi[wait]"]').val(config.wait);$($_o.formid+' [name="toapi[retry]"]').val(config.retry);$(document).ready(function(){$('#toapi_tab a[href="#toapi_tab_'+config.module+'"]').tab('show').trigger('click');if(config.interval>0||config.wait>0||config.retry>0){showPanelCollapse('#panel_toapi')}})}}}},cms_detect:function(){var $_o=this;$('#cms_list').html('').addClass('loading');ajaxOpen({type:'get',url:ulink("release/cmsDetect"),dataType:'json',success:function(data){$('#cms_list').removeClass('loading');if(data.code==1){var html='

点击选择CMS

';for(var x in data.data){var list=data.data[x];html+='