<template include="./plugin/hfdr_umbbs/overwrite/view/htm/my.common.template.htm">
	<slot name="my_body">
	<div class="card1 card-threadlist border-1">
			<div class="col-md-06">
			<div class="col-md-07">	
	<div class="ivu-form-item">
				<div class="ivu-form-item-content">
				
				<img src="<?php echo $user['avatar_url'];?>" alt="" class="avatar-img-2"> 

				</div></div>
				<div class="ivu-form-item-content">
				<div class="avatar-img-3">
			<button type="submit" class="btn-primary btn-6-2 btn-secondary" id="submit" data-loading-text="正在提交..."><span class="icon iconfont">&#xe77a;</span></button>
			</div>	
			</div>
			<div class="ivu-form-item-content">
		<div class="custom-file-1">
		
				<input type="file" id="avatar_upload" accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"  class="upload custom-file-input-1" value="<?php echo lang('modify_avatar');?>"/>
			</div>
			</div>
			<div class="ivu-form-item-content">
			</div>
		</div>
		</div>
		</div>
	</slot>
</template>

<script>
$('a[data-active="my"]').addClass('active');
$('a[data-active="my-avatar"]').addClass('active');
</script>
<script>
$('li[data-active="fid-00"]').addClass('active');
</script>
<script>
var javatar_upload = $('#avatar_upload');
var jprogress = $('#avatar_progress');
var jimg = $('#avatar_img');
jprogress.hide();
javatar_upload.on('change', function(e) {
	var files = xn.get_files_from_event(e);
	xn.upload_file(
		files[0], 
		xn.url('my-avatar'), 
		{width: 128, height: 128, action: 'clip', filetype: 'jpg'}, 
		function(code, message) {
			if(code == 0) {
				jimg.attr('src', message.url+'?'+Math.random());
				$.alert('成功');
				jprogress.delay(1000).hide();
			} else {
				$.alert(message);
			}
		}, 
		function(percent) {
			jprogress.show();
			jprogress.width(percent+'%');
		}
	);
});

</script>