菜谱项目

creditCardList.html 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <title></title>
  5. <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
  6. <meta name="format-detection" content="telephone=no,address=no,email=no" />
  7. <meta name="mobileOptimized" content="width" />
  8. <meta name="handheldFriendly" content="true" />
  9. <meta name="apple-mobile-web-app-capable" content="yes" />
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  11. <meta name="description" content="" />
  12. <meta name="keywords" content=""/>
  13. <script>
  14. ;(function() {
  15. var docEl = document.documentElement,
  16. resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
  17. clientWidth = docEl.clientWidth;
  18. s();
  19. window.addEventListener(resizeEvt, s, false);
  20. function s() {
  21. docEl.style.fontSize = 50.0 * (clientWidth / 375) + 'px';
  22. }
  23. })();
  24. </script>
  25. <script>
  26. var _ua = navigator.userAgent;
  27. if (!!_ua.match(/.*OS\s([\d_]+)/) || !!_ua.match(/(Android)\s+([\d.]+)/)) {
  28. document.write('<style>body{min-width:320px;min-height:320px;}</style>');
  29. }
  30. </script>
  31. <link rel="stylesheet" type="text/css" href="normalize.css">
  32. <style type="text/css" media="screen">
  33. body, html{ background-color: #f6f6f8; }
  34. h6,p,div,a,ul,li,h5{margin: 0;padding: 0;}
  35. h6,p,h5{ line-height: 1.5; }
  36. ul,li{ list-style: none; }
  37. a, a:hover{ text-decoration: none; color: #333; }
  38. .img-box{ width: 100%; }
  39. .elli{ overflow: hidden; white-space: nowrap; max-width: 100%; text-overflow: ellipsis }
  40. #bank-list{ margin: 4px; padding: 0; overflow: hidden; background-color: #fff; border-radius: 4px;}
  41. #bank-list li{ width: 33.3%; height: 115px; float: left; text-align: center;}
  42. #bank-list li a{ display: block; }
  43. #bank-list li .img-box{ width: 46px; height: 46px; margin: 16px auto 0;overflow: hidden;}
  44. #bank-list li h6{ font-size: 14px;font-weight: 500;}
  45. #bank-list li p{ font-size: 12px; color: #999;}
  46. #creditcard-list{ background-color: #fff; margin: 0 4px 10px; padding:0 10px; border-radius: 4px;}
  47. #creditcard-list>h6{ height: 36px; line-height: 36px; font-size: 16px;color:#333;font-weight: 500;border-bottom: 1px solid #ddd; }
  48. #creditcard-list ul li{overflow: hidden;line-height: 0; height: 90px; position: relative; border-bottom: 1px solid #ddd;}
  49. #creditcard-list ul li a{display: block; font-size: 0; margin-top: 10px;}
  50. #creditcard-list ul li .img-box{display: inline-block; vertical-align: top; width: 108px; height: 68px; overflow: hidden; border-radius: 4px; margin-right: 10px;}
  51. #creditcard-list ul li .intro{ display: inline-block; color: #333; margin-top: -2px; font-size: 14px;}
  52. #creditcard-list ul li h5{ font-size: 16px; color: #333; font-weight: 500; }
  53. #creditcard-list ul li p{ font-size: 12px; color: #666; }
  54. #creditcard-list ul li em{display: inline-block; width: auto; height: 18px; line-height: 18px; border: #3993ff solid 1px; color: #3993ff;padding: 0 10px; border-radius: 4px; margin-right: 10px; margin-top: 4px;}
  55. @media screen and (max-width: 415px) {#creditcard-list ul li .intro{ width: 68%; } }
  56. @media screen and (max-width: 375px) {#creditcard-list ul li .intro{ width: 64%; } }
  57. @media screen and (max-width: 320px) {#creditcard-list ul li .intro{ width: 58%; } }
  58. @media (-webkit-min-device-pixel-ratio: 2){ #creditcard-list>h6, #creditcard-list ul li{ border-width: 0.5px;}}
  59. </style>
  60. </head>
  61. <body>
  62. <ul id="bank-list"></ul>
  63. <div id="creditcard-list">
  64. <h6>热门卡片</h6>
  65. <ul></ul>
  66. </div>
  67. <script src="axios.min.js" type="text/javascript" charset="utf-8"></script>
  68. <script type="text/javascript" charset="utf-8">
  69. var data = [], html = '', container = document.querySelector('#bank-list');
  70. axios.get('/api/product/hotcreditcardlist')
  71. .then(function (res) {
  72. if (res.data.errno === '0') {
  73. data = res.data.rst.data.list;
  74. if (data.length > 0) {
  75. for (var i = 0; i < data.length; i++) {
  76. html += '<li class="list-item"><a href="'+ data[i].url +'"> <div class="img-box"><img src="'+ data[i].icon +'"></div> <h6 class="elli">'+ data[i].name +'</h6> <p class="elli">'+ data[i].desc +'</p> </a></li>'
  77. }
  78. }
  79. container.innerHTML = html;
  80. }
  81. })
  82. .catch(function (error) {
  83. console.log(error);
  84. });
  85. var list = [], context = '', containerList = document.querySelector('#creditcard-list ul'), keyData = [], str = '';
  86. axios.get('/api/product/creditcardlist')
  87. .then(function (res) {
  88. if (res.data.errno === '0') {
  89. list = res.data.rst.data.list;
  90. if (list.length > 0) {
  91. for (var n = 0; n < list.length; n++) {
  92. keyData = list[n].keywords;
  93. console.log(keyData);
  94. if (keyData.length > 0) {
  95. str = "";
  96. for (var j = 0; j < keyData.length; j++) {
  97. str += '<em> '+ keyData[j] +' </em>'
  98. }
  99. }
  100. context += '<li><a href="'+ list[n].url +'"><div class="img-box"><img src="'+ list[n].card_icon +'"></div><div class="intro"><h5 class="elli">'+ list[n].name +'</h5><p class="elli">'+ list[n].desc +'</p><p class="elli">'+ str +'</p></div></a></li>'
  101. }
  102. }
  103. containerList.innerHTML = context;
  104. }
  105. })
  106. .catch(function (error) {
  107. console.log(error);
  108. });
  109. </script>
  110. </body>
  111. </html>