recommend.js
2.8 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
$(document).ready(function() {
//查看已推荐的项目
var url = "/warrantyTwo/warrantyTwos"; // 接口
var header = {
"Content-Type": "application/json",
"token": localStorage.getItem('token'),
}
var params = JSON.stringify({
current: 1,
size: 4
})
// 调用公共ajax
ajax(url, "POST", header, params, function(res) {
console.log(res);
$("#recommend-num").html(res.data.records.length)
$.each(res.data.records, function(key, value) {
let title = `
<div class="col-lg-32 col-sm-60" style="display: flex;place-content: center;background-color: #fff;">
<a href="#" class="portfolio-box3" style="display: flex;">
<img src="${value.img2}" alt="" style="width:25%;margin-right: 5%;">
<div style="display: flex; flex-direction: column;">
<h5 style="color: #323232;">${value.field}</h5>
<p style="padding-top: 10%;color: #5a5a5a;">${value.futitle}</p>
</div>
</a>
</div>`
$('#allProject').append(title)
})
}, function(res) {
console.log(res);
})
//查看个人信息赋值名字
var url2 = "/login/userInfo"; // 接口
// 调用公共ajax
ajax(url2, "GET", header, function(res) {
console.log(res);
}, function(res) {
console.log(res);
$("#header-name").html(res.data.surname + res.data.userName)
$("#title-name").html(res.data.surname + res.data.userName)
})
//首页
var url3 = "/warranty/warrantyList";
var header3 = {
"Content-Type": "application/x-www-form-urlencoded"
}
ajax(url3, "GET", header3, function(res) {
console.log('1', res);
}, function(res) {
console.log(res);
let EWM = `<img src="${res.data.sevenimg4}" width="100%">`
$('#ewm-footer').html(EWM)
})
})
//获取用户VIP信息判断是否是VIP
function setPersonal() {
var url = "/login/userInfo"; // 接口
var header = {
"Content-Type": "application/json",
"token": localStorage.getItem('token'),
}
// 调用公共ajax
ajax(url, "GET", header, function(res) {
console.log(res);
}, function(res) {
console.log(res);
if (res.data.status1 == 1) {
window.location.href = 'personalCenter.html'
} else {
window.location.href = 'personalCenter2.html'
}
})
}