init commit

This commit is contained in:
2026-03-17 09:56:00 +08:00
commit e2c8ae752d
6827 changed files with 1211784 additions and 0 deletions

180
public/assets/js/addons.js Normal file
View File

@@ -0,0 +1,180 @@
define([], function () {
require([], function () {
//绑定data-toggle=addresspicker属性点击事件
$(document).on('click', "[data-toggle='addresspicker']", function () {
var that = this;
var callback = $(that).data('callback');
var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
var lat_id = $(that).data("lat-id") ? $(that).data("lat-id") : "";
var lng_id = $(that).data("lng-id") ? $(that).data("lng-id") : "";
var zoom_id = $(that).data("zoom-id") ? $(that).data("zoom-id") : "";
var lat = lat_id ? $("#" + lat_id).val() : '';
var lng = lng_id ? $("#" + lng_id).val() : '';
var zoom = zoom_id ? $("#" + zoom_id).val() : '';
var url = "/addons/address/index/select";
url += (lat && lng) ? '?lat=' + lat + '&lng=' + lng + (input_id ? "&address=" + $("#" + input_id).val() : "") + (zoom ? "&zoom=" + zoom : "") : '';
Fast.api.open(url, '位置选择', {
callback: function (res) {
input_id && $("#" + input_id).val(res.address).trigger("change");
lat_id && $("#" + lat_id).val(res.lat).trigger("change");
lng_id && $("#" + lng_id).val(res.lng).trigger("change");
zoom_id && $("#" + zoom_id).val(res.zoom).trigger("change");
try {
//执行回调函数
if (typeof callback === 'function') {
callback.call(that, res);
}
} catch (e) {
}
}
});
});
});
require.config({
paths: {
'summernote': '../addons/summernote/lang/summernote-zh-CN.min'
},
shim: {
'summernote': ['../addons/summernote/js/summernote.min', 'css!../addons/summernote/css/summernote.min.css'],
}
});
require(['form', 'upload'], function (Form, Upload) {
var _bindevent = Form.events.bindevent;
Form.events.bindevent = function (form) {
_bindevent.apply(this, [form]);
try {
//绑定summernote事件
if ($(Config.summernote.classname || '.editor', form).length > 0) {
var selectUrl = typeof Config !== 'undefined' && Config.modulename === 'index' ? 'user/attachment' : 'general/attachment/select';
require(['summernote'], function () {
var imageButton = function (context) {
var ui = $.summernote.ui;
var button = ui.button({
contents: '<i class="fa fa-file-image-o"/>',
tooltip: __('Choose'),
click: function () {
parent.Fast.api.open(selectUrl + "?element_id=&multiple=true&mimetype=image/", __('Choose'), {
callback: function (data) {
var urlArr = data.url.split(/\,/);
$.each(urlArr, function () {
var url = Fast.api.cdnurl(this, true);
context.invoke('editor.insertImage', url);
});
}
});
return false;
}
});
return button.render();
};
var attachmentButton = function (context) {
var ui = $.summernote.ui;
var button = ui.button({
contents: '<i class="fa fa-file"/>',
tooltip: __('Choose'),
click: function () {
parent.Fast.api.open(selectUrl + "?element_id=&multiple=true&mimetype=*", __('Choose'), {
callback: function (data) {
var urlArr = data.url.split(/\,/);
$.each(urlArr, function () {
var url = Fast.api.cdnurl(this, true);
var node = $("<a href='" + url + "'>" + url + "</a>");
context.invoke('insertNode', node[0]);
});
}
});
return false;
}
});
return button.render();
};
$(Config.summernote.classname || '.editor', form).each(function () {
$(this).summernote($.extend(true, {}, {
// height: 250,
minHeight: 250,
lang: 'zh-CN',
fontNames: [
'Arial', 'Arial Black', 'Serif', 'Sans', 'Courier',
'Courier New', 'Comic Sans MS', 'Helvetica', 'Impact', 'Lucida Grande',
"Open Sans", "Hiragino Sans GB", "Microsoft YaHei",
'微软雅黑', '宋体', '黑体', '仿宋', '楷体', '幼圆',
],
fontNamesIgnoreCheck: [
"Open Sans", "Microsoft YaHei",
'微软雅黑', '宋体', '黑体', '仿宋', '楷体', '幼圆'
],
toolbar: [
['style', ['style', 'undo', 'redo']],
['font', ['bold', 'underline', 'strikethrough', 'clear']],
['fontname', ['color', 'fontname', 'fontsize']],
['para', ['ul', 'ol', 'paragraph', 'height']],
['table', ['table', 'hr']],
['insert', ['link', 'picture', 'video']],
['select', ['image', 'attachment']],
['view', ['fullscreen', 'codeview', 'help']],
],
buttons: {
image: imageButton,
attachment: attachmentButton,
},
dialogsInBody: true,
followingToolbar: false,
callbacks: {
onChange: function (contents) {
$(this).val(contents);
$(this).trigger('change');
},
onInit: function () {
},
onImageUpload: function (files) {
var that = this;
//依次上传图片
for (var i = 0; i < files.length; i++) {
Upload.api.send(files[i], function (data) {
var url = Fast.api.cdnurl(data.url, true);
$(that).summernote("insertImage", url, 'filename');
});
}
}
}
}, $(this).data("summernote-options") || {}));
});
});
}
} catch (e) {
}
};
});
require.config({
paths: {
'wdsxh-colorpicker': '../addons/wdsxh/libs/colorpicker/colorpicker',
'poster': '../addons/wdsxh/libs/poster',
'clipboard': '../addons/wdsxh/libs/clipboard.min',
'designer': '../addons/wdsxh/libs/designer',
'jquery-contextMenu': '../addons/wdsxh/libs/jquery.contextMenu',
'jquery-form': '../addons/wdsxh/libs/jquery.form',
'jquery-lazyload': '../addons/wdsxh/libs/jquery.lazyload.min',
},
// shim依赖配置
shim: {
'wdsxh-colorpicker': ['css!../addons/wdsxh/libs/colorpicker/colorpicker.css'],
'poster': ['css!../addons/wdsxh/libs/poster.css'],
'jquery-contextMenu': ['css!../addons/wdsxh/libs/jquery.contextMenu.css'],
'animation': ['css!../addons/wdsxh/libs/colorui/animation.css'],
'jquery-form': ['css!../addons/wdsxh/libs/colorui/coloriui-forh5.css'],
'ColorUi-simplified': ['css!../addons/wdsxh/libs/colorui/ColorUi-simplified.css'],
'icon': ['css!../addons/wdsxh/libs/colorui/icon.css'],
},
});
});

View File

@@ -0,0 +1,893 @@
/*! AdminLTE app.js
* ================
* Main JS application file for AdminLTE v2. This file
* should be included in all pages. It controls some layout
* options and implements exclusive AdminLTE plugins.
*
* @Author Almsaeed Studio
* @Support <http://www.almsaeedstudio.com>
* @Email <abdullah@almsaeedstudio.com>
* @version 2.3.8
* @license MIT <http://opensource.org/licenses/MIT>
*/
//Make sure jQuery has been loaded before app.js
if (typeof jQuery === "undefined") {
throw new Error("AdminLTE requires jQuery");
}
/* AdminLTE
*
* @type Object
* @description $.AdminLTE is the main object for the template's app.
* It's used for implementing functions and options related
* to the template. Keeping everything wrapped in an object
* prevents conflict with other plugins and is a better
* way to organize our code.
*/
$.AdminLTE = {};
/* --------------------
* - AdminLTE Options -
* --------------------
* Modify these options to suit your implementation
*/
$.AdminLTE.options = {
//Add slimscroll to navbar menus
//This requires you to load the slimscroll plugin
//in every page before app.js
navbarMenuSlimscroll: true,
navbarMenuSlimscrollWidth: "3px", //The width of the scroll bar
navbarMenuHeight: "200px", //The height of the inner menu
//General animation speed for JS animated elements such as box collapse/expand and
//sidebar treeview slide up/down. This options accepts an integer as milliseconds,
//'fast', 'normal', or 'slow'
animationSpeed: 300,
//Sidebar push menu toggle button selector
sidebarToggleSelector: "[data-toggle='offcanvas']",
//Activate sidebar push menu
sidebarPushMenu: true,
//Activate sidebar slimscroll if the fixed layout is set (requires SlimScroll Plugin)
sidebarSlimScroll: true,
//Enable sidebar expand on hover effect for sidebar mini
//This option is forced to true if both the fixed layout and sidebar mini
//are used together
sidebarExpandOnHover: false,
//BoxRefresh Plugin
enableBoxRefresh: true,
//Bootstrap.js tooltip
enableBSToppltip: true,
BSTooltipSelector: "[data-toggle='tooltip']",
//Enable Fast Click. Fastclick.js creates a more
//native touch experience with touch devices. If you
//choose to enable the plugin, make sure you load the script
//before AdminLTE's app.js
enableFastclick: false,
//Control Sidebar Tree views
enableControlTreeView: true,
//Control Sidebar Options
enableControlSidebar: true,
controlSidebarOptions: {
//Which button should trigger the open/close event
toggleBtnSelector: "[data-toggle='control-sidebar']",
//The sidebar selector
selector: ".control-sidebar",
//Enable slide over content
slide: true
},
//Box Widget Plugin. Enable this plugin
//to allow boxes to be collapsed and/or removed
enableBoxWidget: true,
//Box Widget plugin options
boxWidgetOptions: {
boxWidgetIcons: {
//Collapse icon
collapse: 'fa-minus',
//Open icon
open: 'fa-plus',
//Remove icon
remove: 'fa-times'
},
boxWidgetSelectors: {
//Remove button selector
remove: '[data-widget="remove"]',
//Collapse button selector
collapse: '[data-widget="collapse"]'
}
},
//Direct Chat plugin options
directChat: {
//Enable direct chat by default
enable: true,
//The button to open and close the chat contacts pane
contactToggleSelector: '[data-widget="chat-pane-toggle"]'
},
//Define the set of colors to use globally around the website
colors: {
lightBlue: "#3c8dbc",
red: "#f56954",
green: "#00a65a",
aqua: "#00c0ef",
yellow: "#f39c12",
blue: "#0073b7",
navy: "#001F3F",
teal: "#39CCCC",
olive: "#3D9970",
lime: "#01FF70",
orange: "#FF851B",
fuchsia: "#F012BE",
purple: "#8E24AA",
maroon: "#D81B60",
black: "#222222",
gray: "#d2d6de"
},
//The standard screen sizes that bootstrap uses.
//If you change these in the variables.less file, change
//them here too.
screenSizes: {
xs: 480,
sm: 768,
md: 992,
lg: 1200
}
};
/* ------------------
* - Implementation -
* ------------------
* The next block of code implements AdminLTE's
* functions and plugins as specified by the
* options above.
*/
$(function () {
"use strict";
//Fix for IE page transitions
$("body").removeClass("hold-transition");
//Extend options if external options exist
if (typeof AdminLTEOptions !== "undefined") {
$.extend(true,
$.AdminLTE.options,
AdminLTEOptions);
}
if ('ontouchstart' in document.documentElement) {
$.AdminLTE.options.sidebarSlimScroll = false;
$(".main-sidebar").css({height: ($(window).height() - $(".main-header").height()) + "px", overflow: "scroll"});
}
//Easy access to options
var o = $.AdminLTE.options;
//Set up the object
_init();
//Activate the layout maker
$.AdminLTE.layout.activate();
//Enable sidebar tree view controls
if (o.enableControlTreeView) {
$.AdminLTE.tree('.sidebar');
}
//Enable control sidebar
if (o.enableControlSidebar) {
$.AdminLTE.controlSidebar.activate();
}
//Add slimscroll to navbar dropdown
if (o.navbarMenuSlimscroll && typeof $.fn.slimscroll != 'undefined') {
$(".navbar .menu").slimscroll({
height: o.navbarMenuHeight,
alwaysVisible: false,
size: o.navbarMenuSlimscrollWidth
}).css("width", "100%");
}
//Activate sidebar push menu
if (o.sidebarPushMenu) {
$.AdminLTE.pushMenu.activate(o.sidebarToggleSelector);
}
//Activate Bootstrap tooltip
if (o.enableBSToppltip) {
$('body').tooltip({
selector: o.BSTooltipSelector,
container: 'body'
});
}
//Activate box widget
if (o.enableBoxWidget) {
$.AdminLTE.boxWidget.activate();
}
//Activate fast click
if (o.enableFastclick && typeof FastClick != 'undefined') {
FastClick.attach(document.body);
}
//Activate direct chat widget
if (o.directChat.enable) {
$(document).on('click', o.directChat.contactToggleSelector, function () {
var box = $(this).parents('.direct-chat').first();
box.toggleClass('direct-chat-contacts-open');
});
}
/*
* INITIALIZE BUTTON TOGGLE
* ------------------------
*/
$('.btn-group[data-toggle="btn-toggle"]').each(function () {
var group = $(this);
$(this).find(".btn").on('click', function (e) {
group.find(".btn.active").removeClass("active");
$(this).addClass("active");
e.preventDefault();
});
});
});
/* ----------------------------------
* - Initialize the AdminLTE Object -
* ----------------------------------
* All AdminLTE functions are implemented below.
*/
function _init() {
'use strict';
/* Layout
* ======
* Fixes the layout height in case min-height fails.
*
* @type Object
* @usage $.AdminLTE.layout.activate()
* $.AdminLTE.layout.fix()
* $.AdminLTE.layout.fixSidebar()
*/
$.AdminLTE.layout = {
activate: function () {
var _this = this;
//_this.fix();
_this.fixSidebar();
//$('body, html, .wrapper').css('height', 'auto');
$(window, ".wrapper").resize(function () {
//_this.fix();
_this.fixSidebar();
});
},
fix: function () {
// Remove overflow from .wrapper if layout-boxed exists
$(".layout-boxed > .wrapper").css('overflow', 'hidden');
//Get window height and the wrapper height
var footer_height = $('.main-footer').outerHeight() || 0;
var neg = $('.main-header').outerHeight() + footer_height;
var window_height = $(window).height();
var sidebar_height = $(".sidebar").height() || 0;
//Set the min-height of the content and sidebar based on the
//the height of the document.
if ($("body").hasClass("fixed")) {
$(".content-wrapper, .right-side").css('min-height', window_height - footer_height);
} else {
var postSetWidth;
if (window_height >= sidebar_height) {
$(".content-wrapper, .right-side").css('min-height', window_height - neg);
postSetWidth = window_height - neg;
} else {
$(".content-wrapper, .right-side").css('min-height', sidebar_height);
postSetWidth = sidebar_height;
}
//Fix for the control sidebar height
var controlSidebar = $($.AdminLTE.options.controlSidebarOptions.selector);
if (typeof controlSidebar !== "undefined") {
if (controlSidebar.height() > postSetWidth)
$(".content-wrapper, .right-side").css('min-height', controlSidebar.height());
}
}
},
fixSidebar: function () {
//Make sure the body tag has the .fixed class
if (!$("body").hasClass("fixed")) {
if (typeof $.fn.slimScroll != 'undefined') {
$(".sidebar").slimScroll({destroy: true}).height("auto");
}
return;
} else if (typeof $.fn.slimScroll == 'undefined' && window.console) {
window.console.error("Error: the fixed layout requires the slimscroll plugin!");
}
//Enable slimscroll for fixed layout
if ($.AdminLTE.options.sidebarSlimScroll) {
if (typeof $.fn.slimScroll != 'undefined') {
//Destroy if it exists
$(".sidebar").slimScroll({destroy: true}).height("auto").css("overflow", "inherit");
if (!$("body").hasClass('sidebar-collapse')) {
$(".sidebar").off("mousewheel").css("margin-top", 0);
$('.sidebar .treeview-menu').off('mousewheel').removeAttr("style");
//Add slimscroll
$(".sidebar").slimscroll({
height: ($(window).height() - $(".main-header").height()) + "px",
color: "rgba(0,0,0,0.2)",
size: "8px"
});
$(".sidebar").trigger("mouseover");
} else {
var sidebarHeight = $(".sidebar").height();
var maxHeight = $(window).height() - $(".main-header").height();
var overflowHeight = sidebarHeight + $(".main-header").height() - $(window).height();
if (overflowHeight > 0) {
$(".sidebar").height(maxHeight);
$(".sidebar").on("mousewheel", function (e) {
e.preventDefault();
if (e.originalEvent.pageX < $(".sidebar").width()) {
var marginTop = parseInt($(".sidebar").css("margin-top").replace("px", "")) + e.originalEvent.wheelDelta;
if (marginTop < 0 && Math.abs(marginTop) > overflowHeight) {
marginTop = Math.min(overflowHeight, marginTop);
marginTop = -overflowHeight;
}
marginTop = Math.min(0, marginTop);
$(".sidebar").css("margin-top", marginTop);
}
});
$('.sidebar .treeview-menu').on('mousewheel', function (e) {
e.stopPropagation();
});
}
}
}
}
}
};
/* PushMenu()
* ==========
* Adds the push menu functionality to the sidebar.
*
* @type Function
* @usage: $.AdminLTE.pushMenu("[data-toggle='offcanvas']")
*/
$.AdminLTE.pushMenu = {
activate: function (toggleBtn) {
//Get the screen sizes
var screenSizes = $.AdminLTE.options.screenSizes;
//Enable sidebar toggle
$(document).on('click', toggleBtn, function (e) {
e.preventDefault();
//Enable sidebar push menu
if ($(window).width() > (screenSizes.sm - 1)) {
if ($("body").hasClass('sidebar-collapse')) {
$("body").removeClass('sidebar-collapse').trigger('expanded.pushMenu');
} else {
$("body").addClass('sidebar-collapse').trigger('collapsed.pushMenu');
}
}
//Handle sidebar push menu for small screens
else {
if ($("body").hasClass('sidebar-open')) {
$("body").removeClass('sidebar-open').removeClass('sidebar-collapse').trigger('collapsed.pushMenu');
} else {
$("body").addClass('sidebar-open').trigger('expanded.pushMenu');
}
}
$.AdminLTE.layout.fixSidebar();
});
$(".content-wrapper").click(function () {
//Enable hide menu when clicking on the content-wrapper on small screens
if ($(window).width() <= (screenSizes.sm - 1) && $("body").hasClass("sidebar-open")) {
$("body").removeClass('sidebar-open');
}
});
//Enable expand on hover for sidebar mini
if ($.AdminLTE.options.sidebarExpandOnHover) {
this.expandOnHover();
}
},
expandOnHover: function () {
var _this = this;
var screenWidth = $.AdminLTE.options.screenSizes.sm - 1;
//Expand sidebar on hover
$('.main-sidebar').hover(function () {
if ($.AdminLTE.options.sidebarExpandOnHover) {
if ($('body').hasClass('sidebar-mini')
&& $("body").hasClass('sidebar-collapse')
&& $(window).width() > screenWidth) {
_this.expand();
}
}
}, function () {
if ($('body').hasClass('sidebar-mini')
&& $('body').hasClass('sidebar-expanded-on-hover')
&& $(window).width() > screenWidth) {
_this.collapse();
}
});
},
expand: function () {
$("body").removeClass('sidebar-collapse').addClass('sidebar-expanded-on-hover');
$.AdminLTE.layout.fixSidebar();
},
collapse: function () {
if ($('body').hasClass('sidebar-expanded-on-hover')) {
$('body').removeClass('sidebar-expanded-on-hover').addClass('sidebar-collapse');
// $.AdminLTE.layout.fixSidebar();
}
}
};
/* Tree()
* ======
* Converts the sidebar into a multilevel
* tree view menu.
*
* @type Function
* @Usage: $.AdminLTE.tree('.sidebar')
*/
$.AdminLTE.tree = function (menu) {
var _this = this;
var animationSpeed = $.AdminLTE.options.animationSpeed;
$(document).off('mouseenter', menu + ' .sidebar-menu > li')
.on('mouseenter', menu + ' .sidebar-menu > li', function () {
var treemenu = $(this).find("> .treeview-menu");
if (treemenu.length > 0) {
if ($("body").hasClass("sidebar-collapse")) {
var liHeight = $(this).height();
var headerHeight = $(".main-header").height();
var maxBottomHeight = $(window).height() - ($(this).offset().top + headerHeight);
var maxTopHeight = $(window).height() - maxBottomHeight - liHeight;
var maxHeight = maxBottomHeight;
if (maxBottomHeight < 300 || maxTopHeight > maxBottomHeight) {
treemenu.css("top", "unset").css("bottom", liHeight);
maxHeight = maxTopHeight;
}
treemenu.css("max-height", maxHeight).css("overflow-y", "auto");
} else {
treemenu.css("max-height", "inherit").css("overflow-y", "unset");
}
}
});
$(document).off('click', menu + ' li a')
.on('click', menu + ' li a', function (e) {
//Get the clicked link and the next element
var $this = $(this);
var checkElement = $this.next();
//Check if the next element is a menu and is visible
if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible'))) {
if ($("body").hasClass("sidebar-collapse") && $this.parent().parent().hasClass("sidebar-menu")) {
return false;
}
//Close the menu
checkElement.slideUp(animationSpeed, function () {
checkElement.removeClass('menu-open');
//Fix the layout in case the sidebar stretches over the height of the window
//_this.layout.fix();
});
// checkElement.parent("li").removeClass("active");
checkElement.parent("li").removeClass('treeview-open');
}
//If the menu is not visible
else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
//Get the parent menu
var parent = $this.parents('ul').first();
// modified by FastAdmin
if ($(".show-submenu", menu).length == 0) {
//Close all open menus within the parent
var ul = parent.find('ul:visible').slideUp(animationSpeed);
//Remove the menu-open class from the parent
ul.removeClass('menu-open');
parent.find('li.treeview').removeClass("treeview-open");
}
//Get the parent li
var parent_li = $this.parent("li");
//Open the target menu and add the menu-open class
checkElement.slideDown(animationSpeed, function () {
//Add the class active to the parent li
checkElement.addClass('menu-open');
//parent.find('li.active').removeClass('active');
//parent_li.addClass('active');
//Fix the layout in case the sidebar stretches over the height of the window
// _this.layout.fix();
});
parent_li.addClass('treeview-open');
} else {
if (!$this.parent().hasClass("active")) {
// $this.parent().addClass("active");
}
// modified by FastAdmin
if ($(".show-submenu", menu).length == 0 && $this.parent().parent().hasClass("sidebar-menu")) {
$this.parent().siblings().find("ul.menu-open").slideUp();
$this.parent().siblings("li.treeview-open").removeClass("treeview-open");
}
}
//if this isn't a link, prevent the page from being redirected
if (checkElement.is('.treeview-menu')) {
e.preventDefault();
}
});
};
/* ControlSidebar
* ==============
* Adds functionality to the right sidebar
*
* @type Object
* @usage $.AdminLTE.controlSidebar.activate(options)
*/
$.AdminLTE.controlSidebar = {
//instantiate the object
activate: function () {
//Get the object
var _this = this;
//Update options
var o = $.AdminLTE.options.controlSidebarOptions;
//Get the sidebar
var sidebar = $(o.selector);
//The toggle button
var btn = $(o.toggleBtnSelector);
//Listen to the click event
btn.on('click', function (e) {
e.preventDefault();
//If the sidebar is not open
if (!sidebar.hasClass('control-sidebar-open')
&& !$('body').hasClass('control-sidebar-open')) {
//Open the sidebar
_this.open(sidebar, o.slide);
} else {
_this.close(sidebar, o.slide);
}
});
//If the body has a boxed layout, fix the sidebar bg position
var bg = $(".control-sidebar-bg");
_this._fix(bg);
//If the body has a fixed layout, make the control sidebar fixed
if ($('body').hasClass('fixed')) {
_this._fixForFixed(sidebar);
} else {
//If the content height is less than the sidebar's height, force max height
if ($('.content-wrapper, .right-side').height() < sidebar.height()) {
_this._fixForContent(sidebar);
}
}
},
//Open the control sidebar
open: function (sidebar, slide) {
//Slide over content
if (slide) {
sidebar.addClass('control-sidebar-open');
} else {
//Push the content by adding the open class to the body instead
//of the sidebar itself
$('body').addClass('control-sidebar-open');
}
},
//Close the control sidebar
close: function (sidebar, slide) {
if (slide) {
sidebar.removeClass('control-sidebar-open');
} else {
$('body').removeClass('control-sidebar-open');
}
},
_fix: function (sidebar) {
var _this = this;
if ($("body").hasClass('layout-boxed')) {
sidebar.css('position', 'absolute');
sidebar.height($(".wrapper").height());
if (_this.hasBindedResize) {
return;
}
$(window).resize(function () {
_this._fix(sidebar);
});
_this.hasBindedResize = true;
} else {
sidebar.css({
'position': 'fixed',
'height': 'auto'
});
}
},
_fixForFixed: function (sidebar) {
sidebar.css({
'position': 'fixed',
'max-height': '100%',
'overflow': 'auto',
});
},
_fixForContent: function (sidebar) {
$(".content-wrapper, .right-side").css('min-height', sidebar.height());
}
};
/* BoxWidget
* =========
* BoxWidget is a plugin to handle collapsing and
* removing boxes from the screen.
*
* @type Object
* @usage $.AdminLTE.boxWidget.activate()
* Set all your options in the main $.AdminLTE.options object
*/
$.AdminLTE.boxWidget = {
selectors: $.AdminLTE.options.boxWidgetOptions.boxWidgetSelectors,
icons: $.AdminLTE.options.boxWidgetOptions.boxWidgetIcons,
animationSpeed: $.AdminLTE.options.animationSpeed,
activate: function (_box) {
var _this = this;
if (!_box) {
_box = document; // activate all boxes per default
}
//Listen for collapse event triggers
$(_box).on('click', _this.selectors.collapse, function (e) {
e.preventDefault();
_this.collapse($(this));
});
//Listen for remove event triggers
$(_box).on('click', _this.selectors.remove, function (e) {
e.preventDefault();
_this.remove($(this));
});
},
collapse: function (element) {
var _this = this;
//Find the box parent
var box = element.parents(".box").first();
//Find the body and the footer
var box_content = box.find("> .box-body, > .box-footer, > form >.box-body, > form > .box-footer");
if (!box.hasClass("collapsed-box")) {
//Convert minus into plus
element.children(":first")
.removeClass(_this.icons.collapse)
.addClass(_this.icons.open);
//Hide the content
box_content.slideUp(_this.animationSpeed, function () {
box.addClass("collapsed-box");
});
} else {
//Convert plus into minus
element.children(":first")
.removeClass(_this.icons.open)
.addClass(_this.icons.collapse);
//Show the content
box_content.slideDown(_this.animationSpeed, function () {
box.removeClass("collapsed-box");
});
}
},
remove: function (element) {
//Find the box parent
var box = element.parents(".box").first();
box.slideUp(this.animationSpeed);
}
};
}
/* ------------------
* - Custom Plugins -
* ------------------
* All custom plugins are defined below.
*/
/*
* BOX REFRESH BUTTON
* ------------------
* This is a custom plugin to use with the component BOX. It allows you to add
* a refresh button to the box. It converts the box's state to a loading state.
*
* @type plugin
* @usage $("#box-widget").boxRefresh( options );
*/
(function ($) {
"use strict";
$.fn.boxRefresh = function (options) {
// Render options
var settings = $.extend({
//Refresh button selector
trigger: ".refresh-btn",
//File source to be loaded (e.g: ajax/src.php)
source: "",
//Callbacks
onLoadStart: function (box) {
return box;
}, //Right after the button has been clicked
onLoadDone: function (box) {
return box;
} //When the source has been loaded
}, options);
//The overlay
var overlay = $('<div class="overlay"><div class="fa fa-refresh fa-spin"></div></div>');
return this.each(function () {
//if a source is specified
if (settings.source === "") {
if (window.console) {
window.console.log("Please specify a source first - boxRefresh()");
}
return;
}
//the box
var box = $(this);
//the button
var rBtn = box.find(settings.trigger).first();
//On trigger click
rBtn.on('click', function (e) {
e.preventDefault();
//Add loading overlay
start(box);
//Perform ajax call
box.find(".box-body").load(settings.source, function () {
done(box);
});
});
});
function start(box) {
//Add overlay and loading img
box.append(overlay);
settings.onLoadStart.call(box);
}
function done(box) {
//Remove overlay and loading img
box.find(overlay).remove();
settings.onLoadDone.call(box);
}
};
})(jQuery);
/*
* EXPLICIT BOX CONTROLS
* -----------------------
* This is a custom plugin to use with the component BOX. It allows you to activate
* a box inserted in the DOM after the app.js was loaded, toggle and remove box.
*
* @type plugin
* @usage $("#box-widget").activateBox();
* @usage $("#box-widget").toggleBox();
* @usage $("#box-widget").removeBox();
*/
(function ($) {
'use strict';
$.fn.activateBox = function () {
$.AdminLTE.boxWidget.activate(this);
};
$.fn.toggleBox = function () {
var button = $($.AdminLTE.boxWidget.selectors.collapse, this);
$.AdminLTE.boxWidget.collapse(button);
};
$.fn.removeBox = function () {
var button = $($.AdminLTE.boxWidget.selectors.remove, this);
$.AdminLTE.boxWidget.remove(button);
};
})(jQuery);
/*
* TODO LIST CUSTOM PLUGIN
* -----------------------
* This plugin depends on iCheck plugin for checkbox and radio inputs
*
* @type plugin
* @usage $("#todo-widget").todolist( options );
*/
(function ($) {
'use strict';
$.fn.todolist = function (options) {
// Render options
var settings = $.extend({
//When the user checks the input
onCheck: function (ele) {
return ele;
},
//When the user unchecks the input
onUncheck: function (ele) {
return ele;
}
}, options);
return this.each(function () {
if (typeof $.fn.iCheck != 'undefined') {
$('input', this).on('ifChecked', function () {
var ele = $(this).parents("li").first();
ele.toggleClass("done");
settings.onCheck.call(ele);
});
$('input', this).on('ifUnchecked', function () {
var ele = $(this).parents("li").first();
ele.toggleClass("done");
settings.onUncheck.call(ele);
});
} else {
$('input', this).on('change', function () {
var ele = $(this).parents("li").first();
ele.toggleClass("done");
if ($('input', ele).is(":checked")) {
settings.onCheck.call(ele);
} else {
settings.onUncheck.call(ele);
}
});
}
});
};
//set/get form element value
$.fn.field = function (name, value) {
if (typeof name !== "string")
return false;
var element = $(this).find("[name='" + name + "']");
if (typeof value === "undefined" && element.length >= 1) {
switch (element.attr("type")) {
case "checkbox":
var result = new Array();
element.each(function (i, val) {
if ($(this).is(":checked")) {
result.push($(this).val());
}
});
return result;
break;
case "radio":
var result;
element.each(function (i, val) {
if ($(this).is(":checked")) {
result = $(this).val();
}
});
return result;
break;
default:
return element.val();
break;
}
} else {
switch (element.attr("type")) {
case "checkbox":
case "radio":
value = $.isArray(value) ? value : [value];
element.each(function (i) {
$(this).prop({
checked: $.inArray($(this).val(), value) > -1
});
});
break;
case undefined:
default:
element.val(value);
break;
}
return element;
}
};
}(jQuery));

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
define(['backend'], function (Backend) {
});

260
public/assets/js/backend.js Normal file
View File

