wvke.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. xuetong={
  2. //舌标签
  3. show_tab:function(i){
  4. $('.lm_tab_'+i+' .list_'+i+'').click(function(){
  5. var _index = $(this).index();
  6. $(this).addClass('hover').siblings().removeClass('hover');
  7. $('.lm_tab_list_'+i+'').each(function(){
  8. $(this).find('.list_'+i+'').hide();
  9. $(this).find('.list_'+i+'').eq(_index).show();
  10. if($(this).find('.list_'+i+'').hasClass('auto')){
  11. $(this).find('.list_'+i+'').css('height','auto');
  12. }
  13. })
  14. });
  15. },
  16. inputFB:function() {
  17. $('input.input_text').focus(function () {
  18. var t = $(this);
  19. if (t.attr('type') == 'text' || t.attr('type') == 'password')t.css({'border': '1px solid #EB3F3F', 'color': '#333'});
  20. if (t.val() == t.attr('placeholder')) t.val('');
  21. });
  22. $('input.input_text').blur(function () {
  23. var t = $(this);
  24. if (t.attr('type') == 'text' || t.attr('type') == 'password')t.css({'box-shadow': 'none', 'border': '1px solid #f6f6f8', 'color': '#333'});
  25. })
  26. },
  27. inputBian:function() {
  28. $('input.input_bian').focus(function () {
  29. var t = $(this);
  30. if (t.attr('type') == 'text' || t.attr('type') == 'password')t.css({'border': '1px solid #17ffd7', 'color': '#fff'});
  31. if (t.val() == t.attr('placeholder')) t.val('');
  32. });
  33. $('input.input_bian').blur(function () {
  34. var t = $(this);
  35. if (t.attr('type') == 'text' || t.attr('type') == 'password')t.css({'box-shadow': 'none', 'border': '1px solid #132024', 'color': '#fff'});
  36. })
  37. },
  38. //问号内容弹出解释
  39. show_wen:function(){
  40. $(".icon_wen").click(function(e){
  41. e.stopPropagation();
  42. $(this).next().show();
  43. var element = $(this).next().children("span");
  44. if(element.html()){
  45. if(element.html().length>20){
  46. element.html("<marquee scrollamount=4>"+element.html()+"</marquee>");
  47. }
  48. }
  49. })
  50. $('html,body').click(function(){
  51. $('.show_wen').hide();
  52. })
  53. $('.show_wen').click(function(e){
  54. e.stopPropagation();
  55. })
  56. },
  57. //右侧导航
  58. top_rnav:function(){
  59. $('#js-menu').on('click', function () {
  60. $('.menu,#gb-main,.head').toggleClass('gbzp');
  61. });
  62. $('.backBtn').on('click', function () {
  63. $('.menu,#gb-main,.head').toggleClass('gbzp');
  64. });
  65. $('#gb-main').on('click', function() {
  66. if ($(this).hasClass('gbzp')) {
  67. $('.menu,#gb-main,.head').toggleClass('gbzp')
  68. }
  69. });
  70. },
  71. //密码隐藏显示
  72. eyes_box:function(){
  73. $(".eyes_box").click(function(){
  74. if($(this).attr("data-show")==1){//明文
  75. $(this).attr("data-show","2");
  76. $(this).children("i").toggleClass("open");
  77. $(this).parent("div").children(".mima_dd").hide();
  78. $(this).parent("div").children(".mima_wz").show();
  79. $(this).parent("div").children(".mima_wz").val($(this).parent("div").children(".mima_dd").val());
  80. return;
  81. }
  82. if($(this).attr("data-show")==2){//密文
  83. $(this).attr("data-show","1");
  84. $(this).children("i").removeClass("open");
  85. $(this).parent("div").children(".mima_dd").show();
  86. $(this).parent("div").children(".mima_wz").hide();
  87. $(this).parent("div").children(".mima_dd").val($(this).parent("div").children(".mima_wz").val());
  88. return;
  89. }
  90. });
  91. $('.mima_dd').change(function(){
  92. $(this).parent("div").children(".mima_wz").val($(this).val());
  93. })
  94. $('.mima_wz').change(function(){
  95. $(this).parent("div").children(".mima_dd").val($(this).val());
  96. })
  97. },
  98. //复制文本
  99. copy:function(){
  100. var Url2=document.getElementById("wallet_url");
  101. Url2.select();
  102. document.execCommand("Copy");
  103. alert("钱包地址已复制");
  104. },
  105. sendsms:function(){
  106. var wait=60;
  107. function time() {
  108. var o=document.getElementById("send_sms_1")
  109. if (wait == -1) {
  110. $('#send_sms').show();
  111. $('#send_sms_1').hide();
  112. wait = 60;
  113. } else {
  114. o.innerHTML=wait + " s";
  115. wait--;
  116. mobiletimer = setTimeout(function(){time()}, 1000)
  117. }
  118. }
  119. $('#send_sms').click(function(){
  120. $(this).hide();
  121. $('#send_sms_1').show();
  122. $('#send_voice').hide();
  123. $('#send_voice_1').show();
  124. time();
  125. time2();
  126. });
  127. var wait2=60;
  128. function time2() {
  129. var o=document.getElementById("send_voice_1")
  130. if (wait2 == -1) {
  131. $('#send_voice').show();
  132. $('#send_voice_1').hide();
  133. wait2 = 60;
  134. } else {
  135. o.innerHTML=wait2 + " s";
  136. wait2--;
  137. mobiletimer2 = setTimeout(function() {time2()}, 1000)
  138. }
  139. }
  140. $('#send_voice').click(function(){
  141. $(this).hide();
  142. $('#send_voice_1').show();
  143. $('#send_sms').hide();
  144. $('#send_sms_1').show();
  145. time();
  146. time2();
  147. });
  148. },
  149. foot_download:function(id){
  150. if(id==1){
  151. $('#foot_download').hide();
  152. $('#foot_download').removeAttr("id");
  153. }else{
  154. var nowTop = document.documentElement.scrollTop || document.body.scrollTop;
  155. $(window).scroll(function(){
  156. scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  157. if(scrollTop < nowTop){
  158. $('#foot_download').slideDown();
  159. }else{
  160. $('#foot_download').hide();
  161. }
  162. nowTop = scrollTop;
  163. })
  164. }
  165. },
  166. title_tab:function(){
  167. $(".title").click(function(e){
  168. e.stopPropagation();
  169. $(".trade_con_all").show();
  170. })
  171. $('body,html').click(function(){
  172. $(".trade_con_all").hide();
  173. })
  174. },
  175. //判断手机类型
  176. uaFanction:function(){
  177. var UA = window.navigator.userAgent,
  178. IsAndroid = (/Android|HTC/i.test(UA) || !! (window.navigator['platform'] + '').match(/Linux/i)),
  179. IsIPad = !IsAndroid && /iPad/i.test(UA),
  180. IsIPhone = !IsAndroid && /iPod|iPhone/i.test(UA),
  181. IsIOS = IsIPad || IsIPhone;
  182. if(IsIOS){
  183. window.location.href='itms-services://?action=download-manifest&url=https://www.btctrade.com/upload/app/trade.plist';
  184. }
  185. if(IsAndroid){
  186. window.location.href='http://www.btctrade.com/upload/app/trade.apk';
  187. }
  188. },
  189. //弹出层
  190. showDialog:function(id, maskclick) {
  191. // 遮罩
  192. $('#' + id).removeClass('modal-out').addClass('styled-pane');
  193. var dialog = Dom(id);
  194. dialog.style.display = 'block';
  195. if (Dom('mask') == null) {
  196. $('body').prepend('<div class="ui-mask" id="mask" onselectstart="return false"></div>');
  197. if (!maskclick) $('#mask').bind('click', function () {hideDialog(id)})
  198. }
  199. var mask = Dom('mask');
  200. mask.style.display = 'inline-block';
  201. mask.style.width = document.body.offsetWidth + 'px';
  202. mask.style.height = document.body.scrollHeight + 'px';
  203. //居中
  204. var bodyW = document.documentElement.clientWidth;
  205. var bodyH = document.documentElement.clientHeight;
  206. var elW = dialog.offsetWidth;
  207. var elH = dialog.offsetHeight;
  208. dialog.style.left = (bodyW - elW) / 2 + 'px';
  209. dialog.style.top = (bodyH - elH) / 2 + 'px';
  210. dialog.style.position = 'fixed';
  211. },
  212. showDialog_foot:function(id, maskclick) {
  213. // 遮罩
  214. $('#' + id).removeClass('modal-out').addClass('styled-pane');
  215. var dialog = Dom(id);
  216. dialog.style.display = 'block';
  217. if (Dom('mask') == null) {
  218. $('body').prepend('<div class="ui-mask" id="mask" onselectstart="return false"></div>');
  219. if (!maskclick) $('#mask').bind('click', function () {hideDialog(id)})
  220. }
  221. var mask = Dom('mask');
  222. mask.style.display = 'inline-block';
  223. mask.style.width = document.body.offsetWidth + 'px';
  224. mask.style.height = document.body.scrollHeight + 'px';
  225. //居中
  226. var bodyW = document.documentElement.clientWidth;
  227. var bodyH = document.documentElement.clientHeight;
  228. var elW = dialog.offsetWidth;
  229. var elH = dialog.offsetHeight;
  230. dialog.style.left = (bodyW - elW) / 2 + 'px';
  231. dialog.style.bottom ='0px';
  232. dialog.style.position = 'fixed';
  233. },
  234. //关闭弹出层
  235. hideDialog:function(id, fn) {
  236. $('#' + id).removeClass('styled-pane').addClass('modal-out');
  237. $('#mask').addClass('out');
  238. setTimeout(function () {$('#' + id).hide(); $('#mask').remove();}, 300);
  239. if (typeof fn == 'function') fn();
  240. },
  241. //分享弹窗
  242. show_share:function(){
  243. var html='<div class="dialog_content styled-pane wb_100" id="show_share">' +
  244. '<div class="show_share wb_100 center">' +
  245. '<ul class="clear">' +
  246. '<li><a href="#"><img src="/wap/images/share_wb.png" class="icon_show_share"><p class="hui_d">微博</p></a></li>' +
  247. '<li><a href="#"><img src="/wap/images/share_qq.png" class="icon_show_share"><p class="hui_d">QQ</p></a></li>' +
  248. '<li><a href="#"><img src="/wap/images/share_wx.png" class="icon_show_share"><p class="hui_d">微信</p></a></li>' +
  249. '<li><a href="#"><img src="/wap/images/share_people.png" class="icon_show_share"><p class="hui_d">朋友圈</p></a></li>' +
  250. '</ul>' +
  251. '<div class="show_share_close">' +
  252. '<a id="closeBtn" onclick="xuetong.hideDialog(\'show_share\');" class="share_close2" title="取消">取消</a>' +
  253. '</div>' +
  254. '</div>' +
  255. '</div>';
  256. $('body').prepend(html);
  257. xuetong.showDialog_foot('show_share');
  258. },
  259. show_deposit:function(){
  260. var html='<div class="dialog_content styled-pane" id="show_deposit" style="width:80%;">' +
  261. '<div class="show_deposit center po_re">' +
  262. '<div class="show_deposit_top po_ab">' +
  263. '<img src="/wap/images/dialog_deposit.png" class="dialog_icon">' +
  264. '</div>' +
  265. '<h2 class="show_title">充值成功!</h2> ' +
  266. '<div class="show_close">' +
  267. '<a id="closeBtn" onclick="xuetong.hideDialog(\'show_deposit\');" class="share_close" title="知道了">知道了</a>' +
  268. '</div> ' +
  269. '</div>' +
  270. '</div>';
  271. $('body').prepend(html);
  272. xuetong.showDialog('show_deposit');
  273. },
  274. //礼品卡充值成功
  275. show_giftcard:function(){
  276. var html='<div class="dialog_content styled-pane" id="show_giftcard" style="width:80%;">' +
  277. '<div class="show_deposit center po_re">' +
  278. '<div class="show_deposit_top po_ab">' +
  279. '<img src="/wap/images/dialog_deposit2.png" class="giftcard_icon">' +
  280. '</div>' +
  281. '<h2 class="show_title">礼品卡充值成功!</h2> ' +
  282. '<p class="show_p">优质的你偶尔也会忘记好多从来都不关心的事,有我们就没有后顾之忧。</p>' +
  283. '<div class="show_close">' +
  284. '<a id="closeBtn" onclick="xuetong.hideDialog(\'show_deposit\');" class="share_close" title="知道了">知道了</a>' +
  285. '</div> ' +
  286. '</div>' +
  287. '</div>';
  288. $('body').prepend(html);
  289. xuetong.showDialog('show_giftcard');
  290. },
  291. //红包领取成功!
  292. show_red:function(){
  293. var html='<div class="dialog_content styled-pane" id="show_red" style="width:80%;">' +
  294. '<div class="show_deposit center po_re">' +
  295. '<div class="show_deposit_top po_ab">' +
  296. '<img src="/wap/images/dialog_red.png" class="red_icon">' +
  297. '</div>' +
  298. '<h2 class="show_title">红包领取成功!</h2> ' +
  299. '<div class="show_close">' +
  300. '<a id="closeBtn" onclick="xuetong.hideDialog(\'show_red\');" class="share_close" title="知道了">知道了</a>' +
  301. '</div> ' +
  302. '</div>' +
  303. '</div>';
  304. $('body').prepend(html);
  305. xuetong.showDialog('show_red');
  306. },
  307. //申请提现成功!
  308. show_withdraw:function(){
  309. var html='<div class="dialog_content styled-pane" id="show_withdraw" style="width:80%;">' +
  310. '<div class="show_deposit center po_re">' +
  311. '<div class="show_deposit_top po_ab">' +
  312. '<img src="/wap/images/dialog_withdraw.png" class="dialog_icon">' +
  313. '</div>' +
  314. '<h2 class="show_title">申请提现成功!</h2> ' +
  315. '<div class="show_close">' +
  316. '<a id="closeBtn" onclick="xuetong.hideDialog(\'show_withdraw\');" class="share_close" title="知道了">知道了</a>' +
  317. '</div> ' +
  318. '</div>' +
  319. '</div>';
  320. $('body').prepend(html);
  321. xuetong.showDialog('show_withdraw');
  322. },
  323. //找回密码成功!
  324. show_password:function(){
  325. var html='<div class="dialog_content styled-pane" id="show_password" style="width:80%;">' +
  326. '<div class="show_deposit center po_re">' +
  327. '<div class="show_deposit_top po_ab">' +
  328. '<img src="/wap/images/dialog_password.png" class="dialog_icon">' +
  329. '</div>' +
  330. '<h2 class="show_title">找回密码成功!</h2> ' +
  331. '<div class="show_close">' +
  332. '<a id="closeBtn" onclick="xuetong.hideDialog(\'show_password\');" class="share_close" title="知道了">知道了</a>' +
  333. '</div> ' +
  334. '</div>' +
  335. '</div>';
  336. $('body').prepend(html);
  337. xuetong.showDialog('show_password');
  338. },
  339. //找回密码成功!
  340. show_yzm: function () {
  341. var html = '<div class="dialog_content styled-pane" id="show_yzm" style="width:80%;">' +
  342. '<div class="show_deposit show_yzm center po_re">' +
  343. '<h2>请输入验证码!</h2>' +
  344. '<form>' +
  345. '<div class="dialog_box margin">' +
  346. '<input type="text" name="dialog_yzm left" id="captcha">' +
  347. '<a href="#" class="right">' +
  348. '<img id="dialogimg" class="verify_img2" onclick="show_captcha()" src="/index/captcha?t=0.1490179113493706">' +
  349. '</a>' +
  350. '</div>' +
  351. '<div class="dialog_yzm_btn">' +
  352. '<a id="closeBtn" onclick="xuetong.hideDialog(\'show_yzm\');" class="hui_d">取消</a>' +
  353. '<a onclick="getmocode()" class="orange">确认</a>' +
  354. '</div>' +
  355. '</form>' +
  356. '</div>' +
  357. '</div>';
  358. $('body').prepend(html);
  359. xuetong.showDialog('show_yzm');
  360. },
  361. input_cha:function(){
  362. $(".input,.text").focus(function(){
  363. $(this).find('.icon_circha').remove();
  364. $(this).before("<img src='/wap/images/icon_cha.png' onclick='xuetong.remove_val(this)' class='icon_circha'>");
  365. $(this).parents('.form_box').siblings().find('.icon_circha').remove();
  366. });
  367. },
  368. remove_val:function(obj){
  369. $(obj).next().val('');
  370. if ($(obj).next().attr('to_empty') == '1') {
  371. $(obj).parent().children('input').val('');
  372. }
  373. },
  374. //省市联动
  375. show_area: function () {
  376. var html = '<div class="dialog_content styled-pane" id="show_area" style="width:80%;">' +
  377. '<div class="show_deposit show_area center po_re">' +
  378. '<h2>请选择省市!</h2>' +
  379. '<div class="area_all po_re">' +
  380. ' <div class="left wb_50"><p>北京市</p><p>北京市</p><p>北京市</p><p>北京市</p><p>北京市</p><p>北京市</p></div>' +
  381. '<div class="left wb_50"><p>北京市</p><p>北京市</p><p>北京市</p><p>北京市</p><p>北京市</p><p>北京市</p></div>' +
  382. '<div class="area_all_line"></div>' +
  383. '</div>' +
  384. '<div class="area_btn" onclick="xuetong.hideDialog(\'show_area\')">确定</div>' +
  385. '</div>' +
  386. '</div>';
  387. $('body').prepend(html);
  388. xuetong.showDialog('show_area');
  389. },
  390. formatCount:function(count) {
  391. var countokuu = (count / 100000000).toFixed(3)
  392. var countwan = (count / 10000).toFixed(3)
  393. if (count > 100000000)
  394. return countokuu.substring(0, countokuu.lastIndexOf('.') + 3) + '亿'
  395. if (count > 10000)
  396. return countwan.substring(0, countwan.lastIndexOf('.') + 3) + '万'
  397. else
  398. return count
  399. },
  400. //总价
  401. buytotal:function(){
  402. $('#buy-total').html(formatCount(($('#price_in').val())*100 * ($('#numberin').val()*100)/10000));
  403. $('#sell-total').html(formatCount($('#price_out').val() * $('#numberout').val()));
  404. //if(typeof FINANCE == 'object') {
  405. // $('#sell-max').html(formatfloat(FINANCE.data[coin + '_balance'], 4, 0));
  406. //}
  407. },
  408. vNum:function(o, len) {
  409. if (isNaN(o.value)) o.value = '';
  410. var value = len ? xuetong.formatfloat(o.value, len, 0) : parseInt(o.value);
  411. if (xuetong.badFloat(o.value, len)) o.value = value
  412. },
  413. badFloat:function(num, size){
  414. if(isNaN(num)) return true;
  415. num += '';
  416. if(-1 == num.indexOf('.')) return false;
  417. var f_arr = num.split('.');
  418. if(f_arr[1].length > size){
  419. return true;
  420. }
  421. return false;
  422. },
  423. formatfloat:function(f, size, add) {
  424. f = parseFloat(f);
  425. var conf = {0:[1,1], 2: [100, 0.01], 3: [1000, 0.001], 4: [10000, 0.0001], 5: [100000, 0.00001], 6: [1000000, 0.000001]};
  426. var conf = conf[size];
  427. var ff = Math.floor(f * conf[0]) / conf[0];
  428. if (add && f > ff) ff += conf[1];
  429. if (ff > 0) return ff;
  430. return 0;
  431. },
  432. // 根据委托填价格
  433. autotrust:function(_this,type){
  434. if(type == 'sale'){
  435. $('#price_in').val($(_this).children().eq(1).html().substr(1));
  436. }
  437. if(type == 'buy'){
  438. $('#price_out').val($(_this).children().eq(1).html().substr(1));
  439. }
  440. }
  441. }
  442. $(function () {
  443. xuetong.inputFB();
  444. xuetong.inputBian();
  445. xuetong.input_cha();
  446. });
  447. function Dom(o) {return document.getElementById(o)};
  448. function valiForm(){
  449. for(var i in vali){
  450. $('#' + i).focus(); $('#' + i).blur();
  451. if(!vali[i]) return false;
  452. }
  453. return true;
  454. }
  455. function checkmobile(mobile) {
  456. var patrn=/^13[0-9]{9}|15[0-9]{9}|18[0-9]{9}|147[0-9]{8}|17[0-9]{9}$/;
  457. if(!patrn.exec(mobile)) return false;
  458. return true;
  459. }
  460. function showGA(v,l,type){
  461. if(!v) return;
  462. $.get('/ajax/user2ga/email/' + v, function(d){
  463. type = type||'';
  464. if(d.status == 1){
  465. // GA
  466. $('#ga_pwd'+type).show();$('#ga_isclosed').hide();
  467. }else if(d.status == 2){
  468. // verify code
  469. $('#code').show();$('#ga_isclosed'+type).show();
  470. $('#captchaimg'+type).attr('src', '/index/captcha?t='+Math.random());
  471. }else if(d.msg){
  472. if(l == 1){
  473. $('.quick_login_x .tip').html(d.msg).show();
  474. }else if(l == 2){
  475. $('#emailmsg').html(d.msg).show();
  476. }else{
  477. if($('.z1 .tip').length == 0) $('.z1').append('<div class="tip"><b class="false">'+ d.msg+'</b></div>');
  478. }
  479. }
  480. }, 'json');
  481. }
  482. //lang
  483. function lang(str, re){
  484. if(typeof langs == 'undefined') langs = false;
  485. if(langs && typeof langs[str] != 'undefined'){
  486. str = langs[str];
  487. }
  488. if(re) for(var r in re){
  489. str = str.replace(r, re[r]);
  490. }
  491. return str;
  492. }
  493. //取消委托
  494. function trustcancel(id){
  495. $.get('/ajax/trustcancel/id/' + id, function(d){
  496. alert(d.msg);
  497. if(d.status){
  498. location.reload()
  499. }
  500. }, 'json');
  501. }
  502. var btn = {txt: ['', '短信验证码', '语音验证码'], obj: ['', document.getElementById('getcode1'), document.getElementById('getcode2')]};
  503. function btnbind(noeach){
  504. var out = 1;
  505. for(var i = 1;i <= 2; i++){
  506. btn.obj[i].onclick = '';
  507. if(btn.obj[i].value==btn.txt[i] || btn.obj[i].value==lang('正在发送')){
  508. btn.obj[i].value = noeach? lang('正在发送'): lang('{second}秒', {"{second}":60});
  509. $(btn.obj[i]).prop('disabled', true)
  510. } else {
  511. var btnval = btn.obj[i].value.match(/\d+/);
  512. if(btnval > 0){
  513. btn.obj[i].value = lang('{second}秒', {"{second}":btnval-1});
  514. } else {
  515. out = 0;
  516. btn.obj[i].value = btn.txt[i];
  517. $(btn.obj[i]).prop('disabled', false);
  518. btn.obj[i].onclick = function(){
  519. getcodes($(this).val() == lang('短信验证码')? 1: 2);
  520. }
  521. }
  522. }
  523. }
  524. if(!noeach && out)setTimeout(btnbind, 1000);
  525. }
  526. function recode(){
  527. $('#captcha').val('').focus();
  528. $('#captchaimg').attr('src', '/index/captcha?t='+Math.random());
  529. }
  530. //captcha
  531. function show_captcha() {
  532. $('#dialogimg').attr('src', '/index/captcha/?t=' + Math.random());
  533. }