mirror of
https://gitee.com/coder-xiaomo/flashsale
synced 2025-09-12 15:01:39 +08:00
添加Metronic(作为LFS)
This commit is contained in:
199
frontend/static/admin/pages/css/login.css
Normal file
199
frontend/static/admin/pages/css/login.css
Normal file
@@ -0,0 +1,199 @@
|
||||
/* Cubic Bezier Transition */
|
||||
/***
|
||||
Login page
|
||||
***/
|
||||
/* bg color */
|
||||
.login {
|
||||
background-color: #364150 !important; }
|
||||
|
||||
.login .logo {
|
||||
margin: 0 auto;
|
||||
margin-top: 60px;
|
||||
padding: 15px;
|
||||
text-align: center; }
|
||||
|
||||
.login .content {
|
||||
background-color: #eceef1;
|
||||
-webkit-border-radius: 7px;
|
||||
-moz-border-radius: 7px;
|
||||
-ms-border-radius: 7px;
|
||||
-o-border-radius: 7px;
|
||||
border-radius: 7px;
|
||||
width: 400px;
|
||||
margin: 40px auto 10px auto;
|
||||
padding: 30px;
|
||||
padding-top: 10px;
|
||||
overflow: hidden;
|
||||
position: relative; }
|
||||
|
||||
.login .content h3 {
|
||||
color: #4db3a5;
|
||||
text-align: center;
|
||||
font-size: 28px;
|
||||
font-weight: 400 !important; }
|
||||
|
||||
.login .content h4 {
|
||||
color: #555; }
|
||||
|
||||
.login .content .hint {
|
||||
color: #999;
|
||||
padding: 0;
|
||||
margin: 15px 0 7px 0; }
|
||||
|
||||
.login .content .login-form,
|
||||
.login .content .forget-form {
|
||||
padding: 0px;
|
||||
margin: 0px; }
|
||||
|
||||
.login .content .form-control {
|
||||
border: none;
|
||||
background-color: #dde3ec;
|
||||
height: 43px;
|
||||
color: #8290a3;
|
||||
border: 1px solid #dde3ec; }
|
||||
.login .content .form-control:focus,
|
||||
.login .content .form-control:active {
|
||||
border: 1px solid #c3ccda; }
|
||||
.login .content .form-control::-moz-placeholder {
|
||||
color: #8290a3;
|
||||
opacity: 1; }
|
||||
.login .content .form-control:-ms-input-placeholder {
|
||||
color: #8290a3; }
|
||||
.login .content .form-control::-webkit-input-placeholder {
|
||||
color: #8290a3; }
|
||||
|
||||
.login .content select.form-control {
|
||||
padding-left: 9px;
|
||||
padding-right: 9px; }
|
||||
|
||||
.login .content .forget-form {
|
||||
display: none; }
|
||||
|
||||
.login .content .register-form {
|
||||
display: none; }
|
||||
|
||||
.login .content .form-title {
|
||||
font-weight: 300;
|
||||
margin-bottom: 25px; }
|
||||
|
||||
.login .content .form-actions {
|
||||
clear: both;
|
||||
border: 0px;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding: 25px 30px 25px 30px;
|
||||
margin-left: -30px;
|
||||
margin-right: -30px; }
|
||||
|
||||
.login-options {
|
||||
margin-bottom: 30px;
|
||||
overflow: hidden; }
|
||||
|
||||
.login-options h4 {
|
||||
float: left;
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
color: #7d91aa !important; }
|
||||
|
||||
.login-options .social-icons {
|
||||
float: right;
|
||||
padding-top: 3px; }
|
||||
|
||||
.login-options .social-icons li a {
|
||||
border-radius: 15px 15px 15px 15px !important;
|
||||
-moz-border-radius: 15px 15px 15px 15px !important;
|
||||
-webkit-border-radius: 15px 15px 15px 15px !important; }
|
||||
|
||||
.login .content .form-actions .checkbox {
|
||||
margin-left: 0;
|
||||
padding-left: 0; }
|
||||
|
||||
.login .content .forget-form .form-actions {
|
||||
border: 0;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 20px; }
|
||||
|
||||
.login .content .register-form .form-actions {
|
||||
border: 0;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0px; }
|
||||
|
||||
.login .content .form-actions .btn {
|
||||
margin-top: 1px; }
|
||||
|
||||
.login .content .form-actions .btn {
|
||||
font-weight: 600;
|
||||
padding: 10px 20px !important; }
|
||||
|
||||
.login .content .form-actions .btn-default {
|
||||
font-weight: 600;
|
||||
padding: 10px 25px !important;
|
||||
color: #6c7a8d;
|
||||
background-color: #ffffff;
|
||||
border: none; }
|
||||
|
||||
.login .content .form-actions .btn-default:hover {
|
||||
background-color: #fafaff;
|
||||
color: #45b6af; }
|
||||
|
||||
.login .content .forget-password {
|
||||
font-size: 14px;
|
||||
float: right;
|
||||
display: inline-block;
|
||||
margin-top: 10px; }
|
||||
|
||||
.login .content .check {
|
||||
color: #8290a3; }
|
||||
|
||||
.login .content .rememberme {
|
||||
margin-left: 8px;
|
||||
margin-top: 10px; }
|
||||
|
||||
.login .content .create-account {
|
||||
margin: 0 -40px -30px -40px;
|
||||
padding: 15px 0 17px 0;
|
||||
text-align: center;
|
||||
background-color: #6c7a8d;
|
||||
-webkit-border-radius: 0 0 7px 7px;
|
||||
-moz-border-radius: 0 0 7px 7px;
|
||||
-ms-border-radius: 0 0 7px 7px;
|
||||
-o-border-radius: 0 0 7px 7px;
|
||||
border-radius: 0 0 7px 7px; }
|
||||
.login .content .create-account > p {
|
||||
margin: 0; }
|
||||
|
||||
.login .content .create-account p a {
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
color: #c3cedd; }
|
||||
|
||||
.login .content .create-account a {
|
||||
display: inline-block;
|
||||
margin-top: 5px; }
|
||||
|
||||
/* footer copyright */
|
||||
.login .copyright {
|
||||
text-align: center;
|
||||
margin: 0 auto 30px 0;
|
||||
padding: 10px;
|
||||
color: #7a8ca5;
|
||||
font-size: 13px; }
|
||||
|
||||
@media (max-width: 440px) {
|
||||
/***
|
||||
Login page
|
||||
***/
|
||||
.login .logo {
|
||||
margin-top: 10px; }
|
||||
.login .content {
|
||||
width: 280px;
|
||||
margin-top: 10px; }
|
||||
.login .content h3 {
|
||||
font-size: 22px; }
|
||||
.forget-password {
|
||||
display: inline-block;
|
||||
margin-top: 20px; }
|
||||
.login-options .social-icons {
|
||||
float: left;
|
||||
padding-top: 3px; }
|
||||
.login .checkbox {
|
||||
font-size: 13px; } }
|
112
frontend/static/admin/pages/scripts/appDetail.js
Normal file
112
frontend/static/admin/pages/scripts/appDetail.js
Normal file
@@ -0,0 +1,112 @@
|
||||
|
||||
var AppUpdate = function() {
|
||||
|
||||
var handleAppUpdate = function() {
|
||||
|
||||
$('#form').validate({
|
||||
errorElement: 'span', //default input error message container
|
||||
errorClass: 'help-block', // default input error message class
|
||||
focusInvalid: false, // do not focus the last invalid input
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
},
|
||||
icon_url: {
|
||||
required: true,
|
||||
url: true
|
||||
},
|
||||
ios_link: {
|
||||
url: true
|
||||
},
|
||||
android_link: {
|
||||
url: true
|
||||
}
|
||||
},
|
||||
|
||||
messages: {
|
||||
name: {
|
||||
required: "请输入名称"
|
||||
},
|
||||
icon_url: {
|
||||
required: "请输入下载url",
|
||||
url: "请输入正确的url链接"
|
||||
},
|
||||
ios_link: {
|
||||
url: "请输入正确的url链接"
|
||||
},
|
||||
android_link: {
|
||||
url: "请输入正确的url链接"
|
||||
}
|
||||
},
|
||||
|
||||
invalidHandler: function(event, validator) { //display error alert on form submit
|
||||
$('.alert-danger', $('.form')).show();
|
||||
},
|
||||
|
||||
highlight: function(element) { // hightlight error inputs
|
||||
$(element)
|
||||
.closest('.form-group').addClass('has-error'); // set error class to the control group
|
||||
},
|
||||
|
||||
success: function(label) {
|
||||
label.closest('.form-group').removeClass('has-error');
|
||||
label.remove();
|
||||
},
|
||||
|
||||
errorPlacement: function(error, element) {
|
||||
error.insertAfter(element.closest('input'));
|
||||
},
|
||||
|
||||
submitHandler: function(form) {
|
||||
form.submit(); // form validation success, call ajax form submit
|
||||
}
|
||||
});
|
||||
|
||||
$('.form input').keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
if ($('.form').validate().form()) {
|
||||
$('#form').submit(); //form validation success, call ajax form submit
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
//main function to initiate the module
|
||||
init: function() {
|
||||
|
||||
handleAppUpdate();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}();
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
AppUpdate.init();
|
||||
});
|
||||
|
||||
function updateApp(){
|
||||
|
||||
$.ajax( {
|
||||
url:'/admin/applications/update',
|
||||
data:$('#form').serialize(),
|
||||
type:'POST',
|
||||
processData:true,
|
||||
contentType:"application/x-www-form-urlencoded",
|
||||
success:function(data) {
|
||||
alert(data.status);
|
||||
if(data.status=="success"){
|
||||
window.location.reload(true);
|
||||
}else if(data.status=="fail"){
|
||||
alert(data.data.errMessage);
|
||||
}
|
||||
},
|
||||
error : function(e) {
|
||||
// view("异常!");
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
}
|
170
frontend/static/admin/pages/scripts/appList.js
Normal file
170
frontend/static/admin/pages/scripts/appList.js
Normal file
@@ -0,0 +1,170 @@
|
||||
var url = "/admin/applications/indexjson";
|
||||
|
||||
$('#dataTables-app').DataTable({
|
||||
"bPaginate": true,
|
||||
"bLengthChange": false,
|
||||
"bSort": false,
|
||||
"bFilter": true,
|
||||
"bAutoWidth": true,
|
||||
"bStateSave": true,
|
||||
"bServerSide": false,
|
||||
"bProcessing":true,
|
||||
"iDisplayLength": 20,
|
||||
"searching": true,
|
||||
"deferRender": true,
|
||||
"bDestroy":true,
|
||||
ajax:{
|
||||
"url" : url,
|
||||
"dataSrc" : "data.content"
|
||||
},
|
||||
columns : [
|
||||
{"data" : "id"},
|
||||
{"data" : "name"},
|
||||
{"data" : "iconUrl"},
|
||||
{"data" : "id"}
|
||||
],
|
||||
columnDefs: [{
|
||||
// 指定第一列,从0开始,0表示第一列,1表示第二列……
|
||||
targets: 2,
|
||||
render: function(data, type, row) {
|
||||
return "<img src='"+data+"' style='width:100px;' />";
|
||||
}
|
||||
},{
|
||||
targets: 3,
|
||||
render: function(data, type, row) {
|
||||
return "<a href='get?id="+data+"' class='btn btn-outline btn-circle red'><i class='fa fa-info-circle'></i> 查看详情</a>";
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
//屏蔽警告
|
||||
sDefaultContent : '',
|
||||
aTargets : [ '_all' ]
|
||||
}
|
||||
],
|
||||
language: {
|
||||
"sProcessing": "处理中...",
|
||||
"sLengthMenu": "显示 _MENU_ 项结果",
|
||||
"sZeroRecords": "没有匹配结果",
|
||||
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
|
||||
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
|
||||
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
|
||||
"sInfoPostFix": "",
|
||||
"sSearch": "搜索:",
|
||||
"sUrl": "",
|
||||
"sEmptyTable": "表中数据为空",
|
||||
"sLoadingRecords": "载入中...",
|
||||
"sInfoThousands": ",",
|
||||
"oPaginate": {
|
||||
"sFirst": "首页",
|
||||
"sPrevious": "上页",
|
||||
"sNext": "下页",
|
||||
"sLast": "末页"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": 以升序排列此列",
|
||||
"sSortDescending": ": 以降序排列此列"
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var AppAdd = function() {
|
||||
|
||||
var handleAppAdd = function() {
|
||||
|
||||
$('#form').validate({
|
||||
errorElement: 'span', //default input error message container
|
||||
errorClass: 'help-block', // default input error message class
|
||||
focusInvalid: false, // do not focus the last invalid input
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
},
|
||||
iconUrl: {
|
||||
required: true,
|
||||
url: true
|
||||
}
|
||||
},
|
||||
|
||||
messages: {
|
||||
name: {
|
||||
required: "请输入名称"
|
||||
},
|
||||
iconUrl: {
|
||||
required: "请输入下载url",
|
||||
url: "请输入正确的url链接"
|
||||
}
|
||||
},
|
||||
|
||||
invalidHandler: function(event, validator) { //display error alert on form submit
|
||||
$('.alert-danger', $('.form')).show();
|
||||
},
|
||||
|
||||
highlight: function(element) { // hightlight error inputs
|
||||
$(element)
|
||||
.closest('.form-group').addClass('has-error'); // set error class to the control group
|
||||
},
|
||||
|
||||
success: function(label) {
|
||||
label.closest('.form-group').removeClass('has-error');
|
||||
label.remove();
|
||||
},
|
||||
|
||||
errorPlacement: function(error, element) {
|
||||
error.insertAfter(element.closest('input'));
|
||||
},
|
||||
|
||||
submitHandler: function(form) {
|
||||
form.submit(); // form validation success, call ajax form submit
|
||||
}
|
||||
});
|
||||
|
||||
$('.form input').keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
if ($('.form').validate().form()) {
|
||||
$('#form').submit(); //form validation success, call ajax form submit
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
//main function to initiate the module
|
||||
init: function() {
|
||||
|
||||
handleAppAdd();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}();
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
AppAdd.init();
|
||||
});
|
||||
|
||||
function addApp(){
|
||||
|
||||
$.ajax( {
|
||||
url:'/admin/applications/create',
|
||||
data:$('#form').serialize(),
|
||||
type:'POST',
|
||||
processData:true,
|
||||
contentType:"application/x-www-form-urlencoded",
|
||||
success:function(data) {
|
||||
alert(data.status);
|
||||
if(data.status=="success"){
|
||||
window.location.reload(true);
|
||||
}else if(data.status=="fail"){
|
||||
alert(data.data.errMessage);
|
||||
}
|
||||
},
|
||||
error : function(e) {
|
||||
// view("异常!");
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
}
|
1392
frontend/static/admin/pages/scripts/dashboard.js
Normal file
1392
frontend/static/admin/pages/scripts/dashboard.js
Normal file
File diff suppressed because it is too large
Load Diff
100
frontend/static/admin/pages/scripts/login.js
Normal file
100
frontend/static/admin/pages/scripts/login.js
Normal file
@@ -0,0 +1,100 @@
|
||||
var Login = function() {
|
||||
|
||||
var handleLogin = function() {
|
||||
|
||||
$('.login-form').validate({
|
||||
errorElement: 'span', //default input error message container
|
||||
errorClass: 'help-block', // default input error message class
|
||||
focusInvalid: false, // do not focus the last invalid input
|
||||
rules: {
|
||||
email: {
|
||||
required: true
|
||||
},
|
||||
password: {
|
||||
required: true
|
||||
},
|
||||
remember: {
|
||||
required: false
|
||||
}
|
||||
},
|
||||
|
||||
messages: {
|
||||
email: {
|
||||
required: "请输入登录邮箱"
|
||||
},
|
||||
password: {
|
||||
required: "请输入密码"
|
||||
}
|
||||
},
|
||||
|
||||
invalidHandler: function(event, validator) { //display error alert on form submit
|
||||
$('.alert-danger', $('.login-form')).show();
|
||||
},
|
||||
|
||||
highlight: function(element) { // hightlight error inputs
|
||||
$(element)
|
||||
.closest('.form-group').addClass('has-error'); // set error class to the control group
|
||||
},
|
||||
|
||||
success: function(label) {
|
||||
label.closest('.form-group').removeClass('has-error');
|
||||
label.remove();
|
||||
},
|
||||
|
||||
errorPlacement: function(error, element) {
|
||||
error.insertAfter(element.closest('.input-icon'));
|
||||
},
|
||||
|
||||
submitHandler: function(form) {
|
||||
form.submit(); // form validation success, call ajax form submit
|
||||
}
|
||||
});
|
||||
|
||||
$('.login-form input').keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
if ($('.login-form').validate().form()) {
|
||||
$('.login-form').submit(); //form validation success, call ajax form submit
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
//main function to initiate the module
|
||||
init: function() {
|
||||
|
||||
handleLogin();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}();
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
Login.init();
|
||||
});
|
||||
|
||||
function doLogin(){
|
||||
|
||||
$.ajax( {
|
||||
url:'/admin/admin/login',// 跳转到 action
|
||||
data:$('.login-form').serialize(),
|
||||
type:'POST',
|
||||
processData:true,
|
||||
contentType:"application/x-www-form-urlencoded",
|
||||
success:function(data) {
|
||||
alert(data.status);
|
||||
if(data.status=="success"){
|
||||
location.href = "/admin/index/index";
|
||||
}else if(data.status=="fail"){
|
||||
alert(data.data.errMessage);
|
||||
}
|
||||
},
|
||||
error : function(e) {
|
||||
// view("异常!");
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
var TableDatatablesButtons = function () {
|
||||
|
||||
var initTable3 = function () {
|
||||
var table = $('#sample_3');
|
||||
|
||||
var oTable = table.dataTable({
|
||||
|
||||
// Internationalisation. For more info refer to http://datatables.net/manual/i18n
|
||||
"language": {
|
||||
"aria": {
|
||||
"sortAscending": ": activate to sort column ascending",
|
||||
"sortDescending": ": activate to sort column descending"
|
||||
},
|
||||
"emptyTable": "No data available in table",
|
||||
"info": "Showing _START_ to _END_ of _TOTAL_ entries",
|
||||
"infoEmpty": "No entries found",
|
||||
"infoFiltered": "(filtered1 from _MAX_ total entries)",
|
||||
"lengthMenu": "_MENU_ entries",
|
||||
"search": "Search:",
|
||||
"zeroRecords": "No matching records found"
|
||||
},
|
||||
|
||||
// Or you can use remote translation file
|
||||
//"language": {
|
||||
// url: '//cdn.datatables.net/plug-ins/3cfcc339e89/i18n/Portuguese.json'
|
||||
//},
|
||||
|
||||
buttons: [
|
||||
{ extend: 'print', className: 'btn dark btn-outline' },
|
||||
{ extend: 'copy', className: 'btn red btn-outline' },
|
||||
{ extend: 'pdf', className: 'btn green btn-outline' },
|
||||
{ extend: 'excel', className: 'btn yellow btn-outline ' },
|
||||
{ extend: 'csv', className: 'btn purple btn-outline ' },
|
||||
{ extend: 'colvis', className: 'btn dark btn-outline', text: 'Columns'}
|
||||
],
|
||||
|
||||
// setup responsive extension: http://datatables.net/extensions/responsive/
|
||||
responsive: true,
|
||||
|
||||
//"ordering": false, disable column ordering
|
||||
//"paging": false, disable pagination
|
||||
|
||||
"order": [
|
||||
[0, 'asc']
|
||||
],
|
||||
|
||||
"lengthMenu": [
|
||||
[5, 10, 15, 20, -1],
|
||||
[5, 10, 15, 20, "All"] // change per page values here
|
||||
],
|
||||
// set the initial value
|
||||
"pageLength": 10,
|
||||
|
||||
//"dom": "<'row' <'col-md-12'>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>", // horizobtal scrollable datatable
|
||||
|
||||
// Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
|
||||
// setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js).
|
||||
// So when dropdowns used the scrollable div should be removed.
|
||||
//"dom": "<'row' <'col-md-12'T>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r>t<'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>",
|
||||
});
|
||||
|
||||
// handle datatable custom tools
|
||||
$('#sample_3_tools > li > a.tool-action').on('click', function() {
|
||||
var action = $(this).attr('data-action');
|
||||
oTable.DataTable().button(action).trigger();
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
//main function to initiate the module
|
||||
init: function () {
|
||||
|
||||
if (!jQuery().dataTable) {
|
||||
return;
|
||||
}
|
||||
|
||||
initTable3();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}();
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
TableDatatablesButtons.init();
|
||||
});
|
161
frontend/static/admin/pages/scripts/tagCategoryList.js
Normal file
161
frontend/static/admin/pages/scripts/tagCategoryList.js
Normal file
@@ -0,0 +1,161 @@
|
||||
var url = "/admin/tags/indexcategoryjson";
|
||||
|
||||
$('#dataTables-tagcategory').DataTable({
|
||||
"bPaginate": true,
|
||||
"bLengthChange": false,
|
||||
"bSort": false,
|
||||
"bFilter": true,
|
||||
"bAutoWidth": true,
|
||||
"bStateSave": true,
|
||||
"bServerSide": false,
|
||||
"bProcessing":true,
|
||||
"iDisplayLength": 20,
|
||||
"searching": true,
|
||||
"deferRender": true,
|
||||
"bDestroy":true,
|
||||
ajax:{
|
||||
"url" : url,
|
||||
"dataSrc" : "data"
|
||||
},
|
||||
columns : [
|
||||
{"data" : "id"},
|
||||
{"data" : "name"},
|
||||
{"data" : "useCount"}
|
||||
],
|
||||
columnDefs: [
|
||||
// {
|
||||
// // 指定第一列,从0开始,0表示第一列,1表示第二列……
|
||||
// targets: 1,
|
||||
// render: function(data, type, row) {
|
||||
// switch(data){
|
||||
// case 0: return "待审核";
|
||||
// case 1: return "审核通过";
|
||||
// case 2: return "审核不通过";
|
||||
// case 3: return "失效";
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
{
|
||||
//屏蔽警告
|
||||
sDefaultContent : '',
|
||||
aTargets : [ '_all' ]
|
||||
}
|
||||
],
|
||||
language: {
|
||||
"sProcessing": "处理中...",
|
||||
"sLengthMenu": "显示 _MENU_ 项结果",
|
||||
"sZeroRecords": "没有匹配结果",
|
||||
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
|
||||
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
|
||||
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
|
||||
"sInfoPostFix": "",
|
||||
"sSearch": "搜索:",
|
||||
"sUrl": "",
|
||||
"sEmptyTable": "表中数据为空",
|
||||
"sLoadingRecords": "载入中...",
|
||||
"sInfoThousands": ",",
|
||||
"oPaginate": {
|
||||
"sFirst": "首页",
|
||||
"sPrevious": "上页",
|
||||
"sNext": "下页",
|
||||
"sLast": "末页"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": 以升序排列此列",
|
||||
"sSortDescending": ": 以降序排列此列"
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var CategoryAdd = function() {
|
||||
|
||||
var handleCategoryAdd = function() {
|
||||
|
||||
$('#form').validate({
|
||||
errorElement: 'span', //default input error message container
|
||||
errorClass: 'help-block', // default input error message class
|
||||
focusInvalid: false, // do not focus the last invalid input
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
messages: {
|
||||
name: {
|
||||
required: "请输入名称"
|
||||
}
|
||||
},
|
||||
|
||||
invalidHandler: function(event, validator) { //display error alert on form submit
|
||||
$('.alert-danger', $('.form')).show();
|
||||
},
|
||||
|
||||
highlight: function(element) { // hightlight error inputs
|
||||
$(element)
|
||||
.closest('.form-group').addClass('has-error'); // set error class to the control group
|
||||
},
|
||||
|
||||
success: function(label) {
|
||||
label.closest('.form-group').removeClass('has-error');
|
||||
label.remove();
|
||||
},
|
||||
|
||||
errorPlacement: function(error, element) {
|
||||
error.insertAfter(element.closest('input'));
|
||||
},
|
||||
|
||||
submitHandler: function(form) {
|
||||
form.submit(); // form validation success, call ajax form submit
|
||||
}
|
||||
});
|
||||
|
||||
$('.form input').keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
if ($('.form').validate().form()) {
|
||||
$('#form').submit(); //form validation success, call ajax form submit
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
//main function to initiate the module
|
||||
init: function() {
|
||||
|
||||
handleCategoryAdd();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}();
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
CategoryAdd.init();
|
||||
});
|
||||
|
||||
function addCategory(){
|
||||
|
||||
$.ajax( {
|
||||
url:'/admin/tags/createcategory',
|
||||
data:$('#form').serialize(),
|
||||
type:'POST',
|
||||
processData:true,
|
||||
contentType:"application/x-www-form-urlencoded",
|
||||
success:function(data) {
|
||||
alert(data.status);
|
||||
if(data.status=="success"){
|
||||
window.location.reload(true);
|
||||
}else if(data.status=="fail"){
|
||||
alert(data.data.errMessage);
|
||||
}
|
||||
},
|
||||
error : function(e) {
|
||||
// view("异常!");
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
}
|
182
frontend/static/admin/pages/scripts/tagList.js
Normal file
182
frontend/static/admin/pages/scripts/tagList.js
Normal file
@@ -0,0 +1,182 @@
|
||||
var url = "/admin/tags/indexjson";
|
||||
|
||||
function refreshList(a){
|
||||
if(a!=0){
|
||||
var urlTmp = url + "?categoryId=" + a;
|
||||
}else var urlTmp = url;
|
||||
|
||||
$('#dataTables-tag').DataTable({
|
||||
"bPaginate": true,
|
||||
"bLengthChange": false,
|
||||
"bSort": false,
|
||||
"bFilter": true,
|
||||
"bAutoWidth": true,
|
||||
"bStateSave": true,
|
||||
"bServerSide": false,
|
||||
"bProcessing":true,
|
||||
"iDisplayLength": 20,
|
||||
"searching": true,
|
||||
"deferRender": true,
|
||||
"bDestroy":true,
|
||||
ajax:{
|
||||
"url" : urlTmp,
|
||||
"dataSrc" : "data"
|
||||
},
|
||||
columns : [
|
||||
{"data" : "id"},
|
||||
{"data" : "name"} ,
|
||||
{"data" : "useCount"},
|
||||
{"data" : "categoryVO.name"}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
//屏蔽警告
|
||||
sDefaultContent : '',
|
||||
aTargets : [ '_all' ]
|
||||
}
|
||||
],
|
||||
language: {
|
||||
"sProcessing": "处理中...",
|
||||
"sLengthMenu": "显示 _MENU_ 项结果",
|
||||
"sZeroRecords": "没有匹配结果",
|
||||
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
|
||||
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
|
||||
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
|
||||
"sInfoPostFix": "",
|
||||
"sSearch": "搜索:",
|
||||
"sUrl": "",
|
||||
"sEmptyTable": "表中数据为空",
|
||||
"sLoadingRecords": "载入中...",
|
||||
"sInfoThousands": ",",
|
||||
"oPaginate": {
|
||||
"sFirst": "首页",
|
||||
"sPrevious": "上页",
|
||||
"sNext": "下页",
|
||||
"sLast": "末页"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": 以升序排列此列",
|
||||
"sSortDescending": ": 以降序排列此列"
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function loadCategories(){
|
||||
$.ajax( {
|
||||
url:'/admin/tags/indexcategoryjson',
|
||||
type:'GET',
|
||||
success:function(data) {
|
||||
if(data.status=="success"){
|
||||
for(var i=0;i<data.data.length;i++){
|
||||
var h = "<option value='"+data.data[i].id+"'>"+data.data[i].name+"</option>";
|
||||
$('#category-container').append(h);
|
||||
$('#category-container2').append(h);
|
||||
}
|
||||
$('select').select2();
|
||||
refreshList(data.data[0].id);
|
||||
|
||||
}else if(data.status=="fail"){
|
||||
alert(data.data.errMessage);
|
||||
}
|
||||
},
|
||||
error : function(e) {
|
||||
// view("异常!");
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var TagAdd = function() {
|
||||
|
||||
var handleTagAdd = function() {
|
||||
|
||||
$('#form').validate({
|
||||
errorElement: 'span', //default input error message container
|
||||
errorClass: 'help-block', // default input error message class
|
||||
focusInvalid: false, // do not focus the last invalid input
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
messages: {
|
||||
name: {
|
||||
required: "请输入名称"
|
||||
}
|
||||
},
|
||||
|
||||
invalidHandler: function(event, validator) { //display error alert on form submit
|
||||
$('.alert-danger', $('.form')).show();
|
||||
},
|
||||
|
||||
highlight: function(element) { // hightlight error inputs
|
||||
$(element)
|
||||
.closest('.form-group').addClass('has-error'); // set error class to the control group
|
||||
},
|
||||
|
||||
success: function(label) {
|
||||
label.closest('.form-group').removeClass('has-error');
|
||||
label.remove();
|
||||
},
|
||||
|
||||
errorPlacement: function(error, element) {
|
||||
error.insertAfter(element.closest('input'));
|
||||
},
|
||||
|
||||
submitHandler: function(form) {
|
||||
form.submit(); // form validation success, call ajax form submit
|
||||
}
|
||||
});
|
||||
|
||||
$('.form input').keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
if ($('.form').validate().form()) {
|
||||
$('#form').submit(); //form validation success, call ajax form submit
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
//main function to initiate the module
|
||||
init: function() {
|
||||
|
||||
handleTagAdd();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}();
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
TagAdd.init();
|
||||
});
|
||||
|
||||
function addTag(){
|
||||
|
||||
$.ajax( {
|
||||
url:'/admin/tags/create',
|
||||
data:$('#form').serialize(),
|
||||
type:'POST',
|
||||
processData:true,
|
||||
contentType:"application/x-www-form-urlencoded",
|
||||
success:function(data) {
|
||||
alert(data.status);
|
||||
if(data.status=="success"){
|
||||
window.location.reload(true);
|
||||
}else if(data.status=="fail"){
|
||||
alert(data.data.errMessage);
|
||||
}
|
||||
},
|
||||
error : function(e) {
|
||||
// view("异常!");
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user