content_input.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <style>
  2. .measure-input{
  3. background:transparent url("${ctxPath}/static/images/ruler.gif") repeat-x scroll 0 bottom
  4. }
  5. .mutiUpload{
  6. max-width: 510px;
  7. height:auto;
  8. font-size: 18px;
  9. margin-left: 90px;
  10. margin-top: -10px;
  11. }
  12. .mutiUpload div{
  13. line-height: 1.8;
  14. }
  15. .mutiUpload p{
  16. font-size: 20px;
  17. }
  18. .bjui-pageContent{
  19. margin: 0 auto;
  20. }
  21. </style>
  22. <script type="text/javascript">
  23. function thumb_upload_success(file, data) {
  24. var json = $.parseJSON(data)
  25. $(this).bjuiajax('ajaxDone', json)
  26. if (json[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
  27. $('#j_content_thumb').val(json.filename).trigger('validate')
  28. $('#j_custom_pic').val(json.filename)
  29. $('#j_custom_span_pic').html('<img src="'+ json.filename +'" style="margin: 10px 0 0 0" WIDTH="200" HEIGHT="120"/>')
  30. }
  31. }
  32. function content_save_post(){
  33. $("#status").val("1");
  34. $("#qy_qymc").val($("#qy_id").find("option:selected").text());
  35. }
  36. function content_save(){
  37. $("#status").val("0");
  38. $("#qy_qymc").val($("#qy_id").find("option:selected").text());
  39. }
  40. </script>
  41. @if(isWindow=="NO"){
  42. <div class="bjui-pageHeader">
  43. <div class="bjui-searchBar">
  44. <a class="btn btn-default" data-icon="reply" href="${ctxPath}/system/cms/content/page?categoryId=${category.categoryId!}" data-toggle="ajaxload" data-target="#layout-content">返回栏目</a>&nbsp;
  45. <div class="pull-right">
  46. @if(has(content)){
  47. <!--<a class="btn btn-default" data-icon="desktop" href="${ctxPath}/system/cms/content/input?categoryId=${category.categoryId!}&contentId=${content.content_id!}&isWindow=YES" data-toggle="dialog" data-width="850" data-height="650" data-id="post-content-window-tab" data-mask="true">窗口模式</a>&nbsp;-->
  48. @}else{
  49. <!--<a class="btn btn-default" data-icon="desktop" href="${ctxPath}/system/cms/content/input?categoryId=${category.categoryId!}&isWindow=YES" data-toggle="dialog" data-width="900" data-height="600" data-id="post-content-window-tab" data-mask="true">窗口模式</a>&nbsp;-->
  50. @}
  51. </div>
  52. </div>
  53. </div>
  54. @}
  55. <div class="bjui-pageContent">
  56. <form method="post" action="${ctxPath}/system/cms/content/save" id="j_model_form" data-toggle="validate" data-autorefresh="true" data-alertmsg="false">
  57. <input TYPE="hidden" name="contentId" value="${content.contentId!}">
  58. <input TYPE="hidden" name="userId" value="${session.SysUser.userId!}">
  59. <input TYPE="hidden" name="siteId" value="${session.SysUser.siteId!}">
  60. <input type="hidden" name="tableName" value="${model.tableName!}" >
  61. <input TYPE="hidden" id="status" name="status" >
  62. <script>
  63. var id = '${category.categoryId!}';
  64. if(id=='220'){
  65. $(".tc").attr("style","display:none;");
  66. }
  67. </script>
  68. <div class="form-group tc">
  69. <label for="j_title" class="control-label x85">标题:</label>
  70. <input type="text" name="title" id="j_title" class="input-nm measure-input" value="${content.title!,xss}" placeholder="请填写标题" size="50" >
  71. </div>
  72. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  73. <div class="form-group tc">
  74. <label for="j_keyword" class="control-label x85">关键字:</label>
  75. <input type="text" name="keywords" id="j_keyword" class="input-nm" value="${content.keywords!,xss}" placeholder="关键字请用逗号,隔开" size="50" >
  76. </div>
  77. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  78. <div class="form-group tc">
  79. <label for="j_inputdate" class="control-label x85">日期:</label>
  80. <input style="width:225px;margin-left:0px" name="inputdate" id="j_inputdate" data-rule="required;" value="${content.inputdate!,xss}" class="laydate-icon timeUstyle stateUTime"
  81. onclick="laydate({istime: true,format:'YYYY-MM-DD'})"/>
  82. </div>
  83. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  84. <div class="form-group tc">
  85. <label for="j_des" class="control-label x85">描述:</label>
  86. <textarea id="j_des" name="description" placeholder="请填写文章描述" cols="50">${content.description!,xss}</textarea>
  87. </div>
  88. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  89. <div class="form-group tc">
  90. <label for="categoryId" class="control-label x85">栏目:</label>
  91. <select id="categoryId" data-toggle="selectpicker" class="input-nm" readonly="readonly" name="categoryId">
  92. ${ContentSelectCategoryFunction(session.SysUser.siteId!0,category.categoryId!0)}
  93. </select>
  94. </div>
  95. @if(enterpriseList != null){
  96. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  97. <div class="form-group tc">
  98. <label for="qy_id" class="control-label x85">企业:</label>
  99. <select id="qy_id" data-toggle="selectpicker" class="input-nm" readonly="readonly" name="qy_id">
  100. @for(enterprise in enterpriseList){
  101. <option value="${enterprise.qy_id}">${enterprise.qy_qymc}</option>
  102. @}
  103. </select>
  104. <input type="hidden" id="qy_qymc" name="qy_qymc">
  105. </div>
  106. @}
  107. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  108. <div class="form-group tc">
  109. <label class="control-label x85">封面图片:</label>
  110. <div style="display: inline-block; vertical-align: middle;">
  111. <div id="j_content_thumb" data-toggle="upload" data-uploader="${ctxPath}/uploads"
  112. data-file-size-limit="1024000000"
  113. data-file-type-exts="*.jpg;*.png;*.gif;*.mpg"
  114. data-multi="false"
  115. data-on-upload-success="thumb_upload_success"
  116. data-icon="cloud-upload"></div>
  117. <input type="hidden" name="thumb" value="${content.thumb!}" id="j_custom_pic">
  118. <span id="j_custom_span_pic">
  119. @if(isNotEmpty(content.thumb)){
  120. <IMG WIDTH="200" HEIGHT="120" style="margin: 10px 0 0 0" src="${content.thumb!}">
  121. @}
  122. </span>
  123. </div>
  124. </div>
  125. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  126. <div class="form-group tc">
  127. <label for="j_url" class="control-label x85">外部链接:</label>
  128. <input type="text" name="url" id="j_url" value="${content.url!,xss}" class="input-nm" placeholder="如果填写为外部链接,则文章链接以外部链接为准" size="50" data-rule="url;" >
  129. </div>
  130. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  131. <div class="form-group tc">
  132. <label class="control-label x85">推荐顶置:</label>
  133. <input type="checkbox" id="recommend" name="recommend" data-toggle="icheck" data-label="推荐" ${(isNotEmpty(content.recommend)&&content.recommend)?'checked':''}>
  134. <input type="checkbox" id="top" name="top" data-toggle="icheck" data-label="顶置" ${(isNotEmpty(content.top)&&content.top)?'checked':''}>
  135. </div>
  136. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  137. <div class="form-group tc">
  138. <label for="j_viewnum" class="control-label x85">浏览次数:</label>
  139. <input type="text" name="viewNum" id="j_viewnum" class="input-nm" placeholder="浏览量" value="${content.viewNum!0}" size="20" data-rule="required;integer(+0)" >
  140. </div>
  141. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  142. <div class="form-group tc">
  143. <label for="j_author" class="control-label x85">作者:</label>
  144. <input type="text" name="author" id="j_author" class="input-nm" placeholder="文章作者" value="${isEmpty(content.author)?session.SysUser.username:content.author!,xss}" size="20" data-rule="required;" >
  145. </div>
  146. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  147. <div class="form-group">
  148. <label for="j_sorts" class="control-label x85">排序:</label>
  149. <input type="text" name="sorts" id="j_sorts" size="20"
  150. value="${content.sorts!999}" data-rule="integer;" placeholder="排序">
  151. </div>
  152. <hr class="tc" style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  153. <div class="form-group tc">
  154. <label class="control-label x85">标签:</label>
  155. <input type="text" name="tags" data-toggle="tags" VALUE="" data-url="${ctxPath}/system/cms/tag/json" data-width="500" placeholder="输入关键字,回车提交">
  156. </div>
  157. @for(filed in modelFiled){
  158. <hr style="margin-top: 3px!important;padding-top: 3px;margin-bottom: 3px!important;">
  159. <div class="form-group">
  160. @if(filed.filedClass=="input"){
  161. <!--TODO 有待做详细的表单验证-->
  162. <!--普通表单输入-->
  163. @var t="";
  164. @if(filed.notNull){
  165. @t ="data-rule=\"required;";
  166. @if(filed.filedType=='int'){
  167. @t=t+"'integer;'";
  168. @if(filed.filedLength>1){
  169. @t=t+"length(1~"+filed.filedLength+");";
  170. @}else{
  171. @t=t+"length("+filed.filedLength+");";
  172. @}
  173. @}
  174. @t=t+"\"";
  175. @}
  176. <label for="${filed.filedName!}" class="control-label x85">${filed.alias}:</label>
  177. <input type='text' name='${filed.filedName!}' id='${filed.filedName!}' class='input-nm' placeholder='${filed.alias!}' value='${(!has(content)?filed.filedValue!:content[filed.filedName]!),xss}' size='50' ${t!}>
  178. @}
  179. @if(filed.filedClass=="image"){
  180. <!--判断是否为图片上传字段-->
  181. <!--TODO 有待做自定义文件类型-->
  182. <label for="${filed.filedName!}" class="control-label x85">${filed.alias}:</label>
  183. <input type="file" class="form-control" data-name="${filed.filedName!}" data-toggle="webuploader" data-options="
  184. {
  185. pick: {label: '点击选择图片'},
  186. server: '${ctxPath}/uploads',
  187. fileNumLimit: 20,
  188. formData: {dir:'${filed.filedName!}'},
  189. required: true,
  190. uploaded: '',
  191. basePath: '',
  192. accept: {
  193. title: '图片',
  194. extensions: 'jpg,JPG,jpeg,JPEG,png,gif',
  195. mimeTypes: '.jpg,.JPG,.jpeg,.png,gif'
  196. }
  197. }"
  198. >
  199. <input TYPE="hidden" name="${filed.filedName!}" value="${!has(content)?'':content[filed.filedName]}" >
  200. @}
  201. @if(filed.filedClass=="file"){
  202. <!--判断是否为文件上传字段-->
  203. <script type="text/javascript">
  204. function ${filed.filedName!}_upload_success(file, data) {
  205. var json = $.parseJSON(data)
  206. $(this).bjuiajax('ajaxDone', json)
  207. if (json[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
  208. $('#${filed.filedName!}').val(json.filename).trigger('validate');
  209. $('#${filed.filedName!}_file').val(json.filename);
  210. }
  211. }
  212. </script>
  213. <label for="${filed.filedName!}" class="control-label x85">${filed.alias}:</label>
  214. <div style="display: inline-block; vertical-align: middle;">
  215. <!--遍历获取运行上传的文件类型-->
  216. @var strs = strutil.split(filed.filedValue,"#");
  217. @var str="";
  218. @if(isNotEmpty(strs)){
  219. @for(s in strs){
  220. @str=str+"*."+s+";";
  221. @}
  222. @}
  223. <div id="${filed.filedName!}" data-toggle="upload" data-uploader="${ctxPath}/uploads"
  224. data-file-size-limit="1024000000"
  225. data-file-type-exts="${isNotEmpty(str)?strutil.subStringTo(str,0,strutil.length(str)-1):'*.jpg;*.png;*.gif;*.mpg;*.docx;*.doc;*.xls;*.mp4;'}"
  226. data-multi="false"
  227. data-on-upload-success="${filed.filedName!}_upload_success"
  228. data-icon="cloud-upload"></div>
  229. <span>
  230. <input type="text" class="input-nm" style="margin: 5px 0 0 0" size="50" name="${filed.filedName!}" placeholder="${filed.alias!}" value="${(!has(content)?'':content[filed.filedName]!),xss='escape'}" id="${filed.filedName!}_file">
  231. </span>
  232. </div>
  233. @}
  234. @if(filed.filedClass=="editor"){
  235. <!--判断是否为文本编辑器-->
  236. <textarea data-toggle="CKEditor" data-upload="${ctxPath}/uploads/CKEditorUpload" style="height:650px;max-height:750px;margin:10px 0 0 0" name="${filed.filedName!}">${(has(content)?content[filed.filedName]:filed.filedValue),xss="escape"}</textarea>
  237. @}
  238. @if(filed.filedClass=="textarea"){
  239. <label for="${filed.filedName!}" class="control-label x85">${filed.alias}:</label>
  240. <!--判断是否为文本编辑器-->
  241. <textarea id="${filed.filedName!}" name="${filed.filedName!}" value="" PLACEHOLDER="${filed.filedValue!}" cols="50" ${filed.notNull?'data-rule=\"required;\"':''}>${(!has(content)?filed.filedValue:content[filed.filedName]),xss="escape"}</textarea>
  242. @}
  243. @if(filed.filedClass=="dateInput"){
  244. <label for="${filed.filedName!}" class="control-label x85">${filed.alias}:</label>
  245. <!--判断是否为日期输入框-->
  246. <input type="text" name="${filed.filedName!}" data-toggle="datepicker" value="${(!has(content)?filed.filedValue!:content[filed.filedName]),xss}" data-pattern="yyyy-MM-dd HH:mm:ss">
  247. @}
  248. @if(filed.filedClass=="radio"){
  249. <label class="control-label x85">${filed.alias}:</label>
  250. <!--判断是否为单选按钮-->
  251. @if(isNotEmpty(filed.filedValue)){
  252. @var radios = strutil.split(filed.filedValue,"#");
  253. @for(radio in radios){
  254. @var checked ="";
  255. @if(has(content)){
  256. @if(radio==content[filed.filedName]){
  257. @checked="checked";
  258. @}
  259. @}
  260. <input type="radio" name="${filed.filedName!}" id="${filed.filedName!}_${radio}" ${checked!} data-toggle="icheck" data-label="[${radio}]" value="${radio}" ${filed.notNull?'data-rule=\"required;\"':''}></input>
  261. @}
  262. @}
  263. @}
  264. @if(filed.filedClass=="checkbox"){
  265. <label for="${filed.filedName!}" class="control-label x85">${filed.alias}:</label>
  266. <!--判断是为多选按钮-->
  267. @if(isNotEmpty(filed.filedValue)){
  268. @var checkboxs = strutil.split(filed.filedValue,"#");
  269. @for(checkbox in checkboxs){
  270. @var checked ="";
  271. @if(has(content)){
  272. @if(checkbox==content[filed.filedName]){
  273. @checked="checked";
  274. @}
  275. @}
  276. <input type="checkbox" name="${filed.filedName!}" id="${filed.filedName!}" ${checked!} data-toggle="icheck" data-label="${checkbox}" value="${checkbox}" ${filed.notNull?'data-rule=\"required;\"':''}></input>
  277. @}
  278. @}
  279. @}
  280. @if(filed.filedClass=="select"){
  281. <label for="${filed.filedName!}" class="control-label x85">${filed.alias}:</label>
  282. <!--判断是为单选菜单-->
  283. @if(isNotEmpty(filed.filedValue)){
  284. @var selects = strutil.split(filed.filedValue,"#");
  285. <select name="${filed.filedName!}" data-toggle="selectpicker" ${filed.notNull?'data-rule=\"required\"':''}>
  286. <option value="" selected>所有</option>
  287. @for(s in selects){
  288. @var selected ="";
  289. @if(has(content)){
  290. @if(s==content[filed.filedName]){
  291. @selected="selected";
  292. @}
  293. @}
  294. <option value="${s}" ${selected!}>${s}</option>
  295. @}
  296. </select>
  297. @}
  298. @}
  299. </div>
  300. @}
  301. </form>
  302. </div>
  303. <div class="bjui-pageFooter">
  304. <ul>
  305. <li><button onclick="content_save()" type="submit" class="btn btn-blue" data-icon="pencil">暂存草稿</button></li>
  306. @if(!(shiro.lacksRole("superAdmin"))){
  307. <li><button onclick="content_save_post()" type="submit" class="btn btn-green" data-icon="send">保存发布</button></li>
  308. @}
  309. </ul>
  310. </div>