index.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <style>
  2. .upload-image {
  3. background: url('__CDN__/assets/addons/example/img/plus.png') no-repeat center center;
  4. background-size: 30px 30px;
  5. height: 30px;
  6. width: 30px;
  7. border: 1px solid #ccc;
  8. }
  9. </style>
  10. <div class="row">
  11. <div class="col-md-6">
  12. <div class="box box-success">
  13. <div class="panel-heading">
  14. {:__('自定义图片描述')}
  15. </div>
  16. <div class="panel-body">
  17. <div class="alert alert-success-light">
  18. <b>温馨提示</b><br>
  19. 默认我们的多图是没有图片描述的,如果我们需要自定义描述,可以使用以下的自定义功能<br>
  20. 特别注意的是图片的url和描述是分开储存的,也就是说图片一个字段,描述一个字段,你在前台使用时需要自己匹配映射关系<br>
  21. <b>下面的演示textarea为了便于调试,设置为可见的,实际使用中应该添加个hidden的class进行隐藏</b>
  22. </div>
  23. <form id="first-form" role="form" data-toggle="validator" method="POST" action="">
  24. <div class="form-group row">
  25. <label class="control-label col-xs-12">{:__('一维数组示例')}:</label>
  26. <div class="col-xs-12">
  27. <div class="input-group">
  28. <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">
  29. <div class="input-group-addon no-border no-padding">
  30. <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>
  31. <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>
  32. </div>
  33. <span class="msg-box n-right" for="c-files"></span>
  34. </div>
  35. <!--ul需要添加 data-template和data-name属性,并一一对应且唯一 -->
  36. <ul class="row list-inline plupload-preview" id="p-files" data-template="introtpl" data-name="row[intro]"></ul>
  37. <!--请注意 ul和textarea间不能存在其它任何元素,实际开发中textarea应该添加个hidden进行隐藏-->
  38. <textarea name="row[intro]" class="form-control" style="margin-top:5px;">["简洁响应式博客","CMS内容管理系统","在线投票系统"]</textarea>
  39. <!--这里自定义图片预览的模板 开始-->
  40. <script type="text/html" id="introtpl">
  41. <li class="col-xs-3">
  42. <a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail">
  43. <img src="<%=fullurl%>" class="img-responsive">
  44. </a>
  45. <input type="text" name="row[intro][<%=index%>]" class="form-control mb-1" placeholder="请输入文件描述" value="<%=value?value:''%>"/>
  46. <a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a>
  47. </li>
  48. </script>
  49. <!--这里自定义图片预览的模板 结束-->
  50. </div>
  51. </div>
  52. <div class="form-group row">
  53. <label class="control-label col-xs-12">{:__('二维数组示例')}:</label>
  54. <div class="col-xs-12">
  55. <div class="input-group">
  56. <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">
  57. <div class="input-group-addon no-border no-padding">
  58. <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,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  59. <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>
  60. </div>
  61. <span class="msg-box n-right" for="c-images"></span>
  62. </div>
  63. <!--ul需要添加 data-template和data-name属性,并一一对应且唯一 -->
  64. <ul class="row list-inline plupload-preview" id="p-images" data-template="desctpl" data-name="row[intro]"></ul>
  65. <!--请注意 ul和textarea间不能存在其它任何元素,实际开发中textarea应该添加个hidden进行隐藏-->
  66. <textarea name="row[intro]" class="form-control" style="margin-top:5px;">[{"info":"开发者示例插件","size":"1M"},{"info":"又拍云储存整合","size":"2M"},{"info":"阿里OSS云储存","size":"1M"}]</textarea>
  67. <!--这里自定义图片预览的模板 开始-->
  68. <script type="text/html" id="desctpl">
  69. <li class="col-xs-3">
  70. <a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail">
  71. <img src="<%=fullurl%>" class="img-responsive">
  72. </a>
  73. <input type="text" name="row[intro][<%=index%>][info]" class="form-control mb-1" placeholder="请输入插件描述" value="<%=value?value['info']:''%>"/>
  74. <input type="text" name="row[intro][<%=index%>][size]" class="form-control mb-1" placeholder="请输入插件大小" value="<%=value?value['size']:''%>"/>
  75. <a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a>
  76. </li>
  77. </script>
  78. <!--这里自定义图片预览的模板 结束-->
  79. </div>
  80. </div>
  81. <div class="form-group row">
  82. <label class="control-label col-xs-12"></label>
  83. <div class="col-xs-12">
  84. <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
  85. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  86. </div>
  87. </div>
  88. </form>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="col-md-6">
  93. <div class="box box-info">
  94. <div class="panel-heading">
  95. {:__('自定义Fieldlist示例')}
  96. </div>
  97. <div class="panel-body">
  98. <div class="alert alert-danger-light">
  99. <b>温馨提示</b><br>
  100. 默认我们的fieldlist只有一维数组,为键值形式,如果需要二维数组,可使用下面的自定义模板来实现<br>
  101. 默认追加的元素是没有进行事件绑定的,我们需要监听btn-append这个按钮的fa.event.appendfieldlist事件<br>
  102. <b>下面的演示textarea为了便于调试,设置为可见的,实际使用中应该添加个hidden的class进行隐藏</b>
  103. </div>
  104. <form id="second-form" role="form" data-toggle="validator" method="POST" action="">
  105. <div class="form-group row">
  106. <label class="control-label col-xs-12">{:__('Fieldlist示例')}:</label>
  107. <div class="col-xs-12">
  108. <table class="table fieldlist" data-template="basictpl" data-name="row[basic]" id="first-table">
  109. <tr>
  110. <td>{:__('标题')}</td>
  111. <td>{:__('介绍')}</td>
  112. <td>{:__('大小')}</td>
  113. <td>{:__('状态')}</td>
  114. <td width="100"></td>
  115. </tr>
  116. <tr>
  117. <td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></td>
  118. </tr>
  119. </table>
  120. <!--请注意实际开发中textarea应该添加个hidden进行隐藏-->
  121. <textarea name="row[basic]" class="form-control" cols="30" rows="5">[{"title":"开发者示例插件","intro":"开发者必备","size":"1M","state":1},{"title":"又拍云储存整合","intro":"一款云储存","size":"2M","state":0},{"title":"阿里OSS云储存","intro":"一款云储存","size":"1M","state":1}]</textarea>
  122. <script id="basictpl" type="text/html">
  123. <tr class="form-inline">
  124. <td><input type="text" name="<%=name%>[<%=index%>][title]" class="form-control" size="15" value="<%=row.title%>" placeholder="标题"/></td>
  125. <td><input type="text" name="<%=name%>[<%=index%>][intro]" class="form-control" size="15" value="<%=row.intro%>" placeholder="介绍"/></td>
  126. <td><input type="text" name="<%=name%>[<%=index%>][size]" class="form-control" style="width:50px" value="<%=row.size%>" placeholder="大小"/></td>
  127. <td>
  128. <input type="hidden" name="<%=name%>[<%=index%>][state]" id="c-state-<%=index%>" class="form-control" style="width:50px" value="<%=row.state%>" placeholder="状态"/>
  129. <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-state-<%=index%>" data-yes="1" data-no="0" >
  130. <i class="fa fa-toggle-on text-success <%if(row.state==0){%>fa-flip-horizontal text-gray<%}%> fa-2x"></i>
  131. </a>
  132. </td>
  133. <td>
  134. <!--下面的两个按钮务必保留-->
  135. <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
  136. <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
  137. </td>
  138. </tr>
  139. </script>
  140. </div>
  141. </div>
  142. <div class="form-group row">
  143. <label class="control-label col-xs-12">{:__('元素事件')}:</label>
  144. <div class="col-xs-12">
  145. <table class="table fieldlist" data-template="eventtpl" data-name="row[event]" id="second-table">
  146. <tr>
  147. <td>{:__('管理员')}</td>
  148. <td>{:__('图片')}</td>
  149. <td>{:__('登录时间')}</td>
  150. <td width="100"></td>
  151. </tr>
  152. <tr>
  153. <td colspan="4"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></td>
  154. </tr>
  155. </table>
  156. <!--请注意实际开发中textarea应该添加个hidden进行隐藏-->
  157. <textarea name="row[event]" class="form-control" cols="30" rows="5">[{"id":"1","image":"/assets/addons/example/img/200x200.png","time":"2019-06-28 12:05:03"}]</textarea>
  158. <script id="eventtpl" type="text/html">
  159. <tr class="form-inline">
  160. <td><input type="text" name="<%=name%>[<%=index%>][id]" class="form-control selectpage" data-source="auth/admin/selectpage" data-field="username" value="<%=row.id%>" placeholder="管理员"/></td>
  161. <td>
  162. <input type="hidden" name="<%=name%>[<%=index%>][image]" id="c-image-<%=index%>" value="<%=row.image%>">
  163. <!--@formatter:off-->
  164. <button type="button" id="faupload-image" class="btn btn-danger faupload upload-image" data-input-id="c-image-<%=index%>" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" <%if(row.image){%>style="background-image: url('<%=Fast.api.cdnurl(row.image)%>')"<%}%>></button>
  165. <!--@formatter:on-->
  166. </td>
  167. <td><input type="text" name="<%=name%>[<%=index%>][time]" class="form-control datetimepicker" style="width:120px" value="<%=row.time%>" placeholder="时间"/></td>
  168. <td>
  169. <!--下面的两个按钮务必保留-->
  170. <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
  171. <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
  172. </td>
  173. </tr>
  174. </script>
  175. </div>
  176. </div>
  177. <div class="form-group row">
  178. <label class="control-label col-xs-12"></label>
  179. <div class="col-xs-12">
  180. <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
  181. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  182. </div>
  183. </div>
  184. </form>
  185. </div>
  186. </div>
  187. </div>
  188. <div class="col-md-6">
  189. <div class="box box-warning">
  190. <div class="panel-heading">
  191. 自动完成+标签输入示例,<font color="red">只支持FastAdmin1.3.0+</font> {if version_compare($Think.config.fastadmin.version, '1.3.0')<0}<span class="label label-danger">你当前FastAdmin版本不支持</span>{/if}
  192. </div>
  193. <div class="panel-body">
  194. <div class="alert alert-danger-light">
  195. <b>温馨提示</b><br>
  196. </div>
  197. <form id="third-form" role="form" data-toggle="validator" method="POST" action="">
  198. <div class="form-group row">
  199. <label class="control-label col-xs-12">自动完成</label>
  200. <div class="col-xs-12">
  201. <input type="text" class="form-control" data-role="autocomplete" data-autocomplete-options='{"url":"example/customform/get_title_list", "minChars":1}' />
  202. </div>
  203. </div>
  204. <div class="form-group row">
  205. <label class="control-label col-xs-12">标签输入 <span class="text-muted small">输入后<code>回车</code>或<code>,</code>确认</span></label>
  206. <div class="col-xs-12">
  207. <input type="text" class="form-control" data-role="tagsinput" />
  208. </div>
  209. </div>
  210. <div class="form-group row">
  211. <label class="control-label col-xs-12">自动完成+标签输入</label>
  212. <div class="col-xs-12">
  213. <input type="text" class="form-control" data-role="tagsinput" data-tagsinput-options='{"minChars":1, "autocomplete":{"url":"example/customform/get_title_list"}}' />
  214. </div>
  215. </div>
  216. </form>
  217. </div>
  218. </div>
  219. </div>
  220. <div class="col-md-6">
  221. <div class="box box-danger">
  222. <div class="panel-heading">
  223. 动态显示,<font color="red">只支持FastAdmin1.3.3+</font> {if version_compare($Think.config.fastadmin.version, '1.3.3')<0}<span class="label label-danger">你当前FastAdmin版本不支持</span>{/if}
  224. </div>
  225. <div class="panel-body">
  226. <form id="fourth-form" role="form" data-toggle="validator" method="POST" action="">
  227. <div class="form-group row">
  228. <label class="control-label col-xs-12">常规使用</label>
  229. <div class="col-xs-12">
  230. <input type="radio" name="row[type]" value="value1" checked /> 类型1
  231. <input type="radio" name="row[type]" value="value2" /> 类型2
  232. <div data-favisible="type=value1" class="p-3">显示内容1</div>
  233. <div data-favisible="type=value2" class="p-3">显示内容2</div>
  234. </div>
  235. </div>
  236. <hr>
  237. <div class="form-group row">
  238. <label class="control-label col-xs-12">使用开关组件</label>
  239. <div class="col-xs-12">
  240. <input id="c-switch" name="row[switch]" type="hidden" value="0">
  241. <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch" data-yes="1" data-no="0" >
  242. <i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i>
  243. </a>
  244. <div data-favisible="switch=1" class="p-3">显示内容隐藏的内容</div>
  245. </div>
  246. </div>
  247. <hr>
  248. <div class="form-group row">
  249. <label class="control-label col-xs-12">组件嵌套</label>
  250. <div class="col-xs-12">
  251. <input type="radio" name="row[mode]" value="value1" /> 模式1
  252. <input type="radio" name="row[mode]" value="value2" /> 模式2
  253. <div data-favisible="mode=value1" class="p-3">
  254. <h4>显示内容1</h4>
  255. <input id="c-switch1" name="row[switch1]" type="hidden" value="0">
  256. <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch1" data-yes="1" data-no="0" >
  257. <i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i>
  258. </a>
  259. <div data-favisible="switch1=1" class="p-3">显示内容隐藏的内容1</div>
  260. </div>
  261. <div data-favisible="mode=value2" class="p-3">
  262. <h4>显示内容2</h4>
  263. <input id="c-switch2" name="row[switch2]" type="hidden" value="0">
  264. <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch2" data-yes="1" data-no="0" >
  265. <i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i>
  266. </a>
  267. <div data-favisible="switch2=1" class="p-3">显示内容隐藏的内容2</div>
  268. </div>
  269. </div>
  270. </div>
  271. <hr>
  272. <div class="form-group row">
  273. <label class="control-label col-xs-12">使用内容判断 <span class="text-muted small">只有输入指定的内容才显示</span></label>
  274. <div class="col-xs-12">
  275. <input type="text" class="form-control" name="row[title]" placeholder="请输入abc三个字母">
  276. <div data-favisible="title=abc" class="p-3">显示内容隐藏的内容</div>
  277. </div>
  278. </div>
  279. </form>
  280. </div>
  281. </div>
  282. </div>
  283. </div>