Commit 248866a1 authored by leon's avatar leon

feat: detail new prev and next

parent f0b54780
<template> <template>
<view class="viewport-wrapper" :style="[styleObject]"> <view class="viewport-wrapper" :style="[styleObject]">
<u-icon class="left-button" name="arrow-left" @click="handleLeftAction()"></u-icon> <view class="float-button" :style="{bottom: bottom + 'px'}" @click="showMenus()" :animation="animation">
<u-icon class="right-button" name="arrow-right" @click="handleRightAction()"></u-icon> <u-icon name="list" size="26" v-if="!isShow"></u-icon>
<u-icon name="plus" size="26" v-else></u-icon>
</view>
<view class="menu" :class="[menuClass(1)]" :style="{bottom: (bottom + 50) + 'px'}">
<u-icon name="arrow-left" size="24" @click="handleLeftAction()"></u-icon>
</view>
<view class="menu" :class="[menuClass(2)]" :style="{bottom: bottom + 'px'}">
<u-icon name="reload" size="24" @click="handleReolad()"></u-icon>
</view>
<view class="menu" :class="[menuClass(3)]" :style="{bottom: (bottom - 50) + 'px'}">
<u-icon name="arrow-right" size="24" @click="handleRightAction()"></u-icon>
</view>
<template v-for="(element, index) in reportInfo.list"> <template v-for="(element, index) in reportInfo.list">
<view <view
class="view-element" class="view-element"
...@@ -68,7 +80,6 @@ ...@@ -68,7 +80,6 @@
></ModelData> ></ModelData>
<MySelect></MySelect> <MySelect></MySelect>
</view> </view>
</template> </template>
...@@ -88,8 +99,10 @@ ...@@ -88,8 +99,10 @@
popupShow: false, popupShow: false,
popupData: [], popupData: [],
customRender: {}, customRender: {},
currentIndex: 0 currentIndex: 0,
animation: '',
isShow: false,
bottom: 100
} }
}, },
computed: { computed: {
...@@ -214,11 +227,15 @@ ...@@ -214,11 +227,15 @@
async getReportCharts() { async getReportCharts() {
clearInterval(this.timename) clearInterval(this.timename)
const that = this const that = this
let res = await that.$u.api.getReportCharts({id: that.detailId})
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
uni.$emit('handlePullDownRefresh') uni.$emit('handlePullDownRefresh')
uni.showLoading({
title: '加载中...'
})
let res = await that.$u.api.getReportCharts({id: that.detailId})
const { Status, Result: { info, list } } = res.data const { Status, Result: { info, list } } = res.data
if (Status === 'true') { if (Status === 'true') {
uni.hideLoading()
if(info.dataUrl) { if(info.dataUrl) {
that.getGlobalData(info, list) that.getGlobalData(info, list)
if(info.dataPollingInterval) { if(info.dataPollingInterval) {
...@@ -241,7 +258,11 @@ ...@@ -241,7 +258,11 @@
} }
that.reportInfo = res.data.Result that.reportInfo = res.data.Result
uni.setStorageSync('reportInfo', JSON.stringify(res.data.Result)) uni.setStorageSync('reportInfo', JSON.stringify(res.data.Result))
uni.setNavigationBarTitle({
title: info.name
})
that.getStickyTables() that.getStickyTables()
} }
}, },
/** /**
...@@ -304,11 +325,11 @@ ...@@ -304,11 +325,11 @@
* 点击向左切换按钮 * 点击向左切换按钮
*/ */
handleLeftAction() { handleLeftAction() {
this.indexs-- this.showMenus()
if (this.indexs<0) { if (this.indexs === 0) {
this.indexs = 0
return return
} }
this.indexs--
this.handlePage() this.handlePage()
}, },
...@@ -316,11 +337,11 @@ ...@@ -316,11 +337,11 @@
* 点击向右切换按钮 * 点击向右切换按钮
*/ */
handleRightAction() { handleRightAction() {
this.indexs++ this.showMenus()
if (this.indexs>this.idList.length-1) { if (this.indexs>=this.idList.length-1) {
this.indexs--
return return
} }
this.indexs++
this.handlePage() this.handlePage()
}, },
...@@ -335,6 +356,33 @@ ...@@ -335,6 +356,33 @@
}) })
}, },
showMenus() {
var animation = uni.createAnimation({
duration: 200,
timingFunction: 'ease',
})
this.isShow = !this.isShow
var rotate = this.isShow ? 135 : 0
animation.rotate(rotate).step()
this.animation = animation.export()
},
menuClass(number) {
let num = this.isShow ? number : 0;
return 'menu' + num;
},
handleReolad () {
this.showMenus()
// 让list数据做下改变,下拉刷新后才能触发页面的渲染,让组件里面的接口调用
this.reportInfo.list = this.reportInfo.list.map(item => {
item.value = "2022"
return item
})
this.getReportCharts()
},
/** /**
* 请求下一页的列表id * 请求下一页的列表id
*/ */
...@@ -361,6 +409,7 @@ ...@@ -361,6 +409,7 @@
} }
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
// 让list数据做下改变,下拉刷新后才能触发页面的渲染,让组件里面的接口调用 // 让list数据做下改变,下拉刷新后才能触发页面的渲染,让组件里面的接口调用
this.reportInfo.list = this.reportInfo.list.map(item => { this.reportInfo.list = this.reportInfo.list.map(item => {
...@@ -418,15 +467,64 @@ ...@@ -418,15 +467,64 @@
.left-button { .left-button {
position: fixed; position: fixed;
bottom: 50%; bottom: 50%;
left: 10px; left: 1px;
z-index: 99; z-index: 99;
} }
.right-button { .right-button {
position: fixed; position: fixed;
bottom: 50%; bottom: 50%;
right: 10px; right: 1px;
z-index: 99;
}
.float-button {
position: fixed;
z-index: 99; z-index: 99;
width: 40px;
height: 40px;
bottom: 15%;
right: 10px;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.7);
justify-content: center;
align-content: center;
display: flex;
border: 1rpx solid #ccc;
}
.menu {
position: fixed;
z-index: 90;
width: 30px;
height: 30px;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.7);
justify-content: center;
align-content: center;
display: flex;
border: 1rpx solid #ccc;
}
.menu0 {
right: 10px;
opacity: 0;
transition: top 0.2s, right 0.2s, opacity 0.2s;
}
.menu1 {
right: 30px;
transition: top 0.2s, right 0.2s, opacity 0.2s;
}
.menu2 {
right: 60px;
transition: top 0.2s, right 0.2s, opacity 0.2s;
}
.menu3 {
right: 30px;
transition: top 0.2s, right 0.2s, opacity 0.2s;
} }
</style> </style>
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