ZHANG ZENGXUAN d0dd647fac feat: INIT
2025-05-19 21:59:43 +08:00

51 lines
1.6 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// banner
var imgIndex = 0;
var imgDivArr = document.getElementsByClassName("imgdiv");
var dotArr = document.getElementsByClassName("dot");
/**
* 播放图片
* 参数r是否正放若为true正放。若为false倒放
*/
function picplay(r) {
for (let i = 0; i < imgDivArr.length; i++) {
imgDivArr[i].style.display = "none";
dotArr[i].className = "dot";
}
if (r) {
imgIndex++;
imgIndex = (imgIndex >= imgDivArr.length) ? 0 : imgIndex;
} else {
imgIndex--;
imgIndex = (imgIndex < 0) ? imgDivArr.length - 1 : imgIndex;
}
imgDivArr[imgIndex].style.display = "block";
dotArr[imgIndex].className = "dot active";
}
setInterval(picplay, 3000, true);
// banner
// 判断用户登录状态
function usermessage() {
var userId = window.localStorage.getItem('userId');
var userToken = window.localStorage.getItem("yq_token");
console.log(userId);
$.ajax({
url: 'http://127.0.0.1:81/consumer/user/fineById/' + userId + '/', //请求url
undefined,
type: "get",
headers: {
undefined,
"token": userToken //此处放置请求到的用户token
},
success: function(data) {
if (data.code == 200) {
b = '<ul class="denglu">' +
data.data.username + '</ul>';
b += '<p style="margin-bottom:30px;">' + data.data[j].poemUser + '</p>';
b += '<div class="mb-6"><p>' + data.data[j].time + '</p></div></div></div>';
$("#denglu").append(b);
}
}
})
}
// 判断用户状态结束