profile.js
8.4 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
var str1 = ''
var token = ''
var userId = ''
$(document).ready(function () {
var url = window.location.search;
// console.log(url);
if (url.indexOf('?') != -1) {
//截取url ?id=1 第四位
str1 = url.substr(4)
console.log(str1);
token = localStorage.getItem('token')
userId = localStorage.getItem("userId");
//公司介绍
var header = {
"Content-Type": "application/x-www-form-urlencoded",
}
ajax("/recommend/recommendList", "GET", header, { id: str1 }, function (res) {
// console.log(res);
// console.log(res.data);
// $('#titleExplain').html(res.data.titleExplain)
// $('#explain').html(res.data.explain)
$('#onefield').html(res.data.onefield)
$('#onefield1').html(res.data.onefield1)
$('#twofield').html(res.data.twofield)
$('#twoName').html(res.data.twoName)
$('#twoNames').html(res.data.twoNames)
$('#twofield1').html(res.data.twofield1)
$('#fourfield1').html(res.data.fourfield1)
$('#fourfield2').html(res.data.fourfield2)
$('#fourfield3').html(res.data.fourfield3)
$('#fivefield').html(res.data.fivefield)
$('#threefield').html(res.data.threefield)
$('#threefield1').html(res.data.threefield1)
// 图片
// let logo = ` <img src="${res.data.img}" style="width: 100%;">`
// $("#img-logo").html(logo)
let img1 = `<img src="${res.data.img1}" alt="" style="width: 100%;height:100%">`
$("#img1").html(img1)
let img2 = `<img src="${res.data.img2}" alt="" style="width: 100%;height:100%">`
$("#img2").html(img2)
let img3 = `<img src="${res.data.img3}" style="width: 100%;height:100%" alt="" >`
$("#img3").html(img3)
$("#profile_bg").css('background-image', "url(" + res.data.img4 + ")")
$("#profile_head_logo").attr("src", res.data.img)
$("#explain").html(res.data.explain)
$("#titleExplain").html(res.data.titleExplain)
let info = `
<div class='btn-joinUs'>
<h5
style="position: absolute;background-color: #97dab6;border-radius: 50%;z-index: 2;width: 0.50rem;height: 0.50rem;opacity: 0.5;">
</h5>
<a onclick="setLearingContentId(${str1})" class='joinStudyPro'>加入实习项目</a>
</div>`
$('#jionInfo').html(info)
}, function (res) {
// console.log(res);
})
//获取四张小图
var header1 = {
"Content-Type": "application/x-www-form-urlencoded",
}
ajax("/recommendOne/recommendOneList", "GET", header1, { id: str1 }, function (res) {
$.each(res.data, function (key, value) {
let title = `
<div class="col-md-6 .col-sm-6 .col-xs-6 .col-lg-3 box-item">
<div class='four-to-one'><img src="${value.img}" style='width:100%'></div>
<div class="col-xs-91 four-to-tit">
<div class='four-to-one1'>${value.title}</div>
<div class='four-to-two1'>${value.englishTitle}</div>
</div>
</div>`
$('#fourGroups').append(title)
})
}, function (res) { })
var newId = ''
if (userId != null && userId != '') {
newId = userId
} else {
newId = 0
}
//大标题
var header3 = {
"Content-Type": "application/x-www-form-urlencoded",
// "token": localStorage.getItem('token'),
}
ajax("/recommend/recommendTwoList", "GET", header3, { id: str1, userId: newId }, function (res) {
console.log(res);
for (let i in res.data) {
//判断题目高度
let singltItem = ''
let content = ''
let x = +i + 1
let title = `
<div class='all-list'>
<!-- 左边 -->
<div class='list-left'>
<div class='yuan-num'>
<!-- 圆 -->
<div class='left-yuan'></div>
<!-- 数字 -->
<div class='left-num'>${x < 10 ? '0' + x : x}</div>
</div>
<!-- 线 -->
<div class='left-xian' style="height: 1rem;"> </div>
</div>
<!-- 右边 -->
<div id="get_right" class='right-content'>
<!-- 大标题 -->
<div class='bigTitle' id="big-title">
<div class='bigTitle-one' id="headline">${res.data[i].headline}</div>
<div class='bigTitle-two' id='dateTime'>${res.data[i].dateTime}</div>
</div>
<!-- 小标题 -->
<div class='smallTitle' id="title_content">`
$.each(res.data[i].recommendThrees, function (index, item) {
if (index == 0) {
console.log(i);
console.log(item);
}
if (index < 2) {
content += `<div>${item.subhead}</div>`
}
})
singltItem = title + content + ` </div>
<button class='title-btn' onClick="setLearingContentId(${str1})">下一步骤></button>
</div>
</div>`
$('#recommend-List').append(singltItem);
}
// $(".all-list").last().find('#list-left').find('#left-xian').css('display','none')
}, function (res) {
console.log(res);
})
//首页底部二维码
ajax("/warranty/warrantyList", "GET", header1, function (res) {
}, function (res) {
let EWM = `<img src="${res.data.sevenimg4}" width="100%">`
$('#ewm-footer').html(EWM)
})
}
})
//添加项目
function setLearingContentId(id) {
var header1 = {
"Content-Type": "application/json",
"token": localStorage.getItem('token'),
}
ajax("/login/userInfo", "GET", header1, function (res) {
console.log(res);
}, function (res) {
// console.log(res);
if (res.data.status1 == 2) {
var url7 = "/userProgram/userProgramAdd/" + id;
var header = {
"Content-Type": "application/x-www-form-urlencoded",
"token": localStorage.getItem('token'),
}
ajax(url7, "POST", header, function (res) {
console.log(res);
}, function (res) {
console.log(res);
window.location.href = 'learningContent.html?id=' + id
}, function (res) {
console.log(res);
alert("登录才可以查看项目内容哦!")
window.location.href = 'login.html'
})
} else {
alert("请您充值会员才能查看此内容!")
window.location.href = 'personalCenter.html'
}
}, function (res) {
if (res) {
alert("请您先登录,否则无法查看项目内容!")
window.location.href = 'login.html'
}
})
}
//获取用户VIP信息判断是否是VIP
function setPersonal() {
var header = {
"Content-Type": "application/json",
"token": localStorage.getItem('token'),
}
ajax("/login/userInfo", "GET", header, function (res) {
console.log(res);
}, function (res) {
// console.log(res);
if (res.data.status1 == 2) {
window.location.href = 'personalCenter2.html'
} else {
window.location.href = 'personalCenter.html'
}
}, function (res) {
if (res) {
alert("请您先登录!")
window.location.href = 'login.html'
}
})
}