add:标签,球馆
This commit is contained in:
1
addons/address/.addonrc
Normal file
1
addons/address/.addonrc
Normal file
@@ -0,0 +1 @@
|
||||
{"files":["public\\assets\\addons\\address\\js\\gcoord.min.js","public\\assets\\addons\\address\\js\\jquery.autocomplete.js"],"license":"regular","licenseto":"34485","licensekey":"Fr1gIoX2PBbGmMnp GFErXGAvLGllzXV\/ASjNRQ==","domains":["localhost"],"licensecodes":[],"validations":["757319b447175b6ca1882635b132a594"]}
|
||||
32
addons/address/Address.php
Normal file
32
addons/address/Address.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace addons\address;
|
||||
|
||||
use think\Addons;
|
||||
|
||||
/**
|
||||
* 地址选择
|
||||
* @author [MiniLing] <[laozheyouxiang@163.com]>
|
||||
*/
|
||||
class Address extends Addons
|
||||
{
|
||||
|
||||
/**
|
||||
* 插件安装方法
|
||||
* @return bool
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件卸载方法
|
||||
* @return bool
|
||||
*/
|
||||
public function uninstall()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
34
addons/address/bootstrap.js
vendored
Normal file
34
addons/address/bootstrap.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
132
addons/address/config.php
Normal file
132
addons/address/config.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'name' => 'maptype',
|
||||
'title' => '默认地图类型',
|
||||
'type' => 'radio',
|
||||
'content' => [
|
||||
'baidu' => '百度地图',
|
||||
'amap' => '高德地图',
|
||||
'tencent' => '腾讯地图',
|
||||
],
|
||||
'value' => 'amap',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'zoom',
|
||||
'title' => '默认缩放级别',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '11',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'lat',
|
||||
'title' => '默认Lat',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '23.002569',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'lng',
|
||||
'title' => '默认Lng',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '113.752215',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'baidukey',
|
||||
'title' => '百度地图KEY',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'amapkey',
|
||||
'title' => '高德地图KEY',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '78c9a922ba2d29f005eaa89e3f1b00bb',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'amapsecurityjscode',
|
||||
'title' => '高德地图安全密钥',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'tencentkey',
|
||||
'title' => '腾讯地图KEY',
|
||||
'type' => 'string',
|
||||
'content' => [],
|
||||
'value' => '',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'coordtype',
|
||||
'title' => '坐标系类型',
|
||||
'type' => 'select',
|
||||
'content' => [
|
||||
'DEFAULT' => '默认(使用所选地图默认坐标系)',
|
||||
'GCJ02' => 'GCJ-02',
|
||||
'BD09' => 'BD-09',
|
||||
],
|
||||
'value' => 'DEFAULT',
|
||||
'rule' => 'required',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => '',
|
||||
],
|
||||
[
|
||||
'name' => '__tips__',
|
||||
'title' => '温馨提示',
|
||||
'type' => '',
|
||||
'content' => [],
|
||||
'value' => '请先申请对应地图的Key,配置后再使用',
|
||||
'rule' => '',
|
||||
'msg' => '',
|
||||
'tip' => '',
|
||||
'ok' => '',
|
||||
'extend' => 'alert-danger-light',
|
||||
],
|
||||
];
|
||||
64
addons/address/controller/Index.php
Normal file
64
addons/address/controller/Index.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace addons\address\controller;
|
||||
|
||||
use think\addons\Controller;
|
||||
use think\Config;
|
||||
use think\Hook;
|
||||
|
||||
class Index extends Controller
|
||||
{
|
||||
|
||||
// 首页
|
||||
public function index()
|
||||
{
|
||||
// 语言检测
|
||||
$lang = $this->request->langset();
|
||||
$lang = preg_match("/^([a-zA-Z\-_]{2,10})\$/i", $lang) ? $lang : 'zh-cn';
|
||||
|
||||
$site = Config::get("site");
|
||||
|
||||
// 配置信息
|
||||
$config = [
|
||||
'site' => array_intersect_key($site, array_flip(['name', 'cdnurl', 'version', 'timezone', 'languages'])),
|
||||
'upload' => null,
|
||||
'modulename' => 'addons',
|
||||
'controllername' => 'index',
|
||||
'actionname' => 'index',
|
||||
'jsname' => 'addons/address',
|
||||
'moduleurl' => '',
|
||||
'language' => $lang
|
||||
];
|
||||
$config = array_merge($config, Config::get("view_replace_str"));
|
||||
|
||||
// 配置信息后
|
||||
Hook::listen("config_init", $config);
|
||||
// 加载当前控制器语言包
|
||||
$this->view->assign('site', $site);
|
||||
$this->view->assign('config', $config);
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
// 选择地址
|
||||
public function select()
|
||||
{
|
||||
$config = get_addon_config('address');
|
||||
$zoom = (int)$this->request->get('zoom', $config['zoom']);
|
||||
$lng = (float)$this->request->get('lng');
|
||||
$lat = (float)$this->request->get('lat');
|
||||
$address = $this->request->get('address');
|
||||
$lng = $lng ?: $config['lng'];
|
||||
$lat = $lat ?: $config['lat'];
|
||||
$this->view->assign('zoom', $zoom);
|
||||
$this->view->assign('lng', $lng);
|
||||
$this->view->assign('lat', $lat);
|
||||
$this->view->assign('address', $address);
|
||||
$maptype = $config['maptype'];
|
||||
if (!isset($config[$maptype . 'key']) || !$config[$maptype . 'key']) {
|
||||
$this->error("请在配置中配置对应类型地图的密钥");
|
||||
}
|
||||
return $this->view->fetch('index/' . $maptype);
|
||||
}
|
||||
|
||||
}
|
||||
10
addons/address/info.ini
Normal file
10
addons/address/info.ini
Normal file
@@ -0,0 +1,10 @@
|
||||
name = address
|
||||
title = 地址位置选择插件
|
||||
intro = 地图位置选择插件,可返回地址和经纬度
|
||||
author = FastAdmin
|
||||
website = https://www.fastadmin.net
|
||||
version = 1.1.8
|
||||
state = 1
|
||||
url = /addons/address
|
||||
license = regular
|
||||
licenseto = 34485
|
||||
258
addons/address/view/index/amap.html
Normal file
258
addons/address/view/index/amap.html
Normal file
@@ -0,0 +1,258 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>地址选择器</title>
|
||||
<link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
|
||||
<link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#container {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.confirm {
|
||||
position: absolute;
|
||||
bottom: 30px;
|
||||
right: 4%;
|
||||
z-index: 99;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
line-height: 50px;
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
background: #1ABC9C;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.search {
|
||||
position: absolute;
|
||||
width: 400px;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
padding: 5px;
|
||||
margin-left: -200px;
|
||||
}
|
||||
|
||||
.amap-marker-label {
|
||||
border: 0;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.info {
|
||||
padding: .75rem 1.25rem;
|
||||
margin-bottom: 1rem;
|
||||
border-radius: .25rem;
|
||||
position: fixed;
|
||||
top: 2rem;
|
||||
background-color: white;
|
||||
width: auto;
|
||||
min-width: 22rem;
|
||||
border-width: 0;
|
||||
left: 1.8rem;
|
||||
box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="search">
|
||||
<div class="input-group">
|
||||
<input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/>
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" name="search" id="search-btn" class="btn btn-success">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="confirm">确定</div>
|
||||
<div id="container"></div>
|
||||
<script type="text/javascript">
|
||||
window._AMapSecurityConfig = {
|
||||
securityJsCode: "{$config.amapsecurityjscode|default=''}",
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript" src="//webapi.amap.com/maps?v=1.4.11&key={$config.amapkey|default=''}&plugin=AMap.ToolBar,AMap.Autocomplete,AMap.PlaceSearch,AMap.Geocoder"></script>
|
||||
<!-- UI组件库 1.0 -->
|
||||
<script src="//webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
|
||||
<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
|
||||
<script src="__CDN__/assets/addons/address/js/gcoord.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var as, map, geocoder, address, fromtype, totype;
|
||||
address = "{$address|htmlentities}";
|
||||
var lng = Number("{$lng}");
|
||||
var lat = Number("{$lat}");
|
||||
fromtype = "GCJ02";
|
||||
totype = "{$config.coordtype|default='DEFAULT'}"
|
||||
totype = totype === 'DEFAULT' ? "GCJ02" : totype;
|
||||
|
||||
if (lng && lat && fromtype !== totype) {
|
||||
var result = gcoord.transform([lng, lat], gcoord[totype], gcoord[fromtype]);
|
||||
lng = result[0] || lng;
|
||||
lat = result[1] || lat;
|
||||
}
|
||||
|
||||
var init = function () {
|
||||
AMapUI.loadUI(['misc/PositionPicker', 'misc/PoiPicker'], function (PositionPicker, PoiPicker) {
|
||||
//加载PositionPicker,loadUI的路径参数为模块名中 'ui/' 之后的部分
|
||||
map = new AMap.Map('container', {
|
||||
zoom: parseInt('{$zoom}'),
|
||||
center: [lng, lat]
|
||||
});
|
||||
geocoder = new AMap.Geocoder({
|
||||
radius: 1000 //范围,默认:500
|
||||
});
|
||||
var positionPicker = new PositionPicker({
|
||||
mode: 'dragMarker',//设定为拖拽地图模式,可选'dragMap'、'dragMarker',默认为'dragMap'
|
||||
map: map//依赖地图对象
|
||||
});
|
||||
//输入提示
|
||||
var autoOptions = {
|
||||
input: "place"
|
||||
};
|
||||
|
||||
var relocation = function (lnglat, addr) {
|
||||
lng = lnglat.lng;
|
||||
lat = lnglat.lat;
|
||||
map.panTo([lng, lat]);
|
||||
positionPicker.start(lnglat);
|
||||
if (addr) {
|
||||
// var label = '<div class="info">地址:' + addr + '<br>经度:' + lng + '<br>纬度:' + lat + '</div>';
|
||||
var label = '<div class="info">地址:' + addr + '</div>';
|
||||
positionPicker.marker.setLabel({
|
||||
content: label //显示内容
|
||||
});
|
||||
} else {
|
||||
geocoder.getAddress(lng + ',' + lat, function (status, result) {
|
||||
if (status === 'complete' && result.regeocode) {
|
||||
var address = result.regeocode.formattedAddress;
|
||||
// var label = '<div class="info">地址:' + address + '<br>经度:' + lng + '<br>纬度:' + lat + '</div>';
|
||||
var label = '<div class="info">地址:' + address + '</div>';
|
||||
positionPicker.marker.setLabel({
|
||||
content: label //显示内容
|
||||
});
|
||||
} else {
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var auto = new AMap.Autocomplete(autoOptions);
|
||||
|
||||
//构造地点查询类
|
||||
var placeSearch = new AMap.PlaceSearch({
|
||||
map: map
|
||||
});
|
||||
//注册监听,当选中某条记录时会触发
|
||||
AMap.event.addListener(auto, "select", function (e) {
|
||||
placeSearch.setCity(e.poi.adcode);
|
||||
placeSearch.search(e.poi.name, function (status, result) {
|
||||
$(map.getAllOverlays("marker")).each(function (i, j) {
|
||||
j.on("click", function () {
|
||||
relocation(j.De.position);
|
||||
});
|
||||
});
|
||||
}); //关键字查询查询
|
||||
});
|
||||
AMap.event.addListener(map, 'click', function (e) {
|
||||
relocation(e.lnglat);
|
||||
});
|
||||
|
||||
//加载工具条
|
||||
var tool = new AMap.ToolBar();
|
||||
map.addControl(tool);
|
||||
|
||||
var poiPicker = new PoiPicker({
|
||||
input: 'place',
|
||||
placeSearchOptions: {
|
||||
map: map,
|
||||
pageSize: 6 //关联搜索分页
|
||||
}
|
||||
});
|
||||
poiPicker.on('poiPicked', function (poiResult) {
|
||||
poiPicker.hideSearchResults();
|
||||
$('.poi .nearpoi').text(poiResult.item.name);
|
||||
$('.address .info').text(poiResult.item.address);
|
||||
$('#address').val(poiResult.item.address);
|
||||
$("#place").val(poiResult.item.name);
|
||||
|
||||
relocation(poiResult.item.location);
|
||||
});
|
||||
|
||||
positionPicker.on('success', function (positionResult) {
|
||||
console.log(positionResult);
|
||||
as = positionResult.position;
|
||||
address = positionResult.address;
|
||||
lat = as.lat;
|
||||
lng = as.lng;
|
||||
});
|
||||
positionPicker.on('fail', function (positionResult) {
|
||||
address = '';
|
||||
});
|
||||
positionPicker.start();
|
||||
|
||||
if (address) {
|
||||
// 添加label
|
||||
var label = '<div class="info">地址:' + address + '</div>';
|
||||
positionPicker.marker.setLabel({
|
||||
content: label //显示内容
|
||||
});
|
||||
}
|
||||
|
||||
//点击搜索按钮
|
||||
$(document).on('click', '#search-btn', function () {
|
||||
if ($("#place").val() == '')
|
||||
return;
|
||||
placeSearch.search($("#place").val(), function (status, result) {
|
||||
$(map.getAllOverlays("marker")).each(function (i, j) {
|
||||
j.on("click", function () {
|
||||
relocation(j.De.position);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
//点击确定后执行回调赋值
|
||||
var 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);
|
||||
}
|
||||
};
|
||||
|
||||
//点击搜索按钮
|
||||
$(document).on('click', '.confirm', function () {
|
||||
var zoom = map.getZoom();
|
||||
var data = {lat: lat, lng: lng, zoom: zoom, address: address};
|
||||
if (fromtype !== totype) {
|
||||
var result = gcoord.transform([data.lng, data.lat], gcoord[fromtype], gcoord[totype]);
|
||||
data.lng = (result[0] || data.lng).toFixed(5);
|
||||
data.lat = (result[1] || data.lat).toFixed(5);
|
||||
console.log(data, result, fromtype, totype);
|
||||
}
|
||||
close(data);
|
||||
});
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
243
addons/address/view/index/baidu.html
Normal file
243
addons/address/view/index/baidu.html
Normal file
@@ -0,0 +1,243 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>地址选择器</title>
|
||||
<link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
|
||||
<link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#container {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.confirm {
|
||||
position: absolute;
|
||||
bottom: 30px;
|
||||
right: 4%;
|
||||
z-index: 99;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
line-height: 50px;
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
background: #1ABC9C;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.search {
|
||||
position: absolute;
|
||||
width: 400px;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
padding: 5px;
|
||||
margin-left: -200px;
|
||||
}
|
||||
|
||||
label.BMapLabel {
|
||||
max-width: inherit;
|
||||
padding: .75rem 1.25rem;
|
||||
margin-bottom: 1rem;
|
||||
background-color: white;
|
||||
width: auto;
|
||||
min-width: 22rem;
|
||||
border: none;
|
||||
box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="search">
|
||||
<div class="input-group">
|
||||
<input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/>
|
||||
<div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div>
|
||||
<span class="input-group-btn">
|
||||
<button type="button" name="search" id="search-btn" class="btn btn-success">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="confirm">确定</div>
|
||||
<div id="container"></div>
|
||||
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak={$config.baidukey|default=''}"></script>
|
||||
<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
|
||||
<script src="__CDN__/assets/addons/address/js/gcoord.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var map, marker, point, fromtype, totype;
|
||||
var zoom = parseInt("{$zoom}");
|
||||
var address = "{$address|htmlentities}";
|
||||
var lng = Number("{$lng}");
|
||||
var lat = Number("{$lat}");
|
||||
fromtype = "BD09";
|
||||
totype = "{$config.coordtype|default='DEFAULT'}"
|
||||
totype = totype === 'DEFAULT' ? "BD09" : totype;
|
||||
|
||||
if (lng && lat && fromtype !== totype) {
|
||||
var result = gcoord.transform([lng, lat], gcoord[totype], gcoord[fromtype]);
|
||||
lng = result[0] || lng;
|
||||
lat = result[1] || lat;
|
||||
}
|
||||
|
||||
var geocoder = new BMap.Geocoder();
|
||||
|
||||
var addPointMarker = function (point, addr) {
|
||||
deletePoint();
|
||||
addPoint(point);
|
||||
|
||||
if (addr) {
|
||||
addMarker(point, addr);
|
||||
} else {
|
||||
geocoder.getLocation(point, function (rs) {
|
||||
addMarker(point, rs.address);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var addPoint = function (point) {
|
||||
lng = point.lng;
|
||||
lat = point.lat;
|
||||
marker = new BMap.Marker(point);
|
||||
map.addOverlay(marker);
|
||||
map.panTo(point);
|
||||
};
|
||||
|
||||
var addMarker = function (point, addr) {
|
||||
address = addr;
|
||||
// var labelhtml = '<div class="info">地址:' + address + '<br>经度:' + point.lng + '<br>纬度:' + point.lat + '</div>';
|
||||
var labelhtml = '<div class="info">地址:' + address + '</div>';
|
||||
var label = new BMap.Label(labelhtml, {offset: new BMap.Size(16, 20)});
|
||||
label.setStyle({
|
||||
border: 'none',
|
||||
padding: '.75rem 1.25rem'
|
||||
});
|
||||
marker.setLabel(label);
|
||||
};
|
||||
|
||||
var deletePoint = function () {
|
||||
var allOverlay = map.getOverlays();
|
||||
for (var i = 0; i < allOverlay.length; i++) {
|
||||
map.removeOverlay(allOverlay[i]);
|
||||
}
|
||||
};
|
||||
|
||||
var init = function () {
|
||||
map = new BMap.Map("container"); // 创建地图实例
|
||||
var point = new BMap.Point(lng, lat); // 创建点坐标
|
||||
map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
|
||||
map.centerAndZoom(point, zoom); // 初始化地图,设置中心点坐标和地图级别
|
||||
|
||||
var size = new BMap.Size(10, 20);
|
||||
map.addControl(new BMap.CityListControl({
|
||||
anchor: BMAP_ANCHOR_TOP_LEFT,
|
||||
offset: size,
|
||||
}));
|
||||
|
||||
if ("{$lng}" != '' && "{$lat}" != '') {
|
||||
addPointMarker(point, address);
|
||||
}
|
||||
|
||||
ac = new BMap.Autocomplete({"input": "place", "location": map}); //建立一个自动完成的对象
|
||||
ac.addEventListener("onhighlight", function (e) { //鼠标放在下拉列表上的事件
|
||||
var str = "";
|
||||
var _value = e.fromitem.value;
|
||||
var value = "";
|
||||
if (e.fromitem.index > -1) {
|
||||
value = _value.province + _value.city + _value.district + _value.street + _value.business;
|
||||
}
|
||||
str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
|
||||
|
||||
value = "";
|
||||
if (e.toitem.index > -1) {
|
||||
_value = e.toitem.value;
|
||||
value = _value.province + _value.city + _value.district + _value.street + _value.business;
|
||||
}
|
||||
str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
|
||||
$("#searchResultPanel").html(str);
|
||||
});
|
||||
ac.addEventListener("onconfirm", function (e) { //鼠标点击下拉列表后的事件
|
||||
var _value = e.item.value;
|
||||
myValue = _value.province + _value.city + _value.district + _value.street + _value.business;
|
||||
$("#searchResultPanel").html("onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue);
|
||||
setPlace();
|
||||
});
|
||||
|
||||
function setPlace(text) {
|
||||
map.clearOverlays(); //清除地图上所有覆盖物
|
||||
function myFun() {
|
||||
var results = local.getResults();
|
||||
var result = local.getResults().getPoi(0);
|
||||
var point = result.point; //获取第一个智能搜索的结果
|
||||
map.centerAndZoom(point, 18);
|
||||
// map.addOverlay(new BMap.Marker(point)); //添加标注
|
||||
if (result.type != 0) {
|
||||
address = results.province + results.city + result.address;
|
||||
} else {
|
||||
address = result.address;
|
||||
}
|
||||
addPointMarker(point, address);
|
||||
}
|
||||
|
||||
var local = new BMap.LocalSearch(map, { //智能搜索
|
||||
onSearchComplete: myFun
|
||||
});
|
||||
local.search(text || myValue);
|
||||
}
|
||||
|
||||
map.addEventListener("click", function (e) {
|
||||
//通过点击百度地图,可以获取到对应的point, 由point的lng、lat属性就可以获取对应的经度纬度
|
||||
addPointMarker(e.point);
|
||||
});
|
||||
|
||||
//点击搜索按钮
|
||||
$(document).on('click', '#search-btn', function () {
|
||||
if ($("#place").val() == '')
|
||||
return;
|
||||
setPlace($("#place").val());
|
||||
});
|
||||
};
|
||||
|
||||
var 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);
|
||||
}
|
||||
};
|
||||
|
||||
//点击确定后执行回调赋值
|
||||
$(document).on('click', '.confirm', function () {
|
||||
var zoom = map.getZoom();
|
||||
var data = {lat: lat, lng: lng, zoom: zoom, address: address};
|
||||
if (fromtype !== totype) {
|
||||
var result = gcoord.transform([data.lng, data.lat], gcoord[fromtype], gcoord[totype]);
|
||||
data.lng = (result[0] || data.lng).toFixed(5);
|
||||
data.lat = (result[1] || data.lat).toFixed(5);
|
||||
console.log(data, result, fromtype, totype);
|
||||
}
|
||||
close(data);
|
||||
});
|
||||
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
132
addons/address/view/index/index.html
Normal file
132
addons/address/view/index/index.html
Normal file
@@ -0,0 +1,132 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
||||
<title>地图位置(经纬度)选择插件</title>
|
||||
<link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
|
||||
<link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
<div class="bs-docs-section clearfix">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="page-header">
|
||||
<h2>地图位置(经纬度)选择示例</h2>
|
||||
</div>
|
||||
|
||||
<div class="bs-component">
|
||||
<form action="" method="post" role="form">
|
||||
<div class="form-group">
|
||||
<label for=""></label>
|
||||
<input type="text" class="form-control" name="" id="address" placeholder="地址">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for=""></label>
|
||||
<input type="text" class="form-control" name="" id="lng" placeholder="经度">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for=""></label>
|
||||
<input type="text" class="form-control" name="" id="lat" placeholder="纬度">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for=""></label>
|
||||
<input type="text" class="form-control" name="" id="zoom" placeholder="缩放">
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-primary" data-toggle='addresspicker' data-input-id="address" data-lng-id="lng" data-lat-id="lat" data-zoom-id="zoom">点击选择</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="page-header">
|
||||
<h2 id="code">调用代码</h2>
|
||||
</div>
|
||||
<div class="bs-component">
|
||||
<textarea class="form-control" rows="17">
|
||||
<form action="" method="post" role="form">
|
||||
<div class="form-group">
|
||||
<label for=""></label>
|
||||
<input type="text" class="form-control" name="" id="address" placeholder="地址">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for=""></label>
|
||||
<input type="text" class="form-control" name="" id="lng" placeholder="经度">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for=""></label>
|
||||
<input type="text" class="form-control" name="" id="lat" placeholder="纬度">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for=""></label>
|
||||
<input type="text" class="form-control" name="" id="zoom" placeholder="缩放">
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-primary" data-toggle='addresspicker' data-input-id="address" data-lng-id="lng" data-lat-id="lat" data-zoom-id="zoom">点击选择</button>
|
||||
</form>
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="page-header">
|
||||
<h2>参数说明</h2>
|
||||
</div>
|
||||
|
||||
<div class="bs-component" style="background:#fff;">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
<th>释义</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>data-input-id</td>
|
||||
<td>填充地址的文本框ID</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>data-lng-id</td>
|
||||
<td>填充经度的文本框ID</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>data-lat-id</td>
|
||||
<td>填充纬度的文本框ID</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>data-zoom-id</td>
|
||||
<td>填充缩放的文本框ID</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--@formatter:off-->
|
||||
<script type="text/javascript">
|
||||
var require = {
|
||||
config: {$config|json_encode}
|
||||
};
|
||||
</script>
|
||||
<!--@formatter:on-->
|
||||
|
||||
<script>
|
||||
require.callback = function () {
|
||||
define('addons/address', ['jquery', 'bootstrap', 'frontend', 'template'], function ($, undefined, Frontend, Template) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
define('lang', function () {
|
||||
return [];
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="__CDN__/assets/js/require.min.js" data-main="__CDN__/assets/js/require-frontend.min.js?v={$site.version}"></script>
|
||||
</body>
|
||||
</html>
|
||||
291
addons/address/view/index/tencent.html
Normal file
291
addons/address/view/index/tencent.html
Normal file
@@ -0,0 +1,291 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>地址选择器</title>
|
||||
<link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
|
||||
<link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#container {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.confirm {
|
||||
position: absolute;
|
||||
bottom: 30px;
|
||||
right: 4%;
|
||||
z-index: 99;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
line-height: 50px;
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
background: #1ABC9C;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.search {
|
||||
position: absolute;
|
||||
width: 400px;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
padding: 5px;
|
||||
margin-left: -200px;
|
||||
}
|
||||
|
||||
.autocomplete-search {
|
||||
text-align: left;
|
||||
cursor: default;
|
||||
background: #fff;
|
||||
border-radius: 2px;
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
|
||||
-moz-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
|
||||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
|
||||
background-clip: padding-box;
|
||||
position: absolute;
|
||||
display: none;
|
||||
z-index: 1036;
|
||||
max-height: 254px;
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.autocomplete-search .autocomplete-suggestion {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.autocomplete-search .autocomplete-suggestion:hover {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="search">
|
||||
<div class="input-group">
|
||||
<input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/>
|
||||
<span class="input-group-btn">
|
||||
<button type="button" name="search" id="search-btn" class="btn btn-success">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="confirm">确定</div>
|
||||
<div id="container"></div>
|
||||
|
||||
<script charset="utf-8" src="//map.qq.com/api/js?v=2.exp&libraries=place&key={$config.tencentkey|default=''}"></script>
|
||||
<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
|
||||
<script src="__CDN__/assets/addons/address/js/gcoord.min.js"></script>
|
||||
<script src="__CDN__/assets/addons/address/js/jquery.autocomplete.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var map, marker, geocoder, infoWin, searchService, keyword, address, fromtype, totype;
|
||||
address = "{$address|htmlentities}";
|
||||
var lng = Number("{$lng}");
|
||||
var lat = Number("{$lat}");
|
||||
fromtype = "GCJ02";
|
||||
totype = "{$config.coordtype|default='DEFAULT'}"
|
||||
totype = totype === 'DEFAULT' ? "GCJ02" : totype;
|
||||
|
||||
if (lng && lat && fromtype !== totype) {
|
||||
var result = gcoord.transform([lng, lat], gcoord[totype], gcoord[fromtype]);
|
||||
lng = result[0] || lng;
|
||||
lat = result[1] || lat;
|
||||
}
|
||||
|
||||
var init = function () {
|
||||
var center = new qq.maps.LatLng(lat, lng);
|
||||
map = new qq.maps.Map(document.getElementById('container'), {
|
||||
center: center,
|
||||
zoom: parseInt("{$config.zoom}")
|
||||
});
|
||||
|
||||
//实例化信息窗口
|
||||
infoWin = new qq.maps.InfoWindow({
|
||||
map: map
|
||||
});
|
||||
|
||||
geocoder = {
|
||||
getAddress: function (latLng) {
|
||||
$.ajax({
|
||||
url: "https://apis.map.qq.com/ws/geocoder/v1/?location=" + latLng.lat + "," + latLng.lng + "&key={$config.tencentkey|default=''}&output=jsonp",
|
||||
dataType: "jsonp",
|
||||
type: 'GET',
|
||||
cache: true,
|
||||
crossDomain: true,
|
||||
success: function (ret) {
|
||||
console.log("getAddress:", ret)
|
||||
if (ret.status === 0) {
|
||||
var component = ret.result.address_component;
|
||||
if (ret.result.formatted_addresses && ret.result.formatted_addresses.recommend) {
|
||||
var recommend = ret.result.formatted_addresses.recommend;
|
||||
var standard_address = ret.result.formatted_addresses.standard_address;
|
||||
var address = component.province !== component.city ? component.province + component.city : component.province;
|
||||
|
||||
address = address + (recommend.indexOf(component.district) === 0 ? '' : component.district) + recommend;
|
||||
} else {
|
||||
address = ret.result.address;
|
||||
}
|
||||
showMarker(ret.result.location, address);
|
||||
showInfoWin(ret.result.location, address);
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e, 'error')
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//初始化marker
|
||||
showMarker(center);
|
||||
if (address) {
|
||||
showInfoWin(center, address);
|
||||
} else {
|
||||
geocoder.getAddress(center);
|
||||
}
|
||||
|
||||
var place = $("#place");
|
||||
place.autoComplete({
|
||||
minChars: 1,
|
||||
cache: 0,
|
||||
menuClass: 'autocomplete-search',
|
||||
source: function (term, response) {
|
||||
try {
|
||||
xhr.abort();
|
||||
} catch (e) {
|
||||
}
|
||||
xhr = $.ajax({
|
||||
url: "https://apis.map.qq.com/ws/place/v1/suggestion?keyword=" + term + "&key={$config.tencentkey|default=''}&output=jsonp",
|
||||
dataType: "jsonp",
|
||||
type: 'GET',
|
||||
cache: true,
|
||||
success: function (ret) {
|
||||
if (ret.status === 0) {
|
||||
if(ret.data.length === 0){
|
||||
$(".autocomplete-suggestions.autocomplete-search").html('');
|
||||
}
|
||||
response(ret.data);
|
||||
} else {
|
||||
console.log(ret);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
renderItem: function (item, search) {
|
||||
search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
var regexp = new RegExp("(" + search.replace(/[\,|\u3000|\uff0c]/, ' ').split(' ').join('|') + ")", "gi");
|
||||
return "<div class='autocomplete-suggestion' data-item='" + JSON.stringify(item) + "' data-title='" + item.title + "' data-val='" + item.title + "'>" + item.title.replace(regexp, "<b>$1</b>") + "</div>";
|
||||
},
|
||||
onSelect: function (e, term, sel) {
|
||||
e.preventDefault();
|
||||
var item = $(sel).data("item");
|
||||
//调用获取位置方法
|
||||
geocoder.getAddress(item.location);
|
||||
|
||||
var position = new qq.maps.LatLng(item.location.lat, item.location.lng);
|
||||
map.setCenter(position);
|
||||
}
|
||||
});
|
||||
|
||||
//地图点击
|
||||
qq.maps.event.addListener(map, 'click', function (event) {
|
||||
try {
|
||||
//调用获取位置方法
|
||||
geocoder.getAddress(event.latLng);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
//显示info窗口
|
||||
var showInfoWin = function (latLng, title) {
|
||||
var position = new qq.maps.LatLng(latLng.lat, latLng.lng);
|
||||
infoWin.open();
|
||||
infoWin.setContent(title);
|
||||
infoWin.setPosition(position);
|
||||
};
|
||||
|
||||
//实例化marker和监听拖拽结束事件
|
||||
var showMarker = function (latLng, title) {
|
||||
console.log("showMarker", latLng, title)
|
||||
var position = new qq.maps.LatLng(latLng.lat, latLng.lng);
|
||||
marker && marker.setMap(null);
|
||||
marker = new qq.maps.Marker({
|
||||
map: map,
|
||||
position: position,
|
||||
draggable: true,
|
||||
title: title || '拖动图标选择位置'
|
||||
});
|
||||
|
||||
//监听拖拽结束
|
||||
qq.maps.event.addListener(marker, 'dragend', function (event) {
|
||||
//调用获取位置方法
|
||||
geocoder.getAddress(event.latLng);
|
||||
});
|
||||
};
|
||||
|
||||
var 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);
|
||||
}
|
||||
};
|
||||
|
||||
//点击确定后执行回调赋值
|
||||
$(document).on('click', '.confirm', function () {
|
||||
var zoom = map.getZoom();
|
||||
var data = {lat: infoWin.position.lat.toFixed(5), lng: infoWin.position.lng.toFixed(5), zoom: zoom, address: infoWin.content};
|
||||
if (fromtype !== totype) {
|
||||
var result = gcoord.transform([data.lng, data.lat], gcoord[fromtype], gcoord[totype]);
|
||||
data.lng = (result[0] || data.lng).toFixed(5);
|
||||
data.lat = (result[1] || data.lat).toFixed(5);
|
||||
console.log(data, result, fromtype, totype);
|
||||
}
|
||||
|
||||
close(data);
|
||||
});
|
||||
|
||||
//点击搜索按钮
|
||||
$(document).on('click', '#search-btn', function () {
|
||||
if ($("#place").val() === '')
|
||||
return;
|
||||
var first = $(".autocomplete-search > .autocomplete-suggestion:first");
|
||||
if (!first.length) {
|
||||
return;
|
||||
}
|
||||
var item = first.data("item");
|
||||
|
||||
//调用获取位置方法
|
||||
geocoder.getAddress(item.location);
|
||||
|
||||
var position = new qq.maps.LatLng(item.location.lat, item.location.lng);
|
||||
map.setCenter(position);
|
||||
});
|
||||
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
80
addons/shopro/controller/zy/Gym.php
Normal file
80
addons/shopro/controller/zy/Gym.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\controller\zy;
|
||||
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use app\admin\model\zy\Stadium;
|
||||
use think\exception\PDOException;
|
||||
use addons\shopro\controller\Common;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
class Gym extends Common
|
||||
{
|
||||
|
||||
// protected $noNeedLogin = ['index'];
|
||||
protected $noNeedLogin = ['*'];
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$model = Stadium::where('status', 1);
|
||||
if (isset($params['name'])) {
|
||||
$model->where('name', 'like', '%' . $params['name'] . '%');
|
||||
}
|
||||
$res = $model->select();
|
||||
|
||||
|
||||
$this->success('获取成功', $res);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$result = false;
|
||||
$params = $this->request->param();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$result = (new Stadium)->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$result = false;
|
||||
$params = $this->request->param();
|
||||
$model = Stadium::get($params['id']);
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$result = $model->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
public function view()
|
||||
{
|
||||
$model = Stadium::get($this->request->param('id'));
|
||||
if (empty($model)) {
|
||||
$this->error(__('No rows were found'));
|
||||
}
|
||||
$this->success($model);
|
||||
}
|
||||
}
|
||||
32
addons/shopro/controller/zy/Tags.php
Normal file
32
addons/shopro/controller/zy/Tags.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\controller\zy;
|
||||
|
||||
use app\admin\model\zy\Tags as TagsModel;
|
||||
use addons\shopro\controller\Common;
|
||||
|
||||
class Tags extends Common
|
||||
{
|
||||
|
||||
// protected $noNeedLogin = ['index'];
|
||||
protected $noNeedLogin = ['*'];
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$model = new TagsModel();
|
||||
if (isset($params['type'])) {
|
||||
$model->where('type', $params['type']);
|
||||
}
|
||||
if (isset($params['group'])) {
|
||||
$model->where('group', $params['group']);
|
||||
}
|
||||
$res = $model->select();
|
||||
foreach ($res as &$value) {
|
||||
$value['content_json'] = array_values(json_decode($value['content_json'] ?? '[]', true));
|
||||
}
|
||||
|
||||
$this->success('获取成功', $res);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ class GoodsService
|
||||
protected $is_activity = false; // 是否处理活动
|
||||
protected $show_score_shop = false; // 查询积分商城商品
|
||||
|
||||
public function __construct(\Closure $format = null, \think\db\Query $query = null)
|
||||
public function __construct(?\Closure $format = null, ?\think\db\Query $query = null)
|
||||
{
|
||||
$this->query = $query ?: new Goods();
|
||||
$this->format = $format;
|
||||
|
||||
168
application/admin/controller/zy/Stadium.php
Normal file
168
application/admin/controller/zy/Stadium.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use Exception;
|
||||
use think\Db;
|
||||
use think\exception\DbException;
|
||||
use think\exception\PDOException;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
/**
|
||||
* 球馆
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Stadium extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Stadium模型对象
|
||||
* @var \app\admin\model\zy\Stadium
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\Stadium;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['user'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('user')->visible(['id', 'username', 'nickname', 'avatar', 'gender']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @return string
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
if (empty($params)) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$params = $this->preExcludeFields($params);
|
||||
$params['position'] = sprintf("POINT(%s %s)", $params['lng'], $params['lat']);
|
||||
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
||||
$params[$this->dataLimitField] = $this->auth->id;
|
||||
}
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
|
||||
$this->model->validateFailException()->validate($validate);
|
||||
}
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param $ids
|
||||
* @return string
|
||||
* @throws DbException
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
if (false === $this->request->isPost()) {
|
||||
$point = empty($row['position']) ? [0, 0] : explode(' ', substr($row['position'], 6, -1));
|
||||
$row['lng'] = $point[0];
|
||||
$row['lat'] = $point[1];
|
||||
$this->view->assign('row', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
if (empty($params)) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$params = $this->preExcludeFields($params);
|
||||
$params['position'] = sprintf("POINT(%s %s)", $params['lng'], $params['lat']);
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
||||
$row->validateFailException()->validate($validate);
|
||||
}
|
||||
$result = $row->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if (false === $result) {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
}
|
||||
37
application/admin/controller/zy/Tags.php
Normal file
37
application/admin/controller/zy/Tags.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\zy;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Tags extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Tags模型对象
|
||||
* @var \app\admin\model\zy\Tags
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\zy\Tags;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
25
application/admin/lang/zh-cn/zy/stadium.php
Normal file
25
application/admin/lang/zh-cn/zy/stadium.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Name' => '球馆名称',
|
||||
'Sub_name' => '简称',
|
||||
'Position' => '位置',
|
||||
'Address' => '地址',
|
||||
'City' => '城市',
|
||||
'Contact' => '联系方式',
|
||||
'Blurb' => '简介',
|
||||
'Imgs' => '图片',
|
||||
'Admin_ids' => '管理员',
|
||||
'Tags' => '标签',
|
||||
'Status' => '状态',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
'User.id' => 'ID',
|
||||
'User.username' => '用户名',
|
||||
'User.nickname' => '昵称',
|
||||
'User.avatar' => '头像',
|
||||
'User.gender' => '性别',
|
||||
|
||||
'Status0' => '禁用',
|
||||
'Status1' => '正常',
|
||||
];
|
||||
21
application/admin/lang/zh-cn/zy/tags.php
Normal file
21
application/admin/lang/zh-cn/zy/tags.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Type' => '标签类型',
|
||||
'Group' => '标签分组',
|
||||
'Content_json' => '标签内容',
|
||||
'Choose' => '选择方式',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '修改时间',
|
||||
|
||||
'Single' => '仅单选',
|
||||
'Multiple' => '可多选',
|
||||
|
||||
'General' => '通用标签',
|
||||
'Ability' => '能力标签',
|
||||
'Role' => '角色标签',
|
||||
|
||||
'Gym' => '球馆标签',
|
||||
'Club' => '俱乐部标签',
|
||||
'User' => '用户标签',
|
||||
];
|
||||
44
application/admin/model/zy/Stadium.php
Normal file
44
application/admin/model/zy/Stadium.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Stadium extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $table = 'zy_stadium';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'admin_ids', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
40
application/admin/model/zy/Tags.php
Normal file
40
application/admin/model/zy/Tags.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\zy;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Tags extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $table = 'zy_tags';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/Stadium.php
Normal file
27
application/admin/validate/zy/Stadium.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Stadium extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/zy/Tags.php
Normal file
27
application/admin/validate/zy/Tags.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\zy;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Tags extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
96
application/admin/view/zy/stadium/add.html
Normal file
96
application/admin/view/zy/stadium/add.html
Normal file
@@ -0,0 +1,96 @@
|
||||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Sub_name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-sub_name" data-rule="required" class="form-control" name="row[sub_name]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Position')}:</label>
|
||||
<div class="col-xs-4 col-sm-3">
|
||||
<input id="c-lng" data-rule="required" class="form-control" name="row[lng]" type="text" value="" placeholder="经度">
|
||||
</div>
|
||||
<div class="col-xs-4 col-sm-3">
|
||||
<input id="c-lat" data-rule="required" class="form-control" name="row[lat]" type="text" value="" placeholder="经度">
|
||||
</div>
|
||||
<div class="col-xs-4 col-sm-2">
|
||||
<button type="button" class="btn btn-primary" data-toggle='addresspicker'
|
||||
data-lng-id="c-lng" data-lat-id="c-lat" data-zoom-id="zoom">地图选择</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-6 col-sm-2">{:__('Address')}:</label>
|
||||
<div class="col-xs-6 col-sm-4">
|
||||
<div class='control-relative'><input id="c-city" class="form-control" data-toggle="city-picker"
|
||||
name="row[city]" type="text" value="NULL"></div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-4">
|
||||
<input id="c-address" class="form-control" name="row[address]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Contact')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-contact" class="form-control" name="row[contact]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Blurb')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<textarea id="c-blurb" class="form-control " rows="5" name="row[blurb]" cols="50">NULL</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Imgs')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="c-imgs" class="form-control" size="50" name="row[imgs]" type="textarea" value="">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="faupload-imgs" class="btn btn-danger faupload"
|
||||
data-input-id="c-imgs"
|
||||
data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp"
|
||||
data-multiple="true" data-preview-id="p-imgs"><i class="fa fa-upload"></i>
|
||||
{:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-imgs" class="btn btn-primary fachoose"
|
||||
data-input-id="c-imgs" data-mimetype="image/*" data-multiple="true"><i
|
||||
class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-imgs"></span>
|
||||
</div>
|
||||
<ul class="row list-inline faupload-preview" id="p-imgs"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Admin_ids')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-admin_ids" data-rule="required" data-source="user/user/index" data-field="nickname"
|
||||
data-multiple="true" class="form-control selectpage" name="row[admin_ids]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Tags')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-tags" class="form-control" data-role="tagsinput" name="row[tags]" type="text" value="NULL">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_radios('row[status]', ['1'=>__('Status1'), '0'=>__('Status0')],1)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
106
application/admin/view/zy/stadium/edit.html
Normal file
106
application/admin/view/zy/stadium/edit.html
Normal file
@@ -0,0 +1,106 @@
|
||||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text"
|
||||
value="{$row.name|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Sub_name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-sub_name" data-rule="required" class="form-control" name="row[sub_name]" type="text"
|
||||
value="{$row.sub_name|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Position')}:</label>
|
||||
<div class="col-xs-4 col-sm-3">
|
||||
<input id="c-lng" data-rule="required" class="form-control" name="row[lng]" type="text"
|
||||
value="{$row.lng|htmlentities}" placeholder="经度">
|
||||
</div>
|
||||
<div class="col-xs-4 col-sm-3">
|
||||
<input id="c-lat" data-rule="required" class="form-control" name="row[lat]" type="text"
|
||||
value="{$row.lat|htmlentities}" placeholder="经度">
|
||||
</div>
|
||||
<div class="col-xs-4 col-sm-2">
|
||||
<button type="button" class="btn btn-primary" data-toggle='addresspicker' data-lng-id="c-lng"
|
||||
data-lat-id="c-lat" data-zoom-id="zoom">地图选择</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
|
||||
<div class="col-xs-6 col-sm-4">
|
||||
<div class='control-relative'><input id="c-city" class="form-control" data-toggle="city-picker"
|
||||
name="row[city]" type="text" value="{$row.city|htmlentities}"></div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-4">
|
||||
<input id="c-address" class="form-control" name="row[address]" type="text"
|
||||
value="{$row.address|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Contact')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-contact" class="form-control" name="row[contact]" type="text"
|
||||
value="{$row.contact|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Blurb')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<textarea id="c-blurb" class="form-control " rows="5" name="row[blurb]"
|
||||
cols="50">{$row.blurb|htmlentities}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Imgs')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="c-imgs" class="form-control" size="50" name="row[imgs]" type="textarea"
|
||||
value="{$row.imgs|htmlentities}">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="faupload-imgs" class="btn btn-danger faupload"
|
||||
data-input-id="c-imgs"
|
||||
data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp"
|
||||
data-multiple="true" data-preview-id="p-imgs"><i class="fa fa-upload"></i>
|
||||
{:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-imgs" class="btn btn-primary fachoose"
|
||||
data-input-id="c-imgs" data-mimetype="image/*" data-multiple="true"><i
|
||||
class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-imgs"></span>
|
||||
</div>
|
||||
<ul class="row list-inline faupload-preview" id="p-imgs"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Admin_ids')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-admin_ids" data-rule="required" data-source="user/user/index" data-field="nickname"
|
||||
data-multiple="true" class="form-control selectpage" name="row[admin_ids]" type="text"
|
||||
value="{$row.admin_ids|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Tags')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-tags" class="form-control" data-role="tagsinput" name="row[tags]" type="text"
|
||||
value="{$row.tags|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_radios('row[status]', ['1'=>__('Status0'), '0'=>__('Status1')], $row['status'])}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
29
application/admin/view/zy/stadium/index.html
Normal file
29
application/admin/view/zy/stadium/index.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="panel panel-default panel-intro">
|
||||
{:build_heading()}
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('zy/stadium/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('zy/stadium/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('zy/stadium/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('zy/stadium/edit')}"
|
||||
data-operate-del="{:$auth->check('zy/stadium/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
46
application/admin/view/zy/tags/add.html
Normal file
46
application/admin/view/zy/tags/add.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_radios('row[type]', ['0'=>__('Gym'), '1'=>__('Club'), '2'=>__('User')])}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Group')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_radios('row[group]', ['0'=>__('General'), '1'=>__('Ability'), '2'=>__('Role')])}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Choose')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_radios('row[choose]', ['0'=>__('Multiple'), '1'=>__('Single')])}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Content_json')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<dl class="fieldlist" data-name="row[content_json]">
|
||||
<dd>
|
||||
<ins>{:__('Key')}</ins>
|
||||
<ins>{:__('Value')}</ins>
|
||||
</dd>
|
||||
<dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
|
||||
<textarea name="row[content_json]" class="form-control hide" cols="30" rows="5">''</textarea>
|
||||
</dl>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
43
application/admin/view/zy/tags/edit.html
Normal file
43
application/admin/view/zy/tags/edit.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_radios('row[type]', ['0'=>__('Gym'), '1'=>__('Club'), '2'=>__('User')], $row['type'])}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Group')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_radios('row[group]', ['0'=>__('General'), '1'=>__('Ability'), '2'=>__('Role')], $row['group'])}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Choose')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_radios('row[choose]', ['0'=>__('Multiple'), '1'=>__('Single')], $row['choose'])}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Content_json')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<dl class="fieldlist" data-name="row[content_json]">
|
||||
<dd>
|
||||
<ins>{:__('Key')}</ins>
|
||||
<ins>{:__('Value')}</ins>
|
||||
</dd>
|
||||
<dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
|
||||
<textarea name="row[content_json]" class="form-control hide" cols="30" rows="5">{$row.content_json|htmlentities}</textarea>
|
||||
</dl>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
29
application/admin/view/zy/tags/index.html
Normal file
29
application/admin/view/zy/tags/index.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="panel panel-default panel-intro">
|
||||
{:build_heading()}
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('zy/tags/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('zy/tags/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('zy/tags/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('zy/tags/edit')}"
|
||||
data-operate-del="{:$auth->check('zy/tags/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
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,4 +1,39 @@
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
if (typeof Config.upload.storage !== 'undefined' && Config.upload.storage === 'hwobs') {
|
||||
require(['upload'], function (Upload) {
|
||||
//获取文件MD5值
|
||||
|
||||
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