@@ -0,0 +1,260 @@
define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
var Backend = {
api: {
sidebar: function (params) {
colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
$colorNums = colorArr.length;
badgeList = {};
$.each(params, function (k, v) {
$url = Fast.api.fixurl(k);
if ($.isArray(v)) {
$nums = typeof v[0] !== 'undefined' ? v[0] : 0;
$color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
$class = typeof v[2] !== 'undefined' ? v[2] : 'label';
} else {
$nums = v;
$color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
$class = 'label';
}
//必须nums大于0才显示
badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
});
$.each(badgeList, function (k, v) {
var anchor = top.window.$("li a[addtabs][url='" + k + "']");
if (anchor) {
top.window.$(".pull-right-container", anchor).html(v);
top.window.$(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
}
});
},
addtabs: function (url, title, icon) {
var dom = "a[url='{url}']"
var leftlink = top.window.$(dom.replace(/\{url\}/, url));
if (leftlink.length > 0) {
leftlink.trigger("click");
} else {
url = Fast.api.fixurl(url);
leftlink = top.window.$(dom.replace(/\{url\}/, url));
if (leftlink.length > 0) {
var event = leftlink.parent().hasClass("active") ? "dblclick" : "click";
leftlink.trigger(event);
} else {
var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
leftlink = top.window.$(dom.replace(/\{url\}/, baseurl));
//能找到相对地址
if (leftlink.length > 0) {
icon = typeof icon !== 'undefined' ? icon : leftlink.find("i").attr("class");
title = typeof title !== 'undefined' ? title : leftlink.find("span:first").text();
leftlink.trigger("fa.event.toggleitem");
}
var navnode = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
if (navnode.length > 0) {
navnode.trigger("click");
} else {
//追加新的tab
var id = Math.floor(new Date().valueOf() * Math.random());
icon = typeof icon !== 'undefined' ? icon : 'fa fa-circle-o';
title = typeof title !== 'undefined' ? title : '';
top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({
url: url,
addtabs: id
}).addClass("hide").appendTo(top.window.document.body).trigger("click");
}
}
}
},
closetabs: function (url) {
if (typeof url === 'undefined') {
top.window.$("ul.nav-addtabs li.active .close-tab").trigger("click");
} else {
var dom = "a[url='{url}']"
var navlink = top.window.$(dom.replace(/\{url\}/, url));
if (navlink.length === 0) {
url = Fast.api.fixurl(url);
navlink = top.window.$(dom.replace(/\{url\}/, url));
if (navlink.length === 0) {
} else {
var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
navlink = top.window.$(dom.replace(/\{url\}/, baseurl));
//能找到相对地址
if (navlink.length === 0) {
navlink = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
}
}
}
if (navlink.length > 0 && navlink.attr('addtabs')) {
top.window.$("ul.nav-addtabs li#tab_" + navlink.attr('addtabs') + " .close-tab").trigger("click");
}
}
},
replaceids: function (elem, url) {
//如果有需要替换ids的
if (url.indexOf("{ids}") > -1) {
var ids = 0;
var tableId = $(elem).data("table-id");
if (tableId && $("#" + tableId).length > 0 && $("#" + tableId).data("bootstrap.table")) {
var Table = require("table");
ids = Table.api.selectedids($("#" + tableId)).join(",");
}
url = url.replace(/\{ids\}/g, ids);
}
return url;
},
refreshmenu: function () {
top.window.$(".sidebar-menu").trigger("refresh");
},
gettablecolumnbutton: function (options) {
if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
if (tableOptions) {
var columnObj = null;
$.each(tableOptions.columns, function (i, columns) {
$.each(columns, function (j, column) {
if (typeof column.fieldIndex !== 'undefined' && column.fieldIndex === options.fieldIndex) {
columnObj = column;
return false;
}
});
if (columnObj) {
return false;
}
});
if (columnObj) {
return columnObj['buttons'][options.buttonIndex];
}
}
}
return null;
},
},
init: function () {
//公共代码
//添加ios-fix兼容iOS下的iframe
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
$("html").addClass("ios-fix");
}
//配置Toastr的参数
Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
//点击包含.btn-dialog的元素时弹出dialog
$(document).on('click', '.btn-dialog,.dialogit', function (e) {
var that = this;
var options = $.extend({}, $(that).data() || {});
var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
var button = Backend.api.gettablecolumnbutton(options);
if (button && typeof button.callback === 'function') {
options.callback = button.callback;
}
if (typeof options.confirm !== 'undefined') {
Layer.confirm(options.confirm, function (index) {
Backend.api.open(url, title, options);
Layer.close(index);
});
} else {
window[$(that).data("window") || 'self'].Backend.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 = Backend.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) {
Backend.api.addtabs(url, title, icon);
Layer.close(index);
});
} else {
Backend.api.addtabs(url, title, icon);
}
return false;
});
//点击包含.btn-ajax的元素时发送Ajax请求
$(document).on('click', '.btn-ajax,.ajaxit', 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 = Backend.api.replaceids(this, options.url);
var success = typeof options.success === 'function' ? options.success : null;
var error = typeof options.error === 'function' ? options.error : null;
delete options.success;
delete options.error;
var button = Backend.api.gettablecolumnbutton(options);
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) {
Backend.api.ajax(options, success, error);
Layer.close(index);
});
} else {
Backend.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 = Backend.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;
});
//修复含有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"]'});
}
};
Backend.api = $.extend(Fast.api, Backend.api);
//将Template渲染至全局,以便于在子框架中调用
window.Template = Template;
//将Moment渲染至全局,以便于在子框架中调用
window.Moment = Moment;
//将Backend渲染至全局,以便于在子框架中调用
window.Backend = Backend;
Backend.init();
return Backend;
});

View File

@@ -0,0 +1,823 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie'], function ($, undefined, Backend, Table, Form, Template, undefined) {
$.cookie.prototype.defaults = {path: Config.moduleurl};
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: Config.api_url ? Config.api_url + '/addon/index' : "addon/downloaded",
add_url: '',
edit_url: '',
del_url: '',
multi_url: ''
}
});
var table = $("#table");
// 弹窗自适应宽高
var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
var switch_local = function () {
if ($(".btn-switch.active").data("type") != "local") {
Layer.confirm(__('Store not available tips'), {
title: __('Warmtips'),
btn: [__('Switch to the local'), __('Try to reload')]
}, function (index) {
layer.close(index);
$(".panel .nav-tabs").hide();
$(".toolbar > *:not(:first)").hide();
$(".btn-switch[data-type='local']").trigger("click");
}, function (index) {
layer.close(index);
table.bootstrapTable('refresh');
});
return false;
}
};
table.on('load-success.bs.table', function (e, json) {
if (json && typeof json.category != 'undefined' && $(".nav-category li").length == 2) {
$.each(json.category, function (i, j) {
$("<li><a href='javascript:;' data-id='" + j.id + "'>" + j.name + "</a></li>").insertBefore($(".nav-category li:last"));
});
}
if (typeof json.rows === 'undefined' && typeof json.code != 'undefined') {
switch_local();
}
});
table.on('load-error.bs.table', function (e, status, res) {
console.log(e, status, res);
switch_local();
});
table.on('post-body.bs.table', function (e, settings, json, xhr) {
var parenttable = table.closest('.bootstrap-table');
var d = $(".fixed-table-toolbar", parenttable).find(".search input");
d.off("keyup drop blur");
d.on("keyup", function (e) {
if (e.keyCode == 13) {
var that = this;
var options = table.bootstrapTable('getOptions');
var queryParams = options.queryParams;
options.pageNumber = 1;
options.queryParams = function (params) {
var params = queryParams(params);
params.search = $(that).val();
return params;
};
table.bootstrapTable('refresh', {});
}
});
});
Template.helper("Moment", Moment);
Template.helper("addons", Config['addons']);
$("#faupload-addon").data("params", function (files, xhr) {
var userinfo = Controller.api.userinfo.get();
return {
uid: userinfo ? userinfo.id : '',
token: userinfo ? userinfo.token : '',
version: Config.faversion,
force: (files[0].force || false) ? 1 : 0
};
});
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pageSize: 50,
queryParams: function (params) {
var userinfo = Controller.api.userinfo.get();
$.extend(params, {
uid: userinfo ? userinfo.id : '',
token: userinfo ? userinfo.token : '',
domain: Config.domain,
version: Config.faversion,
sid: Controller.api.sid()
});
return params;
},
columns: [
[
{field: 'id', title: 'ID', operate: false, visible: false},
{
field: 'home',
title: __('Index'),
width: '50px',
formatter: Controller.api.formatter.home
},
{field: 'name', title: __('Name'), operate: false, visible: false, width: '120px'},
{
field: 'title',
title: __('Title'),
operate: 'LIKE',
align: 'left',
formatter: Controller.api.formatter.title
},
{
field: 'intro',
title: __('Intro'),
operate: 'LIKE',
align: 'left',
class: 'visible-lg',
formatter: Controller.api.formatter.intro
},
{
field: 'author',
title: __('Author'),
operate: 'LIKE',
width: '100px',
formatter: Controller.api.formatter.author
},
{
field: 'price',
title: __('Price'),
operate: 'LIKE',
width: '100px',
align: 'center',
formatter: Controller.api.formatter.price
},
{
field: 'downloads',
title: __('Downloads'),
operate: 'LIKE',
width: '80px',
align: 'center',
formatter: Controller.api.formatter.downloads
},
{
field: 'version',
title: __('Version'),
operate: 'LIKE',
width: '80px',
align: 'center',
formatter: Controller.api.formatter.version
},
{
field: 'toggle',
title: __('Status'),
width: '80px',
formatter: Controller.api.formatter.toggle
},
{
field: 'id',
title: __('Operate'),
table: table,
formatter: Controller.api.formatter.operate,
align: 'right'
},
]
],
responseHandler: function (res) {
$.each(res.rows, function (i, j) {
j.addon = typeof Config.addons[j.name] != 'undefined' ? Config.addons[j.name] : null;
});
return res;
},
dataType: 'jsonp',
templateView: false,
clickToSelect: false,
search: true,
showColumns: false,
showToggle: false,
showExport: false,
showSearch: false,
commonSearch: true,
searchFormVisible: true,
searchFormTemplate: 'searchformtpl',
});
// 为表格绑定事件
Table.api.bindevent(table);
// 离线安装
require(['upload'], function (Upload) {
Upload.api.upload("#faupload-addon", function (data, ret, up, file) {
Config['addons'][data.addon.name] = data.addon;
var addon = data.addon;
var testdata = data.addon.testdata;
operate(data.addon.name, 'enable', false, function (data, ret) {
Layer.alert(__('Offline installed tips') + (testdata ? __('Testdata tips') : ""), {
btn: testdata ? [__('Import testdata'), __('Skip testdata')] : [__('OK')],
title: __('Warning'),
yes: function (index) {
if (testdata) {
Fast.api.ajax({
url: 'addon/testdata',
data: {
name: addon.name,
version: addon.version,
faversion: Config.faversion
}
}, function (data, ret) {
Layer.close(index);
});
} else {
Layer.close(index);
}
},
icon: 1
});
});
return false;
}, function (data, ret, up, file) {
if (ret.msg && ret.msg.match(/(login|登录)/g)) {
return Layer.alert(ret.msg, {
title: __('Warning'),
btn: [__('Login now')],
yes: function (index, layero) {
$(".btn-userinfo").trigger("click");
}
});
} else if (ret.code === -1) {
Layer.confirm(__('Upgrade tips', data.title), {title: __('Warmtips')}, function (index, layero) {
up.removeFile(file);
file.force = true;
up.uploadFile(file);
Layer.close(index);
});
return false;
}
});
// 检测是否登录
$(document).on("mousedown", "#faupload-addon", function (e) {
var userinfo = Controller.api.userinfo.get();
var uid = userinfo ? userinfo.id : 0;
var uploadBtn = Upload.list['faupload-addon'];
if (parseInt(uid) === 0) {
uploadBtn.disable();
$(".btn-userinfo").trigger("click");
return false;
} else {
if (uploadBtn.disabled) {
uploadBtn.enable();
}
}
});
});
// 查看插件首页
$(document).on("click", ".btn-addonindex", function () {
if ($(this).attr("href") == 'javascript:;') {
Layer.msg(__('Not installed tips'), {icon: 7});
} else if ($(this).closest(".operate").find("a.btn-enable").length > 0) {
Layer.msg(__('Not enabled tips'), {icon: 7});
return false;
}
});
// 切换
$(document).on("click", ".btn-switch", function () {
$(".btn-switch").removeClass("active");
$(this).addClass("active");
$("form.form-commonsearch input[name='type']").val($(this).data("type"));
var method = $(this).data("type") == 'local' ? 'hideColumn' : 'showColumn';
table.bootstrapTable(method, 'price');
table.bootstrapTable(method, 'downloads');
table.bootstrapTable('refresh', {url: ($(this).data("url") ? $(this).data("url") : $.fn.bootstrapTable.defaults.extend.index_url), pageNumber: 1});
return false;
});
// 切换分类
$(document).on("click", ".nav-category li a", function () {
$(".nav-category li").removeClass("active");
$(this).parent().addClass("active");
$("form.form-commonsearch input[name='category_id']").val($(this).data("id"));
table.bootstrapTable('refresh', {url: $(this).data("url"), pageNumber: 1});
return false;
});
var tables = [];
$(document).on("click", "#droptables", function () {
if ($(this).prop("checked")) {
Fast.api.ajax({
url: "addon/get_table_list",
async: false,
data: {name: $(this).data("name")}
}, function (data) {
tables = data.tables;
return false;
});
var html;
html = tables.length > 0 ? '<div class="alert alert-warning-light droptablestips" style="max-width:480px;max-height:300px;overflow-y: auto;">' + __('The following data tables will be deleted') + '<br>' + tables.join("<br>") + '</div>'
: '<div class="alert alert-warning-light droptablestips">' + __('The Addon did not create a data table') + '</div>';
$(html).insertAfter($(this).closest("p"));
} else {
$(".droptablestips").remove();
}
$(window).resize();
});
// 会员信息
$(document).on("click", ".btn-userinfo", function (e, name, version) {
var that = this;
var area = [$(window).width() > 800 ? '500px' : '95%', $(window).height() > 600 ? '400px' : '95%'];
var userinfo = Controller.api.userinfo.get();
if (!userinfo) {
Fast.api.ajax({
url: Config.api_url + '/user/logintpl',
type: 'post',
loading: false,
data: {
version: Config.faversion,
sid: Controller.api.sid()
}
}, function (tpldata, ret) {
Layer.open({
content: Template.render(tpldata, {}),
zIndex: 99,
area: area,
title: __('Login'),
resize: false,
btn: [__('Login')],
yes: function (index, layero) {
var data = $("form", layero).serializeArray();
data.push({name: "faversion", value: Config.faversion});
data.push({name: "sid", value: Controller.api.sid()});
Fast.api.ajax({
url: Config.api_url + '/user/login',
type: 'post',
data: data
}, function (data, ret) {
Controller.api.userinfo.set(data);
Layer.closeAll();
Layer.alert(ret.msg, {title: __('Warning'), icon: 1});
return false;
}, function (data, ret) {
});
},
success: function (layero, index) {
this.checkEnterKey = function (event) {
if (event.keyCode === 13) {
$(".layui-layer-btn0").trigger("click");
return false;
}
};
$(document).on('keydown', this.checkEnterKey);
},
end: function () {
$(document).off('keydown', this.checkEnterKey);
}
});
return false;
});
} else {
Fast.api.ajax({
url: Config.api_url + '/user/userinfotpl',
type: 'post',
data: {
uid: userinfo.id,
token: userinfo.token,
version: Config.faversion,
sid: Controller.api.sid()
}
}, function (tpldata, ret) {
Layer.open({
content: Template.render(tpldata, userinfo),
area: area,
title: __('Userinfo'),
resize: false,
btn: [__('Logout'), __('Close')],
yes: function () {
Fast.api.ajax({
url: Config.api_url + '/user/logout',
data: {
uid: userinfo.id,
token: userinfo.token,
version: Config.faversion,
sid: Controller.api.sid()
}
}, function (data, ret) {
Controller.api.userinfo.set(null);
Layer.closeAll();
Layer.alert(ret.msg, {title: __('Warning'), icon: 0});
}, function (data, ret) {
Controller.api.userinfo.set(null);
Layer.closeAll();
Layer.alert(ret.msg, {title: __('Warning'), icon: 0});
});
}
});
return false;
}, function (data) {
Controller.api.userinfo.set(null);
$(that).trigger('click');
return false;
});
}
});
//刷新授权
$(document).on("click", ".btn-authorization", function () {
var userinfo = Controller.api.userinfo.get();
if (!userinfo) {
$(".btn-userinfo").trigger("click");
return false;
}
Layer.confirm(__('Are you sure you want to refresh authorization?'), {icon: 3, title: __('Warmtips')}, function () {
Fast.api.ajax({
url: 'addon/authorization',
data: {
uid: userinfo.id,
token: userinfo.token
}
}, function (data, ret) {
$(".btn-refresh").trigger("click");
Layer.closeAll();
});
});
return false;
});
var install = function (name, version, force) {
var userinfo = Controller.api.userinfo.get();
var uid = userinfo ? userinfo.id : 0;
var token = userinfo ? userinfo.token : '';
Fast.api.ajax({
url: 'addon/install',
data: {
name: name,
force: force ? 1 : 0,
uid: uid,
token: token,
version: version,
faversion: Config.faversion
}
}, function (data, ret) {
Layer.closeAll();
Config['addons'][data.addon.name] = ret.data.addon;
operate(data.addon.name, 'enable', false, function () {
Layer.alert(__('Online installed tips') + (data.addon.testdata ? __('Testdata tips') : ""), {
btn: data.addon.testdata ? [__('Import testdata'), __('Skip testdata')] : [__('OK')],
title: __('Warning'),
yes: function (index) {
if (data.addon.testdata) {
Fast.api.ajax({
url: 'addon/testdata',
data: {
name: name,
uid: uid,
token: token,
version: version,
faversion: Config.faversion
}
}, function (data, ret) {
Layer.close(index);
});
} else {
Layer.close(index);
}
},
icon: 1
});
Controller.api.refresh(table, name);
});
}, function (data, ret) {
var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > 650 ? '650px' : '95%', $(window).height() > 710 ? '710px' : '95%'];
if (ret && ret.code === -2) {
//如果登录已经超时,重新提醒登录
if (uid && uid != ret.data.uid) {
Controller.api.userinfo.set(null);
$(".operate[data-name='" + name + "'] .btn-install").trigger("click");
return;
}
top.Fast.api.open(ret.data.payurl, __('Pay now'), {
area: area,
end: function () {
Fast.api.ajax({
url: 'addon/isbuy',
data: {
name: name,
force: force ? 1 : 0,
uid: uid,
token: token,
version: version,
faversion: Config.faversion
}
}, function () {
top.Layer.alert(__('Pay successful tips'), {
btn: [__('Continue installation')],
title: __('Warning'),
icon: 1,
yes: function (index) {
top.Layer.close(index);
install(name, version);
}
});
return false;
}, function () {
console.log(__('Canceled'));
return false;
});
}
});
} else if (ret && ret.code === -3) {
//插件目录发现影响全局的文件
Layer.open({
content: Template("conflicttpl", ret.data),
shade: 0.8,
area: area,
title: __('Warning'),
btn: [__('Continue install'), __('Cancel')],
end: function () {
},
yes: function () {
install(name, version, true);
}
});
} else {
Layer.alert(ret.msg, {title: __('Warning'), icon: 0});
}
return false;
});
};
var uninstall = function (name, force, droptables) {
Fast.api.ajax({
url: 'addon/uninstall',
data: {name: name, force: force ? 1 : 0, droptables: droptables ? 1 : 0}
}, function (data, ret) {
delete Config['addons'][name];
Layer.closeAll();
Controller.api.refresh(table, name);
}, function (data, ret) {
if (ret && ret.code === -3) {
//插件目录发现影响全局的文件
Layer.open({
content: Template("conflicttpl", ret.data),
shade: 0.8,
area: area,
title: __('Warning'),
btn: [__('Continue uninstall'), __('Cancel')],
end: function () {
},
yes: function () {
uninstall(name, true, droptables);
}
});
} else {
Layer.alert(ret.msg, {title: __('Warning'), icon: 0});
}
return false;
});
};
var operate = function (name, action, force, success) {
Fast.api.ajax({
url: 'addon/state',
data: {name: name, action: action, force: force ? 1 : 0}
}, function (data, ret) {
var addon = Config['addons'][name];
addon.state = action === 'enable' ? 1 : 0;
Layer.closeAll();
if (typeof success === 'function') {
success(data, ret);
}
Controller.api.refresh(table, name);
}, function (data, ret) {
if (ret && ret.code === -3) {
//插件目录发现影响全局的文件
Layer.open({
content: Template("conflicttpl", ret.data),
shade: 0.8,
area: area,
title: __('Warning'),
btn: [__('Continue operate'), __('Cancel')],
end: function () {
},
yes: function () {
operate(name, action, true, success);
}
});
} else {
Layer.alert(ret.msg, {title: __('Warning'), icon: 0});
}
return false;
});
};
var upgrade = function (name, version) {
var userinfo = Controller.api.userinfo.get();
var uid = userinfo ? userinfo.id : 0;
var token = userinfo ? userinfo.token : '';
Fast.api.ajax({
url: 'addon/upgrade',
data: {name: name, uid: uid, token: token, version: version, faversion: Config.faversion}
}, function (data, ret) {
Config['addons'][name] = data.addon;
Layer.closeAll();
Controller.api.refresh(table, name);
}, function (data, ret) {
Layer.alert(ret.msg, {title: __('Warning')});
return false;
});
};
// 点击安装
$(document).on("click", ".btn-install", function () {
var that = this;
var name = $(this).closest(".operate").data("name");
var version = $(this).data("version");
var userinfo = Controller.api.userinfo.get();
var uid = userinfo ? userinfo.id : 0;
if (parseInt(uid) === 0) {
$(".btn-userinfo").trigger("click", name, version);
return false;
}
install(name, version, false);
});
// 点击卸载
$(document).on("click", ".btn-uninstall", function () {
var name = $(this).closest(".operate").data('name');
if (Config['addons'][name].state == 1) {
Layer.alert(__('Please disable the add before trying to uninstall'), {icon: 7});
return false;
}
Template.helper("__", __);
tables = [];
Layer.confirm(Template("uninstalltpl", {addon: Config['addons'][name]}), {focusBtn: false, title: __("Warning")}, function (index, layero) {
uninstall(name, false, $("input[name='droptables']", layero).prop("checked"));
});
});
// 点击配置
$(document).on("click", ".btn-config", function () {
var name = $(this).closest(".operate").data("name");
Fast.api.open("addon/config?name=" + name, __('Setting'));
});
// 点击启用/禁用
$(document).on("click", ".btn-enable,.btn-disable", function () {
var name = $(this).data("name");
var action = $(this).data("action");
operate(name, action, false);
});
// 点击升级
$(document).on("click", ".btn-upgrade", function () {
var name = $(this).closest(".operate").data('name');
if (Config['addons'][name].state == 1) {
Layer.alert(__('Please disable the add before trying to upgrade'), {icon: 7});
return false;
}
var version = $(this).data("version");
Layer.confirm(__('Upgrade tips', Config['addons'][name].title), {title: __('Warmtips')}, function (index, layero) {
upgrade(name, version);
});
});
$(document).on("click", ".operate .btn-group .dropdown-toggle", function () {
$(this).closest(".btn-group").toggleClass("dropup", $(document).height() - $(this).offset().top <= 200);
});
$(document).on("click", ".view-screenshots", function () {
var row = Table.api.getrowbyindex(table, parseInt($(this).data("index")));
var data = [];
$.each(row.screenshots, function (i, j) {
data.push({
"src": j
});
});
var json = {
"title": row.title,
"data": data
};
top.Layer.photos(top.JSON.parse(JSON.stringify({photos: json})));
});
},
add: function () {
Controller.api.bindevent();
},
config: function () {
$(document).on("click", ".nav-group li a[data-toggle='tab']", function () {
if ($(this).attr("href") == "#all") {
$(".tab-pane").addClass("active in");
}
return;
var type = $(this).attr("href").substring(1);
if (type == 'all') {
$(".table-config tr").show();
} else {
$(".table-config tr").hide();
$(".table-config tr[data-group='" + type + "']").show();
}
});
Controller.api.bindevent();
},
api: {
formatter: {
title: function (value, row, index) {
if ($(".btn-switch.active").data("type") == "local") {
// return value;
}
var title = '<a class="title" href="' + row.url + '" data-toggle="tooltip" title="' + __('View addon home page') + '" target="_blank"><span class="' + Fast.api.escape(row.color) + '">' + value + '</span></a>';
if (row.screenshots && row.screenshots.length > 0) {
title += ' <a href="javascript:;" data-index="' + index + '" class="view-screenshots text-success" title="' + __('View addon screenshots') + '" data-toggle="tooltip"><i class="fa fa-image"></i></a>';
}
return title;
},
intro: function (value, row, index) {
return row.intro + (row.extend ? "<a href='" + Fast.api.escape(row.extend[1]) + "' class='" + Fast.api.escape(row.extend[2]) + "'>" + Fast.api.escape(row.extend[0]) + "</a>" : "");
},
operate: function (value, row, index) {
return Template("operatetpl", {item: row, index: index});
},
toggle: function (value, row, index) {
if (!row.addon) {
return '';
}
return '<a href="javascript:;" data-toggle="tooltip" title="' + __('Click to toggle status') + '" class="btn btn-toggle btn-' + (row.addon.state == 1 ? "disable" : "enable") + '" data-action="' + (row.addon.state == 1 ? "disable" : "enable") + '" data-name="' + row.name + '"><i class="fa ' + (row.addon.state == 0 ? 'fa-toggle-on fa-rotate-180 text-gray' : 'fa-toggle-on text-success') + ' fa-2x"></i></a>';
},
author: function (value, row, index) {
var url = 'javascript:';
if (typeof row.homepage !== 'undefined') {
url = row.homepage;
} else if (typeof row.qq !== 'undefined' && row.qq) {
url = 'https://wpa.qq.com/msgrd?v=3&uin=' + row.qq + '&site=&menu=yes';
}
return '<a href="' + url + '" target="_blank" data-toggle="tooltip" class="text-primary">' + value + '</a>';
},
price: function (value, row, index) {
if (isNaN(value)) {
return value;
}
return parseFloat(value) == 0 ? '<span class="text-success">' + __('Free') + '</span>' : '<span class="text-danger">¥' + value + '</span>';
},
downloads: function (value, row, index) {
return value;
},
version: function (value, row, index) {
return row.addon && row.addon.version != row.version ? '<a href="' + row.url + '?version=' + row.version + '" target="_blank"><span class="releasetips text-primary" data-toggle="tooltip" title="' + __('New version tips', row.version) + '">' + row.addon.version + '<i></i></span></a>' : row.version;
},
home: function (value, row, index) {
return row.addon && parseInt(row.addon.state) > 0 ? '<a href="' + row.addon.url + '" data-toggle="tooltip" title="' + __('View addon index page') + '" target="_blank"><i class="fa fa-home text-primary"></i></a>' : '<a href="javascript:;"><i class="fa fa-home text-gray"></i></a>';
},
},
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
},
userinfo: {
get: function () {
if (typeof $.cookie !== 'undefined') {
var userinfo = $.cookie('fastadmin_userinfo');
} else {
var userinfo = sessionStorage.getItem("fastadmin_userinfo");
}
return userinfo ? JSON.parse(userinfo) : null;
},
set: function (data) {
if (typeof $.cookie !== 'undefined') {
if (data) {
$.cookie("fastadmin_userinfo", JSON.stringify(data));
} else {
$.removeCookie("fastadmin_userinfo");
}
} else {
if (data) {
sessionStorage.setItem("fastadmin_userinfo", JSON.stringify(data));
} else {
sessionStorage.removeItem("fastadmin_userinfo");
}
}
}
},
sid: function () {
var sid = $.cookie('fastadmin_sid');
if (!sid) {
sid = Math.random().toString(20).substr(2, 12);
$.cookie('fastadmin_sid', sid);
}
return sid;
},
refresh: function (table, name) {
//刷新左侧边栏
Fast.api.refreshmenu();
//刷新行数据
if ($(".operate[data-name='" + name + "']").length > 0) {
var tr = $(".operate[data-name='" + name + "']").closest("tr[data-index]");
var index = tr.data("index");
var row = Table.api.getrowbyindex(table, index);
row.addon = typeof Config['addons'][name] !== 'undefined' ? Config['addons'][name] : undefined;
table.bootstrapTable("updateRow", {index: index, row: row});
} else if ($(".btn-switch.active").data("type") == "local") {
$(".btn-refresh").trigger("click");
}
}
}
};
return Controller;
});

View File

@@ -0,0 +1,62 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'auth/admin/index',
add_url: 'auth/admin/add',
edit_url: 'auth/admin/edit',
del_url: 'auth/admin/del',
multi_url: 'auth/admin/multi',
}
});
var table = $("#table");
//在表格内容渲染完成后回调的事件
table.on('post-body.bs.table', function (e, json) {
$("tbody tr[data-index]", this).each(function () {
if (parseInt($("td:eq(1)", this).text()) == Config.admin.id) {
$("input[type=checkbox]", this).prop("disabled", true);
}
});
});
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
columns: [
[
{field: 'state', checkbox: true, },
{field: 'id', title: 'ID'},
{field: 'username', title: __('Username')},
{field: 'nickname', title: __('Nickname')},
{field: 'groups_text', title: __('Group'), operate:false, formatter: Table.api.formatter.label},
{field: 'email', title: __('Email')},
{field: 'mobile', title: __('Mobile')},
{field: 'status', title: __("Status"), searchList: {"normal":__('Normal'),"hidden":__('Hidden')}, formatter: Table.api.formatter.status},
{field: 'logintime', title: __('Login time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
if(row.id == Config.admin.id){
return '';
}
return Table.api.formatter.operate.call(this, value, row, index);
}}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Form.api.bindevent($("form[role=form]"));
},
edit: function () {
Form.api.bindevent($("form[role=form]"));
}
};
return Controller;
});

View File

@@ -0,0 +1,64 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'auth/adminlog/index',
add_url: '',
edit_url: '',
del_url: 'auth/adminlog/del',
multi_url: 'auth/adminlog/multi',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{field: 'state', checkbox: true,},
{field: 'id', title: 'ID', operate: false},
{field: 'admin_id', title: __('Admin_id'), formatter: Table.api.formatter.search, visible: false},
{field: 'username', title: __('Username'), formatter: Table.api.formatter.search},
{field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索'},
{field: 'url', title: __('Url'), formatter: Table.api.formatter.url},
{field: 'ip', title: __('IP'), events: Table.api.events.ip, formatter: Table.api.formatter.search},
{field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{
field: 'operate', title: __('Operate'), table: table,
events: Table.api.events.operate,
buttons: [{
name: 'detail',
text: __('Detail'),
icon: 'fa fa-list',
classname: 'btn btn-info btn-xs btn-detail btn-dialog',
url: 'auth/adminlog/detail'
}],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
},
formatter: {
browser: function (value, row, index) {
return '<a class="btn btn-xs btn-browser">' + row.useragent.split(" ")[0] + '</a>';
},
},
}
};
return Controller;
});

View File

