index.js
7.3 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
$(document).ready(function() {
//首页
$.ajax({
type: 'GET',
url: "http://192.168.1.241:9004/warranty/warrantyList",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"token": localStorage.getItem('token'),
},
success: function(res) {
console.log('1', res);
$('#onefields1').html(res.data.onefields1)
$('#onefields2').html(res.data.onefields2)
$('#twofields1').html(res.data.twofields1)
$('#twofields2').html(res.data.twofields2)
$('#twofields3').html(res.data.twofields3)
$('#threefield1').html(res.data.threefield1)
$('#threefield2').html(res.data.threefield2)
$('#fourfields1').html(res.data.fourfields1)
$('#fourfields2').html(res.data.fourfields2)
$('#fourfields3').html(res.data.fourfields3)
$('#fivefields1').html(res.data.fivefields1)
$('#fivefields2').html(res.data.fivefields2)
$('#sixfields1').html(res.data.sixfields1)
$('#sixfields2').html(res.data.sixfields2)
$('#sevenfields1').html(res.data.sevenfields1)
$('#sevenfields2').html(res.data.sevenfields2)
//图片
let str = `<img src="${res.data.oneimg1}" class="rounded img-fluid d-block mx-auto" alt="" >`
$('#oneimg1').html(str)
}
})
//获取四张小图
$.ajax({
type: 'GET',
url: 'http://192.168.1.241:9004/warrantyOne/warrantyOneList',
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"token": localStorage.getItem('token'),
},
success: function(res) {
// console.log(res);
$.each(res.data, function(key, value) {
// console.log($(this));
// console.log(value)
let title = `<div class="col-md-6 box-item">
<div id="FourImage" class="col-xs-33 center">
<a><img src="${value.img}"></a>
</div>
<div class="col-xs-99" id="fourGroups_title">
<span id="FourTitle">${value.title}</span>
<p id="FourTxt" style="color:#5A5A5A;font-size: 0.5em;font-family: Helvetica;">${value.content}</p>
</div>
</div>`
$('#fourGroups').append(title)
})
}
})
//企业实习项目
$.ajax({
type: 'POST',
url: 'http://192.168.1.241:9004/warrantyTwo/warrantyTwoList',
headers: {
"Content-Type": "application/json",
"token": localStorage.getItem('token'),
},
data: JSON.stringify({
current: 1,
size: 4
}),
success: function(res) {
console.log('企业', res);
$.each(res.data.records, function(key, value) {
console.log(value)
let title = `<div class="col-xs-6 col-lg-33 portfolio-post contentClick" style="margin-bottom: 2%;height:35%" id=${value.id} onClick="setProfileId(${value.id})">
<article class="portfolio-post-item" style='height:100%'>
<div style="position: relative;height:100%">
<div style="position: relative;" style='height:100%'>
<img src="${value.img}" alt="" style='height:100%'>
</div>
<div style="position: absolute;bottom: 4%;right: 2%;line-height: 1;display: flex;width: 40%;place-items:center">
<div style="position: relative;margin-right: 2%;width: 25%;">
<img src="${value.img1}">
</div>
<div style="position: relative;">
<div style="font-size: 1.4em;color: #fff;padding-bottom:5%">${value.title}</div>
<div style="font-size: 1.4em;color: #fff; ">${value.futitle}</div>
</div>
</div>
</div>
<div class="portfolio-content-wrapper ">
<div class="portfolio-content ">
<h3 class="portfolio-title "><a>${value.content}</a></h3>
<div style="display: flex;text-align: left;place-items: center;padding-top: 6%; ">
<img src="${value.img1} " style="width: 10%;height: 1%; ">
<div style="display: flex;flex-direction: column;padding-left: 2%; ">
<div class="portfolio-cat" style='padding-bottom:5%'>${value.title}</div>
<div class="portfolio-cat">${value.futitle}</div>
</div>
</div>
</div>
</div>
</article>
</div>`
$('#enterpriseProject').append(title)
})
}
})
//首页问题
$.ajax({
type: 'GET',
url: 'http://192.168.1.241:9004/warrantyFive/warrantyFiveList',
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"token": localStorage.getItem('token'),
},
success: function(res) {
console.log(res);
$.each(res.data, function(key, value) {
console.log(value.question);
let title = `<div style="margin: 20px 0;color: #323232;" id="question2" onClick="showAnswer(${value.id})">${value.question}</div>`
$('#clickQuestion').append(title)
})
}
})
});
//首页答案
function showAnswer(id) {
$.ajax({
type: 'GET',
url: 'http://192.168.1.241:9004/warrantyFive/warrantyFiveAnswer',
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"token": localStorage.getItem('token'),
},
data: {
id: id
},
success: function(res) {
console.log(res);
var i = 0;
console.log(i);
if (i % 2 == 0) {
document.getElementById('question2').style.color = '#66ca94'
$('#answer1').html(res.data)
i = 1
} else {
document.getElementsById('question2').style.color = '#323232'
}
}
})
}
function setProfileId(id) {
// location.href()
console.log('1111', id);
window.location.href = 'profile.html?id=' + id
}
//获取用户VIP信息判断是否是VIP
function setPersonal() {
$.ajax({
type: 'GET',
url: 'http://192.168.1.241:9004/login/userInfo',
headers: {
"Content-Type": "application/json",
"token": localStorage.getItem('token'),
},
success: function(res) {
console.log(res);
if (res.data.status1 == 1) {
window.location.href = 'personalCenter.html'
} else {
window.location.href = 'personalCenter2.html'
}
}
})
}