index.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. <!--ul需要添加 data-template和data-name属性,并一一对应且唯一 -->
  27. <ul class="row list-inline plupload-preview" id="p-files" data-template="introtpl" data-name="row[intro]"></ul>
  28. <!--请注意 ul和textarea间不能存在其它任何元素,实际开发中textarea应该添加个hidden进行隐藏-->
  29. <textarea name="row[intro]" class="form-control" style="margin-top:5px;">["简洁响应式博客","CMS内容管理系统","在线投票系统"]</textarea>
  30. <!--这里自定义图片预览的模板 开始-->
  31. <script type="text/html" id="introtpl">
  32. <li class="col-xs-3">
  33. <a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail">
  34. <img src="<%=fullurl%>" class="img-responsive">
  35. </a>
  36. <input type="text" name="row[intro][<%=index%>]" class="form-control" placeholder="请输入文件描述" value="<%=value?value:''%>"/>
  37. <a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a>
  38. </li>
  39. </script>
  40. <!--这里自定义图片预览的模板 结束-->
  41. </div>
  42. </div>
  43. <div class="form-group row">
  44. <label class="control-label col-xs-12 col-sm-2">{:__('二维数组示例')}:</label>
  45. <div class="col-xs-12 col-sm-8">
  46. <div class="input-group">
  47. <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">
  48. <div class="input-group-addon no-border no-padding">
  49. <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>
  50. <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>
  51. </div>
  52. <span class="msg-box n-right" for="c-images"></span>
  53. </div>
  54. <!--ul需要添加 data-template和data-name属性,并一一对应且唯一 -->
  55. <ul class="row list-inline plupload-preview" id="p-images" data-template="desctpl" data-name="row[desc]"></ul>
  56. <!--请注意 ul和textarea间不能存在其它任何元素,实际开发中textarea应该添加个hidden进行隐藏-->
  57. <textarea name="row[desc]" class="form-control" style="margin-top:5px;">[{"info":"开发者示例插件","size":"1M"},{"info":"又拍云储存整合","size":"2M"},{"info":"阿里OSS云储存","size":"1M"}]</textarea>
  58. <!--这里自定义图片预览的模板 开始-->
  59. <script type="text/html" id="desctpl">
  60. <li class="col-xs-3">
  61. <a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail">
  62. <img src="<%=fullurl%>" class="img-responsive">
  63. </a>
  64. <input type="text" name="row[desc][<%=index%>][info]" class="form-control" placeholder="请输入插件描述" value="<%=value?value['info']:''%>"/>
  65. <input type="text" name="row[desc][<%=index%>][size]" class="form-control" placeholder="请输入插件大小" value="<%=value?value['size']:''%>"/>
  66. <a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a>
  67. </li>
  68. </script>
  69. <!--这里自定义图片预览的模板 结束-->
  70. </div>
  71. </div>
  72. <div class="form-group row">
  73. <label class="control-label col-xs-12 col-sm-2"></label>
  74. <div class="col-xs-12 col-sm-8">
  75. <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
  76. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  77. </div>
  78. </div>
  79. </form>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="col-md-6">
  84. <div class="box box-info">
  85. <div class="panel-heading">
  86. {:__('自定义Fieldlist示例')}
  87. </div>
  88. <div class="panel-body">
  89. <div class="alert alert-danger-light">
  90. <b>温馨提示</b><br>
  91. 默认我们的fieldlist只有一维数组,为键值形式,如果需要二维数组,可使用下面的自定义模板来实现<br>
  92. 默认追加的元素是没有进行事件绑定的,我们需要监听btn-append这个按钮的fa.event.appendfieldlist事件<br>
  93. <b>下面的演示textarea为了便于调试,设置为可见的,实际使用中应该添加个hidden的class进行隐藏</b>
  94. </div>
  95. <form id="second-form" role="form" data-toggle="validator" method="POST" action="">
  96. <div class="form-group row">
  97. <label class="control-label col-xs-12 col-sm-2">{:__('Fieldlist示例')}:</label>
  98. <div class="col-xs-12 col-sm-8">
  99. <dl class="fieldlist" data-template="basictpl" data-name="row[basic]">
  100. <dd>
  101. <ins>{:__('标题')}</ins>
  102. <ins>{:__('介绍')}</ins>
  103. <ins>{:__('大小')}</ins>
  104. </dd>
  105. <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
  106. <!--请注意 dd和textarea间不能存在其它任何元素,实际开发中textarea应该添加个hidden进行隐藏-->
  107. <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>
  108. </dl>
  109. <script id="basictpl" type="text/html">
  110. <dd class="form-inline">
  111. <ins><input type="text" name="<%=name%>[<%=index%>][title]" class="form-control" value="<%=row.title%>" placeholder="标题" size="10"/></ins>
  112. <ins><input type="text" name="<%=name%>[<%=index%>][intro]" class="form-control" value="<%=row.intro%>" placeholder="描述"/></ins>
  113. <ins><input type="text" name="<%=name%>[<%=index%>][size]" class="form-control" value="<%=row.size%>" placeholder="大小"/></ins>
  114. <!--下面的两个按钮务必保留-->
  115. <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
  116. <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
  117. </dd>
  118. </script>
  119. </div>
  120. </div>
  121. <div class="form-group row">
  122. <label class="control-label col-xs-12 col-sm-2">{:__('元素事件')}:</label>
  123. <div class="col-xs-12 col-sm-8">
  124. <dl class="fieldlist" data-template="eventtpl" data-name="row[event]">
  125. <dd>
  126. <ins>{:__('管理员')}</ins>
  127. <ins>{:__('名称')}</ins>
  128. <ins>{:__('登录时间')}</ins>
  129. </dd>
  130. <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
  131. <!--请注意 dd和textarea间不能存在其它任何元素,实际开发中textarea应该添加个hidden进行隐藏-->
  132. <textarea name="row[event]" class="form-control" cols="30" rows="5">[{"id":"1","name":"admin","time":"2019-06-28 12:05:03"}]</textarea>
  133. </dl>
  134. <script id="eventtpl" type="text/html">
  135. <dd class="form-inline">
  136. <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>
  137. <ins><input type="text" name="<%=name%>[<%=index%>][name]" class="form-control" value="<%=row.name%>" placeholder="名称"/></ins>
  138. <ins><input type="text" name="<%=name%>[<%=index%>][time]" class="form-control datetimepicker" value="<%=row.time%>" placeholder="时间"/></ins>
  139. <!--下面的两个按钮务必保留-->
  140. <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
  141. <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
  142. </dd>
  143. </script>
  144. </div>
  145. </div>
  146. <div class="form-group row">
  147. <label class="control-label col-xs-12 col-sm-2"></label>
  148. <div class="col-xs-12 col-sm-8">
  149. <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
  150. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  151. </div>
  152. </div>
  153. </form>
  154. </div>
  155. </div>
  156. </div>
  157. </div>