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