system.js
1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// 字符上标
function convertToSuperscript(str) {
var regex = /[\\\\|\?]+/; // 定义特殊符号的正则表达式
if (regex.test(str)) {
return str.replace(/([\\\\|\?])/g, '<sup>$1</sup>'); // 使用正则表达式全局替换特殊符号并添加上标样式
} else {
return str;
}
}
let urlStr = window.location.href
let apilang = ''
if(urlStr.includes('English')){
// url = url.replace('English',change)
// window.location.href = url
apilang = 'English'
}else if(urlStr.includes('Chinese')){
apilang = 'Chinese'
}else if(urlStr.includes('Russian')){
apilang = 'Russian'
}else if(urlStr.includes('Spain')){
apilang = 'Spain'
}
// 获取体系列表
$.get(`http://www.ccdcdf.com:6080/api/index/getSystemList?apilang=${apilang}`, function (res) {
console.log('返回的数据', res)
let str = ''
res.data.forEach(item => {
let title = convertToSuperscript(item.title)
let description = convertToSuperscript(item.description)
// let objEncoded = encodeURIComponent(it);
str += `
<div>
<a href="../system/system_detail.html?data=${item.id}">
<span>${title}</span>
<p style="width:85%;display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
text-overflow: ellipsis;">${description}</p>
<div></div>
</a>
</div>
`
})
$('.info').append(str)
})