addzhanghao.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. {template 'public/header'}{template 'public/comhead'}
  2. <link rel="stylesheet" type="text/css" href="../addons/zh_jdgjb/template/public/ygcss.css">
  3. <style type="text/css">
  4. input[type="radio"] + label::before {
  5. content: "\a0"; /*不换行空格*/
  6. display: inline-block;
  7. vertical-align: middle;
  8. font-size: 16px;
  9. width: 1em;
  10. height: 1em;
  11. margin-right: .4em;
  12. border-radius: 50%;
  13. border: 2px solid #ddd;
  14. text-indent: .15em;
  15. line-height: 1;
  16. }
  17. input[type="radio"]:checked + label::before {
  18. background-color: #44ABF7;
  19. background-clip: content-box;
  20. padding: .1em;
  21. border: 2px solid #44ABF7;
  22. }
  23. input[type="radio"] {
  24. position: absolute;
  25. clip: rect(0, 0, 0, 0);
  26. }
  27. .dis_in{
  28. display: inline-block;
  29. vertical-align: middle;
  30. }
  31. </style>
  32. <ul class="nav nav-tabs">
  33. <span class="ygxian"></span>
  34. <div class="ygdangq">当前位置:</div>
  35. <li><a href="{php echo $this->createWebUrl('zhanghao')}">账号管理</a></li>
  36. <li class="active"><a href="{php echo $this->createWebUrl('addzhanghao')}">添加/编辑账号</a></li>
  37. </ul>
  38. <div class="main">
  39. <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
  40. <div class="panel panel-default ygdefault">
  41. <div class="panel-heading wyheader"> 添加/编辑账号</div>
  42. <div class="panel-body panel">
  43. <div class="form-group">
  44. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">登录账号</label>
  45. <div class="col-sm-10 col-lg-9">
  46. <input id="" name="username" type="text" class="form-control" value="{$users['username']}"/>
  47. <span class="help-block">*请输入用户名,用户名为 3 到 15 个字符组成,包括汉字,大小写字母(不区分大小写)</span>
  48. </div>
  49. </div>
  50. <div class="form-group">
  51. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">登录密码</label>
  52. <div class="col-sm-10 col-lg-9">
  53. <input id="password" name="password" type="password" class="form-control" value="" autocomplete="off"/>
  54. <span class="help-block">*请填写密码,最小长度为 8 个字符</span>
  55. </div>
  56. </div>
  57. <div class="form-group">
  58. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">确认密码</label>
  59. <div class="col-sm-10 col-lg-9">
  60. <input id="repassword" type="password" class="form-control" value="" autocomplete="off"/>
  61. <span class="help-block">*重复输入密码,确认正确输入</span>
  62. </div>
  63. </div>
  64. <div class="form-group">
  65. <label class="col-xs-12 col-sm-3 col-md-2 control-label">状态</label>
  66. <div class="col-sm-9">
  67. <label class="radio-inline">
  68. <input type="radio" id="qiyongc" name="status" value="2" {if $users['status']==2 || empty($users)}checked{/if}>
  69. <label for="qiyongc">启用</label>
  70. </label>
  71. <label class="radio-inline">
  72. <input type="radio" id="qiyongc2" name="status" value="1" {if $users['status']== 1}checked{/if}>
  73. <label for="qiyongc2">关闭</label>
  74. </label>
  75. </div>
  76. </div>
  77. <div class="form-group">
  78. <label class="col-xs-12 col-sm-3 col-md-2 control-label">权限管理</label>
  79. <div class="add_html dis_in" style="width:75%;" value="{$account['authority']}">
  80. </div>
  81. <input style="opacity: 0" type="text" value="" name="form_array">
  82. </div>
  83. </div>
  84. </div>
  85. <div class="form-group">
  86. <input type="submit" name="submit" value="保存设置" class="btn col-lg-3" style="color: white;background-color: #44ABF7;"/>
  87. <input type="hidden" name="token" value="{$_W['token']}"/>
  88. </div>
  89. </form>
  90. </div>
  91. <!-- <script type="text/javascript">
  92. $(function(){
  93. // $("#frame-0").addClass("in");
  94. $("#frame-8").show();
  95. $("#yframe-8").addClass("wyactive");
  96. })
  97. </script> -->
  98. <script type="text/javascript">
  99. $(function(){
  100. $("#frame-12").show();
  101. $("#yframe-12").addClass("wyactive");
  102. $(".searchname").hide();
  103. // console.log('')
  104. var authority = "{$account['authority']}".split(',');
  105. console.log(authority)
  106. var mock = [
  107. {
  108. name:'store',
  109. val:'商家管理',
  110. y:'checked'
  111. },
  112. {
  113. name:'information',
  114. val:'帖子管理',
  115. y:'checked'
  116. },
  117. {
  118. name:'carinfo',
  119. val:'拼车管理',
  120. y:'checked'
  121. },
  122. {
  123. name:'zx',
  124. val:'资讯管理',
  125. y:'checked'
  126. },
  127. {
  128. name:'video',
  129. val:'视频管理',
  130. y:'checked'
  131. },
  132. {
  133. name:'yellowstore',
  134. val:'黄页114',
  135. y:'checked'
  136. },
  137. {
  138. name:'activity',
  139. val:'活动管理',
  140. y:'checked'
  141. },
  142. {
  143. name:'ad',
  144. val:'广告管理',
  145. y:'checked'
  146. },
  147. {
  148. name:'goods',
  149. val:'商品管理',
  150. y:'checked'
  151. }
  152. ]
  153. for(var i = 0;i< authority.length;i++){
  154. for(var j = 0;j< mock.length;j++){
  155. if(mock[j].name==authority[i]){
  156. console.log('相等')
  157. mock[j].y=true
  158. }
  159. }
  160. }
  161. console.log(authority)
  162. console.log(mock)
  163. for(let i in mock){
  164. if(mock[i].y==true){
  165. mock[i].info = ''
  166. mock[i].info += '<div class="col-sm-9 dis_in" style="width:20%;margin-bottom:10px;">'+'<label class="radio-inline">'+'<input type="checkbox" class="dis_in"'+'name='+'"'+mock[i].name+'"'+'value='+mock[i].name+' '+'checked='+'"'+mock[i].y+'"'+'>'+'<text style="margin-left:10px;" class="dis_in">'+mock[i].val+'</text>'+'</label>'+'</div>'
  167. $(".add_html").append(mock[i].info)
  168. }else{
  169. mock[i].info = ''
  170. mock[i].info += '<div class="col-sm-9 dis_in" style="width:20%;margin-bottom:10px;">'+'<label class="radio-inline">'+'<input type="checkbox" class="dis_in"'+'name='+'"'+mock[i].name+'"'+'value='+mock[i].name+'>'+'<text style="margin-left:10px;" class="dis_in">'+mock[i].val+'</text>'+'</label>'+'</div>'
  171. $(".add_html").append(mock[i].info)
  172. }
  173. }
  174. check()
  175. $('input[type=checkbox]').click(function(){
  176. check()
  177. })
  178. function check(){
  179. var checkInput = $('input[type=checkbox]:checked')
  180. var check = []
  181. for(let i in checkInput){
  182. if(checkInput[i].defaultValue!=null){
  183. check.push(checkInput[i].defaultValue)
  184. }
  185. }
  186. check = check.join(',')
  187. console.log(check)
  188. $("input[name=form_array]").val(check)
  189. }
  190. $(".ygbtn").on("click",function(){
  191. var ygsinput = $("#ygsinput").val();
  192. console.log(ygsinput)
  193. if(ygsinput.length==''){
  194. $(".searchname").html('');
  195. }else{
  196. $(".searchname").html('')
  197. var keywords = $("#ygsinput").val()
  198. $.ajax({
  199. type:"post",
  200. url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=SelectJd&m=zh_jdgjb",
  201. dataType:"text",
  202. data:{keywords:keywords},
  203. success:function(data){
  204. var data = eval('(' + data + ')')
  205. console.log(data);
  206. $(".searchname").show();
  207. for(var i=0;i<data.length;i++){
  208. $(".searchname").append('<div class="shnbox" data-dismiss="modal" id="'+data[i].id+'"><a href="javascript:void(0);"><p>'+data[i].name+'</p></a></div>')
  209. }
  210. $(".shnbox").each(function(){
  211. $(this).click(function(){
  212. // 获取选中的用户id
  213. var thid = $(this).text()
  214. // 获取选中的用户name
  215. var user_id = $(this).attr("id")
  216. // 根据选中的用户新增一个option
  217. $("#username").append("<option value='"+user_id+"'>"+thid+"</option>").attr("selected", true);
  218. // 点击之后让value等于user_id的options显示
  219. $("#username").val(user_id);
  220. })
  221. })
  222. }
  223. })
  224. }
  225. })
  226. })
  227. </script>{template 'common/footer'}