profile.blade.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. @extends('admin/layout')
  2. @section('content')
  3. <body class="gray-bg">
  4. <div class="wrapper wrapper-content animated fadeInRight">
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <div class="ibox float-e-margins">
  8. <div class="ibox-content">
  9. <form method="get" class="form-horizontal" id="form">
  10. <div class="form-group">
  11. <div class="col-sm-2" style="text-align: right;height: 100%;padding-top: 20px">
  12. <label for="profile">头像:</label>
  13. </div>
  14. <div class="col-sm-8">
  15. <span>
  16. <img alt="image" class="img-circle"
  17. src="{{$data->profile_img}}"
  18. style="width: 64px;@if(empty($data->profile_img))display:none;@endif"
  19. id="profile_img">
  20. </span>
  21. <br>
  22. <br>
  23. <button type="button" class="btn btn-primary" onclick="units.translate()">随机一个头像
  24. </button>
  25. <button type="button" class="btn btn-primary" onclick="units.fileUpload(this)">
  26. 上传头像
  27. </button>
  28. <input type="file" style="display: none" onchange="units.uploadFile(this)">
  29. </div>
  30. </div>
  31. <div class="form-group">
  32. <label class="col-sm-2 control-label" for="nickname">昵称:</label>
  33. <div class="col-sm-8">
  34. <input type="text" class="form-control" id="nickname" name="nickname"
  35. value="{{$data->nickname ?? ''}}">
  36. </div>
  37. </div>
  38. <div class="form-group">
  39. <label class="col-sm-2 control-label" for="username">用户名:</label>
  40. <div class="col-sm-8">
  41. <input type="text" class="form-control" id="username" name="username"
  42. value="{{$data->username ?? ''}}">
  43. </div>
  44. </div>
  45. <div class="form-group">
  46. <label class="col-sm-2 control-label" for="password">密码:</label>
  47. <div class="col-sm-8">
  48. <input type="password" class="form-control" id="password" name="password">
  49. <span class="help-block m-b-none">如果不需要修改密码请设为空</span>
  50. </div>
  51. </div>
  52. <div class="hr-line-dashed"></div>
  53. <div class="form-group">
  54. <label class="col-sm-2 control-label" for="entry_time">入职时间:</label>
  55. <div class="col-sm-8">
  56. <input type="text" class="form-control deadline" id="entry_time" name="entry_time"
  57. autocomplete="off"
  58. value="{{str_limit($data->entry_time??'',10,'')}}">
  59. </div>
  60. </div>
  61. <div class="form-group">
  62. <label class="col-sm-2 control-label" for="phone">手机号:</label>
  63. <div class="col-sm-8">
  64. <input type="text" class="form-control" id="phone" name="phone"
  65. value="{{$data->phone ?? ''}}">
  66. </div>
  67. </div>
  68. <div class="form-group">
  69. <label class="col-sm-2 control-label" for="phone">qq号:</label>
  70. <div class="col-sm-8">
  71. <input type="text" class="form-control" id="qq" name="qq"
  72. value="{{$data->qq ?? ''}}">
  73. </div>
  74. </div>
  75. <div class="form-group">
  76. <label class="col-sm-2 control-label" for="phone">座机:</label>
  77. <div class="col-sm-8">
  78. <input type="text" class="form-control" id="telephone" name="telephone"
  79. value="{{$data->telephone ?? ''}}">
  80. </div>
  81. </div>
  82. <div class="form-group">
  83. <label class="col-sm-2 control-label" for="email">邮箱:</label>
  84. <div class="col-sm-8">
  85. <input type="email" class="form-control" id="email" name="email"
  86. value="{{$data->email??''}}">
  87. </div>
  88. </div>
  89. <div class="form-group">
  90. <label class="col-sm-2 control-label" for="intro">介绍:</label>
  91. <div class="col-sm-8">
  92. <textarea rows="3" class="form-control" id="intro" placeholder="这个人很懒,什么都没留下~"
  93. name="intro">{{$data->intro??''}}</textarea>
  94. </div>
  95. </div>
  96. <div class="form-group">
  97. <div class="col-sm-4 col-sm-offset-2">
  98. <button class="btn btn-primary" type="button" onclick="units.save()">
  99. 保存
  100. </button>
  101. </div>
  102. </div>
  103. </form>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </body>
  110. @endsection
  111. @section('footer')
  112. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  113. <script>
  114. //时间插件
  115. lay('.deadline').each(function () {
  116. laydate.render({
  117. elem: this
  118. , trigger: 'click'
  119. });
  120. });
  121. var units = {
  122. save: function () {
  123. var data = tips.getFormValues('#form');
  124. data.profile_img = $("#profile_img").attr('src');
  125. var config = {
  126. type: 'PUT',
  127. url: '/admin/index/profile?id=' + "{{$data->id??0}}",
  128. data: data
  129. };
  130. tips.ajax(config);
  131. },
  132. fileUpload: function (_this) {
  133. $(_this).next().trigger('click')
  134. },
  135. uploadFile: function (_this) {
  136. var config = {
  137. url: '/admin/tool/upload'
  138. };
  139. config.success = function (result) {
  140. layer.msg(result.message, {icon: 6, time: 1500});
  141. var img = $("#profile_img");
  142. img.attr('src', result.data.file_url);
  143. img.css('display', '');
  144. };
  145. tips.fileUpload(_this, config);
  146. },
  147. translate: function () {
  148. //x上限,y下限
  149. var x = 224;
  150. var y = 1;
  151. var rand = parseInt(Math.random() * (x - y + 1) + y);
  152. var img = $("#profile_img");
  153. img.attr('src', '{{asset('img/avatar')}}/战网头像%20(' + rand + ').png');
  154. }
  155. };
  156. </script>
  157. @endsection