You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

194 lines
3.6 KiB

<template>
<view class="pages">
<view class="top">
<text class="top-name">{{params.name}}</text>
<text class="top-date">{{params.orderDate}}</text>
</view>
<view class="content">
<view v-show="list.length==0">
<view style="display:flex;flex-direction: column;justify-content: center;align-items: center;">
<image src="../../static/baseIcon/notData.png" mode="aspectFill"
style="width: 150px;height: 150px;">
</image>
<text style="text-align: center;width: 100%; color: #717171;">暂无数据</text>
</view>
</view>
<view v-for="(item,index) in list" class="list">
<view style="display: flex;flex-direction: row;justify-content: space-between;margin-top: 20px;">
<text class="item-text">{{item.fileSrcName}}</text>
<text class="item-text" @click="downloadClick(item.fullUrl)">点击下载</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
params: {
projectSid: "",
name: "",
orderDate: "",
},
list: [
// {
// sid: "1",
// name: "质物库存汇总表",
// url: "111111111111111",
// },
// {
// sid: "2",
// name: "销售日报表",
// url: "222222222222",
// },
// {
// sid: "3",
// name: "在途商品表",
// url: "3333333333",
// }
]
}
},
onLoad(option) {
console.log('option', option)
this.params = {
projectSid: option.sid,
name: option.name,
orderDate: option.date
}
this.getServerData()
},
methods: {
getServerData() {
this.$api.getProjectDailyFiles(this.params).then((resp) => {
console.log('1111>>>>>>', resp)
this.list =resp
}).catch(e => {
console.log('eeeee', e)
})
},
downloadClick(url) {
if (url == '') {
uni.showToast({
icon: "none",
title: "下载地址错误,请重新进入页面。",
duration: 5000
})
return
}
uni.downloadFile({
url: url, // 网络文档地址
success: (data) => {
if (data.statusCode === 200) {
uni.saveFile({
tempFilePath: data.tempFilePath, //临时路径
success: function(res) {
// 保存路径
uni.showToast({
title: "文件已保存:" + res.savedFilePath,
duration: 5000
})
setTimeout(() => {
//打开文档查看
uni.openDocument({
filePath: res.savedFilePath,
showMenu: true, //右上角是否有可以转发分享的功能
success: function(res) {
console.log('打开文档成功')
}
})
}, 3000);
}
});
}
},
fail: (err) => {
uni.showToast({
title: '失败请重新下载'
});
},
});
},
}
}
</script>
<style lang="scss">
.pages {
display: flex;
flex-direction: column;
background-color: #fff;
width: 100%;
height: 100%;
.top {
padding: 20px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
.top-name {
font-size: 16px;
color: #000;
font-weight: 600;
font-family: sans-serif;
}
.top-date {
font-size: 13px;
color: #717171;
}
}
.content {
display: flex;
width: 100%;
flex-direction: column;
border-top: 2px solid #eee;
.list {
display: flex;
margin-left: 30px;
margin-right: 30px;
flex-direction: column;
.item-text {
font-size: 14px;
color: #018AD2;
border-bottom: 1px solid #018AD2;
}
}
}
}
</style>