<template>
|
<view>
|
<view class="custom-navbar">
|
<view class="navbar-content">
|
<view class="nav-left" @click="handleBack">
|
<view class="back-btn">
|
<text class="back-text">返回</text>
|
</view>
|
</view>
|
<text class="navbar-title">项目审批</text>
|
<view class="nav-right"></view>
|
</view>
|
</view>
|
<view class="page-content" :style="{ paddingTop: navbarHeight + 'px'}">
|
<view class="card-t">
|
<span class="card-t-l">项目审批</span>
|
<div>
|
<u-tabs :list="examSelect" :current="currentTab" @click="changeState"></u-tabs>
|
</div>
|
</view>
|
<view>
|
<view class="cardList" v-if="projectList && projectList.length>0">
|
<scroll-view scroll-y="true" class="scroll-Y" @scrolltoupper="upper" @scrolltolower="lower"
|
lower-threshold="150" @scroll="scrollView" style="height:100%">
|
<view style="padding: 0 0 20px">
|
<view class="card-i" v-for="(item,index) in projectList" :key="index">
|
<view class="card-line">
|
<view class="card-tit">项目名称</view>
|
<view class="card-cont">{{item.fileName}}</view>
|
</view>
|
<view class="card-line">
|
<view class="card-tit">项目阶段</view>
|
<view class="card-cont">{{item.stage}}</view>
|
</view>
|
<view class="card-line">
|
<u-button text="项目文档" type="primary" @click="viewProject(item)"></u-button>
|
<u-button text="电子签名" type="primary" @click="toSign(item)"></u-button>
|
</view>
|
</view>
|
</view>
|
</scroll-view>
|
</view>
|
<u-empty v-else text="暂无记录" mode="data"></u-empty>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
getProjectList
|
} from '../../api/review.js'
|
import VUE_APP_BASE_URL from "../../common/constant";
|
export default {
|
components: {},
|
data() {
|
return {
|
navbarHeight: 0,
|
currentTab: 0,
|
examSelect: [{
|
name: "待审批"
|
}],
|
projectList: []
|
}
|
|
},
|
onLoad() {
|
//获取手机状态栏高度
|
this.getNavbarHeight()
|
this.getList()
|
},
|
onShow() {
|
|
},
|
created() {},
|
methods: {
|
getNavbarHeight() {
|
const systemInfo = uni.getSystemInfoSync()
|
const statusBarHeight = systemInfo.statusBarHeight
|
const navbarHeight = 44
|
this.navbarHeight = statusBarHeight + navbarHeight
|
},
|
|
handleBack() {
|
uni.navigateTo({
|
url: '/pages/menuPage/index'
|
})
|
},
|
changeState(e) {
|
this.currentTab = e.index
|
},
|
viewProject(item) {
|
wx.showLoading({
|
title: '文件获取中...',
|
mask: true
|
})
|
wx.downloadFile({
|
url: VUE_APP_BASE_URL + '/' + item.filePath,
|
success: function(res) {
|
if (res.statusCode !== 200 || !res.tempFilePath) {
|
wx.hideLoading()
|
uni.showToast({
|
icon: 'none',
|
title: '文件下载失败',
|
duration: 2000
|
})
|
return
|
}
|
var filePath = res.tempFilePath
|
wx.openDocument({
|
filePath: filePath,
|
showMenu: true,
|
success: function(res) {
|
wx.hideLoading()
|
},
|
fail: function(res) {
|
uni.showToast({
|
icon: 'none',
|
duration: 2000,
|
position: 'top',
|
title: `打开文件失败: ${res.errMsg || '未知错误'}`
|
});
|
wx.hideLoading()
|
}
|
})
|
},
|
fail: function(res) {
|
uni.showToast({
|
icon: 'none',
|
duration: 2000,
|
position: 'top',
|
title: `下载失败: ${res.errMsg || '网络错误'}`
|
});
|
wx.hideLoading()
|
}
|
})
|
},
|
toSign(item) {
|
uni.navigateTo({
|
url: `/pages/review/signPage?id=` + encodeURIComponent(JSON.stringify(item.id))
|
})
|
},
|
async getList() {
|
const res = await getProjectList(uni.getStorageSync('uid'))
|
if (res.code == 200) {
|
this.projectList = res.data || []
|
} else {
|
uni.$u.toast(res.message)
|
}
|
},
|
upper(e) {
|
// console.log(e)
|
},
|
lower(e) {
|
//并且让页码+1,调用获取数据的方法获取第二页数据
|
this.classParams.pageNum++
|
if (this.classParams.pageNum > this.totalPage) {
|
uni.$u.toast('已加载全部数据')
|
return
|
}
|
//此处调用自己获取数据列表的方法
|
this.getClass()
|
},
|
scrollView(e) {
|
// console.log(e)
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.custom-navbar {
|
position: fixed;
|
top: 0;
|
left: 0;
|
right: 0;
|
z-index: 999;
|
background: #ffffff;
|
|
.navbar-content {
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
height: 44px;
|
padding-top: var(--status-bar-height);
|
}
|
|
.nav-left {
|
flex-shrink: 0;
|
width: 80px;
|
padding-left: 15px;
|
box-sizing: border-box;
|
}
|
|
.back-btn {
|
display: flex;
|
align-items: center;
|
padding: 8px 12px 8px 0;
|
}
|
|
.back-text {
|
font-size: 16px;
|
color: #333;
|
}
|
|
.navbar-title {
|
flex: 1;
|
font-size: 16px;
|
text-align: center;
|
font-weight: bold;
|
color: #333;
|
}
|
|
.nav-right {
|
flex-shrink: 0;
|
width: 80px;
|
}
|
|
|
}
|
|
.page-content {
|
min-height: calc(100vh - 44px);
|
box-sizing: border-box;
|
padding: 0 15px;
|
|
.card-t {
|
width: 100%;
|
padding: 0 6rpx;
|
box-sizing: border-box;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-bottom: 20rpx;
|
|
.card-t-l {
|
font-size: 36rpx;
|
font-weight: bold;
|
}
|
|
.card-t-r {
|
color: #999;
|
cursor: pointer;
|
font-size: 28rpx;
|
}
|
|
.uni-stat__select {
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
padding: 2rpx 20rpx;
|
border: 1rpx solid #ccc;
|
border-radius: 99rpx;
|
background: #fff;
|
cursor: pointer;
|
|
|
text {
|
color: #999;
|
font-size: 28rpx;
|
margin-right: 6rpx;
|
}
|
}
|
}
|
|
.cardList {
|
width: 100%;
|
height: calc(100vh - 130px);
|
box-sizing: border-box;
|
|
.card-i {
|
width: 100%;
|
background: #fff;
|
border-radius: 20rpx;
|
padding: 15px;
|
margin-bottom: 15px;
|
box-sizing: border-box;
|
box-shadow: 4px 4px 12px rgba(150, 150, 150, .05);
|
|
.card-line {
|
margin-bottom: 15px;
|
display: flex;
|
align-items: flex-start;
|
|
&:last-of-type {
|
margin-bottom: 0;
|
}
|
|
.card-tit {
|
flex-shrink: 0;
|
width: 140rpx;
|
}
|
|
.u-button {
|
margin-right: 30px;
|
|
&:last-of-type {
|
margin-right: 0;
|
}
|
}
|
}
|
}
|
}
|
}
|
</style>
|