| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <html>
- <head>
- <style type="text/css">
- .icon {
- border: 1px solid #f2f2f2;
- }
- </style>
- </head>
- <body>
- <div id="space-content">
- <div class="space-form-infor">
- <el-form action='@service{name:`user_tool_updateIcon`, page:`toTips`, params:`{personid:"${appUser.userId}"}` }@'
- method="post" :model="obj" :rules="appRules" ref="obj" label-width="100px">
- <div style="width: 100%; margin: 0 auto; text-align: center;margin-left: 14px;">
- <el-avatar :size="120" shape="square" :src="obj.iconPath" class="icon">
- 未获取到头像
- </el-avatar>
- <div style="margin-top: 12px;">
- ${appUser.name}
- </div>
- <div style="margin-top: 20px;">
- <input type="file" accept="image/*" id="iconFile" style="display: none;" />
- <el-button id="uploadBtn" onclick="$('#iconFile').click();" size="small" icon="el-icon-upload">上传头像</el-button>
- </div>
- <div style="margin-top: 6px;font-size: 12px; color: rgb(102, 177, 255);">
- 更换后需重新登录
- </div>
- </div>
- </el-form>
- </div>
- <div class="space-form-btn">
- <el-button type="primary" icon="el-icon-circle-check" :loading="loading" onclick="space.forms.submit();">保存</el-button>
- <el-button icon="el-icon-circle-close" onclick="space.allFunction.closeDialog();">关闭</el-button>
- </div>
- </div>
- </body>
- <script type="text/javascript">
- space.vue = new Vue({
- el: space.appContent,
- data() {
- return {
- obj: {
- iconPath: '${appUser.iconPath}'
- },
- appRules: {
- iconPath: [{
- required: true,
- message: '未上传头像',
- trigger: 'blur'
- }]
- },
- loading: false
- };
- }
- })
- space.plugins.cropper.init({
- el: $("#iconFile"),
- box: '0', // 圆形:0,方形:1
- aspectRatio: 1,
- photoSize: { // 裁剪的图片大小,注意需要和 aspectRatio 保持统一比例
- width: 360,
- height: 360
- },
- success: function(path) { // 成功后的回调方法,path为裁剪后的img路径
- space.vue.$data.obj.iconPath = path;
- },
- });
- </script>
- </html>
|