codeToFile1.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>商品资料页</title>
  6. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  7. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  8. <style>
  9. body {
  10. margin: 0; /* 移除默认的边距 */
  11. padding: 0; /* 移除默认的填充 */
  12. background-color: #003399;
  13. }
  14. .logo-margin{
  15. margin: -60pt 0 0 30pt;
  16. position: absolute;
  17. }
  18. .img-div{
  19. width: 100%;
  20. height: 353pt;
  21. background-color: #AAB7CB ;
  22. background-image: url('./img/background.png');
  23. background-size: cover; /* 可选:使背景图片覆盖整个div */
  24. background-position: center; /* 可选:居中显示背景图片 */
  25. background-repeat: no-repeat; /* 可选:防止背景图片重复 */
  26. position: relative;
  27. margin-top: 95px;
  28. }
  29. .title-div{
  30. width: 100%;
  31. height:50px;
  32. margin:60px 0 60px 30pt
  33. }
  34. .title-font{
  35. font-size: 40pt;
  36. height:50px;
  37. line-height: 50px;
  38. vertical-align: auto;
  39. text-align: left;
  40. color: #FFFFFF;
  41. font-weight: bold
  42. }
  43. .margin-style{
  44. margin:30pt 0 30pt 0;
  45. }
  46. .div-border{
  47. width: 90%;
  48. height: 150px;
  49. border-radius: 8pt;
  50. background-color: #FFFFFF;
  51. display: flex;
  52. justify-content: left;
  53. margin: 35px;
  54. }
  55. .img-style{
  56. width: 90px;
  57. height: 90px;
  58. margin: 28px 0 0 20px;
  59. }
  60. .content-style{
  61. font-size: 30px;
  62. color: #333333;
  63. margin: 30px 20px 0 20px;
  64. }
  65. .content-div{
  66. width: 90%;
  67. height: 500pt;
  68. min-height: 500pt;
  69. background-color: rgba(255, 255, 255, 0.3);
  70. max-height: 500pt;
  71. margin: auto;
  72. overflow: auto;
  73. border: 1px solid #707070;
  74. border-radius: 10pt;
  75. }
  76. .container {
  77. display: flex;
  78. justify-content: center; /* 水平居中 */
  79. align-items: center; /* 垂直居中 */
  80. height: 100pt; /* 设置容器高度 */
  81. background-color: rgba(255, 255, 255, 0.3);
  82. width: 100%;
  83. margin-top: 50pt;
  84. font-size: 50pt;
  85. margin-bottom: 50pt;
  86. }
  87. .inner {
  88. color: #FFFFFF;
  89. }
  90. .container_div {
  91. display: flex;
  92. justify-content: center; /* 水平居中 */
  93. align-items: center; /* 垂直居中 */
  94. height: 50pt;
  95. width: 100%;
  96. font-size: 30pt;
  97. color: #FFFFFF;
  98. }
  99. </style>
  100. </head>
  101. <body>
  102. <div class="img-div" id="backgroundDiv">
  103. <img src="./img/logo.png" width="164pt" height="164pt" class="logo-margin">
  104. </div>
  105. <div class="title-div">
  106. <img src="./img/datum.png" width="84pt" height="84pt" class="logo-margin" style="margin-top: -10px">
  107. <div class="title-font" style="margin-left: 160px">产品技术资料</div>
  108. </div>
  109. <div class="content-div" style="margin-top: 30pt">
  110. <div id="dataContainer"></div>
  111. </div>
  112. <div class="container">
  113. <div class="inner" onclick="window.location.href='http://www.ibpchina.com/';">
  114. 品牌官网·点击跳转
  115. </div>
  116. </div>
  117. <div class="container_div">班尼戈</div>
  118. <div class="container_div">水工业控制的可靠服务商</div>
  119. <div class="container_div">客服电话:+86 0573-89053730</div>
  120. <script>
  121. window.onload = async function(){
  122. var loc=location.href;
  123. var n1=loc.length;
  124. var n2=loc.indexOf('=');
  125. var code=loc.slice(n2+1,n1)
  126. let that = this
  127. console.log(code)
  128. let param = {
  129. "id": 2025082515112802,
  130. "content": {
  131. "code": code
  132. },
  133. }
  134. var str = window.location.href;
  135. var index = str.indexOf('/');
  136. var num = 0;
  137. var strNew = ''
  138. while(index !== -1) {
  139. num++;
  140. index = str.indexOf('/',index + 1);
  141. if (num++ === 3) {
  142. this.url = str.slice(0, index) + '/yosweb/codeToFile.html'
  143. strNew = str.slice(0, index)
  144. }
  145. }
  146. console.log(strNew)
  147. var urlNew = strNew + '/yos/rest/index'
  148. console.log(urlNew)
  149. axios.post(urlNew, param)
  150. .then(function (response) {
  151. response.data.data.forEach((item,index) => {
  152. item.attinfos.forEach((data,rowindex) => {
  153. const div = document.createElement('div');
  154. div.className = 'div-border';
  155. let iconSrc = '';
  156. if (data.postfix == 'doc' || data.postfix == 'DOC' || data.postfix == 'docx' || data.postfix == 'DOCX') {
  157. iconSrc = './img/word.svg';
  158. } else if (data.postfix == 'pdf' || data.postfix == 'PDF') {
  159. iconSrc = './img/pdfType.svg';
  160. } else if (data.postfix == 'png' || data.postfix == 'PNG' || data.postfix == 'JPG' || data.postfix == 'jpg') {
  161. iconSrc = './img/pngType.svg';
  162. }else if (data.postfix == 'ppt' || data.postfix == 'PPT') {
  163. iconSrc = './img/ppt.svg';
  164. }else if (data.postfix == 'mp3' || data.postfix == 'MP3' || data.postfix == 'MP4' || data.postfix == 'mp4'
  165. || data.postfix == 'mov' || data.postfix == 'MOV') {
  166. iconSrc = './img/mov.svg';
  167. }else if (data.postfix == 'EXCEL' || data.postfix == 'excel' || data.postfix == 'xlsx' || data.postfix == 'XLSX') {
  168. iconSrc = './img/excel.svg';
  169. } else {
  170. iconSrc = './img/default.svg';
  171. }
  172. let remarks = data.document.split('.')[0]
  173. div.innerHTML = `
  174. <div class="div-border" >
  175. <img src="${iconSrc}" class="img-style">
  176. <div class="content-style">${data.document.split('.')[0]}</div>
  177. </div>
  178. `;
  179. dataContainer.appendChild(div);
  180. div.addEventListener('click', function() {
  181. console.log(data.url)
  182. downloadFile(data.url)
  183. });
  184. })
  185. })
  186. })
  187. .catch(function (error) {
  188. console.log(error);
  189. });
  190. }
  191. function downloadFile(fileUrl, fileType){
  192. const link = document.createElement('a');
  193. link.href = fileUrl
  194. document.body.appendChild(link);
  195. link.click();
  196. document.body.removeChild(link);
  197. }
  198. </script>
  199. </body>
  200. </html>