@@ -0,0 +1,160 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function ($, undefined, Backend, Table, Form, undefined) {
//读取选中的条目
$.jstree.core.prototype.get_all_checked = function (full) {
var obj = this.get_selected(), i, j;
for (i = 0, j = obj.length; i < j; i++) {
obj = obj.concat(this.get_node(obj[i]).parents);
}
obj = $.grep(obj, function (v, i, a) {
return v != '#';
});
obj = obj.filter(function (itm, i, a) {
return i == a.indexOf(itm);
});
return full ? $.map(obj, $.proxy(function (i) {
return this.get_node(i);
}, this)) : obj;
};
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
"index_url": "auth/group/index",
"add_url": "auth/group/add",
"edit_url": "auth/group/edit",
"del_url": "auth/group/del",
"multi_url": "auth/group/multi",
}
});
var table = $("#table");
//在表格内容渲染完成后回调的事件
table.on('post-body.bs.table', function (e, json) {
$("tbody tr[data-index]", this).each(function () {
if (Config.admin.group_ids.indexOf(parseInt(parseInt($("td:eq(1)", this).text()))) > -1) {
$("input[type=checkbox]", this).prop("disabled", true);
}
});
});
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
columns: [
[
{field: 'state', checkbox: true,},
{field: 'id', title: 'ID'},
{field: 'pid', title: __('Parent')},
{field: 'name', title: __('Name'), align: 'left', formatter:function (value, row, index) {
return value.toString().replace(/(&|&amp;)nbsp;/g, '&nbsp;');
}
},
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
{
field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
if (Config.admin.group_ids.indexOf(parseInt(row.id)) > -1) {
return '';
}
return Table.api.formatter.operate.call(this, value, row, index);
}
}
]
],
pagination: false,
search: false,
commonSearch: false,
});
// 为表格绑定事件
Table.api.bindevent(table);//当内容渲染完成后
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"), null, null, function () {
if ($("#treeview").length > 0) {
var r = $("#treeview").jstree("get_all_checked");
$("input[name='row[rules]']").val(r.join(','));
}
return true;
});
//渲染权限节点树
//变更级别后需要重建节点树
$(document).on("change", "select[name='row[pid]']", function () {
var pid = $(this).data("pid");
var id = $(this).data("id");
if ($(this).val() == id) {
$("option[value='" + pid + "']", this).prop("selected", true).change();
Backend.api.toastr.error(__('Can not change the parent to self'));
return false;
}
$.ajax({
url: "auth/group/roletree",
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 === 1) {
//销毁已有的节点树
$("#treeview").jstree("destroy");
Controller.api.rendertree(data);
} else {
Backend.api.toastr.error(ret.msg);
}
}
}, error: function (e) {
Backend.api.toastr.error(e.message);
}
});
});
//全选和展开
$(document).on("click", "#checkall", function () {
$("#treeview").jstree($(this).prop("checked") ? "check_all" : "uncheck_all");
});
$(document).on("click", "#expandall", function () {
$("#treeview").jstree($(this).prop("checked") ? "open_all" : "close_all");
});
$("select[name='row[pid]']").trigger("change");
},
rendertree: function (content) {
$("#treeview")
.on('redraw.jstree', function (e) {
$(".layer-footer").attr("domrefresh", Math.random());
})
.jstree({
"themes": {"stripes": true},
"checkbox": {
"keep_selected_style": false,
},
"types": {
"root": {
"icon": "fa fa-folder-open",
},
"menu": {
"icon": "fa fa-folder-open",
},
"file": {
"icon": "fa fa-file-o",
}
},
"plugins": ["checkbox", "types"],
"core": {
'check_callback': true,
"data": content
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,221 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
"index_url": "auth/rule/index",
"add_url": "auth/rule/add",
"edit_url": "auth/rule/edit",
"del_url": "auth/rule/del",
"multi_url": "auth/rule/multi",
"table": "auth_rule"
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
sortName: '',
escape: false,
columns: [
[
{field: 'state', checkbox: true,},
{field: 'id', title: 'ID'},
{field: 'title', title: __('Title'), align: 'left', formatter: Controller.api.formatter.title, clickToSelect: !false},
{field: 'icon', title: __('Icon'), formatter: Controller.api.formatter.icon},
{field: 'name', title: __('Name'), align: 'left', formatter: Controller.api.formatter.name},
{field: 'weigh', title: __('Weigh')},
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
{
field: 'ismenu',
title: __('Ismenu'),
align: 'center',
table: table,
formatter: Table.api.formatter.toggle
},
{
field: 'operate',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
formatter: Table.api.formatter.operate
}
]
],
pagination: false,
search: false,
commonSearch: false,
rowAttributes: function (row, index) {
return row.pid == 0 ? {} : {style: "display:none"};
}
});
// 为表格绑定事件
Table.api.bindevent(table);
var btnSuccessEvent = function (data, ret) {
if ($(this).hasClass("btn-change")) {
var index = $(this).data("index");
var row = Table.api.getrowbyindex(table, index);
row.ismenu = $("i.fa.text-gray", this).length > 0 ? 1 : 0;
table.bootstrapTable("updateRow", {index: index, row: row});
} else if ($(this).hasClass("btn-delone")) {
if ($(this).closest("tr[data-index]").find("a.btn-node-sub.disabled").length > 0) {
$(this).closest("tr[data-index]").remove();
} else {
table.bootstrapTable('refresh');
}
} else if ($(this).hasClass("btn-dragsort")) {
table.bootstrapTable('refresh');
}
Fast.api.refreshmenu();
return false;
};
//表格内容渲染前
table.on('pre-body.bs.table', function (e, data) {
var options = table.bootstrapTable("getOptions");
options.escape = true;
});
//当内容渲染完成后
table.on('post-body.bs.table', function (e, data) {
var options = table.bootstrapTable("getOptions");
options.escape = false;
//点击切换/排序/删除操作后刷新左侧菜单
$(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", btnSuccessEvent);
});
table.on('post-body.bs.table', function (e, settings, json, xhr) {
//显示隐藏子节点
$(">tbody>tr[data-index] > td", this).on('click', "a.btn-node-sub", function () {
var status = $(this).data("shown") ? true : false;
$("a[data-pid='" + $(this).data("id") + "']").each(function () {
$(this).closest("tr").toggle(!status);
});
if (status) {
$("a[data-pid='" + $(this).data("id") + "']").trigger("collapse");
}
$(this).data("shown", !status);
$("i", this).toggleClass("fa-caret-down").toggleClass("fa-caret-right");
return false;
});
});
//隐藏子节点
$(document).on("collapse", ".btn-node-sub", function () {
if ($("i", this).length > 0) {
$("a[data-pid='" + $(this).data("id") + "']").trigger("collapse");
}
$("i", this).removeClass("fa-caret-down").addClass("fa-caret-right");
$(this).data("shown", false);
$(this).closest("tr").toggle(false);
});
//批量删除后的回调
$(".toolbar > .btn-del,.toolbar .btn-more~ul>li>a").data("success", function (e) {
Fast.api.refreshmenu();
});
//展开隐藏一级
$(document.body).on("click", ".btn-toggle", function (e) {
$("a[data-id][data-pid][data-pid!=0].disabled").closest("tr").hide();
var that = this;
var show = $("i", that).hasClass("fa-chevron-down");
$("i", that).toggleClass("fa-chevron-down", !show).toggleClass("fa-chevron-up", show);
$("a[data-id][data-pid][data-pid!=0]").not('.disabled').closest("tr").toggle(show);
$(".btn-node-sub[data-pid=0]").data("shown", show);
});
//展开隐藏全部
$(document.body).on("click", ".btn-toggle-all", function (e) {
var that = this;
var show = $("i", that).hasClass("fa-plus");
$("i", that).toggleClass("fa-plus", !show).toggleClass("fa-minus", show);
$(".btn-node-sub:not([data-pid=0])").closest("tr").toggle(show);
$(".btn-node-sub").data("shown", show);
$(".btn-node-sub > i").toggleClass("fa-caret-down", show).toggleClass("fa-caret-right", !show);
});
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
formatter: {
title: function (value, row, index) {
value = value.toString().replace(/(&|&amp;)nbsp;/g, '&nbsp;');
var caret = row.haschild == 1 || row.ismenu == 1 ? '<i class="fa fa-caret-right"></i>' : '';
value = value.indexOf("&nbsp;") > -1 ? value.replace(/(.*)&nbsp;/, "$1" + caret) : caret + value;
value = !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
return '<a href="javascript:;" data-id="' + row.id + '" data-pid="' + row.pid + '" class="'
+ (row.haschild == 1 || row.ismenu == 1 ? 'text-primary' : 'disabled') + ' btn-node-sub">' + value + '</a>';
},
name: function (value, row, index) {
return !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
},
icon: function (value, row, index) {
return '<span class="' + (!row.ismenu || row.status == 'hidden' ? 'text-muted' : '') + '"><i class="' + value + '"></i></span>';
}
},
bindevent: function () {
$(document).on('click', "input[name='row[ismenu]']", function () {
var name = $("input[name='row[name]']");
var ismenu = $(this).val() == 1;
name.prop("placeholder", ismenu ? name.data("placeholder-menu") : name.data("placeholder-node"));
$('div[data-type="menu"]').toggleClass("hidden", !ismenu);
});
$("input[name='row[ismenu]']:checked").trigger("click");
var iconlist = [];
var iconfunc = function () {
Layer.open({
type: 1,
area: ['99%', '98%'], //宽高
content: Template('chooseicontpl', {iconlist: iconlist})
});
};
Form.api.bindevent($("form[role=form]"), function (data) {
Fast.api.refreshmenu();
});
$(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.site.cdnurl + "/assets/libs/font-awesome/less/variables.less", function (ret) {
var exp = /fa-var-(.*):/ig;
var result;
while ((result = exp.exec(ret)) != null) {
iconlist.push(result[1]);
}
iconfunc();
});
} else {
iconfunc();
}
});
$(document).on('click', '#chooseicon ul li', function () {
$("input[name='row[icon]']").val('fa fa-' + $(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 Controller;
});

View File

@@ -0,0 +1,93 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'category/index',
add_url: 'category/add',
edit_url: 'category/edit',
del_url: 'category/del',
multi_url: 'category/multi',
dragsort_url: 'ajax/weigh',
table: 'category',
}
});
var table = $("#table");
var tableOptions = {
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
pagination: false,
commonSearch: false,
search: false,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'type', title: __('Type'), operate: false, searchList: Config.searchList, formatter: Table.api.formatter.label},
{field: 'name', title: __('Name'), align: 'left', formatter:function (value, row, index) {
return value.toString().replace(/(&|&amp;)nbsp;/g, '&nbsp;');
}
},
{field: 'nickname', title: __('Nickname')},
{field: 'flag', title: __('Flag'), formatter: Table.api.formatter.flag},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'weigh', title: __('Weigh')},
{field: 'status', title: __('Status'), operate: false, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
};
// 初始化表格
table.bootstrapTable(tableOptions);
// 为表格绑定事件
Table.api.bindevent(table);
//绑定TAB事件
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
// var options = table.bootstrapTable(tableOptions);
var typeStr = $(this).attr("href").replace('#', '');
var options = table.bootstrapTable('getOptions');
options.pageNumber = 1;
options.queryParams = function (params) {
// params.filter = JSON.stringify({type: typeStr});
params.type = typeStr;
return params;
};
table.bootstrapTable('refresh', {});
return false;
});
//必须默认触发shown.bs.tab事件
// $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
},
add: function () {
Controller.api.bindevent();
setTimeout(function () {
$("#c-type").trigger("change");
}, 100);
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$(document).on("change", "#c-type", function () {
$("#c-pid option[data-type='all']").prop("selected", true);
$("#c-pid option").removeClass("hide");
$("#c-pid option[data-type!='" + $(this).val() + "'][data-type!='all']").addClass("hide");
$("#c-pid").data("selectpicker") && $("#c-pid").selectpicker("refresh");
});
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,80 @@
define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template) {
var Controller = {
index: function () {
// 基于准备好的dom初始化echarts实例
var myChart = Echarts.init(document.getElementById('echart'), 'walden');
// 指定图表的配置项和数据
var option = {
title: {
text: '',
subtext: ''
},
color: [
"#18d1b1",
"#3fb1e3",
"#626c91",
"#a0a7e6",
"#c4ebad",
"#96dee8"
],
tooltip: {
trigger: 'axis'
},
legend: {
data: [__('Register user')]
},
toolbox: {
show: false,
feature: {
magicType: {show: true, type: ['stack', 'tiled']},
saveAsImage: {show: true}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: Config.column
},
yAxis: {},
grid: [{
left: 'left',
top: 'top',
right: '10',
bottom: 30
}],
series: [{
name: __('Register user'),
type: 'line',
smooth: true,
areaStyle: {
normal: {}
},
lineStyle: {
normal: {
width: 1.5
}
},
data: Config.userdata
}]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
$(window).resize(function () {
myChart.resize();
});
$(document).on("click", ".btn-refresh", function () {
setTimeout(function () {
myChart.resize();
}, 0);
});
}
};
return Controller;
});

View File

@@ -0,0 +1,261 @@
define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'general/attachment/index',
add_url: 'general/attachment/add',
edit_url: 'general/attachment/edit',
del_url: 'general/attachment/del',
multi_url: 'general/attachment/multi',
table: 'attachment'
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
sortName: 'id',
columns: [
[
{field: 'state', checkbox: true},
{field: 'id', title: __('Id')},
{field: 'category', title: __('Category'), operate: 'in', formatter: Table.api.formatter.label, searchList: Config.categoryList},
{field: 'admin_id', title: __('Admin_id'), visible: false, addClass: "selectpage", extend: "data-source='auth/admin/index' data-field='nickname'"},
{field: 'user_id', title: __('User_id'), visible: false, addClass: "selectpage", extend: "data-source='user/user/index' data-field='nickname'"},
{field: 'preview', title: __('Preview'), formatter: Controller.api.formatter.thumb, operate: false},
{field: 'url', title: __('Url'), formatter: Controller.api.formatter.url, visible: false},
{field: 'filename', title: __('Filename'), sortable: true, formatter: Controller.api.formatter.filename, operate: 'like'},
{
field: 'filesize', title: __('Filesize'), operate: 'BETWEEN', sortable: true, formatter: function (value, row, index) {
var size = parseFloat(value);
var i = Math.floor(Math.log(size) / Math.log(1024));
return (size / Math.pow(1024, i)).toFixed(i < 2 ? 0 : 2) * 1 + ' ' + ['B', 'KB', 'MB', 'GB', 'TB'][i];
}
},
{field: 'imagewidth', title: __('Imagewidth'), sortable: true},
{field: 'imageheight', title: __('Imageheight'), sortable: true},
{field: 'imagetype', title: __('Imagetype'), sortable: true, formatter: Table.api.formatter.search, operate: 'like'},
{field: 'storage', title: __('Storage'), formatter: Table.api.formatter.search, operate: 'like'},
{field: 'mimetype', title: __('Mimetype'), formatter: Controller.api.formatter.mimetype},
{
field: 'createtime',
title: __('Createtime'),
formatter: Table.api.formatter.datetime,
operate: 'RANGE',
addclass: 'datetimerange',
sortable: true,
width: 150
},
{
field: 'operate',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
formatter: Table.api.formatter.operate
}
]
],
});
// 绑定过滤事件
$('.filter-type ul li a', table.closest(".panel-intro")).on('click', function (e) {
$(this).closest("ul").find("li").removeClass("active");
$(this).closest("li").addClass("active");
var field = 'mimetype';
var value = $(this).data("value") || '';
var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
if (object.prop('tagName') == "SELECT") {
$("option[value='" + value + "']", object).prop("selected", true);
} else {
object.val(value);
}
table.trigger("uncheckbox");
table.bootstrapTable('refresh', {pageNumber: 1});
});
// 为表格绑定事件
Table.api.bindevent(table);
// 附件归类
$(document).on('click', '.btn-classify', function () {
var ids = Table.api.selectedids(table);
Layer.open({
title: __('Classify'),
content: Template("typetpl", {}),
btn: [__('OK')],
yes: function (index, layero) {
var category = $("select[name='category']", layero).val();
Fast.api.ajax({
url: "general/attachment/classify",
type: "post",
data: {category: category, ids: ids.join(',')},
}, function () {
table.bootstrapTable('refresh', {});
Layer.close(index);
});
},
success: function (layero, index) {
}
});
});
},
select: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'general/attachment/select',
}
});
var urlArr = [];
var multiple = Backend.api.query('multiple');
multiple = multiple == 'true' ? true : false;
var table = $("#table");
table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function (e, row) {
if (e.type == 'check' || e.type == 'uncheck') {
row = [row];
} else {
urlArr = [];
}
$.each(row, function (i, j) {
if (e.type.indexOf("uncheck") > -1) {
var index = urlArr.indexOf(j.url);
if (index > -1) {
urlArr.splice(index, 1);
}
} else {
urlArr.indexOf(j.url) == -1 && urlArr.push(j.url);
}
});
});
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
sortName: 'id',
showToggle: false,
showExport: false,
maintainSelected: true,
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{field: 'state', checkbox: multiple, visible: multiple, operate: false},
{field: 'id', title: __('Id')},
{field: 'category', title: __('Category'), operate: 'in', formatter: Table.api.formatter.label, searchList: Config.categoryList},
{field: 'admin_id', title: __('Admin_id'), formatter: Table.api.formatter.search, visible: false},
{field: 'user_id', title: __('User_id'), formatter: Table.api.formatter.search, visible: false},
{field: 'url', title: __('Preview'), formatter: Controller.api.formatter.thumb, operate: false},
{field: 'filename', title: __('Filename'), sortable: true, formatter: Controller.api.formatter.filename, operate: 'like'},
{field: 'imagewidth', title: __('Imagewidth'), operate: false, sortable: true},
{field: 'imageheight', title: __('Imageheight'), operate: false, sortable: true},
{
field: 'mimetype', title: __('Mimetype'), sortable: true, operate: 'LIKE %...%',
process: function (value, arg) {
return value.replace(/\*/g, '%');
},
formatter: Controller.api.formatter.mimetype
},
{field: 'createtime', title: __('Createtime'), width: 120, formatter: Table.api.formatter.datetime, datetimeFormat: 'YYYY-MM-DD', operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{
field: 'operate', title: __('Operate'), width: 85, events: {
'click .btn-chooseone': function (e, value, row, index) {
Fast.api.close({url: row.url, multiple: multiple});
},
}, formatter: function () {
return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';
}
}
]
]
});
// 绑定过滤事件
$('.filter-type ul li a', table.closest(".panel-intro")).on('click', function (e) {
$(this).closest("ul").find("li").removeClass("active");
$(this).closest("li").addClass("active");
var field = 'mimetype';
var value = $(this).data("value") || '';
var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
if (object.prop('tagName') == "SELECT") {
$("option[value='" + value + "']", object).prop("selected", true);
} else {
object.val(value);
}
table.trigger("uncheckbox");
table.bootstrapTable('refresh', {pageNumber: 1});
});
// 选中多个
$(document).on("click", ".btn-choose-multi", function () {
Fast.api.close({url: urlArr.join(","), multiple: multiple});
});
// 为表格绑定事件
Table.api.bindevent(table);
require(['upload'], function (Upload) {
$("#toolbar .faupload").data("category", function (file) {
var category = $("ul.nav-tabs[data-field='category'] li.active a").data("value");
return category;
});
Upload.api.upload($("#toolbar .faupload"), function () {
$(".btn-refresh").trigger("click");
});
});
},
add: function () {
//上传完成后刷新父窗口
$(".faupload").data("upload-complete", function (files) {
setTimeout(function () {
window.parent.$(".btn-refresh").trigger("click");
}, 100);
});
// 获取上传类别
$("#faupload-third,#faupload-third-chunking").data("category", function (file) {
return $("#category-third").val();
});
// 获取上传类别
$("#faupload-local,#faupload-local-chunking").data("category", function (file) {
return $("#category-local").val();
});
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
},
formatter: {
thumb: function (value, row, index) {
var html = '';
if (row.mimetype.indexOf("image") > -1) {
html = '<a href="' + row.fullurl + '" target="_blank"><img src="' + row.fullurl + row.thumb_style + '" alt="" style="max-height:60px;max-width:120px"></a>';
} else {
html = '<a href="' + row.fullurl + '" target="_blank"><img src="' + Fast.api.fixurl("ajax/icon") + "?suffix=" + row.imagetype + '" alt="" style="max-height:90px;max-width:120px"></a>';
}
return '<div style="width:120px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + html + '</div>';
},
url: function (value, row, index) {
return '<a href="' + row.fullurl + '" target="_blank" class="label bg-green">' + row.url + '</a>';
},
filename: function (value, row, index) {
return '<div style="width:150px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + Table.api.formatter.search.call(this, value, row, index) + '</div>';
},
mimetype: function (value, row, index) {
return '<div style="width:80px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + Table.api.formatter.search.call(this, value, row, index) + '</div>';
},
}
}
};
return Controller;
});

View File

@@ -0,0 +1,140 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
$("form.edit-form").data("validator-options", {
display: function (elem) {
return $(elem).closest('tr').find("td:first").text();
}
});
Form.api.bindevent($("form.edit-form"));
//不可见的元素不验证
$("form#add-form").data("validator-options", {
ignore: ':hidden',
rules: {
content: function () {
return ['radio', 'checkbox', 'select', 'selects'].indexOf($("#add-form select[name='row[type]']").val()) > -1;
},
extend: function () {
return $("#add-form select[name='row[type]']").val() == 'custom';
}
}
});
Form.api.bindevent($("form#add-form"), function (ret) {
setTimeout(function () {
location.reload();
}, 1500);
});
//渲染关联显示字段和存储字段
var renderselect = function (id, data, defaultvalue) {
var html = [];
for (var i = 0; i < data.length; i++) {
html.push("<option value='" + data[i].name + "' " + (defaultvalue == data[i].name ? "selected" : "") + " data-subtext='" + data[i].title + "'>" + data[i].name + "</option>");
}
var select = $(id);
$(select).html(html.join(""));
select.trigger("change");
if (select.data("selectpicker")) {
select.selectpicker('refresh');
}
};
//关联表切换
$(document).on('change', "#c-selectpage-table", function (e, first) {
var that = this;
Fast.api.ajax({
url: "general/config/get_fields_list",
data: {table: $(that).val()},
}, function (data, ret) {
renderselect("#c-selectpage-primarykey", data.fieldList, first ? $("#c-selectpage-primarykey").data("value") : '');
renderselect("#c-selectpage-field", data.fieldList, first ? $("#c-selectpage-field").data("value") : '');
return false;
});
return false;
});
//如果编辑模式则渲染已知数据
if (['selectpage', 'selectpages'].indexOf($("#c-type").val()) > -1) {
$("#c-selectpage-table").trigger("change", true);
}
//切换类型时
$(document).on("change", "#c-type", function () {
var value = $(this).val();
$(".tf").addClass("hidden");
$(".tf.tf-" + value).removeClass("hidden");
if (["selectpage", "selectpages"].indexOf(value) > -1 && $("#c-selectpage-table option").length == 1) {
//异步加载表列表
Fast.api.ajax({
url: "general/config/get_table_list",
}, function (data, ret) {
renderselect("#c-selectpage-table", data.tableList);
return false;
});
}
});
//切换显示隐藏变量字典列表
$(document).on("change", "form#add-form select[name='row[type]']", function (e) {
$("#add-content-container").toggleClass("hide", ['select', 'selects', 'checkbox', 'radio'].indexOf($(this).val()) > -1 ? false : true);
});
//选择规则
$(document).on("click", ".rulelist > li > a", function () {
var ruleArr = $("#rule").val() == '' ? [] : $("#rule").val().split(";");
var rule = $(this).data("value");
var index = ruleArr.indexOf(rule);
if (index > -1) {
ruleArr.splice(index, 1);
} else {
ruleArr.push(rule);
}
$("#rule").val(ruleArr.join(";"));
$(this).parent().toggleClass("active");
});
//添加向发件人发送测试邮件按钮和方法
$('input[name="row[mail_from]"]').parent().next().append('<a class="btn btn-info testmail">' + __('Send a test message') + '</a>');
$(document).on("click", ".testmail", function () {
var that = this;
Layer.prompt({title: __('Please input your email'), formType: 0}, function (value, index) {
Backend.api.ajax({
url: "general/config/emailtest",
data: $(that).closest("form").serialize() + "&receiver=" + value
});
});
});
//删除配置
$(document).on("click", ".btn-delcfg", function () {
var that = this;
Layer.confirm(__('Are you sure you want to delete this item?'), {
icon: 3,
title: '提示'
}, function (index) {
Backend.api.ajax({
url: "general/config/del",
data: {name: $(that).data("name")}
}, function () {
$(that).closest("tr").remove();
Layer.close(index);
});
});
});
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,57 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'upload'], function ($, undefined, Backend, Table, Form, Upload) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
search: true,
advancedSearch: true,
pagination: true,
extend: {
"index_url": "general/profile/index",
"add_url": "",
"edit_url": "",
"del_url": "",
"multi_url": "",
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
columns: [
[
{field: 'id', title: 'ID'},
{field: 'title', title: __('Title')},
{field: 'url', title: __('Url'), align: 'left', formatter: Table.api.formatter.url},
{field: 'ip', title: __('ip'), formatter:Table.api.formatter.search},
{field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
]
],
commonSearch: false
});
// 为表格绑定事件
Table.api.bindevent(table);//当内容渲染完成后
// 给上传按钮添加上传成功事件
$("#faupload-avatar").data("upload-success", function (data) {
var url = Backend.api.cdnurl(data.url);
$(".profile-user-img").prop("src", url);
Toastr.success("上传成功!");
});
// 给表单绑定事件
Form.api.bindevent($("#update-form"), function () {
$("input[name='row[password]']").val('');
var url = Backend.api.cdnurl($("#c-avatar").val());
top.window.$(".user-panel .image img,.user-menu > a > img,.user-header > img").prop("src", url);
return true;
});
},
};
return Controller;
});

View File

@@ -0,0 +1,423 @@
define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], function ($, undefined, Backend, undefined, AdminLTE, Form) {
var Controller = {
index: function () {
//双击重新加载页面
$(document).on("dblclick", ".sidebar-menu li > a", function (e) {
$("#con_" + $(this).attr("addtabs") + " iframe").attr('src', function (i, val) {
return val;
});
e.stopPropagation();
});
//修复在移除窗口时下拉框不隐藏的BUG
$(window).on("blur", function () {
$("[data-toggle='dropdown']").parent().removeClass("open");
if ($("body").hasClass("sidebar-open")) {
$(".sidebar-toggle").trigger("click");
}
});
//快捷搜索
$(".menuresult").width($("form.sidebar-form > .input-group").width());
var searchResult = $(".menuresult");
$("form.sidebar-form").on("blur", "input[name=q]", function () {
searchResult.addClass("hide");
}).on("focus", "input[name=q]", function () {
if ($("a", searchResult).length > 0) {
searchResult.removeClass("hide");
}
}).on("keyup", "input[name=q]", function () {
searchResult.html('');
var val = $(this).val();
var html = [];
if (val != '') {
$("ul.sidebar-menu li a[addtabs]:not([href^='javascript:;'])").each(function () {
if ($("span:first", this).text().indexOf(val) > -1 || $(this).attr("py").indexOf(val) > -1 || $(this).attr("pinyin").indexOf(val) > -1) {
html.push('<a data-url="' + ($(this).attr("url") || $(this).attr("href")) + '" href="javascript:;">' + $("span:first", this).text() + '</a>');
if (html.length >= 100) {
return false;
}
}
});
}
$(searchResult).append(html.join(""));
if (html.length > 0) {
searchResult.removeClass("hide");
} else {
searchResult.addClass("hide");
}
});
//快捷搜索点击事件
$("form.sidebar-form").on('mousedown click', '.menuresult a[data-url]', function () {
Backend.api.addtabs($(this).data("url"));
});
//切换左侧sidebar显示隐藏
$(document).on("click fa.event.toggleitem", ".sidebar-menu li > a", function (e) {
var nextul = $(this).next("ul");
if (nextul.length == 0 && (!$(this).parent("li").hasClass("treeview") || ($("body").hasClass("multiplenav") && $(this).parent().parent().hasClass("sidebar-menu")))) {
$(".sidebar-menu li").not($(this).parents("li")).removeClass("active");
}
//当外部触发隐藏的a时,触发父辈a的事件
if (!$(this).closest("ul").is(":visible")) {
//如果不需要左侧的菜单栏联动可以注释下面一行即可
$(this).closest("ul").prev().trigger("click");
}
var visible = nextul.is(":visible");
if (nextul.length == 0) {
$(this).parents("li").addClass("active");
$(this).closest(".treeview").addClass("treeview-open");
} else {
}
e.stopPropagation();
});
//清除缓存
$(document).on('click', "ul.wipecache li a,a.wipecache", function () {
$.ajax({
url: 'ajax/wipecache',
dataType: 'json',
data: {type: $(this).data("type")},
cache: false,
success: function (ret) {
if (ret.hasOwnProperty("code")) {
var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
if (ret.code === 1) {
Toastr.success(msg ? msg : __('Wipe cache completed'));
} else {
Toastr.error(msg ? msg : __('Wipe cache failed'));
}
} else {
Toastr.error(__('Unknown data format'));
}
}, error: function () {
Toastr.error(__('Network error'));
}
});
});
//全屏事件
$(document).on('click', "[data-toggle='fullscreen']", function () {
var doc = document.documentElement;
if ($(document.body).hasClass("full-screen")) {
$(document.body).removeClass("full-screen");
document.exitFullscreen ? document.exitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen();
} else {
$(document.body).addClass("full-screen");
doc.requestFullscreen ? doc.requestFullscreen() : doc.mozRequestFullScreen ? doc.mozRequestFullScreen() : doc.webkitRequestFullscreen ? doc.webkitRequestFullscreen() : doc.msRequestFullscreen && doc.msRequestFullscreen();
}
});
var multiplenav = $("body").hasClass("multiplenav") > 0 ? true : false;
var firstnav = $("#firstnav .nav-addtabs");
var nav = multiplenav ? $("#secondnav .nav-addtabs") : firstnav;
//刷新菜单事件
$(document).on('refresh', '.sidebar-menu', function () {
Fast.api.ajax({
url: 'index/index',
data: {action: 'refreshmenu'},
loading: false
}, function (data) {
$(".sidebar-menu li:not([data-rel='external'])").remove();
$(".sidebar-menu").prepend(data.menulist);
if (multiplenav) {
firstnav.html(data.navlist);
}
$("li[role='presentation'].active a", nav).trigger('click');
$(window).trigger("resize");
return false;
}, function () {
return false;
});
});
if (multiplenav) {
firstnav.css("overflow", "inherit");
//一级菜单自适应
$(window).resize(function () {
var siblingsWidth = 0;
firstnav.siblings().each(function () {
siblingsWidth += $(this).outerWidth();
});
firstnav.width(firstnav.parent().width() - siblingsWidth);
firstnav.refreshAddtabs();
});
//点击顶部第一级菜单栏
firstnav.on("click", "li a", function () {
$("li", firstnav).removeClass("active");
$(this).closest("li").addClass("active");
$(".sidebar-menu > li[pid]").addClass("hidden");
if ($(this).attr("url") == "javascript:;") {
var sonlist = $(".sidebar-menu > li[pid='" + $(this).attr("addtabs") + "']");
sonlist.removeClass("hidden");
var sidenav;
var last_id = $(this).attr("last-id");
if (last_id) {
sidenav = $(".sidebar-menu > li[pid='" + $(this).attr("addtabs") + "'] a[addtabs='" + last_id + "']");
} else {
sidenav = $(".sidebar-menu > li[pid='" + $(this).attr("addtabs") + "']:first > a");
}
if (sidenav) {
sidenav.attr("href") != "javascript:;" && sidenav.trigger('click');
}
} else {
}
});
var mobilenav = $(".mobilenav");
$("#firstnav .nav-addtabs li a").each(function () {
mobilenav.append($(this).clone().addClass("btn btn-app"));
});
//点击移动端一级菜单
mobilenav.on("click", "a", function () {
$("a", mobilenav).removeClass("active");
$(this).addClass("active");
$(".sidebar-menu > li[pid]").addClass("hidden");
if ($(this).attr("url") == "javascript:;") {
var sonlist = $(".sidebar-menu > li[pid='" + $(this).attr("addtabs") + "']");
sonlist.removeClass("hidden");
}
});
//点击左侧菜单栏
$(document).on('click', '.sidebar-menu li a[addtabs]', function (e) {
var parents = $(this).parentsUntil("ul.sidebar-menu", "li");
var top = parents[parents.length - 1];
var pid = $(top).attr("pid");
if (pid) {
var obj = $("li a[addtabs=" + pid + "]", firstnav);
var last_id = obj.attr("last-id");
if (!last_id || last_id != pid) {
obj.attr("last-id", $(this).attr("addtabs"));
if (!obj.closest("li").hasClass("active")) {
obj.trigger("click");
}
}
mobilenav.find("a").removeClass("active");
mobilenav.find("a[addtabs='" + pid + "']").addClass("active");
}
});
}
//这一行需要放在点击左侧链接事件之前
var addtabs = Config.referer ? sessionStorage.getItem("addtabs") : null;
//绑定tabs事件,如果需要点击强制刷新iframe,则请将iframeForceRefresh置为true,iframeForceRefreshTable只强制刷新表格
nav.addtabs({iframeHeight: "100%", iframeForceRefresh: false, iframeForceRefreshTable: true, nav: nav});
if ($("ul.sidebar-menu li.active a").length > 0) {
$("ul.sidebar-menu li.active a").trigger("click");
} else {
if (multiplenav) {
$("li:first > a", firstnav).trigger("click");
} else {
$("ul.sidebar-menu li a[url!='javascript:;']:first").trigger("click");
}
}
//如果是刷新操作则直接返回刷新前的页面
if (Config.referer) {
if (Config.referer === $(addtabs).attr("url")) {
var active = $("ul.sidebar-menu li a[addtabs=" + $(addtabs).attr("addtabs") + "]");
if (multiplenav && active.length == 0) {
active = $("ul li a[addtabs='" + $(addtabs).attr("addtabs") + "']");
}
if (active.length > 0) {
active.trigger("click");
} else {
$(addtabs).appendTo(document.body).addClass("hide").trigger("click");
}
} else {
//刷新页面后跳到到刷新前的页面
Backend.api.addtabs(Config.referer);
}
}
var createCookie = function (name, value) {
var date = new Date();
date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));
var path = Config.moduleurl;
document.cookie = encodeURIComponent(Config.cookie.prefix + name) + "=" + encodeURIComponent(value) + "; path=" + path + "; expires=" + date.toGMTString();
};
var my_skins = [
"skin-blue",
"skin-black",
"skin-red",
"skin-yellow",
"skin-purple",
"skin-green",
"skin-blue-light",
"skin-black-light",
"skin-red-light",
"skin-yellow-light",
"skin-purple-light",
"skin-green-light",
"skin-black-blue",
"skin-black-purple",
"skin-black-red",
"skin-black-green",
"skin-black-yellow",
"skin-black-pink",
];
// 皮肤切换
$("[data-skin]").on('click', function (e) {
var skin = $(this).data('skin');
if (!$("body").hasClass(skin)) {
$("body").removeClass(my_skins.join(' ')).addClass(skin);
var cssfile = Config.site.cdnurl + "/assets/css/skins/" + skin + ".css";
$('head').append('<link rel="stylesheet" href="' + cssfile + '" type="text/css" />');
$(".skin-list li.active").removeClass("active");
$(".skin-list li a[data-skin='" + skin + "']").parent().addClass("active");
createCookie('adminskin', skin);
}
return false;
});
// 收起菜单栏切换
$("[data-layout='sidebar-collapse']").on('click', function () {
$(".sidebar-toggle").trigger("click");
});
// 切换子菜单显示和菜单小图标的显示
$("[data-menu='show-submenu']").on('click', function () {
createCookie('show_submenu', $(this).prop("checked") ? 1 : 0);
location.reload();
});
// 右侧控制栏切换
$("[data-controlsidebar]").on('click', function () {
var cls = $(this).data('controlsidebar');
$("body").toggleClass(cls);
AdminLTE.layout.fixSidebar();
//Fix the problem with right sidebar and layout boxed
if (cls == "layout-boxed")
AdminLTE.controlSidebar._fix($(".control-sidebar-bg"));
if ($('body').hasClass('fixed') && cls == 'fixed') {
AdminLTE.pushMenu.expandOnHover();
AdminLTE.layout.activate();
}
AdminLTE.controlSidebar._fix($(".control-sidebar-bg"));
AdminLTE.controlSidebar._fix($(".control-sidebar"));
var slide = !AdminLTE.options.controlSidebarOptions.slide;
AdminLTE.options.controlSidebarOptions.slide = slide;
if (!slide)
$('.control-sidebar').removeClass('control-sidebar-open');
});
// 右侧控制栏背景切换
$("[data-sidebarskin='toggle']").on('click', function () {
var sidebar = $(".control-sidebar");
if (sidebar.hasClass("control-sidebar-dark")) {
sidebar.removeClass("control-sidebar-dark")
sidebar.addClass("control-sidebar-light")
} else {
sidebar.removeClass("control-sidebar-light")
sidebar.addClass("control-sidebar-dark")
}
});
// 菜单栏展开或收起
$("[data-enable='expandOnHover']").on('click', function () {
$.AdminLTE.options.sidebarExpandOnHover = $(this).prop("checked") ? 1 : 0;
localStorage.setItem('sidebarExpandOnHover', $.AdminLTE.options.sidebarExpandOnHover);
AdminLTE.pushMenu.expandOnHover();
$.AdminLTE.layout.fixSidebar();
});
// 切换菜单栏
$(document).on("click", ".sidebar-toggle", function () {
setTimeout(function(){
var value = $("body").hasClass("sidebar-collapse") ? 1 : 0;
setTimeout(function () {
$(window).trigger("resize");
}, 300);
createCookie('sidebar_collapse', value);
}, 0);
});
// 切换多级菜单
$(document).on("click", "[data-config='multiplenav']", function () {
var value = $(this).prop("checked") ? 1 : 0;
createCookie('multiplenav', value);
location.reload();
});
// 切换多选项卡
$(document).on("click", "[data-config='multipletab']", function () {
var value = $(this).prop("checked") ? 1 : 0;
$("body").toggleClass("multipletab", value);
createCookie('multipletab', value);
});
// 重设选项
if ($('body').hasClass('fixed')) {
$("[data-layout='fixed']").attr('checked', 'checked');
}
if ($('body').hasClass('layout-boxed')) {
$("[data-layout='layout-boxed']").attr('checked', 'checked');
}
if ($('body').hasClass('sidebar-collapse')) {
$("[data-layout='sidebar-collapse']").attr('checked', 'checked');
}
if ($('ul.sidebar-menu').hasClass('show-submenu')) {
$("[data-menu='show-submenu']").attr('checked', 'checked');
}
var sidebarExpandOnHover = localStorage.getItem('sidebarExpandOnHover');
if (sidebarExpandOnHover == '1') {
$("[data-enable='expandOnHover']").trigger("click");
}
$.each(my_skins, function (i, j) {
if ($("body").hasClass(j)) {
$(".skin-list li a[data-skin='" + j + "']").parent().addClass("active");
}
});
$(window).resize();
},
login: function () {
var lastlogin = localStorage.getItem("lastlogin");
if (lastlogin) {
lastlogin = JSON.parse(lastlogin);
$("#profile-img").attr("src", Backend.api.cdnurl(lastlogin.avatar));
$("#profile-name").val(lastlogin.username);
}
//让错误提示框居中
Fast.config.toastr.positionClass = "toast-top-center";
//本地验证未通过时提示
$("#login-form").data("validator-options", {
invalid: function (form, errors) {
$.each(errors, function (i, j) {
Toastr.error(j);
});
},
target: '#errtips'
});
//为表单绑定事件
Form.api.bindevent($("#login-form"), function (data) {
localStorage.setItem("lastlogin", JSON.stringify({
id: data.id,
username: data.username,
avatar: data.avatar
}));
location.href = Backend.api.fixurl(data.url);
}, function (data) {
$("input[name=captcha]").next(".input-group-addon").find("img").trigger("click");
});
}
};
return Controller;
});

