my_set.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <{include file="header.html"}>
  2. <link rel="stylesheet" type="text/css" href="<{$web_cfg.cdn}>/haili/css/setting.css" />
  3. <header><a href="javascript:history.go(-1)" class="back"></a>资料设置</header>
  4. <section class="applycont">
  5. <form>
  6. <input type="text" id="realname" name="realname" placeholder="真实姓名" value="<{$my.user_name}>">
  7. <select id="sex" name="sex" >
  8. <option <{if $my.sex != 2 && $my.sex != 3}>selected<{/if}> value="1">性别</option>
  9. <option <{if $my.sex == 2}>selected<{/if}> value="2">男</option>
  10. <option <{if $my.sex == 3}>selected<{/if}> value="3">女</option>
  11. </select>
  12. <input type="text" id="phone" name="phone" placeholder="手机号" value="<{$my.phone}>">
  13. <textarea placeholder="通信地址" id="address" name="address" value="<{$my.address}>"><{$my.address}></textarea>
  14. <section class="button-wrapper">
  15. <a class="button" id="sub_address" style="cursor: pointer;">保存</a>
  16. </section>
  17. </form>
  18. </section>
  19. <!--公用提示背景遮罩层-->
  20. <div class="a_cover"></div>
  21. <div class="v_tips_box v_tips_box2" id="error_tips_box">
  22. <div class="v_close_btn" id="tips_close_btn"></div>
  23. <p class="tips_msg" id="error_msg">错误信息</p>
  24. </div>
  25. <{include file="bottom.html"}>
  26. <script>
  27. KISSY.use('node, io', function (S, Node, IO) {
  28. $("input[type=text]").focus(function(){
  29. $(this).parent().find("span").hide();
  30. $(this).css("color","#000");
  31. });
  32. $("input[type=text]").blur(function(){
  33. if($(this).val() == ''){
  34. $(this).parent().find("span").show();
  35. }
  36. });
  37. // 提示
  38. function showTipsBox(msg,close){
  39. toast(msg, 1);
  40. return;
  41. $("#error_msg").html(msg);
  42. $("#tips_close_btn").hide();
  43. if(close){
  44. $("#tips_close_btn").show();
  45. }
  46. $("#error_tips_box").fadeIn();
  47. $('.a_cover').fadeIn();
  48. }
  49. $('#sub_address').on('click', function () {
  50. var realname = S.trim($('input[name=realname]').val());
  51. if (realname == '') {
  52. showTipsBox('真实姓名不能为空',true);
  53. return false;
  54. }
  55. var phone = S.trim($('input[name=phone]').val());
  56. var regex = /^(1[0-9][0-9]|15[0-9]|18[02-9]|14[57])[0-9]{8}$/;
  57. if(!regex.test(phone)) {
  58. showTipsBox('请填写有效手机号码',true);
  59. return false;
  60. }
  61. var address = S.trim($('textarea[name=address]').val());
  62. if (address == '') {
  63. showTipsBox('请填写收货地址',true);
  64. return false;
  65. }
  66. var sex = S.trim($('select[name=sex]').val());
  67. if (!sex) {
  68. showTipsBox('请选择性别',true);
  69. return false;
  70. }
  71. IO.get('<{$web_cfg.domain}>/?c=Express&a=UpExpressYes'
  72. , {
  73. //lottery_data_id: '<{$lotteryData.id}>',
  74. realname: realname,
  75. phone: phone,
  76. address: address,
  77. sex:sex
  78. }
  79. , function (data) {
  80. if (data.ok) {
  81. toast('修改成功');
  82. } else {
  83. showTipsBox(data.msg);
  84. return false;
  85. }
  86. }
  87. , 'json'
  88. );
  89. });
  90. });
  91. </script>