Aucune description

detailIntegral.html 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. </head>
  99. <body>
  100. <div class="recordEmpty">
  101. <img src="../H5/noFriend.png" />
  102. <p>您目前还没有积分,赶紧做任务赚积分吧~</p>
  103. </div>
  104. <div class="integral"></div>
  105. </body>
  106. </html>
  107. <script type="text/javascript" src="../jquery-2.1.0.js"></script>
  108. <script type="text/javascript">
  109. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  110. window.onresize = function(){
  111. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  112. }
  113. var userId = null;
  114. var arr = [];
  115. var str=location.href; //取得整个地址栏
  116. var num=str.indexOf("?");
  117. str=str.substr(num+1); //str得到?之后的字符串
  118. var brr=str.split("&");
  119. for(var i = 0 ; i<brr.length; i++){
  120. if(brr[i].indexOf('userId') != -1){
  121. userId = brr[i].split('=')[1];//用户id
  122. }
  123. }
  124. //页面加载,显示数据
  125. window.onload = function () {
  126. detailIntegral();
  127. getScoreDetail();
  128. }
  129. function detailIntegral () {
  130. //有积分记录
  131. var html = ''
  132. for( var i = 0 ; i < arr.length ; i++){
  133. if(arr[i].score>0){
  134. arr[i].score = "+" + arr[i].score;
  135. }
  136. html+=`<div class="detail">
  137. <div class="con">
  138. <div class="conLeft active"></div>
  139. <text>${arr[i].name}</text>
  140. <div class="time">${arr[i].created_at}</div>
  141. </div>
  142. <div class="gold">${arr[i].score}</div>
  143. </div>`;
  144. };
  145. $('.integral').html(html);
  146. $(".detail").eq(-1).find('.conLeft').removeClass('active')
  147. }
  148. function getScoreDetail () {
  149. $.ajax({
  150. type:"post",
  151. url:"/api/V1/getScoreDetail",
  152. data:{
  153. user_id:userId
  154. },
  155. success: function (res) {
  156. console.log(res)
  157. if(JSON.parse(res).res == null){
  158. $(".recordEmpty").css('display','block');
  159. $(".integral").css("display","none");
  160. }else{
  161. $(".recordEmpty").css('display','none');
  162. $(".integral").css("display","block");
  163. arr = JSON.parse(res).res;
  164. detailIntegral();
  165. }
  166. }
  167. });
  168. }
  169. </script>