View File

@@ -0,0 +1,114 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function ($, undefined, Backend, Table, Form, undefined) {
//读取选中的条目
$.jstree.core.prototype.get_all_checked = function (full) {
var obj = this.get_selected(), i, j;
for (i = 0, j = obj.length; i < j; i++) {
obj = obj.concat(this.get_node(obj[i]).parents);
}
obj = $.grep(obj, function (v, i, a) {
return v != '#';
});
obj = obj.filter(function (itm, i, a) {
return i == a.indexOf(itm);
});
return full ? $.map(obj, $.proxy(function (i) {
return this.get_node(i);
}, this)) : obj;
};
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'user/group/index',
add_url: 'user/group/add',
edit_url: 'user/group/edit',
del_url: 'user/group/del',
multi_url: 'user/group/multi',
table: 'user_group',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name')},
{field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'updatetime', title: __('Updatetime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"), null, null, function () {
if ($("#treeview").length > 0) {
var r = $("#treeview").jstree("get_all_checked");
$("input[name='row[rules]']").val(r.join(','));
}
return true;
});
//渲染权限节点树
//销毁已有的节点树
$("#treeview").jstree("destroy");
Controller.api.rendertree(nodeData);
//全选和展开
$(document).on("click", "#checkall", function () {
$("#treeview").jstree($(this).prop("checked") ? "check_all" : "uncheck_all");
});
$(document).on("click", "#expandall", function () {
$("#treeview").jstree($(this).prop("checked") ? "open_all" : "close_all");
});
$("select[name='row[pid]']").trigger("change");
},
rendertree: function (content) {
$("#treeview")
.on('redraw.jstree', function (e) {
$(".layer-footer").attr("domrefresh", Math.random());
})
.jstree({
"themes": {"stripes": true},
"checkbox": {
"keep_selected_style": false,
},
"types": {
"root": {
"icon": "fa fa-folder-open",
},
"menu": {
"icon": "fa fa-folder-open",
},
"file": {
"icon": "fa fa-file-o",
}
},
"plugins": ["checkbox", "types"],
"core": {
'check_callback': true,
"data": content
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,130 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'user/rule/index',
add_url: 'user/rule/add',
edit_url: 'user/rule/edit',
del_url: 'user/rule/del',
multi_url: 'user/rule/multi',
table: 'user_rule',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
escape: false,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'pid', title: __('Pid'), visible: false},
{field: 'title', title: __('Title'), align: 'left', formatter: Controller.api.formatter.title},
{field: 'name', title: __('Name'), align: 'left', formatter: Controller.api.formatter.name},
{field: 'remark', title: __('Remark')},
// {field: 'ismenu', title: __('Ismenu'), formatter: Table.api.formatter.toggle},
{field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true, visible: false},
{field: 'updatetime', title: __('Updatetime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true, visible: false},
{field: 'weigh', title: __('Weigh')},
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
],
pagination: false,
search: false,
commonSearch: false,
rowAttributes: function (row, index) {
return row.pid == 0 ? {} : {style: "display:none"};
}
});
// 为表格绑定事件
Table.api.bindevent(table);
table.on('post-body.bs.table', function (e, settings, json, xhr) {
//显示隐藏子节点
$(">tbody>tr[data-index] > td", this).on('click', "a.btn-node-sub", function () {
var status = $(this).data("shown") ? true : false;
$("a[data-pid='" + $(this).data("id") + "']").each(function () {
$(this).closest("tr").toggle(!status);
});
if (status) {
$("a[data-pid='" + $(this).data("id") + "']").trigger("collapse");
}
$(this).data("shown", !status);
$("i", this).toggleClass("fa-caret-down").toggleClass("fa-caret-right");
return false;
});
});
//隐藏子节点
$(document).on("collapse", ".btn-node-sub", function () {
if ($("i", this).length > 0) {
$("a[data-pid='" + $(this).data("id") + "']").trigger("collapse");
}
$("i", this).removeClass("fa-caret-down").addClass("fa-caret-right");
$(this).data("shown", false);
$(this).closest("tr").toggle(false);
});
//展开隐藏一级
$(document.body).on("click", ".btn-toggle", function (e) {
$("a[data-id][data-pid][data-pid!=0].disabled").closest("tr").hide();
var that = this;
var show = $("i", that).hasClass("fa-chevron-down");
$("i", that).toggleClass("fa-chevron-down", !show).toggleClass("fa-chevron-up", show);
$("a[data-id][data-pid][data-pid!=0]").not('.disabled').closest("tr").toggle(show);
$(".btn-node-sub[data-pid=0]").data("shown", show);
});
//展开隐藏全部
$(document.body).on("click", ".btn-toggle-all", function (e) {
var that = this;
var show = $("i", that).hasClass("fa-plus");
$("i", that).toggleClass("fa-plus", !show).toggleClass("fa-minus", show);
$(".btn-node-sub:not([data-pid=0])").closest("tr").toggle(show);
$(".btn-node-sub").data("shown", show);
$(".btn-node-sub > i").toggleClass("fa-caret-down", show).toggleClass("fa-caret-right", !show);
});
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
formatter: {
title: function (value, row, index) {
value = value.toString().replace(/(&|&amp;)nbsp;/g, '&nbsp;');
var caret = row.haschild == 1 || row.ismenu == 1 ? '<i class="fa fa-caret-right"></i>' : '';
value = value.indexOf("&nbsp;") > -1 ? value.replace(/(.*)&nbsp;/, "$1" + caret) : caret + value;
value = !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
return '<a href="javascript:;" data-id="' + row.id + '" data-pid="' + row.pid + '" class="'
+ (row.haschild == 1 || row.ismenu == 1 ? 'text-primary' : 'disabled') + ' btn-node-sub">' + value + '</a>';
},
name: function (value, row, index) {
return !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
},
},
bindevent: function () {
$(document).on('click', "input[name='row[ismenu]']", function () {
var name = $("input[name='row[name]']");
name.prop("placeholder", $(this).val() == 1 ? name.data("placeholder-menu") : name.data("placeholder-node"));
});
$("input[name='row[ismenu]']:checked").trigger("click");
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,65 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'user/user/index',
add_url: 'user/user/add',
edit_url: 'user/user/edit',
del_url: 'user/user/del',
multi_url: 'user/user/multi',
table: 'user',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'user.id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'), sortable: true},
{field: 'group.name', title: __('Group')},
{field: 'username', title: __('Username'), operate: 'LIKE'},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'email', title: __('Email'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
{field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
{field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}},
{field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
{field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true},
{field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
{field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
{field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,213 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/activity/activity/index' + location.search,
add_url: 'wdsxh/activity/activity/add',
edit_url: 'wdsxh/activity/activity/edit',
del_url: 'wdsxh/activity/activity/del',
multi_url: 'wdsxh/activity/activity/multi',
import_url: 'wdsxh/activity/activity/import',
table: 'wdsxh_activity',
}
});
var table = $("#table");
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
});
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'fees', title: __('Fees'), operate:'BETWEEN'},
{field: 'organizing_method', title: __('Organizing_method'), searchList: {"1":__('Organizing_method 1'),"2":__('Organizing_method 2')}, formatter: Table.api.formatter.normal},
{field: 'apply_time', title: __('Apply_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'state', title: __('State'), searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3')}, formatter: Table.api.formatter.normal},
{field: 'is_verifying', title: __('Is_verifying'), searchList: {"1":__('Is_verifying 1'),"2":__('Is_verifying 2')}, formatter: Table.api.formatter.normal},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'applet_activity_qrcode_path', title: __('Applet_activity_qrcode_path'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'points_status', title: __('Points_status'), searchList: {"1":__('Points_status 1'),"2":__('Points_status 2'),"3":__('Points_status 3')}, formatter: Table.api.formatter.normal},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons:[
{
name: 'list',
text: __('报名列表'),
title: __('报名列表'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa fa-list',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/activity/activity_apply?activity_id={id}',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
},
{
name: 'verification_qr_code',
text: __('公众号签到二维码'),
title: __('公众号签到二维码'),
classname: 'btn btn-xs bg-olive btn-dialog',
icon: 'fa fa-qrcode',
extend: 'data-area=["40%","60%"]',
url: 'wdsxh/activity/activity/verification_qr_code',
visible: function (row) {
if(Config.wananchi_appid !== null && Config.wananchi_appid !== undefined && Config.wananchi_appid !== '' && row.is_verifying == '1' && row.verification_method == 1 && row.state != '3'){
return true;
}else{
return false;
}
},
},
{
name: 'verification_applet_code',
text: __('小程序签到二维码'),
title: __('小程序签到二维码'),
classname: 'btn btn-xs bg-black btn-dialog',
icon: 'fa fa-qrcode',
extend: 'data-area=["40%","60%"]',
url: 'wdsxh/activity/activity/verification_applet_code',
visible: function (row) {
if(Config.applet_appid !== null && Config.applet_appid !== undefined && Config.applet_appid !== '' && row.is_verifying == '1' && row.verification_method == 1 && row.state != '3'){
return true;
}else{
return false;
}
},
},
{
name: 'fieldset',
text: __('自定义报名字段'),
title: __('自定义报名字段'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/activity/activity_fieldset/fieldset',
visible: function (row) {
if(row.apply_field_state == 1){
return true;
}else{
return false;
}
},
},
{
name: 'certificate_design',
text: __('设置证书'),
title: __('设置证书'),
classname: 'btn btn-xs btn-success btn-dialog',
icon: 'fa fa-certificate',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/activity/certificate_design/index',
visible: function (row) {
// 只有启用单独证书时才显示按钮
if(row.certificate_enabled == '1'){
return true;
}else{
return false;
}
},
}
]
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
verification_qr_code: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
$(document).on('change','input[name="row[organizing_method]"]',function (){
var type=$(this).val();
switch (type){
case "1":
$('.address').addClass('hide');
$('.url').removeClass('hide');
break;
case "2":
$('.url').addClass('hide');
$('.address').removeClass('hide');
break;
}
});
$(document).on('change','input[name="row[is_verifying]"]',function (){
var type=$(this).val();
switch (type){
case "1"://需要核销
$('.verification_method').removeClass('hide');
break;
case "2"://不需要核销
$('.verification_method').addClass('hide');
$('.verifying_wechat_ids').addClass('hide');
break;
}
});
$(document).on('change','input[name="row[verification_method]"]',function (){
var type=$(this).val();
switch (type){
case "1"://核销方式:自动签到
$('.verifying_wechat_ids').addClass('hide');
break;
case "2"://核销方式:管理员核销
$('.verifying_wechat_ids').removeClass('hide');
break;
}
});
$(document).on('change','input[name="row[points_status]"]',function (){
var type=$(this).val();
switch (type){
case "1"://能活动积分
$('.points').removeClass('hide');
break;
case "2"://不能活动积分
$('.points').addClass('hide');
break;
}
});
$(document).on('change','input[name="row[certificate_enabled]"]',function (){
var type=$(this).val();
switch (type){
case "1"://启用单独证书
$('.certificate_data').removeClass('hide');
break;
case "2"://使用统一证书
$('.certificate_data').addClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,97 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/activity/activity_apply/index' + location.search + '&activity_id=' + Config.activity_id,
add_url: 'wdsxh/activity/activity_apply/add?activity_id=' + Config.activity_id,
multi_url: 'wdsxh/activity/activity_apply/multi',
import_url: 'wdsxh/activity/activity_apply/import',
table: 'wdsxh_activity_apply',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
// {checkbox: true},
{field: 'id', title: __('Id')},
{field: 'order_no', title: '订单号', operate: false},
{field: 'wechat.nickname', title: '用户昵称', operate: 'LIKE'},
{field: 'wechat.avatar', title: '用户头像', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'wechat.mobile', title: '用户电话', operate: false},
{field: 'activity.name', title: __('Activity.name'), operate: 'LIKE'},
{field: 'activity.start_time', title: __('Activity.start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'activity.end_time', title: __('Activity.end_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'activity.fees', title: __('Activity.fees'), operate:'BETWEEN'},
{field: 'state', title: __('State'), searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3'),"4":__('State 4'),"5":__('State 5')}, formatter: Table.api.formatter.normal},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'pay_time', title: __('付款时间'), operate:false},
{field: 'is_sign_in', title: __('Is_sign_in'), searchList: {"1":__('Is_sign_in 1'),"2":__('Is_sign_in 2'),"3":__('Is_sign_in 3')}, formatter: Table.api.formatter.normal},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons: [
{
name: 'field_data_details',
text: __('报名信息'),
title: __('报名信息'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/activity/activity_apply/field_data_details',
visible: function (row) {
if(row.show_field_data == 1){
return true;
}else{
return false;
}
},
},
]
}
]
]
});
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["80%", "80%"]);
})
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
$(document).on('click','#select-user',function () {
Fast.api.open('wdsxh/member/member/activity_seluser?activity_id='+ Config.activity_id,'选择用户',{
area:['80%','95%'],
callback:function(data){
console.log(data);
if(data){
$('#c-uid').val(data.id);
$('#c-user').val(data.nickname);
}else{
Layer.alert("请选择用户");
}
}
});
});
},
field_data_details: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,14 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
config: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,39 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'clipboard', 'designer', 'jquery-contextMenu', 'jquery-form', 'jquery-lazyload', 'poster', 'wdsxh-colorpicker'], function ($, undefined, Backend, Table, Form, Clipboard, Designer, jqueryContextMenu, jqueryForm, jqueryLazyload, poster, colorpicker) {
var Controller = {
index: function () {
$(".panel-body").show()
$("#loading").hide()
$("#faupload-image").data("upload-success", function (data) {
var url = Fast.api.cdnurl(data.url);
$(".bg").prop("src", url);
});
Form.api.bindevent($("form[role=form]"), function (data, ret) {
Toastr.success("成功");
}, function (data, ret) {
Toastr.success("失败");
}, function (success, error) {
var data = getPosterData();
console.log(data)
$('#poster-data').val(JSON.stringify(data));
Form.api.submit(this, success, error);
return false;
});
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"), function (data, ret) {
Toastr.success("成功");
}, function (data, ret) {
Toastr.success("失败");
}, function (success, error) {
var data = getPosterData();
$('#poster-data').val(JSON.stringify(data));
Form.api.submit(this, success, error);
return false;
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,64 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/join_config/index' + location.search,
multi_url: 'wdsxh/member/join_config/multi',
table: 'wdsxh_member_join_config',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'weigh', title: __('Weigh'), operate: false},
{
field: 'operate',
width: "150px",
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'fieldset',
text: __('自定义登记字段'),
title: __('自定义登记字段'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/member/join_config/fieldset',
}
],
formatter: Table.api.formatter.operate
},
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
fieldset: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,39 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'clipboard', 'designer', 'jquery-contextMenu', 'jquery-form', 'jquery-lazyload', 'poster', 'wdsxh-colorpicker'], function ($, undefined, Backend, Table, Form, Clipboard, Designer, jqueryContextMenu, jqueryForm, jqueryLazyload, poster, colorpicker) {
var Controller = {
index: function () {
$(".panel-body").show()
$("#loading").hide()
$("#faupload-image").data("upload-success", function (data) {
var url = Fast.api.cdnurl(data.url);
$(".bg").prop("src", url);
});
Form.api.bindevent($("form[role=form]"), function (data, ret) {
Toastr.success("成功");
}, function (data, ret) {
Toastr.success("失败");
}, function (success, error) {
var data = getPosterData();
console.log(data)
$('#poster-data').val(JSON.stringify(data));
Form.api.submit(this, success, error);
return false;
});
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"), function (data, ret) {
Toastr.success("成功");
}, function (data, ret) {
Toastr.success("失败");
}, function (success, error) {
var data = getPosterData();
$('#poster-data').val(JSON.stringify(data));
Form.api.submit(this, success, error);
return false;
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,122 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/activity/refund/index' + location.search,
// del_url: 'wdsxh/activity/refund/del',
table: 'wdsxh_activity_refund',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
// {checkbox: true},
{field: 'id', title: __('Id')},
{field: 'order.order_no', title: '订单号', operate: 'LIKE'},
{field: 'activity.name', title: '活动名称', operate: 'LIKE'},
{field: 'wechat.nickname', title: '用户昵称', operate: 'LIKE'},
{field: 'wechat.avatar', title: '用户头像', operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'wechat.mobile', title: '用户电话', operate: 'LIKE'},
{field: 'activity.fees', title: '报名费用', operate: false},
{field: 'order.pay_amount', title: '退款费用', operate: false},
{field: 'state', title: __('State'), searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3')}, formatter: Table.api.formatter.normal},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'dispose_time', title: __('Dispose_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{
field: 'buttons',
width: "120px",
title: __('操作'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'agree',
text: __('确认退款'),
title: __('确认退款'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
icon: 'fa fa-check',
url: 'wdsxh/activity/refund/agree',
confirm: '确认并同意退款?退款后费用将原路退回',
visible:function (row){
if(row.state == 1){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
},
{
name: 'refuse',
text: __('拒绝退款'),
title: __('拒绝退款'),
classname: 'btn btn-xs btn-info btn-danger btn-dialog',
icon: 'fa fa-close',
url: 'wdsxh/activity/refund/refuse',
visible: function (row) {
if(row.state == 1){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$(".btn-refresh").trigger("click");
return true;
},
error: function (data, ret) {
Layer.alert(ret.msg);
return false;
}
},
// {
// name: 'del',
// icon: 'fa fa-trash',
// title: __('删除'),
// text: __('删除'),
// extend: 'data-toggle="tooltip"',
// classname: 'btn btn-xs btn-danger btn-delone'
// }
],
formatter: Table.api.formatter.buttons
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
agree: function () {
Controller.api.bindevent();
},
refuse: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,138 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/album/index' + location.search,
add_url: 'wdsxh/album/add',
edit_url: 'wdsxh/album/edit',
del_url: 'wdsxh/album/del',
multi_url: 'wdsxh/album/multi',
import_url: 'wdsxh/album/import',
table: 'wdsxh_album',
},
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'release_date', title: __('Release_date'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/album/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/album/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/album/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
album_config: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
$(document).on('change','input[name="row[type]"]',function (){
var type=$(this).val();
switch (type){
case "1":
$('.images').removeClass('hide');
$('.video').addClass('hide');
$('.image').addClass('hide');
break;
case "2":
$('.image').removeClass('hide');
$('.video').removeClass('hide');
$('.images').addClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,195 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/article/article/index' + location.search,
add_url: 'wdsxh/article/article/add',
edit_url: 'wdsxh/article/article/edit',
del_url: 'wdsxh/article/article/del',
multi_url: 'wdsxh/article/article/multi',
import_url: 'wdsxh/article/article/import',
table: 'wdsxh_article',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'wdsxharticlecat.name', title: __('文章分类'), operate: false},
{field: 'title', title: __('Title'), operate: 'LIKE'},
{field: 'release', title: __('Release'), operate: 'LIKE'},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
// 使用更精确的表单选择器
var $form = $("form#edit-form, form#add-form, form[role=form]");
// 先移除表单的默认提交行为,改为通过按钮点击处理
$form.attr('onsubmit', 'return false;');
Form.api.bindevent($form, {
beforeSubmit: function (form) {
var $filesInput = $('#c-files');
var $hidden = $('#c-filesjson');
if ($filesInput.length === 0 || $hidden.length === 0) return true;
var urlsStr = $.trim($filesInput.val());
if (urlsStr === '') {
$hidden.val('');
return true;
}
var urls = urlsStr.split(/\s*,\s*/);
var namesJsonStr = ($("textarea[name='row[filesdata]']").val() || '').trim();
var namesData = [];
try {
namesData = namesJsonStr ? JSON.parse(namesJsonStr) : [];
} catch (e) {
namesData = [];
}
var arr = [];
for (var i = 0; i < urls.length; i++) {
var url = urls[i];
if (!url) continue;
var name = '';
if (namesData[i] && namesData[i].name) {
name = $.trim(namesData[i].name);
}
if (!name) {
Toastr.error('附件名称不能为空');
return false;
}
arr.push({ url: url, name: name });
}
$hidden.val(JSON.stringify(arr));
return true;
}
});
// 添加额外的表单提交验证
$form.on("submit", function (e) {
console.log('表单提交事件触发'); // 添加调试日志
var $filesInput = $('#c-files');
if ($filesInput.length === 0) return true;
var urlsStr = $.trim($filesInput.val());
if (urlsStr === '') return true;
var urls = urlsStr.split(/\s*,\s*/);
var namesJsonStr = ($("textarea[name='row[filesdata]']").val() || '').trim();
var namesData = [];
try {
namesData = namesJsonStr ? JSON.parse(namesJsonStr) : [];
} catch (e) {
namesData = [];
}
console.log('附件数量:', urls.length); // 添加调试日志
console.log('名称数据:', namesData); // 添加调试日志
for (var i = 0; i < urls.length; i++) {
if (!(namesData[i] && $.trim(namesData[i].name))) {
console.log('第', i+1, '个附件名称为空'); // 添加调试日志
Toastr.error('附件名称不能为空');
e.preventDefault();
e.stopImmediatePropagation();
// 添加更强制的方法阻止表单提交
if (e.cancelable !== false) {
e.preventDefault();
}
// 返回false并阻止事件冒泡
return false;
}
}
return true;
});
// 添加按钮点击事件作为主要的验证层
$form.find('button[type="submit"]').on('click', function (e) {
console.log('提交按钮点击事件触发'); // 添加调试日志
var $filesInput = $('#c-files');
if ($filesInput.length === 0) {
// 如果没有附件输入框,直接提交表单
console.log('没有附件输入框,直接提交表单');
return true;
}
var urlsStr = $.trim($filesInput.val());
if (urlsStr === '') {
// 如果没有附件,直接提交表单
console.log('没有附件,直接提交表单');
return true;
}
var urls = urlsStr.split(/\s*,\s*/);
var namesJsonStr = ($("textarea[name='row[filesdata]']").val() || '').trim();
var namesData = [];
try {
namesData = namesJsonStr ? JSON.parse(namesJsonStr) : [];
} catch (e) {
namesData = [];
}
console.log('按钮点击验证 - 附件数量:', urls.length); // 添加调试日志
console.log('按钮点击验证 - 名称数据:', namesData); // 添加调试日志
for (var i = 0; i < urls.length; i++) {
if (!(namesData[i] && $.trim(namesData[i].name))) {
console.log('按钮点击验证 - 第', i+1, '个附件名称为空'); // 添加调试日志
Toastr.error('附件名称不能为空');
e.preventDefault();
e.stopImmediatePropagation();
return false;
}
}
// 验证通过移除onsubmit属性并允许表单正常提交
console.log('验证通过,允许表单提交');
$form.removeAttr('onsubmit');
return true;
});
$(document).on('change','input[name="row[type]"]',function (){
var type=$(this).val();
switch (type){
case "1":
$('.linktext').addClass('hide');
$('.release').removeClass('hide');
$('.read_num').removeClass('hide');
$('.teletext').removeClass('hide');
$('.files').removeClass('hide');
break;
case "2":
$('.linktext').removeClass('hide');
$('.release').addClass('hide');
$('.read_num').addClass('hide');
$('.teletext').addClass('hide');
$('.files').addClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,59 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/article/article_cat/index' + location.search,
add_url: 'wdsxh/article/article_cat/add',
edit_url: 'wdsxh/article/article_cat/edit',
del_url: 'wdsxh/article/article_cat/del',
multi_url: 'wdsxh/article/article_cat/multi',
import_url: 'wdsxh/article/article_cat/import',
table: 'wdsxh_article_cat',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'),align: 'left',formatter: Controller.api.formatter.title},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
formatter: {
title: function (value, row, index) {
value = value.toString().replace(/(&|&amp;)nbsp;/g, '&nbsp;');
return !row.ismenu || row.status == 'hidden' ? "<span class='text-primary'>" + value + "</span>" : value;
}
},
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,90 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/banner/index' + location.search,
add_url: 'wdsxh/banner/add',
edit_url: 'wdsxh/banner/edit',
del_url: 'wdsxh/banner/del',
multi_url: 'wdsxh/banner/multi',
import_url: 'wdsxh/banner/import',
table: 'wdsxh_banner',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), operate: 'LIKE'},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'jump_type', title: __('Jump_type'), searchList: {"1":__('Jump_type 1'),"2":__('Jump_type 2'),"3":__('Jump_type 3'),"4":__('Jump_type 4')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.toggle},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$("#c-jump_link").data("format-item", function(row){
return row.name + " 【" + row.url+"】";
});
Form.api.bindevent($("form[role=form]"));
$(document).on('change','input[name="row[jump_type]"]',function (){
var type=$(this).val();
switch (type){
case "1":
$('.page-url').addClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').removeClass('hide');
break;
case "2":
$('.page-url').removeClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').addClass('hide');
break;
case "3":
$('.page-url').addClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').removeClass('hide');
$('.teletext').addClass('hide');
break;
case "4":
$('.page-url').addClass('hide');
$('.outer-url').removeClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').addClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,14 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,165 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/business/business/index' + location.search,
add_url: 'wdsxh/business/business/add',
edit_url: 'wdsxh/business/business/edit',
del_url: 'wdsxh/business/business/del',
multi_url: 'wdsxh/business/business/multi',
import_url: 'wdsxh/business/business/import',
table: 'wdsxh_business',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'category.name', title: __('分类名称'), operate:false},
{field: 'member.name', title: __('发布人名称'), operate:false},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'state', title: __('State'), searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3')}, formatter: Table.api.formatter.normal},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'three_adopt',
text: __('通过'),
title: __('通过申请'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
url: 'wdsxh/business/business/three_adopt',
confirm: '确认并同意申请?',
visible:function(row){
if(row['state']==1){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
},
{
name: 'three_reject',
text:'驳回',
classname: 'btn btn-xs btn-primary btn-warning btn-view btn-dialog',
icon: 'fa fa-times',
url: 'wdsxh/business/business/three_reject',
visible:function(row){
if(row['state']==1){
return true;
}else{
return false;
}
},
refresh:true
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/business/business/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/business/business/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/business/business/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
three_reject:function () {
Controller.api.bindevent();
},
business_config:function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,116 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/business/category/index' + location.search,
add_url: 'wdsxh/business/category/add',
edit_url: 'wdsxh/business/category/edit',
del_url: 'wdsxh/business/category/del',
multi_url: 'wdsxh/business/category/multi',
import_url: 'wdsxh/business/category/import',
table: 'wdsxh_business_category',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/business/category/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/business/category/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/business/category/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,49 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/company_goods/index' + location.search,
edit_url: 'wdsxh/company_goods/edit',
del_url: 'wdsxh/company_goods/del',
multi_url: 'wdsxh/company_goods/multi',
import_url: 'wdsxh/company_goods/import',
table: 'wdsxh_company_goods',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,56 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form','wdsxh-colorpicker'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
Controller.api.bindevent();
//选择颜色
var colorpickerObj = null;
$(document).on("click", ".colorpicker", function () {
var that = this;
var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
var color = $("#" + input_id).val();
if (!colorpickerObj) {
colorpickerObj = Colorpicker.create({
el: "colorpicker",
color: color ? color : 'rgba(0,0,0)',
allMode: 'hex',
change: function (elem, rgba, hex) {
$("#" + input_id).val(hex);
}
});
} else {
colorpickerObj.color = color ? color : 'rgba(0,0,0)';
// 调用 Colorpicker 库中提供的方法来重新渲染颜色选择器
colorpickerObj.render();
}
// 显示颜色选择器
colorpickerObj.show();
});
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
$(document).on('change','input[name="row[jump_type]"]',function (){
var type=$(this).val();
switch (type){
case "1"://小程序客服
$('.jump_link').addClass('hide');
$('.call_mobile').addClass('hide');
break;
case "2"://拨打电话
$('.jump_link').addClass('hide');
$('.call_mobile').removeClass('hide');
break;
case "3"://外部链接
$('.call_mobile').addClass('hide');
$('.jump_link').removeClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,100 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/corporate/card/index' + location.search,
edit_url: 'wdsxh/corporate/card/edit',
del_url: 'wdsxh/corporate/card/del',
table: 'wdsxh_corporate_card',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'share_title', title: __('Share_title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'company_name', title: __('Company_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'company_position', title: __('Company_position'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'company_address', title: __('Company_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'wechat_number', title: __('Wechat_number'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'is_default', title: __('Is_default'), searchList: {"1":__('Is_default 1'),"2":__('Is_default 2')}, formatter: Table.api.formatter.normal},
{field: 'is_hide_avatar', title: __('Is_hide_avatar'), searchList: {"1":__('Is_hide_avatar 1'),"2":__('Is_hide_avatar 2')}, formatter: Table.api.formatter.normal},
{field: 'is_wechat_number_public', title: __('Is_wechat_number_public'), searchList: {"1":__('Is_wechat_number_public 1'),"2":__('Is_wechat_number_public 2')}, formatter: Table.api.formatter.normal},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'details',
text: __('查看详情'),
title: __('查看详情'),
classname: 'btn btn-xs btn-info btn-dialog',
url: 'wdsxh/corporate/card/details',
extend: 'data-area=["80%","80%"]',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
}
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
details: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
$('body').on('click', '[data-tips-image]', function () {
var img = new Image();
var imgWidth = this.getAttribute('data-width') || '480px';
img.onload = function () {
var $content = $(img).appendTo('body').css({background: '#fff', width: imgWidth, height: 'auto'});
Layer.open({
type: 1, area: imgWidth, title: false, closeBtn: 1,
skin: 'layui-layer-nobg', shadeClose: true, content: $content,
end: function () {
$(img).remove();
},
success: function () {
}
});
};
img.onerror = function (e) {
};
img.src = this.getAttribute('data-tips-image') || this.src;
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,116 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/corporate/card_background/index' + location.search,
add_url: 'wdsxh/corporate/card_background/add',
edit_url: 'wdsxh/corporate/card_background/edit',
del_url: 'wdsxh/corporate/card_background/del',
multi_url: 'wdsxh/corporate/card_background/multi',
import_url: 'wdsxh/corporate/card_background/import',
table: 'wdsxh_corporate_card_background',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'font_color', title: __('FontColor'), searchList: {"#5A5B6E":__('Black'),"#FFFFFF":__('White')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/corporate/card_background/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/corporate/card_background/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/corporate/card_background/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,80 @@
define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template) {
var Controller = {
index: function () {
// 基于准备好的dom初始化echarts实例
var myChart = Echarts.init(document.getElementById('echart'), 'walden');
// 指定图表的配置项和数据
var option = {
title: {
text: '',
subtext: ''
},
color: [
"#18d1b1",
"#3fb1e3",
"#626c91",
"#a0a7e6",
"#c4ebad",
"#96dee8"
],
tooltip: {
trigger: 'axis'
},
legend: {
data: [__('Register user')]
},
toolbox: {
show: false,
feature: {
magicType: {show: true, type: ['stack', 'tiled']},
saveAsImage: {show: true}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: Config.column
},
yAxis: {},
grid: [{
left: 'left',
top: 'top',
right: '10',
bottom: 30
}],
series: [{
name: __('Register user'),
type: 'line',
smooth: true,
areaStyle: {
normal: {}
},
lineStyle: {
normal: {
width: 1.5
}
},
data: Config.userdata
}]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
$(window).resize(function () {
myChart.resize();
});
$(document).on("click", ".btn-refresh", function () {
setTimeout(function () {
myChart.resize();
}, 0);
});
}
};
return Controller;
});

View File

@@ -0,0 +1,158 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/demand/index' + location.search,
del_url: 'wdsxh/demand/del',
table: 'wdsxh_demand',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{
field: 'wechat.nickname',
title: __('Wdsxh_user_id'),
formatter: function (value, row, index) {
if (row.is_anonymity == 1) {
return '***'; // 这里是一个简单的示例,实际情况下需要根据需求进行处理
// return '用户匿名提交'; // 显示提示信息
} else if (row.is_anonymity == 2) {
return value; // 其他状态保持原样显示
}
}
},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'is_anonymity', title: __('Is_anonymity'), searchList: {"1":__('Is_anonymity 1'),"2":__('Is_anonymity 2')}, formatter: Table.api.formatter.normal},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.normal},
{field: 'processing_time', title: __('Processing_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
text:'反馈详情',
name: 'details',
title: '订单详情',
classname: 'btn btn-xs btn-primary btn-dialog bg-aqua',
icon: 'fa',
url: 'wdsxh/demand/details',
extend:'data-area=["95%","95%"]',
},
{
name: 'processing',
text: __('处理'),
title: __('处理'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax bg-olive',
icon: 'fa',
url: 'wdsxh/demand/processing',
confirm: '确认处理?',
visible:function (row){
if(row.status == 2){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
}
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/demand/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/demand/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/demand/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,727 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/diy_page/index' + location.search,
add_url: 'wdsxh/diy_page/add',
edit_url: 'wdsxh/diy_page/edit',
del_url: 'wdsxh/diy_page/del',
multi_url: 'wdsxh/diy_page/multi',
import_url: 'wdsxh/diy_page/import',
table: 'wdsxh_diy_page',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{ checkbox: true },
{ field: 'id', title: __('Id') },
{
field: 'page_name',
title: __('Page Name')
},
{ field: 'status', title: __('Status'), searchList: { "home": __('Status home'), "custom": __('Status custom') }, formatter: Table.api.formatter.status },
{ field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'updatetime', title: __('Updatetime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{
field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, buttons: [
{
name: 'adopt',
text: '设为首页',
title: '设为首页',
confirm: '页面类型确认设为首页吗?',
classname: 'btn btn-xs btn-info btn-view btn-ajax',
url: 'wdsxh/diy_page/set_home',
hidden: function (row) {
if (row.status != 'home') {
return false;
} else {
return true;
}
},
refresh: true
},
],
}
]
]
});
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
new Vue({
el: '#diy',
data: {
// 默认组件数据
defaultData: defaultData,
// 模板数据
pageData: pageData,
// 已选组件索引
selectedIndex: -1,
// 当前组件数据
currentData: {},
// 选择弹窗是否显示
selectVisible: false,
// 选择弹窗数据
selectData: null,
// 选择弹窗选中类型
selectType: 'Custom',
// 选择弹窗选中回调事件
selectCallback: null,
// 选择弹窗表单数据
selectForm: {
title: "",
content: "",
appid: '',
path: '',
protocol: '',
url: '',
phone: '',
},
// 文章分类列表
articleCategoryList: [],
// 供需分类列表
demandCategoryList: [],
},
created() {
$("#diy").show()
$("#loading").hide()
this.pageData.page.activeName = "first"
this.getArticleCategory()
this.getDemandCategory()
},
methods: {
// 添加组件
handleAdd(type) {
this.pageData.items.push(JSON.parse(JSON.stringify(defaultData[type])));
this.handleEdit(this.pageData.items.length - 1);
setTimeout(() => {
const listContainer = document.querySelector(".main-center .scroll-drag")
listContainer.scrollTop = listContainer.scrollHeight;
}, 50);
},
// 编辑组件
handleEdit(index) {
this.selectedIndex = index;
this.currentData = {}
this.$nextTick(() => {
this.currentData = this.selectedIndex == -1 ? this.pageData.page : this.pageData.items[this.selectedIndex];
if (!this.currentData.activeName) this.currentData.activeName = "first"
if (this.currentData.type == "richTextDiy") {
this.$nextTick(() => {
Form.api.bindevent($("form[role=form]"));
$('#richTextDiy').on('change', () => {
this.currentData.params.content = $('#richTextDiy').val()
});
})
}
})
},
// 拖动组件
handleDrag(event) {
this.handleEdit(event.newIndex);
},
// 获取当前时间
getCurrentDate() {
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}`;
},
// 重置颜色
handleResetColor(source, key, color) {
source[key] = color;
},
// 选择图片
handleSelectImage(source, index, type = "image/") {
parent.Fast.api.open(`general/attachment/select?element_id=&multiple=true&mimetype=${type}*`, __('Choose'), {
callback: (data) => {
if (data.multiple) {
var url = Fast.api.cdnurl(data.url);
this.$set(source, index, url)
}
}
});
},
// 删除图片
handleDeleteImage(source, index) {
this.$set(source, index, "")
},
// 获取文章分类
getArticleCategory() {
$.post('wdsxh/diy_page/get_article_category', {}, (res) => {
this.articleCategoryList = res.rows
});
},
// 选择文章分类
handleSelectArticleCategory(source, event) {
if (event) {
const index = this.articleCategoryList.findIndex(item => item.id == event)
if (index > -1) source.categoryName = this.articleCategoryList[index].name
else source.categoryName = ""
} else {
source.categoryName = ""
}
},
// 获取供需分类
getDemandCategory() {
$.post('wdsxh/diy_page/get_demand_category', {}, (res) => {
this.demandCategoryList = res.rows
});
},
// 选择文章分类
handleSelectDemandCategory(source, event) {
if (event) {
const index = this.demandCategoryList.findIndex(item => item.id == event)
if (index > -1) source.categoryName = this.demandCategoryList[index].name
else source.categoryName = ""
} else {
source.categoryName = ""
}
},
// 选择组件类型
handleSelectType(source) {
this.selectCallback = (type, row) => {
source['link'] = null;
switch (type) {
case 'Custom':
var path = row.path
if (row.parameter) {
if (path.indexOf("?") > -1) path += "&" + row.parameter
else path += "?" + row.parameter
}
source['link'] = { type: type, title: row.title, path: path, };
break;
case 'Inlay':
source['link'] = { type: type, title: row.title, path: row.path };
break;
case 'Editor':
var content = $("#Editor").val()
source['link'] = { type: type, title: row.name, pageTitle: this.selectForm.title, content: content };
break;
case 'WXMp':
source['link'] = { type: type, title: row.name, appid: this.selectForm.appid, path: this.selectForm.path };
break;
case 'Outside':
source['link'] = { type: type, title: row.name, url: this.selectForm.protocol + this.selectForm.url };
break;
case 'Phone':
source['link'] = { type: type, title: row.name, phone: this.selectForm.phone };
break;
case 'Service':
source['link'] = { type: type, title: row.name };
break;
case 'Member':
source['link'] = { type: type, title: '会员:' + row.name, id: row.id };
break;
case 'Article':
source['link'] = { type: type, title: '文章:' + row.title, id: row.id, link_type: row.type, link_url: row.link };
break;
case 'Activity':
source['link'] = { type: type, title: '活动:' + row.name, id: row.id };
break;
case 'Goods':
source['link'] = { type: type, title: '商品:' + row.name, id: row.id };
break;
}
this.selectVisible = false;
}
$.post('wdsxh/diy_page/select_url_pro', {}, (res) => {
this.selectData = res.rows;
this.selectForm = {
title: "",
content: "",
appid: '',
path: '',
protocol: '',
url: '',
phone: '',
}
if (source['link']) {
this.selectType = source['link'].type
if (source['link'].type === 'Custom') {
let index = this.selectData.Custom.list.findIndex((item) => {
if (source['link'].path.indexOf(item.path) > -1) {
return true
}
})
if (index > -1) {
let selectLink = this.selectData.Custom.list[index]
this.$delete(this.selectData.Custom.list, index)
let selectPath = source['link'].path.split(selectLink.path)[1]
if (selectPath[0] == "?" || selectPath[0] == "&") {
this.$set(selectLink, "parameter", selectPath.slice(1))
}
this.selectData.Custom.list.unshift(selectLink)
this.selectData.Custom.list = [...this.selectData.Custom.list]
}
} else if (source['link'].type === 'WXMp') {
this.selectForm.appid = source['link'].appid;
this.selectForm.path = source['link'].path;
} else if (source['link'].type === 'Outside') {
if (source['link'].url && source['link'].url.substring(0, 5) == "http:") {
this.selectForm.protocol = 'http://';
this.selectForm.url = source['link'].url.split('http://')[1];
} else if (source['link'].url && source['link'].url.substring(0, 5) == "https") {
this.selectForm.protocol = 'https://';
this.selectForm.url = source['link'].url.split('https://')[1];
} else {
this.selectForm.protocol = '';
this.selectForm.url = source['link'].url;
}
} else if (source['link'].type === 'Phone') {
this.selectForm.phone = source['link'].phone
}
} else {
this.selectType = "Custom"
$("#Editor").val("")
}
this.selectVisible = true;
this.$nextTick(() => {
if (source['link'] && source['link'].type === 'Editor') {
$("#Editor").val(source['link'].content)
this.selectForm.title = source['link'].pageTitle
this.selectForm.content = source['link'].content
}
Controller.api.bindevent();
})
});
},
// 改变选择框类型
tabChange(e) {
if (e.name == "Editor") {
this.$nextTick(() => {
Form.api.bindevent($("form[role=form]"));
$('#Editor').on('change', () => {
this.selectForm.content = $('#Editor').val()
});
})
}
},
// 添加组件内容项目
handleAddItem() {
this.currentData.data.push(JSON.parse(JSON.stringify(defaultData[this.currentData.type].data[0])));
},
// 删除组件内容项目
handleDeleteItem(index) {
if (this.pageData.items[this.selectedIndex].data.length > 1) {
this.pageData.items[this.selectedIndex].data.splice(index, 1);
} else {
this.$message({
showClose: true,
message: '至少保留一个项目',
type: 'error'
});
}
},
// 向上移动组件
handleMoveUp(index) {
if (index > 0) {
[this.pageData.items[index], this.pageData.items[index - 1]] = [this.pageData.items[index - 1], this.pageData.items[index]];
this.selectedIndex = index - 1
}
},
// 向下移动组件
handleMoveDown(index) {
if (index < this.pageData.items.length - 1) {
[this.pageData.items[index], this.pageData.items[index + 1]] = [this.pageData.items[index + 1], this.pageData.items[index]];
this.selectedIndex = index + 1
}
},
// 复制组件
handleCopy(index) {
this.pageData.items.push(JSON.parse(JSON.stringify(this.pageData.items[index])));
this.handleEdit(this.pageData.items.length - 1);
setTimeout(() => {
const listContainer = document.querySelector(".main-center .scroll-drag")
listContainer.scrollTop = listContainer.scrollHeight;
}, 50);
},
// 删除组件
handleDelete(index) {
this.$delete(this.pageData.items, index)
this.selectedIndex = -1;
},
// 提交数据
handleSubmit() {
if (this.pageData.items.length) {
this.pageData.page.activeName = undefined
for (var i in this.pageData.items) {
this.pageData.items[i].activeName = undefined
}
$.post('', { data: JSON.stringify(this.pageData) }, (res) => {
if (res.code == 1) {
parent.window.$(".btn-refresh").trigger("click");
Toastr.success(res.msg);
return setTimeout(() => {
Fast.api.close({});
}, 1000);
}
return Toastr.error(res.msg);
});
} else {
this.$message({
showClose: true,
message: '至少添加一个组件',
type: 'error'
});
}
},
}
});
Controller.api.bindevent();
},
edit: function () {
new Vue({
el: '#diy',
data: {
// 默认组件数据
defaultData: defaultData,
// 模板数据
pageData: pageData,
// 已选组件索引
selectedIndex: -1,
// 当前组件数据
currentData: {},
// 选择弹窗是否显示
selectVisible: false,
// 选择弹窗数据
selectData: null,
// 选择弹窗选中类型
selectType: 'Custom',
// 选择弹窗选中回调事件
selectCallback: null,
// 选择弹窗表单数据
selectForm: {
title: "",
content: "",
appid: '',
path: '',
protocol: '',
url: '',
phone: '',
},
// 文章分类列表
articleCategoryList: [],
// 供需分类列表
demandCategoryList: [],
},
created() {
$("#diy").show()
$("#loading").hide()
this.pageData.page.activeName = "first"
this.getArticleCategory()
this.getDemandCategory()
},
methods: {
// 添加组件
handleAdd(type) {
this.pageData.items.push(JSON.parse(JSON.stringify(defaultData[type])));
this.handleEdit(this.pageData.items.length - 1);
setTimeout(() => {
const listContainer = document.querySelector(".main-center .scroll-drag")
listContainer.scrollTop = listContainer.scrollHeight;
}, 50);
},
// 编辑组件
handleEdit(index) {
this.selectedIndex = index;
this.currentData = {}
this.$nextTick(() => {
this.currentData = this.selectedIndex == -1 ? this.pageData.page : this.pageData.items[this.selectedIndex];
if (!this.currentData.activeName) this.currentData.activeName = "first"
if (this.currentData.type == "richTextDiy") {
this.$nextTick(() => {
Form.api.bindevent($("form[role=form]"));
$('#richTextDiy').on('change', () => {
this.currentData.params.content = $('#richTextDiy').val()
});
})
}
})
},
// 拖动组件
handleDrag(event) {
this.handleEdit(event.newIndex);
},
// 获取当前时间
getCurrentDate() {
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}`;
},
// 重置颜色
handleResetColor(source, key, color) {
source[key] = color;
},
// 选择图片
handleSelectImage(source, index, type = "image/") {
parent.Fast.api.open(`general/attachment/select?element_id=&multiple=true&mimetype=${type}*`, __('Choose'), {
callback: (data) => {
if (data.multiple) {
var url = Fast.api.cdnurl(data.url);
this.$set(source, index, url)
}
}
});
},
// 删除图片
handleDeleteImage(source, index) {
this.$set(source, index, "")
},
// 获取文章分类
getArticleCategory() {
$.post('wdsxh/diy_page/get_article_category', {}, (res) => {
this.articleCategoryList = res.rows
});
},
// 选择文章分类
handleSelectArticleCategory(source, event) {
if (event) {
const index = this.articleCategoryList.findIndex(item => item.id == event)
if (index > -1) source.categoryName = this.articleCategoryList[index].name
else source.categoryName = ""
} else {
source.categoryName = ""
}
},
// 获取供需分类
getDemandCategory() {
$.post('wdsxh/diy_page/get_demand_category', {}, (res) => {
this.demandCategoryList = res.rows
});
},
// 选择文章分类
handleSelectDemandCategory(source, event) {
if (event) {
const index = this.demandCategoryList.findIndex(item => item.id == event)
if (index > -1) source.categoryName = this.demandCategoryList[index].name
else source.categoryName = ""
} else {
source.categoryName = ""
}
},
// 选择组件类型
handleSelectType(source) {
this.selectCallback = (type, row) => {
source['link'] = null;
switch (type) {
case 'Custom':
var path = row.path
if (row.parameter) {
if (path.indexOf("?") > -1) path += "&" + row.parameter
else path += "?" + row.parameter
}
source['link'] = { type: type, title: row.title, path: path, };
break;
case 'Inlay':
source['link'] = { type: type, title: row.title, path: row.path };
break;
case 'Editor':
var content = $("#Editor").val()
source['link'] = { type: type, title: row.name, pageTitle: this.selectForm.title, content: content };
break;
case 'WXMp':
source['link'] = { type: type, title: row.name, appid: this.selectForm.appid, path: this.selectForm.path };
break;
case 'Outside':
source['link'] = { type: type, title: row.name, url: this.selectForm.protocol + this.selectForm.url };
break;
case 'Phone':
source['link'] = { type: type, title: row.name, phone: this.selectForm.phone };
break;
case 'Service':
source['link'] = { type: type, title: row.name };
break;
case 'Member':
source['link'] = { type: type, title: '会员:' + row.name, id: row.id };
break;
case 'Article':
source['link'] = { type: type, title: '文章:' + row.title, id: row.id, link_type: row.type, link_url: row.link };
break;
case 'Activity':
source['link'] = { type: type, title: '活动:' + row.name, id: row.id };
break;
case 'Goods':
source['link'] = { type: type, title: '商品:' + row.name, id: row.id };
break;
}
this.selectVisible = false;
}
$.post('wdsxh/diy_page/select_url_pro', {}, (res) => {
this.selectData = res.rows;
this.selectForm = {
title: "",
content: "",
appid: '',
path: '',
protocol: '',
url: '',
phone: '',
}
if (source['link']) {
this.selectType = source['link'].type
if (source['link'].type === 'Custom') {
let index = this.selectData.Custom.list.findIndex((item) => {
if (source['link'].path.indexOf(item.path) > -1) {
return true
}
})
if (index > -1) {
let selectLink = this.selectData.Custom.list[index]
this.$delete(this.selectData.Custom.list, index)
let selectPath = source['link'].path.split(selectLink.path)[1]
if (selectPath[0] == "?" || selectPath[0] == "&") {
this.$set(selectLink, "parameter", selectPath.slice(1))
}
this.selectData.Custom.list.unshift(selectLink)
this.selectData.Custom.list = [...this.selectData.Custom.list]
}
} else if (source['link'].type === 'WXMp') {
this.selectForm.appid = source['link'].appid;
this.selectForm.path = source['link'].path;
} else if (source['link'].type === 'Outside') {
if (source['link'].url && source['link'].url.substring(0, 5) == "http:") {
this.selectForm.protocol = 'http://';
this.selectForm.url = source['link'].url.split('http://')[1];
} else if (source['link'].url && source['link'].url.substring(0, 5) == "https") {
this.selectForm.protocol = 'https://';
this.selectForm.url = source['link'].url.split('https://')[1];
} else {
this.selectForm.protocol = '';
this.selectForm.url = source['link'].url;
}
} else if (source['link'].type === 'Phone') {
this.selectForm.phone = source['link'].phone
}
} else {
this.selectType = "Custom"
$("#Editor").val("")
}
this.selectVisible = true;
this.$nextTick(() => {
if (source['link'] && source['link'].type === 'Editor') {
$("#Editor").val(source['link'].content)
this.selectForm.title = source['link'].pageTitle
this.selectForm.content = source['link'].content
}
Controller.api.bindevent();
})
});
},
// 改变选择框类型
tabChange(e) {
if (e.name == "Editor") {
this.$nextTick(() => {
Form.api.bindevent($("form[role=form]"));
$('#Editor').on('change', () => {
this.selectForm.content = $('#Editor').val()
});
})
}
},
// 添加组件内容项目
handleAddItem() {
this.currentData.data.push(JSON.parse(JSON.stringify(defaultData[this.currentData.type].data[0])));
},
// 删除组件内容项目
handleDeleteItem(index) {
if (this.pageData.items[this.selectedIndex].data.length > 1) {
this.pageData.items[this.selectedIndex].data.splice(index, 1);
} else {
this.$message({
showClose: true,
message: '至少保留一个项目',
type: 'error'
});
}
},
// 向上移动组件
handleMoveUp(index) {
if (index > 0) {
[this.pageData.items[index], this.pageData.items[index - 1]] = [this.pageData.items[index - 1], this.pageData.items[index]];
this.selectedIndex = index - 1
}
},
// 向下移动组件
handleMoveDown(index) {
if (index < this.pageData.items.length - 1) {
[this.pageData.items[index], this.pageData.items[index + 1]] = [this.pageData.items[index + 1], this.pageData.items[index]];
this.selectedIndex = index + 1
}
},
// 复制组件
handleCopy(index) {
this.pageData.items.push(JSON.parse(JSON.stringify(this.pageData.items[index])));
this.handleEdit(this.pageData.items.length - 1);
setTimeout(() => {
const listContainer = document.querySelector(".main-center .scroll-drag")
listContainer.scrollTop = listContainer.scrollHeight;
}, 50);
},
// 删除组件
handleDelete(index) {
this.$delete(this.pageData.items, index)
this.selectedIndex = -1;
},
// 提交数据
handleSubmit() {
if (this.pageData.items.length) {
this.pageData.page.activeName = undefined
for (var i in this.pageData.items) {
this.pageData.items[i].activeName = undefined
}
$.post('', { data: JSON.stringify(this.pageData) }, (res) => {
if (res.code == 1) {
parent.window.$(".btn-refresh").trigger("click");
Toastr.success(res.msg);
return setTimeout(() => {
Fast.api.close({});
}, 1000);
}
return Toastr.error(res.msg);
});
} else {
this.$message({
showClose: true,
message: '至少添加一个组件',
type: 'error'
});
}
},
}
});
Controller.api.bindevent();
},
select_home_mode: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,54 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/faq/index' + location.search,
add_url: 'wdsxh/faq/add',
edit_url: 'wdsxh/faq/edit',
del_url: 'wdsxh/faq/del',
multi_url: 'wdsxh/faq/multi',
import_url: 'wdsxh/faq/import',
table: 'wdsxh_faq',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,82 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/institution/institution/index' + location.search,
add_url: 'wdsxh/institution/institution/add',
edit_url: 'wdsxh/institution/institution/edit',
del_url: 'wdsxh/institution/institution/del',
multi_url: 'wdsxh/institution/institution/multi',
import_url: 'wdsxh/institution/institution/import',
table: 'wdsxh_institution',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'icon', title: __('Icon'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'level_list',
text: '级别列表',
title: '级别列表',
classname: 'btn btn-xs btn-info btn-dialog',
url: 'wdsxh/institution/level?institution_id={id}',
extend: 'data-area=["100%","100%"]',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
},
{
name: 'member_list',
text: '成员列表',
title: '成员列表',
classname: 'btn btn-xs btn-info btn-dialog bg-olive',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/institution/member?institution_id={id}',
refresh:true,
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
institution_config: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,73 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/institution/institution_member_apply/index' + location.search,
table: 'wdsxh_institution_member_apply',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{field: 'id', title: __('Id')},
{field: 'usermember.name', title: '会员名称'},
{field: 'institution.name', title: __('Institution.name'), operate: 'LIKE'},
{field: 'level.level_name', title: __('Level.level_name'), operate: 'LIKE'},
{field: 'state', title: __('State'), searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3')}, formatter: Table.api.formatter.normal},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'handle_time', title: __('Handle_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'handle',
text: __('审核'),
title: __('审核'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/institution/institution_member_apply/handle',
visible:function(row){
if(row['state'] == 1){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$(".btn-refresh").trigger("click");
return true;
},
error: function (data, ret) {
Layer.alert(ret.msg);
return false;
}
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
handle: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,64 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/institution/level/index' + location.search + '&institution_id=' + Config.institution_id,
add_url: 'wdsxh/institution/level/add?institution_id=' + Config.institution_id,
edit_url: 'wdsxh/institution/level/edit?institution_id=' + Config.institution_id,
del_url: 'wdsxh/institution/level/del',
multi_url: 'wdsxh/institution/level/multi',
import_url: 'wdsxh/institution/level/import',
table: 'wdsxh_institution_level',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'institution.name', title: __('Institution.name'), operate: 'LIKE'},
{field: 'level_name', title: __('Level_name'), operate: 'LIKE'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'member_list',
text: '成员列表',
title: '成员列表',
classname: 'btn btn-xs btn-info btn-dialog bg-olive',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/institution/member?level_id={id}',
refresh:true,
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,66 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/institution/member/index' + location.search + '&institution_id=' + Config.institution_id + '&level_id=' + Config.level_id,
add_url: 'wdsxh/institution/member/add?institution_id=' + Config.institution_id + '&level_id=' + Config.level_id,
edit_url: 'wdsxh/institution/member/edit?institution_id=' + Config.institution_id + '&level_id=' + Config.level_id,
del_url: 'wdsxh/institution/member/del',
multi_url: 'wdsxh/institution/member/multi',
import_url: 'wdsxh/institution/member/import',
table: 'wdsxh_institution_member',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'usermember.name', title: __('Member_id')},
{field: 'usermember.mobile', title: '会员手机号', operate: 'LIKE'},
{field: 'institution.name', title: __('Institution.name'), operate: 'LIKE'},
{field: 'level.level_name', title: __('Level.level_name'), operate: 'LIKE'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'member_expire_status', title: __('会员状态'), searchList: {"1":__('正常'),"2":__('已过期')}, formatter: Table.api.formatter.normal},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$("#c-level_id").data("params", function(){
console.log($("#c-institution_id").val());
return {custom: {institution_id: $('input[name="row[institution_id]"]').val()}};
});
$(document).on("change", "#c-institution_id_text", function () {
$("#c-level_id_text").val('');
});
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,210 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/jielong/index' + location.search,
add_url: 'wdsxh/jielong/add',
edit_url: 'wdsxh/jielong/edit',
del_url: 'wdsxh/jielong/del',
multi_url: 'wdsxh/jielong/multi',
import_url: 'wdsxh/jielong/import',
table: 'wdsxh_jielong',
}
});
var table = $("#table");
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
});
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
// fixedColumns: true,
// fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'member_name', title: __('发布人名称'), operate: false},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
{field: 'expire_time', title: __('Expire_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
// {field: 'member_ids', title: __('Member_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
// {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'applet_jielong_qrcode_path', title: __('Applet_jielong_qrcode_path'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'copy_relay',
text: __('复制接龙'),
title: __('复制接龙'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
icon: 'fa fa-floppy-o',
url: 'wdsxh/jielong/copy_relay',
confirm: '确认复制此条接龙信息?',
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
},
{
name: 'list',
text: __('反馈信息'),
title: __('反馈信息'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa fa-list',
url: 'wdsxh/jielong/lists?jielong_id={id}',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/jielong/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/jielong/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/jielong/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
config: function () {
Controller.api.bindevent();
},
lists: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/jielong/lists'+ location.search,
pk: 'id',
sortName: 'weigh',
// fixedColumns: true,
// fixedRightNumber: 1,
search:false,
showToggle: false,
showColumns: false,
visible: false,
columns: [
[
// {checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('会员名称'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'images', title: __('图片'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'content', title: __('内容'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'status', title: __('参加状态'), searchList: {"1":__('参加'),"2":__('不参加'),"3":__('参加其他')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
$(document).on('change','input[name="row[type]"]',function (){
var type=$(this).val();
switch (type){
case "1":
$('.MemberIds').addClass('hide');
break;
case "2":
$('.MemberIds').removeClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,54 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/link/index' + location.search,
add_url: 'wdsxh/link/add',
edit_url: 'wdsxh/link/edit',
del_url: 'wdsxh/link/del',
multi_url: 'wdsxh/link/multi',
import_url: 'wdsxh/link/import',
table: 'wdsxh_link',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'url', title: __('Url'), operate: 'LIKE', formatter: Table.api.formatter.url},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.toggle},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,150 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/mall/banner/index' + location.search,
add_url: 'wdsxh/mall/banner/add',
edit_url: 'wdsxh/mall/banner/edit',
del_url: 'wdsxh/mall/banner/del',
multi_url: 'wdsxh/mall/banner/multi',
import_url: 'wdsxh/mall/banner/import',
table: 'wdsxh_mall_banner',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'title', title: __('Title'), operate: 'LIKE'},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'jump_type', title: __('Jump_type'), searchList: {"0":__('Jump_type 0'),"1":__('Jump_type 1'),"2":__('Jump_type 2'),"3":__('Jump_type 3'),"4":__('Jump_type 4')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.toggle},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/mall/banner/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/mall/banner/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/mall/banner/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$("#c-jump_link").data("format-item", function(row){
return row.name + " 【" + row.url+"】";
});
Form.api.bindevent($("form[role=form]"));
$(document).on('change','input[name="row[jump_type]"]',function (){
var type=$(this).val();
switch (type){
case "1":
$('.page-url').addClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').removeClass('hide');
break;
case "2":
$('.page-url').removeClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').addClass('hide');
break;
case "4":
$('.page-url').addClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').removeClass('hide');
$('.teletext').addClass('hide');
break;
case "3":
$('.page-url').addClass('hide');
$('.outer-url').removeClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').addClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,116 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/mall/express/index' + location.search,
add_url: 'wdsxh/mall/express/add',
edit_url: 'wdsxh/mall/express/edit',
del_url: 'wdsxh/mall/express/del',
multi_url: 'wdsxh/mall/express/multi',
import_url: 'wdsxh/mall/express/import',
table: 'wdsxh_mall_express',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'brief_introduction', title: __('Brief_introduction'), operate: false},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/mall/express/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/mall/express/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/mall/express/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,116 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/mall/freight_rules/index' + location.search,
add_url: 'wdsxh/mall/freight_rules/add',
edit_url: 'wdsxh/mall/freight_rules/edit',
del_url: 'wdsxh/mall/freight_rules/del',
multi_url: 'wdsxh/mall/freight_rules/multi',
import_url: 'wdsxh/mall/freight_rules/import',
table: 'wdsxh_mall_freight_rules',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'min', title: __('Min')},
{field: 'max', title: __('Max')},
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/mall/freight_rules/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/mall/freight_rules/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/mall/freight_rules/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,124 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/mall/goods/index' + location.search,
add_url: 'wdsxh/mall/goods/add',
edit_url: 'wdsxh/mall/goods/edit',
del_url: 'wdsxh/mall/goods/del',
multi_url: 'wdsxh/mall/goods/multi',
import_url: 'wdsxh/mall/goods/import',
table: 'wdsxh_mall_goods',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'category.name', title: __('Category_id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'recommend_image', title: __('Recommend_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'ot_price', title: __('Ot_price'), operate:'BETWEEN'},
{field: 'is_hot', title: __('Is_hot'), searchList: {"1":__('Is_hot 1'),"0":__('Is_hot 0')}, formatter: Table.api.formatter.normal},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/mall/goods/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/mall/goods/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/mall/goods/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,118 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/mall/goods_category/index' + location.search,
add_url: 'wdsxh/mall/goods_category/add',
edit_url: 'wdsxh/mall/goods_category/edit',
del_url: 'wdsxh/mall/goods_category/del',
multi_url: 'wdsxh/mall/goods_category/multi',
import_url: 'wdsxh/mall/goods_category/import',
table: 'wdsxh_single_category',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'pid', title: __('Pid'), operate: false},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/mall/goods_category/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/mall/goods_category/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/mall/goods_category/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,136 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/mall/order/index' + location.search,
table: 'wdsxh_mall_order',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
{field: 'real_name', title: __('Real_name'), operate: 'LIKE'},
{field: 'user_phone', title: __('User_phone'), operate: 'LIKE'},
{field: 'user_address', title: __('User_address'), operate: 'LIKE'},
// {field: 'cart_ids', title: __('Cart_ids'), operate: 'LIKE'},
{field: 'number', title: '下单数量', operate: false},
{field: 'state', title: __('State'), searchList: {"1":__('待付款'),"2":__('待发货'),"3":__('待收货'),"4":__('已完成'),"5":__('支付失败'),"6":__('已取消'),"-1":__('退款中'),"-2":__('已退款')}, formatter: Table.api.formatter.status},
{field: 'pay_price', title: __('Pay_price'), operate:'BETWEEN'},
// {field: 'pay_postage', title: __('Pay_postage'), operate:'BETWEEN'},
{field: 'paid', title: __('Paid'), searchList: {"1":__('未付款'),"2":__('已付款')}, formatter: Table.api.formatter.normal},
{field: 'delivery_method', title: __('Delivery_method'), searchList: {"1":__('Delivery_method 1'),"2":__('Delivery_method 2')}, formatter: Table.api.formatter.normal},
{field: 'pick_up_code', title: __('Pick_up_code'), operate: 'LIKE'},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'delivery',
text:'发货',
classname: 'btn btn-xs btn-primary btn-dialog bg-aqua',
icon: 'fa',
extend:'data-area=["80%","80%"]',
url: 'wdsxh/mall/order/delivery',
visible:function(row){
if(row['state']==2 && row['delivery_method']==1){
return true;
}else{
return false;
}
},
refresh:true
},
{
text:'订单详情',
name: 'goods_details',
title: '订单详情',
classname: 'btn btn-xs btn-primary btn-dialog bg-aqua',
icon: 'fa',
url: 'wdsxh/mall/order/goods_details',
extend:'data-area=["95%","95%"]',
},
{
name: 'confirm_self_pickup',
text: __('确认自提'),
title: __('确认自提'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax bg-green',
url: 'wdsxh/mall/order/confirm_self_pickup',
confirm: '确认确认自提?操作后将确认收货',
visible:function (row){
if(row.delivery_method == 2 && row.state == '2'){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
},
{
name: 'confirm_receipt',
text: __('确认收货'),
title: __('确认收货'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax bg-olive',
icon: 'fa',
url: 'wdsxh/mall/order/confirm_receipt',
confirm: '确认收货?',
visible:function (row){
if(row.state == '3' && row.delivery_method == 1 && row.paid == '2'){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
}
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
confirm_self_pickup: function () {
Controller.api.bindevent();
},
delivery: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,122 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/mall/refund/index' + location.search,
del_url: 'wdsxh/mall/refund/del',
table: 'wdsxh_mall_order_refund',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{field: 'id', title: __('Id')},
{field: 'order_no', title: __('退款单号')},
{field: 'real_name', title: __('用户名称'),operate:false},
{field: 'refund_price', title: __('Refund_price'), operate:false},
{field: 'refund_time', title: __('Refund_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'refund_reason', title: __('Refund_reason'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'refund_express_no', title: __('Refund_express_no'), operate: 'LIKE'},
{field: 'createtime', title: __('Createtime'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'add_express_no_time', title: __('Add_express_no_time'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'three_adopt',
text: __('通过'),
title: __('通过申请'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
url: 'wdsxh/mall/refund/three_adopt',
confirm: '确认并同意退款申请?',
visible:function(row){
if(row['refund_status']==2){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
},
{
name: 'three_reject',
text: __('驳回'),
title: __('驳回申请'),
classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
url: 'wdsxh/mall/refund/three_reject',
confirm: '确认并驳回退款申请?',
visible:function(row){
if(row['refund_status']==2){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
},
{
name: 'refund',
text: __('已收到商品,同意退款'),
title: __('已收到商品,同意退款'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
url: 'wdsxh/mall/refund/refund',
confirm: '确认并已收到商品,同意退款申请?',
visible:function(row){
if(row['refund_status']==4){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,25 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
config: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
$(document).on('change','input[name="row[self_pickup_status]"]',function (){
var type=$(this).val();
switch (type){
case "1":
$('.address').removeClass('hide');
break;
case "2":
$('.address').addClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,29 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
examine: function () {
Controller.api.bindevent();
},
offline_examine: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
$(document).on('change','input[name="row[state]"]',function (){
var type=$(this).val();
switch (type){
case "2":
$('.reject').addClass('hide');
break;
case "3":
$('.reject').removeClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,142 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/apply/company/index' + location.search,
del_url: 'wdsxh/member/apply/apply/del',
examine_url: 'wdsxh/member/apply/apply/examine',
table: 'wdsxh_member_apply',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'company_name', title: __('Company_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'company_logo', title: __('Company_logo'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.image},
{field: 'company_position', title: __('Company_position'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'level.name', title: __('Level.name'), operate: 'LIKE'},
{field: 'state', title: __('State'), visible: false, searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3'),"4":__('State 4')}, formatter: Table.api.formatter.normal},
{field: 'child_state', title: __('State'), searchList: {"1":'待审核',"2":'已驳回',"3":'待付款',"4":'线下待审核',"5":'线下已驳回',"6":'已通过'}, formatter: Table.api.formatter.normal},
{field: 'examine_name', title: '审核人', operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons: [
{
name: 'examine',
text: __('入会审核'),
title: __('查看'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/member/apply/apply/examine',
visible: function (row) {
if(row.child_state == 1){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$(".btn-refresh").trigger("click");
return true;
},
error: function (data, ret) {
Layer.alert(ret.msg);
return false;
}
},
{
name: 'offline_examine',
text: __('线下审核'),
title: __('查看'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/member/apply/apply/offline_examine',
visible: function (row) {
if(row.child_state == 4){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$(".btn-refresh").trigger("click");
return true;
},
error: function (data, ret) {
Layer.alert(ret.msg);
return false;
}
},
{
name: 'details',
text: __('详情'),
title: __('查看'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/member/apply/apply/examine',
visible: function (row) {
if(row.child_state != '1' && row.child_state != '4'){
return true;
}else{
return false;
}
},
},
{
name: 'del',
text: __('删除'),
title: __('删除'),
classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
url: 'wdsxh/member/apply/apply/del',
confirm: '确认删除吗?',
visible:function(row){
if(row['child_state'] !='6'){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
}
]
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,142 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/apply/organize/index' + location.search,
del_url: 'wdsxh/member/apply/apply/del',
examine_url: 'wdsxh/member/apply/apply/examine',
table: 'wdsxh_member_apply',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'organize_name', title: __('Organize_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'organize_logo', title: __('Organize_logo'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.image},
{field: 'organize_position', title: __('Organize_position'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'level.name', title: __('Level.name'), operate: 'LIKE'},
{field: 'state', title: __('State'), visible: false, searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3'),"4":__('State 4')}, formatter: Table.api.formatter.normal},
{field: 'child_state', title: __('State'), searchList: {"1":'待审核',"2":'已驳回',"3":'待付款',"4":'线下待审核',"5":'线下已驳回',"6":'已通过'}, formatter: Table.api.formatter.normal},
{field: 'examine_name', title: '审核人', operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons: [
{
name: 'examine',
text: __('入会审核'),
title: __('查看'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/member/apply/apply/examine',
visible: function (row) {
if(row.child_state == 1){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$(".btn-refresh").trigger("click");
return true;
},
error: function (data, ret) {
Layer.alert(ret.msg);
return false;
}
},
{
name: 'offline_examine',
text: __('线下审核'),
title: __('查看'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/member/apply/apply/offline_examine',
visible: function (row) {
if(row.child_state == 4){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$(".btn-refresh").trigger("click");
return true;
},
error: function (data, ret) {
Layer.alert(ret.msg);
return false;
}
},
{
name: 'details',
text: __('详情'),
title: __('查看'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/member/apply/apply/examine',
visible: function (row) {
if(row.child_state != '1' && row.child_state != '4'){
return true;
}else{
return false;
}
},
},
{
name: 'del',
text: __('删除'),
title: __('删除'),
classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
url: 'wdsxh/member/apply/apply/del',
confirm: '确认删除吗?',
visible:function(row){
if(row['child_state'] !='6'){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
}
]
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,140 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/apply/person/index' + location.search,
del_url: 'wdsxh/member/apply/apply/del',
examine_url: 'wdsxh/member/apply/apply/examine',
table: 'wdsxh_member_apply',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'native_place', title: __('Native_place'), operate: 'LIKE'},
{field: 'level.name', title: __('Level.name'), operate: 'LIKE'},
{field: 'state', title: __('State'), visible: false, searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3'),"4":__('State 4')}, formatter: Table.api.formatter.normal},
{field: 'child_state', title: __('State'), searchList: {"1":'待审核',"2":'已驳回',"3":'待付款',"4":'线下待审核',"5":'线下已驳回',"6":'已通过'}, formatter: Table.api.formatter.normal},
{field: 'examine_name', title: '审核人', operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons: [
{
name: 'examine',
text: __('入会审核'),
title: __('查看'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/member/apply/apply/examine',
visible: function (row) {
if(row.child_state == 1){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$(".btn-refresh").trigger("click");
return true;
},
error: function (data, ret) {
Layer.alert(ret.msg);
return false;
}
},
{
name: 'offline_examine',
text: __('线下审核'),
title: __('查看'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/member/apply/apply/offline_examine',
visible: function (row) {
if(row.child_state == 4){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$(".btn-refresh").trigger("click");
return true;
},
error: function (data, ret) {
Layer.alert(ret.msg);
return false;
}
},
{
name: 'details',
text: __('详情'),
title: __('查看'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/member/apply/apply/examine',
visible: function (row) {
if(row.child_state != '1' && row.child_state != '4'){
return true;
}else{
return false;
}
},
},
{
name: 'del',
text: __('删除'),
title: __('删除'),
classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
url: 'wdsxh/member/apply/apply/del',
confirm: '确认删除吗?',
visible:function(row){
if(row['child_state'] !='6'){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
}
]
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,57 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/cert/index' + location.search,
add_url: 'wdsxh/member/cert/add',
edit_url: 'wdsxh/member/cert/edit',
del_url: 'wdsxh/member/cert/del',
multi_url: 'wdsxh/member/cert/multi',
import_url: 'wdsxh/member/cert/import',
table: 'wdsxh_cert',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'member_name', title: __('Member_id'), operate: false},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'number', title: __('Number'), operate: 'LIKE'},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'channel', title: __('Channel'), searchList: {"1":__('Channel 1'),"2":__('Channel 2')}, formatter: Table.api.formatter.normal},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,237 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/company/index' + location.search,
add_url: 'wdsxh/member/company/add',
edit_url: 'wdsxh/member/company/edit',
del_url: 'wdsxh/member/company/del',
multi_url: 'wdsxh/member/company/multi',
import_url: 'wdsxh/member/company/import',
table: 'wdsxh_member',
}
});
var table = $("#table");
$(document).on("click", ".btn-export", function () {
var ids = Table.api.selectedids(table);
var page = table.bootstrapTable('getData');
var all = table.bootstrapTable('getOptions').totalRows;
console.log(ids, page, all);
Layer.confirm("请选择导出的选项", {
title: '导出数据',
btn: ["选中项(" + ids.length + "条)", "本页(" + page.length + "条)", "全部(" + all + "条)"],
success: function (layero, index) {
$(".layui-layer-btn a", layero).addClass("layui-layer-btn0");
}
, yes: function (index, layero) {
submitForm(ids.join(","));
return false;
}
,
btn2: function (index, layero) {
var ids = [];
$.each(page, function (i, j) {
ids.push(j.id);
});
submitForm(ids.join(","));
return false;
}
,
btn3: function (index, layero) {
submitForm("all");
return false;
}
})
});
var submitForm = function (ids) {
// 确保隐藏表单存在
var $form = $("#exportHiddenForm");
if ($form.length === 0) {
$form = $("<form id='exportHiddenForm' method='post' target='_blank' style='display:none;'></form>");
$form.attr('action', Fast.api.fixurl("wdsxh/member/company/export"));
$form.append("<input type='hidden' name='ids' />");
$form.append("<input type='hidden' name='filter' />");
$form.append("<input type='hidden' name='op' />");
$form.append("<input type='hidden' name='search' />");
$form.append("<input type='hidden' name='columns' />");
$("body").append($form);
}
var options = table.bootstrapTable('getOptions');
console.log(options);
var columns = [];
$.each(options.columns[0], function (i, j) {
if (j.field && !j.checkbox && j.visible && j.field != 'operate') {
columns.push(j.field);
}
});
var search = options.queryParams({});
$("input[name=search]", $form).val(options.searchText);
$("input[name=ids]", $form).val(ids);
var _filter = search.filter || {};
var _op = search.op || {};
if (typeof _filter !== 'string') {
_filter = JSON.stringify(_filter);
}
if (typeof _op !== 'string') {
_op = JSON.stringify(_op);
}
$("input[name=filter]", $form).val(_filter);
$("input[name=op]", $form).val(_op);
$("input[name=columns]", $form).val(columns.join(','));
$form[0].submit();
};
$(document).on("click", ".import_template", function () {
Fast.api.ajax({
url:'wdsxh/member/company/import_template',
}, function(data, ret){
//成功的回调
var $a = $("<a>");
$a.attr("href", data.file);
$a.attr("download", data.filename);
$("body").append($a);
$a[0].click();
$a.remove();
return false;
}, function(data, ret){
alert(ret.msg);
//失败的回调
return false;
});
});
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'level.name', title: __('Level.name'), operate: 'LIKE'},
{field: 'native_place', title: __('Native_place'), operate: 'LIKE'},
{field: 'industry.name', title: __('Industry.name'), operate: 'LIKE'},
{field: 'company_name', title: __('Company_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'company_logo', title: __('Company_logo'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.image},
{field: 'company_position', title: __('Company_position'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'join_time', title: __('Join_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'expire_time', title: __('Expire_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons:[
{
name: 'list',
text: __('产品维护'),
title: __('产品维护'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa fa-list',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/company_goods?member_id={id}',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
},
]
}
]
]
});
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
});
// 为表格绑定事件
Table.api.bindevent(table);
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
});
// 会员消息通知按钮点击事件
$(document).on("click", ".btn-member-notification", function () {
var ids = Table.api.selectedids(table);
if (ids.length === 0) {
Layer.msg("请至少选择一个会员");
return false;
}
// 打开通知表单弹窗
Fast.api.open('wdsxh/member/person/send_notification?ids=' + ids.join(','), '发送会员消息通知', {
area: ['800px', '600px'],
callback: function (data) {
table.bootstrapTable('refresh');
}
});
});
},
add: function () {
Controller.api.bindevent();
$(document).on('click','#select-user',function () {
Fast.api.open('wdsxh/member/member/seluser','选择用户',{
area:['80%','95%'],
callback:function(data){
console.log(data);
if(data){
$('#c-uid').val(data.id);
$('#c-user').val(data.nickname);
}else{
Layer.alert("请选择用户");
}
}
});
});
},
edit: function () {
$(document).on('click','#select-user',function () {
Fast.api.open('wdsxh/member/member/seluser','选择用户',{
area:['80%','95%'],
callback:function(data){
console.log(data);
if(data){
$('#c-uid').val(data.id);
$('#c-user').val(data.nickname);
}else{
Layer.alert("请选择用户");
}
}
});
});
// 监听用户输入框变化,当清空时同时清空隐藏字段
$(document).on('input', '#c-user', function() {
if ($(this).val() === '') {
$('#c-uid').val('');
}
});
Controller.api.bindevent();
},
send_notification: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,54 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/industry_category/index' + location.search,
add_url: 'wdsxh/member/industry_category/add',
edit_url: 'wdsxh/member/industry_category/edit',
del_url: 'wdsxh/member/industry_category/del',
multi_url: 'wdsxh/member/industry_category/multi',
import_url: 'wdsxh/member/industry_category/import',
table: 'wdsxh_member_industry_category',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'icon', title: __('Icon'), operate: 'LIKE', formatter: Table.api.formatter.image},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,67 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/join_config/index' + location.search,
edit_url: 'wdsxh/member/join_config/edit',
table: 'wdsxh_member_join_config',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'weigh', title: __('Weigh'), operate: false},
{
field: 'operate',
width: "150px",
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'fieldset',
text: __('自定义登记字段'),
title: __('自定义登记字段'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/member/join_config/fieldset',
}
],
formatter: Table.api.formatter.operate
},
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
fieldset: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,56 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/level/index' + location.search,
add_url: 'wdsxh/member/level/add',
edit_url: 'wdsxh/member/level/edit',
del_url: 'wdsxh/member/level/del',
multi_url: 'wdsxh/member/level/multi',
import_url: 'wdsxh/member/level/import',
table: 'wdsxh_member_level',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'fees', title: __('Fees'), operate:'BETWEEN'},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,146 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
member: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/member/member' + location.search,
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{field: 'id', title: __('Id')},
{field: 'name', title: '昵称', operate: 'LIKE'},
{field: 'avatar', title: '头像', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'createtime', title: '注册时间', operate:false},
{field: 'level_name', title: '级别', operate: false},
{field: 'join_time', title: '加入时间', operate:'RANGE', addclass:'datetimerange', autocomplete:false},
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
seluser:function(){
Table.api.init({
extend: {
}
});
var table = $("#table");
table.bootstrapTable({
url: 'wdsxh/member/member/seluser' + location.search,
pk: 'id',
sortName: 'createtime',
search:false,
showToggle: false,
showColumns: false,
visible: false,
showExport: false,
searchFormVisible: true,
sortOrder:'desc',
columns: [
[
{field: 'id', title: __('ID'), sortable: true,operate: false},
{field: 'avatar', title: __('头像'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
{field: 'nickname', title: __('昵称'), operate: 'LIKE'},
{field: 'mobile', title: __('手机号'), operate: 'LIKE'},
{field: 'createtime', title: __('创建时间'),operate: false, formatter: Table.api.formatter.datetime, addclass: 'datetimerange', sortable: true},
{
field: 'buttons',
width: "80px",
title: __('操作'),
text: __('操作'),
table: table,
operate: false,
events: Table.api.events.operate,
buttons: [
{
name: 'ajax',
text: __('选择'),
title: __('选择'),
classname: 'btn btn-xs btn-primary btn-magic btn-click',
icon: 'fa fa-check',
click:function (obj,row) {
console.log(row);
Fast.api.close(row);
}
}
],
formatter: Table.api.formatter.buttons
}
]
]
});
Table.api.bindevent(table);
},
activity_seluser:function(){
Table.api.init({
extend: {
}
});
var table = $("#table");
table.bootstrapTable({
url: 'wdsxh/member/member/activity_seluser' + location.search,
pk: 'id',
sortName: 'createtime',
search:false,
showToggle: false,
showColumns: false,
visible: false,
showExport: false,
searchFormVisible: true,
sortOrder:'desc',
columns: [
[
{field: 'id', title: __('ID'), sortable: true,operate: false},
{field: 'avatar', title: __('头像'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
{field: 'nickname', title: __('昵称'), operate: 'LIKE'},
{field: 'mobile', title: __('手机号'), operate: 'LIKE'},
{field: 'createtime', title: __('创建时间'),operate: false, formatter: Table.api.formatter.datetime, addclass: 'datetimerange', sortable: true},
{
field: 'buttons',
width: "80px",
title: __('操作'),
text: __('操作'),
table: table,
operate: false,
events: Table.api.events.operate,
buttons: [
{
name: 'ajax',
text: __('选择'),
title: __('选择'),
classname: 'btn btn-xs btn-primary btn-magic btn-click',
icon: 'fa fa-check',
click:function (obj,row) {
console.log(row);
Fast.api.close(row);
}
}
],
formatter: Table.api.formatter.buttons
}
]
]
});
Table.api.bindevent(table);
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,237 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/organize/index' + location.search,
add_url: 'wdsxh/member/organize/add',
edit_url: 'wdsxh/member/organize/edit',
del_url: 'wdsxh/member/organize/del',
multi_url: 'wdsxh/member/organize/multi',
import_url: 'wdsxh/member/organize/import',
table: 'wdsxh_member',
}
});
var table = $("#table");
$(document).on("click", ".btn-export", function () {
var ids = Table.api.selectedids(table);
var page = table.bootstrapTable('getData');
var all = table.bootstrapTable('getOptions').totalRows;
console.log(ids, page, all);
Layer.confirm("请选择导出的选项", {
title: '导出数据',
btn: ["选中项(" + ids.length + "条)", "本页(" + page.length + "条)", "全部(" + all + "条)"],
success: function (layero, index) {
$(".layui-layer-btn a", layero).addClass("layui-layer-btn0");
}
, yes: function (index, layero) {
submitForm(ids.join(","));
return false;
}
,
btn2: function (index, layero) {
var ids = [];
$.each(page, function (i, j) {
ids.push(j.id);
});
submitForm(ids.join(","));
return false;
}
,
btn3: function (index, layero) {
submitForm("all");
return false;
}
})
});
var submitForm = function (ids) {
// 确保隐藏表单存在
var $form = $("#exportHiddenForm");
if ($form.length === 0) {
$form = $("<form id='exportHiddenForm' method='post' target='_blank' style='display:none;'></form>");
$form.attr('action', Fast.api.fixurl("wdsxh/member/organize/export"));
$form.append("<input type='hidden' name='ids' />");
$form.append("<input type='hidden' name='filter' />");
$form.append("<input type='hidden' name='op' />");
$form.append("<input type='hidden' name='search' />");
$form.append("<input type='hidden' name='columns' />");
$("body").append($form);
}
var options = table.bootstrapTable('getOptions');
console.log(options);
var columns = [];
$.each(options.columns[0], function (i, j) {
if (j.field && !j.checkbox && j.visible && j.field != 'operate') {
columns.push(j.field);
}
});
var search = options.queryParams({});
$("input[name=search]", $form).val(options.searchText);
$("input[name=ids]", $form).val(ids);
var _filter = search.filter || {};
var _op = search.op || {};
if (typeof _filter !== 'string') {
_filter = JSON.stringify(_filter);
}
if (typeof _op !== 'string') {
_op = JSON.stringify(_op);
}
$("input[name=filter]", $form).val(_filter);
$("input[name=op]", $form).val(_op);
$("input[name=columns]", $form).val(columns.join(','));
$form[0].submit();
};
$(document).on("click", ".import_template", function () {
Fast.api.ajax({
url:'wdsxh/member/organize/import_template',
}, function(data, ret){
//成功的回调
var $a = $("<a>");
$a.attr("href", data.file);
$a.attr("download", data.filename);
$("body").append($a);
$a[0].click();
$a.remove();
return false;
}, function(data, ret){
alert(ret.msg);
//失败的回调
return false;
});
});
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'level.name', title: __('Level.name'), operate: 'LIKE'},
{field: 'native_place', title: __('Native_place'), operate: 'LIKE'},
{field: 'industry.name', title: __('Industry.name'), operate: 'LIKE'},
{field: 'organize_name', title: __('Organize_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'organize_logo', title: __('Organize_logo'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.image},
{field: 'organize_position', title: __('Organize_position'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'join_time', title: __('Join_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'expire_time', title: __('Expire_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons:[
{
name: 'list',
text: __('产品维护'),
title: __('产品维护'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa fa-list',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/company_goods?member_id={id}',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
},
]
}
]
]
});
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
});
// 为表格绑定事件
Table.api.bindevent(table);
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
});
// 会员消息通知按钮点击事件
$(document).on("click", ".btn-member-notification", function () {
var ids = Table.api.selectedids(table);
if (ids.length === 0) {
Layer.msg("请至少选择一个会员");
return false;
}
// 打开通知表单弹窗
Fast.api.open('wdsxh/member/person/send_notification?ids=' + ids.join(','), '发送会员消息通知', {
area: ['800px', '600px'],
callback: function (data) {
table.bootstrapTable('refresh');
}
});
});
},
add: function () {
Controller.api.bindevent();
$(document).on('click','#select-user',function () {
Fast.api.open('wdsxh/member/member/seluser','选择用户',{
area:['80%','95%'],
callback:function(data){
console.log(data);
if(data){
$('#c-uid').val(data.id);
$('#c-user').val(data.nickname);
}else{
Layer.alert("请选择用户");
}
}
});
});
},
edit: function () {
$(document).on('click','#select-user',function () {
Fast.api.open('wdsxh/member/member/seluser','选择用户',{
area:['80%','95%'],
callback:function(data){
console.log(data);
if(data){
$('#c-uid').val(data.id);
$('#c-user').val(data.nickname);
}else{
Layer.alert("请选择用户");
}
}
});
});
// 监听用户输入框变化,当清空时同时清空隐藏字段
$(document).on('input', '#c-user', function() {
if ($(this).val() === '') {
$('#c-uid').val('');
}
});
Controller.api.bindevent();
},
send_notification: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,49 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/pay/index' + location.search,
table: 'wdsxh_member_pay',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{field: 'id', title: __('Id')},
{field: 'order_no', title: '订单号', operate: 'LIKE'},
{field: 'wechat.nickname', title: '昵称', operate: false},
{field: 'wechat.avatar', title: '头像', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'member.name', title: '姓名', operate: 'LIKE'},
{field: 'level.name', title: '入会级别', operate: 'LIKE'},
{field: 'fees', title: __('Fees'), operate:'BETWEEN'},
{field: 'paid', title: __('Paid'), operate: false, searchList: {"1":__('Paid 1'),"2":__('Paid 2'),"4":__('Paid 4')}, formatter: Table.api.formatter.normal},
{field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'pay_method', title: '缴费方式', searchList: {"2":'微信支付',"3":'线下缴费',"4":'后台添加'}, formatter: Table.api.formatter.normal},
{field: 'pay_voucher', title: '缴费凭证', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,216 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/person/index' + location.search,
add_url: 'wdsxh/member/person/add',
edit_url: 'wdsxh/member/person/edit',
del_url: 'wdsxh/member/person/del',
multi_url: 'wdsxh/member/person/multi',
import_url: 'wdsxh/member/person/import',
table: 'wdsxh_member',
}
});
var table = $("#table");
$(document).on("click", ".btn-export", function () {
var ids = Table.api.selectedids(table);
var page = table.bootstrapTable('getData');
var all = table.bootstrapTable('getOptions').totalRows;
console.log(ids, page, all);
Layer.confirm("请选择导出的选项", {
title: '导出数据',
btn: ["选中项(" + ids.length + "条)", "本页(" + page.length + "条)", "全部(" + all + "条)"],
success: function (layero, index) {
$(".layui-layer-btn a", layero).addClass("layui-layer-btn0");
}
, yes: function (index, layero) {
submitForm(ids.join(","));
return false;
}
,
btn2: function (index, layero) {
var ids = [];
$.each(page, function (i, j) {
ids.push(j.id);
});
submitForm(ids.join(","));
return false;
}
,
btn3: function (index, layero) {
submitForm("all");
return false;
}
})
});
var submitForm = function (ids) {
// 确保隐藏表单存在
var $form = $("#exportHiddenForm");
if ($form.length === 0) {
$form = $("<form id='exportHiddenForm' method='post' target='_blank' style='display:none;'></form>");
$form.attr('action', Fast.api.fixurl("wdsxh/member/person/export"));
$form.append("<input type='hidden' name='ids' />");
$form.append("<input type='hidden' name='filter' />");
$form.append("<input type='hidden' name='op' />");
$form.append("<input type='hidden' name='search' />");
$form.append("<input type='hidden' name='columns' />");
$("body").append($form);
}
var options = table.bootstrapTable('getOptions');
console.log(options);
var columns = [];
$.each(options.columns[0], function (i, j) {
if (j.field && !j.checkbox && j.visible && j.field != 'operate') {
columns.push(j.field);
}
});
var search = options.queryParams({});
$("input[name=search]", $form).val(options.searchText);
$("input[name=ids]", $form).val(ids);
var _filter = search.filter || {};
var _op = search.op || {};
if (typeof _filter !== 'string') {
_filter = JSON.stringify(_filter);
}
if (typeof _op !== 'string') {
_op = JSON.stringify(_op);
}
$("input[name=filter]", $form).val(_filter);
$("input[name=op]", $form).val(_op);
$("input[name=columns]", $form).val(columns.join(','));
$form[0].submit();
};
$(document).on("click", ".import_template", function () {
Fast.api.ajax({
url:'wdsxh/member/person/import_template',
}, function(data, ret){
//成功的回调
var $a = $("<a>");
$a.attr("href", data.file);
$a.attr("download", data.filename);
$("body").append($a);
$a[0].click();
$a.remove();
return false;
}, function(data, ret){
alert(ret.msg);
//失败的回调
return false;
});
});
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'level.name', title: __('Level.name'), operate: 'LIKE'},
{field: 'native_place', title: __('Native_place'), operate: 'LIKE'},
{field: 'industry.name', title: __('Industry.name'), operate: 'LIKE'},
{field: 'join_time', title: __('Join_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'expire_time', title: __('Expire_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
});
// 为表格绑定事件
Table.api.bindevent(table);
table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
});
// 会员消息通知按钮点击事件
$(document).on("click", ".btn-member-notification", function () {
var ids = Table.api.selectedids(table);
if (ids.length === 0) {
Layer.msg("请至少选择一个会员");
return false;
}
// 打开通知表单弹窗
Fast.api.open('wdsxh/member/person/send_notification?ids=' + ids.join(','), '发送会员消息通知', {
area: ['800px', '600px'],
callback: function (data) {
table.bootstrapTable('refresh');
}
});
});
},
add: function () {
Controller.api.bindevent();
$(document).on('click','#select-user',function () {
Fast.api.open('wdsxh/member/member/seluser','选择用户',{
area:['80%','95%'],
callback:function(data){
console.log(data);
if(data){
$('#c-uid').val(data.id);
$('#c-user').val(data.nickname);
}else{
Layer.alert("请选择用户");
}
}
});
});
},
edit: function () {
$(document).on('click','#select-user',function () {
Fast.api.open('wdsxh/member/member/seluser','选择用户',{
area:['80%','95%'],
callback:function(data){
console.log(data);
if(data){
$('#c-uid').val(data.id);
$('#c-user').val(data.nickname);
}else{
Layer.alert("请选择用户");
}
}
});
});
// 监听用户输入框变化,当清空时同时清空隐藏字段
$(document).on('input', '#c-user', function() {
if ($(this).val() === '') {
$('#c-uid').val('');
}
});
Controller.api.bindevent();
},
send_notification: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,80 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/member/promotion/index' + location.search,
table: 'wdsxh_member_promotion',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{field: 'member.id', title: '会员ID'},
{field: 'member.name', title: __('Member.name'), operate: 'LIKE'},
{field: 'member.avatar', title: __('Member.avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'member.mobile', title: __('Member.mobile'), operate: 'LIKE'},
{field: 'level_name', title: __('Member.member_level_id'), operate: false},
{field: 'member.join_time', title: __('Member.join_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons:[
{
name: 'user',
text: '普通用户',
title: __('查看'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa fa-list',
url: 'wdsxh/user/wechat/user?wechat_id={wechat_id}',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
},
{
name: 'member',
text: '商协会员',
title: __('查看'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: 'wdsxh/member/member/member?wechat_id={wechat_id}',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
}
],
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
config: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,28 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$(document).on('change','input[name="row[expire_time_type]"]',function (){
var type=$(this).val();
switch (type){
case "1":
$('.fixed_date').addClass('hide');
$('.days').removeClass('hide');
break;
case "2":
$('.days').addClass('hide');
$('.fixed_date').removeClass('hide');
break;
}
});
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,61 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/message/message_notification/index' + location.search,
multi_url: 'wdsxh/message/message_notification/multi',
import_url: 'wdsxh/message/message_notification/import',
table: 'wdsxh_message_notification',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons:[
{
name: 'list',
text: __('发送列表'),
title: __('发送列表'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa fa-list',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/message/message_notification_member_id?notification_id={id}',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
},
]
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,44 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/message/message_notification_member_id/index' + location.search,
multi_url: 'wdsxh/message/message_notification_member_id/multi',
import_url: 'wdsxh/message/message_notification_member_id/import',
table: 'wdsxh_message_notification_member_id',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{field: 'id', title: __('Id')},
{field: 'member.name', title: __('Member.name'), operate: 'LIKE'},
{field: 'member.avatar', title: __('Member.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'member.mobile', title: __('Member.mobile'), operate: 'LIKE'},
{field: 'member.member_level_name', title: __('Member.member_level_name'), operate: 'LIKE'},
{field: 'send_status', title: __('Send_status'), searchList: {"1":__('Send_status 1'),"2":__('Send_status 2')}, formatter: Table.api.formatter.normal},
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,55 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/pc_banner/index' + location.search,
add_url: 'wdsxh/pc_banner/add',
edit_url: 'wdsxh/pc_banner/edit',
del_url: 'wdsxh/pc_banner/del',
multi_url: 'wdsxh/pc_banner/multi',
import_url: 'wdsxh/pc_banner/import',
table: 'wdsxh_pc_banner',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,15 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,291 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
new Vue({
el: '#diy',
data: {
// 页面数据
pageData: pageData,
// 默认数据
defaultData: defaultData,
// 已选页面样式
selectPageStyle: {},
// 已选组件索引
selectedIndex: -1,
// 当前组件数据
currentData: {},
// 当前日期
currentDate: "",
// 选择弹窗是否显示
selectVisible: false,
// 选择弹窗数据
selectData: null,
// 选择弹窗选中类型
selectType: 'Custom',
// 选择弹窗选中回调事件
selectCallback: null,
// 选择弹窗表单数据
selectForm: {
title: "",
content: "",
appid: '',
path: '',
protocol: '',
url: '',
phone: '',
},
// 标题栏样式
titleBarStyle: {
background: "rgba(255, 255, 255, 0)",
color: "",
},
},
created() {
this.getCurrentDate()
this.getPageStyle()
$("#diy").show()
$("#loading").hide()
},
methods: {
// 获取已选页面样式
getPageStyle() {
var index = this.pageData.pageStyle.findIndex(item => {
if (item.layout == this.pageData.pageLayout) return true
})
if (index === -1) index = 0
this.selectPageStyle = JSON.parse(JSON.stringify(this.pageData.pageStyle[index]))
},
// 获取当前时间
getCurrentDate() {
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
this.currentDate = `${year}/${month}/${day}`;
},
// 编辑组件
handleEdit(index) {
this.selectedIndex = index;
this.currentData = {}
this.$nextTick(() => {
if (this.selectedIndex == -1) {
this.currentData = this.selectPageStyle;
} else {
this.currentData = this.pageData.items[this.selectedIndex];
if (!this.currentData.activeName) this.currentData.activeName = "first"
}
})
},
// 拖动组件
handleDrag(event) {
this.handleEdit(event.newIndex);
},
// 重置颜色
handleResetColor(source, key, color) {
source[key] = color;
},
// 选择图片
handleSelectImage(source, index, type = "image/") {
parent.Fast.api.open(`general/attachment/select?element_id=&multiple=true&mimetype=${type}*`, __('Choose'), {
callback: (data) => {
if (data.multiple) {
var url = Fast.api.cdnurl(data.url);
source[index] = url;
}
}
});
},
// 删除图片
handleDeleteImage(source, index) {
source[index] = "";
},
// 选择组件类型
handleSelectType(source) {
this.selectCallback = (type, row) => {
source['link'] = null;
switch (type) {
case 'Custom':
var path = row.path
if (row.parameter) {
if (path.indexOf("?") > -1) path += "&" + row.parameter
else path += "?" + row.parameter
}
source['link'] = { type: type, title: row.title, path: path, };
break;
case 'Editor':
var content = $("#Editor").val()
source['link'] = { type: type, title: row.name, pageTitle: this.selectForm.title, content: content };
break;
case 'WXMp':
source['link'] = { type: type, title: row.name, appid: this.selectForm.appid, path: this.selectForm.path };
break;
case 'Outside':
source['link'] = { type: type, title: row.name, url: this.selectForm.protocol + this.selectForm.url };
break;
case 'Phone':
source['link'] = { type: type, title: row.name, phone: this.selectForm.phone };
break;
case 'Service':
source['link'] = { type: type, title: row.name };
break;
}
this.selectVisible = false;
}
$.post('wdsxh/person_center_diy_page/select_url_pro', {}, (res) => {
this.selectData = res.rows;
this.selectForm = {
title: "",
content: "",
appid: '',
path: '',
protocol: '',
url: '',
phone: '',
}
if (source['link']) {
this.selectType = source['link'].type
if (source['link'].type === 'Custom') {
let index = this.selectData.Custom.list.findIndex((item) => {
if (source['link'].path.indexOf(item.path) > -1) {
return true
}
})
if (index > -1) {
let selectLink = this.selectData.Custom.list[index]
this.$delete(this.selectData.Custom.list, index)
let selectPath = source['link'].path.split(selectLink.path)[1]
if (selectPath[0] == "?" || selectPath[0] == "&") {
this.$set(selectLink, "parameter", selectPath.slice(1))
}
this.selectData.Custom.list.unshift(selectLink)
this.selectData.Custom.list = [...this.selectData.Custom.list]
}
} else if (source['link'].type === 'WXMp') {
this.selectForm.appid = source['link'].appid;
this.selectForm.path = source['link'].path;
} else if (source['link'].type === 'Outside') {
if (source['link'].url && source['link'].url.substring(0, 5) == "http:") {
this.selectForm.protocol = 'http://';
this.selectForm.url = source['link'].url.split('http://')[1];
} else if (source['link'].url && source['link'].url.substring(0, 5) == "https") {
this.selectForm.protocol = 'https://';
this.selectForm.url = source['link'].url.split('https://')[1];
} else {
this.selectForm.protocol = '';
this.selectForm.url = source['link'].url;
}
} else if (source['link'].type === 'Phone') {
this.selectForm.phone = source['link'].phone
}
} else {
this.selectType = "Custom"
$("#Editor").val("")
}
this.selectVisible = true;
this.$nextTick(() => {
if (source['link'] && source['link'].type === 'Editor') {
$("#Editor").val(source['link'].content)
this.selectForm.title = source['link'].pageTitle
this.selectForm.content = source['link'].content
}
Controller.api.bindevent();
})
});
},
// 改变选择框类型
tabChange(e) {
if (e.name == "Editor") {
this.$nextTick(() => {
Form.api.bindevent($("form[role=form]"));
$('#Editor').on('change', () => {
this.selectForm.content = $('#Editor').val()
});
})
}
},
// 添加组件内容项目
handleAddItem() {
this.currentData.data.push({
imgUrl: '/assets/addons/wdsxh/img/menu.png',
link: null,
text: '导航标题',
});
},
// 删除组件内容项目
handleDeleteItem(index) {
if (this.pageData.items[this.selectedIndex].data.length > 1) {
this.pageData.items[this.selectedIndex].data.splice(index, 1);
} else {
this.$message({
showClose: true,
message: '至少保留一个项目',
type: 'error'
});
}
},
// 监听页面滚动
handleScroll(e) {
const scrollTop = e.target.scrollTop
if (scrollTop > 100) {
this.titleBarStyle.background = "#fff"
this.titleBarStyle.color = "black"
} else {
let opacity = parseFloat(scrollTop / 100).toFixed(4)
this.titleBarStyle.background = "rgba(255, 255, 255, " + opacity + ")"
if (scrollTop > 30) {
this.titleBarStyle.color = "black"
} else {
this.titleBarStyle.color = ""
}
}
},
// 重置数据
handleReset() {
this.$confirm('此操作将重置为系统默认样式,将导致已设置样式被覆盖,是否继续?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const data = JSON.parse(JSON.stringify(this.defaultData))
this.pageData.pageTitle = data.pageTitle
this.pageData.pageStyle = data.pageStyle
this.pageData.items = data.items
this.getPageStyle()
this.handleEdit(-1)
}).catch(() => { })
},
// 提交数据
handleSubmit() {
var submitData = JSON.parse(JSON.stringify(this.pageData))
var index = submitData.pageStyle.findIndex(item => {
if (item.layout == submitData.pageLayout) return true
})
if (index === -1) index = 0
submitData.pageStyle[index] = JSON.parse(JSON.stringify(this.selectPageStyle))
for (var i in submitData.items) {
submitData.items[i].activeName = undefined
}
$.post('', { data: JSON.stringify(submitData) }, (res) => {
if (res.code == 1) {
Toastr.success(res.msg);
this.pageData = submitData
this.getCurrentDate()
this.getPageStyle()
return
}
return Toastr.error(res.msg);
});
},
}
});
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,14 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,52 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/points/express/index' + location.search,
add_url: 'wdsxh/points/express/add',
edit_url: 'wdsxh/points/express/edit',
del_url: 'wdsxh/points/express/del',
import_url: 'wdsxh/points/express/import',
table: 'wdsxh_points_express',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,135 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/points/goods/index' + location.search,
add_url: 'wdsxh/points/goods/add',
edit_url: 'wdsxh/points/goods/edit',
del_url: 'wdsxh/points/goods/del',
multi_url: 'wdsxh/points/goods/multi',
import_url: 'wdsxh/points/goods/import',
table: 'wdsxh_points_goods',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'points', title: __('Points'), operate: false},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/points/goods/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/points/goods/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/points/goods/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
var form = $("form[role=form]");
// 先拦截提交按钮的点击事件(优先级最高)
form.find("button[type='submit']").on("click", function(e) {
var points = parseFloat($("#c-points").val());
if (isNaN(points) || points <= 0) {
e.preventDefault();
e.stopImmediatePropagation();
Layer.msg('积分必须大于0', {icon: 2, time: 2000});
return false;
}
});
// 绑定表单事件
Form.api.bindevent(form);
}
}
};
return Controller;
});

View File

@@ -0,0 +1,81 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/points/order/index' + location.search,
table: 'wdsxh_points_order',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{field: 'id', title: __('Id')},
{field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
{field: 'goods_info.name', title: __('Goods_info.name'), operate: false},
{field: 'goods_info.image', title: __('Goods_info.image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'points', title: __('Goods_info.points'), operate: false},
{field: 'number', title: __('Number')},
{field: 'real_name', title: __('Real_name'), operate: 'LIKE'},
{field: 'user_phone', title: __('User_phone'), operate: 'LIKE'},
{field: 'user_address', title: __('User_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'state', title: __('State'), searchList: {"2":__('State 2'),"3":__('State 3'),"4":__('State 4')}, formatter: Table.api.formatter.normal},
{field: 'total_points', title: __('Total_points')},
{field: 'redemption_time', title: __('Redemption_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'delivery',
text:'发货',
classname: 'btn btn-xs btn-primary btn-dialog bg-aqua',
icon: 'fa',
extend:'data-area=["80%","80%"]',
url: 'wdsxh/points/order/delivery',
visible:function(row){
if(row['state']==2){
return true;
}else{
return false;
}
},
refresh:true
},
{
text:'订单详情',
name: 'details',
title: '订单详情',
classname: 'btn btn-xs btn-primary btn-dialog bg-aqua',
icon: 'fa',
url: 'wdsxh/points/order/details',
extend:'data-area=["95%","95%"]',
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
delivery: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,98 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/points/ranking/index' + location.search,
table: 'wdsxh_user_wechat_points_log',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
commonSearch: false,
visible: true,
showToggle: false,
showColumns: true,
search:false,
showExport: true,
columns: [
[
{field: 'id', title: __('会员Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'level.name', title: __('Level.name'), operate: 'LIKE'},
{field: 'wechat.points', title: __('Points'), operate: false},
// {field: 'before', title: __('Before')},
// {field: 'after', title: __('After')},
// {field: 'memo', title: __('Memo'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons:[
{
name: 'list',
text: __('积分日志'),
title: __('积分日志'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa fa-list',
url: 'wdsxh/points/user_wechat_points_log/index?wechat_id={wechat_id}',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
},
extend: 'data-area=["70%","70%"]',
},
{
name: 'agree',
text: __('一键清零'),
title: __('一键清零'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
icon: 'fa fa-check',
url: 'wdsxh/points/ranking/one_click_reset',
confirm: '确认一键清零?操作后将清零',
visible:function (row){
if(row.wechat.points > 0){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
}
]
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
one_click_reset: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,50 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/points/user_wechat_points_log/index' + location.search,
table: 'wdsxh_user_wechat_points_log',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
commonSearch: false,
visible: false,
showToggle: false,
showColumns: false,
search:false,
showExport: false,
columns: [
[
{field: 'id', title: __('Id')},
{field: 'points', title: __('Points')},
{field: 'before', title: __('Before')},
{field: 'after', title: __('After')},
{field: 'memo', title: __('Memo'), operate: 'LIKE', table: table, class: 'autocontent'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'change', title: __('Change'), searchList: {"1":__('Change 1'),"2":__('Change 2')}, formatter: Table.api.formatter.normal},
{field: 'source', title: __('Source'), searchList: {"1":__('Source 1'),"2":__('Source 2'),"3":__('Source 3'),"4":__('Source 4'),"5":__('Source 5')}, formatter: Table.api.formatter.normal},
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,53 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/questionnaire/category/index' + location.search,
add_url: 'wdsxh/questionnaire/category/add',
edit_url: 'wdsxh/questionnaire/category/edit',
del_url: 'wdsxh/questionnaire/category/del',
multi_url: 'wdsxh/questionnaire/category/multi',
import_url: 'wdsxh/questionnaire/category/import',
table: 'wdsxh_questionnaire_category',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,155 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/questionnaire/questionnaire/index' + location.search,
add_url: 'wdsxh/questionnaire/questionnaire/add',
edit_url: 'wdsxh/questionnaire/questionnaire/edit',
del_url: 'wdsxh/questionnaire/questionnaire/del',
multi_url: 'wdsxh/questionnaire/questionnaire/multi',
import_url: 'wdsxh/questionnaire/questionnaire/import',
table: 'wdsxh_questionnaire',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent'},
{field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'applet_questionnaire_qrcode_path', title: __('Applet_questionnaire_qrcode_path'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'topic',
text: __('题目管理'),
title: __('题目管理'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa fa-list',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/questionnaire/topic/index?questionnaire_id={id}',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
},
{
name: 'topic',
text: __('问卷提交'),
title: __('问卷提交'),
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa fa-list',
extend: 'data-area=["100%","100%"]',
url: 'wdsxh/questionnaire/render/index?questionnaire_id={id}',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/questionnaire/questionnaire/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/questionnaire/questionnaire/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/questionnaire/questionnaire/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
config: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,120 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/questionnaire/render/index' + location.search,
table: 'wdsxh_questionnaire_render',
}
});
var table = $("#table");
// 从 URL 参数中获取 questionnaire_id
function getQuestionnaireIdFromUrl() {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get('questionnaire_id');
}
$(document).on("click", ".btn-export", function () {
var ids = Table.api.selectedids(table);
var page = table.bootstrapTable('getData');
var all = table.bootstrapTable('getOptions').totalRows;
console.log(ids, page, all);
var questionnaireId = getQuestionnaireIdFromUrl();
Layer.confirm("请选择导出的选项<form action='" + Fast.api.fixurl("wdsxh/questionnaire/render/export?questionnaire_id=") + questionnaireId + "' method='post' target='_blank'><input type='hidden' name='ids' value='' /><input type='hidden' name='filter' ><input type='hidden' name='op'><input type='hidden' name='search'><input type='hidden' name='columns'></form>", {
title: '导出数据',
btn: ["选中项(" + ids.length + "条)", "本页(" + page.length + "条)", "全部(" + all + "条)"],
success: function (layero, index) {
$(".layui-layer-btn a", layero).addClass("layui-layer-btn0");
}
, yes: function (index, layero) {
submitForm(ids.join(","), layero);
return false;
}
,
btn2: function (index, layero) {
var ids = [];
$.each(page, function (i, j) {
ids.push(j.id);
});
submitForm(ids.join(","), layero);
return false;
}
,
btn3: function (index, layero) {
submitForm("all", layero);
return false;
}
})
});
var submitForm = function (ids, layero) {
var options = table.bootstrapTable('getOptions');
console.log(options);
var columns = [];
$.each(options.columns[0], function (i, j) {
if (j.field && !j.checkbox && j.visible && j.field != 'operate') {
columns.push(j.field);
}
});
var search = options.queryParams({});
$("input[name=search]", layero).val(options.searchText);
$("input[name=ids]", layero).val(ids);
$("input[name=filter]", layero).val(search.filter);
$("input[name=op]", layero).val(search.op);
$("input[name=columns]", layero).val(columns.join(','));
$("form", layero).submit();
};
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
// fixedColumns: true,
// fixedRightNumber: 1,
search:false,
showToggle: false,
showColumns: false,
visible: false,
showExport:false,
commonSearch:false,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'wechat_id', title: __('Wechat_id')},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
text:'问卷详情',
name: 'details',
title: '问卷详情',
classname: 'btn btn-xs btn-primary btn-dialog bg-aqua',
icon: 'fa',
url: 'wdsxh/questionnaire/render/details',
extend:'data-area=["95%","95%"]',
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,175 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/questionnaire/topic/index' + location.search,
add_url: 'wdsxh/questionnaire/topic/add?questionnaire_id=' + Config.questionnaire_id,
edit_url: 'wdsxh/questionnaire/topic/edit',
del_url: 'wdsxh/questionnaire/topic/del',
multi_url: 'wdsxh/questionnaire/topic/multi',
import_url: 'wdsxh/questionnaire/topic/import',
table: 'wdsxh_questionnaire_topic',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'topic', title: __('Topic'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'type', title: __('Type'), searchList: {"text":__('Type text'),"number":__('Type number'),"radio":__('Type radio'),"checkbox":__('Type checkbox'),"select":__('Type select'),"date":__('Type date'),"time":__('Type time'),"datetime":__('Type datetime'),"textarea":__('Type textarea'),"image":__('Type image'),"images":__('Type images')}, formatter: Table.api.formatter.normal},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'wdsxh/questionnaire/topic/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'wdsxh/questionnaire/topic/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'wdsxh/questionnaire/topic/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
$(document).on('change', 'input[name="row[type]"]', function () {
var type = $("input[name='row[type]']:checked").val();
switch (type) {
case "radio":
$('.substance').removeClass('hide');
$('.is_explain').removeClass('hide');
$('.message').addClass('hide');
break;
case "checkbox":
$('.substance').removeClass('hide');
$('.is_explain').removeClass('hide');
$('.message').addClass('hide');
break;
case "select":
$('.substance').removeClass('hide');
$('.is_explain').addClass('hide');
$('.message').addClass('hide');
break;
case "text":
$('.substance').addClass('hide');
$('.is_explain').addClass('hide');
$('.message').removeClass('hide');
break;
case "number":
$('.substance').addClass('hide');
$('.is_explain').addClass('hide');
$('.message').removeClass('hide');
break;
case "datetime":
$('.substance').addClass('hide');
$('.is_explain').addClass('hide');
$('.message').removeClass('hide');
break;
case "textarea":
$('.substance').addClass('hide');
$('.is_explain').addClass('hide');
$('.message').removeClass('hide');
break;
case "images":
$('.substance').addClass('hide');
$('.is_explain').addClass('hide');
$('.message').addClass('hide');
break;
}
});
$(document).on('change', 'input[name="row[is_explain]"]', function () {
var type = $("input[name='row[is_explain]']:checked").val();
switch (type) {
case "1":
$('.explain').removeClass('hide');
break;
case "2":
$('.explain').addClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,88 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/quickmenu/index' + location.search,
add_url: 'wdsxh/quickmenu/add',
edit_url: 'wdsxh/quickmenu/edit',
del_url: 'wdsxh/quickmenu/del',
multi_url: 'wdsxh/quickmenu/multi',
import_url: 'wdsxh/quickmenu/import',
table: 'wdsxh_quickmenu',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'icon', title: __('Icon'), operate: false, formatter: Table.api.formatter.image},
{field: 'skip_type', title: __('Skip_type'), searchList: {"1":__('Skip_type 1'),"2":__('Skip_type 2'),"3":__('Skip_type 3'),"4":__('Skip_type 4')}, formatter: Table.api.formatter.normal},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$("#c-path").data("format-item", function(row){
return row.name + " 【" + row.url+"】";
});
Form.api.bindevent($("form[role=form]"));
$(document).on('change','input[name="row[skip_type]"]',function (){
var type=$(this).val();
switch (type){
case "1":
$('.page-url').removeClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').addClass('hide');
break;
case "2":
$('.page-url').addClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').removeClass('hide');
break;
case "3":
$('.page-url').addClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').removeClass('hide');
$('.teletext').addClass('hide');
break;
case "4":
$('.page-url').addClass('hide');
$('.outer-url').removeClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').addClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,88 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/tabbar/index' + location.search,
add_url: 'wdsxh/tabbar/add',
edit_url: 'wdsxh/tabbar/edit',
del_url: 'wdsxh/tabbar/del',
multi_url: 'wdsxh/tabbar/multi',
import_url: 'wdsxh/tabbar/import',
table: 'wdsxh_tabbar',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'jump_type', title: __('Jump_type'), searchList: {"0":__('Jump_type 0'),"1":__('Jump_type 1'),"2":__('Jump_type 2'),"3":__('Jump_type 3'),"4":__('Jump_type 4')}, formatter: Table.api.formatter.normal},
{field: 'icon', title: __('Icon'), operate: false, formatter: Table.api.formatter.image},
{field: 'selicon', title: __('Selicon'), operate: false, formatter: Table.api.formatter.image},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$("#c-jump_link").data("format-item", function(row){
return row.name + " 【" + row.url+"】";
});
Form.api.bindevent($("form[role=form]"));
$(document).on('change','input[name="row[jump_type]"]',function (){
var type=$(this).val();
switch (type){
case "1":
$('.page-url').addClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').removeClass('hide');
break;
case "2":
$('.page-url').removeClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').addClass('hide');
break;
case "4":
$('.page-url').addClass('hide');
$('.outer-url').addClass('hide');
$('.wxapp').removeClass('hide');
$('.teletext').addClass('hide');
break;
case "3":
$('.page-url').addClass('hide');
$('.outer-url').removeClass('hide');
$('.wxapp').addClass('hide');
$('.teletext').addClass('hide');
break;
}
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,100 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
Controller.api.bindevent();
$(document).on("click", ".top-box-button", function (event) {
$.post('wdsxh/upgrade/check', { old_version: Config.old_version, name: Config.name }, function (result) {
console.log(result); // 调试输出
if (result.code === 1) {
var window_bg = document.getElementsByClassName("renew-popup")[0];
var log_content = result.data.log_content;
$(".title-num").text(result.data.new_version);
$(".info-title").text(result.data.introduction);
$("#log").html(log_content);
window_bg.style.display = "block";
} else if (result.code === 2) {
Toastr.error(result.msg);
} else if (result.code === 3) {
Toastr.error('请先绑定授权编码');
} else {
var window_bg = document.getElementsByClassName("latest-popup")[0];
$("#latest-version").text(Config.old_version + '已是最新版本');
window_bg.style.display = "block";
window.onclick = function (event) {
if (event.target == window_bg) {
event.target.style.display = "none";
}
};
}
});
});
$(document).on("click", ".info-button", function () {
var window_bg = document.getElementsByClassName("renew-popup")[0];
window_bg.style.display = "block";
var index = layer.load(2, { //icon0-2 加载中,页面显示不同样式
// shade: [0.4, '#000'], //0.4为透明度 #000 为颜色
content: "更新中",
success: function (layero) {
layero.find('.layui-layer-content').css({
'padding-top': '40px',//图标与样式会重合,这样设置可以错开
'width': '200px'//文字显示的宽度
});
}
});
$.post('wdsxh/upgrade/update', { old_version: Config.old_version,name: Config.name }, function (result) {
if (result.code === 1) {
Toastr.success('升级成功');
layer.close(index);
// window_bg.style.display = "none"
return setTimeout(() => {
window.location.reload();
}, 1000);
} else if(result.code === 2) {
layer.close(index);
return Toastr.error(result.msg);
} else {
layer.close(index);
return Toastr.error(result.msg);
}
//return Toastr.error(result.msg);
});
});
$(document).ready(function() {
var index; // 在作用域内声明
$(document).on("click", ".top-box-button-code", function () {
var inputValue = $('.top-box-name-code').val();
console.log(inputValue); // 打印到控制台以确认是否获取到值
$.post('wdsxh/upgrade/code_edit', {
code: inputValue,name: Config.name
}, function (result) {
if (result.code === 1) {
Toastr.success('绑定成功');
layer.close(index);
setTimeout(() => {
window.location.reload();
}, 1000);
} else {
layer.close(index);
Toastr.error(result.msg);
}
});
});
});
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,101 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/user/user/index',
del_url: 'wdsxh/user/user/del',
multi_url: 'wdsxh/user/user/multi',
table: 'user',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'user.id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'), sortable: true},
// {field: 'username', title: __('Username'), operate: 'LIKE'},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
{field: 'channel', title: __('注册来源'), operate: false, searchList: {"1":__('微信小程序'),"2":__('微信公众号')}, formatter: Table.api.formatter.normal},
{field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'set_admin', title: __('Set_admin'), operate: false, searchList: {"1":__('Set_admin 1'),"2":__('Set_admin 2')}, formatter: Table.api.formatter.normal},
{field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'pass_through',
text: __('设为管理员'),
title: __('设为管理员'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
url: 'wdsxh/user/wechat/pass_through',
confirm: '确认设此用为管理员?',
visible:function(row){
if(row['set_admin']==2){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
},
{
name: 'cancellation',
text: __('取消管理员'),
title: __('取消管理员'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
url: 'wdsxh/user/wechat/cancellation',
confirm: '确认并取消此用户的管理权限?',
visible:function(row){
if(row['set_admin']==1){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,123 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/user/wechat/index' + location.search,
table: 'wdsxh_user_wechat',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{field: 'id', title: __('Id')},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'set_admin', title: __('Set_admin'), searchList: {"1":__('Set_admin 1'),"2":__('Set_admin 2')}, formatter: Table.api.formatter.normal},
{field: 'channel', title: __('Channel'), searchList: {"1":__('Channel 1'),"2":__('Channel 2')}, formatter: Table.api.formatter.normal},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'pass_through',
text: __('设为管理员'),
title: __('设为管理员'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
url: 'wdsxh/user/wechat/pass_through',
confirm: '确认设此用为管理员?',
visible:function(row){
if(row['set_admin']==2){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
},
{
name: 'cancellation',
text: __('取消管理员'),
title: __('取消管理员'),
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
url: 'wdsxh/user/wechat/cancellation',
confirm: '确认并取消此用户的管理权限?',
visible:function(row){
if(row['set_admin']==1){
return true;
}else{
return false;
}
},
success: function (data, ret) {
$("#table").bootstrapTable('refresh',{});
},
error: function (data, ret) {
Toastr.error(ret.msg);
return false;
}
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
user: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'wdsxh/user/wechat/user' + location.search,
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{field: 'id', title: __('Id')},
{field: 'nickname', title: '昵称', operate: 'LIKE'},
{field: 'avatar', title: '头像', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'createtime', title: '注册时间', operate:'RANGE', addclass:'datetimerange', autocomplete:false},
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@@ -0,0 +1,39 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'clipboard', 'designer', 'jquery-contextMenu', 'jquery-form', 'jquery-lazyload', 'poster', 'wdsxh-colorpicker'], function ($, undefined, Backend, Table, Form, Clipboard, Designer, jqueryContextMenu, jqueryForm, jqueryLazyload, poster, colorpicker) {
var Controller = {
index: function () {
$(".panel-body").show()
$("#loading").hide()
$("#faupload-image").data("upload-success", function (data) {
var url = Fast.api.cdnurl(data.url);
$(".bg").prop("src", url);
});
Form.api.bindevent($("form[role=form]"), function (data, ret) {
Toastr.success("成功");
}, function (data, ret) {
Toastr.success("失败");
}, function (success, error) {
var data = getPosterData();
console.log(data)
$('#poster-data').val(JSON.stringify(data));
Form.api.submit(this, success, error);
return false;
});
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"), function (data, ret) {
Toastr.success("成功");
}, function (data, ret) {
Toastr.success("失败");
}, function (success, error) {
var data = getPosterData();
$('#poster-data').val(JSON.stringify(data));
Form.api.submit(this, success, error);
return false;
});
}
}
};
return Controller;
});

View File

@@ -0,0 +1,404 @@
/**
* FastAdmin通用搜索
*
* @author: pppscn <35696959@qq.com>
* @update 2017-05-07 <https://gitee.com/pp/fastadmin>
*
* @author: Karson <karson@fastadmin.net>
* @update 2018-04-05 <https://gitee.com/karson/fastadmin>
*/
!function ($) {
'use strict';
var ColumnsForSearch = [];
var sprintf = $.fn.bootstrapTable.utils.sprintf;
var initCommonSearch = function (pColumns, that) {
var vFormCommon = createFormCommon(pColumns, that);
var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
vModal += vFormCommon;
vModal += "</div>";
that.$container.prepend($(vModal));
that.$commonsearch = $(".commonsearch-table", that.$container);
var form = $("form.form-commonsearch", that.$commonsearch);
require(['form'], function (Form) {
Form.api.bindevent(form);
form.validator("destroy");
});
// 表单提交
form.on("submit", function (event) {
event.preventDefault();
that.onCommonSearch();
return false;
});
// 重置搜索
form.on("click", "button[type=reset]", function (event) {
form[0].reset();
setTimeout(function () {
that.onCommonSearch();
}, 1);
});
};
var createFormCommon = function (pColumns, that) {
// 如果有使用模板则直接返回模板的内容
if (that.options.searchFormTemplate) {
return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
}
var htmlForm = [];
htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm));
htmlForm.push('<fieldset>');
if (that.options.titleForm.length > 0)
htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
htmlForm.push('<div class="row">');
for (var i in pColumns) {
var vObjCol = pColumns[i];
if (!vObjCol.checkbox && !vObjCol.radio && vObjCol.field && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
var query = Fast.api.query(vObjCol.field);
var operate = Fast.api.query(vObjCol.field + "-operate");
var renderDefault = that.options.renderDefault && (typeof vObjCol.renderDefault == 'undefined' || vObjCol.renderDefault);
vObjCol.defaultValue = renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
vObjCol.operate = renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
ColumnsForSearch.push(vObjCol);
htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
htmlForm.push('<div class="col-xs-8">');
vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="%s-operate" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
var addClass = typeof vObjCol.addClass === 'undefined' ? (typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass) : 'form-control ' + vObjCol.addClass;
var extend = typeof vObjCol.extend === 'undefined' ? '' : vObjCol.extend;
var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
extend = typeof vObjCol.data !== 'undefined' && extend == '' ? vObjCol.data : extend;
extend = typeof vObjCol.autocomplete !== 'undefined' ? extend + ' autocomplete="' + (vObjCol.autocomplete === false || vObjCol.autocomplete === 'off' ? 'off' : 'on') + '"' : extend;
if (vObjCol.searchList) {
if (typeof vObjCol.searchList === 'function') {
htmlForm.push(vObjCol.searchList.call(this, vObjCol));
} else {
var optionList = [sprintf('<option value="">%s</option>', that.options.formatCommonChoose())];
if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
(function (vObjCol, that) {
$.when(vObjCol.searchList).done(function (ret) {
var searchList = [];
if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
searchList = ret.data.searchlist;
} else if (ret.constructor === Array || ret.constructor === Object) {
searchList = ret;
}
var optionList = createOptionList(searchList, vObjCol, that);
$("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).html(optionList.join('')).trigger("change");
});
})(vObjCol, that);
} else {
optionList = createOptionList(vObjCol.searchList, vObjCol, that);
}
htmlForm.push(sprintf('<select class="%s" name="%s" %s %s>%s</select>', addClass, vObjCol.field, style, extend, optionList.join('')));
}
} else {
var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
if (/BETWEEN$/.test(vObjCol.operate)) {
var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
htmlForm.push('<div class="row row-between">');
htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s-min" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[0], placeholderArr[0], vObjCol.field, i, style, extend));
htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s-max" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[1], placeholderArr[1], vObjCol.field, i, style, extend));
htmlForm.push('</div>');
} else {
htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s>', type, addClass, vObjCol.field, defaultValue, placeholder, vObjCol.field, i, style, extend));
}
}
htmlForm.push('</div>');
htmlForm.push('</div>');
}
}
htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
htmlForm.push(createFormBtn(that).join(''));
htmlForm.push('</div>');
htmlForm.push('</div>');
htmlForm.push('</fieldset>');
htmlForm.push('</form>');
return htmlForm.join('');
};
var createFormBtn = function (that) {
var htmlBtn = [];
var searchSubmit = that.options.formatCommonSubmitButton();
var searchReset = that.options.formatCommonResetButton();
htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
htmlBtn.push('</div>');
return htmlBtn;
};
var createOptionList = function (searchList, vObjCol, that) {
var isArray = searchList.constructor === Array;
var optionList = [];
optionList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
$.each(searchList, function (key, value) {
if (value.constructor === Object) {
key = value.id;
value = value.name;
} else {
key = isArray ? value : key;
}
optionList.push(sprintf("<option value='" + key + "' %s>" + value + "</option>", key == vObjCol.defaultValue ? 'selected' : ''));
});
return optionList;
};
var isSearchAvailble = function (that) {
//只支持服务端搜索
if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
return false;
}
return true;
};
var getSearchQuery = function (that, removeempty) {
var op = {};
var filter = {};
var value = '';
$("form.form-commonsearch .operate", that.$commonsearch).each(function (i) {
var name = $(this).data("name");
var sym = $(this).is("select") ? $("option:selected", this).val() : $(this).val().toUpperCase();
var obj = $("[name='" + name + "']", that.$commonsearch);
if (obj.length == 0)
return true;
var vObjCol = ColumnsForSearch[i];
var process = !that.options.searchFormTemplate && vObjCol && typeof vObjCol.process == 'function' ? vObjCol.process : null;
if (obj.length > 1) {
if (/BETWEEN$/.test(sym)) {
var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()),
value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
if (value_begin.length || value_end.length) {
if (process) {
value_begin = process(value_begin, 'begin');
value_end = process(value_end, 'end');
}
value = value_begin + ',' + value_end;
} else {
value = '';
}
//如果是时间筛选将operate置为RANGE
if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
sym = 'RANGE';
}
} else {
value = $("[name='" + name + "']:checked", that.$commonsearch).val();
value = process ? process(value) : value;
}
} else {
value = process ? process(obj.val()) : obj.val();
}
if (removeempty && (value == '' || value == null || ($.isArray(value) && value.length == 0)) && !sym.match(/null/i)) {
return true;
}
op[name] = sym;
filter[name] = value;
});
return {op: op, filter: filter};
};
var getQueryParams = function (params, searchQuery, removeempty) {
params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
params.filter = $.extend({}, params.filter, searchQuery.filter);
params.op = $.extend({}, params.op, searchQuery.op);
//移除empty的值
if (removeempty) {
$.each(params.filter, function (i, j) {
if ((j == '' || j == null || ($.isArray(j) && j.length == 0)) && !params.op[i].match(/null/i)) {
delete params.filter[i];
delete params.op[i];
}
});
}
params.filter = JSON.stringify(params.filter);
params.op = JSON.stringify(params.op);
return params;
};
$.extend($.fn.bootstrapTable.defaults, {
commonSearch: false,
titleForm: "Common search",
actionForm: "",
searchFormTemplate: "",
searchFormVisible: true,
searchClass: 'searchit',
showSearch: true,
renderDefault: true,
onCommonSearch: function (field, text) {
return false;
},
onPostCommonSearch: function (table) {
return false;
}
});
$.extend($.fn.bootstrapTable.defaults.icons, {
commonSearchIcon: 'glyphicon-search'
});
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
'common-search.bs.table': 'onCommonSearch',
'post-common-search.bs.table': 'onPostCommonSearch'
});
$.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
formatCommonSearch: function () {
return "Common search";
},
formatCommonSubmitButton: function () {
return "Submit";
},
formatCommonResetButton: function () {
return "Reset";
},
formatCommonCloseButton: function () {
return "Close";
},
formatCommonChoose: function () {
return "Choose";
}
});
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initHeader = BootstrapTable.prototype.initHeader,
_initToolbar = BootstrapTable.prototype.initToolbar,
_load = BootstrapTable.prototype.load,
_initSearch = BootstrapTable.prototype.initSearch;
BootstrapTable.prototype.initHeader = function () {
_initHeader.apply(this, Array.prototype.slice.apply(arguments));
this.$header.find('th[data-field]').each(function (i) {
var column = $(this).data();
if (typeof column['width'] !== 'undefined' && column['width'].toString().indexOf("%") === -1) {
$(".th-inner", this).outerWidth(column['width']);
$(this).css("max-width", column['width']);
}
});
this.options.stateField = this.header.stateField;
};
BootstrapTable.prototype.initToolbar = function () {
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
if (!isSearchAvailble(this)) {
return;
}
var that = this,
html = [];
if (that.options.showSearch) {
html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="commonSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatCommonSearch()));
html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
html.push('</button></div>');
}
if (that.$toolbar.find(".pull-right").length > 0) {
$(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first"));
} else {
that.$toolbar.append(html.join(''));
}
initCommonSearch(that.columns, that);
that.$toolbar.find('button[name="commonSearch"]')
.off('click').on('click', function () {
that.$commonsearch.toggleClass("hidden");
return;
});
that.$container.on("click", "." + that.options.searchClass, function () {
var value = $(this).data("value");
var field = $(this).data("field");
var ul = that.$container.closest(".panel-intro").find("ul[data-field='" + field + "']");
if (ul.length > 0) {
$('li a[data-value="' + value + '"][data-toggle="tab"]', ul).trigger('click');
return;
}
var obj = $("form [name='" + field + "']", that.$commonsearch);
if (obj.length > 0) {
if (obj.is("select")) {
$("option[value='" + value + "']", obj).prop("selected", true);
} else if (obj.length > 1) {
$("form [name='" + field + "'][value='" + value + "']", that.$commonsearch).prop("checked", true);
} else {
obj.val(value + "");
}
obj.trigger("change");
$("form", that.$commonsearch).trigger("submit");
}
});
var queryParams = that.options.queryParams;
//匹配默认搜索值
this.options.queryParams = function (params) {
return queryParams(getQueryParams(params, getSearchQuery(that, true)));
};
this.trigger('post-common-search', that);
};
BootstrapTable.prototype.onCommonSearch = function () {
var searchQuery = getSearchQuery(this);
this.trigger('common-search', this, searchQuery);
this.options.pageNumber = 1;
//this.options.pageSize = $.fn.bootstrapTable.defaults.pageSize;
this.refresh({});
};
BootstrapTable.prototype.load = function (data) {
_load.apply(this, Array.prototype.slice.apply(arguments));
if (!isSearchAvailble(this)) {
return;
}
};
BootstrapTable.prototype.initSearch = function () {
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
if (!isSearchAvailble(this)) {
return;
}
var that = this;
var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
this.data = fp ? $.grep(this.data, function (item, i) {
for (var key in fp) {
var fval = fp[key].toLowerCase();
var value = item[key];
value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
that.header.formatters[$.inArray(key, that.header.fields)],
[value, item, i], value);
if (!($.inArray(key, that.header.fields) !== -1 &&
(typeof value === 'string' || typeof value === 'number') &&
(value + '').toLowerCase().indexOf(fval) !== -1)) {
return false;
}
}
return true;
}) : this.data;
};
}(jQuery);

View File

@@ -0,0 +1,74 @@
/**
* 将BootstrapTable的行使用自定义的模板来渲染
*
* @author: karson
* @version: v0.0.1
*
* @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
*/
!function ($) {
'use strict';
$.extend($.fn.bootstrapTable.defaults, {
//是否启用模板渲染
templateView: false,
//数据格式化的模板ID或格式函数
templateFormatter: "itemtpl",
//添加的父类的class
templateParentClass: "row row-flex",
//向table添加的class
templateTableClass: "table-template",
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initContainer = BootstrapTable.prototype.initContainer,
_initBody = BootstrapTable.prototype.initBody,
_initRow = BootstrapTable.prototype.initRow;
BootstrapTable.prototype.initContainer = function () {
_initContainer.apply(this, Array.prototype.slice.apply(arguments));
var that = this;
if (!that.options.templateView) {
return;
}
that.options.cardView = true;
};
BootstrapTable.prototype.initBody = function () {
var that = this;
$.extend(that.options, {
showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
});
$(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
_initBody.apply(this, Array.prototype.slice.apply(arguments));
if (!that.options.templateView) {
return;
} else {
//由于Bootstrap是基于Table的添加一个父类容器
$("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
}
};
BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
var that = this;
//如果未启用则使用原生的initRow方法
if (!that.options.templateView) {
return _initRow.apply(that, Array.prototype.slice.apply(arguments));
}
var $content = '';
if (typeof that.options.templateFormatter === 'function') {
$content = that.options.templateFormatter.call(that, item, i, data);
} else {
var Template = require('template');
$content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
}
return $content;
};
}(jQuery);

3851
public/assets/js/dropzone.js Normal file

File diff suppressed because it is too large Load Diff

1
public/assets/js/dropzone.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,511 @@
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory);
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'));
} else {
// Browser globals
factory({}, root.echarts);
}
}(this, function (exports, echarts) {
var log = function (msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg);
}
};
if (!echarts) {
log('ECharts is not Loaded');
return;
}
echarts.registerTheme('walden', {
"color": [
"#3fb1e3",
"#6be6c1",
"#626c91",
"#a0a7e6",
"#c4ebad",
"#96dee8"
],
"backgroundColor": "rgba(252,252,252,0)",
"textStyle": {},
"title": {
"textStyle": {
"color": "#666666"
},
"subtextStyle": {
"color": "#999999"
}
},
"line": {
"itemStyle": {
"normal": {
"borderWidth": "2"
}
},
"lineStyle": {
"normal": {
"width": "3"
}
},
"symbolSize": "8",
"symbol": "emptyCircle",
"smooth": false
},
"radar": {
"itemStyle": {
"normal": {
"borderWidth": "2"
}
},
"lineStyle": {
"normal": {
"width": "3"
}
},
"symbolSize": "8",
"symbol": "emptyCircle",
"smooth": false
},
"bar": {
"itemStyle": {
"normal": {
"barBorderWidth": 0,
"barBorderColor": "#ccc"
},
"emphasis": {
"barBorderWidth": 0,
"barBorderColor": "#ccc"
}
}
},
"pie": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"scatter": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"boxplot": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"parallel": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"sankey": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"funnel": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"gauge": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"candlestick": {
"itemStyle": {
"normal": {
"color": "#e6a0d2",
"color0": "transparent",
"borderColor": "#e6a0d2",
"borderColor0": "#3fb1e3",
"borderWidth": "2"
}
}
},
"graph": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
}
},
"lineStyle": {
"normal": {
"width": "1",
"color": "#cccccc"
}
},
"symbolSize": "8",
"symbol": "emptyCircle",
"smooth": false,
"color": [
"#3fb1e3",
"#6be6c1",
"#626c91",
"#a0a7e6",
"#c4ebad",
"#96dee8"
],
"label": {
"normal": {
"textStyle": {
"color": "#ffffff"
}
}
}
},
"map": {
"itemStyle": {
"normal": {
"areaColor": "#eeeeee",
"borderColor": "#aaaaaa",
"borderWidth": 0.5
},
"emphasis": {
"areaColor": "rgba(63,177,227,0.25)",
"borderColor": "#3fb1e3",
"borderWidth": 1
}
},
"label": {
"normal": {
"textStyle": {
"color": "#ffffff"
}
},
"emphasis": {
"textStyle": {
"color": "rgb(63,177,227)"
}
}
}
},
"geo": {
"itemStyle": {
"normal": {
"areaColor": "#eeeeee",
"borderColor": "#aaaaaa",
"borderWidth": 0.5
},
"emphasis": {
"areaColor": "rgba(63,177,227,0.25)",
"borderColor": "#3fb1e3",
"borderWidth": 1
}
},
"label": {
"normal": {
"textStyle": {
"color": "#ffffff"
}
},
"emphasis": {
"textStyle": {
"color": "rgb(63,177,227)"
}
}
}
},
"categoryAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#999999"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"valueAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#999999"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"logAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#999999"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"timeAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#999999"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"toolbox": {
"iconStyle": {
"normal": {
"borderColor": "#999999"
},
"emphasis": {
"borderColor": "#666666"
}
}
},
"legend": {
"textStyle": {
"color": "#999999"
}
},
"tooltip": {
"axisPointer": {
"lineStyle": {
"color": "#cccccc",
"width": 1
},
"crossStyle": {
"color": "#cccccc",
"width": 1
}
}
},
"timeline": {
"lineStyle": {
"color": "#626c91",
"width": 1
},
"itemStyle": {
"normal": {
"color": "#626c91",
"borderWidth": 1
},
"emphasis": {
"color": "#626c91"
}
},
"controlStyle": {
"normal": {
"color": "#626c91",
"borderColor": "#626c91",
"borderWidth": 0.5
},
"emphasis": {
"color": "#626c91",
"borderColor": "#626c91",
"borderWidth": 0.5
}
},
"checkpointStyle": {
"color": "#3fb1e3",
"borderColor": "rgba(63,177,227,0.15)"
},
"label": {
"normal": {
"textStyle": {
"color": "#626c91"
}
},
"emphasis": {
"textStyle": {
"color": "#626c91"
}
}
}
},
"visualMap": {
"color": [
"#2a99c9",
"#afe8ff"
]
},
"dataZoom": {
"backgroundColor": "rgba(255,255,255,0)",
"dataBackgroundColor": "rgba(222,222,222,1)",
"fillerColor": "rgba(114,230,212,0.25)",
"handleColor": "#cccccc",
"handleSize": "100%",
"textStyle": {
"color": "#999999"
}
},
"markPoint": {
"label": {
"normal": {
"textStyle": {
"color": "#ffffff"
}
},
"emphasis": {
"textStyle": {
"color": "#ffffff"
}
}
}
}
});
}));

22
public/assets/js/echarts.min.js vendored Normal file

File diff suppressed because one or more lines are too long

389
public/assets/js/fast.js Normal file
View File

@@ -0,0 +1,389 @@
define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) {
var Fast = {
config: {
//toastr默认配置
toastr: {
"closeButton": true,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-center",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
},
events: {
//请求成功的回调
onAjaxSuccess: function (ret, onAjaxSuccess) {
var data = typeof ret.data !== 'undefined' ? ret.data : null;
var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
if (typeof onAjaxSuccess === 'function') {
var result = onAjaxSuccess.call(this, data, ret);
if (result === false)
return;
}
Toastr.success(msg);
},
//请求错误的回调
onAjaxError: function (ret, onAjaxError) {
var data = typeof ret.data !== 'undefined' ? ret.data : null;
if (typeof onAjaxError === 'function') {
var result = onAjaxError.call(this, data, ret);
if (result === false) {
return;
}
}
Toastr.error(ret.msg);
},
//服务器响应数据后
onAjaxResponse: function (response) {
try {
var ret = typeof response === 'object' ? response : JSON.parse(response);
if (!ret.hasOwnProperty('code')) {
$.extend(ret, {code: -2, msg: response, data: null});
}
} catch (e) {
var ret = {code: -1, msg: e.message, data: null};
}
return ret;
}
},
api: {
//发送Ajax请求
ajax: function (options, success, error) {
options = typeof options === 'string' ? {url: options} : options;
var index;
if (typeof options.loading === 'undefined' || options.loading) {
index = Layer.load(options.loading || 0);
}
options = $.extend({
type: "POST",
dataType: "json",
xhrFields: {
withCredentials: true
},
success: function (ret) {
index && Layer.close(index);
ret = Fast.events.onAjaxResponse(ret);
if (ret.code === 1) {
Fast.events.onAjaxSuccess(ret, success);
} else {
Fast.events.onAjaxError(ret, error);
}
},
error: function (xhr) {
index && Layer.close(index);
var ret = {code: xhr.status, msg: xhr.statusText, data: null};
Fast.events.onAjaxError(ret, error);
}
}, options);
return $.ajax(options);
},
//修复URL
fixurl: function (url) {
if (url.substr(0, 1) !== "/") {
var r = new RegExp('^(?:[a-z]+:)?//', 'i');
if (!r.test(url)) {
url = Config.moduleurl + "/" + url;
}
} else if (url.substr(0, 8) === "/addons/") {
url = Config.__PUBLIC__.replace(/(\/*$)/g, "") + url;
}
return url;
},
//获取修复后可访问的cdn链接
cdnurl: function (url, domain) {
var rule = new RegExp("^((?:[a-z]+:)?\\/\\/|data:image\\/)", "i");
var cdnurl = Config.upload.cdnurl;
if (typeof domain === 'undefined' || domain === true || cdnurl.indexOf("/") === 0) {
url = rule.test(url) || (cdnurl && url.indexOf(cdnurl) === 0) ? url : cdnurl + url;
}
if (domain && !rule.test(url)) {
domain = typeof domain === 'string' ? domain : location.origin;
url = domain + url;
}
return url;
},
//查询Url参数
query: function (name, url) {
if (!url) {
url = window.location.href;
}
if (!name)
return '';
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&/]" + name + "([=/]([^&#/?]*)|&|#|$)"),
results = regex.exec(url);
if (!results)
return null;
if (!results[2])
return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
},
//打开一个弹出窗口
open: function (url, title, options) {
title = options && options.title ? options.title : (title ? title : "");
url = Fast.api.fixurl(url);
url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
var success = options && typeof options.success === 'function' ? options.success : $.noop;
if (options && typeof options.success === 'function') {
delete options.success;
}
options = $.extend({
type: 2,
title: title,
shadeClose: true,
shade: false,
maxmin: true,
moveOut: true,
area: area,
content: url,
zIndex: Layer.zIndex,
success: function (layero, index) {
var that = this;
//存储callback事件
$(layero).data("callback", that.callback);
//$(layero).removeClass("layui-layer-border");
Layer.setTop(layero);
try {
var frame = Layer.getChildFrame('html', index);
var layerfooter = frame.find(".layer-footer");
Fast.api.layerfooter(layero, index, that);
//绑定事件
if (layerfooter.length > 0) {
// 监听窗口内的元素及属性变化
// Firefox和Chrome早期版本中带有前缀
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
if (MutationObserver) {
// 选择目标节点
var target = layerfooter[0];
// 创建观察者对象
var observer = new MutationObserver(function (mutations) {
Fast.api.layerfooter(layero, index, that);
mutations.forEach(function (mutation) {
});
});
// 配置观察选项:
var config = {attributes: true, childList: true, characterData: true, subtree: true}
// 传入目标节点和观察选项
observer.observe(target, config);
// 随后,你还可以停止观察
// observer.disconnect();
}
}
} catch (e) {
}
if ($(layero).height() > $(window).height()) {
//当弹出窗口大于浏览器可视高度时,重定位
Layer.style(index, {
top: 0,
height: $(window).height()
});
}
success.call(this, layero, index);
}
}, options ? options : {});
if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").length > 0)) {
if (top.$(".tab-pane.active").length > 0) {
options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
} else {
options.area = [$(window).width() + "px", $(window).height() + "px"];
options.offset = ["0px", "0px"];
}
}
return Layer.open(options);
},
//关闭窗口并回传数据
close: function (data) {
var index = parent.Layer.getFrameIndex(window.name);
var callback = parent.$("#layui-layer" + index).data("callback");
//再执行关闭
parent.Layer.close(index);
//再调用回传函数
if (typeof callback === 'function') {
callback.call(undefined, data);
}
},
layerfooter: function (layero, index, that) {
var frame = Layer.getChildFrame('html', index);
var layerfooter = frame.find(".layer-footer");
if (layerfooter.length > 0) {
$(".layui-layer-footer", layero).remove();
var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
footer.html(layerfooter.html());
if ($(".row", footer).length === 0) {
$(">", footer).wrapAll("<div class='row'></div>");
}
footer.insertAfter(layero.find('.layui-layer-content'));
//绑定事件
footer.on("click", ".btn", function () {
if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
return;
}
var index = footer.find('.btn').index(this);
$(".btn:eq(" + index + ")", layerfooter).trigger("click");
});
var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
//重设iframe高度
$("iframe", layero).height(layero.height() - titHeight - btnHeight);
}
//修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
$("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
$("iframe", layero).css("height", "100%");
}
},
success: function (options, callback) {
var type = typeof options === 'function';
if (type) {
callback = options;
}
return Layer.msg(__('Operation completed'), $.extend({
offset: 0, icon: 1
}, type ? {} : options), callback);
},
error: function (options, callback) {
var type = typeof options === 'function';
if (type) {
callback = options;
}
return Layer.msg(__('Operation failed'), $.extend({
offset: 0, icon: 2
}, type ? {} : options), callback);
},
msg: function (message, url) {
var callback = typeof url === 'function' ? url : function () {
if (typeof url !== 'undefined' && url) {
location.href = url;
}
};
Layer.msg(message, {
time: 2000
}, callback);
},
escape: function (text) {
if (typeof text === 'string') {
return text
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;')
.replace(/`/g, '&#x60;');
}
return text;
},
toastr: Toastr,
layer: Layer
},
lang: function () {
var args = arguments,
string = args[0],
i = 1;
string = string.toLowerCase();
//string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
if (typeof Lang !== 'undefined' && typeof Lang[string] !== 'undefined') {
if (typeof Lang[string] == 'object')
return Lang[string];
string = Lang[string];
} else if (string.indexOf('.') !== -1 && false) {
var arr = string.split('.');
var current = Lang[arr[0]];
for (var i = 1; i < arr.length; i++) {
current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
if (typeof current != 'object')
break;
}
if (typeof current == 'object')
return current;
string = current;
} else {
string = args[0];
}
return string.replace(/%((%)|s|d)/g, function (m) {
// m is the matched format, e.g. %s, %d
var val = null;
if (m[2]) {
val = m[2];
} else {
val = args[i];
// A switch statement so that the formatter can be extended. Default is %s
switch (m) {
case '%d':
val = parseFloat(val);
if (isNaN(val)) {
val = 0;
}
break;
}
i++;
}
return val;
});
},
init: function () {
// jQuery兼容处理
$.fn.extend({
size: function () {
return $(this).length;
}
});
// 对相对地址进行处理
$.ajaxSetup({
beforeSend: function (xhr, setting) {
setting.url = Fast.api.fixurl(setting.url);
}
});
Layer.config({
skin: 'layui-layer-fast'
});
// 绑定ESC关闭窗口事件
$(window).keyup(function (e) {
if (e.keyCode == 27) {
if ($(".layui-layer").length > 0) {
var index = 0;
$(".layui-layer").each(function () {
index = Math.max(index, parseInt($(this).attr("times")));
});
if (index) {
Layer.close(index);
}
}
}
});
//公共代码
//配置Toastr的参数
Toastr.options = Fast.config.toastr;
}
};
//将Layer暴露到全局中去
window.Layer = Layer;
//将Toastr暴露到全局中去
window.Toastr = Toastr;
//将语言方法暴露到全局中去
window.__ = Fast.lang;
//将Fast渲染至全局
window.Fast = Fast;
//默认初始化执行的代码
Fast.init();
return Fast;
});

View File

@@ -0,0 +1,3 @@
define(['frontend'], function (Frontend) {
});

View File

@@ -0,0 +1,115 @@
define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
var Frontend = {
api: Fast.api,
init: function () {
var si = {};
//发送验证码
$(document).on("click", ".btn-captcha", function (e) {
var type = $(this).data("type") ? $(this).data("type") : 'mobile';
var btn = this;
Frontend.api.sendcaptcha = function (btn, type, data, callback) {
$(btn).addClass("disabled", true).text("发送中...");
Frontend.api.ajax({url: $(btn).data("url"), data: data}, function (data, ret) {
clearInterval(si[type]);
var seconds = 60;
si[type] = setInterval(function () {
seconds--;
if (seconds <= 0) {
clearInterval(si);
$(btn).removeClass("disabled").text("发送验证码");
} else {
$(btn).addClass("disabled").text(seconds + "秒后可再次发送");
}
}, 1000);
if (typeof callback == 'function') {
callback.call(this, data, ret);
}
}, function () {
$(btn).removeClass("disabled").text('发送验证码');
});
};
if (['mobile', 'email'].indexOf(type) > -1) {
var element = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : $("input[name='" + type + "']", $(this).closest("form"));
var text = type === 'email' ? '邮箱' : '手机号码';
if (element.val() === "") {
Layer.msg(text + "不能为空!");
element.focus();
return false;
} else if (type === 'mobile' && !element.val().match(/^1[3-9]\d{9}$/)) {
Layer.msg("请输入正确的" + text + "");
element.focus();
return false;
} else if (type === 'email' && !element.val().match(/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/)) {
Layer.msg("请输入正确的" + text + "");
element.focus();
return false;
}
element.isValid(function (v) {
if (v) {
var data = {event: $(btn).data("event")};
data[type] = element.val();
Frontend.api.sendcaptcha(btn, type, data);
} else {
Layer.msg("请确认已经输入了正确的" + text + "");
}
});
} else {
var data = {event: $(btn).data("event")};
Frontend.api.sendcaptcha(btn, type, data, function (data, ret) {
Layer.open({title: false, area: ["400px", "430px"], content: "<img src='" + data.image + "' width='400' height='400' /><div class='text-center panel-title'>扫一扫关注公众号获取验证码</div>", type: 1});
});
}
return false;
});
//tooltip和popover
if (!('ontouchstart' in document.documentElement)) {
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
}
$('body').popover({selector: '[data-toggle="popover"]'});
// 手机端左右滑动切换菜单栏
if ('ontouchstart' in document.documentElement) {
var startX, startY, moveEndX, moveEndY, relativeX, relativeY, element;
element = $('body', document);
element.on("touchstart", function (e) {
startX = e.originalEvent.changedTouches[0].pageX;
startY = e.originalEvent.changedTouches[0].pageY;
});
element.on("touchend", function (e) {
moveEndX = e.originalEvent.changedTouches[0].pageX;
moveEndY = e.originalEvent.changedTouches[0].pageY;
relativeX = moveEndX - startX;
relativeY = moveEndY - startY;
// 判断标准
//右滑
if (relativeX > 45) {
if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50) {
element.addClass("sidebar-open");
}
}
//左滑
else if (relativeX < -45) {
if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50) {
element.removeClass("sidebar-open");
}
}
});
}
$(document).on("click", ".sidebar-toggle", function () {
$("body").toggleClass("sidebar-open");
});
}
};
Frontend.api = $.extend(Fast.api, Frontend.api);
//将Template渲染至全局,以便于在子框架中调用
window.Template = Template;
//将Moment渲染至全局,以便于在子框架中调用
window.Moment = Moment;
//将Frontend渲染至全局,以便于在子框架中调用
window.Frontend = Frontend;
Frontend.init();
return Frontend;
});

Some files were not shown because too many files have changed in this diff Show More