index.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. {extend name="default/base/base_member" /}
  2. {block name="member_main"}
  3. <div class="dsm-default-form member_auth">
  4. <form method="post" action="" id="member_form" enctype="multipart/form-data">
  5. <dl>
  6. <dt>{$Think.lang.member_truename}:</dt>
  7. <dd>
  8. <span class="w400">
  9. <input type="text" class="text" maxlength="20" name="member_truename" value="{$member_info.member_truename}" {if in_array($member_info.member_auth_state,array(1,3))}disabled=""{/if}>
  10. </span>
  11. </dd>
  12. </dl>
  13. <dl>
  14. <dt>{$Think.lang.member_idcard}:</dt>
  15. <dd>
  16. <span class="w400">
  17. <input type="text" class="text" maxlength="20" name="member_idcard" value="{$member_info.member_idcard}" {if in_array($member_info.member_auth_state,array(1,3))}disabled=""{/if}>
  18. </span>
  19. </dd>
  20. </dl>
  21. <dl>
  22. <dt>{$Think.lang.member_idcard_image1}:</dt>
  23. <dd>
  24. <div>
  25. <div class='image-wrapper'>
  26. <div class="dssc-upload-thumb">
  27. <p>
  28. <img onclick='openPhoto("img_member_idcard_image1_url")' src="{if $member_info['member_idcard_image1']!=''}{:get_member_idcard_image($member_info['member_idcard_image1'])}{else}{$Think.BASE_SITE_ROOT}/static/home/images/member_idcard_image1.png{/if}" id="img_member_idcard_image1_url" />
  29. </p>
  30. {if !in_array($member_info.member_auth_state,array(1,3))}<a href="javascript:dropImage('member_idcard_image1')" class="drop-btn iconfont">&#xe6e6;</a>{/if}
  31. </div>
  32. {if !in_array($member_info.member_auth_state,array(1,3))}
  33. <div class="dsm-upload-btn">
  34. <a href="javascript:void(0);">
  35. <span><input type="file" hidefocus="true" size="1" class="input-file" name="member_idcard_image1_url" id="member_idcard_image1_url" accept="image/*"/></span>
  36. <p><i class="iconfont">&#xe733;</i>{$Think.lang.image_upload}</p>
  37. </a>
  38. </div>
  39. {/if}
  40. </div>
  41. </div>
  42. <span class="w400">
  43. <input type="text" style="width:0;opacity: 0" name="member_idcard_image1" id="member_idcard_image1" value="{$member_info.member_idcard_image1}" {if in_array($member_info.member_auth_state,array(1,3))}disabled=""{/if}>
  44. </span>
  45. </dd>
  46. </dl>
  47. <dl>
  48. <dt>{$Think.lang.member_idcard_image2}:</dt>
  49. <dd>
  50. <div>
  51. <div class='image-wrapper'>
  52. <div class="dssc-upload-thumb">
  53. <p>
  54. <img onclick='openPhoto("img_member_idcard_image2_url")' src="{if $member_info['member_idcard_image2']!=''}{:get_member_idcard_image($member_info['member_idcard_image2'])}{else}{$Think.BASE_SITE_ROOT}/static/home/images/member_idcard_image2.png{/if}" id="img_member_idcard_image2_url" />
  55. </p>
  56. {if !in_array($member_info.member_auth_state,array(1,3))}<a href="javascript:dropImage('member_idcard_image2')" class="drop-btn iconfont">&#xe6e6;</a>{/if}
  57. </div>
  58. {if !in_array($member_info.member_auth_state,array(1,3))}
  59. <div class="dsm-upload-btn">
  60. <a href="javascript:void(0);">
  61. <span><input type="file" hidefocus="true" size="1" class="input-file" name="member_idcard_image2_url" id="member_idcard_image2_url" accept="image/*"/></span>
  62. <p><i class="iconfont">&#xe733;</i>{$Think.lang.image_upload}</p>
  63. </a>
  64. </div>
  65. {/if}
  66. </div>
  67. </div>
  68. <span class="w400">
  69. <input type="text" style="width:0;opacity: 0" name="member_idcard_image2" id="member_idcard_image2" value="{$member_info.member_idcard_image2}" {if in_array($member_info.member_auth_state,array(1,3))}disabled=""{/if}>
  70. </span>
  71. </dd>
  72. </dl>
  73. <dl>
  74. <dt>{$Think.lang.member_idcard_image3}:</dt>
  75. <dd>
  76. <div>
  77. <div class='image-wrapper'>
  78. <div class="dssc-upload-thumb">
  79. <p>
  80. <img onclick='openPhoto("img_member_idcard_image3_url")' src="{if $member_info['member_idcard_image3']!=''}{:get_member_idcard_image($member_info['member_idcard_image3'])}{else}{$Think.BASE_SITE_ROOT}/static/home/images/member_idcard_image3.png{/if}" id="img_member_idcard_image3_url" />
  81. </p>
  82. {if !in_array($member_info.member_auth_state,array(1,3))}<a href="javascript:dropImage('member_idcard_image3')" class="drop-btn iconfont">&#xe6e6;</a>{/if}
  83. </div>
  84. {if !in_array($member_info.member_auth_state,array(1,3))}
  85. <div class="dsm-upload-btn">
  86. <a href="javascript:void(0);">
  87. <span><input type="file" hidefocus="true" size="1" class="input-file" name="member_idcard_image3_url" id="member_idcard_image3_url" accept="image/*"/></span>
  88. <p><i class="iconfont">&#xe733;</i>{$Think.lang.image_upload}</p>
  89. </a>
  90. </div>
  91. {/if}
  92. </div>
  93. </div>
  94. <span class="w400">
  95. <input type="text" style="width:0;opacity: 0" name="member_idcard_image3" id="member_idcard_image3" value="{$member_info.member_idcard_image3}" {if in_array($member_info.member_auth_state,array(1,3))}disabled=""{/if}>
  96. </span>
  97. </dd>
  98. </dl>
  99. {if !in_array($member_info.member_auth_state,array(1,3))}
  100. <dl class="bottom">
  101. <dt></dt>
  102. <dd>
  103. <input type="submit" class="submit" value="{$Think.lang.ds_submit}">
  104. </dd>
  105. </dl>
  106. {/if}
  107. </form>
  108. </div>
  109. <style>
  110. .dsm-default-form .dssc-upload-thumb{width:250px;height: 200px;}
  111. .dsm-default-form .dssc-upload-thumb p{width:100%;height: 100%;display: block}
  112. .image-wrapper img{width:100%;height: 100%}
  113. .drop-btn{position: absolute;top:0px;right:0px;}
  114. </style>
  115. <script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/ajaxfileupload.js"></script>
  116. <script>
  117. function openPhoto(id){
  118. var src=$('#'+id).attr('src')
  119. if(!src){
  120. return
  121. }
  122. layer.photos({
  123. photos: {
  124. "title": "", //相册标题
  125. "id": 1, //相册id
  126. "start": 0, //初始显示的图片序号,默认0
  127. "data": [ //相册包含的图片,数组格式
  128. {
  129. "pid": 1, //图片id
  130. "src": src, //原图地址
  131. "thumb": src //缩略图地址
  132. }
  133. ]
  134. }
  135. ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机
  136. })
  137. }
  138. function dropImage(id){
  139. var index=layer.confirm("{$Think.lang.ds_ensure_del}", {
  140. btn: ['{$Think.lang.ds_ok}', '{$Think.lang.ds_cancel}'],
  141. title: false,
  142. }, function () {
  143. layer.close(index)
  144. $.getJSON('{:url('MemberAuth/image_drop')}',{file_name:id},function(res){
  145. if(res.code!=10000){
  146. layer.alert(res.message);
  147. }else{
  148. $('#'+id).val('')
  149. $('#img_'+id+'_url').attr('src',"{$Think.BASE_SITE_ROOT}/static/home/images/"+id+".png")
  150. }
  151. })
  152. })
  153. }
  154. function ajaxFileUpload(url, id)
  155. {
  156. var index=id.substr(0,20)
  157. if($('#'+index).val()){
  158. layer.alert('{$Think.lang.please_drop_image}');
  159. return
  160. }
  161. $.ajaxFileUpload({
  162. url: url,
  163. secureuri: false,
  164. fileElementId: id,
  165. dataType: 'json',
  166. data: {id: id},
  167. success: function (data)
  168. {
  169. if (data.code!=10000) {
  170. layer.alert(data.message);
  171. } else {
  172. $('#'+index).val(data.result.file_name)
  173. $("#img_" + id).attr('src', data.result.file_path);
  174. }
  175. },
  176. error: function (data, status, e)
  177. {
  178. console.error(data);
  179. }
  180. })
  181. }
  182. $(document).ready(function () {
  183. var url = '{:url("MemberAuth/image_upload")}';
  184. $('#member_form').find('input[type="file"]').unbind().change(function () {
  185. var id = $(this).attr('id');
  186. ajaxFileUpload(url, id);
  187. });
  188. $('#member_form').validate({
  189. submitHandler: function (form) {
  190. ds_ajaxpost('member_form','url','{:url('MemberAuth/index')}');
  191. },
  192. rules: {
  193. member_truename: {
  194. required: true
  195. },
  196. member_idcard: {
  197. required: true,
  198. },
  199. member_idcard_image1: {
  200. required: true,
  201. },
  202. member_idcard_image2: {
  203. required: true,
  204. },
  205. member_idcard_image3: {
  206. required: true,
  207. },
  208. },
  209. messages: {
  210. member_truename: {
  211. required: '{$Think.lang.member_truename_require}'
  212. },
  213. member_idcard: {
  214. required: '{$Think.lang.member_idcard_require}',
  215. },
  216. member_idcard_image1: {
  217. required: '{$Think.lang.member_idcard_image1_require}',
  218. },
  219. member_idcard_image2: {
  220. required: '{$Think.lang.member_idcard_image2_require}',
  221. },
  222. member_idcard_image3: {
  223. required: '{$Think.lang.member_idcard_image3_require}',
  224. },
  225. }
  226. });
  227. });
  228. </script>
  229. {/block}