|
@@ -4,25 +4,74 @@ var helpSuggestion = new Vue({
|
|
|
data: {
|
|
|
btnLoading: false,
|
|
|
isRequset:true,
|
|
|
- userId: '',
|
|
|
+ listQuery:{
|
|
|
+ userId: '',
|
|
|
+ pageNum:1,
|
|
|
+ pageSize:10,
|
|
|
+ },
|
|
|
+ noMore:false,
|
|
|
+ listRecord: 0,
|
|
|
+ pageInput: '1',
|
|
|
degree:'',
|
|
|
isCheckedAll:false,
|
|
|
messagesList:[],//消息列表
|
|
|
check:false,
|
|
|
checklist:[],
|
|
|
msgId:'',
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ pageTotal: function () {
|
|
|
+ var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
|
|
|
+ return total > 0 ? total : 1;
|
|
|
+ },
|
|
|
+ showPageBtn: function () {
|
|
|
+ var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
|
|
|
+ total = total > 0 ? total : 1;
|
|
|
+ var index = this.listQuery.pageNum, arr = [];
|
|
|
+ if (total <= 6) {
|
|
|
+ for (var i = 1; i <= total; i++) {
|
|
|
+ arr.push(i);
|
|
|
+ }
|
|
|
+ return arr;
|
|
|
+ }
|
|
|
+ if (index <= 3) return [1, 2, 3, 4, 5, 0, total];
|
|
|
+ if (index >= total - 2) return [1, 0, total - 4, total - 3, total - 2, total - 1, total];
|
|
|
+ return [1, 0, index - 2, index - 1, index, index + 1, index + 2, 0, total];
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
+ toPagination: function (pageNum) {//点击切换分页
|
|
|
+ if (pageNum <= this.pageTotal) {
|
|
|
+ this.listQuery.pageNum = pageNum;
|
|
|
+ this. GetMyPcMymessageInfo();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ checkNum: function () {//输入跳转分页
|
|
|
+ if (this.pageInput > this.pageTotal) {
|
|
|
+ this.pageInput = this.pageTotal;
|
|
|
+ } else if (this.pageInput < 1) {
|
|
|
+ this.pageInput = 1;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
GetMyPcMymessageInfo:function(){
|
|
|
var _self = this;
|
|
|
- UserApi.GetMymessageList({userId:_self.userId},function (response) {
|
|
|
+ UserApi.GetMymessageList(_self.listQuery,function (response) {
|
|
|
if(response.code == 0){
|
|
|
- var data = response.data;
|
|
|
- _self.messagesList = response.data;
|
|
|
+ if (response.data.results.length>0){
|
|
|
+ var data = response.data;
|
|
|
+ _self.messagesList = data.results;
|
|
|
+ _self.listRecord = data.totalRecord;
|
|
|
+ _self.requestFlag = true;
|
|
|
+ }else {
|
|
|
+ _self.requestFlag = false;
|
|
|
+ _self.listRecord = data.totalRecord;
|
|
|
+ }
|
|
|
|
|
|
- _self.isRequset = false;
|
|
|
+ _self.isRequset = false;
|
|
|
}else{
|
|
|
CAIMEI.Alert(response.msg, '确定', false);
|
|
|
+ _self.requestFlag = false;
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -69,7 +118,8 @@ var helpSuggestion = new Vue({
|
|
|
}else {
|
|
|
PublicApi.deleteMessage({messageIds:_this.msgId},function (res) {
|
|
|
if (res.code==0){
|
|
|
- CAIMEI.dialog('刪除成功')
|
|
|
+ CAIMEI.dialog('刪除成功');
|
|
|
+ location.reload()
|
|
|
}else {
|
|
|
CAIMEI.Alert(res.msg, '确定', false);
|
|
|
}
|
|
@@ -87,7 +137,8 @@ var helpSuggestion = new Vue({
|
|
|
}else {
|
|
|
PublicApi.markAsRead({messageIds:_this.msgId},function (res) {
|
|
|
if(res.code==0){
|
|
|
- CAIMEI.dialog('已读成功')
|
|
|
+ CAIMEI.dialog('已读成功');
|
|
|
+ location.reload()
|
|
|
}else {
|
|
|
CAIMEI.Alert(res.msg, '确定', false);
|
|
|
}
|
|
@@ -106,9 +157,36 @@ var helpSuggestion = new Vue({
|
|
|
|
|
|
},
|
|
|
mounted: function () {
|
|
|
+ var _self=this;
|
|
|
if(globalUserData){
|
|
|
- this.userId = globalUserData.userId;
|
|
|
+ this.listQuery.userId = globalUserData.userId;
|
|
|
this.GetMyPcMymessageInfo();
|
|
|
}
|
|
|
+ if(!isPC){
|
|
|
+ $('footer').addClass("noneImportant");
|
|
|
+ //移动端上垃加载更多
|
|
|
+ $(window).on('scroll', function(){
|
|
|
+ var scrollTop = $(this).scrollTop();
|
|
|
+ var scrollHeight = $(document).height();
|
|
|
+ var windowHeight = window.innerHeight;
|
|
|
+ if (scrollTop + windowHeight >= scrollHeight) {
|
|
|
+ //此处是滚动条到底部时候触发的事件,在这里写要加载的数据,或者是拉动滚动条的操作
|
|
|
+ var totalPage = Math.ceil(_self.listRecord / _self.listQuery.pageSize)?Math.ceil(_self.listRecord / _self.listQuery.pageSize):1;
|
|
|
+ var next = _self.listQuery.pageNum+1;
|
|
|
+ if(next <= totalPage){
|
|
|
+ if (_self.requestFlag){
|
|
|
+ _self.listQuery.pageNum = next;
|
|
|
+ // 获取列表数据
|
|
|
+ _self.GetMyPcMymessageInfo();
|
|
|
+ }
|
|
|
+ _self.requestFlag = false;
|
|
|
+ }else{
|
|
|
+ //到底了
|
|
|
+ _self.noMore = true;
|
|
|
+ $('footer').removeClass("noneImportant");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|