company_security.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. @extends('jkq.module.layouts.company')
  2. @push('meta')
  3. @endpush
  4. @push('css')
  5. <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/common.css') }}"/>
  6. <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/company_user.css')}}"/>
  7. <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/company_ajax_dialog.css')}}"/>
  8. <style>.td1 a:hover{cursor: pointer} </style>
  9. @endpush
  10. @push('js')
  11. <script type="text/javascript" src="{{ theme_asset('app/js/company/jquery.common.js') }}"></script>
  12. <script type="text/javascript" src="{{ theme_asset('gt/gt.js') }}"></script>
  13. <script type="text/javascript" src="{{ theme_asset('gt/gt.handle.js') }}"></script>
  14. <script>
  15. $(function () {
  16. @if(!empty(session('message')))
  17. disapperTooltip("remind", "{{ session('message') }}");
  18. @endif
  19. });
  20. </script>
  21. @endpush
  22. @section('content')
  23. <div class="user_main">
  24. <div class="mleft">
  25. @include('jkq.module.section.company_left')
  26. </div>
  27. <div class="mright">
  28. <div class="user_pagetitle safety_user_pagetitle">
  29. <div class="pat_l">账号安全</div>
  30. <div class="clear"></div>
  31. </div>
  32. <div class="user_tab">
  33. <a href="{{ route('jkq.com.security') }}" class="tabli select">账号安全</a>
  34. <a href="{{ route('jkq.com.security.loginLog') }}" class="tabli">登录日志</a>
  35. <div class="clear"></div>
  36. </div>
  37. <div class="user_tip w680">
  38. <div class="tiptit">小提示</div>
  39. <div class="tiptxt link_blue">
  40. 手机号、邮箱认证通过后可增强您账号的安全性,也可通过已认证的手机号、邮箱快速登录账号。
  41. </div>
  42. </div>
  43. <div class="safety J_hoverbut link_blue">
  44. <div class="td1">用户名</div>
  45. <div id="J_unameWrap" class="td2">{{ $companyInfo->username }}</div>
  46. <div class="td3">&nbsp;</div>
  47. <div class="td4"><a id="J_edit_uname" href="javascript:;">修改</a></div>
  48. <div class="clear"></div>
  49. </div>
  50. <div class="safety J_hoverbut link_blue">
  51. <div class="td1 t1">密码</div>
  52. <div class="td2">上次登录时间:<span>{{ date('Y-m-d H:i:s', $companyInfo->last_login_time) }}</span></div>
  53. <div class="td3"><a href="{{ route('jkq.com.security.loginLog') }}">[查看登录日志]</a></div>
  54. <div class="td4"><a id="J_edit_password" href="javascript:;">修改</a></div>
  55. <div class="clear"></div>
  56. </div>
  57. {{-- <div class="safety J_hoverbut link_blue">--}}
  58. {{-- <div class="td1 t2">手机</div>--}}
  59. {{-- <div id="J_mobileWrap" class="td2">{{ $companyInfo->mobile or "手机未填写"}}<span>(认证后可用于登录账号、找回密码)</span></div>--}}
  60. {{-- <div id="J_mobileStatus" class="td3">--}}
  61. {{-- @if(!$companyInfo->mobile_audit)<div class="no"> 未认证</div>@else--}}
  62. {{-- <div class="yes"> 已认证</div>--}}
  63. {{-- @endif--}}
  64. {{-- </div>--}}
  65. {{-- <input type="hidden" id="J_mobile_verify" value="{{ config('aix.system.site_safety.site_vo_code.captcha_open') }}" />--}}
  66. {{-- <div class="td4"><a id="J_auth_mobile" href="javascript:;" data-auth="{{ $companyInfo->mobile_audit }}">@if(!$companyInfo->mobile_audit)立即认证 @else 修改 @endif</a></div>--}}
  67. {{-- <div class="clear"></div>--}}
  68. {{-- </div>--}}
  69. <div class="safety J_hoverbut link_blue">
  70. <div class="td1 t3">邮箱</div>
  71. <div id="J_emailWrap" class="td2">{{ $companyInfo->email or "Email未填写" }}<span>(认证后用于登录账号、找回密码)</span></div>
  72. <div id="J_emailStatus" class="td3">
  73. @if(!$companyInfo->email_audit)
  74. <div class="no">未认证</div>
  75. @else
  76. <div class="yes"> 已认证</div>
  77. @endif
  78. </div>
  79. <div class="td4">
  80. <a id="J_auth_email" href="javascript:;" data-auth="{{ $companyInfo->email_audit }}">@if(!$companyInfo->email_audit) 立即认证 @else 修改 @endif </a>
  81. </div>
  82. <div class="clear"></div>
  83. </div>
  84. <div class="safety_btit">账号绑定<span>(授权绑定后,可使用第三方账号快速登录)</span></div>
  85. <div class="safety_binding">
  86. @if(config('aix.system.oauth.qq.is_open_qq') == 1)
  87. <div class="td1">
  88. <div class="qq @if($qq) ok @endif">腾讯QQ</div>
  89. @if($qq)
  90. <div class="txt link_blue "><a class="J_unlogin" name="腾讯QQ" url="{{ route('jkq.unbindThird',['alias'=>'qq']) }}" href="javascript:;" >解除绑定</a></div>
  91. @else
  92. <div class="txt link_blue"><a id="J_bind_qq">立即绑定</a></div>
  93. @endif
  94. </div>
  95. @endif
  96. @if(config('aix.system.oauth.wechat_open.is_open') == 1)
  97. <div class="td1">
  98. <div class="weixin @if($weixin) ok @endif">微信</div>
  99. @if($weixin)
  100. <div class="txt link_blue "><a class="J_unlogin" name="微信" url="{{ route('jkq.unbindThird',['alias'=>'weixin']) }}" href="javascript:;" >解除绑定</a></div>
  101. @else
  102. <div class="txt link_blue"><a id="J_bind_weixin">立即绑定</a></div>
  103. @endif
  104. </div>
  105. @endif
  106. <div class="clear"></div>
  107. </div>
  108. </div>
  109. <div class="clear"></div>
  110. </div>
  111. @endsection
  112. @section('script')
  113. <script type="text/javascript" src="{{ theme_asset('app/js/regular.js') }}"></script>
  114. <script type="text/javascript" src="{{ theme_asset('app/js/jquery.disappear.tooltip.js') }}"></script>
  115. <script type="text/javascript" src="{{ theme_asset('app/js/jquery.validate.js') }}"></script>
  116. <script type="text/javascript" src="{{theme_asset('app/js/jquery.modal.dialog.js')}}"></script>
  117. @include('module.widgets.thirdlogin_bind', ['redirect_url'=>route('jkq.com.security'), 'redirect_name'=>"账号安全"])
  118. <script type="text/javascript">
  119. $('#J_edit_password').click(function(){
  120. var qsDialog = $(this).dialog({
  121. title: '修改密码',
  122. loading: true,
  123. showFooter: false,
  124. yes: function() {
  125. var options = {};
  126. options['oldpassword'] = $('#J_passwordWrap').find('input[name="oldpassword"]').val();
  127. options['password'] = $('#J_passwordWrap').find('input[name="password"]').val();
  128. options['password1'] = $('#J_passwordWrap').find('input[name="password1"]').val();
  129. options['_token'] = "{{csrf_token()}}";
  130. $.ajax({
  131. method: 'post',
  132. url: '{{ route('jkq.savePwd') }}',
  133. data: options,
  134. beforeSend:function () {
  135. },
  136. complete:function() {
  137. },
  138. success: function (data) {
  139. disapperTooltip('success',data.data);
  140. location.reload();
  141. },
  142. error: function (errorData) {
  143. if (errorData.status==422) {//验证错误
  144. // console.log(errorData.errors);return ;
  145. $.each(errorData.responseJSON.errors,function (key,val) {
  146. disapperTooltip("remind", val[0]);
  147. });
  148. }
  149. else if(errorData.status==400) {//业务错误
  150. disapperTooltip("remind", errorData.responseJSON.message);
  151. }
  152. },
  153. });
  154. }
  155. });
  156. $.get("{{route('jkq.modifyPwd')}}",function(result){
  157. qsDialog.setCloseDialog(false);
  158. qsDialog.setContent(result);
  159. qsDialog.showFooter(true);
  160. });
  161. });
  162. var regularUsername = /^(?=[\u4e00-\u9fa5a-zA-Z])(?!\d+)[\u4e00-\u9fa5\w.]{6,20}$/;
  163. $('#J_edit_uname').click(function(){
  164. var qsDialog = $(this).dialog({
  165. title: '修改用户名',
  166. loading: true,
  167. showFooter: false,
  168. yes: function() {
  169. var username = $.trim($('#J_usernameInput').val());
  170. if (!username.length) {
  171. disapperTooltip("remind", '请填写新用户名');
  172. $('#J_usernameInput').focus();
  173. return false;
  174. }
  175. if (username.length && !regularUsername.test(username)) {
  176. disapperTooltip("remind", "用户名中英文开头6-20位,无特殊符号");
  177. $('#J_usernameInput').focus();
  178. return false;
  179. }
  180. $.ajax({
  181. method: 'post',
  182. url: '{{ route('jkq.saveUsername') }}',
  183. data: {username:username,_token:"{{csrf_token()}}"},
  184. beforeSend:function () {
  185. },
  186. complete:function() {
  187. },
  188. success: function (data) {
  189. disapperTooltip('success',data.data);
  190. location.reload();
  191. },
  192. error: function (errorData) {
  193. if (errorData.status==422) {//验证错误
  194. // console.log(errorData.errors);return ;
  195. $.each(errorData.responseJSON.errors,function (key,val) {
  196. disapperTooltip("remind", val[0]);
  197. });
  198. }
  199. else if(errorData.status==400) {//业务错误
  200. disapperTooltip("remind", errorData.message);
  201. }
  202. },
  203. });
  204. }
  205. });
  206. $.get("{{ route('jkq.modifyUsername') }}",function(result){
  207. // if(result.status == 1){
  208. qsDialog.setCloseDialog(false);
  209. qsDialog.setContent(result);
  210. qsDialog.showFooter(true);
  211. // }else{
  212. // qsDialog.setContent('<div class="confirm">' + result.msg + '</div>');
  213. // }
  214. });
  215. });
  216. $('#J_auth_email').click(function(){
  217. var f = $(this);
  218. var auth = $(this).data('auth');
  219. var title = '认证邮箱';
  220. if(auth == 1){
  221. title = '修改已认证邮箱';
  222. }
  223. var qsDialog = $(this).dialog({
  224. title: title,
  225. loading: true,
  226. border: false,
  227. footer: false
  228. });
  229. $.get("{{ route('jkq.authEmail') }}",function(result){
  230. if(result.status) {
  231. qsDialog.hide();
  232. var qsDialogSon = $(this).dialog({
  233. title: title,
  234. border: false,
  235. content: result.data,
  236. footer: false
  237. });
  238. } else {
  239. qsDialog.hide();
  240. disapperTooltip('remind',result.msg);
  241. }
  242. });
  243. });
  244. $('#J_bind_weixin').click(function(){
  245. location.href=wechat_bind_url;
  246. });
  247. $('#J_bind_qq').click(function(){
  248. location.href=qq_bind_url;
  249. });
  250. $('.J_unlogin').click(function(){
  251. var url = $(this).attr('url'),
  252. name = $(this).attr('name'),
  253. qsDialog=$(this).dialog({
  254. title: '取消绑定',
  255. loading: false,
  256. border: false,
  257. content : '当前账号已绑定<'+name+'><br/>确定解绑吗?',
  258. yes: function() {
  259. $.get(url,function (res) {
  260. if(res.status) {
  261. disapperTooltip('success',res.msg);
  262. } else {
  263. disapperTooltip('remind',res.msg);
  264. }
  265. setTimeout(function () {
  266. window.location.reload();
  267. },2000)
  268. })
  269. }
  270. });
  271. });
  272. $('#J_auth_mobile').click(function(){
  273. var f = $(this);
  274. var auth = f.data('auth');
  275. var title = '认证手机';
  276. if(auth == 1){
  277. title = '修改已认证手机';
  278. }
  279. var qsDialog = $(this).dialog({
  280. title: title,
  281. loading: true,
  282. border: false,
  283. footer: false
  284. });
  285. $.get("{{ route('jkq.authMobile')}}",function(result){
  286. qsDialog.hide();
  287. var qsDialogSon = $(this).dialog({
  288. title: title,
  289. border: false,
  290. content: result,
  291. yes: function() {
  292. var mobile = $.trim($('#J_mobileWrap input[name="mobile"]').val());
  293. if(mobile == ''){
  294. $('#J_mobileWrap .J_errbox').text('手机号不能不空!').show();
  295. return false;
  296. }
  297. if (mobile != "" && !regularMobile.test(mobile)) {
  298. $('#J_mobileWrap .J_errbox').text('手机号码格式不正确!').show();
  299. return false;
  300. }
  301. var verifycode = $.trim($('#J_mobileWrap input[name="verifycode"]').val());
  302. if(!verifycode){
  303. $('#J_mobileWrap .J_errbox').text('请填写验证码!').show();
  304. return false;
  305. }
  306. var postData = {mobile:mobile,id:"{{auth('web-company')->user()->id}}",verifycode:verifycode,_token:'{{csrf_token()}}'}
  307. $.post("{{ route('jkq.mobile.audit') }}",postData,function(result){
  308. if(result.status == 1){
  309. qsDialogSon.hide();
  310. f.text('修改');
  311. $('#J_mobileStatus').html('<div class="yes">已认证</div>');
  312. $('#J_mobileWrap').html(result.data.mobile+'<span>(认证后可使用该手机登录账号、找回密码)</span>');
  313. if(result.data.points){
  314. disapperTooltip("goldremind", '验证手机号增加'+result.data.points+'积分<span class="point">+'+result.data.points+'</span>');
  315. }else{
  316. disapperTooltip('success',result.msg);
  317. }
  318. } else {
  319. $('#J_mobileWrap .J_errbox').text(result.msg).show();
  320. }
  321. },'json');
  322. }
  323. });
  324. qsDialogSon.setCloseDialog(false);
  325. });
  326. });
  327. </script>
  328. @endsection