|
|
@@ -0,0 +1,135 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+ <head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <title>商品资料页</title>
|
|
|
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
|
|
+ <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
|
|
+ <style>
|
|
|
+ .img-margin{
|
|
|
+ margin: 60pt 0 30pt 30pt;
|
|
|
+ }
|
|
|
+ .title-div{
|
|
|
+ width:100%;
|
|
|
+ height:50px;
|
|
|
+ margin:0 0 20pt 30pt
|
|
|
+ }
|
|
|
+ .title-font{
|
|
|
+ font-size: 40pt;
|
|
|
+ height:50px;
|
|
|
+ line-height: 50px;
|
|
|
+ vertical-align: auto;
|
|
|
+ text-align: left;
|
|
|
+ color: #333333;
|
|
|
+ font-weight: bold
|
|
|
+ }
|
|
|
+ .margin-style{
|
|
|
+ margin:0 30pt 20pt 30pt
|
|
|
+ }
|
|
|
+ .div-border{
|
|
|
+ width: 100%;
|
|
|
+ height: 150px;
|
|
|
+ border-radius: 8pt;
|
|
|
+ border: #cccccc solid 1px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: left;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ }
|
|
|
+ .img-style{
|
|
|
+ width: 90px;
|
|
|
+ height: 90px;
|
|
|
+ margin: 28px 0 0 20px;
|
|
|
+ }
|
|
|
+ .content-style{
|
|
|
+ font-size: 30px;
|
|
|
+ color: #333333;
|
|
|
+ margin: 30px 20px 0 20px;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <img src="./img/bnBag.png" width="85%" height="180px" class="img-margin">
|
|
|
+ <div class="title-div">
|
|
|
+ <div class="title-font" >产品技术资料</div>
|
|
|
+ </div>
|
|
|
+ <div class="margin-style" id="dataContainer"></div>
|
|
|
+ <script>
|
|
|
+ window.onload = async function(){
|
|
|
+ var loc=location.href;
|
|
|
+ var n1=loc.length;
|
|
|
+ var n2=loc.indexOf('=');
|
|
|
+ var code=loc.slice(n2+1,n1)
|
|
|
+ let that = this
|
|
|
+ console.log(code)
|
|
|
+ let param = {
|
|
|
+ "id": 2025082515112802,
|
|
|
+ "content": {
|
|
|
+ "code": code
|
|
|
+ },
|
|
|
+ }
|
|
|
+ var str = window.location.href;
|
|
|
+ var index = str.indexOf('/');
|
|
|
+ var num = 0;
|
|
|
+ var strNew = ''
|
|
|
+ while(index !== -1) {
|
|
|
+ num++;
|
|
|
+ index = str.indexOf('/',index + 1);
|
|
|
+ if (num++ === 3) {
|
|
|
+ this.url = str.slice(0, index) + '/yosweb/codeToFile.html'
|
|
|
+ strNew = str.slice(0, index)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(strNew)
|
|
|
+ var urlNew = strNew + '/yos/rest/index'
|
|
|
+ console.log(urlNew)
|
|
|
+ axios.post(urlNew, param)
|
|
|
+ .then(function (response) {
|
|
|
+ console.log(response)
|
|
|
+ console.log(response.data.data.length)
|
|
|
+ response.data.data.forEach((item,index) => {
|
|
|
+ const div = document.createElement('div');
|
|
|
+ div.className = 'div-border';
|
|
|
+ let iconSrc = '';
|
|
|
+ if (item.attinfos[index].postfix == 'word' || item.attinfos[index].postfix == 'Word') {
|
|
|
+ iconSrc = './img/word.svg';
|
|
|
+ } else if (item.attinfos[index].postfix == 'pdf' || item.attinfos[index].postfix == 'PDF') {
|
|
|
+ iconSrc = './img/pdfType.svg';
|
|
|
+ } else if (item.attinfos[index].postfix == 'png' || item.attinfos[index].postfix == 'PNG' || item.attinfos[index].postfix == 'JPG' || item.attinfos[index].postfix == 'jpg') {
|
|
|
+ iconSrc = './img/pngType.svg';
|
|
|
+ }else if (item.attinfos[index].postfix == 'ppt' || item.attinfos[index].postfix == 'PPT') {
|
|
|
+ iconSrc = './img/ppt.svg';
|
|
|
+ }else if (item.attinfos[index].postfix == 'mp3' || item.attinfos[index].postfix == 'MP3' || item.attinfos[index].postfix == 'MP4' || item.attinfos[index].postfix == 'mp4'
|
|
|
+ || item.attinfos[index].postfix == 'mov' || item.attinfos[index].postfix == 'MOV') {
|
|
|
+ iconSrc = './img/mov.svg';
|
|
|
+ }else if (item.attinfos[index].postfix == 'EXCEL' || item.attinfos[index].postfix == 'excel' || item.attinfos[index].postfix == 'xlsx' || item.attinfos[index].postfix == 'XLSX') {
|
|
|
+ iconSrc = './img/excel.svg';
|
|
|
+ } else {
|
|
|
+ iconSrc = './img/default.svg';
|
|
|
+ }
|
|
|
+ div.innerHTML = `
|
|
|
+ <div class="div-border" >
|
|
|
+ <img src="${iconSrc}" class="img-style">
|
|
|
+ <div class="content-style">${item.remarks}</div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ dataContainer.appendChild(div);
|
|
|
+ div.addEventListener('click', function() {
|
|
|
+ console.log(item.attinfos[index].url)
|
|
|
+ downloadFile(item.attinfos[index].url)
|
|
|
+ });
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(function (error) {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function downloadFile(fileUrl, fileType){
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.href = fileUrl
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link);
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ </body>
|
|
|
+</html>
|