|
@@ -1,4 +1,15 @@
|
|
|
|
+import "../css/eventPlanning.css"
|
|
|
|
+
|
|
window.onload = function () {
|
|
window.onload = function () {
|
|
|
|
+ let value = ''
|
|
|
|
+ let totalCount = ''
|
|
|
|
+ let pageNo = 1
|
|
|
|
+ let pageSize = 10
|
|
|
|
+ let selected = 1
|
|
|
|
+ let pagenum = ''
|
|
|
|
+ let btnstart = 3
|
|
|
|
+ let btnend = btnstart + 6
|
|
|
|
+ let buer = null
|
|
$.ajax({
|
|
$.ajax({
|
|
method: "get",
|
|
method: "get",
|
|
dataType: "json",
|
|
dataType: "json",
|
|
@@ -12,219 +23,311 @@ window.onload = function () {
|
|
if (data.error && data.error.length) {
|
|
if (data.error && data.error.length) {
|
|
alert("数据加载失败,请刷新页面");
|
|
alert("数据加载失败,请刷新页面");
|
|
} else {
|
|
} else {
|
|
|
|
+ totalCount = data.data.totalCount
|
|
|
|
+ pagenum = Math.ceil(totalCount / pageSize)
|
|
|
|
+
|
|
|
|
+
|
|
$.each(data.data.list, function (index, item) {
|
|
$.each(data.data.list, function (index, item) {
|
|
- console.log(index, item);
|
|
|
|
|
|
|
|
- let part = `<li>
|
|
+ let part = `<li id="${item.id}">
|
|
- <a href="javascript:;">
|
|
|
|
<div class="newslist_img"><img src="${globalConfig.avatarUploadHost + item.pictureUrl}" alt=""></div>
|
|
<div class="newslist_img"><img src="${globalConfig.avatarUploadHost + item.pictureUrl}" alt=""></div>
|
|
<div class="newslist_content">
|
|
<div class="newslist_content">
|
|
<h6 class="title">${item.title}</h6>
|
|
<h6 class="title">${item.title}</h6>
|
|
<div class="date">${item.createTimes}</div>
|
|
<div class="date">${item.createTimes}</div>
|
|
<p class="content">${item.content}</p>
|
|
<p class="content">${item.content}</p>
|
|
</div>
|
|
</div>
|
|
- </a>
|
|
|
|
</li>`
|
|
</li>`
|
|
- $(".app .newslist").prepend(part)
|
|
+ $(".app .newslist").append(part)
|
|
- $(".app .newslist li .newslist_img").css({
|
|
+ })
|
|
- "float": "left",
|
|
+
|
|
- "width": "345px",
|
|
+ let paging = ` <div class="page_ctrl">
|
|
- "height": "200px"
|
|
+ <span class="page_total">共 ${pagenum} 页</span>
|
|
|
|
+ <button class="prev_page"><</button>
|
|
|
|
+ <div class="btns"></div>
|
|
|
|
+ <button class="next_page">></button>
|
|
|
|
+ <span class="page_total">到第</span>
|
|
|
|
+ <input class="input_page_num" type="text">
|
|
|
|
+ <span class="page_total">页</span>
|
|
|
|
+ <button class="determine">确定</button>
|
|
|
|
+ </div>`
|
|
|
|
+ $(".app .page_1").html(paging)
|
|
|
|
+ pagebtns()
|
|
|
|
+ select()
|
|
|
|
+ $(".determine").click(function () {
|
|
|
|
+ if ($(".input_page_num").val() < 1 || $(".input_page_num").val() > pagenum) return
|
|
|
|
+ selected = $(".input_page_num").val()
|
|
|
|
+ $(".input_page_num").val("")
|
|
|
|
+ jump()
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ $(".prev_page").click(function () {
|
|
|
|
+ if (selected == 1) return
|
|
|
|
+ selected--
|
|
|
|
+ if (selected > 4 && pagenum > 9 && selected < pagenum - 4) {
|
|
|
|
+ if ($(".more").length < 1) {
|
|
|
|
+ $(".btns").after('<span class="more">...</span>')
|
|
|
|
+ }
|
|
|
|
+ $(".btn").remove()
|
|
|
|
+ if (buer) {
|
|
|
|
+ btnstart--
|
|
|
|
+ btnend--
|
|
|
|
+ buer = false
|
|
|
|
+ }
|
|
|
|
+ for (let i = btnstart; i <= btnend; i++) {
|
|
|
|
+ let pagebtn = `<button class="pagebtn btn" index="${i}">${i}</button>`
|
|
|
|
+ $(".btns").append(pagebtn)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (selected > 5 && selected < pagenum - 3) {
|
|
|
|
+ --btnstart
|
|
|
|
+ --btnend
|
|
|
|
+ }
|
|
|
|
+ if (selected == 4) {
|
|
|
|
+ btnstart = 3
|
|
|
|
+ btnend = btnstart + 6
|
|
|
|
+ }
|
|
|
|
+ if (selected == 5) {
|
|
|
|
+ $(".beforemore").remove()
|
|
|
|
+ }
|
|
|
|
+ select()
|
|
|
|
+ request()
|
|
|
|
+ bidden()
|
|
|
|
+ $(".pagebtn").css({
|
|
|
|
+ "background": "#fff",
|
|
|
|
+ "color": "#999"
|
|
})
|
|
})
|
|
- $(".app .newslist li .newslist_img img").css({
|
|
+ $(`.pagebtn[index="${selected}"]`).css({
|
|
- "width": "345px",
|
|
+ "background": "#1296DB",
|
|
- "height": "200px"
|
|
+ "color": "#fff"
|
|
})
|
|
})
|
|
- $(".app .newslist li .newslist_content").css({
|
|
+ })
|
|
- "float": "left",
|
|
+
|
|
- "width": "735px",
|
|
+ $(".next_page").click(function () {
|
|
- "margin-left": "70px",
|
|
+ if (selected == pagenum) return
|
|
- "height": "200px"
|
|
+ selected++
|
|
|
|
+ if (selected > 5 && pagenum > 9 && selected < pagenum - 3) {
|
|
|
|
+ if ($(".beforemore").length < 1) {
|
|
|
|
+ $(".btns").before('<span class="beforemore">...</span>')
|
|
|
|
+ }
|
|
|
|
+ $(".btn").remove()
|
|
|
|
+ if (buer) {
|
|
|
|
+ console.log(123);
|
|
|
|
+ btnstart++
|
|
|
|
+ btnend++
|
|
|
|
+ buer = false
|
|
|
|
+ }
|
|
|
|
+ for (let i = btnstart; i <= btnend; i++) {
|
|
|
|
+ let pagebtn = `<button class="pagebtn btn" index="${i}">${i}</button>`
|
|
|
|
+ $(".btns").append(pagebtn)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (selected > 5 && selected < pagenum - 4) {
|
|
|
|
+ btnstart++
|
|
|
|
+ btnend++
|
|
|
|
+ }
|
|
|
|
+ if (selected == pagenum - 4) {
|
|
|
|
+ $(".more").remove()
|
|
|
|
+ }
|
|
|
|
+ select()
|
|
|
|
+ request()
|
|
|
|
+ bidden()
|
|
|
|
+ $(".pagebtn").css({
|
|
|
|
+ "background": "#fff",
|
|
|
|
+ "color": "#999"
|
|
|
|
+ })
|
|
|
|
+ $(`.pagebtn[index="${selected}"]`).css({
|
|
|
|
+ "background": "#1296DB",
|
|
|
|
+ "color": "#fff"
|
|
})
|
|
})
|
|
- $(".app .newslist li .newslist_content .title").css({
|
|
+ })
|
|
- "color": "#333",
|
|
+
|
|
- "font-size": "24px"
|
|
+ function pagebtns() {
|
|
|
|
+ if (pagenum <= 9) {
|
|
|
|
+ $(".prev_page").after(`<button class="pagebtn" index="1">1</button>`)
|
|
|
|
+ pagebtn(pagenum)
|
|
|
|
+ } else {
|
|
|
|
+ $(".prev_page").after(`<button class="pagebtn" index="1">1</button>`)
|
|
|
|
+ pagebtn(8)
|
|
|
|
+ $(".next_page:last").before(`<span class="more">...<span>`)
|
|
|
|
+ $(".next_page").before(`<button class="pagebtn" index="${pagenum}">${pagenum}</button>`)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function pagebtn(pagenum) {
|
|
|
|
+ for (let i = 2; i <= pagenum; i++) {
|
|
|
|
+ let pagebtn = `<button class="pagebtn btn" index="${i}">${i}</button>`
|
|
|
|
+ $(".btns").append(pagebtn)
|
|
|
|
+ $(".pagebtn:first").css({
|
|
|
|
+ "background": "#1296DB",
|
|
|
|
+ "color": "white"
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function select() {
|
|
|
|
+ $(".pagebtn").click(function () {
|
|
|
|
+ selected = $(this).attr("index")
|
|
|
|
+ console.log("woanle");
|
|
|
|
+ jump()
|
|
|
|
+ $(".pagebtn").css({
|
|
|
|
+ "background": "#fff",
|
|
|
|
+ "color": "#999"
|
|
|
|
+ })
|
|
|
|
+ $(this).css({
|
|
|
|
+ "background": "#1296DB",
|
|
|
|
+ "color": "white"
|
|
|
|
+ })
|
|
})
|
|
})
|
|
- $(".app .newslist li .newslist_content .date").css({
|
|
+ }
|
|
- "color": "#666",
|
|
+
|
|
- "font-size": "17px",
|
|
+ function jump() {
|
|
- "margin": "12px 0"
|
|
+ if (selected > 5 && pagenum > 9 && selected < pagenum - 4) {
|
|
|
|
+ if ($(".more").length < 1) {
|
|
|
|
+ $(".btns").after('<span class="more">...</span>')
|
|
|
|
+ }
|
|
|
|
+ if ($(".beforemore").length < 1) {
|
|
|
|
+ $(".btns").before('<span class="beforemore">...</span>')
|
|
|
|
+ }
|
|
|
|
+ $(".btn").remove()
|
|
|
|
+ for (let i = selected - 3; i <= Number(selected) + 3; i++) {
|
|
|
|
+ let pagebtn = `<button class="pagebtn btn" index="${i}">${i}</button>`
|
|
|
|
+ $(".btns").append(pagebtn)
|
|
|
|
+ }
|
|
|
|
+ btnstart = Number(selected) - 3
|
|
|
|
+ btnend = Number(selected) + 3
|
|
|
|
+ buer = true
|
|
|
|
+ select()
|
|
|
|
+ } else if (selected < 6) {
|
|
|
|
+ $(".beforemore").remove()
|
|
|
|
+ btnstart = 2
|
|
|
|
+ btnend = btnstart + 6
|
|
|
|
+ $(".btn").remove()
|
|
|
|
+ for (let i = btnstart; i <= btnend; i++) {
|
|
|
|
+ let pagebtn = `<button class="pagebtn btn" index="${i}">${i}</button>`
|
|
|
|
+ $(".btns").append(pagebtn)
|
|
|
|
+ }
|
|
|
|
+ select()
|
|
|
|
+ } else if (selected > pagenum - 5) {
|
|
|
|
+ $(".more").remove()
|
|
|
|
+ btnend = pagenum - 1
|
|
|
|
+ btnstart = btnend - 6
|
|
|
|
+ $(".btn").remove()
|
|
|
|
+ for (let i = btnstart; i <= btnend; i++) {
|
|
|
|
+ let pagebtn = `<button class="pagebtn btn" index="${i}">${i}</button>`
|
|
|
|
+ $(".btns").append(pagebtn)
|
|
|
|
+ }
|
|
|
|
+ select()
|
|
|
|
+ }
|
|
|
|
+ console.log(btnend, btnstart);
|
|
|
|
+ request()
|
|
|
|
+ select()
|
|
|
|
+ bidden()
|
|
|
|
+ $(".pagebtn").css({
|
|
|
|
+ "background": "#fff",
|
|
|
|
+ "color": "#999"
|
|
})
|
|
})
|
|
- $(".app .newslist li .newslist_content .content").css({
|
|
+ $(`.pagebtn[index="${selected}"]`).css({
|
|
- "color": "#666",
|
|
+ "background": "#1296DB",
|
|
- "display": "-webkit-box",
|
|
+ "color": "#fff"
|
|
- "-webkit-box-orient": "vertical",
|
|
|
|
- "-webkit-line-clamp": "6",
|
|
|
|
- "overflow": "hidden"
|
|
|
|
})
|
|
})
|
|
- $(".app .newslist li").css({
|
|
+ }
|
|
- "width": "1250px",
|
|
+
|
|
- "height": "272px",
|
|
+ function request() {
|
|
- "padding": "36px 50px",
|
|
+ $.ajax({
|
|
- "transition": "all .36s ease",
|
|
+ method: "get",
|
|
- "position": "relative",
|
|
+ dataType: "json",
|
|
- "top": "0",
|
|
+ url: "/open/getEventPlanningList",
|
|
- "left": "0"
|
|
+ data: {
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ pageNo: selected
|
|
|
|
+ },
|
|
|
|
+ success: function (data) {
|
|
|
|
+ $(".newslist").empty()
|
|
|
|
+
|
|
|
|
+ $.each(data.data.list, function (index, item) {
|
|
|
|
+
|
|
|
|
+ let part = `<li id="${item.id}">
|
|
|
|
+ <div class="newslist_img"><img src="${globalConfig.avatarUploadHost + item.pictureUrl}" alt=""></div>
|
|
|
|
+ <div class="newslist_content">
|
|
|
|
+ <h6 class="title">${item.title}</h6>
|
|
|
|
+ <div class="date">${item.createTimes}</div>
|
|
|
|
+ <p class="content">${item.content}</p>
|
|
|
|
+ </div>
|
|
|
|
+ </li>`
|
|
|
|
+ $(".app .newslist").append(part)
|
|
|
|
+ $(`.pagebtn[index="${selected}"]`).css({
|
|
|
|
+ "background": "#1296DB",
|
|
|
|
+ "color": "#fff"
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ $(".newslist li").click(function () {
|
|
|
|
+ let id = $(this).attr("id")
|
|
|
|
+ window.location.pathname = `/eventPlanning/${id}`
|
|
|
|
+ })
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $(".newslist li").click(function () {
|
|
|
|
+ let id = $(this).attr("id")
|
|
|
|
+ window.location.pathname = `/eventPlanning/${id}`
|
|
})
|
|
})
|
|
|
|
|
|
-
|
|
+ function bidden() {
|
|
- let page = `<div class="page_ctrl">
|
|
+ if (selected == 1) {
|
|
- <span class="page_total">共 ${Math.ceil(data.data.totalCount/10)} 页</span>
|
|
+ $(".prev_page").css({
|
|
- <button class="prev_page"><</button>
|
|
+ "cursor": "default",
|
|
- <button class="">></button>
|
|
+ "opacity": ".7",
|
|
- <span class="page_total">到第</span>
|
|
+ "background-color": "#eee",
|
|
- <input class="input_page_num" type="text">
|
|
+ "color": "#616161",
|
|
- <span class="page_total">页</span>
|
|
+ "border": "1px solid #999999"
|
|
- <button>确定</button>
|
|
+ })
|
|
- </div>`
|
|
+ } else {
|
|
- let pagebtn =
|
|
+ $(".prev_page").css({
|
|
|
|
+ "background-color": "#fff",
|
|
|
|
+ "color": "#999",
|
|
|
|
+ "cursor": "pointer",
|
|
|
|
+ "border": "0"
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if (selected == pagenum) {
|
|
|
|
+ $(".next_page").css({
|
|
|
|
+ "cursor": "default",
|
|
|
|
+ "opacity": ".7",
|
|
|
|
+ "background-color": "#eee",
|
|
|
|
+ "color": "#616161",
|
|
|
|
+ "border": "1px solid #999999"
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ $(".next_page").css({
|
|
|
|
+ "background-color": "#fff",
|
|
|
|
+ "color": "#999",
|
|
|
|
+ "cursor": "pointer",
|
|
|
|
+ "border": "0"
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- $(".app .page_1").prepend(page)
|
|
+ $(".technology_login").click(function () {
|
|
- $(".app .page_1").css({"margin": "40px 0"})
|
|
+ let loginTxt = $('.head_login')[0];
|
|
- $(".app .page_1 .page_ctrl").css({
|
|
+ if (loginTxt && ($(loginTxt).text()) == '登录') {
|
|
- "text-align": "center",
|
|
+ $('.head_login').click();
|
|
- "margin": "10px auto",
|
|
+ window.location.hash = 'jump';
|
|
- "box-sizing": "border-box"
|
|
+ $(".login").css({"display" : "block"})
|
|
|
|
+ return false;
|
|
|
|
+ } else {
|
|
|
|
+ if (window.adminData && window.adminData.mobile) {
|
|
|
|
+ msg('账号不正确,请退出重新登入。')
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ window.location.href = globalConfig.context + '/user/account/index.html#/demand';
|
|
|
|
+ }
|
|
})
|
|
})
|
|
- $(".app .page_1 .page_ctrl .page_total").css({
|
|
+
|
|
- "font-size" : "15px",
|
|
+ $(".login_close").click(function(){
|
|
- "color": "#999"
|
|
+ $(".login").css({"display" : "none"})
|
|
})
|
|
})
|
|
- $(".app .page_1 .page_ctrl .prev_page").css({
|
|
|
|
- "cursor": "default",
|
|
|
|
- "opacity": ".7",
|
|
|
|
- "background": "#eee",
|
|
|
|
- "color": "#616161",
|
|
|
|
- "border": "1px solid #999999"
|
|
|
|
- })
|
|
|
|
- $(".app .page_ctrl button,.app .input_page_num").css({
|
|
|
|
- "font-size": "12px",
|
|
|
|
- "width": "32px",
|
|
|
|
- "height": "32px",
|
|
|
|
- "line-height": "32px",
|
|
|
|
- "background": "#ffffff",
|
|
|
|
- "border-radius": "25px",
|
|
|
|
- "color": "#999999",
|
|
|
|
- "cursor": "pointer",
|
|
|
|
- "outline": "none",
|
|
|
|
- "text-align": "center",
|
|
|
|
- "margin": "0 6px",
|
|
|
|
- "margin-bottom": "16px",
|
|
|
|
- "border" : "1px solid #000"
|
|
|
|
- })
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-
|
|
+}
|
|
-
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
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