codeToFile.html 8.4 KB

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