Commit bc2298c8 authored by tangfh's avatar tangfh

+

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