Commit 1abecd3c authored by tangfh's avatar tangfh

+

parent e057426b
......@@ -11,7 +11,7 @@
<view class="view-tmp1 active" v-for="(item, index) in tab.data" :index="index" :key="index"
:item="item" @onItemClick="onItemClick"></view>
</view>
<c-empty v-if="items.length == 0" @onEmptyClick="onEmptyClick"></c-empty>
<c-status-view @onStatusClick="onStatusClick" v-if="contentStatus.value"></c-status-view>
<uni-load-more :status="loadMoreViewStatus" :icon-size="16" v-if="items.length > 0"
:content-text="loadMoreViewContentText" />
</scroll-view>
......@@ -36,6 +36,8 @@
loadMoreViewStatus: 'noMore',
page: 1,
total_page: 1,
loadMoreStatus: null,
contentStatus: {},
items: [],
channel: "ongoning",
firstRequest: true
......@@ -100,11 +102,16 @@
};
let option = {
isNeedShowLoading: false
};
util.request(url, param, this.requestCallback, this.requestComplete, option);
};
util.request(url, param, option, {
success: this.requestCallback,
fail: this.requestFail,
complete: this.requestComplete
});
},
requestCallback(res) {
if (res.statusCode != 200) {
if (res.data.code > 0) {
this.contentStatus == this.items.length == 0 ? constant.CONTENT_STATUS.ERROR : null;
return;
}
let data = res.data.data;
......@@ -124,6 +131,10 @@
this.items = this.items.concat(list);
}
}
this.contentStatus = this.items.length == 0 ? constant.CONTENT_STATUS.EMPTY : {};
},
requestFail(res, status) {
this.contentStatus = status;
},
requestComplete() {
if (this.refresherTriggered) {
......
......@@ -178,7 +178,11 @@
let option = {
isNeedShowLoading: false
};
util.request(url, param, this.requestCallback, null, option);
util.request(url, param, option, {
success: this.requestCallback,
fail: this.requestFail,
complete: this.requestComplete
});
},
requestCallback(res) {
var tab = this.tabList[this.tabIndex];
......@@ -205,6 +209,16 @@
})
this.tabList[this.tabIndex].data = this.tabList[this.tabIndex].data.concat(data.list);
},
requestFail(res, status) {
this.contentStatus = status;
},
requestComplete() {
if (this.refresherTriggered) {
this.refresherTriggered = false;
}
this.firstRequest = false;
uni.hideLoading()
},
onLoadMore(e) {
var _this = this;
_this.loadMoreViewShow = true;
......
......@@ -39,6 +39,19 @@ const C_POP_DIRECTIONS = {
bottom: "bottom", //最底部
}
const CONTENT_STATUS = {
EMPTY: {
value: "empty",
icon: "../../static/icon_no_data.webp",
tip: "暂无内容~"
},
ERROE: {
value: "error",
icon: "../../static/com_icon_error.png",
tip: "服务器开小差,请稍后再试~"
}
}
export default {
// KEY
KEY_USER,
......@@ -46,6 +59,7 @@ export default {
KEY_SESSION_ID,
SECRET_KEY,
BASE_URL,
CONTENT_STATUS,
LOAD_STATUS,
LOAD_TEXTS,
LOOP,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment