create.blade.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <div style="margin-top: 10px;" id="users-app">
  2. <div style="text-align: center;margin-top: 5px;margin-bottom: 10px;font-size: 20px;">
  3. 新增 - 账号
  4. </div>
  5. <el-form action="{{route('admin.user.save')}}" method="post" id="form-create">
  6. <!-- name -->
  7. <ui-input-text label="账号昵称:" name="name" placeholder="账号昵称" maxlength="255" tips="请输入账号昵称" autofocus="true"></ui-input-text>
  8. <!-- email -->
  9. <ui-input-text label="账号(邮箱):" name="email" placeholder="注册邮箱账号" maxlength="255" tips="请输入注册邮箱" autofocus="true"></ui-input-text>
  10. <!-- password -->
  11. <ui-input-text label="登录密码:" name="password" placeholder="登录密码" minlength="6" maxlength="12" tips="请输入登录密码" autofocus="true"></ui-input-text>
  12. {{-- 商品分类 --}}
  13. <ui-select label="选择角色:" name="role_id" placeholder="" :options="options" :free="true"></ui-select>
  14. <ui-submit></ui-submit>
  15. </el-form>
  16. </div>
  17. <script type="application/javascript">
  18. $(function () {
  19. // 注意:Vue组件一定放在jQuery.validator前面验证
  20. new Vue({
  21. el: '#users-app',
  22. data :function () {
  23. return {
  24. options: {!! $options !!},
  25. };
  26. }
  27. });
  28. jQuery.validator.setDefaults({
  29. debug: false, // 调试模式true不会提交,false允许提交
  30. success: "success", // 匹配成功的class样式名称
  31. errorElement: 'div' // 兼容el标签时使用(兼容el Vue组件label.error标签问题)
  32. });
  33. // 前台数据验证 验证需要设置window.form全局变量
  34. window.form = $('#form-create').validate({
  35. rules: {
  36. email: {
  37. required: true,
  38. email: true,
  39. maxlength: 255,
  40. normalizer: function ( value ) {
  41. return $.trim(value);
  42. }
  43. },
  44. name: {
  45. required: true
  46. },
  47. password: {
  48. required: true
  49. },
  50. role_id: {
  51. required: true
  52. }
  53. }
  54. });
  55. });
  56. </script>
  57. @include('layouts.admin.form_script')