1 个管道
的构建
通过
耗费
27 秒
会员订单审核以及创建店铺创建后台账号
正在显示
62 个修改的文件
包含
4713 行增加
和
0 行删除
addons/address/Address.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace addons\address; | ||
4 | + | ||
5 | +use think\Addons; | ||
6 | + | ||
7 | +/** | ||
8 | + * 地址选择 | ||
9 | + * @author [MiniLing] <[laozheyouxiang@163.com]> | ||
10 | + */ | ||
11 | +class Address extends Addons | ||
12 | +{ | ||
13 | + | ||
14 | + /** | ||
15 | + * 插件安装方法 | ||
16 | + * @return bool | ||
17 | + */ | ||
18 | + public function install() | ||
19 | + { | ||
20 | + return true; | ||
21 | + } | ||
22 | + | ||
23 | + /** | ||
24 | + * 插件卸载方法 | ||
25 | + * @return bool | ||
26 | + */ | ||
27 | + public function uninstall() | ||
28 | + { | ||
29 | + return true; | ||
30 | + } | ||
31 | + | ||
32 | +} |
addons/address/bootstrap.js
0 → 100644
1 | +require([], function () { | ||
2 | + //绑定data-toggle=addresspicker属性点击事件 | ||
3 | + | ||
4 | + $(document).on('click', "[data-toggle='addresspicker']", function () { | ||
5 | + var that = this; | ||
6 | + var callback = $(that).data('callback'); | ||
7 | + var input_id = $(that).data("input-id") ? $(that).data("input-id") : ""; | ||
8 | + var lat_id = $(that).data("lat-id") ? $(that).data("lat-id") : ""; | ||
9 | + var lng_id = $(that).data("lng-id") ? $(that).data("lng-id") : ""; | ||
10 | + var lat = lat_id ? $("#" + lat_id).val() : ''; | ||
11 | + var lng = lng_id ? $("#" + lng_id).val() : ''; | ||
12 | + var url = "/addons/address/index/select"; | ||
13 | + url += (lat && lng) ? '?lat=' + lat + '&lng=' + lng : ''; | ||
14 | + Fast.api.open(url, '位置选择', { | ||
15 | + callback: function (res) { | ||
16 | + input_id && $("#" + input_id).val(res.address); | ||
17 | + lat_id && $("#" + lat_id).val(res.lat); | ||
18 | + lng_id && $("#" + lng_id).val(res.lng); | ||
19 | + try { | ||
20 | + //执行回调函数 | ||
21 | + if (typeof callback === 'function') { | ||
22 | + callback.call(that, res); | ||
23 | + } | ||
24 | + } catch (e) { | ||
25 | + | ||
26 | + } | ||
27 | + } | ||
28 | + }); | ||
29 | + }); | ||
30 | +}); |
addons/address/config.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +return array ( | ||
4 | + 0 => | ||
5 | + array ( | ||
6 | + 'name' => 'maptype', | ||
7 | + 'title' => '默认地图类型', | ||
8 | + 'type' => 'radio', | ||
9 | + 'content' => | ||
10 | + array ( | ||
11 | + 'baidu' => '百度地图', | ||
12 | + 'amap' => '高德地图', | ||
13 | + 'tencent' => '腾讯地图', | ||
14 | + ), | ||
15 | + 'value' => 'baidu', | ||
16 | + 'rule' => 'required', | ||
17 | + 'msg' => '', | ||
18 | + 'tip' => '', | ||
19 | + 'ok' => '', | ||
20 | + 'extend' => '', | ||
21 | + ), | ||
22 | + 1 => | ||
23 | + array ( | ||
24 | + 'name' => 'location', | ||
25 | + 'title' => '默认检索城市', | ||
26 | + 'type' => 'string', | ||
27 | + 'content' => | ||
28 | + array ( | ||
29 | + ), | ||
30 | + 'value' => '北京', | ||
31 | + 'rule' => 'required', | ||
32 | + 'msg' => '', | ||
33 | + 'tip' => '', | ||
34 | + 'ok' => '', | ||
35 | + 'extend' => '', | ||
36 | + ), | ||
37 | + 2 => | ||
38 | + array ( | ||
39 | + 'name' => 'zoom', | ||
40 | + 'title' => '默认缩放级别', | ||
41 | + 'type' => 'string', | ||
42 | + 'content' => | ||
43 | + array ( | ||
44 | + ), | ||
45 | + 'value' => '12', | ||
46 | + 'rule' => 'required', | ||
47 | + 'msg' => '', | ||
48 | + 'tip' => '', | ||
49 | + 'ok' => '', | ||
50 | + 'extend' => '', | ||
51 | + ), | ||
52 | + 3 => | ||
53 | + array ( | ||
54 | + 'name' => 'lat', | ||
55 | + 'title' => '默认Lat', | ||
56 | + 'type' => 'string', | ||
57 | + 'content' => | ||
58 | + array ( | ||
59 | + ), | ||
60 | + 'value' => '39.919990', | ||
61 | + 'rule' => 'required', | ||
62 | + 'msg' => '', | ||
63 | + 'tip' => '', | ||
64 | + 'ok' => '', | ||
65 | + 'extend' => '', | ||
66 | + ), | ||
67 | + 4 => | ||
68 | + array ( | ||
69 | + 'name' => 'lng', | ||
70 | + 'title' => '默认Lng', | ||
71 | + 'type' => 'string', | ||
72 | + 'content' => | ||
73 | + array ( | ||
74 | + ), | ||
75 | + 'value' => '116.456270', | ||
76 | + 'rule' => 'required', | ||
77 | + 'msg' => '', | ||
78 | + 'tip' => '', | ||
79 | + 'ok' => '', | ||
80 | + 'extend' => '', | ||
81 | + ), | ||
82 | + 5 => | ||
83 | + array ( | ||
84 | + 'name' => 'baidukey', | ||
85 | + 'title' => '百度地图KEY', | ||
86 | + 'type' => 'string', | ||
87 | + 'content' => | ||
88 | + array ( | ||
89 | + ), | ||
90 | + 'value' => 'hAeMFHmpyHa2ZjaCH9VVridl', | ||
91 | + 'rule' => 'required', | ||
92 | + 'msg' => '', | ||
93 | + 'tip' => '', | ||
94 | + 'ok' => '', | ||
95 | + 'extend' => '', | ||
96 | + ), | ||
97 | + 6 => | ||
98 | + array ( | ||
99 | + 'name' => 'amapkey', | ||
100 | + 'title' => '高德地图KEY', | ||
101 | + 'type' => 'string', | ||
102 | + 'content' => | ||
103 | + array ( | ||
104 | + ), | ||
105 | + 'value' => '608d75903d29ad471362f8c58c550daf', | ||
106 | + 'rule' => 'required', | ||
107 | + 'msg' => '', | ||
108 | + 'tip' => '', | ||
109 | + 'ok' => '', | ||
110 | + 'extend' => '', | ||
111 | + ), | ||
112 | + 7 => | ||
113 | + array ( | ||
114 | + 'name' => 'tencentkey', | ||
115 | + 'title' => '腾讯地图KEY', | ||
116 | + 'type' => 'string', | ||
117 | + 'content' => | ||
118 | + array ( | ||
119 | + ), | ||
120 | + 'value' => '608d75903d29ad471362f8c58c550daf', | ||
121 | + 'rule' => 'required', | ||
122 | + 'msg' => '', | ||
123 | + 'tip' => '', | ||
124 | + 'ok' => '', | ||
125 | + 'extend' => '', | ||
126 | + ), | ||
127 | + 8 => | ||
128 | + array ( | ||
129 | + 'name' => '__tips__', | ||
130 | + 'title' => '温馨提示', | ||
131 | + 'type' => '', | ||
132 | + 'content' => | ||
133 | + array ( | ||
134 | + ), | ||
135 | + 'value' => '请先申请对应地图的Key,配置后再使用', | ||
136 | + 'rule' => '', | ||
137 | + 'msg' => '', | ||
138 | + 'tip' => '', | ||
139 | + 'ok' => '', | ||
140 | + 'extend' => 'alert-danger-light', | ||
141 | + ), | ||
142 | +); |
addons/address/controller/Index.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace addons\address\controller; | ||
4 | + | ||
5 | +use think\addons\Controller; | ||
6 | +use think\Config; | ||
7 | +use think\Hook; | ||
8 | + | ||
9 | +class Index extends Controller | ||
10 | +{ | ||
11 | + | ||
12 | + public function index() | ||
13 | + { | ||
14 | + // 语言检测 | ||
15 | + $lang = strip_tags($this->request->langset()); | ||
16 | + | ||
17 | + $site = Config::get("site"); | ||
18 | + | ||
19 | + // 配置信息 | ||
20 | + $config = [ | ||
21 | + 'site' => array_intersect_key($site, array_flip(['name', 'cdnurl', 'version', 'timezone', 'languages'])), | ||
22 | + 'upload' => null, | ||
23 | + 'modulename' => 'addons', | ||
24 | + 'controllername' => 'index', | ||
25 | + 'actionname' => 'index', | ||
26 | + 'jsname' => 'addons/address', | ||
27 | + 'moduleurl' => '', | ||
28 | + 'language' => $lang | ||
29 | + ]; | ||
30 | + $config = array_merge($config, Config::get("view_replace_str")); | ||
31 | + | ||
32 | + // 配置信息后 | ||
33 | + Hook::listen("config_init", $config); | ||
34 | + // 加载当前控制器语言包 | ||
35 | + $this->view->assign('site', $site); | ||
36 | + $this->view->assign('config', $config); | ||
37 | + | ||
38 | + return $this->view->fetch(); | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * 选择地址 | ||
43 | + * @return string | ||
44 | + * @throws \think\Exception | ||
45 | + */ | ||
46 | + public function select() | ||
47 | + { | ||
48 | + $config = get_addon_config('address'); | ||
49 | + $lat = $this->request->get('lat', $config['lat']); | ||
50 | + $lng = $this->request->get('lng', $config['lng']); | ||
51 | + $this->view->assign('lat', $lat); | ||
52 | + $this->view->assign('lng', $lng); | ||
53 | + $this->view->assign('location', $config['location']); | ||
54 | + return $this->view->fetch('index/' . $config['maptype']); | ||
55 | + } | ||
56 | + | ||
57 | +} |
addons/address/info.ini
0 → 100644
addons/address/view/index/amap.html
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html> | ||
3 | +<head> | ||
4 | + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> | ||
5 | + <title>地址选择器</title> | ||
6 | + <link rel="stylesheet" href="__CDN__/assets/css/bootstrap.min.css"/> | ||
7 | + <link rel="stylesheet" href="__CDN__/assets/css/fastadmin.min.css"/> | ||
8 | + <link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/> | ||
9 | + <style type="text/css"> | ||
10 | + body { | ||
11 | + margin: 0; | ||
12 | + padding: 0; | ||
13 | + } | ||
14 | + | ||
15 | + #container { | ||
16 | + position: absolute; | ||
17 | + left: 0; | ||
18 | + top: 0; | ||
19 | + right: 0; | ||
20 | + bottom: 0; | ||
21 | + } | ||
22 | + | ||
23 | + .confirm { | ||
24 | + position: absolute; | ||
25 | + bottom: 30px; | ||
26 | + right: 4%; | ||
27 | + z-index: 99; | ||
28 | + height: 50px; | ||
29 | + width: 50px; | ||
30 | + line-height: 50px; | ||
31 | + font-size: 15px; | ||
32 | + text-align: center; | ||
33 | + background-color: white; | ||
34 | + background: #1ABC9C; | ||
35 | + color: white; | ||
36 | + border: none; | ||
37 | + cursor: pointer; | ||
38 | + border-radius: 50%; | ||
39 | + } | ||
40 | + | ||
41 | + .search { | ||
42 | + position: absolute; | ||
43 | + width: 400px; | ||
44 | + top: 0; | ||
45 | + left: 50%; | ||
46 | + padding: 5px; | ||
47 | + margin-left: -200px; | ||
48 | + } | ||
49 | + | ||
50 | + .amap-marker-label { | ||
51 | + border: 0; | ||
52 | + background-color: transparent; | ||
53 | + } | ||
54 | + | ||
55 | + .info { | ||
56 | + padding: .75rem 1.25rem; | ||
57 | + margin-bottom: 1rem; | ||
58 | + border-radius: .25rem; | ||
59 | + position: fixed; | ||
60 | + top: 2rem; | ||
61 | + background-color: white; | ||
62 | + width: auto; | ||
63 | + min-width: 22rem; | ||
64 | + border-width: 0; | ||
65 | + left: 1.8rem; | ||
66 | + box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5); | ||
67 | + } | ||
68 | + </style> | ||
69 | +</head> | ||
70 | +<body> | ||
71 | +<div class="search"> | ||
72 | + <div class="input-group"> | ||
73 | + <input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/> | ||
74 | + <span class="input-group-btn"> | ||
75 | + <button type="submit" name="search" id="search-btn" class="btn btn-success"> | ||
76 | + <i class="fa fa-search"></i> | ||
77 | + </button> | ||
78 | + </span> | ||
79 | + </div> | ||
80 | +</div> | ||
81 | +<div class="confirm">确定</div> | ||
82 | +<div id="container"></div> | ||
83 | +<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> | ||
84 | +<!-- UI组件库 1.0 --> | ||
85 | +<script src="//webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script> | ||
86 | +<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script> | ||
87 | +<script type="text/javascript"> | ||
88 | + $(function () { | ||
89 | + var as, address, map, lat, lng, geocoder; | ||
90 | + var init = function () { | ||
91 | + AMapUI.loadUI(['misc/PositionPicker', 'misc/PoiPicker'], function (PositionPicker, PoiPicker) { | ||
92 | + //加载PositionPicker,loadUI的路径参数为模块名中 'ui/' 之后的部分 | ||
93 | + map = new AMap.Map('container', { | ||
94 | + zoom: parseInt('{$config.zoom}') | ||
95 | + }); | ||
96 | + geocoder = new AMap.Geocoder({ | ||
97 | + radius: 1000 //范围,默认:500 | ||
98 | + }); | ||
99 | + var positionPicker = new PositionPicker({ | ||
100 | + mode: 'dragMarker',//设定为拖拽地图模式,可选'dragMap'、'dragMarker',默认为'dragMap' | ||
101 | + map: map//依赖地图对象 | ||
102 | + }); | ||
103 | + //输入提示 | ||
104 | + var autoOptions = { | ||
105 | + input: "place" | ||
106 | + }; | ||
107 | + | ||
108 | + var relocation = function (lnglat) { | ||
109 | + lng = lnglat.lng; | ||
110 | + lat = lnglat.lat; | ||
111 | + map.panTo([lng, lat]); | ||
112 | + positionPicker.start(lnglat); | ||
113 | + geocoder.getAddress(lng + ',' + lat, function (status, result) { | ||
114 | + if (status === 'complete' && result.regeocode) { | ||
115 | + var address = result.regeocode.formattedAddress; | ||
116 | + var label = '<div class="info">地址:' + address + '<br>经度:' + lng + '<br>纬度:' + lat + '</div>'; | ||
117 | + positionPicker.marker.setLabel({ | ||
118 | + content: label //显示内容 | ||
119 | + }); | ||
120 | + } else { | ||
121 | + console.log(JSON.stringify(result)); | ||
122 | + } | ||
123 | + }); | ||
124 | + }; | ||
125 | + var auto = new AMap.Autocomplete(autoOptions); | ||
126 | + | ||
127 | + //构造地点查询类 | ||
128 | + var placeSearch = new AMap.PlaceSearch({ | ||
129 | + map: map | ||
130 | + }); | ||
131 | + //注册监听,当选中某条记录时会触发 | ||
132 | + AMap.event.addListener(auto, "select", function (e) { | ||
133 | + placeSearch.setCity(e.poi.adcode); | ||
134 | + placeSearch.search(e.poi.name); //关键字查询查询 | ||
135 | + }); | ||
136 | + AMap.event.addListener(map, 'click', function (e) { | ||
137 | + relocation(e.lnglat); | ||
138 | + }); | ||
139 | + | ||
140 | + //加载工具条 | ||
141 | + var tool = new AMap.ToolBar(); | ||
142 | + map.addControl(tool); | ||
143 | + | ||
144 | + var poiPicker = new PoiPicker({ | ||
145 | + input: 'place', | ||
146 | + placeSearchOptions: { | ||
147 | + map: map, | ||
148 | + pageSize: 6 //关联搜索分页 | ||
149 | + } | ||
150 | + }); | ||
151 | + poiPicker.on('poiPicked', function (poiResult) { | ||
152 | + poiPicker.hideSearchResults(); | ||
153 | + $('.poi .nearpoi').text(poiResult.item.name); | ||
154 | + $('.address .info').text(poiResult.item.address); | ||
155 | + $('#address').val(poiResult.item.address); | ||
156 | + $("#place").val(poiResult.item.name); | ||
157 | + | ||
158 | + relocation(poiResult.item.location); | ||
159 | + }); | ||
160 | + | ||
161 | + positionPicker.on('success', function (positionResult) { | ||
162 | + as = positionResult.position; | ||
163 | + address = positionResult.address; | ||
164 | + lat = as.lat; | ||
165 | + lng = as.lng; | ||
166 | + }); | ||
167 | + positionPicker.on('fail', function (positionResult) { | ||
168 | + address = ''; | ||
169 | + }); | ||
170 | + positionPicker.start(); | ||
171 | + }); | ||
172 | + }; | ||
173 | + | ||
174 | + //点击确定后执行回调赋值 | ||
175 | + var close = function (data) { | ||
176 | + var index = parent.Layer.getFrameIndex(window.name); | ||
177 | + var callback = parent.$("#layui-layer" + index).data("callback"); | ||
178 | + //再执行关闭 | ||
179 | + parent.Layer.close(index); | ||
180 | + //再调用回传函数 | ||
181 | + if (typeof callback === 'function') { | ||
182 | + callback.call(undefined, data); | ||
183 | + } | ||
184 | + }; | ||
185 | + | ||
186 | + //点击搜索按钮 | ||
187 | + $(document).on('click', '.confirm', function () { | ||
188 | + var zoom = map.getZoom(); | ||
189 | + var data = {lat: lat, lng: lng, zoom: zoom, address: address}; | ||
190 | + close(data); | ||
191 | + }); | ||
192 | + init(); | ||
193 | + }); | ||
194 | +</script> | ||
195 | +</body> | ||
196 | +</html> |
addons/address/view/index/baidu.html
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html> | ||
3 | +<head> | ||
4 | + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> | ||
5 | + <title>地址选择器</title> | ||
6 | + <link rel="stylesheet" href="__CDN__/assets/css/bootstrap.min.css"/> | ||
7 | + <link rel="stylesheet" href="__CDN__/assets/css/fastadmin.min.css"/> | ||
8 | + <link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/> | ||
9 | + <style type="text/css"> | ||
10 | + body { | ||
11 | + margin: 0; | ||
12 | + padding: 0; | ||
13 | + } | ||
14 | + | ||
15 | + #container { | ||
16 | + position: absolute; | ||
17 | + left: 0; | ||
18 | + top: 0; | ||
19 | + right: 0; | ||
20 | + bottom: 0; | ||
21 | + } | ||
22 | + | ||
23 | + .confirm { | ||
24 | + position: absolute; | ||
25 | + bottom: 30px; | ||
26 | + right: 4%; | ||
27 | + z-index: 99; | ||
28 | + height: 50px; | ||
29 | + width: 50px; | ||
30 | + line-height: 50px; | ||
31 | + font-size: 15px; | ||
32 | + text-align: center; | ||
33 | + background-color: white; | ||
34 | + background: #1ABC9C; | ||
35 | + color: white; | ||
36 | + border: none; | ||
37 | + cursor: pointer; | ||
38 | + border-radius: 50%; | ||
39 | + } | ||
40 | + | ||
41 | + .search { | ||
42 | + position: absolute; | ||
43 | + width: 400px; | ||
44 | + top: 0; | ||
45 | + left: 50%; | ||
46 | + padding: 5px; | ||
47 | + margin-left: -200px; | ||
48 | + } | ||
49 | + | ||
50 | + label.BMapLabel { | ||
51 | + max-width: inherit; | ||
52 | + padding: .75rem 1.25rem; | ||
53 | + margin-bottom: 1rem; | ||
54 | + background-color: white; | ||
55 | + width: auto; | ||
56 | + min-width: 22rem; | ||
57 | + border: none; | ||
58 | + box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5); | ||
59 | + } | ||
60 | + | ||
61 | + </style> | ||
62 | +</head> | ||
63 | +<body> | ||
64 | +<div class="search"> | ||
65 | + <div class="input-group"> | ||
66 | + <input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/> | ||
67 | + <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div> | ||
68 | + <span class="input-group-btn"> | ||
69 | + <button type="button" name="search" id="address" class="btn btn-success"> | ||
70 | + <i class="fa fa-search"></i> | ||
71 | + </button> | ||
72 | + </span> | ||
73 | + </div> | ||
74 | +</div> | ||
75 | +<div class="confirm">确定</div> | ||
76 | +<div id="container"></div> | ||
77 | +<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak={$config.baidukey|default=''}"></script> | ||
78 | +<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script> | ||
79 | +<script type="text/javascript"> | ||
80 | + $(function () { | ||
81 | + // 百度地图API功能 | ||
82 | + function G(id) { | ||
83 | + return document.getElementById(id); | ||
84 | + } | ||
85 | + | ||
86 | + var map, marker, searchService, address = null, lng, lat; | ||
87 | + | ||
88 | + var init = function () { | ||
89 | + map = new BMap.Map("container"); // 创建地图实例 | ||
90 | + var point = new BMap.Point({$lng}, {$lat}); // 创建点坐标 | ||
91 | + map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放 | ||
92 | + map.centerAndZoom(point, parseInt("{$config.zoom}")); // 初始化地图,设置中心点坐标和地图级别 | ||
93 | + | ||
94 | + var size = new BMap.Size(10, 20); | ||
95 | + map.addControl(new BMap.CityListControl({ | ||
96 | + anchor: BMAP_ANCHOR_TOP_LEFT, | ||
97 | + offset: size, | ||
98 | + })); | ||
99 | + | ||
100 | + var geoc = new BMap.Geocoder(); | ||
101 | + | ||
102 | + var addpoint = function (point) { | ||
103 | + //通过点击百度地图,可以获取到对应的point, 由point的lng、lat属性就可以获取对应的经度纬度 | ||
104 | + var pt = point; | ||
105 | + geoc.getLocation(pt, function (rs) { | ||
106 | + //对象可以获取到详细的地址信息 | ||
107 | + address = rs.address; | ||
108 | + deletePoint(); | ||
109 | + var mk = new BMap.Marker(pt); | ||
110 | + map.addOverlay(mk); | ||
111 | + map.panTo(pt); | ||
112 | + var label = new BMap.Label('<div class="info">地址:' + address + '<br>经度:' + pt.lng + '<br>纬度:' + pt.lat + '</div>', {offset: new BMap.Size(16, 20)}); | ||
113 | + label.setStyle({ | ||
114 | + border: 'none', | ||
115 | + padding: '.75rem 1.25rem' | ||
116 | + }); | ||
117 | + mk.setLabel(label); | ||
118 | + //将对应的HTML元素设置值 | ||
119 | + lng = pt.lng; | ||
120 | + lat = pt.lat; | ||
121 | + }); | ||
122 | + }; | ||
123 | + | ||
124 | + if ("{$lng}" != '' && "{$lat}" != '') { | ||
125 | + addpoint(point); | ||
126 | + } | ||
127 | + | ||
128 | + ac = new BMap.Autocomplete({"input": "place", "location": map}); //建立一个自动完成的对象 | ||
129 | + ac.addEventListener("onhighlight", function (e) { //鼠标放在下拉列表上的事件 | ||
130 | + var str = ""; | ||
131 | + var _value = e.fromitem.value; | ||
132 | + var value = ""; | ||
133 | + if (e.fromitem.index > -1) { | ||
134 | + value = _value.province + _value.city + _value.district + _value.street + _value.business; | ||
135 | + } | ||
136 | + str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value; | ||
137 | + | ||
138 | + value = ""; | ||
139 | + if (e.toitem.index > -1) { | ||
140 | + _value = e.toitem.value; | ||
141 | + value = _value.province + _value.city + _value.district + _value.street + _value.business; | ||
142 | + } | ||
143 | + str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value; | ||
144 | + G("searchResultPanel").innerHTML = str; | ||
145 | + }); | ||
146 | + ac.addEventListener("onconfirm", function (e) { //鼠标点击下拉列表后的事件 | ||
147 | + var _value = e.item.value; | ||
148 | + myValue = _value.province + _value.city + _value.district + _value.street + _value.business; | ||
149 | + G("searchResultPanel").innerHTML = "onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue; | ||
150 | + setPlace(); | ||
151 | + }); | ||
152 | + | ||
153 | + function setPlace() { | ||
154 | + map.clearOverlays(); //清除地图上所有覆盖物 | ||
155 | + function myFun() { | ||
156 | + var result = local.getResults().getPoi(0); | ||
157 | + var pp = result.point; //获取第一个智能搜索的结果 | ||
158 | + map.centerAndZoom(pp, 18); | ||
159 | + map.addOverlay(new BMap.Marker(pp)); //添加标注 | ||
160 | + lng = pp.lng; | ||
161 | + lat = pp.lat; | ||
162 | + address = result.address; | ||
163 | + } | ||
164 | + | ||
165 | + var local = new BMap.LocalSearch(map, { //智能搜索 | ||
166 | + onSearchComplete: myFun | ||
167 | + }); | ||
168 | + local.search(myValue); | ||
169 | + } | ||
170 | + | ||
171 | + map.addEventListener("click", function (e) { | ||
172 | + //通过点击百度地图,可以获取到对应的point, 由point的lng、lat属性就可以获取对应的经度纬度 | ||
173 | + var pt = e.point; | ||
174 | + addpoint(e.point); | ||
175 | + }); | ||
176 | + | ||
177 | + /** | ||
178 | + * 清除覆盖物 | ||
179 | + */ | ||
180 | + function deletePoint() { | ||
181 | + var allOverlay = map.getOverlays(); | ||
182 | + for (var i = 0; i < allOverlay.length; i++) { | ||
183 | + map.removeOverlay(allOverlay[i]); | ||
184 | + } | ||
185 | + } | ||
186 | + }; | ||
187 | + | ||
188 | + var close = function (data) { | ||
189 | + var index = parent.Layer.getFrameIndex(window.name); | ||
190 | + var callback = parent.$("#layui-layer" + index).data("callback"); | ||
191 | + //再执行关闭 | ||
192 | + parent.Layer.close(index); | ||
193 | + //再调用回传函数 | ||
194 | + if (typeof callback === 'function') { | ||
195 | + callback.call(undefined, data); | ||
196 | + } | ||
197 | + }; | ||
198 | + | ||
199 | + //点击确定后执行回调赋值 | ||
200 | + $(document).on('click', '.confirm', function () { | ||
201 | + var zoom = map.getZoom(); | ||
202 | + var data = {lat: lat, lng: lng, zoom: zoom, address: address}; | ||
203 | + close(data); | ||
204 | + }); | ||
205 | + | ||
206 | + init(); | ||
207 | + }); | ||
208 | +</script> | ||
209 | +</body> | ||
210 | +</html> |
addons/address/view/index/index.html
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html> | ||
3 | +<head> | ||
4 | + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> | ||
5 | + | ||
6 | + <title>地图位置(经纬度)选择插件 - FastAdmin</title> | ||
7 | + | ||
8 | + <!-- Bootstrap Core CSS --> | ||
9 | + <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet"> | ||
10 | + | ||
11 | + <!-- Custom CSS --> | ||
12 | + <link href="https://cdn.demo.fastadmin.net/assets/css/frontend.css" rel="stylesheet"> | ||
13 | + | ||
14 | + <!-- Plugin CSS --> | ||
15 | + <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet"> | ||
16 | + | ||
17 | + <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> | ||
18 | + <!--[if lt IE 9]> | ||
19 | + <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script> | ||
20 | + <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script> | ||
21 | + <![endif]--> | ||
22 | +</head> | ||
23 | +<body> | ||
24 | +<div class="container"> | ||
25 | + | ||
26 | + <div class="bs-docs-section clearfix"> | ||
27 | + <div class="row"> | ||
28 | + <div class="col-lg-12"> | ||
29 | + <div class="page-header"> | ||
30 | + <h2 id="navbar">地图位置(经纬度)选择示例</h2> | ||
31 | + </div> | ||
32 | + | ||
33 | + <div class="bs-component"> | ||
34 | + <form action="" method="post" role="form"> | ||
35 | + <div class="form-group"> | ||
36 | + <label for=""></label> | ||
37 | + <input type="text" class="form-control" name="" id="address" placeholder="地址"> | ||
38 | + </div> | ||
39 | + <div class="form-group"> | ||
40 | + <label for=""></label> | ||
41 | + <input type="text" class="form-control" name="" id="lng" placeholder="经度"> | ||
42 | + </div> | ||
43 | + <div class="form-group"> | ||
44 | + <label for=""></label> | ||
45 | + <input type="text" class="form-control" name="" id="lat" placeholder="纬度"> | ||
46 | + </div> | ||
47 | + | ||
48 | + <button type="button" class="btn btn-primary" data-toggle='addresspicker' data-input-id="address" data-lng-id="lng" data-lat-id="lat">点击选择地址获取经纬度</button> | ||
49 | + </form> | ||
50 | + </div> | ||
51 | + | ||
52 | + <div class="page-header"> | ||
53 | + <h2 id="code">调用代码</h2> | ||
54 | + </div> | ||
55 | + <div class="bs-component"> | ||
56 | + <textarea class="form-control" rows="17"> | ||
57 | +<form action="" method="post" role="form"> | ||
58 | + <div class="form-group"> | ||
59 | + <label for=""></label> | ||
60 | + <input type="text" class="form-control" name="" id="address" placeholder="地址"> | ||
61 | + </div> | ||
62 | + <div class="form-group"> | ||
63 | + <label for=""></label> | ||
64 | + <input type="text" class="form-control" name="" id="lng" placeholder="经度"> | ||
65 | + </div> | ||
66 | + <div class="form-group"> | ||
67 | + <label for=""></label> | ||
68 | + <input type="text" class="form-control" name="" id="lat" placeholder="纬度"> | ||
69 | + </div> | ||
70 | + | ||
71 | + <button type="button" class="btn btn-primary" data-toggle='addresspicker' data-input-id="address" data-lng-id="lng" data-lat-id="lat">点击选择地址获取经纬度</button> | ||
72 | +</form> | ||
73 | + </textarea> | ||
74 | + </div> | ||
75 | + <div class="page-header"> | ||
76 | + <h2 id="navbar">参数说明</h2> | ||
77 | + </div> | ||
78 | + | ||
79 | + <div class="bs-component"> | ||
80 | + <table class="table table-condensed table-hover"> | ||
81 | + <thead> | ||
82 | + <tr> | ||
83 | + <th>参数</th> | ||
84 | + <th>释义</th> | ||
85 | + </tr> | ||
86 | + </thead> | ||
87 | + <tbody> | ||
88 | + <tr> | ||
89 | + <td>data-input-id</td> | ||
90 | + <td>填充地址的文本框ID</td> | ||
91 | + </tr> | ||
92 | + <tr> | ||
93 | + <td>data-lng-id</td> | ||
94 | + <td>填充经度的文本框ID</td> | ||
95 | + </tr> | ||
96 | + <tr> | ||
97 | + <td>data-lat-id</td> | ||
98 | + <td>填充纬度的文本框ID</td> | ||
99 | + </tr> | ||
100 | + </tbody> | ||
101 | + </table> | ||
102 | + </div> | ||
103 | + | ||
104 | + </div> | ||
105 | + </div> | ||
106 | + </div> | ||
107 | + | ||
108 | +</div> | ||
109 | +<script type="text/javascript"> | ||
110 | + var require = { | ||
111 | + config: {$config | json_encode | ||
112 | + } | ||
113 | + } | ||
114 | + ; | ||
115 | +</script> | ||
116 | + | ||
117 | +<script> | ||
118 | + require.callback = function () { | ||
119 | + define('addons/address', ['jquery', 'bootstrap', 'frontend', 'template'], function ($, undefined, Frontend, Template) { | ||
120 | + var Controller = { | ||
121 | + index: function () { | ||
122 | + ; | ||
123 | + } | ||
124 | + }; | ||
125 | + return Controller; | ||
126 | + }); | ||
127 | + define('lang', function () { | ||
128 | + return []; | ||
129 | + }); | ||
130 | + } | ||
131 | +</script> | ||
132 | + | ||
133 | + | ||
134 | +<script src="__CDN__/assets/js/require.min.js" data-main="__CDN__/assets/js/require-frontend.min.js?v={$site.version}"></script> | ||
135 | +</body> | ||
136 | +</html> |
addons/address/view/index/tencent.html
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html> | ||
3 | +<head> | ||
4 | + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> | ||
5 | + <title>地址选择器</title> | ||
6 | + <link rel="stylesheet" href="__CDN__/assets/css/bootstrap.min.css"/> | ||
7 | + <link rel="stylesheet" href="__CDN__/assets/css/fastadmin.min.css"/> | ||
8 | + <link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/> | ||
9 | + <style type="text/css"> | ||
10 | + body { | ||
11 | + margin: 0; | ||
12 | + padding: 0; | ||
13 | + } | ||
14 | + | ||
15 | + #container { | ||
16 | + position: absolute; | ||
17 | + left: 0; | ||
18 | + top: 0; | ||
19 | + right: 0; | ||
20 | + bottom: 0; | ||
21 | + } | ||
22 | + | ||
23 | + .confirm { | ||
24 | + position: absolute; | ||
25 | + bottom: 30px; | ||
26 | + right: 4%; | ||
27 | + z-index: 99; | ||
28 | + height: 50px; | ||
29 | + width: 50px; | ||
30 | + line-height: 50px; | ||
31 | + font-size: 15px; | ||
32 | + text-align: center; | ||
33 | + background-color: white; | ||
34 | + background: #1ABC9C; | ||
35 | + color: white; | ||
36 | + border: none; | ||
37 | + cursor: pointer; | ||
38 | + border-radius: 50%; | ||
39 | + } | ||
40 | + | ||
41 | + .search { | ||
42 | + position: absolute; | ||
43 | + width: 400px; | ||
44 | + top: 0; | ||
45 | + left: 50%; | ||
46 | + padding: 5px; | ||
47 | + margin-left: -200px; | ||
48 | + } | ||
49 | + </style> | ||
50 | +</head> | ||
51 | +<body> | ||
52 | +<div class="search"> | ||
53 | + <div class="input-group"> | ||
54 | + <input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/> | ||
55 | + <span class="input-group-btn"> | ||
56 | + <button type="submit" name="search" id="search-btn" class="btn btn-success"> | ||
57 | + <i class="fa fa-search"></i> | ||
58 | + </button> | ||
59 | + </span> | ||
60 | + </div> | ||
61 | +</div> | ||
62 | +<div class="confirm">确定</div> | ||
63 | +<div id="container"></div> | ||
64 | +<script charset="utf-8" src="//map.qq.com/api/js?v=2.exp&libraries=place&key={$config.tencentkey|default=''}"></script> | ||
65 | +<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script> | ||
66 | +<script type="text/javascript"> | ||
67 | + $(function () { | ||
68 | + var map, marker, geocoder, infoWin, searchService, address = null; | ||
69 | + var init = function () { | ||
70 | + var center = new qq.maps.LatLng({$lat}, {$lng}); | ||
71 | + map = new qq.maps.Map(document.getElementById('container'), { | ||
72 | + center: center, | ||
73 | + zoom: parseInt("{$config.zoom}") | ||
74 | + }); | ||
75 | + //初始化marker | ||
76 | + initmarker(center); | ||
77 | + | ||
78 | + //实例化信息窗口 | ||
79 | + infoWin = new qq.maps.InfoWindow({ | ||
80 | + map: map | ||
81 | + }); | ||
82 | + geocoder = new qq.maps.Geocoder({ | ||
83 | + complete: function (result) { | ||
84 | + infoWin.open(); | ||
85 | + address = result.detail.addressComponents.province + | ||
86 | + result.detail.addressComponents.city + | ||
87 | + result.detail.addressComponents.district; | ||
88 | + if (result.detail.addressComponents.streetNumber == '') { | ||
89 | + address += result.detail.addressComponents.street; | ||
90 | + } else { | ||
91 | + address += result.detail.addressComponents.streetNumber; | ||
92 | + } | ||
93 | + infoWin.setContent(address); | ||
94 | + infoWin.setPosition(result.detail.location); | ||
95 | + } | ||
96 | + }); | ||
97 | + //显示当前marker的位置信息窗口 | ||
98 | + geocoder.getAddress(center); | ||
99 | + | ||
100 | + var latlngBounds = new qq.maps.LatLngBounds(); | ||
101 | + //查询poi类信息 | ||
102 | + searchService = new qq.maps.SearchService({ | ||
103 | + complete: function (results) { | ||
104 | + var pois = results.detail.pois; | ||
105 | + for (var i = 0, l = pois.length; i < l; i++) { | ||
106 | + var poi = pois[i]; | ||
107 | + latlngBounds.extend(poi.latLng); | ||
108 | + initmarker(poi.latLng); | ||
109 | + //显示当前marker的位置信息窗口 | ||
110 | + geocoder.getAddress(poi.latLng); | ||
111 | + } | ||
112 | + map.fitBounds(latlngBounds); | ||
113 | + } | ||
114 | + }); | ||
115 | + //实例化自动完成 | ||
116 | + var ap = new qq.maps.place.Autocomplete(document.getElementById('place')); | ||
117 | + //添加监听事件 | ||
118 | + qq.maps.event.addListener(ap, "confirm", function (res) { | ||
119 | + searchKeyword(); | ||
120 | + }); | ||
121 | + qq.maps.event.addListener( | ||
122 | + map, | ||
123 | + 'click', | ||
124 | + function (event) { | ||
125 | + try { | ||
126 | + infoWin.setContent('<div style="text-align:center;white-space:nowrap;margin:10px;">加载中</div>'); | ||
127 | + var latLng = event.latLng, | ||
128 | + lat = latLng.getLat().toFixed(5), | ||
129 | + lng = latLng.getLng().toFixed(5); | ||
130 | + var location = new qq.maps.LatLng(lat, lng); | ||
131 | + //调用获取位置方法 | ||
132 | + geocoder.getAddress(location); | ||
133 | + infoWin.setPosition(location); | ||
134 | + marker.setPosition(location); | ||
135 | + } catch (e) { | ||
136 | + console.log(e); | ||
137 | + } | ||
138 | + } | ||
139 | + ); | ||
140 | + }; | ||
141 | + | ||
142 | + //实例化marker和监听拖拽结束事件 | ||
143 | + var initmarker = function (latLng) { | ||
144 | + marker = new qq.maps.Marker({ | ||
145 | + map: map, | ||
146 | + position: latLng, | ||
147 | + draggable: true, | ||
148 | + title: '拖动图标选择位置' | ||
149 | + }); | ||
150 | + //监听拖拽结束 | ||
151 | + qq.maps.event.addListener(marker, 'dragend', function (event) { | ||
152 | + var latLng = event.latLng, | ||
153 | + lat = latLng.getLat().toFixed(5), | ||
154 | + lng = latLng.getLng().toFixed(5); | ||
155 | + var location = new qq.maps.LatLng(lat, lng); | ||
156 | + //调用获取位置方法 | ||
157 | + geocoder.getAddress(location); | ||
158 | + }); | ||
159 | + }; | ||
160 | + var close = function (data) { | ||
161 | + var index = parent.Layer.getFrameIndex(window.name); | ||
162 | + var callback = parent.$("#layui-layer" + index).data("callback"); | ||
163 | + //再执行关闭 | ||
164 | + parent.Layer.close(index); | ||
165 | + //再调用回传函数 | ||
166 | + if (typeof callback === 'function') { | ||
167 | + callback.call(undefined, data); | ||
168 | + } | ||
169 | + }; | ||
170 | + | ||
171 | + //执行搜索方法 | ||
172 | + var searchKeyword = function () { | ||
173 | + searchService.clear();//先清除 | ||
174 | + marker.setMap(null); | ||
175 | + infoWin.close(); | ||
176 | + var keyword = $("#place").val(); | ||
177 | + searchService.setLocation("{$location}");//设置默认检索范围(默认为全国),类型可以是坐标或指定的城市名称。 | ||
178 | + searchService.setPageIndex(0);//设置检索的特定页数。 | ||
179 | + searchService.setPageCapacity(1);//设置每页返回的结果数量。 | ||
180 | + searchService.search(keyword);//开始查询 | ||
181 | + }; | ||
182 | + | ||
183 | + //点击确定后执行回调赋值 | ||
184 | + $(document).on('click', '.confirm', function () { | ||
185 | + var as = marker.getPosition(); | ||
186 | + var x = as.getLat().toFixed(5); | ||
187 | + var y = as.getLng().toFixed(5); | ||
188 | + var zoom = map.getZoom(); | ||
189 | + var data = {lat: x, lng: y, zoom: zoom, address: address}; | ||
190 | + close(data); | ||
191 | + }); | ||
192 | + | ||
193 | + //点击搜索按钮 | ||
194 | + $(document).on('click', '#search-btn', function () { | ||
195 | + if ($("#place").val() == '') | ||
196 | + return; | ||
197 | + searchKeyword(); | ||
198 | + }); | ||
199 | + | ||
200 | + init(); | ||
201 | + }); | ||
202 | +</script> | ||
203 | +</body> | ||
204 | +</html> |
addons/example/Example.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace addons\example; | ||
4 | + | ||
5 | +use app\common\library\Menu; | ||
6 | +use think\Addons; | ||
7 | + | ||
8 | +/** | ||
9 | + * Example | ||
10 | + */ | ||
11 | +class Example extends Addons | ||
12 | +{ | ||
13 | + | ||
14 | + /** | ||
15 | + * 插件安装方法 | ||
16 | + * @return bool | ||
17 | + */ | ||
18 | + public function install() | ||
19 | + { | ||
20 | + $menu = [ | ||
21 | + [ | ||
22 | + 'name' => 'example', | ||
23 | + 'title' => '开发示例管理', | ||
24 | + 'icon' => 'fa fa-magic', | ||
25 | + 'sublist' => [ | ||
26 | + [ | ||
27 | + 'name' => 'example/bootstraptable', | ||
28 | + 'title' => '表格完整示例', | ||
29 | + 'icon' => 'fa fa-table', | ||
30 | + 'sublist' => [ | ||
31 | + ['name' => 'example/bootstraptable/index', 'title' => '查看'], | ||
32 | + ['name' => 'example/bootstraptable/detail', 'title' => '详情'], | ||
33 | + ['name' => 'example/bootstraptable/change', 'title' => '变更'], | ||
34 | + ['name' => 'example/bootstraptable/del', 'title' => '删除'], | ||
35 | + ['name' => 'example/bootstraptable/multi', 'title' => '批量更新'], | ||
36 | + ] | ||
37 | + ], | ||
38 | + [ | ||
39 | + 'name' => 'example/customsearch', | ||
40 | + 'title' => '自定义搜索', | ||
41 | + 'icon' => 'fa fa-table', | ||
42 | + 'sublist' => [ | ||
43 | + ['name' => 'example/customsearch/index', 'title' => '查看'], | ||
44 | + ['name' => 'example/customsearch/del', 'title' => '删除'], | ||
45 | + ['name' => 'example/customsearch/multi', 'title' => '批量更新'], | ||
46 | + ] | ||
47 | + ], | ||
48 | + [ | ||
49 | + 'name' => 'example/customform', | ||
50 | + 'title' => '自定义表单示例', | ||
51 | + 'icon' => 'fa fa-edit', | ||
52 | + 'sublist' => [ | ||
53 | + ['name' => 'example/customform/index', 'title' => '查看'], | ||
54 | + ] | ||
55 | + ], | ||
56 | + [ | ||
57 | + 'name' => 'example/tablelink', | ||
58 | + 'title' => '表格联动示例', | ||
59 | + 'icon' => 'fa fa-table', | ||
60 | + 'remark' => '点击左侧日志列表,右侧的表格数据会显示指定管理员的日志列表', | ||
61 | + 'sublist' => [ | ||
62 | + ['name' => 'example/tablelink/index', 'title' => '查看'], | ||
63 | + ] | ||
64 | + ], | ||
65 | + [ | ||
66 | + 'name' => 'example/colorbadge', | ||
67 | + 'title' => '彩色角标', | ||
68 | + 'icon' => 'fa fa-table', | ||
69 | + 'remark' => '左侧彩色的角标会根据当前数据量的大小进行更新', | ||
70 | + 'sublist' => [ | ||
71 | + ['name' => 'example/colorbadge/index', 'title' => '查看'], | ||
72 | + ['name' => 'example/colorbadge/del', 'title' => '删除'], | ||
73 | + ['name' => 'example/colorbadge/multi', 'title' => '批量更新'], | ||
74 | + ] | ||
75 | + ], | ||
76 | + [ | ||
77 | + 'name' => 'example/controllerjump', | ||
78 | + 'title' => '控制器间跳转', | ||
79 | + 'icon' => 'fa fa-table', | ||
80 | + 'remark' => '点击IP地址可以跳转到新的选项卡中查看指定IP的数据', | ||
81 | + 'sublist' => [ | ||
82 | + ['name' => 'example/controllerjump/index', 'title' => '查看'], | ||
83 | + ['name' => 'example/controllerjump/del', 'title' => '删除'], | ||
84 | + ['name' => 'example/controllerjump/multi', 'title' => '批量更新'], | ||
85 | + ] | ||
86 | + ], | ||
87 | + [ | ||
88 | + 'name' => 'example/cxselect', | ||
89 | + 'title' => '多级联动', | ||
90 | + 'icon' => 'fa fa-table', | ||
91 | + 'remark' => '基于jquery.cxselect实现的多级联动', | ||
92 | + 'sublist' => [ | ||
93 | + ['name' => 'example/cxselect/index', 'title' => '查看'], | ||
94 | + ['name' => 'example/cxselect/del', 'title' => '删除'], | ||
95 | + ['name' => 'example/cxselect/multi', 'title' => '批量更新'], | ||
96 | + ] | ||
97 | + ], | ||
98 | + [ | ||
99 | + 'name' => 'example/multitable', | ||
100 | + 'title' => '多表格示例', | ||
101 | + 'icon' => 'fa fa-table', | ||
102 | + 'remark' => '展示在一个页面显示多个Bootstrap-table表格', | ||
103 | + 'sublist' => [ | ||
104 | + ['name' => 'example/multitable/index', 'title' => '查看'], | ||
105 | + ['name' => 'example/multitable/del', 'title' => '删除'], | ||
106 | + ['name' => 'example/multitable/multi', 'title' => '批量更新'], | ||
107 | + ] | ||
108 | + ], | ||
109 | + [ | ||
110 | + 'name' => 'example/relationmodel', | ||
111 | + 'title' => '关联模型示例', | ||
112 | + 'icon' => 'fa fa-table', | ||
113 | + 'remark' => '列表中的头像、用户名和昵称字段均从关联表中取出', | ||
114 | + 'sublist' => [ | ||
115 | + ['name' => 'example/relationmodel/index', 'title' => '查看'], | ||
116 | + ['name' => 'example/relationmodel/del', 'title' => '删除'], | ||
117 | + ['name' => 'example/relationmodel/multi', 'title' => '批量更新'], | ||
118 | + ] | ||
119 | + ], | ||
120 | + [ | ||
121 | + 'name' => 'example/tabletemplate', | ||
122 | + 'title' => '表格模板示例', | ||
123 | + 'icon' => 'fa fa-table', | ||
124 | + 'remark' => '', | ||
125 | + 'sublist' => [ | ||
126 | + ['name' => 'example/tabletemplate/index', 'title' => '查看'], | ||
127 | + ['name' => 'example/tabletemplate/detail', 'title' => '详情'], | ||
128 | + ['name' => 'example/tabletemplate/del', 'title' => '删除'], | ||
129 | + ['name' => 'example/tabletemplate/multi', 'title' => '批量更新'], | ||
130 | + ] | ||
131 | + ], | ||
132 | + [ | ||
133 | + 'name' => 'example/baidumap', | ||
134 | + 'title' => '百度地图示例', | ||
135 | + 'icon' => 'fa fa-map-pin', | ||
136 | + 'sublist' => [ | ||
137 | + ['name' => 'example/baidumap/index', 'title' => '查看'], | ||
138 | + ['name' => 'example/baidumap/map', 'title' => '详情'], | ||
139 | + ['name' => 'example/baidumap/del', 'title' => '删除'], | ||
140 | + ] | ||
141 | + ], | ||
142 | + [ | ||
143 | + 'name' => 'example/echarts', | ||
144 | + 'title' => '统计图表示例', | ||
145 | + 'icon' => 'fa fa-bar-chart', | ||
146 | + 'sublist' => [ | ||
147 | + ['name' => 'example/echarts/index', 'title' => '查看'], | ||
148 | + ] | ||
149 | + ], | ||
150 | + ] | ||
151 | + ] | ||
152 | + ]; | ||
153 | + Menu::create($menu); | ||
154 | + return true; | ||
155 | + } | ||
156 | + | ||
157 | + /** | ||
158 | + * 插件卸载方法 | ||
159 | + * @return bool | ||
160 | + */ | ||
161 | + public function uninstall() | ||
162 | + { | ||
163 | + Menu::delete('example'); | ||
164 | + return true; | ||
165 | + } | ||
166 | + | ||
167 | + /** | ||
168 | + * 插件启用方法 | ||
169 | + */ | ||
170 | + public function enable() | ||
171 | + { | ||
172 | + Menu::enable('example'); | ||
173 | + } | ||
174 | + | ||
175 | + /** | ||
176 | + * 插件禁用方法 | ||
177 | + */ | ||
178 | + public function disable() | ||
179 | + { | ||
180 | + Menu::disable('example'); | ||
181 | + } | ||
182 | + | ||
183 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 百度地图 | ||
9 | + * | ||
10 | + * @icon fa fa-map | ||
11 | + * @remark 可以搜索百度位置,调用百度地图的相关API | ||
12 | + */ | ||
13 | +class Baidumap extends Backend | ||
14 | +{ | ||
15 | + protected $model = null; | ||
16 | + | ||
17 | + public function _initialize() | ||
18 | + { | ||
19 | + parent::_initialize(); | ||
20 | + $this->model = model('AdminLog'); | ||
21 | + } | ||
22 | + | ||
23 | + /** | ||
24 | + * 查找地图 | ||
25 | + */ | ||
26 | + public function map() | ||
27 | + { | ||
28 | + return $this->view->fetch(); | ||
29 | + } | ||
30 | + | ||
31 | + /** | ||
32 | + * 搜索列表 | ||
33 | + */ | ||
34 | + public function selectpage() | ||
35 | + { | ||
36 | + $this->model = model('Area'); | ||
37 | + return parent::selectpage(); | ||
38 | + } | ||
39 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 表格完整示例 | ||
9 | + * | ||
10 | + * @icon fa fa-table | ||
11 | + * @remark 在使用Bootstrap-table中的常用方式,更多使用方式可查看:http://bootstrap-table.wenzhixin.net.cn/zh-cn/ | ||
12 | + */ | ||
13 | +class Bootstraptable extends Backend | ||
14 | +{ | ||
15 | + protected $model = null; | ||
16 | + /** | ||
17 | + * 无需鉴权的方法(需登录) | ||
18 | + * @var array | ||
19 | + */ | ||
20 | + protected $noNeedRight = ['start', 'pause', 'change', 'detail', 'cxselect', 'searchlist']; | ||
21 | + /** | ||
22 | + * 快捷搜索的字段 | ||
23 | + * @var string | ||
24 | + */ | ||
25 | + protected $searchFields = 'id,title,url'; | ||
26 | + | ||
27 | + public function _initialize() | ||
28 | + { | ||
29 | + parent::_initialize(); | ||
30 | + $this->model = model('AdminLog'); | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * 查看 | ||
35 | + */ | ||
36 | + public function index() | ||
37 | + { | ||
38 | + if ($this->request->isAjax()) { | ||
39 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(null); | ||
40 | + $total = $this->model | ||
41 | + ->where($where) | ||
42 | + ->order($sort, $order) | ||
43 | + ->count(); | ||
44 | + $list = $this->model | ||
45 | + ->where($where) | ||
46 | + ->order($sort, $order) | ||
47 | + ->limit($offset, $limit) | ||
48 | + ->select(); | ||
49 | + $result = array("total" => $total, "rows" => $list, "extend" => ['money' => mt_rand(100000, 999999), 'price' => 200]); | ||
50 | + | ||
51 | + return json($result); | ||
52 | + } | ||
53 | + return $this->view->fetch(); | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * 详情 | ||
58 | + */ | ||
59 | + public function detail($ids) | ||
60 | + { | ||
61 | + $row = $this->model->get(['id' => $ids]); | ||
62 | + if (!$row) { | ||
63 | + $this->error(__('No Results were found')); | ||
64 | + } | ||
65 | + if ($this->request->isAjax()) { | ||
66 | + $this->success("Ajax请求成功", null, ['id' => $ids]); | ||
67 | + } | ||
68 | + $this->view->assign("row", $row->toArray()); | ||
69 | + return $this->view->fetch(); | ||
70 | + } | ||
71 | + | ||
72 | + /** | ||
73 | + * 启用 | ||
74 | + */ | ||
75 | + public function start($ids = '') | ||
76 | + { | ||
77 | + $this->success("模拟启动成功"); | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * 暂停 | ||
82 | + */ | ||
83 | + public function pause($ids = '') | ||
84 | + { | ||
85 | + $this->success("模拟暂停成功"); | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * 切换 | ||
90 | + */ | ||
91 | + public function change($ids = '') | ||
92 | + { | ||
93 | + //你需要在此做具体的操作逻辑 | ||
94 | + | ||
95 | + $this->success("模拟切换成功"); | ||
96 | + } | ||
97 | + | ||
98 | + /** | ||
99 | + * 联动搜索 | ||
100 | + */ | ||
101 | + public function cxselect() | ||
102 | + { | ||
103 | + $type = $this->request->get('type'); | ||
104 | + $group_id = $this->request->get('group_id'); | ||
105 | + $list = null; | ||
106 | + if ($group_id !== '') { | ||
107 | + if ($type == 'group') { | ||
108 | + $groupIds = $this->auth->getChildrenGroupIds(true); | ||
109 | + $list = \app\admin\model\AuthGroup::where('id', 'in', $groupIds)->field('id as value, name')->select(); | ||
110 | + } else { | ||
111 | + $adminIds = \app\admin\model\AuthGroupAccess::where('group_id', 'in', $group_id)->column('uid'); | ||
112 | + $list = \app\admin\model\Admin::where('id', 'in', $adminIds)->field('id as value, username AS name')->select(); | ||
113 | + } | ||
114 | + } | ||
115 | + $this->success('', null, $list); | ||
116 | + } | ||
117 | + | ||
118 | + /** | ||
119 | + * 搜索下拉列表 | ||
120 | + */ | ||
121 | + public function searchlist() | ||
122 | + { | ||
123 | + $result = $this->model->limit(10)->select(); | ||
124 | + $searchlist = []; | ||
125 | + foreach ($result as $key => $value) { | ||
126 | + $searchlist[] = ['id' => $value['url'], 'name' => $value['url']]; | ||
127 | + } | ||
128 | + $data = ['searchlist' => $searchlist]; | ||
129 | + $this->success('', null, $data); | ||
130 | + } | ||
131 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 彩色角标 | ||
9 | + * | ||
10 | + * @icon fa fa-table | ||
11 | + * @remark 在JS端控制角标的显示与隐藏,请注意左侧菜单栏角标的数值变化 | ||
12 | + */ | ||
13 | +class Colorbadge extends Backend | ||
14 | +{ | ||
15 | + protected $model = null; | ||
16 | + | ||
17 | + public function _initialize() | ||
18 | + { | ||
19 | + parent::_initialize(); | ||
20 | + $this->model = model('AdminLog'); | ||
21 | + } | ||
22 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 控制器间跳转 | ||
9 | + * | ||
10 | + * @icon fa fa-table | ||
11 | + * @remark FastAdmin支持在控制器间跳转,点击后将切换到另外一个TAB中,无需刷新当前页面 | ||
12 | + */ | ||
13 | +class Controllerjump extends Backend | ||
14 | +{ | ||
15 | + protected $model = null; | ||
16 | + | ||
17 | + public function _initialize() | ||
18 | + { | ||
19 | + parent::_initialize(); | ||
20 | + $this->model = model('AdminLog'); | ||
21 | + } | ||
22 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 自定义表单示例 | ||
9 | + * | ||
10 | + * @icon fa fa-table | ||
11 | + * @remark FastAdmin支持在控制器间跳转,点击后将切换到另外一个TAB中,无需刷新当前页面 | ||
12 | + */ | ||
13 | +class Customform extends Backend | ||
14 | +{ | ||
15 | + protected $model = null; | ||
16 | + | ||
17 | + public function _initialize() | ||
18 | + { | ||
19 | + parent::_initialize(); | ||
20 | + $this->model = model('AdminLog'); | ||
21 | + } | ||
22 | + | ||
23 | + public function index() | ||
24 | + { | ||
25 | + if ($this->request->isPost()) { | ||
26 | + $this->success("提交成功", null, ['data' => json_encode($this->request->post("row/a"), JSON_UNESCAPED_UNICODE)]); | ||
27 | + } | ||
28 | + return $this->view->fetch(); | ||
29 | + } | ||
30 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 自定义搜索 | ||
9 | + * | ||
10 | + * @icon fa fa-search | ||
11 | + * @remark 自定义列表的搜索 | ||
12 | + */ | ||
13 | +class Customsearch extends Backend | ||
14 | +{ | ||
15 | + protected $model = null; | ||
16 | + | ||
17 | + public function _initialize() | ||
18 | + { | ||
19 | + parent::_initialize(); | ||
20 | + $this->model = model('AdminLog'); | ||
21 | + $ipList = $this->model->whereTime('createtime', '-37 days')->group("ip")->column("ip,ip as aa"); | ||
22 | + $this->view->assign("ipList", $ipList); | ||
23 | + } | ||
24 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 多级联动 | ||
9 | + * | ||
10 | + * @icon fa fa-table | ||
11 | + * @remark FastAdmin使用了jQuery-cxselect实现多级联动,更多文档请参考https://github.com/karsonzhang/cxSelect | ||
12 | + */ | ||
13 | +class Cxselect extends Backend | ||
14 | +{ | ||
15 | + protected $model = null; | ||
16 | + | ||
17 | + public function _initialize() | ||
18 | + { | ||
19 | + parent::_initialize(); | ||
20 | + } | ||
21 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 统计图表示例 | ||
9 | + * | ||
10 | + * @icon fa fa-charts | ||
11 | + * @remark 展示在FastAdmin中使用Echarts展示丰富多彩的统计图表 | ||
12 | + */ | ||
13 | +class Echarts extends Backend | ||
14 | +{ | ||
15 | + protected $model = null; | ||
16 | + | ||
17 | + public function _initialize() | ||
18 | + { | ||
19 | + parent::_initialize(); | ||
20 | + $this->model = model('AdminLog'); | ||
21 | + } | ||
22 | + | ||
23 | + /** | ||
24 | + * 查看 | ||
25 | + */ | ||
26 | + public function index() | ||
27 | + { | ||
28 | + | ||
29 | + return $this->view->fetch(); | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * 详情 | ||
34 | + */ | ||
35 | + public function detail($ids) | ||
36 | + { | ||
37 | + $row = $this->model->get(['id' => $ids]); | ||
38 | + if (!$row) { | ||
39 | + $this->error(__('No Results were found')); | ||
40 | + } | ||
41 | + $this->view->assign("row", $row->toArray()); | ||
42 | + return $this->view->fetch(); | ||
43 | + } | ||
44 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 多表格示例 | ||
9 | + * | ||
10 | + * @icon fa fa-table | ||
11 | + * @remark 当一个页面上存在多个Bootstrap-table时该如何控制按钮和表格 | ||
12 | + */ | ||
13 | +class Multitable extends Backend | ||
14 | +{ | ||
15 | + protected $model = null; | ||
16 | + protected $noNeedRight = ['table1', 'table2']; | ||
17 | + | ||
18 | + public function _initialize() | ||
19 | + { | ||
20 | + parent::_initialize(); | ||
21 | + } | ||
22 | + | ||
23 | + /** | ||
24 | + * 查看 | ||
25 | + */ | ||
26 | + public function index() | ||
27 | + { | ||
28 | + $this->loadlang('general/attachment'); | ||
29 | + $this->loadlang('general/crontab'); | ||
30 | + return $this->view->fetch(); | ||
31 | + } | ||
32 | + | ||
33 | + public function table1() | ||
34 | + { | ||
35 | + $this->model = model('Attachment'); | ||
36 | + //设置过滤方法 | ||
37 | + $this->request->filter(['strip_tags']); | ||
38 | + if ($this->request->isAjax()) { | ||
39 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
40 | + if ($this->request->request('keyField')) { | ||
41 | + return $this->selectpage(); | ||
42 | + } | ||
43 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
44 | + $total = $this->model | ||
45 | + ->where($where) | ||
46 | + ->order($sort, $order) | ||
47 | + ->count(); | ||
48 | + | ||
49 | + $list = $this->model | ||
50 | + ->where($where) | ||
51 | + ->order($sort, $order) | ||
52 | + ->limit($offset, $limit) | ||
53 | + ->select(); | ||
54 | + | ||
55 | + $result = array("total" => $total, "rows" => $list); | ||
56 | + | ||
57 | + return json($result); | ||
58 | + } | ||
59 | + return $this->view->fetch('index'); | ||
60 | + } | ||
61 | + | ||
62 | + public function table2() | ||
63 | + { | ||
64 | + $this->model = model('AdminLog'); | ||
65 | + //设置过滤方法 | ||
66 | + $this->request->filter(['strip_tags']); | ||
67 | + if ($this->request->isAjax()) { | ||
68 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
69 | + if ($this->request->request('keyField')) { | ||
70 | + return $this->selectpage(); | ||
71 | + } | ||
72 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
73 | + $total = $this->model | ||
74 | + ->where($where) | ||
75 | + ->order($sort, $order) | ||
76 | + ->count(); | ||
77 | + | ||
78 | + $list = $this->model | ||
79 | + ->where($where) | ||
80 | + ->order($sort, $order) | ||
81 | + ->limit($offset, $limit) | ||
82 | + ->select(); | ||
83 | + | ||
84 | + $result = array("total" => $total, "rows" => $list); | ||
85 | + | ||
86 | + return json($result); | ||
87 | + } | ||
88 | + return $this->view->fetch('index'); | ||
89 | + } | ||
90 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 关联模型 | ||
9 | + * | ||
10 | + * @icon fa fa-table | ||
11 | + * @remark 当使用到关联模型时需要重载index方法 | ||
12 | + */ | ||
13 | +class Relationmodel extends Backend | ||
14 | +{ | ||
15 | + protected $model = null; | ||
16 | + | ||
17 | + public function _initialize() | ||
18 | + { | ||
19 | + parent::_initialize(); | ||
20 | + $this->model = model('AdminLog'); | ||
21 | + } | ||
22 | + | ||
23 | + /** | ||
24 | + * 查看 | ||
25 | + */ | ||
26 | + public function index() | ||
27 | + { | ||
28 | + $this->relationSearch = true; | ||
29 | + $this->searchFields = "admin.username,id"; | ||
30 | + if ($this->request->isAjax()) { | ||
31 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
32 | + $total = $this->model | ||
33 | + ->with("admin") | ||
34 | + ->where($where) | ||
35 | + ->order($sort, $order) | ||
36 | + ->count(); | ||
37 | + $list = $this->model | ||
38 | + ->with("admin") | ||
39 | + ->where($where) | ||
40 | + ->order($sort, $order) | ||
41 | + ->limit($offset, $limit) | ||
42 | + ->select(); | ||
43 | + $result = array("total" => $total, "rows" => $list); | ||
44 | + | ||
45 | + return json($result); | ||
46 | + } | ||
47 | + return $this->view->fetch(); | ||
48 | + } | ||
49 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 表格联动 | ||
9 | + * | ||
10 | + * @icon fa fa-table | ||
11 | + */ | ||
12 | +class Tablelink extends Backend | ||
13 | +{ | ||
14 | + protected $model = null; | ||
15 | + protected $noNeedRight = ['table1', 'table2']; | ||
16 | + | ||
17 | + public function _initialize() | ||
18 | + { | ||
19 | + parent::_initialize(); | ||
20 | + $this->model = model('AdminLog'); | ||
21 | + } | ||
22 | + | ||
23 | + | ||
24 | + public function table1() | ||
25 | + { | ||
26 | + $this->model = model('Admin'); | ||
27 | + //设置过滤方法 | ||
28 | + $this->request->filter(['strip_tags']); | ||
29 | + if ($this->request->isAjax()) { | ||
30 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
31 | + if ($this->request->request('keyField')) { | ||
32 | + return $this->selectpage(); | ||
33 | + } | ||
34 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
35 | + $total = $this->model | ||
36 | + ->where($where) | ||
37 | + ->order($sort, $order) | ||
38 | + ->count(); | ||
39 | + | ||
40 | + $list = $this->model | ||
41 | + ->where($where) | ||
42 | + ->order($sort, $order) | ||
43 | + ->limit($offset, $limit) | ||
44 | + ->select(); | ||
45 | + | ||
46 | + $result = array("total" => $total, "rows" => $list); | ||
47 | + | ||
48 | + return json($result); | ||
49 | + } | ||
50 | + return $this->view->fetch('index'); | ||
51 | + } | ||
52 | + | ||
53 | + public function table2() | ||
54 | + { | ||
55 | + $this->model = model('AdminLog'); | ||
56 | + //设置过滤方法 | ||
57 | + $this->request->filter(['strip_tags']); | ||
58 | + if ($this->request->isAjax()) { | ||
59 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
60 | + if ($this->request->request('keyField')) { | ||
61 | + return $this->selectpage(); | ||
62 | + } | ||
63 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
64 | + $total = $this->model | ||
65 | + ->where($where) | ||
66 | + ->order($sort, $order) | ||
67 | + ->count(); | ||
68 | + | ||
69 | + $list = $this->model | ||
70 | + ->where($where) | ||
71 | + ->order($sort, $order) | ||
72 | + ->limit($offset, $limit) | ||
73 | + ->select(); | ||
74 | + | ||
75 | + $result = array("total" => $total, "rows" => $list); | ||
76 | + | ||
77 | + return json($result); | ||
78 | + } | ||
79 | + return $this->view->fetch('index'); | ||
80 | + } | ||
81 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\example; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 表格模板示例 | ||
9 | + * | ||
10 | + * @icon fa fa-table | ||
11 | + * @remark 可以通过使用表格模板将表格中的行渲染成一样的展现方式,基于此功能可以任意定制自己想要的展示列表 | ||
12 | + */ | ||
13 | +class Tabletemplate extends Backend | ||
14 | +{ | ||
15 | + protected $model = null; | ||
16 | + | ||
17 | + public function _initialize() | ||
18 | + { | ||
19 | + parent::_initialize(); | ||
20 | + $this->model = model('AdminLog'); | ||
21 | + } | ||
22 | + | ||
23 | + /** | ||
24 | + * 查看 | ||
25 | + */ | ||
26 | + public function index() | ||
27 | + { | ||
28 | + if ($this->request->isAjax()) { | ||
29 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(null); | ||
30 | + $total = $this->model | ||
31 | + ->where($where) | ||
32 | + ->order($sort, $order) | ||
33 | + ->count(); | ||
34 | + $list = $this->model | ||
35 | + ->where($where) | ||
36 | + ->order($sort, $order) | ||
37 | + ->limit($offset, $limit) | ||
38 | + ->select(); | ||
39 | + $result = array("total" => $total, "rows" => $list); | ||
40 | + | ||
41 | + return json($result); | ||
42 | + } | ||
43 | + return $this->view->fetch(); | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * 详情 | ||
48 | + */ | ||
49 | + public function detail($ids) | ||
50 | + { | ||
51 | + $row = $this->model->get(['id' => $ids]); | ||
52 | + if (!$row) { | ||
53 | + $this->error(__('No Results were found')); | ||
54 | + } | ||
55 | + $this->view->assign("row", $row->toArray()); | ||
56 | + return $this->view->fetch(); | ||
57 | + } | ||
58 | +} |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + {:build_toolbar('refresh,delete')} | ||
10 | + <a href="example/baidumap/map" class="btn btn-info btn-dialog" title="地图"><i class="fa fa-map-signs"></i> 地图</a> | ||
11 | + </div> | ||
12 | + <table id="table" class="table table-striped table-bordered table-hover" width="100%"> | ||
13 | + | ||
14 | + </table> | ||
15 | + | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + | ||
19 | + </div> | ||
20 | + </div> | ||
21 | +</div> |
1 | +{__NOLAYOUT__} | ||
2 | +<!DOCTYPE html> | ||
3 | +<html lang="{$config.language}"> | ||
4 | + <head> | ||
5 | + {include file="common/meta" /} | ||
6 | + <style type="text/css"> | ||
7 | + body, html,#allmap{width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";} | ||
8 | + #search{position:absolute;top:20px;left:20px;} | ||
9 | + </style> | ||
10 | + </head> | ||
11 | + | ||
12 | + <body class="inside-header inside-aside {:defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''}"> | ||
13 | + <div class="container-fluid" id="search"> | ||
14 | + <div class="row"> | ||
15 | + <div class="col-xs-12 col-sm-4"> | ||
16 | + <form role="form" action=""> | ||
17 | + <div class="input-group" style="width:300px;"> | ||
18 | + <input type="text" id="searchaddress" class="form-control selectpage" data-primary-key="name" data-source="example/baidumap/selectpage" /> | ||
19 | + <span class="input-group-btn"> | ||
20 | + <button class="btn btn-success btn-search" type="button">搜索</button> | ||
21 | + </span> | ||
22 | + </div> | ||
23 | + </form> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + <div id='allmap'></div> | ||
28 | + {include file="common/script" /} | ||
29 | + </body> | ||
30 | +</html> |
1 | +<table class="table table-striped"> | ||
2 | + <thead> | ||
3 | + <tr> | ||
4 | + <th>{:__('Title')}</th> | ||
5 | + <th>{:__('Content')}</th> | ||
6 | + </tr> | ||
7 | + </thead> | ||
8 | + <tbody> | ||
9 | + {volist name="row" id="vo" } | ||
10 | + <tr> | ||
11 | + <td>{$key}</td> | ||
12 | + <td>{$vo}</td> | ||
13 | + </tr> | ||
14 | + {/volist} | ||
15 | + {if $Think.get.dialog} | ||
16 | + <tr> | ||
17 | + <td>回传数据</td> | ||
18 | + <td> | ||
19 | + <div class="input-group"> | ||
20 | + <input name="callback" class="form-control" value="test" /> | ||
21 | + <span class="input-group-btn"><a href="javascript:;" class="btn btn-success btn-callback" >回传数据</a></span> | ||
22 | + </div> | ||
23 | + </td> | ||
24 | + </tr> | ||
25 | + {/if} | ||
26 | + </tbody> | ||
27 | +</table> | ||
28 | +<div class="hide layer-footer"> | ||
29 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
30 | + <div class="col-xs-12 col-sm-8"> | ||
31 | + <button type="reset" class="btn btn-primary btn-embossed btn-close" onclick="Layer.closeAll();">{:__('Close')}</button> | ||
32 | + </div> | ||
33 | +</div> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + {:build_toolbar('refresh,delete')} | ||
10 | + <a class="btn btn-info btn-disabled disabled btn-selected" href="javascript:;"><i class="fa fa-leaf"></i> 获取选中项</a> | ||
11 | + <div class="dropdown btn-group"> | ||
12 | + <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> <?= __('More') ?></a> | ||
13 | + <ul class="dropdown-menu text-left" role="menu"> | ||
14 | + <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li> | ||
15 | + <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li> | ||
16 | + </ul> | ||
17 | + </div> | ||
18 | + <a class="btn btn-success btn-singlesearch" href="javascript:;"><i class="fa fa-user"></i> 自定义搜索</a> | ||
19 | + <a class="btn btn-success btn-change btn-start" data-params="action=start" data-url="example/bootstraptable/start" href="javascript:;"><i class="fa fa-play"></i> 启动</a> | ||
20 | + <a class="btn btn-danger btn-change btn-pause" data-params="action=pause" data-url="example/bootstraptable/pause" href="javascript:;"><i class="fa fa-pause"></i> 暂停</a> | ||
21 | + <a href="javascript:;" class="btn btn-default" style="font-size:14px;color:dodgerblue;"> | ||
22 | + <i class="fa fa-dollar"></i> | ||
23 | + <span class="extend"> | ||
24 | + 金额:<span id="money">0</span> | ||
25 | + 单价:<span id="price">0</span> | ||
26 | + </span> | ||
27 | + </a> | ||
28 | + </div> | ||
29 | + <table id="table" class="table table-striped table-bordered table-hover" width="100%"> | ||
30 | + | ||
31 | + </table> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | + | ||
36 | + </div> | ||
37 | + </div> | ||
38 | +</div> | ||
39 | +<script id="categorytpl" type="text/html"> | ||
40 | + <div class="row"> | ||
41 | + <div class="col-xs-12"> | ||
42 | + <div class="form-inline" data-toggle="cxselect" data-selects="group,admin"> | ||
43 | + <select class="group form-control" name="group" data-url="example/bootstraptable/cxselect?type=group"></select> | ||
44 | + <select class="admin form-control" name="admin_id" data-url="example/bootstraptable/cxselect?type=admin" data-query-name="group_id"></select> | ||
45 | + <input type="hidden" class="operate" data-name="admin_id" value="=" /> | ||
46 | + </div> | ||
47 | + </div> | ||
48 | + </div> | ||
49 | +</script> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + {:build_toolbar('refresh,delete')} | ||
10 | + </div> | ||
11 | + <table id="table" class="table table-striped table-bordered table-hover" width="100%"> | ||
12 | + | ||
13 | + </table> | ||
14 | + | ||
15 | + | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + | ||
19 | + </div> | ||
20 | + </div> | ||
21 | +</div> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + {:build_toolbar('refresh,delete')} | ||
10 | + </div> | ||
11 | + <table id="table" class="table table-striped table-bordered table-hover" width="100%"> | ||
12 | + | ||
13 | + </table> | ||
14 | + | ||
15 | + | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + | ||
19 | + </div> | ||
20 | + </div> | ||
21 | +</div> |
1 | +<div class="row"> | ||
2 | + <div class="col-md-6"> | ||
3 | + <div class="box box-success"> | ||
4 | + <div class="panel-heading"> | ||
5 | + {:__('自定义图片描述')} | ||
6 | + </div> | ||
7 | + <div class="panel-body"> | ||
8 | + <div class="alert alert-success-light"> | ||
9 | + <b>温馨提示</b><br> | ||
10 | + 默认我们的多图是没有图片描述的,如果我们需要自定义描述,可以使用以下的自定义功能<br> | ||
11 | + 特别注意的是图片的url和描述是分开储存的,也就是说图片一个字段,描述一个字段,你在前台使用时需要自己匹配映射关系<br> | ||
12 | + <b>下面的演示textarea为了便于调试,设置为可见的,实际使用中应该添加个hidden的class进行隐藏</b> | ||
13 | + </div> | ||
14 | + <form id="first-form" role="form" data-toggle="validator" method="POST" action=""> | ||
15 | + <div class="form-group row"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2">{:__('一维数组示例')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <div class="input-group"> | ||
19 | + <input id="c-files" data-rule="required" class="form-control" size="50" name="row[files]" type="text" value="https://cdn.fastadmin.net/uploads/addons/blog.png,https://cdn.fastadmin.net/uploads/addons/cms.png,https://cdn.fastadmin.net/uploads/addons/vote.png"> | ||
20 | + <div class="input-group-addon no-border no-padding"> | ||
21 | + <span><button type="button" id="plupload-files" class="btn btn-danger plupload" data-input-id="c-files" data-mimetype="*" data-multiple="true" data-preview-id="p-files"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
22 | + <span><button type="button" id="fachoose-files" class="btn btn-primary fachoose" data-input-id="c-files" data-mimetype="*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
23 | + </div> | ||
24 | + <span class="msg-box n-right" for="c-files"></span> | ||
25 | + </div> | ||
26 | + | ||
27 | + <!--ul需要添加 data-template和data-name属性,并一一对应且唯一 --> | ||
28 | + <ul class="row list-inline plupload-preview" id="p-files" data-template="introtpl" data-name="row[intro]"></ul> | ||
29 | + | ||
30 | + <!--请注意 ul和textarea间不能存在其它任何元素,实际开发中textarea应该添加个hidden进行隐藏--> | ||
31 | + <textarea name="row[intro]" class="form-control" style="margin-top:5px;">["简洁响应式博客","CMS内容管理系统","在线投票系统"]</textarea> | ||
32 | + | ||
33 | + <!--这里自定义图片预览的模板 开始--> | ||
34 | + <script type="text/html" id="introtpl"> | ||
35 | + <li class="col-xs-3"> | ||
36 | + <a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"> | ||
37 | + <img src="<%=fullurl%>" class="img-responsive"> | ||
38 | + </a> | ||
39 | + <input type="text" name="row[intro][<%=index%>]" class="form-control" placeholder="请输入文件描述" value="<%=value?value:''%>"/> | ||
40 | + <a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a> | ||
41 | + </li> | ||
42 | + </script> | ||
43 | + <!--这里自定义图片预览的模板 结束--> | ||
44 | + </div> | ||
45 | + </div> | ||
46 | + <div class="form-group row"> | ||
47 | + <label class="control-label col-xs-12 col-sm-2">{:__('二维数组示例')}:</label> | ||
48 | + <div class="col-xs-12 col-sm-8"> | ||
49 | + <div class="input-group"> | ||
50 | + <input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="https://cdn.fastadmin.net/uploads/addons/example.png,https://cdn.fastadmin.net/uploads/addons/upyun.png,https://cdn.fastadmin.net/uploads/addons/alioss.png"> | ||
51 | + <div class="input-group-addon no-border no-padding"> | ||
52 | + <span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
53 | + <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
54 | + </div> | ||
55 | + <span class="msg-box n-right" for="c-images"></span> | ||
56 | + </div> | ||
57 | + | ||
58 | + <!--ul需要添加 data-template和data-name属性,并一一对应且唯一 --> | ||
59 | + <ul class="row list-inline plupload-preview" id="p-images" data-template="desctpl" data-name="row[desc]"></ul> | ||
60 | + | ||
61 | + <!--请注意 ul和textarea间不能存在其它任何元素,实际开发中textarea应该添加个hidden进行隐藏--> | ||
62 | + <textarea name="row[desc]" class="form-control" style="margin-top:5px;">[{"info":"开发者示例插件","size":"1M"},{"info":"又拍云储存整合","size":"2M"},{"info":"阿里OSS云储存","size":"1M"}]</textarea> | ||
63 | + | ||
64 | + <!--这里自定义图片预览的模板 开始--> | ||
65 | + <script type="text/html" id="desctpl"> | ||
66 | + <li class="col-xs-3"> | ||
67 | + <a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"> | ||
68 | + <img src="<%=fullurl%>" class="img-responsive"> | ||
69 | + </a> | ||
70 | + <input type="text" name="row[desc][<%=index%>][info]" class="form-control" placeholder="请输入插件描述" value="<%=value?value['info']:''%>"/> | ||
71 | + <input type="text" name="row[desc][<%=index%>][size]" class="form-control" placeholder="请输入插件大小" value="<%=value?value['size']:''%>"/> | ||
72 | + <a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a> | ||
73 | + </li> | ||
74 | + </script> | ||
75 | + <!--这里自定义图片预览的模板 结束--> | ||
76 | + </div> | ||
77 | + </div> | ||
78 | + <div class="form-group row"> | ||
79 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
80 | + <div class="col-xs-12 col-sm-8"> | ||
81 | + <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button> | ||
82 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
83 | + </div> | ||
84 | + </div> | ||
85 | + | ||
86 | + </form> | ||
87 | + </div> | ||
88 | + </div> | ||
89 | + | ||
90 | + </div> | ||
91 | + <div class="col-md-6"> | ||
92 | + <div class="box box-info"> | ||
93 | + <div class="panel-heading"> | ||
94 | + {:__('自定义Fieldlist示例')} | ||
95 | + </div> | ||
96 | + <div class="panel-body"> | ||
97 | + <div class="alert alert-danger-light"> | ||
98 | + <b>温馨提示</b><br> | ||
99 | + 默认我们的fieldlist只有一维数组,为键值形式,如果需要二维数组,可使用下面的自定义模板来实现<br> | ||
100 | + 默认追加的元素是没有进行事件绑定的,我们需要监听btn-append这个按钮的fa.event.appendfieldlist事件<br> | ||
101 | + <b>下面的演示textarea为了便于调试,设置为可见的,实际使用中应该添加个hidden的class进行隐藏</b> | ||
102 | + </div> | ||
103 | + <form id="second-form" role="form" data-toggle="validator" method="POST" action=""> | ||
104 | + | ||
105 | + <div class="form-group row"> | ||
106 | + <label class="control-label col-xs-12 col-sm-2">{:__('Fieldlist示例')}:</label> | ||
107 | + <div class="col-xs-12 col-sm-8"> | ||
108 | + <dl class="fieldlist" data-template="basictpl" data-name="row[basic]"> | ||
109 | + <dd> | ||
110 | + <ins>{:__('标题')}</ins> | ||
111 | + <ins>{:__('介绍')}</ins> | ||
112 | + <ins>{:__('大小')}</ins> | ||
113 | + </dd> | ||
114 | + <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd> | ||
115 | + <!--请注意 dd和textarea间不能存在其它任何元素,实际开发中textarea应该添加个hidden进行隐藏--> | ||
116 | + <textarea name="row[basic]" class="form-control" cols="30" rows="5">[{"title":"开发者示例插件","intro":"开发者必备","size":"1M"},{"title":"又拍云储存整合","intro":"一款云储存","size":"2M"},{"title":"阿里OSS云储存","intro":"一款云储存","size":"1M"}]</textarea> | ||
117 | + </dl> | ||
118 | + <script id="basictpl" type="text/html"> | ||
119 | + <dd class="form-inline"> | ||
120 | + <ins><input type="text" name="<%=name%>[<%=index%>][title]" class="form-control" value="<%=row.title%>" placeholder="标题" size="10"/></ins> | ||
121 | + <ins><input type="text" name="<%=name%>[<%=index%>][intro]" class="form-control" value="<%=row.intro%>" placeholder="描述"/></ins> | ||
122 | + <ins><input type="text" name="<%=name%>[<%=index%>][size]" class="form-control" value="<%=row.size%>" placeholder="大小"/></ins> | ||
123 | + <!--下面的两个按钮务必保留--> | ||
124 | + <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> | ||
125 | + <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span> | ||
126 | + </dd> | ||
127 | + </script> | ||
128 | + </div> | ||
129 | + </div> | ||
130 | + <div class="form-group row"> | ||
131 | + <label class="control-label col-xs-12 col-sm-2">{:__('元素事件')}:</label> | ||
132 | + <div class="col-xs-12 col-sm-8"> | ||
133 | + <dl class="fieldlist" data-template="eventtpl" data-name="row[event]"> | ||
134 | + <dd> | ||
135 | + <ins>{:__('管理员')}</ins> | ||
136 | + <ins>{:__('名称')}</ins> | ||
137 | + <ins>{:__('登录时间')}</ins> | ||
138 | + </dd> | ||
139 | + <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd> | ||
140 | + <!--请注意 dd和textarea间不能存在其它任何元素,实际开发中textarea应该添加个hidden进行隐藏--> | ||
141 | + <textarea name="row[event]" class="form-control" cols="30" rows="5">[{"id":"1","name":"admin","time":"2019-06-28 12:05:03"}]</textarea> | ||
142 | + </dl> | ||
143 | + <script id="eventtpl" type="text/html"> | ||
144 | + <dd class="form-inline"> | ||
145 | + <ins><input type="text" name="<%=name%>[<%=index%>][id]" class="form-control selectpage" data-source="auth/admin/selectpage" data-field="username" value="<%=row.id%>" placeholder="管理员" size="10"/></ins> | ||
146 | + <ins><input type="text" name="<%=name%>[<%=index%>][name]" class="form-control" value="<%=row.name%>" placeholder="名称"/></ins> | ||
147 | + <ins><input type="text" name="<%=name%>[<%=index%>][time]" class="form-control datetimepicker" value="<%=row.time%>" placeholder="时间"/></ins> | ||
148 | + <!--下面的两个按钮务必保留--> | ||
149 | + <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> | ||
150 | + <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span> | ||
151 | + </dd> | ||
152 | + </script> | ||
153 | + </div> | ||
154 | + </div> | ||
155 | + <div class="form-group row"> | ||
156 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
157 | + <div class="col-xs-12 col-sm-8"> | ||
158 | + <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button> | ||
159 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
160 | + </div> | ||
161 | + </div> | ||
162 | + | ||
163 | + </form> | ||
164 | + </div> | ||
165 | + </div> | ||
166 | + | ||
167 | + </div> | ||
168 | +</div> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + {:build_toolbar('refresh')} | ||
10 | + </div> | ||
11 | + <table id="table" class="table table-striped table-bordered table-hover" width="100%"> | ||
12 | + | ||
13 | + </table> | ||
14 | + | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + | ||
18 | + </div> | ||
19 | + </div> | ||
20 | +</div> | ||
21 | + | ||
22 | +<script id="customformtpl" type="text/html"> | ||
23 | + <!--form表单必须添加form-commsearch这个类--> | ||
24 | + <form action="" class="form-commonsearch"> | ||
25 | + <div style="border-radius:2px;margin-bottom:10px;background:#f5f5f5;padding:15px 20px;"> | ||
26 | + <h4>自定义搜索表单</h4> | ||
27 | + <hr> | ||
28 | + <div class="row"> | ||
29 | + <div class="col-xs-12 col-sm-6 col-md-3"> | ||
30 | + <div class="form-group"> | ||
31 | + <label class="control-label">ID</label> | ||
32 | + <!--显式的operate操作符--> | ||
33 | + <div class="input-group"> | ||
34 | + <div class="input-group-btn"> | ||
35 | + <select class="form-control operate" data-name="id" style="width:60px;"> | ||
36 | + <option value="=" selected>等于</option> | ||
37 | + <option value=">">大于</option> | ||
38 | + <option value="<">小于</option> | ||
39 | + </select> | ||
40 | + </div> | ||
41 | + <input class="form-control" type="text" name="id" placeholder="" value=""/> | ||
42 | + </div> | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + <div class="col-xs-12 col-sm-6 col-md-3"> | ||
46 | + <div class="form-group"> | ||
47 | + <label class="control-label">标题</label> | ||
48 | + <!--隐式的operate操作符,必须携带一个class为operate隐藏的文本框,且它的data-name="字段",值为操作符--> | ||
49 | + <input class="operate" type="hidden" data-name="title" value="="/> | ||
50 | + <div> | ||
51 | + <input class="form-control" type="text" name="title" placeholder="请输入查找的标题" value=""/> | ||
52 | + </div> | ||
53 | + </div> | ||
54 | + </div> | ||
55 | + <div class="col-xs-12 col-sm-6 col-md-3"> | ||
56 | + <div class="form-group"> | ||
57 | + <label class="control-label">管理员ID</label> | ||
58 | + <div class="row" data-toggle="cxselect" data-selects="group,admin"> | ||
59 | + <div class="col-xs-6"> | ||
60 | + <select class="group form-control" name="group" | ||
61 | + data-url="example/bootstraptable/cxselect?type=group"></select> | ||
62 | + </div> | ||
63 | + <div class="col-xs-6"> | ||
64 | + <select class="admin form-control" name="admin_id" | ||
65 | + data-url="example/bootstraptable/cxselect?type=admin" | ||
66 | + data-query-name="group_id"></select> | ||
67 | + </div> | ||
68 | + <input type="hidden" class="operate" data-name="admin_id" value="="/> | ||
69 | + </div> | ||
70 | + </div> | ||
71 | + </div> | ||
72 | + <div class="col-xs-12 col-sm-6 col-md-3"> | ||
73 | + <div class="form-group"> | ||
74 | + <label class="control-label">用户名</label> | ||
75 | + <input type="hidden" class="operate" data-name="username" value="="/> | ||
76 | + <div> | ||
77 | + <input id="c-category_id" data-source="auth/admin/index" data-primary-key="username" | ||
78 | + data-field="username" class="form-control selectpage" name="username" type="text" | ||
79 | + value="" style="display:block;"> | ||
80 | + </div> | ||
81 | + </div> | ||
82 | + </div> | ||
83 | + | ||
84 | + <div class="col-xs-12 col-sm-6 col-md-3" style="min-height:68px;"> | ||
85 | + <!--这里添加68px是为了避免刷新时出现元素错位闪屏--> | ||
86 | + <div class="form-group"> | ||
87 | + <label class="control-label">IP</label> | ||
88 | + <input type="hidden" class="operate" data-name="ip" value="in"/> | ||
89 | + <div> | ||
90 | + <!--给select一个固定的高度--> | ||
91 | + <select id="c-flag" class="form-control selectpicker" multiple name="ip" style="height:31px;"> | ||
92 | + {foreach name="ipList" item="vo"} | ||
93 | + <option value="{$key}" {in name="key" value="" }selected{ | ||
94 | + /in}>{$vo}</option> | ||
95 | + {/foreach} | ||
96 | + </select> | ||
97 | + </div> | ||
98 | + </div> | ||
99 | + </div> | ||
100 | + <div class="col-xs-12 col-sm-6 col-md-3"> | ||
101 | + <div class="form-group"> | ||
102 | + <label class="control-label">IP</label> | ||
103 | + <input type="hidden" class="operate" data-name="createtime" value="RANGE"/> | ||
104 | + <div> | ||
105 | + <input type="text" class="form-control datetimerange" name="createtime" value=""/> | ||
106 | + </div> | ||
107 | + </div> | ||
108 | + </div> | ||
109 | + <div class="col-xs-12 col-sm-6 col-md-3"> | ||
110 | + <div class="form-group"> | ||
111 | + <label class="control-label"></label> | ||
112 | + <div class="row"> | ||
113 | + <div class="col-xs-6"> | ||
114 | + <input type="submit" class="btn btn-success btn-block" value="提交"/> | ||
115 | + </div> | ||
116 | + <div class="col-xs-6"> | ||
117 | + <input type="reset" class="btn btn-primary btn-block" value="重置"/> | ||
118 | + </div> | ||
119 | + </div> | ||
120 | + </div> | ||
121 | + </div> | ||
122 | + </div> | ||
123 | + </div> | ||
124 | + </form> | ||
125 | +</script> |
1 | +<style>#cxselect-example textarea{margin:10px 0;}</style> | ||
2 | +<div class="panel panel-default panel-intro"> | ||
3 | + {:build_heading()} | ||
4 | + | ||
5 | + <div class="panel-body"> | ||
6 | + <div id="myTabContent" class="tab-content"> | ||
7 | + <div class="tab-pane fade active in" id="one"> | ||
8 | + <div class="widget-body no-padding" id="cxselect-example"> | ||
9 | + <form id="cxselectform" action=""> | ||
10 | + <div class="row"> | ||
11 | + <div class="col-md-6"> | ||
12 | + | ||
13 | + <div class="panel panel-default"> | ||
14 | + <div class="panel-heading"><b>省市区联动</b>(通过AJAX读取数据)</div> | ||
15 | + <div class="panel-body"> | ||
16 | + <div class="row"> | ||
17 | + <div class="col-xs-9"> | ||
18 | + <div class="form-inline" data-toggle="cxselect" data-selects="province,city,area"> | ||
19 | + <select class="province form-control" name="province" data-url="ajax/area"></select> | ||
20 | + <select class="city form-control" name="city" data-url="ajax/area"></select> | ||
21 | + <select class="area form-control" name="area" data-url="ajax/area"></select> | ||
22 | + </div> | ||
23 | + </div> | ||
24 | + <div class="col-xs-3 text-right"> | ||
25 | + <h6><label class="label label-primary"><i class="fa fa-pencil"></i> 增加</label></h6> | ||
26 | + </div> | ||
27 | + <div class="col-xs-12"> | ||
28 | + <textarea class="form-control" rows="8"> | ||
29 | + </textarea> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + <div class="row"> | ||
33 | + <div class="col-xs-9"> | ||
34 | + <div class="form-inline" data-toggle="cxselect" data-selects="province,city,area"> | ||
35 | + <select class="province form-control" name="province" data-url="ajax/area"> | ||
36 | + <option value="1964" selected>广东省</option> | ||
37 | + </select> | ||
38 | + <select class="city form-control" name="city" data-url="ajax/area"> | ||
39 | + <option value="1988" selected>深圳市</option> | ||
40 | + </select> | ||
41 | + <select class="area form-control" name="area" data-url="ajax/area"> | ||
42 | + <option value="1991" selected>南山区</option> | ||
43 | + </select> | ||
44 | + </div> | ||
45 | + </div> | ||
46 | + <div class="col-xs-3 text-right"> | ||
47 | + <h6><label class="label label-success"><i class="fa fa-edit"></i> 修改</label></h6> | ||
48 | + </div> | ||
49 | + <div class="col-xs-12"> | ||
50 | + <textarea class="form-control" rows="8"> | ||
51 | + </textarea> | ||
52 | + </div> | ||
53 | + </div> | ||
54 | + </div> | ||
55 | + | ||
56 | + </div> | ||
57 | + </div> | ||
58 | + <div class="col-md-6"> | ||
59 | + <div class="panel panel-default"> | ||
60 | + <div class="panel-heading"><b>类别联动</b>(Ajax读取数据)</div> | ||
61 | + <div class="panel-body"> | ||
62 | + <div class="row"> | ||
63 | + <div class="col-xs-9"> | ||
64 | + <div class="form-inline" data-toggle="cxselect" data-selects="first,second"> | ||
65 | + <select class="first form-control" name="first" data-url="ajax/category?type=page&pid=5"></select> | ||
66 | + <select class="second form-control" name="second" data-url="ajax/category" data-query-name="pid"></select> | ||
67 | + </div> | ||
68 | + </div> | ||
69 | + <div class="col-xs-3 text-right"> | ||
70 | + <h6><label class="label label-primary"><i class="fa fa-pencil"></i> 增加</label></h6> | ||
71 | + </div> | ||
72 | + <div class="col-xs-12"> | ||
73 | + <textarea class="form-control" rows="8"> | ||
74 | + </textarea> | ||
75 | + </div> | ||
76 | + </div> | ||
77 | + <div class="row"> | ||
78 | + <div class="col-xs-9"> | ||
79 | + <div class="form-inline" data-toggle="cxselect" data-selects="first,second"> | ||
80 | + <select class="first form-control" name="first" data-url="ajax/category?type=page&pid=5"> | ||
81 | + <option value="6" selected>网站建站</option> | ||
82 | + </select> | ||
83 | + <select class="second form-control" name="second" data-url="ajax/category" data-query-name="pid"> | ||
84 | + <option value="9" selected>移动端</option> | ||
85 | + </select> | ||
86 | + </div> | ||
87 | + </div> | ||
88 | + <div class="col-xs-3 text-right"> | ||
89 | + <h6><label class="label label-success"><i class="fa fa-edit"></i> 修改</label></h6> | ||
90 | + </div> | ||
91 | + <div class="col-xs-12"> | ||
92 | + <textarea class="form-control" rows="8"> | ||
93 | + </textarea> | ||
94 | + </div> | ||
95 | + </div> | ||
96 | + | ||
97 | + </div> | ||
98 | + </div> | ||
99 | + </div> | ||
100 | + <div class="col-md-6"> | ||
101 | + <div class="panel panel-default"> | ||
102 | + <div class="panel-heading"><b>省市区联动</b>(通过JSON渲染数据)</div> | ||
103 | + <div class="panel-body"> | ||
104 | + <div class="row"> | ||
105 | + <div class="col-xs-9"> | ||
106 | + <!--由于在初始化中修改了默认值,所以这里需要修改-jsonSpace/jsonValue/jsonName的值--> | ||
107 | + <div class="form-inline" data-toggle="cxselect" data-url="__CDN__/assets/libs/fastadmin-cxselect/js/cityData.min.json" | ||
108 | + data-selects="province,city,area" data-json-space="" data-json-name="n" data-json-value=""> | ||
109 | + <select class="province form-control" name="province"></select> | ||
110 | + <select class="city form-control" name="city"></select> | ||
111 | + <select class="area form-control" name="area"></select> | ||
112 | + </div> | ||
113 | + </div> | ||
114 | + <div class="col-xs-3 text-right"> | ||
115 | + <h6><label class="label label-primary"><i class="fa fa-pencil"></i> 增加</label></h6> | ||
116 | + </div> | ||
117 | + <div class="col-xs-12"> | ||
118 | + <textarea class="form-control" rows="8"> | ||
119 | + </textarea> | ||
120 | + </div> | ||
121 | + </div> | ||
122 | + <div class="row"> | ||
123 | + <div class="col-xs-9"> | ||
124 | + <!--由于在初始化中修改了默认值,所以这里需要修改-jsonSpace/jsonValue/jsonName的值--> | ||
125 | + <div class="form-inline" data-toggle="cxselect" data-url="__CDN__/assets/libs/fastadmin-cxselect/js/cityData.min.json" | ||
126 | + data-selects="province,city,area" data-json-space="" data-json-name="n" data-json-value=""> | ||
127 | + <select class="province form-control" data-first-title="选择省"> | ||
128 | + <option value="">请选择</option> | ||
129 | + <option value="浙江省" selected>浙江省</option> | ||
130 | + </select> | ||
131 | + <select class="city form-control" data-first-title="选择市"> | ||
132 | + <option value="">请选择</option> | ||
133 | + <option value="杭州市" selected>杭州市</option> | ||
134 | + </select> | ||
135 | + <select class="area form-control" data-first-title="选择地区"> | ||
136 | + <option value="">请选择</option> | ||
137 | + <option value="西湖区" selected>西湖区</option> | ||
138 | + </select> | ||
139 | + </div> | ||
140 | + </div> | ||
141 | + <div class="col-xs-3 text-right"> | ||
142 | + <h6><label class="label label-success"><i class="fa fa-edit"></i> 修改</label></h6> | ||
143 | + </div> | ||
144 | + <div class="col-xs-12"> | ||
145 | + <textarea class="form-control" rows="8"> | ||
146 | + </textarea> | ||
147 | + </div> | ||
148 | + </div> | ||
149 | + </div> | ||
150 | + | ||
151 | + </div> | ||
152 | + </div> | ||
153 | + </div> | ||
154 | + </form> | ||
155 | + </div> | ||
156 | + </div> | ||
157 | + | ||
158 | + </div> | ||
159 | + </div> | ||
160 | +</div> |
1 | +<style> | ||
2 | + .tab-content > .chart { | ||
3 | + padding: 10px; | ||
4 | + } | ||
5 | +</style> | ||
6 | +<div class="row"> | ||
7 | + <div class="col-lg-3 col-xs-6"> | ||
8 | + <!-- small box --> | ||
9 | + <div class="small-box bg-aqua"> | ||
10 | + <div class="inner"> | ||
11 | + <h3>150</h3> | ||
12 | + | ||
13 | + <p>今日订单</p> | ||
14 | + </div> | ||
15 | + <div class="icon"> | ||
16 | + <i class="fa fa-shopping-cart"></i> | ||
17 | + </div> | ||
18 | + <a href="#" class="small-box-footer">更多 <i class="fa fa-arrow-circle-right"></i></a> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <!-- ./col --> | ||
22 | + <div class="col-lg-3 col-xs-6"> | ||
23 | + <!-- small box --> | ||
24 | + <div class="small-box bg-green"> | ||
25 | + <div class="inner"> | ||
26 | + <h3>53<sup style="font-size: 20px">%</sup></h3> | ||
27 | + | ||
28 | + <p>同比增长率</p> | ||
29 | + </div> | ||
30 | + <div class="icon"> | ||
31 | + <i class="fa fa-area-chart"></i> | ||
32 | + </div> | ||
33 | + <a href="#" class="small-box-footer">更多 <i class="fa fa-arrow-circle-right"></i></a> | ||
34 | + </div> | ||
35 | + </div> | ||
36 | + <!-- ./col --> | ||
37 | + <div class="col-lg-3 col-xs-6"> | ||
38 | + <!-- small box --> | ||
39 | + <div class="small-box bg-yellow"> | ||
40 | + <div class="inner"> | ||
41 | + <h3>44</h3> | ||
42 | + | ||
43 | + <p>今日注册用户数</p> | ||
44 | + </div> | ||
45 | + <div class="icon"> | ||
46 | + <i class="fa fa-users"></i> | ||
47 | + </div> | ||
48 | + <a href="#" class="small-box-footer">更多 <i class="fa fa-arrow-circle-right"></i></a> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + <!-- ./col --> | ||
52 | + <div class="col-lg-3 col-xs-6"> | ||
53 | + <!-- small box --> | ||
54 | + <div class="small-box bg-red"> | ||
55 | + <div class="inner"> | ||
56 | + <h3>65</h3> | ||
57 | + | ||
58 | + <p>唯一访客用户</p> | ||
59 | + </div> | ||
60 | + <div class="icon"> | ||
61 | + <i class="fa fa-user"></i> | ||
62 | + </div> | ||
63 | + <a href="#" class="small-box-footer">更多 <i class="fa fa-arrow-circle-right"></i></a> | ||
64 | + </div> | ||
65 | + </div> | ||
66 | + <!-- ./col --> | ||
67 | +</div> | ||
68 | +<!-- /.row --> | ||
69 | +<!-- Main row --> | ||
70 | +<div class="row" style="margin-bottom:5px;"> | ||
71 | + <!-- Left col --> | ||
72 | + <section class="col-lg-7 connectedSortable"> | ||
73 | + <!-- Custom tabs (Charts with tabs)--> | ||
74 | + <div class="nav-tabs-custom charts-custom"> | ||
75 | + <!-- Tabs within a box --> | ||
76 | + <ul class="nav nav-tabs pull-right"> | ||
77 | + <li class="active"><a href="#line-chart" data-toggle="tab">折线图</a></li> | ||
78 | + <li><a href="#area-chart" data-toggle="tab">区域图</a></li> | ||
79 | + <li class="pull-left header"><i class="fa fa-inbox"></i> 销售趋势</li> | ||
80 | + </ul> | ||
81 | + <div class="tab-content no-padding"> | ||
82 | + <!-- Morris chart - Sales --> | ||
83 | + <div class="chart tab-pane active" id="line-chart" style="position: relative; height: 300px;"></div> | ||
84 | + <div class="chart tab-pane" id="area-chart" style="position: relative; height: 300px;"></div> | ||
85 | + </div> | ||
86 | + </div> | ||
87 | + <div class="nav-tabs-custom charts-custom"> | ||
88 | + <!-- Tabs within a box --> | ||
89 | + <ul class="nav nav-tabs pull-right"> | ||
90 | + <li class="active"><a href="#pie-chart" data-toggle="tab">饼图</a></li> | ||
91 | + <li><a href="#bar-chart" data-toggle="tab">柱状图</a></li> | ||
92 | + <li class="pull-left header"><i class="fa fa-inbox"></i> 访问记录</li> | ||
93 | + </ul> | ||
94 | + <div class="tab-content no-padding"> | ||
95 | + <!-- Morris chart - Sales --> | ||
96 | + <div class="chart tab-pane active" id="pie-chart" style="position: relative; height: 300px;"></div> | ||
97 | + <div class="chart tab-pane" id="bar-chart" style="position: relative; height: 300px;"></div> | ||
98 | + </div> | ||
99 | + </div> | ||
100 | + <!-- /.nav-tabs-custom --> | ||
101 | + | ||
102 | + </section> | ||
103 | + <!-- /.Left col --> | ||
104 | + <section class="col-lg-5 connectedSortable"> | ||
105 | + | ||
106 | + <!-- Map box --> | ||
107 | + <div class="box box-solid bg-light-blue-gradient"> | ||
108 | + <div class="box-header"> | ||
109 | + <!-- tools box --> | ||
110 | + <div class="pull-right box-tools"> | ||
111 | + </div> | ||
112 | + <!-- /. tools --> | ||
113 | + | ||
114 | + <i class="fa fa-map-marker"></i> | ||
115 | + | ||
116 | + <h3 class="box-title"> | ||
117 | + 访客分布 | ||
118 | + </h3> | ||
119 | + </div> | ||
120 | + <div class="box-body"> | ||
121 | + <div id="simplebar-chart" style="height: 250px; width: 100%;"></div> | ||
122 | + </div> | ||
123 | + <!-- /.box-body--> | ||
124 | + <div class="box-footer no-border"> | ||
125 | + <div class="row"> | ||
126 | + <div class="col-xs-12 text-center"> | ||
127 | + <div class="knob-label">统计最近一周访客的记录</div> | ||
128 | + </div> | ||
129 | + <!-- ./col --> | ||
130 | + </div> | ||
131 | + <!-- /.row --> | ||
132 | + </div> | ||
133 | + </div> | ||
134 | + <!-- /.box --> | ||
135 | + | ||
136 | + <!-- solid sales graph --> | ||
137 | + <div class="box box-solid bg-teal-gradient"> | ||
138 | + <div class="box-header"> | ||
139 | + <i class="fa fa-th"></i> | ||
140 | + | ||
141 | + <h3 class="box-title">订单趋势</h3> | ||
142 | + | ||
143 | + <div class="box-tools pull-right"> | ||
144 | + </div> | ||
145 | + </div> | ||
146 | + <div class="box-body border-radius-none"> | ||
147 | + <div class="chart" id="smoothline-chart" style="height: 250px;"></div> | ||
148 | + </div> | ||
149 | + <!-- /.box-body--> | ||
150 | + <div class="box-footer no-border"> | ||
151 | + <div class="row"> | ||
152 | + <div class="col-xs-12 text-center"> | ||
153 | + <div class="knob-label">统计最近一周订单的趋势</div> | ||
154 | + </div> | ||
155 | + <!-- ./col --> | ||
156 | + </div> | ||
157 | + <!-- /.row --> | ||
158 | + </div> | ||
159 | + </div> | ||
160 | + <!-- /.box --> | ||
161 | + | ||
162 | + </section> | ||
163 | + <!-- right col --> | ||
164 | +</div> | ||
165 | +<!-- /.row (main row) --> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + <div class="panel-heading"> | ||
3 | + <div class="panel-lead"><em>多表格(Multitable)</em>用于展示在一个页面展示多个表格数据,并且每次切换时刷新</div> | ||
4 | + <ul class="nav nav-tabs"> | ||
5 | + <li class="active"><a href="#first" data-toggle="tab">表格1</a></li> | ||
6 | + <li><a href="#second" data-toggle="tab">表格2</a></li> | ||
7 | + </ul> | ||
8 | + </div> | ||
9 | + <div class="panel-body"> | ||
10 | + <div id="myTabContent" class="tab-content"> | ||
11 | + <div class="tab-pane fade active in" id="first"> | ||
12 | + <div id="toolbar1" class="toolbar"> | ||
13 | + {:build_toolbar('refresh')} | ||
14 | + </div> | ||
15 | + <table id="table1" class="table table-striped table-bordered table-hover" width="100%"> | ||
16 | + </table> | ||
17 | + </div> | ||
18 | + <div class="tab-pane fade" id="second"> | ||
19 | + <div id="toolbar2" class="toolbar"> | ||
20 | + {:build_toolbar('refresh')} | ||
21 | + </div> | ||
22 | + <table id="table2" class="table table-striped table-bordered table-hover" width="100%"> | ||
23 | + </table> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | +</div> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + {:build_toolbar('refresh,delete')} | ||
10 | + </div> | ||
11 | + <table id="table" class="table table-striped table-bordered table-hover" width="100%"> | ||
12 | + | ||
13 | + </table> | ||
14 | + | ||
15 | + | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + | ||
19 | + </div> | ||
20 | + </div> | ||
21 | +</div> |
1 | +<div class="row"> | ||
2 | + <div class="col-xs-12 col-sm-6 col-md-5 col-lg-4"> | ||
3 | + <div class="panel panel-default panel-intro"> | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="1" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar1" class="toolbar"> | ||
9 | + {:build_toolbar('refresh')} | ||
10 | + </div> | ||
11 | + <table id="table1" class="table table-striped table-bordered table-hover" width="100%"> | ||
12 | + | ||
13 | + </table> | ||
14 | + | ||
15 | + | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | + </div> | ||
23 | + <div class="col-xs-12 col-sm-6 col-md-7 col-lg-8"> | ||
24 | + <div class="panel panel-default panel-intro"> | ||
25 | + <div class="panel-body"> | ||
26 | + <div id="myTabContent2" class="tab-content"> | ||
27 | + <div class="tab-pane fade active in" id="two"> | ||
28 | + <div class="widget-body no-padding"> | ||
29 | + <div id="toolbar2" class="toolbar"> | ||
30 | + {:build_toolbar('refresh')} | ||
31 | + </div> | ||
32 | + <table id="table2" class="table table-striped table-bordered table-hover" width="100%"> | ||
33 | + | ||
34 | + </table> | ||
35 | + | ||
36 | + | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + | ||
40 | + </div> | ||
41 | + </div> | ||
42 | + </div> | ||
43 | + </div> | ||
44 | +</div> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + {:build_toolbar('refresh,delete')} | ||
10 | + <a class="btn btn-info btn-disabled disabled btn-selected" href="javascript:;"><i class="fa fa-leaf"></i> 获取选中项</a> | ||
11 | + <a class="btn btn-success btn-toggle-view" href="javascript:;"><i class="fa fa-leaf"></i> 切换视图</a> | ||
12 | + </div> | ||
13 | + <table id="table" class="table table-striped table-hover" width="100%"> | ||
14 | + | ||
15 | + </table> | ||
16 | + | ||
17 | + </div> | ||
18 | + </div> | ||
19 | + | ||
20 | + </div> | ||
21 | + </div> | ||
22 | +</div> | ||
23 | +<style type="text/css"> | ||
24 | + .example { | ||
25 | + height:100%;position: relative; | ||
26 | + } | ||
27 | + .example > span { | ||
28 | + position:absolute;left:15px;top:15px; | ||
29 | + } | ||
30 | +</style> | ||
31 | + | ||
32 | +<script id="itemtpl" type="text/html"> | ||
33 | + <!-- | ||
34 | + 如果启用了templateView,默认调用的是itemtpl这个模板,可以通过设置templateFormatter来修改 | ||
35 | + 在当前模板中可以使用三个变量(item:行数据,i:当前第几行,data:所有的行数据) | ||
36 | + 此模板引擎使用的是art-template的native,可参考官方文档 | ||
37 | + --> | ||
38 | + | ||
39 | + <div class="col-sm-4 col-md-3"> | ||
40 | + <!--下面四行是为了展示随机图片和标签,可移除--> | ||
41 | + <% var imagearr = ['https://cdn.fastadmin.net/uploads/addons/blog.png', 'https://cdn.fastadmin.net/uploads/addons/cms.png', 'https://cdn.fastadmin.net/uploads/addons/vote.png', 'https://cdn.fastadmin.net/uploads/addons/blog.png', 'https://cdn.fastadmin.net/uploads/addons/alisms.png']; %> | ||
42 | + <% var image = imagearr[item.id % 5]; %> | ||
43 | + <% var labelarr = ['primary', 'success', 'info', 'danger', 'warning']; %> | ||
44 | + <% var label = labelarr[item.id % 5]; %> | ||
45 | + <div class="thumbnail example"> | ||
46 | + <span class="btn btn-<%=label%>">ID:<%=item.id%></span> | ||
47 | + <img src="<%=image%>" style="width:100%;" alt="<%=item.title%>"> | ||
48 | + <div class="caption"> | ||
49 | + <h4><%=item.title?item.title:'无'%></h4> | ||
50 | + <p class="text-muted">操作者IP:<%=item.ip%></p> | ||
51 | + <p class="text-muted">操作时间:<%=Moment(item.createtime*1000).format("YYYY-MM-DD HH:mm:ss")%></p> | ||
52 | + <p> | ||
53 | + <!--详情的事件需要在JS中手动绑定--> | ||
54 | + <a href="#" class="btn btn-primary btn-success btn-detail" data-id="<%=item.id%>"><i class="fa fa-camera"></i> 详情</a> | ||
55 | + | ||
56 | + <!--如果需要响应编辑或删除事件,可以给元素添加 btn-edit或btn-del的类和data-id这个属性值--> | ||
57 | + <a href="#" class="btn btn-primary btn-edit" data-id="<%=item.id%>"><i class="fa fa-pencil"></i> 编辑</a> | ||
58 | + <a href="#" class="btn btn-danger btn-del" data-id="<%=item.id%>"><i class="fa fa-times"></i> 删除</a> | ||
59 | + <span class="pull-right" style="margin-top:10px;"> | ||
60 | + <!--如果需要多选操作,请确保有下面的checkbox元素存在,可移除--> | ||
61 | + <input name="checkbox" data-id="<%=item.id%>" type="checkbox" /> | ||
62 | + </span> | ||
63 | + </p> | ||
64 | + </div> | ||
65 | + </div> | ||
66 | + </div> | ||
67 | +</script> |
addons/example/assets/css/common.css
0 → 100644
1 | +/*! | ||
2 | + * Start Bootstrap - Modern Business (http://startbootstrap.com/) | ||
3 | + * Copyright 2013-2016 Start Bootstrap | ||
4 | + * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE) | ||
5 | + */ | ||
6 | + | ||
7 | +/* Global Styles */ | ||
8 | + | ||
9 | +html, | ||
10 | +body { | ||
11 | + height: 100%; | ||
12 | +} | ||
13 | + | ||
14 | +body { | ||
15 | + padding-top: 50px; /* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */ | ||
16 | + -webkit-font-smoothing: antialiased; | ||
17 | + -moz-osx-font-smoothing: grayscale; | ||
18 | + font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; | ||
19 | +} | ||
20 | + | ||
21 | +.img-addon { | ||
22 | + margin-bottom: 10px; | ||
23 | + width:100%; | ||
24 | +} | ||
25 | + | ||
26 | +.img-hover:hover { | ||
27 | + opacity: 0.8; | ||
28 | +} | ||
29 | + | ||
30 | +.display-1 { | ||
31 | + font-size:44px; | ||
32 | +} | ||
33 | +.display-4 { | ||
34 | + font-size:24px; | ||
35 | + line-height:32px; | ||
36 | +} | ||
37 | + | ||
38 | +/* Home Page Carousel */ | ||
39 | + | ||
40 | +header.carousel { | ||
41 | + height: 50%; | ||
42 | +} | ||
43 | + | ||
44 | +header.carousel .item, | ||
45 | +header.carousel .item.active, | ||
46 | +header.carousel .carousel-inner { | ||
47 | + height: 100%; | ||
48 | +} | ||
49 | + | ||
50 | +header.carousel .fill { | ||
51 | + width: 100%; | ||
52 | + height: 100%; | ||
53 | +} | ||
54 | + | ||
55 | +/* 404 Page Styles */ | ||
56 | + | ||
57 | +.error-404 { | ||
58 | + font-size: 100px; | ||
59 | +} | ||
60 | + | ||
61 | +/* Pricing Page Styles */ | ||
62 | + | ||
63 | +.price { | ||
64 | + display: block; | ||
65 | + font-size: 50px; | ||
66 | + line-height: 50px; | ||
67 | +} | ||
68 | + | ||
69 | +.price sup { | ||
70 | + top: -20px; | ||
71 | + left: 2px; | ||
72 | + font-size: 20px; | ||
73 | +} | ||
74 | + | ||
75 | +.period { | ||
76 | + display: block; | ||
77 | + font-style: italic; | ||
78 | +} | ||
79 | + | ||
80 | +/* Footer Styles */ | ||
81 | + | ||
82 | +footer { | ||
83 | + margin: 50px 0; | ||
84 | +} | ||
85 | + | ||
86 | +/* Responsive Styles */ | ||
87 | + | ||
88 | +@media(max-width:991px) { | ||
89 | + .customer-img, | ||
90 | + .img-related { | ||
91 | + margin-bottom: 30px; | ||
92 | + } | ||
93 | +} | ||
94 | + | ||
95 | +@media(max-width:767px) { | ||
96 | + .img-addon { | ||
97 | + margin-bottom: 15px; | ||
98 | + } | ||
99 | + | ||
100 | + header.carousel .carousel { | ||
101 | + height: 70%; | ||
102 | + } | ||
103 | +} | ||
104 | +.carousel-body { | ||
105 | + position:absolute; | ||
106 | + width: 100%; | ||
107 | + top:25%; | ||
108 | + text-align:center; | ||
109 | + color:#fff; | ||
110 | +} | ||
111 | + | ||
112 | +.addonlist a > p{ | ||
113 | + margin-bottom:15px; | ||
114 | +} |
addons/example/assets/js/async.js
0 → 100644
1 | +/** @license | ||
2 | + * RequireJS plugin for async dependency load like JSONP and Google Maps | ||
3 | + * Author: Miller Medeiros | ||
4 | + * Version: 0.1.2 (2014/02/24) | ||
5 | + * Released under the MIT license | ||
6 | + */ | ||
7 | +define(function(){ | ||
8 | + | ||
9 | + var DEFAULT_PARAM_NAME = 'callback', | ||
10 | + _uid = 0; | ||
11 | + | ||
12 | + function injectScript(src){ | ||
13 | + var s, t; | ||
14 | + s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = src; | ||
15 | + t = document.getElementsByTagName('script')[0]; t.parentNode.insertBefore(s,t); | ||
16 | + } | ||
17 | + | ||
18 | + function formatUrl(name, id){ | ||
19 | + var paramRegex = /!(.+)/, | ||
20 | + url = name.replace(paramRegex, ''), | ||
21 | + param = (paramRegex.test(name))? name.replace(/.+!/, '') : DEFAULT_PARAM_NAME; | ||
22 | + url += (url.indexOf('?') < 0)? '?' : '&'; | ||
23 | + return url + param +'='+ id; | ||
24 | + } | ||
25 | + | ||
26 | + function uid() { | ||
27 | + _uid += 1; | ||
28 | + return '__async_req_'+ _uid +'__'; | ||
29 | + } | ||
30 | + | ||
31 | + return{ | ||
32 | + load : function(name, req, onLoad, config){ | ||
33 | + if(config.isBuild){ | ||
34 | + onLoad(null); //avoid errors on the optimizer | ||
35 | + }else{ | ||
36 | + var id = uid(); | ||
37 | + //create a global variable that stores onLoad so callback | ||
38 | + //function can define new module after async load | ||
39 | + window[id] = onLoad; | ||
40 | + injectScript(formatUrl(req.toUrl(name), id)); | ||
41 | + } | ||
42 | + } | ||
43 | + }; | ||
44 | +}); |
addons/example/bootstrap.js
0 → 100644
addons/example/config.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + [ | ||
5 | + 'name' => 'title', | ||
6 | + 'title' => '标题', | ||
7 | + 'type' => 'string', | ||
8 | + 'content' => [ | ||
9 | + ], | ||
10 | + 'value' => '示例标题', | ||
11 | + 'rule' => 'required', | ||
12 | + 'msg' => '', | ||
13 | + 'tip' => '', | ||
14 | + 'ok' => '', | ||
15 | + 'extend' => '' | ||
16 | + ], | ||
17 | + [ | ||
18 | + //配置唯一标识 | ||
19 | + 'name' => 'theme', | ||
20 | + //显示的标题 | ||
21 | + 'title' => '皮肤', | ||
22 | + //类型 | ||
23 | + 'type' => 'string', | ||
24 | + //数据字典 | ||
25 | + 'content' => [ | ||
26 | + ], | ||
27 | + //值 | ||
28 | + 'value' => 'default', | ||
29 | + //验证规则 | ||
30 | + 'rule' => 'required', | ||
31 | + //错误消息 | ||
32 | + 'msg' => '', | ||
33 | + //提示消息 | ||
34 | + 'tip' => '', | ||
35 | + //成功消息 | ||
36 | + 'ok' => '', | ||
37 | + //扩展信息 | ||
38 | + 'extend' => '' | ||
39 | + ], | ||
40 | + [ | ||
41 | + 'name' => 'domain', | ||
42 | + 'title' => '绑定二级域名前缀', | ||
43 | + 'type' => 'string', | ||
44 | + 'content' => [ | ||
45 | + ], | ||
46 | + 'value' => '', | ||
47 | + 'rule' => '', | ||
48 | + 'msg' => '', | ||
49 | + 'tip' => '', | ||
50 | + 'ok' => '', | ||
51 | + 'extend' => '' | ||
52 | + ], | ||
53 | + [ | ||
54 | + 'name' => 'rewrite', | ||
55 | + 'title' => '伪静态', | ||
56 | + 'type' => 'array', | ||
57 | + 'content' => [], | ||
58 | + 'value' => [ | ||
59 | + 'index/index' => '/example$', | ||
60 | + 'demo/index' => '/example/d/[:name]', | ||
61 | + 'demo/demo1' => '/example/d1/[:name]', | ||
62 | + 'demo/demo2' => '/example/d2/[:name]', | ||
63 | + ], | ||
64 | + 'rule' => 'required', | ||
65 | + 'msg' => '', | ||
66 | + 'tip' => '', | ||
67 | + 'ok' => '', | ||
68 | + 'extend' => '' | ||
69 | + ], | ||
70 | +]; |
addons/example/controller/Demo.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace addons\example\controller; | ||
4 | + | ||
5 | +use think\addons\Controller; | ||
6 | + | ||
7 | +/** | ||
8 | + * 测试控制器 | ||
9 | + */ | ||
10 | +class Demo extends Controller | ||
11 | +{ | ||
12 | + | ||
13 | + protected $layout = 'default'; | ||
14 | + protected $noNeedLogin = ['index', 'demo1']; | ||
15 | + protected $noNeedRight = ['*']; | ||
16 | + | ||
17 | + public function index() | ||
18 | + { | ||
19 | + return $this->view->fetch(); | ||
20 | + } | ||
21 | + | ||
22 | + public function demo1() | ||
23 | + { | ||
24 | + return $this->view->fetch(); | ||
25 | + } | ||
26 | + | ||
27 | + public function demo2() | ||
28 | + { | ||
29 | + return $this->view->fetch(); | ||
30 | + } | ||
31 | + | ||
32 | +} |
addons/example/controller/Index.php
0 → 100644
addons/example/info.ini
0 → 100644
addons/example/install.sql
0 → 100644
此 diff 太大无法显示。
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + var Controller = { | ||
3 | + index: function () { | ||
4 | + // | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'example/baidumap/index', | ||
9 | + add_url: 'example/baidumap/add', | ||
10 | + edit_url: 'example/baidumap/edit', | ||
11 | + del_url: 'example/baidumap/del', | ||
12 | + multi_url: 'example/baidumap/multi', | ||
13 | + table: '', | ||
14 | + } | ||
15 | + }); | ||
16 | + | ||
17 | + var table = $("#table"); | ||
18 | + | ||
19 | + // 初始化表格 | ||
20 | + table.bootstrapTable({ | ||
21 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
22 | + pk: 'id', | ||
23 | + sortName: 'id', | ||
24 | + columns: [ | ||
25 | + [ | ||
26 | + {checkbox: true}, | ||
27 | + {field: 'id', title: 'ID', operate: false}, | ||
28 | + {field: 'admin_id', title: __('Admin_id'), visible: false, operate: false}, | ||
29 | + {field: 'username', title: __('Username'), formatter: Table.api.formatter.search}, | ||
30 | + {field: 'title', title: __('Title')}, | ||
31 | + {field: 'url', title: __('Url'), align: 'left'}, | ||
32 | + {field: 'ip', title: __('IP')}, | ||
33 | + {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||
34 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
35 | + ] | ||
36 | + ] | ||
37 | + }); | ||
38 | + | ||
39 | + // 为表格绑定事件 | ||
40 | + Table.api.bindevent(table); | ||
41 | + }, | ||
42 | + add: function () { | ||
43 | + Controller.api.bindevent(); | ||
44 | + }, | ||
45 | + edit: function () { | ||
46 | + Controller.api.bindevent(); | ||
47 | + }, | ||
48 | + map: function () { | ||
49 | + Form.api.bindevent($("form[role=form]")); | ||
50 | + require(['async!BMap'], function () { | ||
51 | + // 更多文档可参考 http://lbsyun.baidu.com/jsdemo.htm | ||
52 | + // 百度地图API功能 | ||
53 | + var map = new BMap.Map("allmap"); | ||
54 | + var point = new BMap.Point(116.404, 39.915); | ||
55 | + | ||
56 | + map.centerAndZoom(point, 13); //设置中心坐标点和级别 | ||
57 | + var marker = new BMap.Marker(point); // 创建标注 | ||
58 | + map.addOverlay(marker); // 将标注添加到地图中 | ||
59 | + marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画 | ||
60 | + | ||
61 | + map.enableDragging(); //开启拖拽 | ||
62 | + //map.enableInertialDragging(); //开启惯性拖拽 | ||
63 | + map.enableScrollWheelZoom(true); //是否允许缩放 | ||
64 | + //map.centerAndZoom("上海",15); //根据城市名设定地图中心点 | ||
65 | + | ||
66 | + var geolocation = new BMap.Geolocation(); | ||
67 | + geolocation.getCurrentPosition(function (r) { | ||
68 | + if (this.getStatus() == BMAP_STATUS_SUCCESS) { | ||
69 | + var mk = new BMap.Marker(r.point); | ||
70 | + map.addOverlay(mk); | ||
71 | + map.panTo(r.point); | ||
72 | + //Layer.alert('您的位置:' + r.point.lng + ',' + r.point.lat); | ||
73 | + } else { | ||
74 | + Layer.alert('failed' + this.getStatus()); | ||
75 | + } | ||
76 | + }, {enableHighAccuracy: true}); | ||
77 | + | ||
78 | + // 点搜索按钮时解析地址坐标 | ||
79 | + $(document).on('click', '.btn-search', function () { | ||
80 | + // 创建地址解析器实例 | ||
81 | + var myGeo = new BMap.Geocoder(); | ||
82 | + // 将地址解析结果显示在地图上,并调整地图视野 | ||
83 | + myGeo.getPoint($("#searchaddress").val(), function (point) { | ||
84 | + if (point) { | ||
85 | + map.centerAndZoom(point, 16); | ||
86 | + map.addOverlay(new BMap.Marker(point)); | ||
87 | + } else { | ||
88 | + Layer.alert("您选择地址没有解析到结果!"); | ||
89 | + } | ||
90 | + }); | ||
91 | + }); | ||
92 | + | ||
93 | + }); | ||
94 | + }, | ||
95 | + api: { | ||
96 | + bindevent: function () { | ||
97 | + Form.api.bindevent($("form[role=form]")); | ||
98 | + } | ||
99 | + } | ||
100 | + }; | ||
101 | + return Controller; | ||
102 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'example/bootstraptable/index', | ||
9 | + add_url: '', | ||
10 | + edit_url: '', | ||
11 | + del_url: 'example/bootstraptable/del', | ||
12 | + multi_url: '', | ||
13 | + } | ||
14 | + }); | ||
15 | + | ||
16 | + var table = $("#table"); | ||
17 | + | ||
18 | + //在普通搜索提交搜索前 | ||
19 | + table.on('common-search.bs.table', function (event, table, query) { | ||
20 | + //这里可以获取到普通搜索表单中字段的查询条件 | ||
21 | + console.log(query); | ||
22 | + }); | ||
23 | + | ||
24 | + //在普通搜索渲染后 | ||
25 | + table.on('post-common-search.bs.table', function (event, table) { | ||
26 | + var form = $("form", table.$commonsearch); | ||
27 | + $("input[name='title']", form).addClass("selectpage").data("source", "auth/adminlog/selectpage").data("primaryKey", "title").data("field", "title").data("orderBy", "id desc"); | ||
28 | + $("input[name='username']", form).addClass("selectpage").data("source", "auth/admin/index").data("primaryKey", "username").data("field", "username").data("orderBy", "id desc"); | ||
29 | + Form.events.cxselect(form); | ||
30 | + Form.events.selectpage(form); | ||
31 | + }); | ||
32 | + | ||
33 | + //在表格内容渲染完成后回调的事件 | ||
34 | + table.on('post-body.bs.table', function (e, settings, json, xhr) { | ||
35 | + console.log(e, settings, json, xhr); | ||
36 | + }); | ||
37 | + | ||
38 | + //当表格数据加载完成时 | ||
39 | + table.on('load-success.bs.table', function (e, data) { | ||
40 | + //这里可以获取从服务端获取的JSON数据 | ||
41 | + console.log(data); | ||
42 | + //这里我们手动设置底部的值 | ||
43 | + $("#money").text(data.extend.money); | ||
44 | + $("#price").text(data.extend.price); | ||
45 | + }); | ||
46 | + | ||
47 | + // 初始化表格 | ||
48 | + // 这里使用的是Bootstrap-table插件渲染表格 | ||
49 | + // 相关文档:https://doc.fastadmin.net/doc/table.html | ||
50 | + table.bootstrapTable({ | ||
51 | + //表格参数可以参考:https://doc.fastadmin.net/doc/190.html | ||
52 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
53 | + columns: [ | ||
54 | + [ | ||
55 | + //更多列参数可以参考:https://doc.fastadmin.net/doc/191.html | ||
56 | + //该列为复选框字段,如果后台的返回state值将会默认选中 | ||
57 | + {field: 'state', checkbox: true,}, | ||
58 | + //sortable为是否排序,operate为搜索时的操作符,visible表示是否可见 | ||
59 | + {field: 'id', title: 'ID', sortable: true, operate: false}, | ||
60 | + //默认隐藏该列 | ||
61 | + {field: 'admin_id', title: __('管理员'), operate: false}, | ||
62 | + //直接响应搜索 | ||
63 | + {field: 'username', title: __('管理员'), formatter: Table.api.formatter.search}, | ||
64 | + //模糊搜索 | ||
65 | + {field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索,*表示任意字符'}, | ||
66 | + //通过Ajax渲染searchList,也可以使用JSON数据 | ||
67 | + { | ||
68 | + field: 'url', | ||
69 | + title: __('Url'), | ||
70 | + align: 'left', | ||
71 | + searchList: $.getJSON('example/bootstraptable/searchlist?search=a&field=row[user_id]'), | ||
72 | + formatter: Controller.api.formatter.url | ||
73 | + }, | ||
74 | + //点击IP时同时执行搜索此IP | ||
75 | + { | ||
76 | + field: 'ip', | ||
77 | + title: __('IP'), | ||
78 | + events: Controller.api.events.ip, | ||
79 | + formatter: Controller.api.formatter.ip | ||
80 | + }, | ||
81 | + //自定义栏位,custom是不存在的字段 | ||
82 | + {field: 'custom', title: __('切换'), operate: false, formatter: Controller.api.formatter.custom}, | ||
83 | + //browser是一个不存在的字段 | ||
84 | + //通过formatter来渲染数据,同时为它添加上事件 | ||
85 | + { | ||
86 | + field: 'browser', | ||
87 | + title: __('Browser'), | ||
88 | + operate: false, | ||
89 | + events: Controller.api.events.browser, | ||
90 | + formatter: Controller.api.formatter.browser | ||
91 | + }, | ||
92 | + { | ||
93 | + field: 'admin_id', title: __('联动搜索'), searchList: function (column) { | ||
94 | + return Template('categorytpl', {}); | ||
95 | + }, formatter: function (value, row, index) { | ||
96 | + return '无'; | ||
97 | + }, visible: false | ||
98 | + }, | ||
99 | + //启用时间段搜索 | ||
100 | + { | ||
101 | + field: 'createtime', | ||
102 | + title: __('Update time'), | ||
103 | + sortable: true, | ||
104 | + formatter: Table.api.formatter.datetime, | ||
105 | + operate: 'RANGE', | ||
106 | + addclass: 'datetimerange' | ||
107 | + }, | ||
108 | + //操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮 | ||
109 | + { | ||
110 | + field: 'operate', | ||
111 | + width: "150px", | ||
112 | + title: __('Operate'), | ||
113 | + table: table, | ||
114 | + events: Table.api.events.operate, | ||
115 | + buttons: [ | ||
116 | + { | ||
117 | + name: 'click', | ||
118 | + title: __('点击执行事件'), | ||
119 | + classname: 'btn btn-xs btn-info btn-click', | ||
120 | + icon: 'fa fa-leaf', | ||
121 | + // dropdown: '更多',//如果包含dropdown,将会以下拉列表的形式展示 | ||
122 | + click: function (data) { | ||
123 | + Layer.alert("点击按钮执行的事件"); | ||
124 | + } | ||
125 | + }, | ||
126 | + { | ||
127 | + name: 'detail', | ||
128 | + title: __('弹出窗口打开'), | ||
129 | + classname: 'btn btn-xs btn-primary btn-dialog', | ||
130 | + icon: 'fa fa-list', | ||
131 | + url: 'example/bootstraptable/detail', | ||
132 | + callback: function (data) { | ||
133 | + Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); | ||
134 | + } | ||
135 | + }, | ||
136 | + { | ||
137 | + name: 'ajax', | ||
138 | + title: __('发送Ajax'), | ||
139 | + classname: 'btn btn-xs btn-success btn-magic btn-ajax', | ||
140 | + icon: 'fa fa-magic', | ||
141 | + confirm: '确认发送Ajax请求?', | ||
142 | + url: 'example/bootstraptable/detail', | ||
143 | + success: function (data, ret) { | ||
144 | + Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data)); | ||
145 | + //如果需要阻止成功提示,则必须使用return false; | ||
146 | + //return false; | ||
147 | + }, | ||
148 | + error: function (data, ret) { | ||
149 | + console.log(data, ret); | ||
150 | + Layer.alert(ret.msg); | ||
151 | + return false; | ||
152 | + } | ||
153 | + }, | ||
154 | + { | ||
155 | + name: 'addtabs', | ||
156 | + title: __('新选项卡中打开'), | ||
157 | + classname: 'btn btn-xs btn-warning btn-addtabs', | ||
158 | + icon: 'fa fa-folder-o', | ||
159 | + url: 'example/bootstraptable/detail' | ||
160 | + } | ||
161 | + ], | ||
162 | + formatter: Table.api.formatter.operate | ||
163 | + }, | ||
164 | + ], | ||
165 | + ], | ||
166 | + //更多配置参数可参考:https://doc.fastadmin.net/doc/190.html | ||
167 | + //亦可以参考require-table.js中defaults的配置 | ||
168 | + //快捷搜索,这里可在控制器定义快捷搜索的字段 | ||
169 | + search: true, | ||
170 | + //启用普通表单搜索 | ||
171 | + commonSearch: true, | ||
172 | + //显示导出按钮 | ||
173 | + showExport: true, | ||
174 | + //导出类型 | ||
175 | + exportDataType: "all", //共有basic, all, selected三种值 basic当前页 all全部 selected仅选中 | ||
176 | + //导出下拉列表选项 | ||
177 | + exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'], | ||
178 | + //可以控制是否默认显示搜索单表,false则隐藏,默认为false | ||
179 | + searchFormVisible: true, | ||
180 | + queryParams: function (params) { | ||
181 | + //这里可以追加搜索条件 | ||
182 | + var filter = JSON.parse(params.filter); | ||
183 | + var op = JSON.parse(params.op); | ||
184 | + //这里可以动态赋值,比如从URL中获取admin_id的值,filter.admin_id=Fast.api.query('admin_id'); | ||
185 | + filter.admin_id = 1; | ||
186 | + op.admin_id = "="; | ||
187 | + params.filter = JSON.stringify(filter); | ||
188 | + params.op = JSON.stringify(op); | ||
189 | + return params; | ||
190 | + }, | ||
191 | + }); | ||
192 | + | ||
193 | + // 为表格绑定事件 | ||
194 | + Table.api.bindevent(table); | ||
195 | + | ||
196 | + // 监听下拉列表改变的事件 | ||
197 | + $(document).on('change', 'select[name=admin]', function () { | ||
198 | + $("input[name='admin_id']").val($(this).val()); | ||
199 | + }); | ||
200 | + | ||
201 | + // 指定搜索条件 | ||
202 | + $(document).on("click", ".btn-singlesearch", function () { | ||
203 | + var options = table.bootstrapTable('getOptions'); | ||
204 | + var queryParams = options.queryParams; | ||
205 | + options.pageNumber = 1; | ||
206 | + options.queryParams = function (params) { | ||
207 | + //这一行必须要存在,否则在点击下一页时会丢失搜索栏数据 | ||
208 | + params = queryParams(params); | ||
209 | + | ||
210 | + //如果希望追加搜索条件,可使用 | ||
211 | + var filter = params.filter ? JSON.parse(params.filter) : {}; | ||
212 | + var op = params.op ? JSON.parse(params.op) : {}; | ||
213 | + filter.url = 'login'; | ||
214 | + op.url = 'like'; | ||
215 | + params.filter = JSON.stringify(filter); | ||
216 | + params.op = JSON.stringify(op); | ||
217 | + | ||
218 | + //如果希望忽略搜索栏搜索条件,可使用 | ||
219 | + //params.filter = JSON.stringify({url: 'login'}); | ||
220 | + //params.op = JSON.stringify({url: 'like'}); | ||
221 | + return params; | ||
222 | + }; | ||
223 | + table.bootstrapTable('refresh', {}); | ||
224 | + Toastr.info("当前执行的是自定义搜索,搜索URL中包含login的数据"); | ||
225 | + return false; | ||
226 | + }); | ||
227 | + | ||
228 | + // 获取选中项 | ||
229 | + $(document).on("click", ".btn-selected", function () { | ||
230 | + Layer.alert(JSON.stringify(table.bootstrapTable('getSelections'))); | ||
231 | + }); | ||
232 | + | ||
233 | + // 启动和暂停按钮 | ||
234 | + $(document).on("click", ".btn-start,.btn-pause", function () { | ||
235 | + //在table外不可以使用添加.btn-change的方法 | ||
236 | + //只能自己调用Table.api.multi实现 | ||
237 | + //如果操作全部则ids可以置为空 | ||
238 | + var ids = Table.api.selectedids(table); | ||
239 | + Table.api.multi("changestatus", ids.join(","), table, this); | ||
240 | + }); | ||
241 | + | ||
242 | + }, | ||
243 | + add: function () { | ||
244 | + Controller.api.bindevent(); | ||
245 | + }, | ||
246 | + edit: function () { | ||
247 | + Controller.api.bindevent(); | ||
248 | + }, | ||
249 | + detail: function () { | ||
250 | + $(document).on('click', '.btn-callback', function () { | ||
251 | + Fast.api.close($("input[name=callback]").val()); | ||
252 | + }); | ||
253 | + }, | ||
254 | + api: { | ||
255 | + bindevent: function () { | ||
256 | + Form.api.bindevent($("form[role=form]")); | ||
257 | + }, | ||
258 | + formatter: {//渲染的方法 | ||
259 | + url: function (value, row, index) { | ||
260 | + return '<div class="input-group input-group-sm" style="width:250px;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>'; | ||
261 | + }, | ||
262 | + ip: function (value, row, index) { | ||
263 | + return '<a class="btn btn-xs btn-ip bg-success"><i class="fa fa-map-marker"></i> ' + value + '</a>'; | ||
264 | + }, | ||
265 | + browser: function (value, row, index) { | ||
266 | + //这里我们直接使用row的数据 | ||
267 | + return '<a class="btn btn-xs btn-browser">' + row.useragent.split(" ")[0] + '</a>'; | ||
268 | + }, | ||
269 | + custom: function (value, row, index) { | ||
270 | + //添加上btn-change可以自定义请求的URL进行数据处理 | ||
271 | + return '<a class="btn-change text-success" data-url="example/bootstraptable/change" data-id="' + row.id + '"><i class="fa ' + (row.title == '' ? 'fa-toggle-on fa-flip-horizontal text-gray' : 'fa-toggle-on') + ' fa-2x"></i></a>'; | ||
272 | + }, | ||
273 | + }, | ||
274 | + events: {//绑定事件的方法 | ||
275 | + ip: { | ||
276 | + //格式为:方法名+空格+DOM元素 | ||
277 | + 'click .btn-ip': function (e, value, row, index) { | ||
278 | + e.stopPropagation(); | ||
279 | + var container = $("#table").data("bootstrap.table").$container; | ||
280 | + var options = $("#table").bootstrapTable('getOptions'); | ||
281 | + //这里我们手动将数据填充到表单然后提交 | ||
282 | + $("form.form-commonsearch [name='ip']", container).val(value); | ||
283 | + $("form.form-commonsearch", container).trigger('submit'); | ||
284 | + Toastr.info("执行了自定义搜索操作"); | ||
285 | + } | ||
286 | + }, | ||
287 | + browser: { | ||
288 | + 'click .btn-browser': function (e, value, row, index) { | ||
289 | + e.stopPropagation(); | ||
290 | + Layer.alert("该行数据为: <code>" + JSON.stringify(row) + "</code>"); | ||
291 | + } | ||
292 | + }, | ||
293 | + } | ||
294 | + } | ||
295 | + }; | ||
296 | + return Controller; | ||
297 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'example/colorbadge/index', | ||
9 | + add_url: '', | ||
10 | + edit_url: '', | ||
11 | + del_url: 'example/colorbadge/del', | ||
12 | + multi_url: '', | ||
13 | + } | ||
14 | + }); | ||
15 | + | ||
16 | + var table = $("#table"); | ||
17 | + | ||
18 | + // 初始化表格 | ||
19 | + table.bootstrapTable({ | ||
20 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
21 | + columns: [ | ||
22 | + [ | ||
23 | + {field: 'state', checkbox: true, }, | ||
24 | + {field: 'id', title: 'ID'}, | ||
25 | + {field: 'title', title: __('Title')}, | ||
26 | + {field: 'ip', title: __('IP')}, | ||
27 | + {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||
28 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
29 | + ] | ||
30 | + ], | ||
31 | + onLoadSuccess: function (data) { | ||
32 | + // 在表格第次加载成功后,刷新左侧菜单栏彩色小角标,支持一次渲染多个 | ||
33 | + // 如果需要在进入后台即显示左侧的彩色小角标,请使用服务端渲染方式,详情修改application/admin/controller/Index.php | ||
34 | + Backend.api.sidebar({ | ||
35 | + 'example/colorbadge': data.total | ||
36 | + }); | ||
37 | + Toastr.info("左侧角标已经刷新成功"); | ||
38 | + } | ||
39 | + }); | ||
40 | + | ||
41 | + // 为表格绑定事件 | ||
42 | + Table.api.bindevent(table); | ||
43 | + }, | ||
44 | + add: function () { | ||
45 | + Form.api.bindevent($("form[role=form]")); | ||
46 | + }, | ||
47 | + edit: function () { | ||
48 | + Form.api.bindevent($("form[role=form]")); | ||
49 | + } | ||
50 | + }; | ||
51 | + return Controller; | ||
52 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'example/controllerjump/index', | ||
9 | + add_url: '', | ||
10 | + edit_url: '', | ||
11 | + del_url: 'example/controllerjump/del', | ||
12 | + multi_url: '', | ||
13 | + } | ||
14 | + }); | ||
15 | + | ||
16 | + var table = $("#table"); | ||
17 | + | ||
18 | + // 初始化表格 | ||
19 | + table.bootstrapTable({ | ||
20 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
21 | + columns: [ | ||
22 | + [ | ||
23 | + {field: 'state', checkbox: true, }, | ||
24 | + {field: 'id', title: 'ID'}, | ||
25 | + {field: 'admin_id', title: __('Admin_id')}, | ||
26 | + {field: 'title', title: __('Title')}, | ||
27 | + {field: 'ip', title: __('IP'), formatter: Controller.api.formatter.ip}, | ||
28 | + {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||
29 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
30 | + ] | ||
31 | + ] | ||
32 | + }); | ||
33 | + | ||
34 | + // 为表格绑定事件 | ||
35 | + Table.api.bindevent(table); | ||
36 | + }, | ||
37 | + add: function () { | ||
38 | + Form.api.bindevent($("form[role=form]")); | ||
39 | + }, | ||
40 | + edit: function () { | ||
41 | + Form.api.bindevent($("form[role=form]")); | ||
42 | + }, | ||
43 | + api: { | ||
44 | + formatter: { | ||
45 | + ip: function (value, row, index) { | ||
46 | + //这里手动构造URL | ||
47 | + url = "example/bootstraptable?" + this.field + "=" + value; | ||
48 | + | ||
49 | + //方式一,直接返回class带有addtabsit的链接,这可以方便自定义显示内容 | ||
50 | + return '<a href="' + url + '" class="label label-success addtabsit" title="' + __("Search %s", value) + '">' + __('Search %s', value) + '</a>'; | ||
51 | + | ||
52 | + //方式二,直接调用Table.api.formatter.addtabs | ||
53 | + return Table.api.formatter.addtabs(value, row, index, url); | ||
54 | + } | ||
55 | + } | ||
56 | + } | ||
57 | + }; | ||
58 | + return Controller; | ||
59 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + //因为日期选择框不会触发change事件,导致无法刷新textarea,所以加上判断 | ||
6 | + $(document).on("dp.change", "#second-form .datetimepicker", function () { | ||
7 | + $(this).parent().prev().find("input").trigger("change"); | ||
8 | + }); | ||
9 | + $(document).on("fa.event.appendfieldlist", "#second-form .btn-append", function (e, obj) { | ||
10 | + Form.events.selectpage(obj); | ||
11 | + Form.events.datetimepicker(obj); | ||
12 | + }); | ||
13 | + Form.api.bindevent($("form[role=form]"), function (data, ret) { | ||
14 | + Layer.alert(data.data); | ||
15 | + }); | ||
16 | + }, | ||
17 | + }; | ||
18 | + return Controller; | ||
19 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + var Controller = { | ||
3 | + index: function () { | ||
4 | + // | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'example/customsearch/index', | ||
9 | + add_url: 'example/customsearch/add', | ||
10 | + edit_url: 'example/customsearch/edit', | ||
11 | + del_url: 'example/customsearch/del', | ||
12 | + multi_url: 'example/customsearch/multi', | ||
13 | + table: '', | ||
14 | + } | ||
15 | + }); | ||
16 | + | ||
17 | + var table = $("#table"); | ||
18 | + | ||
19 | + // 初始化表格 | ||
20 | + table.bootstrapTable({ | ||
21 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
22 | + pk: 'id', | ||
23 | + sortName: 'id', | ||
24 | + searchFormVisible: true, | ||
25 | + searchFormTemplate: 'customformtpl', | ||
26 | + columns: [ | ||
27 | + [ | ||
28 | + {checkbox: true}, | ||
29 | + {field: 'id', title: 'ID', operate: false}, | ||
30 | + {field: 'admin_id', title: __('Admin_id'), visible: false, operate: false}, | ||
31 | + {field: 'username', title: __('Username'), formatter: Table.api.formatter.search}, | ||
32 | + {field: 'title', title: __('Title')}, | ||
33 | + {field: 'url', title: __('Url'), align: 'left'}, | ||
34 | + {field: 'ip', title: __('IP')}, | ||
35 | + {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||
36 | + { | ||
37 | + field: 'operate', | ||
38 | + title: __('Operate'), | ||
39 | + table: table, | ||
40 | + events: Table.api.events.operate, | ||
41 | + formatter: Table.api.formatter.operate | ||
42 | + } | ||
43 | + ] | ||
44 | + ] | ||
45 | + }); | ||
46 | + | ||
47 | + // 为表格绑定事件 | ||
48 | + Table.api.bindevent(table); | ||
49 | + }, | ||
50 | + add: function () { | ||
51 | + Controller.api.bindevent(); | ||
52 | + }, | ||
53 | + edit: function () { | ||
54 | + Controller.api.bindevent(); | ||
55 | + }, | ||
56 | + api: { | ||
57 | + bindevent: function () { | ||
58 | + Form.api.bindevent($("form[role=form]")); | ||
59 | + } | ||
60 | + } | ||
61 | + }; | ||
62 | + return Controller; | ||
63 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + $("#cxselect-example .col-xs-12").each(function () { | ||
6 | + $("textarea", this).val($(this).prev().prev().html().replace(/[ ]{2}/g, '')); | ||
7 | + }); | ||
8 | + | ||
9 | + //这里需要手动为Form绑定上元素事件 | ||
10 | + Form.api.bindevent($("form#cxselectform")); | ||
11 | + } | ||
12 | + }; | ||
13 | + return Controller; | ||
14 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'echarts', 'echarts-theme'], function ($, undefined, Backend, Table, Form, Template, Echarts) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + console.log(Echarts.version); | ||
6 | + //这句话在多选项卡统计表时必须存在,否则会导致影响的图表宽度不正确 | ||
7 | + $(document).on("click", ".charts-custom a[data-toggle=\"tab\"]", function () { | ||
8 | + var that = this; | ||
9 | + setTimeout(function () { | ||
10 | + var id = $(that).attr("href"); | ||
11 | + var chart = Echarts.getInstanceByDom($(id)[0]); | ||
12 | + chart.resize(); | ||
13 | + }, 0); | ||
14 | + }); | ||
15 | + | ||
16 | + // 基于准备好的dom,初始化echarts实例 | ||
17 | + var lineChart = Echarts.init(document.getElementById('line-chart'), 'walden'); | ||
18 | + | ||
19 | + // 指定图表的配置项和数据 | ||
20 | + var option = { | ||
21 | + xAxis: { | ||
22 | + type: 'category', | ||
23 | + data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] | ||
24 | + }, | ||
25 | + yAxis: { | ||
26 | + type: 'value' | ||
27 | + }, | ||
28 | + series: [{ | ||
29 | + data: [49, 92, 61, 134, 90, 130, 120], | ||
30 | + type: 'line' | ||
31 | + }] | ||
32 | + }; | ||
33 | + | ||
34 | + // 使用刚指定的配置项和数据显示图表。 | ||
35 | + lineChart.setOption(option); | ||
36 | + // 基于准备好的dom,初始化echarts实例 | ||
37 | + var areaChart = Echarts.init(document.getElementById('area-chart'), 'walden'); | ||
38 | + | ||
39 | + // 指定图表的配置项和数据 | ||
40 | + var option = { | ||
41 | + xAxis: { | ||
42 | + type: 'category', | ||
43 | + boundaryGap: false, | ||
44 | + data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] | ||
45 | + }, | ||
46 | + yAxis: { | ||
47 | + type: 'value' | ||
48 | + }, | ||
49 | + series: [{ | ||
50 | + data: [820, 932, 901, 934, 1290, 1330, 1320], | ||
51 | + type: 'line', | ||
52 | + areaStyle: {} | ||
53 | + }] | ||
54 | + }; | ||
55 | + | ||
56 | + // 使用刚指定的配置项和数据显示图表。 | ||
57 | + areaChart.setOption(option); | ||
58 | + | ||
59 | + var pieChart = Echarts.init(document.getElementById('pie-chart'), 'walden'); | ||
60 | + var option = { | ||
61 | + tooltip: { | ||
62 | + trigger: 'item', | ||
63 | + formatter: '{a} <br/>{b}: {c} ({d}%)' | ||
64 | + }, | ||
65 | + legend: { | ||
66 | + orient: 'vertical', | ||
67 | + left: 10, | ||
68 | + data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎'] | ||
69 | + }, | ||
70 | + series: [ | ||
71 | + { | ||
72 | + name: '访问来源', | ||
73 | + type: 'pie', | ||
74 | + radius: ['50%', '70%'], | ||
75 | + avoidLabelOverlap: false, | ||
76 | + label: { | ||
77 | + normal: { | ||
78 | + show: false, | ||
79 | + position: 'center' | ||
80 | + }, | ||
81 | + emphasis: { | ||
82 | + show: true, | ||
83 | + textStyle: { | ||
84 | + fontSize: '30', | ||
85 | + fontWeight: 'bold' | ||
86 | + } | ||
87 | + } | ||
88 | + }, | ||
89 | + labelLine: { | ||
90 | + normal: { | ||
91 | + show: false | ||
92 | + } | ||
93 | + }, | ||
94 | + data: [ | ||
95 | + {value: 335, name: '直接访问'}, | ||
96 | + {value: 310, name: '邮件营销'}, | ||
97 | + {value: 234, name: '联盟广告'}, | ||
98 | + {value: 135, name: '视频广告'}, | ||
99 | + {value: 1548, name: '搜索引擎'} | ||
100 | + ] | ||
101 | + } | ||
102 | + ] | ||
103 | + }; | ||
104 | + // 使用刚指定的配置项和数据显示图表。 | ||
105 | + pieChart.setOption(option); | ||
106 | + | ||
107 | + var barChart = Echarts.init(document.getElementById('bar-chart'), 'walden'); | ||
108 | + option = { | ||
109 | + legend: {}, | ||
110 | + tooltip: {}, | ||
111 | + dataset: { | ||
112 | + source: [ | ||
113 | + ['产品销售', '2015', '2016', '2017'], | ||
114 | + ['风扇', 43.3, 85.8, 93.7], | ||
115 | + ['电视机', 83.1, 73.4, 55.1], | ||
116 | + ['空调', 86.4, 65.2, 82.5], | ||
117 | + ['冰箱', 72.4, 53.9, 39.1] | ||
118 | + ] | ||
119 | + }, | ||
120 | + xAxis: {type: 'category'}, | ||
121 | + yAxis: {}, | ||
122 | + // Declare several bar series, each will be mapped | ||
123 | + // to a column of dataset.source by default. | ||
124 | + series: [ | ||
125 | + {type: 'bar'}, | ||
126 | + {type: 'bar'}, | ||
127 | + {type: 'bar'} | ||
128 | + ] | ||
129 | + }; | ||
130 | + // 使用刚指定的配置项和数据显示图表。 | ||
131 | + barChart.setOption(option); | ||
132 | + | ||
133 | + | ||
134 | + var barChart = Echarts.init(document.getElementById('simplebar-chart')); | ||
135 | + option = { | ||
136 | + xAxis: { | ||
137 | + type: 'category', | ||
138 | + axisLine: { | ||
139 | + lineStyle: { | ||
140 | + color: "#fff" | ||
141 | + } | ||
142 | + }, | ||
143 | + data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] | ||
144 | + }, | ||
145 | + yAxis: { | ||
146 | + type: 'value', | ||
147 | + axisLine: { | ||
148 | + lineStyle: { | ||
149 | + color: "#fff" | ||
150 | + } | ||
151 | + } | ||
152 | + }, | ||
153 | + series: [{ | ||
154 | + data: [120, 200, 150, 80, 70, 110, 130], | ||
155 | + type: 'bar', | ||
156 | + itemStyle: { | ||
157 | + color: "#fff", | ||
158 | + opacity: 0.6 | ||
159 | + } | ||
160 | + }] | ||
161 | + }; | ||
162 | + // 使用刚指定的配置项和数据显示图表。 | ||
163 | + barChart.setOption(option); | ||
164 | + | ||
165 | + var barChart = Echarts.init(document.getElementById('smoothline-chart')); | ||
166 | + option = { | ||
167 | + textStyle: { | ||
168 | + color: "#fff" | ||
169 | + }, | ||
170 | + color: ['#fff'], | ||
171 | + xAxis: { | ||
172 | + type: 'category', | ||
173 | + boundaryGap: false, | ||
174 | + data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], | ||
175 | + axisLine: { | ||
176 | + lineStyle: { | ||
177 | + color: "#fff" | ||
178 | + } | ||
179 | + } | ||
180 | + }, | ||
181 | + yAxis: { | ||
182 | + type: 'value', | ||
183 | + splitLine: { | ||
184 | + show: false | ||
185 | + }, | ||
186 | + axisLine: { | ||
187 | + lineStyle: { | ||
188 | + color: "#fff" | ||
189 | + } | ||
190 | + } | ||
191 | + }, | ||
192 | + series: [{ | ||
193 | + data: [820, 932, 901, 934, 1290, 1330, 1320], | ||
194 | + type: 'line', | ||
195 | + smooth: true, | ||
196 | + areaStyle: { | ||
197 | + opacity: 0.4 | ||
198 | + } | ||
199 | + | ||
200 | + }] | ||
201 | + }; | ||
202 | + // 使用刚指定的配置项和数据显示图表。 | ||
203 | + barChart.setOption(option); | ||
204 | + } | ||
205 | + }; | ||
206 | + return Controller; | ||
207 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init(); | ||
7 | + | ||
8 | + //绑定事件 | ||
9 | + $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { | ||
10 | + var panel = $($(this).attr("href")); | ||
11 | + if (panel.size() > 0) { | ||
12 | + Controller.table[panel.attr("id")].call(this); | ||
13 | + $(this).on('click', function (e) { | ||
14 | + $($(this).attr("href")).find(".btn-refresh").trigger("click"); | ||
15 | + }); | ||
16 | + } | ||
17 | + //移除绑定的事件 | ||
18 | + $(this).unbind('shown.bs.tab'); | ||
19 | + }); | ||
20 | + | ||
21 | + //必须默认触发shown.bs.tab事件 | ||
22 | + $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab"); | ||
23 | + }, | ||
24 | + table: { | ||
25 | + first: function () { | ||
26 | + // 表格1 | ||
27 | + var table1 = $("#table1"); | ||
28 | + table1.bootstrapTable({ | ||
29 | + url: 'example/multitable/table1', | ||
30 | + toolbar: '#toolbar1', | ||
31 | + sortName: 'id', | ||
32 | + search: false, | ||
33 | + columns: [ | ||
34 | + [ | ||
35 | + {field: 'state', checkbox: true, }, | ||
36 | + {field: 'id', title: 'ID'}, | ||
37 | + {field: 'url', title: __('Url'), formatter: Table.api.formatter.url}, | ||
38 | + {field: 'imagewidth', title: __('Imagewidth')}, | ||
39 | + {field: 'imageheight', title: __('Imageheight')}, | ||
40 | + {field: 'mimetype', title: __('Mimetype')}, | ||
41 | + {field: 'operate', title: __('Operate'), table: table1, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
42 | + ] | ||
43 | + ] | ||
44 | + }); | ||
45 | + | ||
46 | + // 为表格1绑定事件 | ||
47 | + Table.api.bindevent(table1); | ||
48 | + }, | ||
49 | + second: function () { | ||
50 | + // 表格2 | ||
51 | + var table2 = $("#table2"); | ||
52 | + table2.bootstrapTable({ | ||
53 | + url: 'example/multitable/table2', | ||
54 | + extend: { | ||
55 | + index_url: '', | ||
56 | + add_url: '', | ||
57 | + edit_url: '', | ||
58 | + del_url: '', | ||
59 | + multi_url: '', | ||
60 | + table: '', | ||
61 | + }, | ||
62 | + toolbar: '#toolbar2', | ||
63 | + sortName: 'id', | ||
64 | + search: false, | ||
65 | + columns: [ | ||
66 | + [ | ||
67 | + {field: 'id', title: 'ID'}, | ||
68 | + {field: 'title', title: __('Title')}, | ||
69 | + {field: 'url', title: __('Url'), align: 'left', formatter: Table.api.formatter.url}, | ||
70 | + {field: 'ip', title: __('ip')}, | ||
71 | + {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||
72 | + ] | ||
73 | + ] | ||
74 | + }); | ||
75 | + | ||
76 | + // 为表格2绑定事件 | ||
77 | + Table.api.bindevent(table2); | ||
78 | + } | ||
79 | + }, | ||
80 | + add: function () { | ||
81 | + Controller.api.bindevent(); | ||
82 | + }, | ||
83 | + edit: function () { | ||
84 | + Controller.api.bindevent(); | ||
85 | + }, | ||
86 | + api: { | ||
87 | + bindevent: function () { | ||
88 | + Form.api.bindevent($("form[role=form]")); | ||
89 | + }, | ||
90 | + } | ||
91 | + }; | ||
92 | + return Controller; | ||
93 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'example/relationmodel/index', | ||
9 | + add_url: '', | ||
10 | + edit_url: '', | ||
11 | + del_url: 'example/relationmodel/del', | ||
12 | + multi_url: '', | ||
13 | + } | ||
14 | + }); | ||
15 | + | ||
16 | + var table = $("#table"); | ||
17 | + | ||
18 | + // 初始化表格 | ||
19 | + table.bootstrapTable({ | ||
20 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
21 | + columns: [ | ||
22 | + [ | ||
23 | + {field: 'state', checkbox: true, }, | ||
24 | + {field: 'id', title: 'ID', operate: '='}, | ||
25 | + {field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '关键字,模糊搜索'}, | ||
26 | + {field: 'admin.avatar', title: __('Avatar'), operate: false, formatter: Table.api.formatter.image}, | ||
27 | + {field: 'admin.username', title: __('Username'), operate: '='}, | ||
28 | + {field: 'admin.nickname', title: __('Nickname'), operate: 'LIKE %...%', placeholder: '关键字,模糊搜索'}, | ||
29 | + {field: 'ip', title: __('IP'), operate: '='}, | ||
30 | + {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||
31 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
32 | + ] | ||
33 | + ], | ||
34 | + }); | ||
35 | + | ||
36 | + // 为表格绑定事件 | ||
37 | + Table.api.bindevent(table); | ||
38 | + }, | ||
39 | + add: function () { | ||
40 | + Form.api.bindevent($("form[role=form]")); | ||
41 | + }, | ||
42 | + edit: function () { | ||
43 | + Form.api.bindevent($("form[role=form]")); | ||
44 | + }, | ||
45 | + }; | ||
46 | + return Controller; | ||
47 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init(); | ||
7 | + this.table.first(); | ||
8 | + this.table.second(); | ||
9 | + }, | ||
10 | + table: { | ||
11 | + first: function () { | ||
12 | + // 表格1 | ||
13 | + var table1 = $("#table1"); | ||
14 | + table1.bootstrapTable({ | ||
15 | + url: 'example/tablelink/table1', | ||
16 | + toolbar: '#toolbar1', | ||
17 | + sortName: 'id', | ||
18 | + search: false, | ||
19 | + columns: [ | ||
20 | + [ | ||
21 | + {field: 'state', checkbox: true,}, | ||
22 | + {field: 'id', title: 'ID'}, | ||
23 | + {field: 'username', title: __('Nickname')}, | ||
24 | + { | ||
25 | + field: 'operate', title: __('Operate'), table: table1, events: Table.api.events.operate, buttons: [ | ||
26 | + { | ||
27 | + name: 'log', | ||
28 | + title: '日志列表', | ||
29 | + text: '日志列表', | ||
30 | + icon: 'fa fa-list', | ||
31 | + classname: 'btn btn-primary btn-xs btn-click', | ||
32 | + click: function (e, data) { | ||
33 | + $("#myTabContent2 .form-commonsearch input[name='username']").val(data.username); | ||
34 | + $("#myTabContent2 .btn-refresh").trigger("click"); | ||
35 | + } | ||
36 | + } | ||
37 | + ], formatter: Table.api.formatter.operate | ||
38 | + } | ||
39 | + ] | ||
40 | + ] | ||
41 | + }); | ||
42 | + | ||
43 | + // 为表格1绑定事件 | ||
44 | + Table.api.bindevent(table1); | ||
45 | + }, | ||
46 | + second: function () { | ||
47 | + // 表格2 | ||
48 | + var table2 = $("#table2"); | ||
49 | + table2.bootstrapTable({ | ||
50 | + url: 'example/tablelink/table2', | ||
51 | + extend: { | ||
52 | + index_url: '', | ||
53 | + add_url: '', | ||
54 | + edit_url: '', | ||
55 | + del_url: '', | ||
56 | + multi_url: '', | ||
57 | + table: '', | ||
58 | + }, | ||
59 | + toolbar: '#toolbar2', | ||
60 | + sortName: 'id', | ||
61 | + search: false, | ||
62 | + columns: [ | ||
63 | + [ | ||
64 | + {field: 'state', checkbox: true,}, | ||
65 | + {field: 'id', title: 'ID'}, | ||
66 | + {field: 'username', title: __('Nickname')}, | ||
67 | + {field: 'title', title: __('Title')}, | ||
68 | + {field: 'url', title: __('Url'), align: 'left', formatter: Table.api.formatter.url}, | ||
69 | + {field: 'ip', title: __('ip')}, | ||
70 | + {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||
71 | + ] | ||
72 | + ] | ||
73 | + }); | ||
74 | + | ||
75 | + // 为表格2绑定事件 | ||
76 | + Table.api.bindevent(table2); | ||
77 | + } | ||
78 | + }, | ||
79 | + }; | ||
80 | + return Controller; | ||
81 | +}); |
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'example/tabletemplate/index', | ||
9 | + add_url: '', | ||
10 | + edit_url: '', | ||
11 | + del_url: 'example/tabletemplate/del', | ||
12 | + multi_url: '', | ||
13 | + } | ||
14 | + }); | ||
15 | + | ||
16 | + var table = $("#table"); | ||
17 | + | ||
18 | + Template.helper("Moment", Moment); | ||
19 | + | ||
20 | + // 初始化表格 | ||
21 | + table.bootstrapTable({ | ||
22 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
23 | + templateView: true, | ||
24 | + columns: [ | ||
25 | + [ | ||
26 | + {field: 'state', checkbox: true, }, | ||
27 | + {field: 'id', title: 'ID', operate: false}, | ||
28 | + //直接响应搜索 | ||
29 | + {field: 'username', title: __('Username'), formatter: Table.api.formatter.search}, | ||
30 | + //模糊搜索 | ||
31 | + {field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索,*表示任意字符', style: 'width:200px'}, | ||
32 | + //通过Ajax渲染searchList | ||
33 | + {field: 'url', title: __('Url'), align: 'left', formatter: Controller.api.formatter.url}, | ||
34 | + //点击IP时同时执行搜索此IP,同时普通搜索使用下拉列表的形式 | ||
35 | + {field: 'ip', title: __('IP'), searchList: ['127.0.0.1', '127.0.0.2'], events: Controller.api.events.ip, formatter: Controller.api.formatter.ip}, | ||
36 | + //browser是一个不存在的字段 | ||
37 | + //通过formatter来渲染数据,同时为它添加上事件 | ||
38 | + {field: 'browser', title: __('Browser'), operate: false, events: Controller.api.events.browser, formatter: Controller.api.formatter.browser}, | ||
39 | + //启用时间段搜索 | ||
40 | + {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||
41 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
42 | + ], | ||
43 | + ], | ||
44 | + //禁用默认搜索 | ||
45 | + search: false, | ||
46 | + //启用普通表单搜索 | ||
47 | + commonSearch: false, | ||
48 | + //可以控制是否默认显示搜索单表,false则隐藏,默认为false | ||
49 | + searchFormVisible: false, | ||
50 | + //分页大小 | ||
51 | + pageSize: 12 | ||
52 | + }); | ||
53 | + | ||
54 | + // 为表格绑定事件 | ||
55 | + Table.api.bindevent(table); | ||
56 | + | ||
57 | + //指定搜索条件 | ||
58 | + $(document).on("click", ".btn-toggle-view", function () { | ||
59 | + var options = table.bootstrapTable('getOptions'); | ||
60 | + table.bootstrapTable('refreshOptions', {templateView: !options.templateView}); | ||
61 | + }); | ||
62 | + | ||
63 | + //点击详情 | ||
64 | + $(document).on("click", ".btn-detail[data-id]", function () { | ||
65 | + Backend.api.open('example/bootstraptable/detail/ids/' + $(this).data('id'), __('Detail')); | ||
66 | + }); | ||
67 | + | ||
68 | + //获取选中项 | ||
69 | + $(document).on("click", ".btn-selected", function () { | ||
70 | + //在templateView的模式下不能调用table.bootstrapTable('getSelections')来获取选中的ID,只能通过下面的Table.api.selectedids来获取 | ||
71 | + Layer.alert(JSON.stringify(Table.api.selectedids(table))); | ||
72 | + }); | ||
73 | + }, | ||
74 | + add: function () { | ||
75 | + Controller.api.bindevent(); | ||
76 | + }, | ||
77 | + edit: function () { | ||
78 | + Controller.api.bindevent(); | ||
79 | + }, | ||
80 | + api: { | ||
81 | + bindevent: function () { | ||
82 | + Form.api.bindevent($("form[role=form]")); | ||
83 | + }, | ||
84 | + formatter: { | ||
85 | + url: function (value, row, index) { | ||
86 | + return '<div class="input-group input-group-sm" style="width:250px;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>'; | ||
87 | + }, | ||
88 | + ip: function (value, row, index) { | ||
89 | + return '<a class="btn btn-xs btn-ip bg-success"><i class="fa fa-map-marker"></i> ' + value + '</a>'; | ||
90 | + }, | ||
91 | + browser: function (value, row, index) { | ||
92 | + //这里我们直接使用row的数据 | ||
93 | + return '<a class="btn btn-xs btn-browser">' + row.useragent.split(" ")[0] + '</a>'; | ||
94 | + } | ||
95 | + }, | ||
96 | + events: { | ||
97 | + ip: { | ||
98 | + 'click .btn-ip': function (e, value, row, index) { | ||
99 | + var options = $("#table").bootstrapTable('getOptions'); | ||
100 | + //这里我们手动将数据填充到表单然后提交 | ||
101 | + $("#commonSearchContent_" + options.idTable + " form [name='ip']").val(value); | ||
102 | + $("#commonSearchContent_" + options.idTable + " form").trigger('submit'); | ||
103 | + Toastr.info("执行了自定义搜索操作"); | ||
104 | + } | ||
105 | + }, | ||
106 | + browser: { | ||
107 | + 'click .btn-browser': function (e, value, row, index) { | ||
108 | + Layer.alert("该行数据为: <code>" + JSON.stringify(row) + "</code>"); | ||
109 | + } | ||
110 | + } | ||
111 | + } | ||
112 | + } | ||
113 | + }; | ||
114 | + return Controller; | ||
115 | +}); |
addons/example/view/demo/demo1.html
0 → 100644
1 | +<!-- Page Content --> | ||
2 | + <div class="container"> | ||
3 | + | ||
4 | + <!-- Page Heading/Breadcrumbs --> | ||
5 | + <div class="row"> | ||
6 | + <div class="col-lg-12"> | ||
7 | + <h1 class="page-header">无需登录页面 | ||
8 | + <small>开发者示例</small> | ||
9 | + </h1> | ||
10 | + <ol class="breadcrumb"> | ||
11 | + <li><a href="{:addon_url('example/index/index')}">插件首页</a> | ||
12 | + </li> | ||
13 | + <li class="active">无需登录页面</li> | ||
14 | + </ol> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + <!-- /.row --> | ||
18 | + | ||
19 | + <!-- Content Row --> | ||
20 | + <div class="row"> | ||
21 | + <div class="col-lg-12"> | ||
22 | + <p class="well">当前登录页面无需登录即可查看,当前请求的name值为:{$Request.param.name}</p> | ||
23 | + {if $user} | ||
24 | + <p class="well text-danger">但是如果你登录后可以浏览到这段隐藏的信息</p> | ||
25 | + {/if} | ||
26 | + </div> | ||
27 | + </div> | ||
28 | + <!-- /.row --> | ||
29 | + | ||
30 | + <hr> | ||
31 | + | ||
32 | + </div> | ||
33 | + <!-- /.container --> |
addons/example/view/demo/demo2.html
0 → 100644
1 | +<!-- Page Content --> | ||
2 | +<div class="container"> | ||
3 | + | ||
4 | + <!-- Page Heading/Breadcrumbs --> | ||
5 | + <div class="row"> | ||
6 | + <div class="col-lg-12"> | ||
7 | + <h1 class="page-header">需登录页面 | ||
8 | + <small>开发者示例</small> | ||
9 | + </h1> | ||
10 | + <ol class="breadcrumb"> | ||
11 | + <li><a href="{:addon_url('example/index/index')}">插件首页</a> | ||
12 | + </li> | ||
13 | + <li class="active">需登录页面</li> | ||
14 | + </ol> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + <!-- /.row --> | ||
18 | + | ||
19 | + <!-- Content Row --> | ||
20 | + <div class="row"> | ||
21 | + <div class="col-lg-12"> | ||
22 | + <p class="well">当前登录页面需要登录后才可以查看,你可以退出后再访问此页面,会提醒登录,当前请求的name值为:{$Request.param.name}</p> | ||
23 | + <p class="well">你好!{$user.nickname},<a href="{:url('index/user/logout')}">注销登录</a></p> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + <!-- /.row --> | ||
27 | + | ||
28 | + <hr> | ||
29 | + | ||
30 | +</div> | ||
31 | +<!-- /.container --> |
addons/example/view/demo/index.html
0 → 100644
1 | +<!-- Page Content --> | ||
2 | + <div class="container"> | ||
3 | + | ||
4 | + <!-- Page Heading/Breadcrumbs --> | ||
5 | + <div class="row"> | ||
6 | + <div class="col-lg-12"> | ||
7 | + <h1 class="page-header">使用模板标签和变量 | ||
8 | + <small>开发者示例</small> | ||
9 | + </h1> | ||
10 | + <ol class="breadcrumb"> | ||
11 | + <li><a href="{:addon_url('example/index/index')}">插件首页</a> | ||
12 | + </li> | ||
13 | + <li class="active">使用模板标签和变量</li> | ||
14 | + </ol> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + <!-- /.row --> | ||
18 | + | ||
19 | + <!-- Content Row --> | ||
20 | + <div class="row"> | ||
21 | + <div class="col-lg-12"> | ||
22 | + <p class="well">当前请求的name值为:{$Request.param.name}</p> | ||
23 | + {literal} | ||
24 | + <pre> | ||
25 | +在插件视图中可以使用所有ThinkPHP5内支持的模板标签和变量,如 | ||
26 | + | ||
27 | +{$Think.server.script_name} // 输出$_SERVER['SCRIPT_NAME']变量 | ||
28 | +{$Think.session.user_id} // 输出$_SESSION['user_id']变量 | ||
29 | +{$Think.get.pageNumber} // 输出$_GET['pageNumber']变量 | ||
30 | +{$Think.cookie.name} // 输出$_COOKIE['name']变量 | ||
31 | + | ||
32 | +// 调用Request对象的get方法 传入参数为id | ||
33 | +{$Request.get.id} | ||
34 | +// 调用Request对象的param方法 传入参数为name | ||
35 | +{$Request.param.name} | ||
36 | +// 调用Request对象的param方法 传入参数为user.nickname | ||
37 | +{$Request.param.user.nickname} | ||
38 | +// 调用Request对象的root方法 | ||
39 | +{$Request.root} | ||
40 | +// 调用Request对象的root方法,并且传入参数true | ||
41 | +{$Request.root.true} | ||
42 | +// 调用Request对象的path方法 | ||
43 | +{$Request.path} | ||
44 | +// 调用Request对象的module方法 | ||
45 | +{$Request.module} | ||
46 | +// 调用Request对象的controller方法 | ||
47 | +{$Request.controller} | ||
48 | +// 调用Request对象的action方法 | ||
49 | +{$Request.action} | ||
50 | +// 调用Request对象的ext方法 | ||
51 | +{$Request.ext} | ||
52 | +// 调用Request对象的host方法 | ||
53 | +{$Request.host} | ||
54 | +// 调用Request对象的ip方法 | ||
55 | +{$Request.ip} | ||
56 | +// 调用Request对象的header方法 | ||
57 | +{$Request.header.accept-encoding} | ||
58 | + </pre> | ||
59 | + {/literal} | ||
60 | + </div> | ||
61 | + </div> | ||
62 | + <!-- /.row --> | ||
63 | + | ||
64 | + <hr> | ||
65 | + | ||
66 | + </div> | ||
67 | + <!-- /.container --> |
addons/example/view/index/index.html
0 → 100644
1 | +<!-- Header Carousel --> | ||
2 | +<header id="myCarousel" class="carousel slide"> | ||
3 | + <!-- Indicators --> | ||
4 | + <ol class="carousel-indicators"> | ||
5 | + <li data-target="#myCarousel" data-slide-to="0" class="active"></li> | ||
6 | + <li data-target="#myCarousel" data-slide-to="1"></li> | ||
7 | + <li data-target="#myCarousel" data-slide-to="2"></li> | ||
8 | + <li data-target="#myCarousel" data-slide-to="3"></li> | ||
9 | + </ol> | ||
10 | + | ||
11 | + <!-- Wrapper for slides --> | ||
12 | + <div class="carousel-inner"> | ||
13 | + <div class="item active"> | ||
14 | + <a href="https://www.fastadmin.net/store/cms.html" target="_blank"> | ||
15 | + <div class="fill" style="background-image:url('https://bg.fastadmin.net?text=random&color=3498db');"></div> | ||
16 | + <div class="carousel-body"> | ||
17 | + <div class="container"> | ||
18 | + <h1 class="display-1 text-white">CMS内容管理模块</h1> | ||
19 | + <h2 class="display-4 text-white">简单强大的内容管理系统,可自定义内容模型、标签、伪静态、全文搜索、百度推送等功能<br>包含完整的小程序CMS客户端,拥有完善的资讯模块、产品模块、评论模块、会员模块</h2> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | + </a> | ||
23 | + </div> | ||
24 | + <div class="item"> | ||
25 | + <a href="https://www.fastadmin.net/store/blog.html" target="_blank"> | ||
26 | + <div class="fill" style="background-image:url('https://bg.fastadmin.net?text=random&color=2ecc71');"></div> | ||
27 | + <div class="carousel-body"> | ||
28 | + <div class="container"> | ||
29 | + <h1 class="display-1 text-white">简单博客模块</h1> | ||
30 | + <h2 class="display-4 text-white">响应式博客插件,包含日志、评论、分类、归档、全文搜索、百度推送等功能<br/>包含完整的小程序博客客户端,拥有博客日志列表、日志详情、评论等功能</h2> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + </a> | ||
34 | + </div> | ||
35 | + <div class="item"> | ||
36 | + <a href="https://www.fastadmin.net/store/vote.html" target="_blank"> | ||
37 | + <div class="fill" style="background-image:url('https://bg.fastadmin.net?text=random&color=0082ff');"></div> | ||
38 | + <div class="carousel-body"> | ||
39 | + <div class="container"> | ||
40 | + <h1 class="display-1 text-white">在线投票系统</h1> | ||
41 | + <h2 class="display-4 text-white">基于FastAdmin+ThinkPHP开发的响应式在线投票系统,支持微信公众号投票和PC端投票<br/>具有高防刷票机制和实时排行榜等诸多特性,提供全部前后台无加密源代码</h2> | ||
42 | + </div> | ||
43 | + </div> | ||
44 | + </a> | ||
45 | + </div> | ||
46 | + <div class="item"> | ||
47 | + <a href="https://www.fastadmin.net/store/docs.html" target="_blank"> | ||
48 | + <div class="fill" style="background-image:url('https://bg.fastadmin.net?text=random&color=9c88ff');"></div> | ||
49 | + <div class="carousel-body"> | ||
50 | + <div class="container"> | ||
51 | + <h1 class="display-1 text-white">Markdown文档生成</h1> | ||
52 | + <h2 class="display-4 text-white">将Github或本地Git环境中的Markdown文件解析并生成HTML,可在线浏览或导出为HTML离线浏览</h2> | ||
53 | + </div> | ||
54 | + </div> | ||
55 | + </a> | ||
56 | + </div> | ||
57 | + </div> | ||
58 | +</header> | ||
59 | + | ||
60 | +<!-- Page Content --> | ||
61 | +<div class="container"> | ||
62 | + | ||
63 | + <!-- Marketing Icons Section --> | ||
64 | + <div class="row"> | ||
65 | + <div class="col-lg-12"> | ||
66 | + <h2 class="page-header"> | ||
67 | + 基础模块 | ||
68 | + </h2> | ||
69 | + </div> | ||
70 | + <div class="col-md-4"> | ||
71 | + <div class="panel panel-default"> | ||
72 | + <div class="panel-heading"> | ||
73 | + <h4><i class="fa fa-fw fa-user"></i> 前台模块</h4> | ||
74 | + </div> | ||
75 | + <div class="panel-body"> | ||
76 | + <p>FastAdmin有基础的前台模块,可快速的进行二次开发,前台模块中包含基础的会员模块,前台模块中的会员账号和API模块中的会员账号是同一账号体系</p> | ||
77 | + <a href="{:url('index/index/index')}" target="_blank" class="btn btn-primary">立即访问</a> | ||
78 | + <a href="{:url('index/user/index')}" target="_blank" class="btn btn-default">会员中心</a> | ||
79 | + </div> | ||
80 | + </div> | ||
81 | + </div> | ||
82 | + <div class="col-md-4"> | ||
83 | + <div class="panel panel-default"> | ||
84 | + <div class="panel-heading"> | ||
85 | + <h4><i class="fa fa-fw fa-gift"></i> API模块</h4> | ||
86 | + </div> | ||
87 | + <div class="panel-body"> | ||
88 | + <p>FastAdmin有基础的API模块,可快速的进行二次开发,API模块中包含基础的会员模块,初始化模块、短信发送模块、验证模块</p> | ||
89 | + <a href="{:url('api/index/index')}" target="_blank" class="btn btn-primary">立即访问</a> | ||
90 | + <a href="{:url('api/common/init')}?version=1.0.0" target="_blank" class="btn btn-default">初始化接口</a> | ||
91 | + </div> | ||
92 | + </div> | ||
93 | + </div> | ||
94 | + <div class="col-md-4"> | ||
95 | + <div class="panel panel-default"> | ||
96 | + <div class="panel-heading"> | ||
97 | + <h4><i class="fa fa-fw fa-compass"></i> API文档</h4> | ||
98 | + </div> | ||
99 | + <div class="panel-body"> | ||
100 | + <p>我们提供了一键生成API文档的功能,当写完API接口以后,可通过执行php think api一键生成我们所需要的API文档,并且可以直接在线测试</p> | ||
101 | + <a href="{:url('/')}api.html" target="_blank" class="btn btn-primary">立即访问</a> | ||
102 | + <a href="https://doc.fastadmin.net/docs/command.html#一键生成API文档" target="_blank" class="btn btn-default">一键生成文档</a> | ||
103 | + </div> | ||
104 | + </div> | ||
105 | + </div> | ||
106 | + </div> | ||
107 | + <div class="row"> | ||
108 | + <div class="col-lg-12"> | ||
109 | + <h2 class="page-header"> | ||
110 | + 功能示例 | ||
111 | + </h2> | ||
112 | + </div> | ||
113 | + <div class="col-md-4"> | ||
114 | + <div class="panel panel-default"> | ||
115 | + <div class="panel-heading"> | ||
116 | + <h4><i class="fa fa-fw fa-check"></i> 使用模板标签和变量</h4> | ||
117 | + </div> | ||
118 | + <div class="panel-body"> | ||
119 | + <p>在FastAdmin插件的视图中我们可以像前后台开发一样,向视图中渲染我们的自定义变量,然后在视图中进行访问。同时FastAdmin的插件视图中支持所有ThinkPHP5官方的系统模板标签和变量。轻轻松松的开发我们的插件</p> | ||
120 | + <a href="{:addon_url('example/demo/index',[':name'=>'s1'])}" class="btn btn-success">查看示例</a> | ||
121 | + </div> | ||
122 | + </div> | ||
123 | + </div> | ||
124 | + <div class="col-md-4"> | ||
125 | + <div class="panel panel-default"> | ||
126 | + <div class="panel-heading"> | ||
127 | + <h4><i class="fa fa-fw fa-gift"></i> 访问不需要登录的页面</h4> | ||
128 | + </div> | ||
129 | + <div class="panel-body"> | ||
130 | + <p>在开发的过程有许多页面是不需要会员登录就可以访问的页面,比如新闻列表、新闻详情、评论列表、产品列表、产品展示、关于我们等等页面。在FastAdmin中可以使用noNeedLogin很方便的控制我们请求方法的访问权限</p> | ||
131 | + <a href="{:addon_url('example/demo/demo1',[':name'=>'s2'])}" class="btn btn-success">立即访问</a> | ||
132 | + </div> | ||
133 | + </div> | ||
134 | + </div> | ||
135 | + <div class="col-md-4"> | ||
136 | + <div class="panel panel-default"> | ||
137 | + <div class="panel-heading"> | ||
138 | + <h4><i class="fa fa-fw fa-compass"></i> 访问需要登录的页面</h4> | ||
139 | + </div> | ||
140 | + <div class="panel-body"> | ||
141 | + <p>通常我们在开发中,如果页面与会员信息相关联,则通常需要控制页面在会员登录后才可以访问,FastAdmin中前台的权限控制可以很快捷的在插件中使用。我们可以直接重新定义noNeedLogin排除我们不需要登录的方法即可。</p> | ||
142 | + <a href="{:addon_url('example/demo/demo2',[':name'=>'s3'])}" class="btn btn-success">立即访问</a> | ||
143 | + </div> | ||
144 | + </div> | ||
145 | + </div> | ||
146 | + </div> | ||
147 | + <!-- /.row --> | ||
148 | + | ||
149 | + <div class="row addonlist"> | ||
150 | + <div class="col-lg-12"> | ||
151 | + <h2 class="page-header"> | ||
152 | + 模块&插件 | ||
153 | + <span class="pull-right small" style="margin-top:5px;"> | ||
154 | + <small> | ||
155 | + <a href="https://www.fastadmin.net/store.html" target="_blank">更多</a> | ||
156 | + </small> | ||
157 | + </span> | ||
158 | + </h2> | ||
159 | + </div> | ||
160 | + <div class="col-md-4 col-sm-6"> | ||
161 | + <a href="https://www.fastadmin.net/store/cms.html" target="_blank"> | ||
162 | + <img class="img-responsive img-addon img-hover" src="https://cdn.fastadmin.net/uploads/addons/cms.png" alt=""> | ||
163 | + <p>CMS内容管理模块</p> | ||
164 | + </a> | ||
165 | + </div> | ||
166 | + <div class="col-md-4 col-sm-6"> | ||
167 | + <a href="https://www.fastadmin.net/store/blog.html" target="_blank"> | ||
168 | + <img class="img-responsive img-addon img-hover" src="https://cdn.fastadmin.net/uploads/addons/blog.png" alt=""> | ||
169 | + <p>简洁博客模块</p> | ||
170 | + </a> | ||
171 | + </div> | ||
172 | + <div class="col-md-4 col-sm-6"> | ||
173 | + <a href="https://www.fastadmin.net/store/ask.html" target="_blank"> | ||
174 | + <img class="img-responsive img-addon img-hover" src="https://cdn.fastadmin.net/uploads/addons/ask.png" alt=""> | ||
175 | + <p>付费问答社区</p> | ||
176 | + </a> | ||
177 | + </div> | ||
178 | + <div class="col-md-4 col-sm-6"> | ||
179 | + <a href="https://www.fastadmin.net/store/docs.html" target="_blank"> | ||
180 | + <img class="img-responsive img-addon img-hover" src="https://cdn.fastadmin.net/uploads/addons/docs.png" alt=""> | ||
181 | + <p>文档生成模块</p> | ||
182 | + </a> | ||
183 | + </div> | ||
184 | + <div class="col-md-4 col-sm-6"> | ||
185 | + <a href="https://www.fastadmin.net/store/vote.html" target="_blank"> | ||
186 | + <img class="img-responsive img-addon img-hover" src="https://cdn.fastadmin.net/uploads/addons/vote.png" alt=""> | ||
187 | + <p>在线投票系统</p> | ||
188 | + </a> | ||
189 | + </div> | ||
190 | + <div class="col-md-4 col-sm-6"> | ||
191 | + <a href="https://www.fastadmin.net/store/qiniu.html" target="_blank"> | ||
192 | + <img class="img-responsive img-addon img-hover" src="https://cdn.fastadmin.net/uploads/addons/qiniu.png" alt=""> | ||
193 | + <p>七牛上传插件</p> | ||
194 | + </a> | ||
195 | + </div> | ||
196 | + <div class="col-md-4 col-sm-6"> | ||
197 | + <a href="https://www.fastadmin.net/store/alioss.html" target="_blank"> | ||
198 | + <img class="img-responsive img-addon img-hover" src="https://cdn.fastadmin.net/uploads/addons/alioss.png" alt=""> | ||
199 | + <p>阿里云储存</p> | ||
200 | + </a> | ||
201 | + </div> | ||
202 | + <div class="col-md-4 col-sm-6"> | ||
203 | + <a href="https://www.fastadmin.net/store/alisms.html" target="_blank"> | ||
204 | + <img class="img-responsive img-addon img-hover" src="https://cdn.fastadmin.net/uploads/addons/alisms.png" alt=""> | ||
205 | + <p>阿里云短信</p> | ||
206 | + </a> | ||
207 | + </div> | ||
208 | + <div class="col-md-4 col-sm-6"> | ||
209 | + <a href="https://www.fastadmin.net/store/nkeditor.html" target="_blank"> | ||
210 | + <img class="img-responsive img-addon img-hover" src="https://cdn.fastadmin.net/uploads/addons/nkeditor.png" alt=""> | ||
211 | + <p>富文本编辑器</p> | ||
212 | + </a> | ||
213 | + </div> | ||
214 | + <div class="col-xs-12 text-center"> | ||
215 | + <a href="https://www.fastadmin.net/store.html" class="btn btn-primary" target="_blank">前往插件市场</a> | ||
216 | + </div> | ||
217 | + </div> | ||
218 | + <!-- /.row --> | ||
219 | + | ||
220 | + <hr> | ||
221 | + | ||
222 | + <!-- Call to Action Section --> | ||
223 | + <div class="well"> | ||
224 | + <div class="row"> | ||
225 | + <div class="col-md-8"> | ||
226 | + <p>感谢你对FastAdmin的支持!如果你在使用FastAdmin开发插件的过程中有任何疑问或需要寻求帮助,请前往FastAdmin问答社区与小伙伴们一起交流。</p> | ||
227 | + </div> | ||
228 | + <div class="col-md-4"> | ||
229 | + <a class="btn btn-lg btn-default btn-block" href="https://ask.fastadmin.net" target="_blank">前往问答社区</a> | ||
230 | + </div> | ||
231 | + </div> | ||
232 | + </div> | ||
233 | + | ||
234 | + <hr> | ||
235 | + | ||
236 | +</div> |
addons/example/view/layout/default.html
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html lang="en"> | ||
3 | + | ||
4 | + <head> | ||
5 | + | ||
6 | + <meta charset="utf-8"> | ||
7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
8 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
9 | + <meta name="description" content=""> | ||
10 | + <meta name="author" content=""> | ||
11 | + | ||
12 | + <title>开发者示例 - FastAdmin</title> | ||
13 | + | ||
14 | + <!-- Bootstrap Core CSS --> | ||
15 | + <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> | ||
16 | + | ||
17 | + <!-- Custom CSS --> | ||
18 | + <link href="__ADDON__/css/common.css" rel="stylesheet"> | ||
19 | + | ||
20 | + <!-- Custom Fonts --> | ||
21 | + <link href="https://cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"> | ||
22 | + | ||
23 | + <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> | ||
24 | + <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> | ||
25 | + <!--[if lt IE 9]> | ||
26 | + <script src="https://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.min.js"></script> | ||
27 | + <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> | ||
28 | + <![endif]--> | ||
29 | + | ||
30 | + </head> | ||
31 | + | ||
32 | + <body> | ||
33 | + | ||
34 | + <!-- Navigation --> | ||
35 | + <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> | ||
36 | + <div class="container"> | ||
37 | + <!-- Brand and toggle get grouped for better mobile display --> | ||
38 | + <div class="navbar-header"> | ||
39 | + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> | ||
40 | + <span class="sr-only">Toggle navigation</span> | ||
41 | + <span class="icon-bar"></span> | ||
42 | + <span class="icon-bar"></span> | ||
43 | + <span class="icon-bar"></span> | ||
44 | + </button> | ||
45 | + <a class="navbar-brand" href="{:addon_url('example/index/index')}">FastAdmin</a> | ||
46 | + </div> | ||
47 | + <!-- Collect the nav links, forms, and other content for toggling --> | ||
48 | + <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> | ||
49 | + <ul class="nav navbar-nav navbar-right"> | ||
50 | + <li> | ||
51 | + <a href="{:addon_url('example/index/index')}">插件首页</a> | ||
52 | + </li> | ||
53 | + <li> | ||
54 | + <a href="{:addon_url('example/demo/demo1', [':name'=>'s1'])}">无需登录页面</a> | ||
55 | + </li> | ||
56 | + <li> | ||
57 | + <a href="{:addon_url('example/demo/demo2', [':name'=>'s2'])}">需登录页面</a> | ||
58 | + </li> | ||
59 | + {if $user} | ||
60 | + <li class="dropdown"> | ||
61 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown">欢迎你! {$user.nickname}<b class="caret"></b></a> | ||
62 | + <ul class="dropdown-menu"> | ||
63 | + <li> | ||
64 | + <a href="{:url('index/user/index')}">会员中心</a> | ||
65 | + </li> | ||
66 | + <li> | ||
67 | + <a href="{:url('index/user/profile')}">个人资料</a> | ||
68 | + </li> | ||
69 | + <li> | ||
70 | + <a href="{:url('index/user/logout')}">退出登录</a> | ||
71 | + </li> | ||
72 | + </ul> | ||
73 | + </li> | ||
74 | + {else /} | ||
75 | + <li class="dropdown"> | ||
76 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown">会员中心 <b class="caret"></b></a> | ||
77 | + <ul class="dropdown-menu"> | ||
78 | + <li> | ||
79 | + <a href="{:url('index/user/login')}">登录</a> | ||
80 | + </li> | ||
81 | + <li> | ||
82 | + <a href="{:url('index/user/register')}">注册</a> | ||
83 | + </li> | ||
84 | + </ul> | ||
85 | + </li> | ||
86 | + {/if} | ||
87 | + </ul> | ||
88 | + </div> | ||
89 | + <!-- /.navbar-collapse --> | ||
90 | + </div> | ||
91 | + <!-- /.container --> | ||
92 | + </nav> | ||
93 | + | ||
94 | + {__CONTENT__} | ||
95 | + | ||
96 | + <div class="container"> | ||
97 | + <!-- Footer --> | ||
98 | + <footer> | ||
99 | + <div class="row"> | ||
100 | + <div class="col-lg-12"> | ||
101 | + <p>Copyright © <a href="https://www.fastadmin.net">FastAdmin</a> 2020</p> | ||
102 | + </div> | ||
103 | + </div> | ||
104 | + </footer> | ||
105 | + | ||
106 | + </div> | ||
107 | + <!-- /.container --> | ||
108 | + | ||
109 | + <!-- jQuery --> | ||
110 | + <script src="https://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> | ||
111 | + | ||
112 | + <!-- Bootstrap Core JavaScript --> | ||
113 | + <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | ||
114 | + | ||
115 | + <!-- Script to Activate the Carousel --> | ||
116 | + <script> | ||
117 | + $('.carousel').carousel({ | ||
118 | + interval: 5000 //changes the speed | ||
119 | + }) | ||
120 | + </script> | ||
121 | + | ||
122 | + </body> | ||
123 | + | ||
124 | +</html> |
-
请 注册 或 登录 后发表评论