Nenhuma Descrição

detailIntegral.html 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="yes" name="apple-mobile-web-app-capable">
  6. <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
  7. <title>积分明细</title>
  8. <style type="text/css">
  9. body,html{
  10. font-size: 0.16rem;
  11. }
  12. body, div, button, h3, h6, span, ul, li, p, a,input{
  13. font-family: -apple-system,SF UI Text,Helvetica Neue,Helvetica,Arial,sans-serif;
  14. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  15. padding: 0;
  16. margin: 0;
  17. box-sizing: inherit;
  18. font-weight: normal;
  19. }
  20. button{
  21. outline: none;
  22. }
  23. a, a:visited{
  24. text-decoration: none;
  25. }
  26. body{
  27. width: 100%;
  28. }
  29. .recordEmpty{
  30. padding-top: 1.13rem;
  31. display: none;
  32. }
  33. .recordEmpty img{
  34. width: 1.3rem;
  35. height: 1.14rem;
  36. display: block;
  37. margin: auto;
  38. }
  39. .recordEmpty p{
  40. color: #999999;
  41. font-size: 0.12rem;
  42. line-height: 0.17rem;
  43. margin-top: 0.41rem;
  44. text-align: center;
  45. }
  46. .integral{
  47. padding-top: 0.16rem;
  48. margin-left: 0.2rem;
  49. margin-right: 0.23rem;
  50. }
  51. .detail{
  52. display: flex;
  53. justify-content: space-between;
  54. align-items: center;
  55. margin-bottom: 0.13rem;
  56. }
  57. .detail .con{
  58. color:#333333;
  59. font-size: 0.15rem;
  60. line-height: 0.21rem;
  61. }
  62. .con text{
  63. margin-left: 0.14rem;
  64. }
  65. .conLeft{
  66. display: inline-block;
  67. background: #CCCCCC;
  68. width: 0.07rem;
  69. height: 0.07rem;
  70. border-radius: 50%;
  71. position: relative;
  72. }
  73. .detail .time{
  74. color: #999999;
  75. font-size: 0.12rem;
  76. line-height: 0.17rem;
  77. margin-top: 0.06rem;
  78. margin-left: 0.26rem;
  79. }
  80. .active::after{
  81. content: '';
  82. display: block;
  83. height: 0.5rem;
  84. width: 0.01rem;
  85. background-color:#D8D8D8;
  86. position: absolute;
  87. left: 0;
  88. right: 0;
  89. top:0.07rem;
  90. margin: auto;
  91. }
  92. .gold{
  93. color: #FFC600;
  94. font-size: 0.2rem;
  95. line-height: 0.28rem;
  96. }
  97. </style>
  98. <script>
  99. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  100. window.onresize = function(){
  101. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  102. }
  103. </script>
  104. </head>
  105. <body>
  106. <div class="recordEmpty">
  107. <img src="../H5/noFriend.png" />
  108. <p>您目前还没有积分,赶紧做任务赚积分吧~</p>
  109. </div>
  110. <div class="integral"></div>
  111. </body>
  112. </html>
  113. <script type="text/javascript" src="../jquery-2.1.0.js"></script>
  114. <script type="text/javascript">
  115. var userId = null;
  116. var arr = [];
  117. var str=location.href; //取得整个地址栏
  118. var num=str.indexOf("?");
  119. str=str.substr(num+1); //str得到?之后的字符串
  120. var brr=str.split("&");
  121. for(var i = 0 ; i<brr.length; i++){
  122. if(brr[i].indexOf('userId') != -1){
  123. userId = brr[i].split('=')[1];//用户id
  124. }
  125. }
  126. //页面加载,显示数据
  127. window.onload = function () {
  128. detailIntegral();
  129. getScoreDetail();
  130. }
  131. function detailIntegral () {
  132. //有积分记录
  133. var html = ''
  134. for( var i = 0 ; i < arr.length ; i++){
  135. if(arr[i].score>0){
  136. arr[i].score = "+" + arr[i].score;
  137. }
  138. html+=`<div class="detail">
  139. <div class="con">
  140. <div class="conLeft active"></div>
  141. <text>${arr[i].name}</text>
  142. <div class="time">${arr[i].created_at}</div>
  143. </div>
  144. <div class="gold">${arr[i].score}</div>
  145. </div>`;
  146. };
  147. $('.integral').html(html);
  148. $(".detail").eq(-1).find('.conLeft').removeClass('active')
  149. }
  150. function getScoreDetail () {
  151. $.ajax({
  152. type:"post",
  153. url:"/api/V1/getScoreDetail",
  154. data:{
  155. user_id:userId
  156. },
  157. success: function (res) {
  158. console.log(res)
  159. if(JSON.parse(res).res == null){
  160. $(".recordEmpty").css('display','block');
  161. $(".integral").css("display","none");
  162. }else{
  163. $(".recordEmpty").css('display','none');
  164. $(".integral").css("display","block");
  165. arr = JSON.parse(res).res;
  166. detailIntegral();
  167. }
  168. }
  169. });
  170. }
  171. </script>