Commit bc2298c8 authored by tangfh's avatar tangfh

+

parent 94d9442d
......@@ -2,20 +2,27 @@
<view class="content">
<!-- [uni-nav-bar 自定义导航栏](https://uniapp.dcloud.net.cn/component/uniui/uni-nav-bar.html) -->
<uni-nav-bar ref="navBar" class="uni-navi-bar" status-bar="true" :border="false" color="#333333" fixed="true"
left-icon="left" left-text="返回" :title="title" @clickLeft="onNavBarLeftClick">
left-icon="left" left-text="返回"
:title="option.navBar.title"
:titleRightIcon="option.navBar.center.right.icon"
:titleRightIcon2="option.navBar.center.right2.icon"
@clickLeft="onNavBarLeftClick"
@onClickTitleRightIcon="onClickTitleRightIcon"
@onClickTitleRightIcon2="onClickTitleRightIcon2">
</uni-nav-bar>
<scroll-view class="scroll-view" scroll-y="true" enable-back-to-top="true" :refresher-enabled="refresherEnabled"
@refresherrefresh="onRefresh" @scrolltolower="onLoadMore" :refresher-triggered="refresherTriggered"
:style="{'height':(scrollViewHeight+'px')}">
<view class="flex-column" v-if="items.length > 0" :style="{'min-height': (scrollViewHeight + 'px')}">
<view class="view-tmp1 active" v-for="(item, index) in items" :index="index" :key="index"
:item="item" @onItemClick="onItemClick"></view>
</view>
<c-status-view @onStatusClick="onStatusClick" v-if="contentStatus.value"></c-status-view>
<uni-load-more :status="loadMoreStatus" :icon-size="16" v-if="items.length > 0"
:content-text="loadMoreViewContentText" />
</scroll-view>
<text class="text-bottom-btn" @click="onBottomBtnClick">底部按钮</text>
<view class="com-view-bottom" :style="{paddingBottom: bottomBtnPaddingBottom}">
<text class="text-bottom-btn" @click="onBottomBtnClick">底部按钮</text>
</view>
</view>
</template>
......@@ -25,7 +32,19 @@
export default {
data() {
return {
title: '标题',
option: {
navBar: {
title: '添加店员',
center: {
right: {
icon: "/static/btn_bar_screen.png"
},
right2: {
icon: "/static/btn_problem.png"
}
}
}
},
navBarHeight: 0,
scrollViewHeight: 1000,
refresherEnabled: true,
......@@ -40,53 +59,65 @@
contentStatus: {},
items: [],
channel: "ongoning",
firstRequest: true
firstRequest: true,
bottomBtnPaddingBottom: "",
}
},
onLoad(option) {
var systemInfo = uni.getSystemInfoSync();
//scroll-view的高度 = 屏幕高度 -(顶部状态栏高度 + 导航栏高度) -(底部tabBar高度 + 底部安全区域高度)
this.scrollViewHeight = systemInfo.screenHeight - (uni.getSystemInfoSync()
.statusBarHeight + this.$refs.navBar.height) - (systemInfo.safeAreaInsets.bottom) -
.statusBarHeight + this.$refs.navBar.height) -
(systemInfo.safeAreaInsets.bottom) -
84 / getApp().globalData.pxToRpxScale;
this.bottomBtnPaddingBottom = systemInfo.safeAreaInsets.bottom + "px"
this.init(option);
},
onShow() {
if(!this.firstRequest) {
if (!this.firstRequest) {
//this.request()
}
},
methods: {
init(option) {
let _this = this;
setTimeout(() => {
_this.refresherTriggered = true;
}, 35)
this.refresh();
},
onNavBarLeftClick() {
uni.navigateBack();
},
refreshInit() {
this.page = 1;
this.total_page = 1;
this.loadMoreStatus = constant.LOAD_STATUS.noMore;
onClickTitleRightIcon() {
console.log("click...");
},
onClickTitleRightIcon2() {
console.log("click...");
},
onEmptyClick() {
this.onRefresh();
},
onBottomBtnClick() {
uni.navigateTo({
url: "/pages/repair-apply/repair-apply"
url: ""
})
},
onItemClick(item) {
uni.navigateTo({
url: "/pages/repair-detail/repair-detail"
url: ""
})
},
onStatusClick() {
this.refresh();
},
refresh() {
let _this = this;
setTimeout(() => {
_this.refresherTriggered = true;
}, 35);
},
onRefresh(e) {
this.refresherTriggered = true;
this.refreshInit();
this.page = 1;
this.total_page = 1;
this.loadMoreStatus = constant.LOAD_STATUS.noMore;
this.request();
},
onLoadMore(e) {
......@@ -100,7 +131,12 @@
request() {
this.page = this.page > this.total_page ? this.total_page : this.page;
let url = "";
if(!url) {
if (!url) {
let _this = this;
setTimeout(() => {
_this.refresherTriggered = false;
_this.contentStatus = constant.CONTENT_STATUS.EMPTY;
}, 300);
return;
}
let param = {
......@@ -109,9 +145,9 @@
};
let option = {
isNeedShowLoading: false
};
};
util.request(url, param, option, {
success: this.requestSuccess,
success: this.requestSuccess,
fail: this.requestFail,
complete: this.requestComplete
});
......@@ -124,7 +160,7 @@
let data = res.data.data;
let list = data.list;
try {
this.total_page = util.calTotalPage(data.total_list);
this.total_page = util.calTotalPage(data.total_list);
} catch (e) {
this.total_page = 1;
console.log(e);
......@@ -136,9 +172,10 @@
if (list.length > 0) {
this.items = this.items.concat(list);
}
this.loadMoreStatus = this.page == this.total_page ? constant.LOAD_STATUS.noMore : constant.LOAD_STATUS.more;
this.loadMoreStatus = this.page == this.total_page ? constant.LOAD_STATUS.noMore : constant.LOAD_STATUS
.more;
}
this.contentStatus = this.items.length == 0 ? constant.CONTENT_STATUS.EMPTY : {};
this.contentStatus = this.items.length == 0 ? constant.CONTENT_STATUS.EMPTY : {};
},
requestFail(res, status) {
this.contentStatus = status;
......
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