|
@@ -171,20 +171,16 @@
|
|
|
|
|
|
|
|
|
<div v-if="!loading" class="page mt-30 mb-30">
|
|
|
- <div class="d-flex justify-content-center align-items-end cannot_selected"
|
|
|
- style="position:relative">
|
|
|
+ <div class="d-flex justify-content-center align-items-end cannot_selected" style="position:relative">
|
|
|
<div class="page-des align-items-start cannot_selected">共<span> {{
|
|
|
totalPageNum}}</span>页,共<span> {{ totalPageSzie}}</span>条信息</div>
|
|
|
|
|
|
<a :class="[hasPageTop ? '' : 'disable']" class="previous" @click="toPrevious">上一页</a>
|
|
|
- <a v-if="needOmit" :class="[currentPageNum == 1 ? 'active' : '']"
|
|
|
- @click="switchPage(1)">1</a>
|
|
|
+ <a v-if="needOmit" :class="[currentPageNum == 1 ? 'active' : '']" @click="switchPage(1)">1</a>
|
|
|
<span v-if="hasLeftOmit">...</span>
|
|
|
- <a v-for="item in middlePageNums" :key="item"
|
|
|
- :class="[item == currentPageNum ? 'active': '']" @click="switchPage(item)">{{item}}</a>
|
|
|
+ <a v-for="item in middlePageNums" :key="item" :class="[item == currentPageNum ? 'active': '']" @click="switchPage(item)">{{item}}</a>
|
|
|
<span v-if="hasRightOmit">...</span>
|
|
|
- <a v-if="needOmit" :class="[currentPageNum == totalPageNum? 'active' : '']"
|
|
|
- @click="switchPage(totalPageNum)">{{totalPageNum}}</a>
|
|
|
+ <a v-if="needOmit" :class="[currentPageNum == totalPageNum? 'active' : '']" @click="switchPage(totalPageNum)">{{totalPageNum}}</a>
|
|
|
<a :class="[hasPageNext ? '' : 'disable']" @click="toNext" class="next">下一页</a>
|
|
|
|
|
|
<div class="page-des2 align-items-end cannot_selected pc">前往第
|
|
@@ -217,11 +213,11 @@
|
|
|
<!--====== Vue js======-->
|
|
|
<script src="../assets/js/vue.min.js"></script>
|
|
|
<script>
|
|
|
- $(function () {
|
|
|
+ $(function() {
|
|
|
$('#footer').load("../footer.html");
|
|
|
})
|
|
|
var news_list = [];
|
|
|
- var one_page_num = 12;
|
|
|
+ var one_page_num = 6;
|
|
|
var app = new Vue({
|
|
|
el: '#app',
|
|
|
data: {
|
|
@@ -236,23 +232,23 @@
|
|
|
goPage: 1,
|
|
|
},
|
|
|
computed: {
|
|
|
- hasNews: function () {
|
|
|
+ hasNews: function() {
|
|
|
return this.news.length > 0;
|
|
|
},
|
|
|
- hasLeftOmit: function () {
|
|
|
+ hasLeftOmit: function() {
|
|
|
return (this.currentPageNum >= 4 && this.needOmit);
|
|
|
},
|
|
|
- hasRightOmit: function () {
|
|
|
+ hasRightOmit: function() {
|
|
|
return ((this.middlePageNums[4] + 1) < this.totalPageNum && this.needOmit);
|
|
|
},
|
|
|
- hasPageTop: function () {
|
|
|
+ hasPageTop: function() {
|
|
|
return this.currentPageNum > 1;
|
|
|
},
|
|
|
- hasPageNext: function () {
|
|
|
+ hasPageNext: function() {
|
|
|
return this.currentPageNum < this.totalPageNum;
|
|
|
}
|
|
|
},
|
|
|
- mounted: function () {
|
|
|
+ mounted: function() {
|
|
|
var self = this;
|
|
|
jQuery.ajax({
|
|
|
type: 'POST',
|
|
@@ -261,12 +257,12 @@
|
|
|
data: {
|
|
|
type: '1'
|
|
|
}
|
|
|
- }).done(function (res) {
|
|
|
+ }).done(function(res) {
|
|
|
if (!res.msg) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- res.data.forEach(function (item) {
|
|
|
+ res.data.forEach(function(item) {
|
|
|
news_list.push(item);
|
|
|
if (self.news.length < one_page_num) {
|
|
|
self.news.push(item);
|
|
@@ -283,13 +279,13 @@
|
|
|
}
|
|
|
}
|
|
|
self.loading = false;
|
|
|
- }).fail(function (err) { });
|
|
|
+ }).fail(function(err) {});
|
|
|
},
|
|
|
methods: {
|
|
|
- oneInnerBox:function(id){
|
|
|
- window.location="./read.html?id="+id
|
|
|
+ oneInnerBox: function(id) {
|
|
|
+ window.location = "./read.html?id=" + id
|
|
|
},
|
|
|
- switchPage: function (page_num) {
|
|
|
+ switchPage: function(page_num) {
|
|
|
if (page_num == this.currentPageNum) {
|
|
|
return;
|
|
|
}
|
|
@@ -319,20 +315,20 @@
|
|
|
|
|
|
this.currentPageNum = page_num;
|
|
|
},
|
|
|
- toPrevious: function () {
|
|
|
+ toPrevious: function() {
|
|
|
if (this.currentPageNum == 1) {
|
|
|
return;
|
|
|
}
|
|
|
this.switchPage(this.currentPageNum - 1);
|
|
|
},
|
|
|
|
|
|
- toNext: function () {
|
|
|
+ toNext: function() {
|
|
|
if (this.currentPageNum == this.totalPageNum) {
|
|
|
return;
|
|
|
}
|
|
|
this.switchPage(this.currentPageNum + 1);
|
|
|
},
|
|
|
- enterPage: function () {
|
|
|
+ enterPage: function() {
|
|
|
if (this.goPage <= this.totalPageNum) {
|
|
|
// this.currentPageNum = this.goPage
|
|
|
// alert(this.currentPageNum)
|
|
@@ -344,7 +340,7 @@
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- currentPageNum: function (val) {
|
|
|
+ currentPageNum: function(val) {
|
|
|
this.goPage = val
|
|
|
}
|
|
|
}
|