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.

111 lines
2.4 KiB

2 years ago
<template>
<view class="wrap">
<view class="title">{{ form.title }}</view>
<view class="text">{{ form.applicableMajor }}</view>
<view class="text">{{ form.schemeIntroduction }}</view>
<view class="text">{{ form.product }}</view>
<template v-if="form.fileName">
<view class="file">{{ form.fileName }}</view>
<view class="detail" @click.stop="download">下载</view>
</template>
</view>
</template>
<script>
import { schemeFindById } from '@/apis/modules/article.js'
export default {
data() {
return {
id: '',
form: {
totalBrowsing: ''
}
}
},
onShow() {
const pages = getCurrentPages()
const { options } = pages[pages.length - 1]
this.id = options.id
this.getInfo()
},
methods: {
// 获取详情
getInfo() {
uni.showLoading({
title: '加载中'
})
schemeFindById(this.id).then(({ data }) => {
this.form = data
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
})
},
// 下载方案文件
download() {
this.$util.to(`../send/send?url=${this.form.schemeFile}`)
// uni.showLoading({
// title: '加载中',
// mask: true
// })
// const url = this.form.schemeFile
// const that = this
// // 下载文件资源到本地
// uni.downloadFile({
// url,
// success: function(res) {
// console.log(444, res)
// uni.saveFile({
// tempFilePath: res.tempFilePath,
// success: function(res) {
// console.log(555, res)
// // 新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx。
// that.$util.isDoc(url.substring(url.lastIndexOf('.') +1)) && uni.openDocument({
// filePath: res.savedFilePath,
// showMenu: true, // 允许出现分享功能
// success: res => {
// uni.hideLoading()
// },
// fail: openError => {
// uni.hideLoading()
// }
// })
// }
// })
// },
// fail: function(err) {
// uni.hideLoading()
// }
// })
}
}
}
</script>
<style scoped lang="scss">
.wrap {
padding: 30rpx;
background-color: #fff;
}
.title {
font-size: 34rpx;
font-weight: 600;
color: #333;
}
.text {
margin: 20rpx 0;
font-size: 28rpx;
line-height: 1.6;
}
.file {
margin: 20rpx 0;
font-size: 26rpx;
word-break: break-all;
}
.detail {
font-size: 30rpx;
color: #1f83ff;
}
</style>