codeToFile.html 8.4 KB

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