add:标签,球馆
This commit is contained in:
6
public/assets/addons/address/js/gcoord.min.js
vendored
Normal file
6
public/assets/addons/address/js/gcoord.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
215
public/assets/addons/address/js/jquery.autocomplete.js
Normal file
215
public/assets/addons/address/js/jquery.autocomplete.js
Normal file
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
jQuery autoComplete v1.0.7
|
||||
Copyright (c) 2014 Simon Steinberger / Pixabay
|
||||
GitHub: https://github.com/Pixabay/jQuery-autoComplete
|
||||
License: http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
$.fn.autoComplete = function (options) {
|
||||
var o = $.extend({}, $.fn.autoComplete.defaults, options);
|
||||
|
||||
// public methods
|
||||
if (typeof options == 'string') {
|
||||
this.each(function () {
|
||||
var that = $(this);
|
||||
if (options == 'destroy') {
|
||||
$(window).off('resize.autocomplete', that.updateSC);
|
||||
that.off('blur.autocomplete focus.autocomplete keydown.autocomplete keyup.autocomplete');
|
||||
if (that.data('autocomplete'))
|
||||
that.attr('autocomplete', that.data('autocomplete'));
|
||||
else
|
||||
that.removeAttr('autocomplete');
|
||||
$(that.data('sc')).remove();
|
||||
that.removeData('sc').removeData('autocomplete');
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
return this.each(function () {
|
||||
var that = $(this);
|
||||
// sc = 'suggestions container'
|
||||
that.sc = $('<div class="autocomplete-suggestions ' + o.menuClass + '"></div>');
|
||||
that.data('sc', that.sc).data('autocomplete', that.attr('autocomplete'));
|
||||
that.attr('autocomplete', 'off');
|
||||
that.cache = {};
|
||||
that.last_val = '';
|
||||
|
||||
that.updateSC = function (resize, next) {
|
||||
that.sc.css({
|
||||
top: that.offset().top + that.outerHeight() - (that.sc.css("position") == "fixed" ? $(window).scrollTop() : 0),
|
||||
left: that.offset().left,
|
||||
width: that.outerWidth()
|
||||
});
|
||||
if (!resize) {
|
||||
that.sc.show();
|
||||
if (!that.sc.maxHeight) that.sc.maxHeight = parseInt(that.sc.css('max-height'));
|
||||
if (!that.sc.suggestionHeight) that.sc.suggestionHeight = $('.autocomplete-suggestion', that.sc).first().outerHeight();
|
||||
if (that.sc.suggestionHeight)
|
||||
if (!next) that.sc.scrollTop(0);
|
||||
else {
|
||||
var scrTop = that.sc.scrollTop(), selTop = next.offset().top - that.sc.offset().top;
|
||||
if (selTop + that.sc.suggestionHeight - that.sc.maxHeight > 0)
|
||||
that.sc.scrollTop(selTop + that.sc.suggestionHeight + scrTop - that.sc.maxHeight);
|
||||
else if (selTop < 0)
|
||||
that.sc.scrollTop(selTop + scrTop);
|
||||
}
|
||||
}
|
||||
}
|
||||
$(window).on('resize.autocomplete', that.updateSC);
|
||||
|
||||
that.sc.appendTo('body');
|
||||
|
||||
that.on('click', function () {
|
||||
if ($(this).val().length > 0 && that.sc.is(":hidden")) {
|
||||
setTimeout(function () {
|
||||
that.sc.show();
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
that.sc.on('mouseleave', '.autocomplete-suggestion', function () {
|
||||
$('.autocomplete-suggestion.selected').removeClass('selected');
|
||||
});
|
||||
|
||||
that.sc.on('mouseenter', '.autocomplete-suggestion', function () {
|
||||
$('.autocomplete-suggestion.selected').removeClass('selected');
|
||||
$(this).addClass('selected');
|
||||
});
|
||||
|
||||
that.sc.on('mousedown click', '.autocomplete-suggestion', function (e) {
|
||||
var item = $(this), v = item.data('val');
|
||||
if (v || item.hasClass('autocomplete-suggestion')) { // else outside click
|
||||
that.val(v);
|
||||
o.onSelect(e, v, item);
|
||||
that.sc.hide();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
that.on('blur.autocomplete', function () {
|
||||
try {
|
||||
over_sb = $('.autocomplete-suggestions:hover').length;
|
||||
} catch (e) {
|
||||
over_sb = 0;
|
||||
} // IE7 fix :hover
|
||||
if (!over_sb) {
|
||||
that.last_val = that.val();
|
||||
that.sc.hide();
|
||||
setTimeout(function () {
|
||||
that.sc.hide();
|
||||
}, 350); // hide suggestions on fast input
|
||||
} else if (!that.is(':focus')) setTimeout(function () {
|
||||
that.focus();
|
||||
}, 20);
|
||||
});
|
||||
|
||||
if (!o.minChars) that.on('focus.autocomplete', function () {
|
||||
that.last_val = '\n';
|
||||
that.trigger('keyup.autocomplete');
|
||||
});
|
||||
|
||||
function suggest(data) {
|
||||
var val = that.val();
|
||||
that.cache[val] = data;
|
||||
if (data.length && val.length >= o.minChars) {
|
||||
var s = '';
|
||||
if (data.length > 0) {
|
||||
s += typeof o.header === 'function' ? o.header.call(data, o, that) : o.header;
|
||||
for (var i = 0; i < data.length; i++) s += o.renderItem(data[i], val);
|
||||
s += typeof o.footer === 'function' ? o.footer.call(data, o, that) : o.footer;
|
||||
}
|
||||
that.sc.html(s);
|
||||
that.updateSC(0);
|
||||
} else
|
||||
that.sc.hide();
|
||||
}
|
||||
|
||||
that.on('keydown.autocomplete', function (e) {
|
||||
// down (40), up (38)
|
||||
if ((e.which == 40 || e.which == 38) && that.sc.html()) {
|
||||
var next, sel = $('.autocomplete-suggestion.selected', that.sc);
|
||||
if (!sel.length) {
|
||||
next = (e.which == 40) ? $('.autocomplete-suggestion', that.sc).first() : $('.autocomplete-suggestion', that.sc).last();
|
||||
that.val(next.addClass('selected').data('val'));
|
||||
} else {
|
||||
next = (e.which == 40) ? sel.next('.autocomplete-suggestion') : sel.prev('.autocomplete-suggestion');
|
||||
if (next.length) {
|
||||
sel.removeClass('selected');
|
||||
that.val(next.addClass('selected').data('val'));
|
||||
} else {
|
||||
sel.removeClass('selected');
|
||||
that.val(that.last_val);
|
||||
next = 0;
|
||||
}
|
||||
}
|
||||
that.updateSC(0, next);
|
||||
return false;
|
||||
}
|
||||
// esc
|
||||
else if (e.which == 27) that.val(that.last_val).sc.hide();
|
||||
// enter or tab
|
||||
else if (e.which == 13 || e.which == 9) {
|
||||
var sel = $('.autocomplete-suggestion.selected', that.sc);
|
||||
if (sel.length && that.sc.is(':visible')) {
|
||||
o.onSelect(e, sel.data('val'), sel);
|
||||
setTimeout(function () {
|
||||
that.sc.hide();
|
||||
}, 20);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
that.on('keyup.autocomplete', function (e) {
|
||||
if (!~$.inArray(e.which, [13, 27, 35, 36, 37, 38, 39, 40])) {
|
||||
var val = that.val();
|
||||
if (val.length >= o.minChars) {
|
||||
if (val != that.last_val) {
|
||||
that.last_val = val;
|
||||
clearTimeout(that.timer);
|
||||
if (o.cache) {
|
||||
if (val in that.cache) {
|
||||
suggest(that.cache[val]);
|
||||
return;
|
||||
}
|
||||
// no requests if previous suggestions were empty
|
||||
for (var i = 1; i < val.length - o.minChars; i++) {
|
||||
var part = val.slice(0, val.length - i);
|
||||
if (part in that.cache && !that.cache[part].length) {
|
||||
suggest([]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
that.timer = setTimeout(function () {
|
||||
o.source(val, suggest)
|
||||
}, o.delay);
|
||||
}
|
||||
} else {
|
||||
that.last_val = val;
|
||||
that.sc.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.autoComplete.defaults = {
|
||||
source: 0,
|
||||
minChars: 3,
|
||||
delay: 150,
|
||||
cache: 1,
|
||||
menuClass: '',
|
||||
header: '',
|
||||
footer: '',
|
||||
renderItem: function (item, search) {
|
||||
// escape special characters
|
||||
search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
|
||||
return '<div class="autocomplete-suggestion" data-val="' + item + '">' + item.replace(re, "<b>$1</b>") + '</div>';
|
||||
},
|
||||
onSelect: function (e, term, item) {
|
||||
}
|
||||
};
|
||||
}(jQuery));
|
||||
@@ -1,5 +1,40 @@
|
||||
define([], function () {
|
||||
if (typeof Config.upload.storage !== 'undefined' && Config.upload.storage === 'hwobs') {
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
if (typeof Config.upload.storage !== 'undefined' && Config.upload.storage === 'hwobs') {
|
||||
require(['upload'], function (Upload) {
|
||||
//获取文件MD5值
|
||||
var getFileMd5 = function (file, cb) {
|
||||
|
||||
61
public/assets/js/backend/zy/stadium.js
Normal file
61
public/assets/js/backend/zy/stadium.js
Normal 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: 'zy/stadium/index' + location.search,
|
||||
add_url: 'zy/stadium/add',
|
||||
edit_url: 'zy/stadium/edit',
|
||||
del_url: 'zy/stadium/del',
|
||||
multi_url: 'zy/stadium/multi',
|
||||
import_url: 'zy/stadium/import',
|
||||
table: 'zy_stadium',
|
||||
}
|
||||
});
|
||||
|
||||
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: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
||||
{ field: 'sub_name', title: __('Sub_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
||||
{ field: 'position', title: __('Position') },
|
||||
{ field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
||||
{ field: 'city', title: __('City'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
||||
{ field: 'contact', title: __('Contact'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
||||
{ field: 'status', title: __('Status'), formatter: Table.api.formatter.label, searchList: { 0: __('Status0'), 1: __('Status1') } },
|
||||
{ field: 'create_time', title: __('Create_time'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false },
|
||||
{ field: 'update_time', title: __('Update_time'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: 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;
|
||||
});
|
||||
56
public/assets/js/backend/zy/tags.js
Normal file
56
public/assets/js/backend/zy/tags.js
Normal 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: 'zy/tags/index' + location.search,
|
||||
add_url: 'zy/tags/add',
|
||||
edit_url: 'zy/tags/edit',
|
||||
del_url: 'zy/tags/del',
|
||||
multi_url: 'zy/tags/multi',
|
||||
import_url: 'zy/tags/import',
|
||||
table: 'zy_tags',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{ checkbox: true },
|
||||
{ field: 'id', title: __('Id') },
|
||||
{ field: 'type', title: __('Type'), formatter: Table.api.formatter.label, searchList: { 0: __('Gym'), 1: __('Club'), 2: __('User') } },
|
||||
{ field: 'group', title: __('Group'), formatter: Table.api.formatter.label, searchList: { 0: __('General'), 1: __('Ability'), 2: __('Role') } },
|
||||
{ field: 'choose', title: __('Choose'), formatter: Table.api.formatter.label, searchList: { 0: __('Multiple'), 1: __('Single') } },
|
||||
{ field: 'content_json', title: __('Content_json') },
|
||||
{ field: 'create_time', title: __('Create_time'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false },
|
||||
{ field: 'update_time', title: __('Update_time'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: 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;
|
||||
});
|
||||
Reference in New Issue
Block a user