codeToFile.html 8.2 KB

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