publish.html 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>专家编辑</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  9. <link rel="stylesheet" href="/static/public/layui/css/layui.css" media="all">
  10. <link rel="stylesheet" href="/static/public/font-awesome/css/font-awesome.min.css" media="all"/>
  11. <link rel="stylesheet" href="/static/admin/css/admin.css" media="all">
  12. <script src="/static/public/layui/layui.js"></script>
  13. <script src="/static/public/jquery/jquery.min.js"></script>
  14. </head>
  15. <style>
  16. .layui-upload-img {
  17. cursor: pointer;
  18. width: 150px;
  19. height: 150px;
  20. background: url('/static/public/images/uploadimg.jpg');
  21. background-size: contain;
  22. border-radius: 2px;
  23. border-width: 1px;
  24. border-style: solid;
  25. border-color: #e6e6e6;
  26. }
  27. </style>
  28. <body style="padding:10px;">
  29. <div class="tplay-body-div">
  30. {empty name="$data"}
  31. <div class="layui-tab">
  32. <ul class="layui-tab-title">
  33. <li><a href="index" class="a_menu">列表</a></li>
  34. <li class="layui-this">新增</li>
  35. </ul>
  36. </div>
  37. {/empty}
  38. <div style="margin-top: 20px;"></div>
  39. <form class="layui-form" id="publish" method="post">
  40. <!-- 输入框 -->
  41. <div class="layui-form-item">
  42. <label class="layui-form-label">名字</label>
  43. <div class="layui-input-inline" style="max-width:300px;">
  44. <input name="name" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input"
  45. type="text" {notempty name="$data" }value="{$data.name}" {/notempty}>
  46. </div>
  47. <div class="layui-form-mid layui-word-aux">必填</div>
  48. </div>
  49. <!-- 输入框 -->
  50. <div class="layui-form-item">
  51. <label class="layui-form-label">职称</label>
  52. <div class="layui-input-inline" style="max-width:300px;">
  53. <input name="title" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input"
  54. type="text" {notempty name="$data" }value="{$data.title}" {/notempty}>
  55. </div>
  56. <div class="layui-form-mid layui-word-aux">必填</div>
  57. </div>
  58. <!-- 图片 -->
  59. <div class="layui-upload">
  60. <label class="layui-form-label">头像</label>
  61. <div class="layui-upload-list">
  62. <img class="layui-upload-img" id="upload_img_head_pic" {notempty name="$data.head_pic"
  63. }src="{$data.head_pic|geturl}" {/notempty}>
  64. <input type="hidden" id="upload_value_head_pic" name="head_pic"
  65. value='{notempty name="$data.head_pic"}{$data.head_pic}{/notempty}'>
  66. </div>
  67. </div>
  68. <!-- 单选框 -->
  69. <div class="layui-form-item">
  70. <label class="layui-form-label">性别</label>
  71. <div class="layui-input-block">
  72. <input type="radio" name="sex" value="1" title="男" {notempty name="$data" }{eq name="$data.sex"
  73. value="1" } checked {/eq}{/notempty}>
  74. <input type="radio" name="sex" value="2" title="女" {notempty name="$data" }{eq name="$data.sex"
  75. value="2" } checked {/eq}{/notempty}>
  76. </div>
  77. </div>
  78. <!-- 下拉框 -->
  79. <div class="layui-form-item">
  80. <label class="layui-form-label">地址</label>
  81. <div class="layui-input-inline" style="max-width:300px;">
  82. <select name="address_id" lay-filter="" lay-search="" lay-verify="required">
  83. <option value="">请选择</option>
  84. {volist name="$addresslist" id="vo"}
  85. <option value="{$vo.id}"
  86. {notempty name="$data.address_id" }
  87. {eq name="$data.address_id" value="$vo.id" } selected="" {/eq}{/notempty}>{$vo.title}</option>
  88. {/volist}
  89. </select>
  90. </div>
  91. <div class="layui-form-mid layui-word-aux">必填</div>
  92. </div>
  93. <div class="layui-form-item">
  94. <label class="layui-form-label">模块</label>
  95. <div class="layui-input-inline" style="max-width:300px;">
  96. <select name="module" lay-filter="" lay-search="" lay-verify="required">
  97. <option value="">请选择</option>
  98. {volist name="$modules" id="vo"}
  99. <option value="{$vo.id}"
  100. {notempty name="$data.module" }
  101. {eq name="$data.module" value="$vo.id" } selected="" {/eq}{/notempty}>{$vo.name}</option>
  102. {/volist}
  103. </select>
  104. </div>
  105. <div class="layui-form-mid layui-word-aux">必填</div>
  106. </div>
  107. <!-- 输入框 -->
  108. <div class="layui-form-item">
  109. <label class="layui-form-label">联系电话</label>
  110. <div class="layui-input-inline" style="max-width:300px;">
  111. <input name="phone" lay-verify="" autocomplete="off" placeholder="请输入" class="layui-input"
  112. type="text" {notempty name="$data" }value="{$data.phone}" {/notempty}>
  113. </div>
  114. </div>
  115. <!-- 纯文本段落 -->
  116. <div class="layui-form-item layui-form-text">
  117. <label class="layui-form-label">简介</label>
  118. <div class="layui-input-inline" style="width:80%;">
  119. <textarea name="desc" class="layui-textarea">{notempty name="$data"}{$data.desc}{/notempty}</textarea>
  120. </div>
  121. </div>
  122. <!-- 纯文本段落 -->
  123. <div class="layui-form-item layui-form-text">
  124. <label class="layui-form-label">咨询方向</label>
  125. <div class="layui-input-inline" style="width:80%;">
  126. <textarea name="consultation_direction" class="layui-textarea">{notempty name="$data"}{$data.consultation_direction}{/notempty}</textarea>
  127. </div>
  128. </div>
  129. {notempty name="$data"}
  130. <input type="hidden" name="id" value="{$data.id}">
  131. {/notempty}
  132. <div class="layui-form-item">
  133. <div class="layui-input-block">
  134. <button class="layui-btn" lay-submit lay-filter="admin">立即提交</button>
  135. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  136. </div>
  137. </div>
  138. </form>
  139. <script>
  140. layui.use(['layer', 'form', 'laydate'], function () {
  141. var layer = layui.layer,
  142. $ = layui.jquery,
  143. form = layui.form;
  144. var laydate = layui.laydate;
  145. $(window).on('load', function () {
  146. form.on('submit(admin)', function (data) {
  147. $.ajax({
  148. url: "{:url('publish')}",
  149. data: $('#publish').serialize(),
  150. type: 'post',
  151. dataType: 'json',
  152. async: false,
  153. success: function (res) {
  154. if (res.code == 1) {
  155. if (res.msg == "添加成功") {
  156. layer.alert(res.msg, function (index) {
  157. location.href = res.url;
  158. })
  159. } else {
  160. layer.confirm(res.msg, {
  161. btn: ['关闭', '继续编辑']
  162. }, function (index) {
  163. window.parent.tab.close('tplay_specialist{$data.id|default=0}');
  164. }, function (index, layero) {
  165. location.href = res.url;
  166. });
  167. }
  168. } else {
  169. layer.msg(res.msg);
  170. }
  171. }
  172. })
  173. return false;
  174. });
  175. $('#upload_img_head_pic').click(function () {
  176. layer.open({
  177. type: 2,
  178. title: '选择图片',
  179. area: ['570px', '485px'],
  180. id: 'layerDemo', //防止重复弹出
  181. anim: 4,
  182. content: "/admin/attachment/selectimage.html?suffix=_head_pic",
  183. cancel: function () {
  184. //右上角关闭回调
  185. }
  186. });
  187. })
  188. });
  189. });
  190. </script>
  191. </div>
  192. </body>
  193. </html>