page.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //选中
  2. $('.circular').click(function () {
  3. $('.circular').toggleClass("active")
  4. });
  5. //边框
  6. $('.iphone').focus(function () {
  7. $(this).css('border', '1px solid #FF14CB');
  8. $(this).css('opacity', '1');
  9. });
  10. $('.iphone').blur(function () {
  11. $(this).css('border', '1px solid #fff');
  12. if ($(this).val() == '') {
  13. $(this).css('opacity', '0.49');
  14. } else {
  15. $(this).css('opacity', '1');
  16. }
  17. });
  18. $('.yanzhenma').focus(function () {
  19. $(this).css('border', '1px solid #FF14CB');
  20. $(this).css('opacity', '1');
  21. });
  22. $('.yanzhenma').blur(function () {
  23. $(this).css('border', '1px solid #fff');
  24. if ($(this).val() == '') {
  25. $(this).css('opacity', '0.49');
  26. } else {
  27. $(this).css('opacity', '1');
  28. }
  29. });
  30. $('.btn').mousedown(function () {
  31. $(this).css('opacity', '0.8')
  32. });
  33. $('.btn').mouseup(function () {
  34. console.log(1);
  35. $(this).css('opacity', '1')
  36. });
  37. //弹窗
  38. $('.yuyue').click(function () {
  39. $('.maskArea').show();
  40. $('.tc').show();
  41. $('.close').show();
  42. });
  43. $('.close').click(function () {
  44. $('.maskArea').hide();
  45. $('.tc').hide();
  46. $('.close').hide();
  47. });
  48. //验证码倒计时
  49. var countdown = 60;
  50. $('.yanzhenma_btn').click(function () {
  51. console.log($('.iphone').val().length);
  52. if (!(/^1[3|4|5|8][0-9]\d{4,8}$/.test($('.iphone').val())) || $('.iphone').val().length < 11) {
  53. alert('请输入正确电话号码');
  54. } else {
  55. settime($(this))
  56. }
  57. /*$(this).css('background-color','yanzhenma_btn')*/
  58. });
  59. function settime(val) {
  60. if (countdown == 0) {
  61. val.css('background-color', '#FF14CB');
  62. val.attr("disabled", false);
  63. val.val("获取验证码");
  64. countdown = 60;
  65. } else {
  66. val.attr("disabled", true);
  67. val.val(countdown + 's');
  68. countdown--;
  69. setTimeout(function () {
  70. settime(val)
  71. }, 1000)
  72. }
  73. }
  74. //环形图
  75. var fw = $('.header1').width();
  76. $('.header1').height(fw);
  77. var c = document.getElementById('myCanvas');
  78. var ctx = c.getContext('2d');
  79. var process = 0;
  80. var w = parseInt($('#myCanvas').css('width'));
  81. console.log(w);
  82. var mW = c.width = w;
  83. var mH = c.height = w;
  84. var lineWidth = 5;
  85. var r = mW / 2;
  86. var cR = r - 4 * lineWidth; //圆半径
  87. var startAngle = -(1 / 2 * Math.PI); //开始角度
  88. var endAngle = startAngle + 2 * Math.PI; //结束角度
  89. var xAngle = 1 * (Math.PI / 180); //偏移角度量
  90. var fontSize = 35; //字号大小
  91. var tmpAngle = startAngle; //临时角度变量
  92. //渲染函数
  93. var rander = function (ctx, prs) {
  94. ctx.clearRect(0, 0, mW, mH);
  95. ctx.beginPath();
  96. ctx.lineWidth = 20;
  97. ctx.strokeStyle = '#fff';
  98. ctx.arc(r, r, cR, Math.PI * 1.5, Math.PI * (1.5 + 2 * prs / 100));
  99. ctx.stroke();
  100. ctx.closePath();
  101. ctx.beginPath();
  102. ctx.lineWidth = 20;
  103. ctx.lineCap = 'round';
  104. ctx.strokeStyle = '#FF14CB';
  105. ctx.arc(r, r, cR, Math.PI * (1.5 + 2 * prs / 100), Math.PI * 1.5);
  106. ctx.stroke();
  107. ctx.closePath();
  108. };
  109. function animate(i) {
  110. requestAnimationFrame(function () {
  111. process = process + 1;
  112. rander(ctx, process);
  113. if (process < i) {
  114. animate(i);
  115. }
  116. });
  117. }
  118. animate(50);