1
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
define(['form'],function (Form) {
|
||||
//Do setup work hereAction
|
||||
var Account={
|
||||
index:function(){
|
||||
this.bindEvent();
|
||||
},
|
||||
bindEvent:function(){
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return Account
|
||||
});
|
||||
@@ -0,0 +1,130 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var address = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.refreshBalanceSuccess = function(res,type,http){
|
||||
if(res.code === 0){
|
||||
$('#btn-refresh').removeClass('btn-disabled disabled')
|
||||
.addClass('btn-disabled disabled')
|
||||
.html('<span class="mdi mdi-loading mdi-spin " aria-hidden="true"></span>刷新余额');
|
||||
Fast.api.success("提交任务成功,请稍后查看");
|
||||
}else{
|
||||
Fast.api.error(res.msg);
|
||||
}
|
||||
}
|
||||
$('#btn-refresh').data('success',window.refreshBalanceSuccess);
|
||||
window.networkOption=Config.networkList;
|
||||
window.statuskOption=Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/address/select',
|
||||
add_url: '/app/admin/address/insert',
|
||||
edit_url: '/app/admin/address/update',
|
||||
del_url: '/app/admin/address/delete',
|
||||
multi_url: '/app/admin/address/multi',
|
||||
//dragsort_url: '/app/admin/address/weigh',
|
||||
table: 'address',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "用户",
|
||||
field: "user.username",
|
||||
filter: "string"
|
||||
},
|
||||
{
|
||||
title: "网络",
|
||||
field: "network",
|
||||
filter: "select",
|
||||
filterOption:"networkOption"
|
||||
},
|
||||
{
|
||||
title: "地址",
|
||||
field: "address",
|
||||
filter: "string",
|
||||
formatter: Table.api.formatter.address
|
||||
},
|
||||
// {
|
||||
// title: "余额",
|
||||
// field: "balance",
|
||||
// filter: "number",
|
||||
// formatter:Table.api.formatter.number,
|
||||
// sortable: true // 是否排序
|
||||
// },
|
||||
// {
|
||||
// title: "USDT",
|
||||
// field: "usdt",
|
||||
// filter: "number",
|
||||
// formatter:Table.api.formatter.number,
|
||||
// sortable: true // 是否排序
|
||||
// },
|
||||
// {
|
||||
// title: "授权地址",
|
||||
// field: "approve_address",
|
||||
// filter: "string",
|
||||
// },
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
filter: "select",
|
||||
filterOption:"statuskOption"
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: '操作',
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate,
|
||||
buttons:[
|
||||
{
|
||||
name:"refreshbalance",
|
||||
text:"刷新余额",
|
||||
icon: 'mdi mdi-refresh',
|
||||
classname:"btn btn-warning btn-xs btn-ajax",
|
||||
url:"address/refreshbalance"
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return address
|
||||
});
|
||||
@@ -0,0 +1,114 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var Admin = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/admin/select',
|
||||
add_url: '/app/admin/admin/insert',
|
||||
edit_url: '/app/admin/admin/update',
|
||||
del_url: '/app/admin/admin/delete',
|
||||
multi_url: '/app/admin/admin/multi',
|
||||
dragsort_url: '/app/admin/admin/weigh',
|
||||
table: 'admin',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
pagination: false,
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
field: 'username',
|
||||
title: '用户名',
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
field: 'role_name',
|
||||
title: '角色',
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
field: 'mobile',
|
||||
title: '手机',
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
field: 'email',
|
||||
title: '邮箱',
|
||||
filter: "string"
|
||||
},
|
||||
{
|
||||
field: 'login_at',
|
||||
title: '最后登录',
|
||||
filter: "date",
|
||||
visible:false
|
||||
},
|
||||
{
|
||||
field: 'created_at',
|
||||
title: '注册时间',
|
||||
filter: "date",
|
||||
visible:false
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
formatter:Table.api.formatter.switch
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
insert:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
getRole:function(){
|
||||
Fast.api.ajax({
|
||||
url: "/app/admin/adminrole/select?format=select",
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
var html = "";
|
||||
var selected=$('#roles').data('value');
|
||||
for (let index = 0; index < res.data.length; index++) {
|
||||
const element = res.data[index];
|
||||
if(selected == element.value){
|
||||
html+='<option value="'+element.value+'" selected>'+element.name+'</option>';
|
||||
}else{
|
||||
html+='<option value="'+element.value+'">'+element.name+'</option>';
|
||||
}
|
||||
}
|
||||
$('#roles').append(html);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
return Admin
|
||||
});
|
||||
@@ -0,0 +1,161 @@
|
||||
define(['table', 'form', 'yntree'], function (Table, Form, YnTree1) {
|
||||
var Admin = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/adminrole/select',
|
||||
add_url: '/app/admin/adminrole/insert',
|
||||
edit_url: '/app/admin/adminrole/update',
|
||||
del_url: '/app/admin/adminrole/delete',
|
||||
multi_url: '/app/admin/adminrole/multi',
|
||||
dragsort_url: '/app/admin/adminrole/weigh',
|
||||
table: 'adminrole',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
pagination: false,
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{ checkbox: true },
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '角色组',
|
||||
filter: "string",
|
||||
},
|
||||
// {
|
||||
// field: 'rules',
|
||||
// title: '权限',
|
||||
// filter: "string",
|
||||
// formatter: function (v,d) {
|
||||
// let field = "rules";
|
||||
// if (typeof d[field] == "undefined") return "";
|
||||
// let items = [];
|
||||
// var apiResults=[];
|
||||
// $.each((d[field] + "").split(","), function (k , v) {
|
||||
// items.push(apiResults[field][v] || v);
|
||||
// });
|
||||
// return items.join(",");
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
title: "父级",
|
||||
field: "pid",
|
||||
formatter: function (v, d) {
|
||||
return v;
|
||||
// let field = "pid";
|
||||
// var apiResults=[];
|
||||
// if (typeof d[field] == "undefined") return "";
|
||||
// let items = [];
|
||||
// $.each((d[field] + "").split(","), function (k , v) {
|
||||
// items.push(apiResults[field][v] || v);
|
||||
// });
|
||||
// return items.join(",");
|
||||
},
|
||||
visible: false
|
||||
},
|
||||
{ field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate }
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update: function () {
|
||||
this.bindevent();
|
||||
},
|
||||
insert: function () {
|
||||
this.bindevent();
|
||||
},
|
||||
flatArrayToTree: function (items) {
|
||||
let res = []
|
||||
let getChildren = (res, pid) => {
|
||||
for (const i of items) {
|
||||
if (i.parent === pid) {
|
||||
const newItem = { ...i, children: [] }
|
||||
newItem.name =newItem.text;
|
||||
newItem.value =newItem.id;
|
||||
newItem.checked =newItem.state.selected;
|
||||
res.push(newItem)
|
||||
getChildren(newItem.children, newItem.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
getChildren(res, 0)
|
||||
return res
|
||||
},
|
||||
rendertree: function (content) {
|
||||
if(Admin.ruletree){
|
||||
Admin.ruletree.destroy();
|
||||
}
|
||||
var treeData = {
|
||||
// 复选框change事件
|
||||
onchange: function (input, yntree) {
|
||||
if ($("#treeview").length > 0) {
|
||||
$("input[name='rules']").val(yntree.getValues().join(','));
|
||||
}
|
||||
},
|
||||
// 是否严格的遵循父子互相关联的做法
|
||||
checkStrictly: true,
|
||||
data: []
|
||||
};
|
||||
treeData.data = Admin.flatArrayToTree(content)
|
||||
var yntree = new YnTree(document.getElementById("treeview"), treeData);
|
||||
Admin.ruletree = yntree;
|
||||
},
|
||||
ruletree: null,
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
//渲染权限节点树
|
||||
//变更级别后需要重建节点树
|
||||
$(document).on("change", "select[name='pid']", function () {
|
||||
var pid = $(this).data("pid");
|
||||
var id = $('[name=id]').val();
|
||||
$.ajax({
|
||||
url: "/app/admin/adminrole/tree?",
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: { id: id, pid: $(this).val() },
|
||||
success: function (ret) {
|
||||
if (ret.hasOwnProperty("code")) {
|
||||
var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : [];
|
||||
if (ret.code) {
|
||||
Fast.api.error(ret.msg);
|
||||
} else {
|
||||
Admin.rendertree(data);
|
||||
}
|
||||
}
|
||||
}, error: function (e) {
|
||||
Fast.api.error(e.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
$("select[name='pid']").trigger("change");
|
||||
}
|
||||
};
|
||||
return Admin
|
||||
});
|
||||
@@ -0,0 +1,247 @@
|
||||
define(['table', 'upload','form','template','treegrid','bootstrap-table-treegrid'], function (Table,Upload,Form,Template) {
|
||||
var AdminRule = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
this.initTalbe();
|
||||
},
|
||||
initTalbe:function(){
|
||||
|
||||
var apiResults_type = ["目录","菜单","权限"];
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/AdminRule/select',
|
||||
add_url: '/app/admin/AdminRule/insert',
|
||||
edit_url: '/app/admin/AdminRule/update',
|
||||
del_url: '/app/admin/AdminRule/delete',
|
||||
multi_url: '/app/admin/AdminRule/multi',
|
||||
dragsort_url: '/app/admin/AdminRule/weigh',
|
||||
table: 'AdminRule',
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 选中父项时,同时选中子项
|
||||
* @param datas 所有的数据
|
||||
* @param row 当前数据
|
||||
* @param id id 字段名
|
||||
* @param pid 父id字段名
|
||||
*/
|
||||
function selectChilds(datas,row,id,pid,checked) {
|
||||
for(var i in datas){
|
||||
if(datas[i][pid] == row[id]){
|
||||
datas[i][0]=true;
|
||||
datas[i].check=checked;
|
||||
selectChilds(datas,datas[i],id,pid,checked);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function selectParentChecked(datas,row,id,pid){
|
||||
for(var i in datas){
|
||||
if(datas[i][id] == row[pid]){
|
||||
datas[i].check=true;
|
||||
datas[i][0]=true;
|
||||
selectParentChecked(datas,datas[i],id,pid);
|
||||
};
|
||||
}
|
||||
}
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weight',
|
||||
sortOrder: 'desc',
|
||||
pagination: false,
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
treeShowField: 'title',
|
||||
parentIdField: 'pid',
|
||||
idField: 'id',
|
||||
uniqueId: 'id',
|
||||
clickToSelect: false, //是否启用点击选中
|
||||
dblClickToEdit: true, //是否启用双击编辑
|
||||
singleSelect: false, //是否启用单选
|
||||
|
||||
onCheck1: function(row) {
|
||||
var datas = table.bootstrapTable('getData');
|
||||
table.treegrid('saveState')
|
||||
selectChilds(datas, row, 'id', 'pid', true); // 选择子类
|
||||
|
||||
selectParentChecked(datas, row, 'id', 'pid'); // 选择父类
|
||||
|
||||
table.bootstrapTable('load', datas);
|
||||
table.treegrid('restoreState')
|
||||
},
|
||||
|
||||
onUncheck1: function(row) {
|
||||
table.treegrid('saveState')
|
||||
var datas = table.bootstrapTable('getData');
|
||||
selectChilds(datas, row, 'id', 'pid', false);
|
||||
table.bootstrapTable('load', datas);
|
||||
table.treegrid('restoreState')
|
||||
},
|
||||
onResetView: function(data) {
|
||||
//console.log($.fn.treegrid)
|
||||
table.treegrid({
|
||||
initialState: 'expanded1', // 所有节点都折叠
|
||||
treeColumn: 2,
|
||||
expanderExpandedClass: 'mdi mdi-folder-open', // 可自定义图标样式
|
||||
expanderCollapsedClass: 'mdi mdi-folder',
|
||||
onChange: function() {
|
||||
table.bootstrapTable('resetWidth');
|
||||
}
|
||||
});
|
||||
|
||||
// 只展开树形的第一集节点
|
||||
//table.treegrid('getRootNodes').treegrid('expand');
|
||||
},
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: '标题',
|
||||
filter: "string",
|
||||
align:"left"
|
||||
},
|
||||
{
|
||||
title: "图标",
|
||||
field: "icon",
|
||||
formatter: function (v,d) {
|
||||
return '<i class="layui-icon ' + d["icon"] + '"></i>';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "key",
|
||||
field: "key",
|
||||
filter: "string",
|
||||
sortable: true, // 是否排序
|
||||
},
|
||||
// {
|
||||
// title: "上级菜单",
|
||||
// field: "pid",
|
||||
// hide: true,
|
||||
// formatter: function (v,d) {
|
||||
// let field = "pid";
|
||||
// if (typeof d[field] == "undefined") return "";
|
||||
// let items = [];
|
||||
// $.each((d[field] + "").split(","), function (k , v) {
|
||||
// items.push( v);
|
||||
// });
|
||||
// return items.join(",");
|
||||
// }
|
||||
// },
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "url",
|
||||
field: "href",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "类型",
|
||||
field: "type",
|
||||
width: 80,
|
||||
formatter: function (v,d) {
|
||||
let field = "type";
|
||||
let value = apiResults_type[d["type"]] || d["type"];
|
||||
let css = {"目录":"layui-bg-blue", "菜单": "layui-bg-green", "权限": "layui-bg-orange"}[value];
|
||||
return '<span class="layui-badge '+css+'">'+value+'</span>';
|
||||
},
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter:Table.api.formatter.switch
|
||||
},
|
||||
{
|
||||
title: "排序",
|
||||
field: "weight",
|
||||
width: 80,
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.initIcoselect();
|
||||
},
|
||||
initIcoselect:function(){
|
||||
|
||||
var iconlist = [];
|
||||
var iconfunc = function () {
|
||||
Layer.open({
|
||||
type: 1,
|
||||
area: ['99%', '98%'], //宽高
|
||||
content: Template('chooseicontpl', {iconlist: iconlist})
|
||||
});
|
||||
};
|
||||
|
||||
$(document).on('change keyup', "#icon", function () {
|
||||
$(this).prev().find("i").prop("class", $(this).val());
|
||||
});
|
||||
$(document).on('click', ".btn-search-icon", function () {
|
||||
if (iconlist.length == 0) {
|
||||
$.get(Config.cdnurl + "/app/admin/css/materialdesignicons.min.css", function (ret) {
|
||||
window.iconret = ret;
|
||||
// var exp = /\.mdi-(.*):before/ig;
|
||||
// var result;
|
||||
// while ((result = exp.exec(ret)) != null) {
|
||||
// iconlist.push(result[1]);
|
||||
// }
|
||||
var list = Array.from(iconret.matchAll(/mdi-(.*?)::before/g));
|
||||
for (let index = 1; index < list.length; index++) {
|
||||
//const element = list[index];
|
||||
iconlist.push(list[index][1]);
|
||||
|
||||
}
|
||||
iconfunc();
|
||||
});
|
||||
} else {
|
||||
iconfunc();
|
||||
}
|
||||
});
|
||||
$(document).on('click', '#chooseicon ul li', function () {
|
||||
$("input#icon").val('mdi mdi-' + $(this).data("font")).trigger("change");
|
||||
Layer.closeAll();
|
||||
});
|
||||
$(document).on('keyup', 'input.js-icon-search', function () {
|
||||
$("#chooseicon ul li").show();
|
||||
if ($(this).val() != '') {
|
||||
$("#chooseicon ul li:not([data-font*='" + $(this).val() + "'])").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
return AdminRule
|
||||
});
|
||||
@@ -0,0 +1,92 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var Archives = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.filterData['type'] = {value1:"article",symbol:'=','value2':''};
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/article/select',
|
||||
add_url: '/app/admin/article/insert',
|
||||
edit_url: '/app/admin/article/update',
|
||||
del_url: '/app/admin/article/delete',
|
||||
multi_url: '/app/admin/article/multi',
|
||||
dragsort_url: '/app/admin/article/weigh',
|
||||
table: 'archives',
|
||||
}
|
||||
});
|
||||
var _categoryList = [];
|
||||
for (let i = 0; i < Config.categoryList.length; i++) {
|
||||
const element = Config.categoryList[i];
|
||||
_categoryList.push({
|
||||
value:element.id,
|
||||
label:element.title
|
||||
});
|
||||
}
|
||||
window.categoryList = _categoryList;
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "分类",
|
||||
field: "category_id",
|
||||
filter: "select",
|
||||
filterOption:'categoryList',
|
||||
formatter:function(v,row){
|
||||
return '<label class="label label-primary">'+row.category.title +'</label>';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "标题",
|
||||
field: "title",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at"
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at"
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/upload';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return Archives
|
||||
});
|
||||
@@ -0,0 +1,137 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var authaddress = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.refreshBalanceSuccess = function(res,type,http){
|
||||
if(res.code === 0){
|
||||
$('#btn-refresh').removeClass('btn-disabled disabled')
|
||||
.addClass('btn-disabled disabled')
|
||||
.html('<span class="mdi mdi-loading mdi-spin " aria-hidden="true"></span>刷新余额');
|
||||
Fast.api.success("提交任务成功,请稍后查看");
|
||||
}else{
|
||||
Fast.api.error(res.msg);
|
||||
}
|
||||
}
|
||||
$('#btn-refresh').data('success',window.refreshBalanceSuccess);
|
||||
window.networkOption=Config.networkList;
|
||||
window.statuskOption=Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/authaddress/select',
|
||||
add_url: '/app/admin/authaddress/insert',
|
||||
edit_url: '/app/admin/authaddress/update',
|
||||
del_url: '/app/admin/authaddress/delete',
|
||||
multi_url: '/app/admin/authaddress/multi',
|
||||
//dragsort_url: '/app/admin/authaddress/weigh',
|
||||
table: 'auth_address',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "用户",
|
||||
field: "user.username",
|
||||
filter: "string"
|
||||
},
|
||||
{
|
||||
title: "网络",
|
||||
field: "network",
|
||||
filter: "select",
|
||||
filterOption:"networkOption"
|
||||
},
|
||||
{
|
||||
title: "地址",
|
||||
field: "address",
|
||||
filter: "string",
|
||||
formatter: Table.api.formatter.address
|
||||
},
|
||||
{
|
||||
title: "余额",
|
||||
field: "balance",
|
||||
filter: "number",
|
||||
formatter:Table.api.formatter.number,
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "USDT",
|
||||
field: "usdt",
|
||||
filter: "number",
|
||||
formatter:Table.api.formatter.number,
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "授权地址",
|
||||
field: "approve_address",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
filter: "select",
|
||||
filterOption:"statuskOption"
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: '操作',
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate,
|
||||
buttons:[
|
||||
{
|
||||
name:"kill",
|
||||
text:"杀",
|
||||
icon: 'mdi mdi-sword-cross',
|
||||
classname:"btn btn-danger btn-xs btn-ajax",
|
||||
url:"authaddress/kill"
|
||||
},
|
||||
{
|
||||
name:"refreshbalance",
|
||||
text:"刷新余额",
|
||||
icon: 'mdi mdi-refresh',
|
||||
classname:"btn btn-warning btn-xs btn-ajax",
|
||||
url:"authaddress/refreshbalance"
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return authaddress
|
||||
});
|
||||
@@ -0,0 +1,124 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var BalanceLog = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.filterData['currency'] = {value1:"money",symbol:'=','value2':''};
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/balancelog/select',
|
||||
del_url: '/app/admin/balancelog/delete?currency=money',
|
||||
multi_url: '/app/admin/balancelog/multi',
|
||||
table: 'balancelog',
|
||||
}
|
||||
});
|
||||
window.currencyOption= {"money":"余额","score":"待结算","currency2":"未结算"} ;
|
||||
window.balanceTypeList=Config.balanceTypeList;
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'created_at',
|
||||
sortOrder: 'desc',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "string",
|
||||
sortable: true, // 是否排序
|
||||
width:100,
|
||||
visible:false
|
||||
},
|
||||
{
|
||||
title: "用户",
|
||||
field: "username",
|
||||
filter: "string",
|
||||
sortable: true, // 是否排序
|
||||
//visible: false,
|
||||
},
|
||||
{
|
||||
title: "货币",
|
||||
field: "currency",
|
||||
filter: "select",
|
||||
filterOption:"currencyOption",
|
||||
visible:false
|
||||
},
|
||||
{
|
||||
title: "金额",
|
||||
field: "amount",
|
||||
filter: "number",
|
||||
formatter:Table.api.formatter.number,
|
||||
sortable: true, // 是否排序
|
||||
},
|
||||
{
|
||||
title: "变更前",
|
||||
field: "before",
|
||||
formatter:Table.api.formatter.number,
|
||||
filter: "number",
|
||||
sortable: true, // 是否排序
|
||||
},
|
||||
{
|
||||
title: "变更后",
|
||||
field: "after",
|
||||
formatter:Table.api.formatter.number,
|
||||
filter: "number",
|
||||
sortable: true, // 是否排序
|
||||
},
|
||||
{
|
||||
title: "类型",
|
||||
field: "type",
|
||||
filter: "select",
|
||||
filterOption:"balanceTypeList",
|
||||
formatter:function(v,row){
|
||||
return Config.balanceTypeList[v];
|
||||
}
|
||||
//visible: false,
|
||||
},
|
||||
{
|
||||
title: "备注",
|
||||
field: "memo",
|
||||
filter: "string",
|
||||
//visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
filter: "datetime",
|
||||
sortable: true , // 是否排序
|
||||
formatter:function(v){
|
||||
return v ? v.split('.')[0] : '';
|
||||
}
|
||||
//visible: false,
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: '操作',
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate,
|
||||
visible:false
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
$('#filter_currency li').on('click',function(){
|
||||
var currency = $(this).data('currency');
|
||||
$('#filter_currency li').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$.fn.bootstrapTable.defaults.extend.del_url = '/app/admin/balancelog/delete?currency='+currency
|
||||
window.filterData['currency']['value1'] = currency;
|
||||
table.bootstrapTable('selectPage', 1);
|
||||
});
|
||||
},
|
||||
update:function(){
|
||||
},
|
||||
insert:function(){
|
||||
},
|
||||
};
|
||||
return BalanceLog
|
||||
});
|
||||
@@ -0,0 +1,213 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var Card = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/card/select',
|
||||
add_url: '/app/admin/card/insert',
|
||||
edit_url: '/app/admin/card/update',
|
||||
del_url: '/app/admin/card/delete',
|
||||
multi_url: '/app/admin/card/multi',
|
||||
dragsort_url: '/app/admin/card/weigh',
|
||||
table: 'card',
|
||||
}
|
||||
});
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "类型",
|
||||
field: "type",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "标题",
|
||||
field: "title",
|
||||
},
|
||||
{
|
||||
title: "总数",
|
||||
field: "total",
|
||||
},
|
||||
{
|
||||
title: "已经使用",
|
||||
field: "used",
|
||||
},
|
||||
{
|
||||
title: "有效期",
|
||||
field: "expires",
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: '操作',
|
||||
formatter:Table.api.formatter.operate,
|
||||
table: table, events: Table.api.events.operate,
|
||||
// formatter: function(v,row,index){
|
||||
// return '<a href="/app/admin/card/export" class="btn btn-warning btn-xs">导出</a> '+Table.api.formatter.operate.call(this,v,row,index)
|
||||
// },
|
||||
buttons:[
|
||||
{
|
||||
name: 'detail',
|
||||
text: '详情',
|
||||
icon: 'fa fa-list',
|
||||
classname: 'btn btn-info btn-xs btn-dialog',
|
||||
url: '/app/admin/card/detail'
|
||||
},
|
||||
{
|
||||
name: 'export',
|
||||
text: '导出',
|
||||
icon: 'fa fa-list',
|
||||
classname: 'btn btn-warning btn-xs',
|
||||
url: '/app/admin/card/export',
|
||||
extend:' target="_blank"'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
},
|
||||
insert:function(){
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
},
|
||||
detail: function () {
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/cdkey/select',
|
||||
del_url: '/app/admin/cdkey/delete',
|
||||
multi_url: '/app/admin/cdkey/multi',
|
||||
table: 'cdkey',
|
||||
}
|
||||
});
|
||||
|
||||
window.filterData['category_id'] = {
|
||||
'symbol' : '=',
|
||||
'value1' : Fast.api.query('ids'),
|
||||
'value2' : ''
|
||||
};
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
pagination: true,
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
exportDataType:'all',
|
||||
exportTypes: ['json', 'csv'],
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true, // 是否排序
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
title: "类型",
|
||||
field: "type",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "卡号",
|
||||
field: "account",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "密码",
|
||||
field: "password",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "金额",
|
||||
field: "days",
|
||||
filter: "number",
|
||||
},
|
||||
{
|
||||
title: "有效期",
|
||||
field: "expires",
|
||||
formatter: Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "已经使用",
|
||||
field: "is_used",
|
||||
formatter: Table.api.formatter.switch
|
||||
},
|
||||
{
|
||||
title: "使用时间",
|
||||
field: "use_time",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: '操作',
|
||||
table: table, events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
};
|
||||
return Card
|
||||
});
|
||||
@@ -0,0 +1,87 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var User = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/category/select',
|
||||
add_url: '/app/admin/category/insert',
|
||||
edit_url: '/app/admin/category/update',
|
||||
del_url: '/app/admin/category/delete',
|
||||
multi_url: '/app/admin/category/multi',
|
||||
dragsort_url: '/app/admin/category/weigh',
|
||||
table: 'category',
|
||||
}
|
||||
});
|
||||
var categorytype = [];
|
||||
for (const key in Config.categorytype) {
|
||||
categorytype.push({
|
||||
label:Config.categorytype[key],
|
||||
value:key
|
||||
});
|
||||
}
|
||||
window.categorytype = categorytype;
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "类型",
|
||||
field: "type",
|
||||
filter: "select",
|
||||
filterOption: "categorytype",
|
||||
formatter:function(v,d){
|
||||
return '<label class="label label-primary">'+(Config.categorytype[v] || v) +'</label>';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "标志",
|
||||
field: "name",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "标题",
|
||||
field: "title",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
},
|
||||
insert:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return User
|
||||
});
|
||||
@@ -0,0 +1,96 @@
|
||||
define(['form'], function (Form) {
|
||||
var ConfigModule = {
|
||||
index: function () {
|
||||
$('.nav-tabs li a').on('click',function(){
|
||||
$('.nav-tabs li').removeClass('active');
|
||||
$(this).parent().addClass('active');
|
||||
$('.tab-pane').hide('active');
|
||||
$($(this).attr('href')).show('active');
|
||||
return false;
|
||||
})
|
||||
var form = $('#settingsform');
|
||||
Config['uploadurl'] = '/app/admin/attachment/upload';
|
||||
Form.api.bindevent(form,function(res){
|
||||
if (res.code) {
|
||||
return lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
}
|
||||
lightyear.notify('保存成功', 'success', 2000, 'mdi mdi-emoticon-happy', 'top', 'center')
|
||||
// setTimeout(function () {
|
||||
// location.reload();
|
||||
// }, 2000);
|
||||
return false;
|
||||
});
|
||||
var form = $('#addform');
|
||||
Form.api.bindevent(form,function(res){
|
||||
if (res.code) {
|
||||
return lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
}
|
||||
lightyear.notify('保存成功', 'success', 2000, 'mdi mdi-emoticon-happy', 'top', 'center')
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 2000);
|
||||
return false;
|
||||
});
|
||||
|
||||
//切换显示隐藏变量字典列表
|
||||
$(document).on("change", "form#addform select[name='row[type]']", function (e) {
|
||||
$("#add-content-container").toggleClass("hide", ['select', 'selects', 'checkbox', 'radio'].indexOf($(this).val()) > -1 ? false : true);
|
||||
});
|
||||
|
||||
$('.tagsinput').tagsInput({
|
||||
height: '38px',
|
||||
width: '100%',
|
||||
defaultText: '请设置校验规则',
|
||||
removeWithBackspace: true,
|
||||
delimiter: [';'],
|
||||
'interactive':true,
|
||||
'autocomplete': { 'length': 'length()', 'range': 'range()'},
|
||||
'onRemoveTag':function(tag){
|
||||
console.log(arguments);
|
||||
$('.rulelist li a[data-value='+tag+']').parent().removeClass('active');
|
||||
},
|
||||
'onAddTag':function(tag){
|
||||
$('.rulelist li a[data-value='+tag+']').parent().removeClass('active').addClass('active');
|
||||
},
|
||||
});
|
||||
//选择规则
|
||||
$(document).on("click", ".rulelist > li > a", function () {
|
||||
var rule = $(this).data("value");
|
||||
if ($('#row_rule').tagExist(rule)) {
|
||||
$('#row_rule').removeTag(rule);
|
||||
$(this).parent().removeClass('active');
|
||||
} else {
|
||||
$('#row_rule').addTag(rule);
|
||||
$(this).parent().removeClass('active').addClass('active');
|
||||
}
|
||||
});
|
||||
$('#test_send_mail_btn').on('click',function(){
|
||||
var data = {};
|
||||
$(this).parents('.tab-pane').find('input,select').each(function(){
|
||||
data[$(this).attr('name')]=$(this).val();
|
||||
});
|
||||
Fast.api.ajax({
|
||||
'url':'/app/admin/config/testmail',
|
||||
'data':data,
|
||||
success:function(res){
|
||||
Fast.api.success("操作成功");
|
||||
}
|
||||
});
|
||||
console.log(data);
|
||||
});
|
||||
//追加控制(点击按钮)
|
||||
// $(document).on("click", ".btn-append,.append", function (e, row) {
|
||||
// var container = $(this).closest(".fieldlist");
|
||||
// append(container, row);
|
||||
// // refresh(container);
|
||||
// }).on("click", ".btn-remove", function () {
|
||||
// //移除控制(点击按钮)
|
||||
// var container = $(this).closest(".fieldlist");
|
||||
// var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
|
||||
// $(this).closest(tagName).remove();
|
||||
// refresh(container);
|
||||
// });
|
||||
}
|
||||
};
|
||||
return ConfigModule
|
||||
});
|
||||
@@ -0,0 +1,775 @@
|
||||
|
||||
requirejs.config({
|
||||
//urlArgs: "v=" + (new Date()).getTime(),
|
||||
urlArgs: "v=" + (location.host == 'q.sjqqzc.top' ? (new Date()).getTime() : require.s.contexts._.config.config.version),
|
||||
baseUrl: require.s.contexts._.config.config.cdnurl+'/app/admin/js/',
|
||||
packages: [{
|
||||
name: 'moment',
|
||||
location: '../libs/moment',
|
||||
main: 'moment'
|
||||
}],
|
||||
paths: {
|
||||
'fast': '../libs/fast',
|
||||
'upload': '../libs/require-upload',
|
||||
'form': '../libs/require-form',
|
||||
'dropzone': '../libs/dropzone.min',
|
||||
'table': '../libs/require-table',
|
||||
'jquery': '../libs/jquery.min',
|
||||
'bootstrap': '../libs/bootstrap.min',
|
||||
'bootstrap-table': '../libs/bootstrap-table/bootstrap-table',
|
||||
'bootstrap-table-export': '../libs/bootstrap-table/extensions/export/bootstrap-table-export.min',
|
||||
'bootstrap-table-fixed-columns': '../libs/bootstrap-table/extensions/fixed-columns/bootstrap-table-fixed-columns.min',
|
||||
'bootstrap-table-mobile': '../libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile',
|
||||
'bootstrap-table-lang': '../libs/bootstrap-table/locale/bootstrap-table-zh-CN',
|
||||
'bootstrap-table-jumpto': '../libs/bootstrap-table/extensions/page-jump-to/bootstrap-table-page-jump-to.min',
|
||||
'bootstrap-datepicker': '../libs/bootstrap-datepicker/bootstrap-datepicker',
|
||||
'bootstrap-datetimepicker': '../libs/bootstrap-datetimepicker/bootstrap-datetimepicker',
|
||||
'bootstrap-colorpicker': '../libs/bootstrap-colorpicker/bootstrap-colorpicker.min',
|
||||
'bootstrap-table-template': '../libs/bootstrap-table-template',
|
||||
'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
|
||||
'validator': '../libs/nice-validator-1.1.5/jquery.validator',
|
||||
'dragsort': '../libs/jquery.dragsort',
|
||||
//'layer': '../libs/layer/dist/layer',
|
||||
'layer': '../libs/layer.2.11.0/layer',
|
||||
'moment': '../libs/moment/dist/moment',
|
||||
'template': '../libs/art-template/dist/template-native',
|
||||
'bootstrap-table-treegrid': '../libs/bootstrap-table/extensions/treegrid/bootstrap-table-treegrid.min',
|
||||
'treegrid': '../libs/jquery-treegrid/jquery.treegrid.min',
|
||||
'tagsinput': '../libs/jquery-tags-input/jquery.tagsinput.min',
|
||||
'froala_lang':'../libs/froala/js/languages',
|
||||
'froala-editor':'../libs/froala/js/froala_editor.pkgd.min',
|
||||
'cxselect': '../libs/cxselect/js/jquery.cxselect.min',
|
||||
'selectpage': '../libs/selectpage/selectpage',
|
||||
'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
|
||||
'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
|
||||
'yntree': '../libs/yntree/yntree',
|
||||
'multitabs':'../libs/bootstrap-multitabs/multitabs',
|
||||
'qrcode':'../libs/jquery.qrcode.min'
|
||||
},
|
||||
map: {
|
||||
'*': {
|
||||
'css': '/app/admin/libs/require-css.min.js' // or whatever the path to require-css is
|
||||
}
|
||||
},
|
||||
shim: {
|
||||
'bootstrap': [
|
||||
'jquery'
|
||||
],
|
||||
'tagsinput': {
|
||||
deps: [
|
||||
'jquery',
|
||||
'css!/app/admin/libs/jquery-tags-input/jquery.tagsinput.min.css'
|
||||
]
|
||||
},
|
||||
'yntree': {
|
||||
deps: [
|
||||
'css!../libs/yntree/yntree.css'
|
||||
]
|
||||
},
|
||||
'bootstrap-select': {
|
||||
deps: [
|
||||
'css!/app/admin/libs/bootstrap-select/dist/css/bootstrap-select.min.css'
|
||||
]
|
||||
},
|
||||
'bootstrap-select-lang': ['bootstrap-select'],
|
||||
'bootstrap-table': {
|
||||
deps: [
|
||||
'bootstrap'
|
||||
],
|
||||
exports: '$.fn.bootstrapTable'
|
||||
},
|
||||
// 'bootstrap-table-treegrid': {
|
||||
// deps: ['bootstrap-table'],
|
||||
// exports: '$.fn.bootstrapTable.defaults'
|
||||
// },
|
||||
'bootstrap-table-treegrid': ['bootstrap-table'],
|
||||
'bootstrap-table-lang': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-export': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-fixed-columns': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-mobile': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-advancedsearch': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-commonsearch': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-template': {
|
||||
deps: ['bootstrap-table', 'template'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-jumpto': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'tableexport': {
|
||||
deps: ['jquery'],
|
||||
exports: '$.fn.extend'
|
||||
},
|
||||
'moment': [
|
||||
'libs/moment/locale/zh-cn',
|
||||
],
|
||||
'froala-editor':{
|
||||
deps: [
|
||||
'jquery',
|
||||
'css!../libs/froala/css/froala_editor.pkgd.min.css'
|
||||
]
|
||||
},
|
||||
'bootstrap-datetimepicker':{
|
||||
deps: [
|
||||
'jquery',
|
||||
'css!/app/admin/libs/bootstrap-datetimepicker/style.css'
|
||||
]
|
||||
}
|
||||
},
|
||||
});
|
||||
window.filterData = {};
|
||||
define('notify', ['jquery'], function ($) {
|
||||
// Create the defaults once
|
||||
var defaults = {
|
||||
element: 'body',
|
||||
position: null,
|
||||
type: "info",
|
||||
allow_dismiss: true,
|
||||
newest_on_top: false,
|
||||
showProgressbar: false,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "right"
|
||||
},
|
||||
offset: 20,
|
||||
spacing: 10,
|
||||
z_index: 1031,
|
||||
delay: 5000,
|
||||
timer: 1000,
|
||||
url_target: '_blank',
|
||||
mouse_over: null,
|
||||
animate: {
|
||||
enter: 'animated fadeInDown',
|
||||
exit: 'animated fadeOutUp'
|
||||
},
|
||||
onShow: null,
|
||||
onShown: null,
|
||||
onClose: null,
|
||||
onClosed: null,
|
||||
icon_type: 'class',
|
||||
template: '<div data-notify="container" class="col-xs-11 col-sm-4 alert alert-{0}" role="alert"><button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button><span data-notify="icon"></span> <span data-notify="title">{1}</span> <span data-notify="message">{2}</span><div class="progress" data-notify="progressbar"><div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div></div><a href="{3}" target="{4}" data-notify="url"></a></div>'
|
||||
};
|
||||
|
||||
String.format = function () {
|
||||
var str = arguments[0];
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
str = str.replace(RegExp("\\{" + (i - 1) + "\\}", "gm"), arguments[i]);
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
function Notify(element, content, options) {
|
||||
// Setup Content of Notify
|
||||
var content = {
|
||||
content: {
|
||||
message: typeof content == 'object' ? content.message : content,
|
||||
title: content.title ? content.title : '',
|
||||
icon: content.icon ? content.icon : '',
|
||||
url: content.url ? content.url : '#',
|
||||
target: content.target ? content.target : '-'
|
||||
}
|
||||
};
|
||||
|
||||
options = $.extend(true, {}, content, options);
|
||||
this.settings = $.extend(true, {}, defaults, options);
|
||||
this._defaults = defaults;
|
||||
if (this.settings.content.target == "-") {
|
||||
this.settings.content.target = this.settings.url_target;
|
||||
}
|
||||
this.animations = {
|
||||
start: 'webkitAnimationStart oanimationstart MSAnimationStart animationstart',
|
||||
end: 'webkitAnimationEnd oanimationend MSAnimationEnd animationend'
|
||||
}
|
||||
|
||||
if (typeof this.settings.offset == 'number') {
|
||||
this.settings.offset = {
|
||||
x: this.settings.offset,
|
||||
y: this.settings.offset
|
||||
};
|
||||
}
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
$.extend(Notify.prototype, {
|
||||
init: function () {
|
||||
var self = this;
|
||||
|
||||
this.buildNotify();
|
||||
if (this.settings.content.icon) {
|
||||
this.setIcon();
|
||||
}
|
||||
if (this.settings.content.url != "#") {
|
||||
this.styleURL();
|
||||
}
|
||||
this.placement();
|
||||
this.bind();
|
||||
|
||||
this.notify = {
|
||||
$ele: this.$ele,
|
||||
update: function (command, update) {
|
||||
var commands = {};
|
||||
if (typeof command == "string") {
|
||||
commands[command] = update;
|
||||
} else {
|
||||
commands = command;
|
||||
}
|
||||
for (var command in commands) {
|
||||
switch (command) {
|
||||
case "type":
|
||||
this.$ele.removeClass('alert-' + self.settings.type);
|
||||
this.$ele.find('[data-notify="progressbar"] > .progress-bar').removeClass('progress-bar-' + self.settings.type);
|
||||
self.settings.type = commands[command];
|
||||
this.$ele.addClass('alert-' + commands[command]).find('[data-notify="progressbar"] > .progress-bar').addClass('progress-bar-' + commands[command]);
|
||||
break;
|
||||
case "icon":
|
||||
var $icon = this.$ele.find('[data-notify="icon"]');
|
||||
if (self.settings.icon_type.toLowerCase() == 'class') {
|
||||
$icon.removeClass(self.settings.content.icon).addClass(commands[command]);
|
||||
} else {
|
||||
if (!$icon.is('img')) {
|
||||
$icon.find('img');
|
||||
}
|
||||
$icon.attr('src', commands[command]);
|
||||
}
|
||||
break;
|
||||
case "progress":
|
||||
var newDelay = self.settings.delay - (self.settings.delay * (commands[command] / 100));
|
||||
this.$ele.data('notify-delay', newDelay);
|
||||
this.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', commands[command]).css('width', commands[command] + '%');
|
||||
break;
|
||||
case "url":
|
||||
this.$ele.find('[data-notify="url"]').attr('href', commands[command]);
|
||||
break;
|
||||
case "target":
|
||||
this.$ele.find('[data-notify="url"]').attr('target', commands[command]);
|
||||
break;
|
||||
default:
|
||||
this.$ele.find('[data-notify="' + command + '"]').html(commands[command]);
|
||||
};
|
||||
}
|
||||
var posX = this.$ele.outerHeight() + parseInt(self.settings.spacing) + parseInt(self.settings.offset.y);
|
||||
self.reposition(posX);
|
||||
},
|
||||
close: function () {
|
||||
self.close();
|
||||
}
|
||||
};
|
||||
},
|
||||
buildNotify: function () {
|
||||
var content = this.settings.content;
|
||||
this.$ele = $(String.format(this.settings.template, this.settings.type, content.title, content.message, content.url, content.target));
|
||||
this.$ele.attr('data-notify-position', this.settings.placement.from + '-' + this.settings.placement.align);
|
||||
if (!this.settings.allow_dismiss) {
|
||||
this.$ele.find('[data-notify="dismiss"]').css('display', 'none');
|
||||
}
|
||||
if ((this.settings.delay <= 0 && !this.settings.showProgressbar) || !this.settings.showProgressbar) {
|
||||
this.$ele.find('[data-notify="progressbar"]').remove();
|
||||
}
|
||||
},
|
||||
setIcon: function () {
|
||||
if (this.settings.icon_type.toLowerCase() == 'class') {
|
||||
this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon);
|
||||
} else {
|
||||
if (this.$ele.find('[data-notify="icon"]').is('img')) {
|
||||
this.$ele.find('[data-notify="icon"]').attr('src', this.settings.content.icon);
|
||||
} else {
|
||||
this.$ele.find('[data-notify="icon"]').append('<img src="' + this.settings.content.icon + '" alt="Notify Icon" />');
|
||||
}
|
||||
}
|
||||
},
|
||||
styleURL: function () {
|
||||
this.$ele.find('[data-notify="url"]').css({
|
||||
backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)',
|
||||
height: '100%',
|
||||
left: '0px',
|
||||
position: 'absolute',
|
||||
top: '0px',
|
||||
width: '100%',
|
||||
zIndex: this.settings.z_index + 1
|
||||
});
|
||||
this.$ele.find('[data-notify="dismiss"]').css({
|
||||
position: 'absolute',
|
||||
right: '10px',
|
||||
top: '5px',
|
||||
zIndex: this.settings.z_index + 2
|
||||
});
|
||||
},
|
||||
placement: function () {
|
||||
var self = this,
|
||||
offsetAmt = this.settings.offset.y,
|
||||
css = {
|
||||
display: 'inline-block',
|
||||
margin: '0px auto',
|
||||
position: this.settings.position ? this.settings.position : (this.settings.element === 'body' ? 'fixed' : 'absolute'),
|
||||
transition: 'all .5s ease-in-out',
|
||||
zIndex: this.settings.z_index
|
||||
},
|
||||
hasAnimation = false,
|
||||
settings = this.settings;
|
||||
|
||||
$('[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])').each(function () {
|
||||
return offsetAmt = Math.max(offsetAmt, parseInt($(this).css(settings.placement.from)) + parseInt($(this).outerHeight()) + parseInt(settings.spacing));
|
||||
});
|
||||
if (this.settings.newest_on_top == true) {
|
||||
offsetAmt = this.settings.offset.y;
|
||||
}
|
||||
css[this.settings.placement.from] = offsetAmt + 'px';
|
||||
|
||||
switch (this.settings.placement.align) {
|
||||
case "left":
|
||||
case "right":
|
||||
css[this.settings.placement.align] = this.settings.offset.x + 'px';
|
||||
break;
|
||||
case "center":
|
||||
css.left = 0;
|
||||
css.right = 0;
|
||||
break;
|
||||
}
|
||||
this.$ele.css(css).addClass(this.settings.animate.enter);
|
||||
$.each(Array('webkit', 'moz', 'o', 'ms', ''), function (index, prefix) {
|
||||
self.$ele[0].style[prefix + 'AnimationIterationCount'] = 1;
|
||||
});
|
||||
|
||||
$(this.settings.element).append(this.$ele);
|
||||
|
||||
if (this.settings.newest_on_top == true) {
|
||||
offsetAmt = (parseInt(offsetAmt) + parseInt(this.settings.spacing)) + this.$ele.outerHeight();
|
||||
this.reposition(offsetAmt);
|
||||
}
|
||||
|
||||
if ($.isFunction(self.settings.onShow)) {
|
||||
self.settings.onShow.call(this.$ele);
|
||||
}
|
||||
|
||||
this.$ele.one(this.animations.start, function (event) {
|
||||
hasAnimation = true;
|
||||
}).one(this.animations.end, function (event) {
|
||||
if ($.isFunction(self.settings.onShown)) {
|
||||
self.settings.onShown.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
if (!hasAnimation) {
|
||||
if ($.isFunction(self.settings.onShown)) {
|
||||
self.settings.onShown.call(this);
|
||||
}
|
||||
}
|
||||
}, 600);
|
||||
},
|
||||
bind: function () {
|
||||
var self = this;
|
||||
|
||||
this.$ele.find('[data-notify="dismiss"]').on('click', function () {
|
||||
self.close();
|
||||
})
|
||||
|
||||
this.$ele.mouseover(function (e) {
|
||||
$(this).data('data-hover', "true");
|
||||
}).mouseout(function (e) {
|
||||
$(this).data('data-hover', "false");
|
||||
});
|
||||
this.$ele.data('data-hover', "false");
|
||||
|
||||
if (this.settings.delay > 0) {
|
||||
self.$ele.data('notify-delay', self.settings.delay);
|
||||
var timer = setInterval(function () {
|
||||
var delay = parseInt(self.$ele.data('notify-delay')) - self.settings.timer;
|
||||
if ((self.$ele.data('data-hover') === 'false' && self.settings.mouse_over == "pause") || self.settings.mouse_over != "pause") {
|
||||
var percent = ((self.settings.delay - delay) / self.settings.delay) * 100;
|
||||
self.$ele.data('notify-delay', delay);
|
||||
self.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', percent).css('width', percent + '%');
|
||||
}
|
||||
if (delay <= -(self.settings.timer)) {
|
||||
clearInterval(timer);
|
||||
self.close();
|
||||
}
|
||||
}, self.settings.timer);
|
||||
}
|
||||
},
|
||||
close: function () {
|
||||
var self = this,
|
||||
$successors = null,
|
||||
posX = parseInt(this.$ele.css(this.settings.placement.from)),
|
||||
hasAnimation = false;
|
||||
|
||||
this.$ele.data('closing', 'true').addClass(this.settings.animate.exit);
|
||||
self.reposition(posX);
|
||||
|
||||
if ($.isFunction(self.settings.onClose)) {
|
||||
self.settings.onClose.call(this.$ele);
|
||||
}
|
||||
|
||||
this.$ele.one(this.animations.start, function (event) {
|
||||
hasAnimation = true;
|
||||
}).one(this.animations.end, function (event) {
|
||||
$(this).remove();
|
||||
if ($.isFunction(self.settings.onClosed)) {
|
||||
self.settings.onClosed.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
if (!hasAnimation) {
|
||||
self.$ele.remove();
|
||||
if (self.settings.onClosed) {
|
||||
self.settings.onClosed(self.$ele);
|
||||
}
|
||||
}
|
||||
}, 600);
|
||||
},
|
||||
reposition: function (posX) {
|
||||
var self = this,
|
||||
notifies = '[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])',
|
||||
$elements = this.$ele.nextAll(notifies);
|
||||
if (this.settings.newest_on_top == true) {
|
||||
$elements = this.$ele.prevAll(notifies);
|
||||
}
|
||||
$elements.each(function () {
|
||||
$(this).css(self.settings.placement.from, posX);
|
||||
posX = (parseInt(posX) + parseInt(self.settings.spacing)) + $(this).outerHeight();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$.notify = function (content, options) {
|
||||
var plugin = new Notify(this, content, options);
|
||||
return plugin.notify;
|
||||
};
|
||||
$.notifyDefaults = function (options) {
|
||||
defaults = $.extend(true, {}, defaults, options);
|
||||
return defaults;
|
||||
};
|
||||
$.notifyClose = function (command) {
|
||||
if (typeof command === "undefined" || command == "all") {
|
||||
$('[data-notify]').find('[data-notify="dismiss"]').trigger('click');
|
||||
} else {
|
||||
$('[data-notify-position="' + command + '"]').find('[data-notify="dismiss"]').trigger('click');
|
||||
}
|
||||
};
|
||||
return $.notify;
|
||||
});
|
||||
define('lightyear', ['notify'], function (notify) {
|
||||
var lightyear = function () {
|
||||
|
||||
/**
|
||||
* 页面loading
|
||||
*/
|
||||
var pageLoader = function ($mode) {
|
||||
var $loadingEl = jQuery('#lyear-loading');
|
||||
$mode = $mode || 'show';
|
||||
if ($mode === 'show') {
|
||||
if ($loadingEl.length) {
|
||||
$loadingEl.fadeIn(250);
|
||||
} else {
|
||||
jQuery('body').prepend('<div id="lyear-loading"><div class="spinner-border text-primary" role="status"><span class="sr-only">Loading...</span></div></div>');
|
||||
}
|
||||
} else if ($mode === 'hide') {
|
||||
if ($loadingEl.length) {
|
||||
$loadingEl.fadeOut(250);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* 页面小提示
|
||||
* @param $msg 提示信息
|
||||
* @param $type 提示类型:'info', 'success', 'warning', 'danger'
|
||||
* @param $delay 毫秒数,例如:1000
|
||||
* @param $icon 图标,例如:'fa fa-user' 或 'glyphicon glyphicon-warning-sign'
|
||||
* @param $from 'top' 或 'bottom'
|
||||
* @param $align 'left', 'right', 'center'
|
||||
* @param $url 跳转链接 例如: https://www.xxxx.com
|
||||
* @author CaiWeiMing <314013107@qq.com>
|
||||
*/
|
||||
var tips = function ($msg, $type, $delay, $icon, $from, $align, $url) {
|
||||
$type = $type || 'info';
|
||||
$delay = $delay || 1000;
|
||||
$from = $from || 'top';
|
||||
$align = $align || 'center';
|
||||
$enter = $type == 'danger' ? 'animated shake' : 'animated fadeInUp';
|
||||
$url = $url || url;
|
||||
jQuery.notify({
|
||||
icon: $icon,
|
||||
message: $msg
|
||||
},
|
||||
{
|
||||
element: 'body',
|
||||
type: $type,
|
||||
allow_dismiss: true,
|
||||
newest_on_top: true,
|
||||
showProgressbar: false,
|
||||
placement: {
|
||||
from: $from,
|
||||
align: $align
|
||||
},
|
||||
offset: 20,
|
||||
spacing: 10,
|
||||
z_index: 10800,
|
||||
delay: $delay,
|
||||
//timer: 1000,
|
||||
animate: {
|
||||
enter: $enter,
|
||||
exit: 'animated fadeOutDown'
|
||||
}
|
||||
});
|
||||
if ($url != '') {
|
||||
setTimeout(function () {
|
||||
window.location.href = $url;
|
||||
}, $delay);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var url = '';
|
||||
|
||||
return {
|
||||
// 页面小提示
|
||||
notify: function ($msg, $type, $delay, $icon, $from, $align, $url) {
|
||||
tips($msg, $type, $delay, $icon, $from, $align, $url);
|
||||
},
|
||||
url: function ($url) {
|
||||
url = $url;
|
||||
},
|
||||
// 页面加载动画
|
||||
loading: function ($mode) {
|
||||
pageLoader($mode);
|
||||
}
|
||||
};
|
||||
}();
|
||||
return lightyear;
|
||||
});
|
||||
define(['jquery', 'bootstrap-datepicker', 'fast','tagsinput','moment','bootstrap-datetimepicker'], function ($, a, Fast,ss,momen) {
|
||||
var App = {
|
||||
init: function () {
|
||||
// 提示
|
||||
if ($('[data-toggle="tooltip"]')[0]) {
|
||||
$('[data-toggle="tooltip"]').tooltip({
|
||||
"container": 'body',
|
||||
});
|
||||
}
|
||||
|
||||
// 弹出框
|
||||
if ($('[data-toggle="popover"]')[0]) {
|
||||
$('[data-toggle="popover"]').popover();
|
||||
}
|
||||
|
||||
// 标签
|
||||
$('.js-tags-input,[data-role="tagsinput"]').each(function () {
|
||||
var $this = $(this);
|
||||
$this.tagsInput({
|
||||
height: $this.data('height') ? $this.data('height') : '38px',
|
||||
width: '100%',
|
||||
defaultText: $this.attr("placeholder"),
|
||||
removeWithBackspace: true,
|
||||
delimiter: [$this.data('delimiter') || ',']
|
||||
});
|
||||
});
|
||||
|
||||
// 日期时间选择
|
||||
$('.js-datepicker,.js-datetimepicker').each(function () {
|
||||
var $input = $(this);
|
||||
$input.datetimepicker({
|
||||
format: $input.data('format') ? $input.data('format') : ($input.hasClass('js-datetimepicker') ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'),
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// 复选框全选
|
||||
$("#check-all").change(function () {
|
||||
if ($boxname = $(this).data('name')) {
|
||||
$(this).closest('table').find("input[name='" + $boxname + "']").prop('checked', $(this).prop("checked"));
|
||||
} else {
|
||||
$(this).closest('table').find(".lyear-checkbox input[type='checkbox']").prop('checked', $(this).prop("checked"));
|
||||
}
|
||||
});
|
||||
|
||||
// iframe打开tab
|
||||
$(document).on('click', '.js-create-tab', function () {
|
||||
parent.$(parent.document).data('multitabs').create({
|
||||
iframe: true,
|
||||
title: $(this).data('title') ? $(this).data('title') : '标题',
|
||||
url: $(this).data('url') ? $(this).data('url') : 'lyear-main.html'
|
||||
}, true);
|
||||
});
|
||||
$(document).on('click', '.btn-dialog,.dialogit', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
var url = Fast.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
|
||||
var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
|
||||
var button = Fast.api.gettablecolumnbutton(options);
|
||||
if (button && typeof button.callback === 'function') {
|
||||
options.callback = button.callback;
|
||||
}
|
||||
//console.log(options)
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
Fast.api.open(url, title, options);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
window[$(that).data("window") || 'self'].Fast.api.open(url, title, options);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//点击包含.btn-addtabs的元素时新增选项卡
|
||||
$(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
var url = BacFastkend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
|
||||
var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
|
||||
var icon = $(that).attr("icon") || $(that).data("icon");
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
Fast.api.addtabs(url, title, icon);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
Fast.api.addtabs(url, title, icon);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//点击包含.btn-ajax的元素时发送Ajax请求
|
||||
$(document).on('click', '.btn-ajax', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
if (typeof options.url === 'undefined' && $(that).attr("href")) {
|
||||
options.url = $(that).attr("href");
|
||||
}
|
||||
options.url = Fast.api.replaceids(this, options.url);
|
||||
var success = typeof options.success === 'function' ? options.success : null;
|
||||
var error = typeof options.error === 'function' ? options.error : null;
|
||||
var button = Fast.api.gettablecolumnbutton(options);
|
||||
if(button){
|
||||
delete options.success;
|
||||
delete options.error;
|
||||
if (button) {
|
||||
if (typeof button.success === 'function') {
|
||||
success = button.success;
|
||||
}
|
||||
if (typeof button.error === 'function') {
|
||||
error = button.error;
|
||||
}
|
||||
}
|
||||
}
|
||||
//如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新
|
||||
if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {
|
||||
success = function () {
|
||||
$("#" + options.tableId).bootstrapTable('refresh');
|
||||
}
|
||||
}
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
Fast.api.ajax(options, success, error);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
Fast.api.ajax(options, success, error);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$(document).on('click', '.btn-click,.clickit', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
var row = {};
|
||||
if (typeof options.tableId !== 'undefined') {
|
||||
var index = parseInt(options.rowIndex);
|
||||
var data = $("#" + options.tableId).bootstrapTable('getData');
|
||||
row = typeof data[index] !== 'undefined' ? data[index] : {};
|
||||
}
|
||||
var button = Fast.api.gettablecolumnbutton(options);
|
||||
var click = typeof button.click === 'function' ? button.click : $.noop;
|
||||
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
click.apply(that, [options, row, button]);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
click.apply(that, [options, row, button]);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$(document).on('click', '.previewitem .btn-preview', function (e) {
|
||||
var that = this;
|
||||
var srcs = [];
|
||||
var index = $(this).parents('ul').find('li .img-responsive').index($(this).parents('li').find('.img-responsive'))
|
||||
$(this).parents('ul').find('li .img-responsive').each(function(v,k){
|
||||
srcs.push({
|
||||
"src": $(this).attr('data-url'),
|
||||
"alt": "图片名",
|
||||
"pid":k,
|
||||
"thumb": $(this).attr('data-url')
|
||||
});
|
||||
});
|
||||
(parent ? parent.layer : layer).photos({
|
||||
zIndex:19891033,
|
||||
photos: { // 图片层的数据源
|
||||
"title": "", // 相册标题
|
||||
"id": 123, // 相册 id
|
||||
"start": index, // 初始显示的图片序号,默认 0
|
||||
"data": srcs
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}).on('click', '.previewitem .btn-remove', function (e) {
|
||||
var that = this;
|
||||
var src = $(this).parents('li').find('.img-responsive').attr('data-url');
|
||||
var ipt = $(this).parents('ul').siblings('[type=hidden]');
|
||||
var val = ipt.val().split(',');
|
||||
var newval = [];
|
||||
for (let i = 0; i < val.length; i++) {
|
||||
const element = val[i];
|
||||
if(src != val[i]){
|
||||
newval.push(val[i]);
|
||||
}
|
||||
}
|
||||
ipt.val(newval.join(',')).trigger('change');
|
||||
return false;
|
||||
});
|
||||
//修复含有fixed-footer类的body边距
|
||||
if ($(".fixed-footer").length > 0) {
|
||||
$(document.body).css("padding-bottom", $(".fixed-footer").outerHeight());
|
||||
}
|
||||
//修复不在iframe时layer-footer隐藏的问题
|
||||
if ($(".layer-footer").length > 0 && self === top) {
|
||||
$(".layer-footer").show();
|
||||
}
|
||||
//tooltip和popover
|
||||
if (!('ontouchstart' in document.documentElement)) {
|
||||
$('body').tooltip({ selector: '[data-toggle="tooltip"]', trigger: 'hover' });
|
||||
}
|
||||
$('body').popover({ selector: '[data-toggle="popover"]' });
|
||||
}
|
||||
}
|
||||
var Config = requirejs.s.contexts._.config.config;
|
||||
//将Config渲染到全局
|
||||
window.Config = Config;
|
||||
App.init();
|
||||
requirejs([Config.controller.toLowerCase()], function (app) {
|
||||
if (app[Config.action]) { app[Config.action](); }
|
||||
});
|
||||
return App;
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
define(['lightyear','form'], function (lightyear,Form) {
|
||||
//Do setup work here
|
||||
var Dev = {
|
||||
index: function () {
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form);
|
||||
}
|
||||
}
|
||||
return Dev
|
||||
});
|
||||
@@ -0,0 +1,104 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var gift = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.statuskOption= Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/gift/select',
|
||||
add_url: '/app/admin/gift/insert',
|
||||
edit_url: '/app/admin/gift/update',
|
||||
del_url: '/app/admin/gift/delete',
|
||||
multi_url: '/app/admin/gift/multi',
|
||||
//dragsort_url: '/app/admin/gift/weigh',
|
||||
table: 'gift',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "名称",
|
||||
field: "title",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "库存",
|
||||
field: "stock",
|
||||
filter: "number",
|
||||
formatter:function(v){
|
||||
return v+'份';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "销量",
|
||||
field: "sales",
|
||||
filter: "number",
|
||||
formatter:function(v){
|
||||
return v+'份';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
filter: "select",
|
||||
filterOption:"statuskOption"
|
||||
},
|
||||
{
|
||||
title: "memo",
|
||||
field: "memo",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false,
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/upload';
|
||||
var form = $('form');
|
||||
var that = this;
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return gift
|
||||
});
|
||||
@@ -0,0 +1,107 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
window.statuskOption= Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/giftorder/select',
|
||||
add_url: '/app/admin/giftorder/insert',
|
||||
edit_url: '/app/admin/giftorder/update',
|
||||
del_url: '/app/admin/giftorder/delete',
|
||||
multi_url: '/app/admin/giftorder/multi',
|
||||
//dragsort_url: '/app/admin/giftorder/weigh',
|
||||
table: 'giftorder',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "用户",
|
||||
field: "user.username",
|
||||
},
|
||||
{
|
||||
title: "礼品名称",
|
||||
field: "gift.title",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "数量",
|
||||
field: "quantity",
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "总价",
|
||||
field: "amount",
|
||||
filter: "number",
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "面值",
|
||||
field: "denomination",
|
||||
filter: "number",
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
filter: "select",
|
||||
filterOption:"statuskOption"
|
||||
},
|
||||
{
|
||||
title: "memo",
|
||||
field: "memo",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false,
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
var form = $('form');
|
||||
var that = this;
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return Controller
|
||||
});
|
||||
@@ -0,0 +1,105 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var income_record = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.statuskOption= Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/income_record/select',
|
||||
add_url: '/app/admin/income_record/insert',
|
||||
edit_url: '/app/admin/income_record/update',
|
||||
del_url: '/app/admin/income_record/delete',
|
||||
multi_url: '/app/admin/income_record/multi',
|
||||
//dragsort_url: '/app/admin/income_record/weigh',
|
||||
table: 'income_record',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "名称",
|
||||
field: "title",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "产品单价",
|
||||
field: "price",
|
||||
filter: "string"
|
||||
},
|
||||
{
|
||||
title: "利率",
|
||||
field: "interest_rate",
|
||||
filter: "string",
|
||||
formatter:function(v){
|
||||
return v+'%'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "持续周期",
|
||||
field: "duration_cycle",
|
||||
filter: "string",
|
||||
formatter:function(v,row){
|
||||
return v+Config.cycleTypeList[row['cycle_type']]
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "结算周期",
|
||||
field: "billing_cycle",
|
||||
filter: "string",
|
||||
formatter:function(v,row){
|
||||
return v+Config.cycleTypeList[row['cycle_type']]
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
filter: "select",
|
||||
filterOption:"statuskOption"
|
||||
},
|
||||
{
|
||||
title: "memo",
|
||||
field: "memo",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false,
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
}
|
||||
};
|
||||
return income_record
|
||||
});
|
||||
@@ -0,0 +1,306 @@
|
||||
define(['lightyear','multitabs', '../libs/Chart','form','bootstrap'], function (lightyear,multitabs, Chart,Form,bootstrap) {
|
||||
//Do setup work here
|
||||
var Index = {
|
||||
index: function () {
|
||||
if($('#loginform').length == 0){
|
||||
this.main();
|
||||
}else{
|
||||
this.login();
|
||||
}
|
||||
},
|
||||
main:function (){
|
||||
$("body").on('click', '[data-stopPropagation]', function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
// 滚动条
|
||||
const ps = new PerfectScrollbar('.lyear-layout-sidebar-scroll', {
|
||||
swipeEasing: false,
|
||||
suppressScrollX: true
|
||||
});
|
||||
|
||||
// 侧边栏
|
||||
$(document).on('click', '.lyear-aside-toggler', function () {
|
||||
$('.lyear-layout-sidebar').toggleClass('lyear-aside-open');
|
||||
$("body").toggleClass('lyear-layout-sidebar-close');
|
||||
|
||||
if ($('.lyear-mask-modal').length == 0) {
|
||||
$('<div class="lyear-mask-modal"></div>').prependTo('body');
|
||||
} else {
|
||||
$('.lyear-mask-modal').remove();
|
||||
}
|
||||
});
|
||||
|
||||
// 遮罩层
|
||||
$(document).on('click', '.lyear-mask-modal', function () {
|
||||
$(this).remove();
|
||||
$('.lyear-layout-sidebar').toggleClass('lyear-aside-open');
|
||||
$('body').toggleClass('lyear-layout-sidebar-close');
|
||||
});
|
||||
|
||||
// 侧边栏导航
|
||||
$(document).on('click', '.nav-item-has-subnav > a', function () {
|
||||
$subnavToggle = jQuery(this);
|
||||
$navHasSubnav = $subnavToggle.parent();
|
||||
$topHasSubNav = $subnavToggle.parents('.nav-item-has-subnav').last();
|
||||
$subnav = $navHasSubnav.find('.nav-subnav').first();
|
||||
$viSubHeight = $navHasSubnav.siblings().find('.nav-subnav:visible').outerHeight();
|
||||
$scrollBox = $('.lyear-layout-sidebar-scroll');
|
||||
$navHasSubnav.siblings().find('.nav-subnav:visible').slideUp(500).parent().removeClass('open');
|
||||
$subnav.slideToggle(300, function () {
|
||||
$navHasSubnav.toggleClass('open');
|
||||
|
||||
// 新增滚动条处理
|
||||
var scrollHeight = 0;
|
||||
pervTotal = $topHasSubNav.prevAll().length,
|
||||
boxHeight = $scrollBox.outerHeight(),
|
||||
innerHeight = $('.sidebar-main').outerHeight(),
|
||||
thisScroll = $scrollBox.scrollTop(),
|
||||
thisSubHeight = $(this).outerHeight(),
|
||||
footHeight = 121;
|
||||
|
||||
if (footHeight + innerHeight - boxHeight >= (pervTotal * 48)) {
|
||||
scrollHeight = pervTotal * 48;
|
||||
}
|
||||
if ($subnavToggle.parents('.nav-item-has-subnav').length == 1) {
|
||||
$scrollBox.animate({ scrollTop: scrollHeight }, 300);
|
||||
} else {
|
||||
// 子菜单操作
|
||||
if (typeof ($viSubHeight) != 'undefined' && $viSubHeight != null) {
|
||||
scrollHeight = thisScroll + thisSubHeight - $viSubHeight;
|
||||
$scrollBox.animate({ scrollTop: scrollHeight }, 300);
|
||||
} else {
|
||||
if ((thisScroll + boxHeight - $scrollBox[0].scrollHeight) == 0) {
|
||||
scrollHeight = thisScroll - thisSubHeight;
|
||||
$scrollBox.animate({ scrollTop: scrollHeight }, 300);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 设置主题配色
|
||||
setTheme = function (input_name, data_name) {
|
||||
$("input[name='" + input_name + "']").click(function () {
|
||||
$('body').attr(data_name, $(this).val());
|
||||
});
|
||||
}
|
||||
setTheme('logo_bg', 'data-logobg');
|
||||
setTheme('header_bg', 'data-headerbg');
|
||||
setTheme('sidebar_bg', 'data-sidebarbg');
|
||||
$(function(){
|
||||
// 选项卡
|
||||
$('#iframe-content').multitabs({
|
||||
iframe: true,
|
||||
nav: {
|
||||
backgroundColor: '#ffffff',
|
||||
},
|
||||
init: [{
|
||||
type: 'main',
|
||||
title: '首页',
|
||||
url: '/app/admin/index/'+Config.fixedpage
|
||||
}]
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$(document).on('click', '.nav-item .multitabs', function () {
|
||||
$('.nav-item').removeClass('active');
|
||||
$('.nav-subnav li').removeClass('active');
|
||||
$(this).parents('li').addClass('active');
|
||||
$(this).parents('.nav-item-has-subnav').addClass('open').first().addClass('active');
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-logout', function (e) {
|
||||
$.getJSON($(this).data('url'),function(res){
|
||||
if(res.code === 0){
|
||||
lightyear.notify('即将跳转登录页面~', 'success', 2000, 'mdi mdi-emoticon-happy', 'top', 'center')
|
||||
if(res.data.url){
|
||||
setTimeout(function(){
|
||||
location.href = res.data.url;
|
||||
},2000);
|
||||
}
|
||||
}else{
|
||||
return lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
login: function () {
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form,function (res) {
|
||||
if (res.code) {
|
||||
$('.codeImage').trigger('click');
|
||||
lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
return false;
|
||||
}
|
||||
lightyear.notify('登录成功,页面即将自动跳转~', 'success', 2000, 'mdi mdi-emoticon-happy', 'top', 'center')
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 2000);
|
||||
return false;
|
||||
});
|
||||
},
|
||||
password: function () {
|
||||
var form = $('form');
|
||||
console.log(Form)
|
||||
Form.api.bindevent(form,function (res) {
|
||||
if (res.code) {
|
||||
$('.codeImage').trigger('click');
|
||||
return lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
}
|
||||
lightyear.notify('修改成功', 'success', 2000, 'mdi mdi-emoticon-happy', 'top', 'center')
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 2000);
|
||||
return true;
|
||||
});
|
||||
},
|
||||
profile: function () {
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form,function (res) {
|
||||
if (res.code) {
|
||||
return lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
}
|
||||
lightyear.notify('修改成功', 'success', 2000, 'mdi mdi-emoticon-happy', 'top', 'center')
|
||||
return true;
|
||||
});
|
||||
},
|
||||
dashboard: function () {
|
||||
// new Chart(
|
||||
// document.getElementsByClassName('js-chartjs-bars'),
|
||||
// {
|
||||
// type: 'bar',
|
||||
// data: {
|
||||
// labels: recharge_labels,
|
||||
// datasets: [
|
||||
// {
|
||||
// label: '充值统计',
|
||||
// data: recharge_values,
|
||||
// borderColor: '#358ed7',
|
||||
// backgroundColor: 'rgba(53, 142, 215, 0.175)',
|
||||
// borderWidth: 1,
|
||||
// fill: false,
|
||||
// lineTension: 0.5
|
||||
// },
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
// new Chart(
|
||||
// document.getElementsByClassName('js-chartjs-lines'),
|
||||
// {
|
||||
// type: 'bar',//line
|
||||
// data: {
|
||||
// labels: withdrawl_labels,
|
||||
// datasets: [
|
||||
// {
|
||||
// label: '提现统计',
|
||||
// data: withdrawl_values,
|
||||
// borderColor: '#358ed7',
|
||||
// backgroundColor: 'rgba(53, 142, 215, 0.175)',
|
||||
// borderWidth: 1,
|
||||
// fill: false,
|
||||
// lineTension: 0.5
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
$.getJSON('/app/admin/index/money_lines',function(res){
|
||||
res = res.data;
|
||||
var labels=[];
|
||||
var withdrawl_values=[];
|
||||
var recharge_values=[];
|
||||
for (let date in res) {
|
||||
labels.push(date);
|
||||
recharge_values.push(res[date].recharge);
|
||||
withdrawl_values.push(res[date].withdrawl);
|
||||
}
|
||||
|
||||
new Chart(
|
||||
document.getElementsByClassName('js-money-chartjs'),
|
||||
{
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [
|
||||
{
|
||||
label: '充值统计',
|
||||
data: recharge_values,
|
||||
borderColor: 'rgba(33, 111, 5, 0.46)',
|
||||
backgroundColor: 'rgba(33, 111, 5, 0.46)',
|
||||
borderWidth: 2,
|
||||
fill: false,
|
||||
lineTension: 0.5
|
||||
},
|
||||
{
|
||||
label: '提现统计',
|
||||
data: withdrawl_values,
|
||||
borderColor: 'rgba(161, 72, 16, 0.81)',
|
||||
backgroundColor: 'rgba(161, 72, 16, 0.81)',
|
||||
borderWidth: 2,
|
||||
fill: false,
|
||||
lineTension: 0.5
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
$.getJSON('/app/admin/index/role_buy_lines',function(res){
|
||||
res = res.data;
|
||||
var amount=[];
|
||||
var reward=[];
|
||||
var residual=[];
|
||||
var labels=[];
|
||||
for (let date in res) {
|
||||
labels.push(date);
|
||||
amount.push(res[date].amount);
|
||||
reward.push(res[date].reward);
|
||||
residual.push(res[date].residual);
|
||||
}
|
||||
new Chart(document.getElementsByClassName('js-role_buy_lines'),{
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [
|
||||
{
|
||||
label: '总购买金额',
|
||||
data: amount,
|
||||
borderColor: 'rgba(43, 191, 232, 0.7)',
|
||||
backgroundColor: 'rgba(43, 191, 232, 0.7)',
|
||||
borderWidth: 2,
|
||||
fill: false,
|
||||
lineTension: 0.5
|
||||
},
|
||||
{
|
||||
label: '奖励统计',
|
||||
data: reward,
|
||||
borderColor: 'rgba(166, 53, 215, 0.7)',
|
||||
backgroundColor: 'rgba(166, 53, 215, 0.7)',
|
||||
borderWidth: 2,
|
||||
fill: false,
|
||||
lineTension: 0.5
|
||||
},
|
||||
{
|
||||
label: '沉淀统计',
|
||||
data: residual,
|
||||
borderColor: 'rgba(59, 199, 8, 0.7)',
|
||||
backgroundColor: 'rgba(59, 199, 8, 0.7)',
|
||||
borderWidth: 2,
|
||||
fill: false,
|
||||
lineTension: 0.5
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
reward: function () {
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
}
|
||||
return Index
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var Controller = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.statuskOption= Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/invitecode/select',
|
||||
add_url: null,
|
||||
edit_url: null,
|
||||
del_url: '/app/admin/invitecode/delete',
|
||||
multi_url: null,
|
||||
//dragsort_url: '/app/admin/product/weigh',
|
||||
table: 'invitecode',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
//fixedColumns: true,
|
||||
//fixedRightNumber: 1,
|
||||
exportTypes: ['csv'],
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'code', title: __('邀请码')},
|
||||
{field: 'expire', title: __('有效期'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible:false},
|
||||
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at"
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: function (v){
|
||||
if(v==1){
|
||||
return '已使用';
|
||||
}
|
||||
return '未使用';
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,132 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var product = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.statuskOption= Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/product/select',
|
||||
add_url: '/app/admin/product/insert',
|
||||
edit_url: '/app/admin/product/update',
|
||||
del_url: '/app/admin/product/delete',
|
||||
multi_url: '/app/admin/product/multi',
|
||||
//dragsort_url: '/app/admin/product/weigh',
|
||||
table: 'product',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "名称",
|
||||
field: "title",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "单价",
|
||||
field: "price",
|
||||
filter: "string",
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "收益",
|
||||
field: "score",
|
||||
filter: "number",
|
||||
formatter:function(v,row){
|
||||
return row['min_score']+'~'+row['max_score']+'积分';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "总量",
|
||||
field: "total",
|
||||
filter: "number",
|
||||
formatter:function(v){
|
||||
return v+'个';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "每日",
|
||||
field: "assign_count",
|
||||
filter: "number",
|
||||
formatter:function(v){
|
||||
return v+'份';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "销量",
|
||||
field: "sales",
|
||||
filter: "number",
|
||||
formatter:function(v){
|
||||
return v+'份';
|
||||
},
|
||||
visible:false
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
filter: "select",
|
||||
filterOption:"statuskOption"
|
||||
},
|
||||
{
|
||||
title: "memo",
|
||||
field: "memo",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false,
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/upload';
|
||||
var form = $('form');
|
||||
var that = this;
|
||||
$('[name=cycle_type]').on('change',function(){
|
||||
console.log($(this).val());
|
||||
$('[name=cycle_type]').val($(this).val());
|
||||
//$('#random_build_btn').parent().parent().find('input').val(that.generatepassword(48));
|
||||
});
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return product
|
||||
});
|
||||
@@ -0,0 +1,116 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var User = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.filterData = {
|
||||
};
|
||||
window.statuskOption=Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/productorder/select',
|
||||
add_url: null,
|
||||
edit_url: '/app/admin/productorder/update',
|
||||
del_url: null,
|
||||
multi_url: null,
|
||||
dragsort_url: null,
|
||||
table: 'productorder',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "用户",
|
||||
field: "user.username",
|
||||
},
|
||||
{
|
||||
title: "产品",
|
||||
field: "product.title"
|
||||
},
|
||||
{
|
||||
title: "数量",
|
||||
field: "quantity",
|
||||
},
|
||||
{
|
||||
title: "加速",
|
||||
field: "accelerate",
|
||||
formatter:function(v,row){
|
||||
return v ? '是' : '否';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "进度",
|
||||
field: "assigned",
|
||||
filter:'number',
|
||||
formatter:function(v,row){
|
||||
return parseInt(v/row.total*100)+'%';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
filter: "select",
|
||||
filterOption:"statuskOption"
|
||||
},
|
||||
{
|
||||
field: 'operate', title: '操作',
|
||||
table: table, events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate,
|
||||
// buttons:[
|
||||
// {
|
||||
// text:"详情",
|
||||
// name:"servers",
|
||||
// icon:"mdi mdi-account-group-outline",
|
||||
// classname:"btn btn-xs btn-info btn-dialog",
|
||||
// url:'/app/admin/workrecord/index'
|
||||
// }
|
||||
// ]
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
},
|
||||
insert:function(){
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return User
|
||||
});
|
||||
@@ -0,0 +1,240 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var Questionnaire = {
|
||||
index: function () {
|
||||
window.statuskOption= Config.statusList;
|
||||
window.countryList= Config.questionnaire_country;
|
||||
var _categoryList = [];
|
||||
for (let i = 0; i < Config.categoryList.length; i++) {
|
||||
const element = Config.categoryList[i];
|
||||
_categoryList.push({
|
||||
value:element.id,
|
||||
label:element.title
|
||||
});
|
||||
}
|
||||
window.categoryList = _categoryList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/questionnaire/select',
|
||||
add_url: '/app/admin/questionnaire/insert',
|
||||
edit_url: '/app/admin/questionnaire/update',
|
||||
del_url: '/app/admin/questionnaire/delete',
|
||||
multi_url: '/app/admin/questionnaire/multi',
|
||||
//dragsort_url: '/app/admin/questionnaire/weigh',
|
||||
table: 'questionnaire',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "编号",
|
||||
field: "title",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "分类",
|
||||
field: "category_id",
|
||||
filter: "select",
|
||||
filterOption:'categoryList',
|
||||
formatter:function(v,row){
|
||||
return '<label class="label label-primary">'+row.category.title +'</label>';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "国家",
|
||||
field: "country",
|
||||
filter: "select",
|
||||
filterOption:'countryList',
|
||||
formatter:function(v,row){
|
||||
return '<label class="label label-info">'+window.countryList[row.country] +'</label>';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "积分",
|
||||
field: "score",
|
||||
filter: "number",
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "开始时间",
|
||||
field: "start_time",
|
||||
filter: "datetime",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
},
|
||||
{
|
||||
title: "结束时间",
|
||||
field: "end_time",
|
||||
filter: "datetime",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
},
|
||||
{
|
||||
title: "题目数量",
|
||||
field: "total",
|
||||
filter: "number"
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
filter: "select",
|
||||
filterOption:"statuskOption"
|
||||
},
|
||||
{
|
||||
title: "memo",
|
||||
field: "memo",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false,
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
/**
|
||||
* 生成不重复的随机编号
|
||||
* 格式:固定9位纯数字,不以0开头
|
||||
* @returns {string}
|
||||
*/
|
||||
generateUniqueNo: function() {
|
||||
// 生成前6位随机数字,第一位不能为0
|
||||
var numbers = '';
|
||||
// 第一位生成1-9的随机数字
|
||||
numbers += Math.floor(Math.random() * 9) + 1;
|
||||
// 后面5位生成0-9的随机数字
|
||||
for (var i = 1; i < 6; i++) {
|
||||
numbers += Math.floor(Math.random() * 10);
|
||||
}
|
||||
|
||||
// 添加时间戳后3位确保唯一性
|
||||
var timestamp = Date.now().toString();
|
||||
var microtime = timestamp.substr(-3);
|
||||
|
||||
return numbers + microtime;
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
$('#refresh-title').trigger('click');
|
||||
},
|
||||
bindevent:function(){
|
||||
var questionEditor = $('.question-editor');
|
||||
function rebuildindex(){
|
||||
questionEditor.find('.question-item').each(function(index,ele){
|
||||
var q_index = index +1;
|
||||
$(ele).data('index',q_index);
|
||||
$(ele).find('.question-title>b').html(q_index+'.');
|
||||
$(ele).find('.question-title>input').attr('name','body['+index+'][question]');
|
||||
$(ele).find('.answer-item').each(function(a_index,answer){
|
||||
var _a_index = a_index +1;
|
||||
$(answer).data('index',_a_index);
|
||||
$(answer).find('b').html(String.fromCharCode(64+_a_index)+'.');
|
||||
$(answer).find('input').attr('name','body['+index+'][answer][]');
|
||||
});
|
||||
});
|
||||
$('[name="total"]').val(questionEditor.find('.question-item').length);
|
||||
//console.log(a_index);
|
||||
}
|
||||
$(document).on('click','.btn-append-answer',function(){
|
||||
var dl = $(this).parents('.answer-list');
|
||||
var last_anser_node = dl.find('.answer-item:last');
|
||||
var html = ['<dd class="list-group-item answer-item" data-index="">',
|
||||
'<b></b>',
|
||||
'<input type="text" name="body[][answer][]" value="" class="form-control" data-rule="required;length(2~100)" />',
|
||||
'<a class="btn btn-danger btn-delete"><i class="mdi mdi-close"></i></a>',
|
||||
'</dd>'];
|
||||
if(last_anser_node.length>0){
|
||||
last_anser_node.after(html.join(''));
|
||||
}else{
|
||||
dl.prepend(html.join(''));
|
||||
}
|
||||
rebuildindex();
|
||||
});
|
||||
$(document).on('click','.btn-append-question',function(){
|
||||
var html = [];
|
||||
html.push('<dl class="list-group question-item" data-index="">');
|
||||
html.push('<dd class="list-group-item m-b-5 question-title">');
|
||||
html.push('<b></b>');
|
||||
html.push('<input type="text" name="body[][question]" value="" class="form-control" data-rule="required;length(2~100)" />');
|
||||
html.push('<a class="btn btn-danger btn-delete"><i class="mdi mdi-close"></i></a>');
|
||||
html.push('</dd>');
|
||||
html.push('<dd class="list-group-item m-b-5">');
|
||||
html.push('<dl class="list-group answer-list">');
|
||||
for(var index=1;index<=4;index++){
|
||||
html.push('<dd class="list-group-item answer-item" data-index="">');
|
||||
html.push('<b>');
|
||||
html.push('.</b>');
|
||||
html.push('<input type="text" name="body[][answer][]" value="" class="form-control" data-rule="required;length(2~100)" />');
|
||||
html.push('<a class="btn btn-danger btn-delete"><i class="mdi mdi-close"></i></a>');
|
||||
html.push('</dd>');
|
||||
}
|
||||
html.push('<dd class="m-l-15">');
|
||||
html.push('<a href="javascript:;" class="btn btn-sm btn-success btn-append-answer m-t-5 m-l-15"><i class="fa fa-plus"></i> 添加答案</a>');
|
||||
html.push('</dd>');
|
||||
html.push('</dl>');
|
||||
html.push('</dd>');
|
||||
html.push('</dl>');
|
||||
console.log(questionEditor.find('.question-item:last'));
|
||||
if(questionEditor.find('.question-item:last').length>0){
|
||||
questionEditor.find('.question-item:last').after(html.join(''));
|
||||
}else{
|
||||
questionEditor.prepend(html.join(''));
|
||||
}
|
||||
rebuildindex();
|
||||
});
|
||||
$(document).on('click','.btn.btn-delete',function(){
|
||||
if($(this).parent().hasClass('answer-item')){
|
||||
$(this).parent().remove();
|
||||
rebuildindex();
|
||||
}else{
|
||||
$(this).parents('.question-item').remove();
|
||||
rebuildindex();
|
||||
}
|
||||
});
|
||||
$(document).on('click','#refresh-title',function(){
|
||||
var no = Questionnaire.generateUniqueNo();
|
||||
$('[name="title"]').val(no);
|
||||
});
|
||||
if($('.question-item').length == 0){
|
||||
$('.btn-append-question').trigger('click');
|
||||
}else{
|
||||
rebuildindex();
|
||||
}
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form);
|
||||
}
|
||||
};
|
||||
return Questionnaire
|
||||
});
|
||||
@@ -0,0 +1,210 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var recharge = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.networkOption=Config.networkList;
|
||||
window.statuskOption=Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/recharge/select',
|
||||
add_url: '/app/admin/recharge/insert',
|
||||
edit_url: '/app/admin/recharge/update',
|
||||
del_url: '/app/admin/recharge/delete',
|
||||
multi_url: '/app/admin/recharge/multi',
|
||||
//dragsort_url: '/app/admin/recharge/weigh',
|
||||
table: 'recharge',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true, // 是否排序
|
||||
visible:false,
|
||||
},
|
||||
{
|
||||
field: 'user.username',
|
||||
title: '用户',
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "金额",
|
||||
field: "amount",
|
||||
filter: "number",
|
||||
formatter:Table.api.formatter.number,
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "网络",
|
||||
field: "network",
|
||||
sortable: true,
|
||||
filter: "select",
|
||||
filterOption:"networkOption"
|
||||
},
|
||||
{
|
||||
title: "地址",
|
||||
field: "address",
|
||||
formatter: Table.api.formatter.address
|
||||
},
|
||||
{
|
||||
title: "入账地址",
|
||||
field: "from",
|
||||
filter: "string",
|
||||
visible:false,
|
||||
formatter: Table.api.formatter.address
|
||||
},
|
||||
{
|
||||
title: "转账金额",
|
||||
field: "real_amount",
|
||||
sortable: true,
|
||||
filter: "string",
|
||||
formatter:Table.api.formatter.number,
|
||||
visible:false
|
||||
},
|
||||
{
|
||||
title: "txid",
|
||||
field: "txid",
|
||||
filter: "string",
|
||||
visible:false,
|
||||
formatter: Table.api.formatter.txid
|
||||
},
|
||||
{
|
||||
title: "转账时间",
|
||||
field: "pay_time",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible:false
|
||||
},
|
||||
{
|
||||
title: "result",
|
||||
field: "result",
|
||||
filter: "string",
|
||||
visible:false
|
||||
},
|
||||
{
|
||||
title: "reason",
|
||||
field: "reason",
|
||||
filter: "string",
|
||||
visible:false
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
// formatter: function (v,d) {
|
||||
// for (let i = 0; i < window.statuskOption.length; i++) {
|
||||
// if(v===window.statuskOption[i].value){
|
||||
// return '<span class="status-'+v+'">'+window.statuskOption[i].label+'</span>';
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
filter: "select",
|
||||
filterOption:"statuskOption"
|
||||
},
|
||||
{
|
||||
title: "memo",
|
||||
field: "memo",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
sortable: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
field: 'operate', title: '操作',
|
||||
table: table, events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
setForm:function(obj){
|
||||
console.log(obj);
|
||||
if(obj.from){
|
||||
$('[name=from]').val(obj.from);
|
||||
}
|
||||
if(obj.transfer_at){
|
||||
$('[name=pay_time]').val(Table.api.formatter.datetime(obj.transfer_at));
|
||||
}
|
||||
if(obj.real_amount){
|
||||
$('[name=real_amount]').val(obj.real_amount);
|
||||
}
|
||||
$('[name=result]').val(obj.result);
|
||||
},
|
||||
bindevent:function(){
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form);
|
||||
$('#gettxid').on('click',function(){
|
||||
var btn_loading = $(this).find('i');
|
||||
var v = $('[name=txid]').val();
|
||||
if(v){
|
||||
btn_loading.show();
|
||||
if(v.substr(0,2) == '0x'){
|
||||
$.getJSON('/app/admin/index/txid?txid='+v,function(res){
|
||||
btn_loading.hide();
|
||||
recharge.setForm({
|
||||
from:res.data.from,
|
||||
transfer_at:res.data.timestamp,
|
||||
real_amount:res.data.real_amount,
|
||||
result:res.data.status == '0x1' ? 'SUCCESS' : 'FAIL'
|
||||
});
|
||||
});
|
||||
}else{
|
||||
$.getJSON('https://apilist.tronscan.org/api/transaction-info?hash='+v,function(res){
|
||||
btn_loading.hide();
|
||||
if(res.contractRet){
|
||||
recharge.setForm({
|
||||
from:res.tokenTransferInfo ? res.tokenTransferInfo.from_address : '',
|
||||
transfer_at:parseInt(res.timestamp/1000),
|
||||
real_amount:res.tokenTransferInfo ? res.tokenTransferInfo.amount_str/1000000 : 0,
|
||||
result:res.contractRet
|
||||
});
|
||||
}else{
|
||||
recharge.setForm({
|
||||
from:null,
|
||||
transfer_at:null,
|
||||
real_amount:null,
|
||||
result:"FAIL"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
return recharge
|
||||
});
|
||||
@@ -0,0 +1,106 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var product = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.statuskOption= Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/robot/select',
|
||||
add_url: '/app/admin/robot/insert',
|
||||
edit_url: '/app/admin/robot/update',
|
||||
del_url: '/app/admin/robot/delete',
|
||||
multi_url: '/app/admin/robot/multi',
|
||||
//dragsort_url: '/app/admin/robot/weigh',
|
||||
table: 'robot',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "名称",
|
||||
field: "title",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "产品单价",
|
||||
field: "price",
|
||||
filter: "string"
|
||||
},
|
||||
{
|
||||
title: "广告",
|
||||
field: "size",
|
||||
filter: "string",
|
||||
formatter:function(v){
|
||||
return v+'个'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
filter: "select",
|
||||
filterOption:"statuskOption"
|
||||
},
|
||||
{
|
||||
title: "memo",
|
||||
field: "memo",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false,
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/upload';
|
||||
var form = $('form');
|
||||
var that = this;
|
||||
$('[name=cycle_type]').on('change',function(){
|
||||
console.log($(this).val());
|
||||
$('[name=cycle_type]').val($(this).val());
|
||||
//$('#random_build_btn').parent().parent().find('input').val(that.generatepassword(48));
|
||||
});
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return product
|
||||
});
|
||||
@@ -0,0 +1,83 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var investment_record = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.statuskOption= Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/robotrecord/select',
|
||||
add_url: '/app/admin/robotrecord/insert',
|
||||
edit_url: '/app/admin/robotrecord/update',
|
||||
del_url: '/app/admin/robotrecord/delete',
|
||||
multi_url: '/app/admin/robotrecord/multi',
|
||||
//dragsort_url: '/app/admin/robotrecord/weigh',
|
||||
table: 'robotrecord',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "名称",
|
||||
field: "robot.title",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "金额",
|
||||
field: "amount",
|
||||
formatter:Table.api.formatter.number,
|
||||
filter: "string"
|
||||
},
|
||||
{
|
||||
title: "用户",
|
||||
field: "user.username",
|
||||
filter: "string"
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
filter: "select",
|
||||
filterOption:"statuskOption",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "时间",
|
||||
field: "created_at",
|
||||
filter: "datetime"
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false,
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
};
|
||||
return investment_record
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var Archives = {
|
||||
index: function () {
|
||||
window.filterData['type'] = {value1:"page",symbol:'=','value2':''};
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/singlepage/select',
|
||||
add_url: '/app/admin/singlepage/insert',
|
||||
edit_url: '/app/admin/singlepage/update',
|
||||
del_url: '/app/admin/singlepage/delete',
|
||||
multi_url: '/app/admin/singlepage/multi',
|
||||
dragsort_url: '/app/admin/singlepage/weigh',
|
||||
table: 'archives',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "标题",
|
||||
field: "title",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at"
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at"
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/upload';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return Archives
|
||||
});
|
||||
@@ -0,0 +1,402 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var User = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.filterData = {
|
||||
};
|
||||
window.groupOption=Config.groupList;
|
||||
window.roleOption=Config.roleList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/studio/select',
|
||||
add_url: '/app/admin/studio/insert',
|
||||
edit_url: '/app/admin/studio/update',
|
||||
del_url: '/app/admin/studio/delete',
|
||||
multi_url: '/app/admin/studio/multi',
|
||||
dragsort_url: '/app/admin/studio/weigh',
|
||||
table: 'studio',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "推荐人",
|
||||
field: "parent_id",
|
||||
formatter:function(v,row){
|
||||
return row.referrer ? row.referrer.username : '';
|
||||
},
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "分组",
|
||||
field: "group",
|
||||
formatter:function(v,row){
|
||||
for (let i = 0; i < Config.groupList.length; i++) {
|
||||
if(Config.groupList[i].value == v){
|
||||
return Config.groupList[i].label;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
},
|
||||
filter: "select",
|
||||
filterOption:"groupOption",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "角色",
|
||||
field: "role_id",
|
||||
formatter:function(v,row){
|
||||
return row.role.name;
|
||||
},
|
||||
filter: "select",
|
||||
filterOption:"roleOption",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "用户名",
|
||||
field: "username",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "昵称",
|
||||
field: "nickname",
|
||||
visible: false
|
||||
},
|
||||
// {
|
||||
// title: "密码",
|
||||
// field: "password",
|
||||
// visible: false,
|
||||
// },
|
||||
{
|
||||
title: "性别",
|
||||
field: "sex",
|
||||
formatter: function (v,d) {
|
||||
let field = "sex";
|
||||
if (typeof d[field] == "undefined") return "";
|
||||
let items = [];
|
||||
$.each((d[field] + "").split(","), function (k , v) {
|
||||
items.push( v);//apiResults[field][v] ||
|
||||
});
|
||||
return util.escape(items.join(","));
|
||||
},
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "头像",
|
||||
field: "avatar",
|
||||
formatter: function (v,d) {
|
||||
return '<img src="'+encodeURI(d['avatar'])+'" style="max-width:32px;max-height:32px;" alt="" />'
|
||||
},
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
title: "邮箱",
|
||||
field: "email",
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
title: "手机",
|
||||
field: "mobile",
|
||||
visible: false
|
||||
},
|
||||
// {
|
||||
// title: "等级",
|
||||
// field: "level",
|
||||
// visible: false,
|
||||
// },
|
||||
// {
|
||||
// title: "生日",
|
||||
// field: "birthday",
|
||||
// visible: false,
|
||||
// },
|
||||
// {
|
||||
// title: "后缀",
|
||||
// field: "decimal_part",
|
||||
// //visible: false,
|
||||
// },
|
||||
{
|
||||
title: "余额",
|
||||
field: "money",
|
||||
formatter:Table.api.formatter.number,
|
||||
sortable: true,
|
||||
//visible: false,
|
||||
},
|
||||
{
|
||||
title: "积分",
|
||||
field: "score",
|
||||
sortable: true,
|
||||
visible: false,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "currency1",
|
||||
field: "currency1",
|
||||
visible: false,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "冻结",
|
||||
field: "currency2",
|
||||
sortable: true,
|
||||
visible: false,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "currency3",
|
||||
field: "currency3",
|
||||
visible: false,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "currency4",
|
||||
field: "currency4",
|
||||
visible: false,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "currency5",
|
||||
field: "currency5",
|
||||
visible: false,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "登录时间",
|
||||
field: "last_time",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "登录ip",
|
||||
field: "last_ip",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "注册时间",
|
||||
field: "join_time",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
filter:'datetime'
|
||||
},
|
||||
{
|
||||
title: "注册ip",
|
||||
field: "join_ip",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
},
|
||||
{
|
||||
field: 'operate', title: '操作',
|
||||
table: table, events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate,
|
||||
buttons:[
|
||||
{
|
||||
text:"团队",
|
||||
name:"team",
|
||||
icon:"mdi mdi-account-group-outline",
|
||||
classname:"btn btn-xs btn-info btn-dialog",
|
||||
url:'/app/admin/studio/team'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
insert:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
getRole:function(){
|
||||
Fast.api.ajax({
|
||||
url: "/app/admin/UserRole/select?format=tree",
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
Layer.closeAll();
|
||||
var html = "";
|
||||
var selected=$('#roles').data('value');
|
||||
for (let index = 0; index < res.data.length; index++) {
|
||||
const element = res.data[index];
|
||||
if(selected == element.id){
|
||||
html+='<option value="'+element.id+'" selected>'+element.name+'</option>';
|
||||
}else{
|
||||
html+='<option value="'+element.id+'">'+element.name+'</option>';
|
||||
}
|
||||
}
|
||||
$('#roles').append(html);
|
||||
}
|
||||
});
|
||||
},
|
||||
team:function(){
|
||||
window.filterData = {
|
||||
"user_id":{value1:Fast.api.query('ids'),symbol:'=','value2':''},
|
||||
'type' : {value1:'child',symbol:'=','value2':''}
|
||||
};
|
||||
|
||||
$('.nav-tabs li').on('click',function(){
|
||||
$('.nav-tabs li').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
window.filterData['type'] = {value1:$(this).data('type'),symbol:'=','value2':''};
|
||||
table.bootstrapTable('selectPage', 1);
|
||||
});
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/team/select',
|
||||
add_url: null,
|
||||
edit_url: null,
|
||||
del_url: null,
|
||||
multi_url: null,
|
||||
dragsort_url: null,
|
||||
table: 'team',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
title: "深度",
|
||||
field: "depth",
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "角色",
|
||||
field: "role",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "用户名",
|
||||
field: "username",
|
||||
filter: "string",
|
||||
},
|
||||
// {
|
||||
// title: "等级",
|
||||
// field: "level",
|
||||
// visible: false,
|
||||
// },
|
||||
{
|
||||
title: "余额",
|
||||
field: "money",
|
||||
formatter:Table.api.formatter.number,
|
||||
sortable: true,
|
||||
//visible: false,
|
||||
},
|
||||
{
|
||||
title: "积分",
|
||||
field: "score",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "待结算",
|
||||
field: "currency1",
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "失效算力",
|
||||
field: "currency2",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "登录时间",
|
||||
field: "last_time",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "登录ip",
|
||||
field: "last_ip",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "注册时间",
|
||||
field: "join_time",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
filter:'datetime'
|
||||
},
|
||||
{
|
||||
title: "注册ip",
|
||||
field: "join_ip",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
}
|
||||
};
|
||||
return User
|
||||
});
|
||||
@@ -0,0 +1,407 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var User = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.filterData = {
|
||||
};
|
||||
window.groupOption=Config.groupList;
|
||||
window.roleOption=Config.roleList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/user/select',
|
||||
add_url: '/app/admin/user/insert',
|
||||
edit_url: '/app/admin/user/update',
|
||||
del_url: '/app/admin/user/delete',
|
||||
multi_url: '/app/admin/user/multi',
|
||||
dragsort_url: '/app/admin/user/weigh',
|
||||
table: 'user',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "推荐人",
|
||||
field: "parent_id",
|
||||
formatter:function(v,row){
|
||||
return row.referrer ? row.referrer.username : '';
|
||||
},
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "分组",
|
||||
field: "group",
|
||||
formatter:function(v,row){
|
||||
for (let i = 0; i < Config.groupList.length; i++) {
|
||||
if(Config.groupList[i].value == v){
|
||||
return Config.groupList[i].label;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
},
|
||||
filter: "select",
|
||||
filterOption:"groupOption",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "角色",
|
||||
field: "role_id",
|
||||
formatter:function(v,row){
|
||||
return row.role ? row.role.name : '用户';
|
||||
},
|
||||
filter: "select",
|
||||
filterOption:"roleOption",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "用户名",
|
||||
field: "username",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "昵称",
|
||||
field: "nickname",
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'domain',
|
||||
title: '域名',
|
||||
filter: "string",
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
title: "头像",
|
||||
field: "avatar",
|
||||
formatter: function (v,d) {
|
||||
return '<img src="'+encodeURI(d['avatar'])+'" style="max-width:32px;max-height:32px;" alt="" />'
|
||||
},
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
title: "邮箱",
|
||||
field: "email",
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
title: "手机",
|
||||
field: "mobile",
|
||||
visible: false
|
||||
},
|
||||
// {
|
||||
// title: "等级",
|
||||
// field: "level",
|
||||
// visible: false,
|
||||
// },
|
||||
// {
|
||||
// title: "生日",
|
||||
// field: "birthday",
|
||||
// visible: false,
|
||||
// },
|
||||
// {
|
||||
// title: "后缀",
|
||||
// field: "decimal_part",
|
||||
// //visible: false,
|
||||
// },
|
||||
{
|
||||
title: "调研币",
|
||||
field: "money",
|
||||
formatter:Table.api.formatter.number,
|
||||
sortable: true,
|
||||
//visible: false,
|
||||
},
|
||||
{
|
||||
title: "积分",
|
||||
field: "score",
|
||||
sortable: true,
|
||||
visible: false,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "调研豆",
|
||||
field: "currency1",
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "可领取",
|
||||
field: "currency6",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "待分配",
|
||||
field: "currency7",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "已分配",
|
||||
field: "currency8",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "未通过",
|
||||
field: "currency9",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "登录时间",
|
||||
field: "last_time",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "登录ip",
|
||||
field: "last_ip",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "注册时间",
|
||||
field: "join_time",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
filter:'datetime'
|
||||
},
|
||||
{
|
||||
title: "注册ip",
|
||||
field: "join_ip",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
},
|
||||
{
|
||||
field: 'operate', title: '操作',
|
||||
table: table, events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate,
|
||||
buttons:[
|
||||
{
|
||||
text:"团队",
|
||||
name:"team",
|
||||
icon:"mdi mdi-account-group-outline",
|
||||
classname:"btn btn-xs btn-info btn-dialog",
|
||||
url:'/app/admin/user/team'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
insert:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
getRole:function(){
|
||||
Fast.api.ajax({
|
||||
url: "/app/admin/UserRole/select?format=tree",
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
Layer.closeAll();
|
||||
var html = "";
|
||||
var selected=$('#roles').data('value');
|
||||
for (let index = 0; index < res.data.length; index++) {
|
||||
const element = res.data[index];
|
||||
if(selected == element.id){
|
||||
html+='<option value="'+element.id+'" selected>'+element.name+'</option>';
|
||||
}else{
|
||||
html+='<option value="'+element.id+'">'+element.name+'</option>';
|
||||
}
|
||||
}
|
||||
$('#roles').append(html);
|
||||
}
|
||||
});
|
||||
},
|
||||
team:function(){
|
||||
window.filterData = {
|
||||
"user_id":{value1:Fast.api.query('ids'),symbol:'=','value2':''},
|
||||
'type' : {value1:'child',symbol:'=','value2':''}
|
||||
};
|
||||
|
||||
$('.nav-tabs li').on('click',function(){
|
||||
$('.nav-tabs li').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
window.filterData['type'] = {value1:$(this).data('type'),symbol:'=','value2':''};
|
||||
table.bootstrapTable('selectPage', 1);
|
||||
});
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/team/select',
|
||||
add_url: null,
|
||||
edit_url: null,
|
||||
del_url: null,
|
||||
multi_url: null,
|
||||
dragsort_url: null,
|
||||
table: 'team',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
title: "深度",
|
||||
field: "depth",
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "角色",
|
||||
field: "role_id",
|
||||
formatter: function(v,item){
|
||||
return 'V'+v;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "用户名",
|
||||
field: "username",
|
||||
filter: "string",
|
||||
},
|
||||
// {
|
||||
// title: "等级",
|
||||
// field: "level",
|
||||
// visible: false,
|
||||
// },
|
||||
{
|
||||
title: "余额",
|
||||
field: "money",
|
||||
formatter:Table.api.formatter.number,
|
||||
sortable: true,
|
||||
//visible: false,
|
||||
},
|
||||
{
|
||||
title: "积分",
|
||||
field: "score",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "调研币",
|
||||
field: "currency1",
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "可领取",
|
||||
field: "currency6",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "待分配",
|
||||
field: "currency7",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "已分配",
|
||||
field: "currency8",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "未通过",
|
||||
field: "currency9",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "登录时间",
|
||||
field: "last_time",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "登录ip",
|
||||
field: "last_ip",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "注册时间",
|
||||
field: "join_time",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
filter:'datetime'
|
||||
},
|
||||
{
|
||||
title: "注册ip",
|
||||
field: "join_ip",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
}
|
||||
};
|
||||
return User
|
||||
});
|
||||
@@ -0,0 +1,159 @@
|
||||
define(['table','form','yntree'], function (Table,Form,YnTree1) {
|
||||
var Admin = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/userrole/select',
|
||||
add_url: '/app/admin/userrole/insert',
|
||||
edit_url: '/app/admin/userrole/update',
|
||||
del_url: '/app/admin/userrole/delete',
|
||||
multi_url: '/app/admin/userrole/multi',
|
||||
dragsort_url: '/app/admin/userrole/weigh',
|
||||
table: 'userrole',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "父级",
|
||||
field: "pid",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '角色组',
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
field: 'need_sales',
|
||||
title: '销售额',
|
||||
filter: "number",
|
||||
},
|
||||
{
|
||||
field: 'consume_reward',
|
||||
title: '消费奖励',
|
||||
filter: "number",
|
||||
},
|
||||
{
|
||||
field: 'income_reward',
|
||||
title: '产值奖',
|
||||
filter: "number",
|
||||
},
|
||||
{
|
||||
field: 'withdrawl_reward',
|
||||
title: '提现奖励',
|
||||
filter: "number",
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
flatArrayToTree: function (items) {
|
||||
let res = []
|
||||
let getChildren = (res, pid) => {
|
||||
for (const i of items) {
|
||||
if (i.parent === pid) {
|
||||
const newItem = { ...i, children: [] }
|
||||
newItem.name =newItem.text;
|
||||
newItem.value =newItem.id;
|
||||
newItem.checked =newItem.state.selected;
|
||||
res.push(newItem)
|
||||
getChildren(newItem.children, newItem.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
getChildren(res, 0)
|
||||
return res
|
||||
},
|
||||
rendertree: function (content) {
|
||||
if(Admin.ruletree){
|
||||
Admin.ruletree.destroy();
|
||||
}
|
||||
var treeData = {
|
||||
// 复选框change事件
|
||||
onchange: function (input, yntree) {
|
||||
console.log(yntree.getValues().join(','));
|
||||
if ($("#treeview").length > 0) {
|
||||
$("input[name='rules']").val(yntree.getValues().join(','));
|
||||
}
|
||||
},
|
||||
// 是否严格的遵循父子互相关联的做法
|
||||
checkStrictly: true,
|
||||
data: []
|
||||
};
|
||||
treeData.data = Admin.flatArrayToTree(content)
|
||||
var yntree = new YnTree(document.getElementById("treeview"), treeData);
|
||||
Admin.ruletree = yntree;
|
||||
},
|
||||
ruletree: null,
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
//渲染权限节点树
|
||||
//变更级别后需要重建节点树
|
||||
$(document).on("change", "select[name='pid']", function () {
|
||||
var pid = $(this).data("pid");
|
||||
var id = $(this).data("id");
|
||||
// if ($(this).val() == id) {
|
||||
// $("option[value='" + pid + "']", this).prop("selected", true).change();
|
||||
// Fast.api.error(__('Can not change the parent to self'));
|
||||
// return false;
|
||||
// }
|
||||
$.ajax({
|
||||
url: "/app/admin/userrole/tree",
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {id: id, pid: $(this).val()},
|
||||
success: function (ret) {
|
||||
if (ret.hasOwnProperty("code")) {
|
||||
var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : "";
|
||||
if (ret.code) {
|
||||
Fast.api.error(ret.msg);
|
||||
} else {
|
||||
Admin.rendertree(data);
|
||||
}
|
||||
}
|
||||
}, error: function (e) {
|
||||
Fast.api.error(e.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
$("select[name='pid']").trigger("change");
|
||||
}
|
||||
};
|
||||
return Admin
|
||||
});
|
||||
@@ -0,0 +1,260 @@
|
||||
define(['table', 'upload','form','template','treegrid','bootstrap-table-treegrid'], function (Table,Upload,Form,Template) {
|
||||
var AdminRule = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
this.initTalbe();
|
||||
},
|
||||
initTalbe:function(){
|
||||
|
||||
var apiResults_type = ["目录","菜单","权限"];
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/UserRule/select',
|
||||
add_url: '/app/admin/UserRule/insert',
|
||||
edit_url: '/app/admin/UserRule/update',
|
||||
del_url: '/app/admin/UserRule/delete',
|
||||
multi_url: '/app/admin/UserRule/multi',
|
||||
dragsort_url: '/app/admin/UserRule/weigh',
|
||||
table: 'UserRule',
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 选中父项时,同时选中子项
|
||||
* @param datas 所有的数据
|
||||
* @param row 当前数据
|
||||
* @param id id 字段名
|
||||
* @param pid 父id字段名
|
||||
*/
|
||||
function selectChilds(datas,row,id,pid,checked) {
|
||||
for(var i in datas){
|
||||
if(datas[i][pid] == row[id]){
|
||||
datas[i][0]=true;
|
||||
datas[i].check=checked;
|
||||
selectChilds(datas,datas[i],id,pid,checked);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function selectParentChecked(datas,row,id,pid){
|
||||
for(var i in datas){
|
||||
if(datas[i][id] == row[pid]){
|
||||
datas[i].check=true;
|
||||
datas[i][0]=true;
|
||||
selectParentChecked(datas,datas[i],id,pid);
|
||||
};
|
||||
}
|
||||
}
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
pagination: false,
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
treeShowField: 'title',
|
||||
parentIdField: 'pid',
|
||||
idField: 'id',
|
||||
uniqueId: 'id',
|
||||
clickToSelect: false, //是否启用点击选中
|
||||
dblClickToEdit: true, //是否启用双击编辑
|
||||
singleSelect: false, //是否启用单选
|
||||
|
||||
onCheck: function(row) {
|
||||
var datas = table.bootstrapTable('getData');
|
||||
|
||||
selectChilds(datas, row, 'id', 'pid', true); // 选择子类
|
||||
|
||||
selectParentChecked(datas, row, 'id', 'pid'); // 选择父类
|
||||
|
||||
table.bootstrapTable('load', datas);
|
||||
},
|
||||
|
||||
onUncheck: function(row) {
|
||||
var datas = table.bootstrapTable('getData');
|
||||
selectChilds(datas, row, 'id', 'pid', false);
|
||||
table.bootstrapTable('load', datas);
|
||||
},
|
||||
onResetView: function(data) {
|
||||
//console.log($.fn.treegrid)
|
||||
table.treegrid({
|
||||
initialState: 'expanded', // 所有节点都折叠
|
||||
treeColumn: 2,
|
||||
expanderExpandedClass: 'mdi mdi-folder-open', // 可自定义图标样式
|
||||
expanderCollapsedClass: 'mdi mdi-folder',
|
||||
onChange: function() {
|
||||
table.bootstrapTable('resetWidth');
|
||||
}
|
||||
});
|
||||
|
||||
// 只展开树形的第一集节点
|
||||
table.treegrid('getRootNodes').treegrid('expand');
|
||||
},
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: '标题',
|
||||
filter: "string",
|
||||
align:"left"
|
||||
},
|
||||
{
|
||||
title: "图标",
|
||||
field: "icon",
|
||||
formatter: function (v,d) {
|
||||
return '<i class="layui-icon ' + d["icon"] + '"></i>';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "key",
|
||||
field: "key",
|
||||
},
|
||||
// {
|
||||
// title: "上级菜单",
|
||||
// field: "pid",
|
||||
// hide: true,
|
||||
// formatter: function (v,d) {
|
||||
// let field = "pid";
|
||||
// if (typeof d[field] == "undefined") return "";
|
||||
// let items = [];
|
||||
// $.each((d[field] + "").split(","), function (k , v) {
|
||||
// items.push( v);
|
||||
// });
|
||||
// return items.join(",");
|
||||
// }
|
||||
// },
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
title: "url",
|
||||
field: "href",
|
||||
},
|
||||
{
|
||||
title: "类型",
|
||||
field: "type",
|
||||
width: 80,
|
||||
formatter: function (v,d) {
|
||||
let field = "type";
|
||||
let value = apiResults_type[d["type"]] || d["type"];
|
||||
let css = {"目录":"layui-bg-blue", "菜单": "layui-bg-green", "权限": "layui-bg-orange"}[value];
|
||||
return '<span class="layui-badge '+css+'">'+value+'</span>';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter:Table.api.formatter.switch
|
||||
},
|
||||
{
|
||||
title: "排序",
|
||||
field: "weight",
|
||||
width: 80,
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
this.initIcoselect();
|
||||
},
|
||||
getRole:function(){
|
||||
Fast.api.ajax({
|
||||
url: "/app/admin/UserRole/select?format=tree",
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
Layer.closeAll();
|
||||
var html = "";
|
||||
var selected=$('#roles').data('value');
|
||||
for (let index = 0; index < res.data.length; index++) {
|
||||
const element = res.data[index];
|
||||
if(selected == element.id){
|
||||
html+='<option value="'+element.id+'" selected>'+element.name+'</option>';
|
||||
}else{
|
||||
html+='<option value="'+element.id+'">'+element.name+'</option>';
|
||||
}
|
||||
}
|
||||
$('#roles').append(html);
|
||||
}
|
||||
});
|
||||
},
|
||||
initIcoselect:function(){
|
||||
|
||||
var iconlist = [];
|
||||
var iconfunc = function () {
|
||||
Layer.open({
|
||||
type: 1,
|
||||
area: ['99%', '98%'], //宽高
|
||||
content: Template('chooseicontpl', {iconlist: iconlist})
|
||||
});
|
||||
};
|
||||
|
||||
$(document).on('change keyup', "#icon", function () {
|
||||
$(this).prev().find("i").prop("class", $(this).val());
|
||||
});
|
||||
$(document).on('click', ".btn-search-icon", function () {
|
||||
if (iconlist.length == 0) {
|
||||
$.get(Config.cdnurl + "/app/admin/css/materialdesignicons.min.css", function (ret) {
|
||||
window.iconret = ret;
|
||||
// var exp = /\.mdi-(.*):before/ig;
|
||||
// var result;
|
||||
// while ((result = exp.exec(ret)) != null) {
|
||||
// iconlist.push(result[1]);
|
||||
// }
|
||||
var list = Array.from(iconret.matchAll(/mdi-(.*?):before/g));
|
||||
for (let index = 1; index < list.length; index++) {
|
||||
//const element = list[index];
|
||||
iconlist.push(list[index][1]);
|
||||
|
||||
}
|
||||
iconfunc();
|
||||
});
|
||||
} else {
|
||||
iconfunc();
|
||||
}
|
||||
});
|
||||
$(document).on('click', '#chooseicon ul li', function () {
|
||||
$("input#icon").val('mdi mdi-' + $(this).data("font")).trigger("change");
|
||||
Layer.closeAll();
|
||||
});
|
||||
$(document).on('keyup', 'input.js-icon-search', function () {
|
||||
$("#chooseicon ul li").show();
|
||||
if ($(this).val() != '') {
|
||||
$("#chooseicon ul li:not([data-font*='" + $(this).val() + "'])").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
return AdminRule
|
||||
});
|
||||
@@ -0,0 +1,175 @@
|
||||
define(['table', 'upload','form','qrcode'], function (Table,Upload,Form) {
|
||||
var Withdrawl = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.networkOption= Config.networkList;
|
||||
window.statuskOption = Config.statusList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/withdrawl/select',
|
||||
add_url: '/app/admin/withdrawl/insert',
|
||||
edit_url: '/app/admin/withdrawl/update',
|
||||
//del_url: '/app/admin/withdrawl/delete',
|
||||
multi_url: '/app/admin/withdrawl/multi',
|
||||
//dragsort_url: '/app/admin/withdrawl/weigh',
|
||||
table: 'withdrawl',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
title: "用户名",
|
||||
field: "user.username",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "手续费",
|
||||
field: "fee",
|
||||
filter: "number",
|
||||
formatter:Table.api.formatter.number,
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "转账金额",
|
||||
field: "recive_amount",
|
||||
filter: "number",
|
||||
formatter:function(v){
|
||||
return Table.api.formatter.number(v/Config.score_to_money_rate)+'元';
|
||||
},
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "网络",
|
||||
field: "network",
|
||||
filter: "select",
|
||||
filterOption:"networkOption",
|
||||
formatter:function(v){
|
||||
return window.networkOption[v];
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "账号",
|
||||
field: "address",
|
||||
formatter: function(v,row){
|
||||
if(row.network == 'TRC-20' || row.network == 'BEP-20'){
|
||||
return Table.api.formatter.address(v,row);
|
||||
}else{
|
||||
return '<a href="/'+row.address_model.img+'" target="_blank" data-img="'+row.address_model.img+'">'+
|
||||
row.title+"<br />"+row.address
|
||||
+'</a>';
|
||||
return row.title+"<br />"+row.address;//Table.api.formatter.address(v,row);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "txid",
|
||||
field: "txid",
|
||||
filter: "string",
|
||||
formatter: Table.api.formatter.txid,
|
||||
visible:false
|
||||
},
|
||||
{
|
||||
title: "转账时间",
|
||||
field: "transfer_at",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible:false
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.status,
|
||||
searchList:window.statuskOption,
|
||||
operate:false,
|
||||
// formatter: function (v,d) {
|
||||
// for (let i = 0; i < window.statuskOption.length; i++) {
|
||||
// if(v===window.statuskOption[i].value){
|
||||
// return '<span class="status-'+v+'">'+window.statuskOption[i].label+'</span>';
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
filter: "select",
|
||||
filterOption:"statuskOption"
|
||||
},
|
||||
{
|
||||
title: "memo",
|
||||
field: "memo",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
visible: false,
|
||||
},
|
||||
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
//当加载数据成功时
|
||||
table.on('load-success.bs.table', function (e, data) {
|
||||
if(data.code === 0){
|
||||
$('#tongji').html('待提现笔数:'+data.wait_count+',待提现金额:'+data.wait_amount);
|
||||
}
|
||||
});
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
$(document).on('mouseenter','a[data-address],a[data-img]',function(){
|
||||
if($('#withdral_helper').length == 0){
|
||||
$('body').append('<div id="withdral_helper"><p></p><div></div></div>');
|
||||
}
|
||||
var amount = $(this).parents('tr').find('td').eq(4).html();
|
||||
$('#withdral_helper').css({
|
||||
top:$(this).offset().top-128,
|
||||
left:$(this).offset().left+50,
|
||||
});
|
||||
$('#withdral_helper p').html("金额:"+amount);
|
||||
$('#withdral_helper div').empty();
|
||||
if($(this).data("img")){
|
||||
$('#withdral_helper div').html('<img src="/'+$(this).data("img")+'" />');
|
||||
}else{
|
||||
$('#withdral_helper div').qrcode({
|
||||
width: 128,height: 128,
|
||||
text: $(this).data("address")
|
||||
});
|
||||
}
|
||||
$('#withdral_helper').show();
|
||||
}).on('mouseleave','a[data-address]',function(){
|
||||
$('#withdral_helper').hide();
|
||||
})
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return Withdrawl
|
||||
});
|
||||
@@ -0,0 +1,235 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var User = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.filterData = {
|
||||
"order_id":{value1:Fast.api.query('ids'),symbol:'=','value2':''}
|
||||
};
|
||||
window.groupOption=Config.groupList;
|
||||
window.roleOption=Config.roleList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/workrecord/select',
|
||||
add_url: null,
|
||||
edit_url: '/app/admin/workrecord/update',
|
||||
del_url: null,
|
||||
multi_url: '/app/admin/workrecord/multi',
|
||||
dragsort_url: null,
|
||||
table: 'work_record',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "订单号",
|
||||
field: "order_id"
|
||||
},
|
||||
{
|
||||
title: "开始时间",
|
||||
field: "start_time",
|
||||
formatter:Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
title: "结束时间",
|
||||
field: "end_time",
|
||||
formatter:Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
},
|
||||
{
|
||||
field: 'operate', title: '操作',
|
||||
table: table, events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
insert:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
getRole:function(){
|
||||
Fast.api.ajax({
|
||||
url: "/app/admin/UserRole/select?format=tree",
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
Layer.closeAll();
|
||||
var html = "";
|
||||
var selected=$('#roles').data('value');
|
||||
for (let index = 0; index < res.data.length; index++) {
|
||||
const element = res.data[index];
|
||||
if(selected == element.id){
|
||||
html+='<option value="'+element.id+'" selected>'+element.name+'</option>';
|
||||
}else{
|
||||
html+='<option value="'+element.id+'">'+element.name+'</option>';
|
||||
}
|
||||
}
|
||||
$('#roles').append(html);
|
||||
}
|
||||
});
|
||||
},
|
||||
team:function(){
|
||||
window.filterData = {
|
||||
"user_id":{value1:Fast.api.query('ids'),symbol:'=','value2':''},
|
||||
'type' : {value1:'child',symbol:'=','value2':''}
|
||||
};
|
||||
|
||||
$('.nav-tabs li').on('click',function(){
|
||||
$('.nav-tabs li').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
window.filterData['type'] = {value1:$(this).data('type'),symbol:'=','value2':''};
|
||||
table.bootstrapTable('selectPage', 1);
|
||||
});
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/team/select',
|
||||
add_url: null,
|
||||
edit_url: null,
|
||||
del_url: null,
|
||||
multi_url: null,
|
||||
dragsort_url: null,
|
||||
table: 'team',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
title: "深度",
|
||||
field: "depth",
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "角色",
|
||||
field: "role",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "用户名",
|
||||
field: "username",
|
||||
filter: "string",
|
||||
},
|
||||
// {
|
||||
// title: "等级",
|
||||
// field: "level",
|
||||
// visible: false,
|
||||
// },
|
||||
{
|
||||
title: "余额",
|
||||
field: "money",
|
||||
formatter:Table.api.formatter.number,
|
||||
sortable: true,
|
||||
//visible: false,
|
||||
},
|
||||
{
|
||||
title: "积分",
|
||||
field: "score",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "待结算",
|
||||
field: "currency1",
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "失效算力",
|
||||
field: "currency2",
|
||||
sortable: true,
|
||||
formatter:Table.api.formatter.number
|
||||
},
|
||||
{
|
||||
title: "登录时间",
|
||||
field: "last_time",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "登录ip",
|
||||
field: "last_ip",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "注册时间",
|
||||
field: "join_time",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
filter:'datetime'
|
||||
},
|
||||
{
|
||||
title: "注册ip",
|
||||
field: "join_ip",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
}
|
||||
};
|
||||
return User
|
||||
});
|
||||
@@ -0,0 +1,119 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var User = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.filterData = {
|
||||
};
|
||||
window.statusOption = Config.statusList;
|
||||
window.typeOption = Config.typeList;
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/xuanchuan/select',
|
||||
add_url: '/app/admin/xuanchuan/insert',
|
||||
edit_url: '/app/admin/xuanchuan/update',
|
||||
del_url: '/app/admin/xuanchuan/delete',
|
||||
multi_url: '/app/admin/xuanchuan/multi',
|
||||
dragsort_url: '/app/admin/xuanchuan/weigh',
|
||||
table: 'user_xuanchuan',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "类型",
|
||||
field: "type",
|
||||
formatter:function(v,row){
|
||||
for (let i = 0; i < Config.typeList.length; i++) {
|
||||
if(Config.typeList[i].value == v){
|
||||
return Config.typeList[i].label;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
},
|
||||
filter: "select",
|
||||
filterOption:"groupOption",
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "用户",
|
||||
field: "user_id",
|
||||
formatter:function(v,row){
|
||||
return row.user.username;
|
||||
},
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "图片",
|
||||
field: "files",
|
||||
// formatter:Table.api.formatter.images,
|
||||
// operate:Table.api.events.image
|
||||
formatter:function(v){
|
||||
var html='<ul class="list-inline clearfix lyear-uploads-pic">';
|
||||
v=v.split(',');
|
||||
for (let i = 0; i < v.length; i++) {
|
||||
html+= '<li class="col-xs-4 col-sm-3 col-md-2 previewitem">'
|
||||
+' <figure class="btn-preview">'
|
||||
+' <img src="'+Fast.api.cdnurl(v[i])+'" width="120" data-url="'+Fast.api.cdnurl(v[i])+'" alt="图片一" class="img-sm img-center img-responsive">'
|
||||
+' </figure>'
|
||||
+'</li>';
|
||||
}
|
||||
return html+'</ul>';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
field: "created_at"
|
||||
},
|
||||
{
|
||||
title: "更新时间",
|
||||
field: "updated_at",
|
||||
formatter:Table.api.formatter.datetime,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch,
|
||||
filter:'select',
|
||||
filterOption:'statusOption'
|
||||
},
|
||||
{
|
||||
field: 'operate', title: '操作',
|
||||
table: table, events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form);
|
||||
},
|
||||
insert:function(){
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form);
|
||||
}
|
||||
};
|
||||
return User
|
||||
});
|
||||
Reference in New Issue
Block a user