publish.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. <!-- 输入框 -->
  94. <div class="layui-form-item">
  95. <label class="layui-form-label">联系电话</label>
  96. <div class="layui-input-inline" style="max-width:300px;">
  97. <input name="phone" lay-verify="" autocomplete="off" placeholder="请输入" class="layui-input"
  98. type="text" {notempty name="$data" }value="{$data.phone}" {/notempty}>
  99. </div>
  100. </div>
  101. <!-- 纯文本段落 -->
  102. <div class="layui-form-item layui-form-text">
  103. <label class="layui-form-label">简介</label>
  104. <div class="layui-input-inline" style="width:80%;">
  105. <textarea name="desc" class="layui-textarea">{notempty name="$data"}{$data.desc}{/notempty}</textarea>
  106. </div>
  107. </div>
  108. <!-- 纯文本段落 -->
  109. <div class="layui-form-item layui-form-text">
  110. <label class="layui-form-label">咨询方向</label>
  111. <div class="layui-input-inline" style="width:80%;">
  112. <textarea name="consultation_direction" class="layui-textarea">{notempty name="$data"}{$data.consultation_direction}{/notempty}</textarea>
  113. </div>
  114. </div>
  115. {notempty name="$data"}
  116. <input type="hidden" name="id" value="{$data.id}">
  117. {/notempty}
  118. <div class="layui-form-item">
  119. <div class="layui-input-block">
  120. <button class="layui-btn" lay-submit lay-filter="admin">立即提交</button>
  121. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  122. </div>
  123. </div>
  124. </form>
  125. <script>
  126. layui.use(['layer', 'form', 'laydate'], function () {
  127. var layer = layui.layer,
  128. $ = layui.jquery,
  129. form = layui.form;
  130. var laydate = layui.laydate;
  131. $(window).on('load', function () {
  132. form.on('submit(admin)', function (data) {
  133. $.ajax({
  134. url: "{:url('publish')}",
  135. data: $('#publish').serialize(),
  136. type: 'post',
  137. dataType: 'json',
  138. async: false,
  139. success: function (res) {
  140. if (res.code == 1) {
  141. if (res.msg == "添加成功") {
  142. layer.alert(res.msg, function (index) {
  143. location.href = res.url;
  144. })
  145. } else {
  146. layer.confirm(res.msg, {
  147. btn: ['关闭', '继续编辑']
  148. }, function (index) {
  149. window.parent.tab.close('tplay_specialist{$data.id|default=0}');
  150. }, function (index, layero) {
  151. location.href = res.url;
  152. });
  153. }
  154. } else {
  155. layer.msg(res.msg);
  156. }
  157. }
  158. })
  159. return false;
  160. });
  161. $('#upload_img_head_pic').click(function () {
  162. layer.open({
  163. type: 2,
  164. title: '选择图片',
  165. area: ['570px', '485px'],
  166. id: 'layerDemo', //防止重复弹出
  167. anim: 4,
  168. content: "/admin/attachment/selectimage.html?suffix=_head_pic",
  169. cancel: function () {
  170. //右上角关闭回调
  171. }
  172. });
  173. })
  174. });
  175. });
  176. </script>
  177. </div>
  178. </body>
  179. </html>