Commit 1abecd3c authored by tangfh's avatar tangfh

+

parent e057426b
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<view class="view-tmp1 active" v-for="(item, index) in tab.data" :index="index" :key="index" <view class="view-tmp1 active" v-for="(item, index) in tab.data" :index="index" :key="index"
:item="item" @onItemClick="onItemClick"></view> :item="item" @onItemClick="onItemClick"></view>
</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" <uni-load-more :status="loadMoreViewStatus" :icon-size="16" v-if="items.length > 0"
:content-text="loadMoreViewContentText" /> :content-text="loadMoreViewContentText" />
</scroll-view> </scroll-view>
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
loadMoreViewStatus: 'noMore', loadMoreViewStatus: 'noMore',
page: 1, page: 1,
total_page: 1, total_page: 1,
loadMoreStatus: null,
contentStatus: {},
items: [], items: [],
channel: "ongoning", channel: "ongoning",
firstRequest: true firstRequest: true
...@@ -100,11 +102,16 @@ ...@@ -100,11 +102,16 @@
}; };
let option = { let option = {
isNeedShowLoading: false 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) { requestCallback(res) {
if (res.statusCode != 200) { if (res.data.code > 0) {
this.contentStatus == this.items.length == 0 ? constant.CONTENT_STATUS.ERROR : null;
return; return;
} }
let data = res.data.data; let data = res.data.data;
...@@ -124,6 +131,10 @@ ...@@ -124,6 +131,10 @@
this.items = this.items.concat(list); this.items = this.items.concat(list);
} }
} }
this.contentStatus = this.items.length == 0 ? constant.CONTENT_STATUS.EMPTY : {};
},
requestFail(res, status) {
this.contentStatus = status;
}, },
requestComplete() { requestComplete() {
if (this.refresherTriggered) { if (this.refresherTriggered) {
......
...@@ -178,7 +178,11 @@ ...@@ -178,7 +178,11 @@
let option = { let option = {
isNeedShowLoading: false 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) { requestCallback(res) {
var tab = this.tabList[this.tabIndex]; var tab = this.tabList[this.tabIndex];
...@@ -205,6 +209,16 @@ ...@@ -205,6 +209,16 @@
}) })
this.tabList[this.tabIndex].data = this.tabList[this.tabIndex].data.concat(data.list); 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) { onLoadMore(e) {
var _this = this; var _this = this;
_this.loadMoreViewShow = true; _this.loadMoreViewShow = true;
......
...@@ -39,6 +39,19 @@ const C_POP_DIRECTIONS = { ...@@ -39,6 +39,19 @@ const C_POP_DIRECTIONS = {
bottom: "bottom", //最底部 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 { export default {
// KEY // KEY
KEY_USER, KEY_USER,
...@@ -46,6 +59,7 @@ export default { ...@@ -46,6 +59,7 @@ export default {
KEY_SESSION_ID, KEY_SESSION_ID,
SECRET_KEY, SECRET_KEY,
BASE_URL, BASE_URL,
CONTENT_STATUS,
LOAD_STATUS, LOAD_STATUS,
LOAD_TEXTS, LOAD_TEXTS,
LOOP, 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