phone.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <style type="text/css">
  6. html, body, ul, li, p, h1, h2, h3, h4, h5, h6, form, img { margin:0; padding:0; }
  7. img,input,button { border:none; padding:0;margin:0;outline-style:none; }
  8. ul{ list-style:none; }
  9. iframe{display:none;}
  10. input { padding-top:0; padding-bottom:0; font-family: "SimSun","Microsoft YaHei";}
  11. select, input { vertical-align:middle;}
  12. select, input{ font-size:12px; margin:0; }
  13. img {border:0; vertical-align:middle; display:block;}
  14. body { color:#666;background:#fff;}
  15. h1,h2,h3,h4,h5,h6 {text-decoration:none;font-weight:normal;font-size:100%;}
  16. s,i,em{font-style:normal;text-decoration:none;}
  17. html {
  18. width: 1280px;
  19. height: 720px;
  20. margin: 0 auto;
  21. }
  22. body{
  23. font-size:20px;
  24. font-family:'Microsoft Yahei;Arial';
  25. color: #f1f1f1;
  26. background: url('../img/page_04.png') no-repeat center;
  27. background-attachment: fixed;
  28. background-size: 100%;
  29. overflow: hidden;
  30. width:1280px;
  31. height:720px;
  32. margin: 0 auto;
  33. }
  34. #myPrize{
  35. position: absolute;
  36. top: 310px;
  37. left: 248px;
  38. }
  39. #keyBoard{
  40. width: 340px;
  41. height: 110px;
  42. position: absolute;
  43. top: 364px;
  44. left: 674px;
  45. }
  46. #phone{
  47. width: 331px;
  48. height: 71px;
  49. position: absolute;
  50. top: 283px;
  51. left: 667px;
  52. line-height: 71px;
  53. font-size: 26px;
  54. text-align: center;
  55. }
  56. .phoneNum{
  57. float: left;
  58. font-size: 20px;
  59. background:#5988eb;
  60. width: 46px;
  61. height: 46px;
  62. text-align: center;
  63. line-height: 50px;
  64. border:3px solid transparent;
  65. margin-right: 2px;
  66. margin-bottom: 2px;
  67. box-shadow: 0px 0px 5px 5px #4068d3 inset;
  68. }
  69. .phoneNum.current{
  70. border:3px solid #d4c020;
  71. }
  72. .confirm,.cancel{
  73. width: 227px;
  74. height: 91px;
  75. background: url('../img/btn_qd_def.png') no-repeat center;
  76. position: absolute;
  77. top: 590px;
  78. left: 390px;
  79. }
  80. .confirm.current{
  81. background: url('../img/btn_qd_sel.png') no-repeat center;
  82. }
  83. .cancel{
  84. left: 650px;
  85. background: url('../img/btn_qx_def.png') no-repeat center;
  86. }
  87. .cancel.current{
  88. background: url('../img/btn_qx_sel.png') no-repeat center;
  89. }
  90. </style>
  91. </head>
  92. <body>
  93. <div id="exchangePopup" class="popup">
  94. <img id="myPrize" src="" alt="" />
  95. <div id="phone"></div>
  96. <ul id="keyBoard">
  97. <li class="phoneNum">1</li>
  98. <li class="phoneNum">2</li>
  99. <li class="phoneNum">3</li>
  100. <li class="phoneNum">4</li>
  101. <li class="phoneNum">5</li>
  102. <li class="phoneNum">6</li>
  103. <li class="phoneNum">7</li>
  104. <li class="phoneNum">8</li>
  105. <li class="phoneNum">9</li>
  106. <li class="phoneNum">0</li>
  107. <li class="phoneNum otherBtn">删除</li>
  108. <li class="phoneNum otherBtn">清空</li>
  109. </ul>
  110. <div class="exchangeBtn confirm"></div>
  111. <div class="exchangeBtn cancel"></div>
  112. </div>
  113. <script src="../js/webview.js" type="text/javascript"></script>
  114. <script src="../js/tvSysBtnBind.v2.js" type="text/javascript"></script>
  115. <script src="../js/comm.js" type="text/javascript"></script>
  116. <script src="../js/api.js" type="text/javascript"></script>
  117. <script type="text/javascript">
  118. var data = {};
  119. data.rules = {
  120. exchangeBtn:{
  121. 0:[0,["phoneNum",6],1,0],
  122. 1:[-1,["phoneNum",8],0,0],
  123. "onEnterPress":exchangePopups,
  124. onPress:cellphoneNum,
  125. onBack:function(){
  126. G("phone").innerHTML = "";
  127. window.location.href = "../index.html";
  128. },
  129. },
  130. phoneNum:{
  131. line:6,
  132. down:["exchangeBtn",1],
  133. onEnterPress:function(){
  134. try{
  135. alert('phoneNum'+this.currentIndex+this.className+G("phone").innerHTML.length);
  136. if(this.currentIndex<=9){
  137. if(G("phone").innerHTML.length>10) return;
  138. if(this.currentIndex == 9){
  139. G("phone").innerHTML += 0;
  140. }else{
  141. G("phone").innerHTML += this.currentIndex*1+1;
  142. }
  143. }else if(this.currentIndex == 10){
  144. if(G("phone").innerHTML.length>0)
  145. G("phone").innerHTML = G("phone").innerHTML.slice(0,-1);
  146. }else if(this.currentIndex == 11){
  147. if(G("phone").innerHTML.length>0)
  148. G("phone").innerHTML = "";
  149. }
  150. }catch(e){
  151. alert(e)
  152. }
  153. },
  154. onPress:cellphoneNum,
  155. onBack:function(){
  156. if(G("phone").innerHTML.length>0){
  157. G("phone").innerHTML = G("phone").innerHTML.slice(0,-1);
  158. }else{
  159. // H("exchangePopup");
  160. G("phone").innerHTML = "";
  161. window.location.href = "../index.html";
  162. // this.reSetClass(heguiItem);
  163. }
  164. },
  165. },
  166. }
  167. function exchangePopups(){
  168. try{
  169. if(this.currentIndex==1){
  170. H("exchangePopup");
  171. G("phone").innerHTML = "";
  172. this.reSetClass(heguiItem);
  173. }else if(this.currentIndex==0){
  174. var phone = G("phone").innerText;
  175. var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  176. if(!myreg.test(phone)){
  177. tips('手机号码格式有误!');
  178. }else{
  179. ajax({
  180. url: webUrl + "index.php?m=Home&c=Activityv2&a=setUserInfo",
  181. data: {
  182. uid: uid,
  183. act_id: init.act_id,
  184. is_vip: init.oursProduct_isVip+init.othersProduct_isVip,
  185. phone: phone
  186. },
  187. success: function (res) {
  188. if(res.code == 0){
  189. H("exchangePopup");
  190. G("phone").innerHTML = "";
  191. S("markDownPopup");
  192. main.reSetClass("markDownBtn");
  193. }else{
  194. tips(res.msg);
  195. }
  196. }
  197. })
  198. }
  199. }
  200. }catch(e){
  201. alert(e);
  202. }
  203. }
  204. function cellphoneNum(){
  205. if(G("phone").innerHTML.length>10) return;
  206. var key = this.event.keyCode;
  207. try {
  208. // Webview.setInputTypeTextFlag("true");
  209. if (key >= 0 && key <= 9) {
  210. G("phone").innerText += key;
  211. }
  212. } catch (e) {
  213. if (key > 47 && key < 58) {
  214. G("phone").innerText += (key - 48);
  215. }
  216. }
  217. }
  218. var btnConfig = {
  219. className: 'phoneNum',
  220. currentIndex: 0,
  221. rules: data.rules,
  222. }
  223. window.main = new tvSysBtnBind(btnConfig);
  224. main.reLoad();
  225. </script>
  226. </body>
  227. </html>