avatar.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. {extend name="default/base/base_member" /}
  2. {block name="member_main"}
  3. <form action="{:url('Memberinformation/upload')}" enctype="multipart/form-data" id="form_avaster" method="post">
  4. <div class="dsm-default-form">
  5. <dl>
  6. <dt>{$Think.lang.home_member_avatar_thumb}{$Think.lang.ds_colon}</dt>
  7. <dd>
  8. <div class="user-avatar"><span><img src="{:get_member_avatar($member_info.member_avatar)}?{:microtime()}>" alt="" ds_type="avatar" width='120' height="120" /></span></div>
  9. <p class="hint mt5">{$Think.lang.ds_member_avatar_hint|raw}</p>
  10. </dd>
  11. </dl>
  12. <dl>
  13. <dt>{$Think.lang.home_member_change_avatar}{$Think.lang.ds_colon}</dt>
  14. <dd>
  15. <div class="dsm-upload-btn"> <a href="javascript:void(0);"><span>
  16. <input type="file" hidefocus="true" size="1" class="input-file" name="pic" id="pic" file_id="0" multiple="" maxlength="0"/>
  17. </span>
  18. <p><i class="iconfont">&#xe733;</i>{$Think.lang.home_member_avatar_upload}</p>
  19. <input id="submit_button" style="display:none" type="button" value="&nbsp;" onClick="submit_form($(this))" />
  20. </a> </div>
  21. </dd>
  22. </dl>
  23. </div>
  24. </form>
  25. <script type="text/javascript">
  26. $(function(){
  27. $('#pic').change(function(){
  28. var filepatd=$(this).val();
  29. var extStart=filepatd.lastIndexOf(".");
  30. var ext=filepatd.substring(extStart,filepatd.lengtd).toUpperCase();
  31. if(ext!=".PNG"&&ext!=".GIF"&&ext!=".JPG"&&ext!=".JPEG"){
  32. layer.msg("{$Think.lang.file_type_error}");
  33. $(this).attr('value','');
  34. return false;
  35. }
  36. if ($(this).val() == '') return false;
  37. $("#form_avaster").submit();
  38. });
  39. });
  40. </script>
  41. {/block}