将js代码架构改为app下渲染;

This commit is contained in:
2023-09-18 16:32:46 +08:00
parent 4d9434454e
commit ca729da0a9
86 changed files with 1572 additions and 719 deletions

View File

@@ -15,7 +15,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
index: function () {
var uidList = [];
ea.table.render({
ua.table.render({
init: init,
size: 'sm',
limit: 50,
@@ -51,13 +51,13 @@ define(["jquery", "easy-admin"], function ($, ea) {
]
});
ea.listen();
ua.listen();
},
add: function () {
ea.listen();
ua.listen();
},
edit: function () {
ea.listen();
ua.listen();
},
};
return Controller;

View File

@@ -3,8 +3,8 @@ define(["jquery", "easy-admin", "echarts", "echarts-theme", "miniAdmin"], functi
var Controller = {
index: function () {
var options = {
iniUrl: ea.url('ajax/initAdmin'), // 初始化接口
clearUrl: ea.url("ajax/clearCache"), // 缓存清理接口
iniUrl: ua.url('ajax/initAdmin'), // 初始化接口
clearUrl: ua.url("ajax/clearCache"), // 缓存清理接口
urlHashLocation: true, // 是否打开hash定位
bgColorDefault: false, // 主题默认配置
multiModule: true, // 是否开启多模块
@@ -16,12 +16,12 @@ define(["jquery", "easy-admin", "echarts", "echarts-theme", "miniAdmin"], functi
miniAdmin.render(options);
$('.login-out').on("click", function () {
ea.request.get({
ua.request.get({
url: 'login/out',
prefix: true,
}, function (res) {
ea.msg.success(res.msg, function () {
window.location = ea.url('login/index');
ua.msg.success(res.msg, function () {
window.location = ua.url('login/index');
})
});
});
@@ -108,13 +108,13 @@ define(["jquery", "easy-admin", "echarts", "echarts-theme", "miniAdmin"], functi
clearInterval(checkChartVisibleTimer)
}
}, 3000);
ea.listen();
ua.listen();
},
editAdmin: function () {
ea.listen();
ua.listen();
},
editPassword: function () {
ea.listen();
ua.listen();
}
};
return Controller;

View File

@@ -3,49 +3,7 @@ define(["easy-admin"], function (ea) {
var Controller = {
index: function () {
if (top.location !== self.location) {
top.location = self.location;
}
$('.bind-password').on('click', function () {
if ($(this).hasClass('icon-5')) {
$(this).removeClass('icon-5');
$("input[name='password']").attr('type', 'password');
} else {
$(this).addClass('icon-5');
$("input[name='password']").attr('type', 'text');
}
});
$('.icon-nocheck').on('click', function () {
if ($(this).hasClass('icon-check')) {
$(this).removeClass('icon-check');
} else {
$(this).addClass('icon-check');
}
});
$('.login-tip').on('click', function () {
$('.icon-nocheck').click();
});
ea.listen(function (data) {
data['keep_login'] = $('.icon-nocheck').hasClass('icon-check') ? 1 : 0;
return data;
}, function (res) {
ea.msg.success(res.msg, function () {
window.location = ea.url('index');
})
}, function (res) {
ea.msg.error(res.msg, function () {
$('#refreshCaptcha').trigger("click");
});
});
$('.forget-password').click(function () {
layer.msg('可以使用重置密码命令设置:<br/>php think admin:resetPassword<br><a target="_blank" href="http://doc.ulthon.com/home/read/ulthon_admin/reset_password/15/16.html"> 参考文档</a>')
})
},
};

View File

@@ -14,28 +14,28 @@ define(["jquery", "easy-admin"], function ($, ea) {
var Controller = {
index: function () {
ea.table.render({
ua.table.render({
init: init,
cols: [[
{type: "checkbox"},
{field: 'id', width: 80, title: 'ID'},
{field: 'sort', width: 80, title: '排序', edit: 'text'},
{field: 'title', minWidth: 80, title: '分类名称'},
{field: 'image', minWidth: 80, title: '分类图片', search: false, templet: ea.table.image},
{field: 'image', minWidth: 80, title: '分类图片', search: false, templet: ua.table.image},
{field: 'remark', minWidth: 80, title: '备注信息'},
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ua.table.switch},
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
{width: 250, title: '操作', templet: ea.table.tool}
{width: 250, title: '操作', templet: ua.table.tool}
]],
});
ea.listen();
ua.listen();
},
add: function () {
ea.listen();
ua.listen();
},
edit: function () {
ea.listen();
ua.listen();
},
};
return Controller;

View File

@@ -17,21 +17,21 @@ define(["jquery", "easy-admin"], function ($, ea) {
var Controller = {
index: function () {
ea.table.render({
ua.table.render({
init: init,
totalRow: true,
cols: [[
{ type: "checkbox" },
{ field: 'id', width: 80, title: 'ID', totalRowText: '合计:' },
{ field: 'sort', width: 80, title: '排序', edit: 'text' },
{ field: 'cate_id', minWidth: 80, title: '商品分类', selectList: ea.getDataBrage('select_list_cate'), selectValue: 'id', selectLabel: 'title', defaultSearchValue: ea.getQueryVariable('cate_id', '') },
{ field: 'cate.image', minWidth: 80, title: '分类图片', search: false, templet: ea.table.image },
{ field: 'cate_id', minWidth: 80, title: '商品分类', selectList: ua.getDataBrage('select_list_cate'), selectValue: 'id', selectLabel: 'title', defaultSearchValue: ua.getQueryVariable('cate_id', '') },
{ field: 'cate.image', minWidth: 80, title: '分类图片', search: false, templet: ua.table.image },
{ field: 'title', minWidth: 80, title: '商品名称', },
{ field: 'logo', minWidth: 80, title: '商品图片', search: false, templet: ea.table.image },
{ field: 'market_price', width: 100, title: '市场价', templet: ea.table.price },
{ field: 'logo', minWidth: 80, title: '商品图片', search: false, templet: ua.table.image },
{ field: 'market_price', width: 100, title: '市场价', templet: ua.table.price },
{
field: 'discount_price', width: 120, title: '折扣价', templet: ea.table.price, totalRow: true,
templet: ea.table.copyText,
field: 'discount_price', width: 120, title: '折扣价', templet: ua.table.price, totalRow: true,
templet: ua.table.copyText,
valueParser(value) {
return '¥' + value
},
@@ -53,12 +53,12 @@ define(["jquery", "easy-admin"], function ($, ea) {
},
{ field: 'virtual_sales', width: 100, title: '虚拟销量' },
{ field: 'sales', width: 80, title: '销量' },
{ field: 'status', title: '状态', width: 85, selectList: { 0: '禁用', 1: '启用' }, templet: ea.table.switch },
{ field: 'status', title: '状态', width: 85, selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
{
width: 250,
title: '操作',
templet: ea.table.tool,
templet: ua.table.tool,
fixed: 'right',
operat: [
'edit',
@@ -81,19 +81,19 @@ define(["jquery", "easy-admin"], function ($, ea) {
]],
});
ea.listen();
ua.listen();
},
add: function () {
ea.listen();
ua.listen();
},
edit: function () {
ea.listen();
ua.listen();
},
stock: function () {
ea.listen();
ua.listen();
},
read: function () {
ea.listen();
ua.listen();
},
};
return Controller;

View File

@@ -14,23 +14,23 @@ define(["jquery", "easy-admin"], function ($, ea) {
var Controller = {
index: function () {
ea.table.render({
ua.table.render({
init: init,
cols: [[
{type: 'checkbox'},
{field: 'id', title: 'id'},
{field: 'title', title: '名称'},
{width: 250, title: '操作', templet: ea.table.tool},
{width: 250, title: '操作', templet: ua.table.tool},
]],
});
ea.listen();
ua.listen();
},
add: function () {
ea.listen();
ua.listen();
},
edit: function () {
ea.listen();
ua.listen();
},
};
return Controller;

View File

@@ -12,10 +12,10 @@ define(["jquery", "easy-admin"], function ($, ea) {
password_url: 'system.admin/password',
};
var authList = ea.getDataBrage('auth_list', []);
var count = ea.getDataBrage('count', 0);
var tips = ea.getDataBrage('tips', '');
var tips = ea.getDataBrage('adminCustomFlag');
var authList = ua.getDataBrage('auth_list', []);
var count = ua.getDataBrage('count', 0);
var tips = ua.getDataBrage('tips', '');
var tips = ua.getDataBrage('adminCustomFlag');
console.log(authList);
console.log(count);
@@ -25,24 +25,24 @@ define(["jquery", "easy-admin"], function ($, ea) {
index: function () {
ea.table.render({
ua.table.render({
init: init,
cols: [[
{ type: "checkbox" },
{ field: 'id', width: 80, title: 'ID' },
{ field: 'sort', width: 80, title: '排序', edit: 'text' },
{ field: 'username', minWidth: 80, title: '登录账户' },
{ field: 'head_img', minWidth: 80, title: '头像', search: false, templet: ea.table.image },
{ field: 'head_img', minWidth: 80, title: '头像', search: false, templet: ua.table.image },
{ field: 'phone', minWidth: 80, title: '手机' },
{ field: 'login_num', minWidth: 80, title: '登录次数' },
{ field: 'remark', minWidth: 80, title: '备注信息', defaultValue: '无' },
{ field: 'status', title: '状态', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ea.table.switch },
{ field: 'status', title: '状态', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
{
width: 250,
title: '操作',
fixed: 'right',
templet: ea.table.tool,
templet: ua.table.tool,
operat: [
'edit',
[{
@@ -59,16 +59,16 @@ define(["jquery", "easy-admin"], function ($, ea) {
]],
});
ea.listen();
ua.listen();
},
add: function () {
ea.listen();
ua.listen();
},
edit: function () {
ea.listen();
ua.listen();
},
password: function () {
ea.listen();
ua.listen();
}
};
return Controller;

View File

@@ -15,7 +15,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
var Controller = {
index: function () {
ea.table.render({
ua.table.render({
init: init,
cols: [[
{type: "checkbox"},
@@ -23,12 +23,12 @@ define(["jquery", "easy-admin"], function ($, ea) {
{field: 'sort', width: 80, title: '排序', edit: 'text'},
{field: 'title', minWidth: 80, title: '权限名称'},
{field: 'remark', minWidth: 80, title: '备注信息'},
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ua.table.switch},
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
{
width: 250,
title: '操作',
templet: ea.table.tool,
templet: ua.table.tool,
operat: [
'edit',
[{
@@ -44,18 +44,18 @@ define(["jquery", "easy-admin"], function ($, ea) {
]],
});
ea.listen();
ua.listen();
},
add: function () {
ea.listen();
ua.listen();
},
edit: function () {
ea.listen();
ua.listen();
},
authorize: function () {
var tree = layui.tree;
ea.request.get(
ua.request.get(
{
url: window.location.href,
}, function (res) {
@@ -69,7 +69,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
}
);
ea.listen(function (data) {
ua.listen(function (data) {
var checkedData = tree.getChecked('nodeDataId');
var ids = [];
$.each(checkedData, function (i, v) {

View File

@@ -13,7 +13,7 @@ define(["jquery", "easy-admin", "vue"], function ($, ea, Vue) {
$('.show-type-item.' + this.value).show();
});
ea.listen();
ua.listen();
}
};
return Controller;

View File

@@ -26,18 +26,18 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
homdPid: 99999999,
treeIdName: 'id',
treePidName: 'pid',
url: ea.url(init.index_url),
url: ua.url(init.index_url),
elem: init.table_elem,
id: init.table_render_id,
toolbar: '#toolbar',
page: false,
skin: 'line',
// @todo 不直接使用ea.table.render(); 进行表格初始化, 需要使用 ea.table.formatCols(); 方法格式化`cols`列数据
cols: ea.table.formatCols([[
// @todo 不直接使用ua.table.render(); 进行表格初始化, 需要使用 ua.table.formatCols(); 方法格式化`cols`列数据
cols: ua.table.formatCols([[
{ type: 'checkbox' },
{ field: 'title', sort: false, width: 250, title: '菜单名称', align: 'left' },
{ field: 'icon', sort: false, width: 80, title: '图标', templet: ea.table.icon },
{ field: 'icon', sort: false, width: 80, title: '图标', templet: ua.table.icon },
{ field: 'href', sort: false, minWidth: 120, title: '菜单链接' },
{
field: 'is_home', sort: false,
@@ -54,13 +54,13 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
}
}
},
{ field: 'status', sort: false, title: '状态', width: 85, templet: ea.table.switch },
{ field: 'status', sort: false, title: '状态', width: 85, templet: ua.table.switch },
{ field: 'sort', sort: false, width: 80, title: '排序', edit: 'text' },
{
width: 220,
title: '操作',
fixed: 'right',
templet: ea.table.tool,
templet: ua.table.tool,
operat: [
[{
text: '添加下级',
@@ -94,7 +94,7 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
data: ['id', 'title'],
_if(data) {
if (data.pid == ea.getDataBrage('menu_home_pid')) {
if (data.pid == ua.getDataBrage('menu_home_pid')) {
return false
}
@@ -126,15 +126,15 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
$('body').on('click', '[data-treetable-delete-item]', function () {
var id = $(this).data('id');
var url = $(this).attr('data-url');
url = url != undefined ? ea.url(url) : window.location.href;
ea.msg.confirm('确定删除?', function () {
ea.request.post({
url = url != undefined ? ua.url(url) : window.location.href;
ua.msg.confirm('确定删除?', function () {
ua.request.post({
url: url,
data: {
id: id
},
}, function (res) {
ea.msg.success(res.msg, function () {
ua.msg.success(res.msg, function () {
renderTable();
});
});
@@ -146,25 +146,25 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
var tableId = $(this).attr('data-treetable-delete'),
url = $(this).attr('data-url');
tableId = tableId || init.table_render_id;
url = url != undefined ? ea.url(url) : window.location.href;
url = url != undefined ? ua.url(url) : window.location.href;
var checkStatus = table.checkStatus(tableId),
data = checkStatus.data;
if (data.length <= 0) {
ea.msg.error('请勾选需要删除的数据');
ua.msg.error('请勾选需要删除的数据');
return false;
}
var ids = [];
$.each(data, function (i, v) {
ids.push(v.id);
});
ea.msg.confirm('确定删除?', function () {
ea.request.post({
ua.msg.confirm('确定删除?', function () {
ua.request.post({
url: url,
data: {
id: ids
},
}, function (res) {
ea.msg.success(res.msg, function () {
ua.msg.success(res.msg, function () {
renderTable();
});
});
@@ -172,11 +172,11 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
return false;
});
ea.table.listenSwitch({ filter: 'status', url: init.modify_url });
ua.table.listenSwitch({ filter: 'status', url: init.modify_url });
ea.table.listenEdit(init, 'currentTable', init.table_render_id, false);
ua.table.listenEdit(init, 'currentTable', init.table_render_id, false);
ea.listen();
ua.listen();
},
add: function () {
iconPickerFa.render({
@@ -192,17 +192,17 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
});
autocomplete.render({
elem: $('#href')[0],
url: ea.url('system.menu/getMenuTips'),
url: ua.url('system.menu/getMenuTips'),
template_val: '{{-d.node}}',
template_txt: '{{-d.node}} <span class=\'layui-badge layui-bg-gray\'>{{-d.title}}</span>',
onselect: function (resp) {
}
});
ea.listen(function (data) {
ua.listen(function (data) {
return data;
}, function (res) {
ea.msg.success(res.msg, function () {
ua.msg.success(res.msg, function () {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
parent.$('[data-treetable-refresh]').trigger("click");
@@ -223,17 +223,17 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
});
autocomplete.render({
elem: $('#href')[0],
url: ea.url('system.menu/getMenuTips'),
url: ua.url('system.menu/getMenuTips'),
template_val: '{{-d.node}}',
template_txt: '{{-d.node}} <span class=\'layui-badge layui-bg-gray\'>{{-d.title}}</span>',
onselect: function (resp) {
}
});
ea.listen(function (data) {
ua.listen(function (data) {
return data;
}, function (res) {
ea.msg.success(res.msg, function () {
ua.msg.success(res.msg, function () {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
parent.$('[data-treetable-refresh]').trigger("click");

View File

@@ -13,7 +13,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
var Controller = {
index: function () {
ea.table.render({
ua.table.render({
init: init,
search: false,
page: false,
@@ -52,17 +52,17 @@ define(["jquery", "easy-admin"], function ($, ea) {
{ field: 'node', sort: false, minWidth: 200, align: 'left', title: '系统节点' },
{ field: 'title', sort: false, minWidth: 80, title: '节点名称 <i class="table-edit-tips color-red">*</i>', edit: 'text' },
{ field: 'update_time', sort: false, minWidth: 80, title: '更新时间', search: 'range' },
{ field: 'is_auth', sort: false, title: '节点控制', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ea.table.switch },
{ field: 'is_auth', sort: false, title: '节点控制', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
]],
});
ea.listen();
ua.listen();
},
add: function () {
ea.listen();
ua.listen();
},
edit: function () {
ea.listen();
ua.listen();
}
};
return Controller;

View File

@@ -17,23 +17,23 @@ define(["jquery", "easy-admin", "iconPickerFa", "autocomplete"], function ($, ea
var Controller = {
index: function () {
ea.table.render({
ua.table.render({
init: init,
cols: [[
{type: "checkbox"},
{field: 'id', width: 80, title: 'ID'},
{field: 'sort', width: 80, title: '排序', edit: 'text'},
{field: 'title', minWidth: 80, title: '权限名称'},
{field: 'icon', width: 80, title: '图标', templet: ea.table.icon},
{field: 'icon', width: 80, title: '图标', templet: ua.table.icon},
{field: 'href', minWidth: 120, title: '快捷链接'},
{field: 'remark', minWidth: 80, title: '备注信息'},
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ua.table.switch},
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
{width: 250, title: '操作', templet: ea.table.tool, operat: ['edit', 'delete']}
{width: 250, title: '操作', templet: ua.table.tool, operat: ['edit', 'delete']}
]],
});
ea.listen();
ua.listen();
},
add: function () {
iconPickerFa.render({
@@ -49,14 +49,14 @@ define(["jquery", "easy-admin", "iconPickerFa", "autocomplete"], function ($, ea
});
autocomplete.render({
elem: $('#href')[0],
url: ea.url('system.menu/getMenuTips'),
url: ua.url('system.menu/getMenuTips'),
template_val: '{{d.node}}',
template_txt: '{{d.node}} <span class=\'layui-badge layui-bg-gray\'>{{d.title}}</span>',
onselect: function (resp) {
}
});
ea.listen();
ua.listen();
},
edit: function () {
iconPickerFa.render({
@@ -72,14 +72,14 @@ define(["jquery", "easy-admin", "iconPickerFa", "autocomplete"], function ($, ea
});
autocomplete.render({
elem: $('#href')[0],
url: ea.url('system.menu/getMenuTips'),
url: ua.url('system.menu/getMenuTips'),
template_val: '{{d.node}}',
template_txt: '{{d.node}} <span class=\'layui-badge layui-bg-gray\'>{{d.title}}</span>',
onselect: function (resp) {
}
});
ea.listen();
ua.listen();
},
};
return Controller;

View File

@@ -14,15 +14,15 @@ define(["jquery", "easy-admin"], function ($, ea) {
var Controller = {
index: function () {
ea.table.render({
ua.table.render({
init: init,
cols: [[
{ type: "checkbox" },
{ field: 'id', width: 80, title: 'ID' },
{ field: 'upload_type', minWidth: 80, title: '存储位置', search: 'select', selectList: { 'local': '本地', 'alioss': '阿里云', 'qnoss': '七牛云', ',txcos': '腾讯云' } },
{ field: 'url', minWidth: 80, search: false, title: '文件预览', templet: ea.table.filePreview },
{ field: 'url', minWidth: 80, search: false, title: '文件预览', templet: ua.table.filePreview },
{
field: 'url', minWidth: 120, title: '保存地址', templet: ea.table.url, urlNameField: function (data) {
field: 'url', minWidth: 120, title: '保存地址', templet: ua.table.url, urlNameField: function (data) {
return data.url;
}
},
@@ -31,8 +31,8 @@ define(["jquery", "easy-admin"], function ($, ea) {
{ field: 'file_ext', minWidth: 80, title: '文件后缀' },
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
{
width: 250, title: '操作', templet: ea.table.tool, operat: ['delete'], fixed: 'right', hide: function () {
var selectMode = ea.getQueryVariable("select_mode");
width: 250, title: '操作', templet: ua.table.tool, operat: ['delete'], fixed: 'right', hide: function () {
var selectMode = ua.getQueryVariable("select_mode");
console.log(selectMode);
if (selectMode == 'radio' || selectMode == 'checkbox') {
@@ -44,16 +44,16 @@ define(["jquery", "easy-admin"], function ($, ea) {
]],
});
ea.listen();
ua.listen();
},
add: function () {
ea.listen();
ua.listen();
},
edit: function () {
ea.listen();
ua.listen();
},
password: function () {
ea.listen();
ua.listen();
}
};
return Controller;