codeToFileCopy.html 8.5 KB

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