// 字符上标 function convertToSuperscript(str) { var regex = /[\\\\|\?]+/; // 定义特殊符号的正则表达式 if (regex.test(str)) { return str.replace(/([\\\\|\?])/g, '$1'); // 使用正则表达式全局替换特殊符号并添加上标样式 } else { return str; } } //获取url传来的值 let arr = window.location.href.split('?')[1] let id = arr.split('=')[1] let baseUrl = 'https://ccdcfile.oss-cn-chengdu.aliyuncs.com' console.log(arr) let urlStr = window.location.href let apilang = '' let strIntroduce = '' if(urlStr.includes('English')){ // url = url.replace('English',change) // window.location.href = url apilang = 'English' strIntroduce = 'INTRODUCE' }else if(urlStr.includes('Chinese')){ apilang = 'Chinese' strIntroduce = '介绍' }else if(urlStr.includes('Russian')){ apilang = 'Russian' strIntroduce = 'Презентация' }else if(urlStr.includes('Spain')){ apilang = 'Spain' strIntroduce = 'Introducción' } // 根据ID获取详情 $.get(`http://www.ccdcdf.com:6080/api/index/getProductById?id=${id}&apilang=${apilang}`, function (res) { console.log('返回的数据', res) let data = res.data let title = convertToSuperscript(data.title) let description = convertToSuperscript(data.description) let introduce = convertToSuperscript(data.introduce) let arr = data.images.split(',') let str2 = '' str2 = `
${title}
${strIntroduce}
${data.content}