91 lines
7.1 KiB
JavaScript
91 lines
7.1 KiB
JavaScript
$(function () {
|
||
$(".container-fluid").hide()
|
||
// 获取活动列表
|
||
var page = 1
|
||
var limit = 12
|
||
function getActivityList() {
|
||
$.ajax({
|
||
method: 'GET',
|
||
url: adminPath + '/api/wdsxh/activity/activity/index',
|
||
data: {
|
||
page: page,
|
||
limit: limit,
|
||
},
|
||
success: function (res) {
|
||
$(".container-fluid").show()
|
||
if (res.code == 1) {
|
||
var listHtml = ""
|
||
for (var i in res.data.data) {
|
||
listHtml += `
|
||
<button type="button" data-toggle="modal" data-target="#codeModal" class="cont-item">
|
||
<div class="item-image">
|
||
<img class="image" src="${res.data.data[i].images}">
|
||
</div>
|
||
<div class="item-box">
|
||
<div class="box-title">${res.data.data[i].name}</div>
|
||
<div class="box-label">
|
||
<svg class="icon" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||
<path d="M6.99998 0.333252C3.32665 0.333252 0.333313 3.32659 0.333313 6.99992C0.333313 10.6733 3.32665 13.6666 6.99998 13.6666C10.6733 13.6666 13.6666 10.6733 13.6666 6.99992C13.6666 3.32659 10.6733 0.333252 6.99998 0.333252ZM9.89998 9.37992C9.80665 9.53992 9.63998 9.62659 9.46665 9.62659C9.37998 9.62659 9.29331 9.60659 9.21331 9.55325L7.14665 8.31992C6.63331 8.01325 6.25331 7.33992 6.25331 6.74659V4.01325C6.25331 3.73992 6.47998 3.51325 6.75331 3.51325C7.02665 3.51325 7.25331 3.73992 7.25331 4.01325V6.74659C7.25331 6.98659 7.45331 7.33992 7.65998 7.45992L9.72665 8.69325C9.96665 8.83325 10.0466 9.13992 9.89998 9.37992Z" fill="currentColor" />
|
||
</svg>
|
||
<span class="text">${res.data.data[i].start_time} | ${res.data.data[i].week}</span>
|
||
</div>
|
||
<div class="box-label" style="display: ${res.data.data[i].organizing_method == 1 ? "none" : "flex"}">
|
||
<svg class="icon" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||
<path d="M13.7467 5.63341C13.0467 2.55341 10.36 1.16675 8 1.16675C8 1.16675 8 1.16675 7.99334 1.16675C5.64 1.16675 2.94667 2.54675 2.24667 5.62675C1.46667 9.06675 3.57334 11.9801 5.48 13.8134C6.18667 14.4934 7.09334 14.8334 8 14.8334C8.90667 14.8334 9.81334 14.4934 10.5133 13.8134C12.42 11.9801 14.5267 9.07341 13.7467 5.63341ZM8 8.97341C6.84 8.97341 5.9 8.03341 5.9 6.87341C5.9 5.71341 6.84 4.77341 8 4.77341C9.16 4.77341 10.1 5.71341 10.1 6.87341C10.1 8.03341 9.16 8.97341 8 8.97341Z" fill="currentColor" />
|
||
</svg>
|
||
<span class="text">${res.data.data[i].address}</span>
|
||
</div>
|
||
<div class="box-label" style="display: ${res.data.data[i].organizing_method == 2 ? "none" : "flex"}">
|
||
<svg class="icon" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||
<g clip-path="url(#clip241_6749)">
|
||
<circle cx="8.000000" cy="8.500000" r="7.000000" fill="currentColor" fill-opacity="1.000000"/>
|
||
<path id="path" d="M8 3.5C5.23859 3.5 3 5.73828 3 8.5C3 11.2617 5.23859 13.5 8 13.5C10.7614 13.5 13 11.2617 13 8.5C13 5.73828 10.7614 3.5 8 3.5ZM7.64288 6.33789C7.16315 6.29785 6.70569 6.18066 6.28406 5.99414C6.62555 5.0957 7.13013 4.48535 7.64288 4.28711L7.64288 6.33789ZM7.64288 7.05273L7.64288 8.14258L5.86707 8.14258C5.88995 7.61328 5.96216 7.12207 6.07233 6.67871C6.56104 6.88477 7.08905 7.0127 7.64288 7.05273ZM7.64288 8.85742L7.64288 9.94727C7.08905 9.9873 6.56104 10.1152 6.07233 10.3213C5.96204 9.87793 5.88995 9.38672 5.86707 8.85742L7.64288 8.85742ZM7.64288 10.6621L7.64288 12.7129C7.13013 12.5146 6.62555 11.9043 6.28406 11.0059C6.70569 10.8193 7.16315 10.7021 7.64288 10.6621ZM8.35712 10.6621C8.83685 10.7021 9.29431 10.8193 9.71594 11.0059C9.37445 11.9043 8.86987 12.5146 8.35712 12.7129L8.35712 10.6621ZM8.35712 9.94727L8.35712 8.85742L10.1329 8.85742C10.11 9.38672 10.038 9.87793 9.92767 10.3213C9.43896 10.1152 8.91095 9.9873 8.35712 9.94727ZM8.35712 8.14258L8.35712 7.05273C8.91095 7.0127 9.43896 6.88477 9.92767 6.67871C10.038 7.12207 10.11 7.61328 10.1329 8.14258L8.35712 8.14258ZM8.35712 6.33789L8.35712 4.28711C8.86987 4.48535 9.37445 5.0957 9.71594 5.99414C9.29431 6.18066 8.83685 6.29785 8.35712 6.33789ZM9.79645 4.61426C10.1715 4.78809 10.5142 5.01172 10.8246 5.28516C10.6744 5.41797 10.5123 5.53613 10.3447 5.64648C10.1902 5.25879 10.0058 4.91113 9.79645 4.61426ZM5.65546 5.64648C5.48785 5.53613 5.32568 5.41797 5.17548 5.28516C5.48584 5.01172 5.82861 4.78809 6.20367 4.61426C5.9942 4.91113 5.80981 5.25879 5.65546 5.64648ZM5.42401 6.34863C5.27356 6.89844 5.17914 7.50391 5.15326 8.14258L3.73248 8.14258C3.80591 7.25879 4.14679 6.44922 4.67688 5.79883C4.90723 6.00488 5.15839 6.1875 5.42401 6.34863ZM5.15314 8.85742C5.17902 9.49609 5.27344 10.1016 5.42389 10.6514C5.15826 10.8125 4.90723 10.9951 4.6767 11.2012C4.14655 10.5508 3.80566 9.74121 3.73224 8.85742L5.15314 8.85742ZM5.65546 11.3535C5.80981 11.7412 5.9942 12.0889 6.20367 12.3857C5.82861 12.2119 5.4859 11.9883 5.17548 11.7148C5.32568 11.582 5.48785 11.4639 5.65546 11.3535ZM10.3445 11.3535C10.5121 11.4639 10.6743 11.582 10.8246 11.7148C10.5142 11.9883 10.1714 12.2119 9.79633 12.3857C10.0058 12.0889 10.1902 11.7412 10.3445 11.3535ZM10.576 10.6514C10.7264 10.1016 10.8209 9.49609 10.8467 8.85742L12.2675 8.85742C12.1941 9.74121 11.8532 10.5508 11.3231 11.2012C11.0928 10.9951 10.8416 10.8125 10.576 10.6514ZM10.8469 8.14258C10.821 7.50391 10.7266 6.89844 10.5761 6.34863C10.8417 6.1875 11.0928 6.00488 11.3233 5.79883C11.8535 6.44922 12.1943 7.25879 12.2678 8.14258L10.8469 8.14258Z" fill="#FFFFFF" fill-opacity="1.000000" fill-rule="nonzero"/>
|
||
</g>
|
||
</svg>
|
||
<span class="text">报名成功后查看</span>
|
||
</div>
|
||
</div>
|
||
</button>
|
||
`
|
||
}
|
||
$(".container-main .main-content").html(listHtml)
|
||
if (listHtml) {
|
||
$(".empty").hide()
|
||
} else {
|
||
$(".empty").css("display", "flex")
|
||
}
|
||
setPages(res.data.total)
|
||
} else {
|
||
console.error(res.msg)
|
||
}
|
||
},
|
||
error: function (res) {
|
||
if (res.status == 401) {
|
||
$(".container-fluid").show()
|
||
$(".container-main .main-code").show()
|
||
}
|
||
}
|
||
})
|
||
}
|
||
// 设置分页
|
||
function setPages(total) {
|
||
var nowPage = page
|
||
var totalPage = Math.ceil(total / limit)
|
||
if (nowPage == 1) {
|
||
new Paging('page', {
|
||
nowPage: nowPage, // 当前页码
|
||
pageNum: totalPage, // 总页码
|
||
totalNum: total, // 总条数
|
||
buttonNum: 5, //要展示的页码数量
|
||
canJump: 1,// 是否能跳转。0=不显示(默认),1=显示
|
||
showOne: 0,//只有一页时,是否显示。0=不显示,1=显示(默认)
|
||
callback: function (num) { //回调函数
|
||
page = num
|
||
getActivityList()
|
||
}
|
||
})
|
||
}
|
||
}
|
||
// 调用方法
|
||
getActivityList()
|
||
}); |