codeToFile.html 8.1 KB

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