1002510133_edit.jsp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <html>
  2. <head>
  3. <style type="text/css">
  4. .icon {
  5. border: 1px solid #f2f2f2;
  6. }
  7. </style>
  8. </head>
  9. <body>
  10. <div id="space-content">
  11. <div class="space-form-infor">
  12. <el-form action='@service{name:`user_tool_updateIcon`, page:`toTips`, params:`{personid:"${appUser.userId}"}` }@'
  13. method="post" :model="obj" :rules="appRules" ref="obj" label-width="100px">
  14. <div style="width: 100%; margin: 0 auto; text-align: center;margin-left: 14px;">
  15. <el-avatar :size="120" shape="square" :src="obj.iconPath" class="icon">
  16. 未获取到头像
  17. </el-avatar>
  18. <div style="margin-top: 12px;">
  19. ${appUser.name}
  20. </div>
  21. <div style="margin-top: 20px;">
  22. <input type="file" accept="image/*" id="iconFile" style="display: none;" />
  23. <el-button id="uploadBtn" onclick="$('#iconFile').click();" size="small" icon="el-icon-upload">上传头像</el-button>
  24. </div>
  25. <div style="margin-top: 6px;font-size: 12px; color: rgb(102, 177, 255);">
  26. 更换后需重新登录
  27. </div>
  28. </div>
  29. </el-form>
  30. </div>
  31. <div class="space-form-btn">
  32. <el-button type="primary" icon="el-icon-circle-check" :loading="loading" onclick="space.forms.submit();">保存</el-button>
  33. <el-button icon="el-icon-circle-close" onclick="space.allFunction.closeDialog();">关闭</el-button>
  34. </div>
  35. </div>
  36. </body>
  37. <script type="text/javascript">
  38. space.vue = new Vue({
  39. el: space.appContent,
  40. data() {
  41. return {
  42. obj: {
  43. iconPath: '${appUser.iconPath}'
  44. },
  45. appRules: {
  46. iconPath: [{
  47. required: true,
  48. message: '未上传头像',
  49. trigger: 'blur'
  50. }]
  51. },
  52. loading: false
  53. };
  54. }
  55. })
  56. space.plugins.cropper.init({
  57. el: $("#iconFile"),
  58. box: '0', // 圆形:0,方形:1
  59. aspectRatio: 1,
  60. photoSize: { // 裁剪的图片大小,注意需要和 aspectRatio 保持统一比例
  61. width: 360,
  62. height: 360
  63. },
  64. success: function(path) { // 成功后的回调方法,path为裁剪后的img路径
  65. space.vue.$data.obj.iconPath = path;
  66. },
  67. });
  68. </script>
  69. </html>