补正项目列表完成
This commit is contained in:
parent
99579749ff
commit
0ede7d9b9d
@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="body-container">
|
<view class="page-container">
|
||||||
<view class="hint">温馨提示:如需编辑或分享文字,您可选中文字,一键复制至微信或文档内进行操作。</view>
|
<view class="hint">温馨提示:如需编辑或分享文字,您可选中文字,一键复制至微信或文档内进行操作。</view>
|
||||||
<view class="content">
|
<view class="content" v-if="txtParagraphs != null && txtParagraphs.length>0">
|
||||||
<view wx:for="{{txtParagraphs}}" wx:key="index">
|
<view v-for="(item,index) in txtParagraphs" :key="index">
|
||||||
<text selectable="true">{{item}}</text>
|
<text selectable="true">{{item}}</text>
|
||||||
<view style="height: 10px;"></view> <!-- 段落间隔 -->
|
<view style="height: 10px;"></view> <!-- 段落间隔 -->
|
||||||
</view>
|
</view>
|
||||||
@ -18,9 +18,18 @@
|
|||||||
txtParagraphs: []
|
txtParagraphs: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad(options) {
|
||||||
this.setData({
|
this.fileUrl = options.filePath
|
||||||
fileUrl: options.filePath
|
uni.setNavigationBarTitle({
|
||||||
|
title: '文档'
|
||||||
|
})
|
||||||
|
uni.setNavigationBarColor({
|
||||||
|
frontColor: '#000000', // 必写项,字体颜色仅支持#ffffff和#000000
|
||||||
|
backgroundColor: '#F0F0F0', // 传递的颜色值,仅支持十六进制颜色
|
||||||
|
animation: { // 可选项
|
||||||
|
duration: 500,
|
||||||
|
timingFunc: 'easeIn'
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.readTxt()
|
this.readTxt()
|
||||||
},
|
},
|
||||||
@ -29,16 +38,15 @@
|
|||||||
const _self = this
|
const _self = this
|
||||||
const fs = uni.getFileSystemManager();
|
const fs = uni.getFileSystemManager();
|
||||||
fs.readFile({
|
fs.readFile({
|
||||||
filePath: _self.data.fileUrl,
|
filePath: _self.fileUrl,
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
success: (readRes) => {
|
success: (readRes) => {
|
||||||
const fileContent = readRes.data;
|
const fileContent = readRes.data;
|
||||||
// 简单示例:按空行拆分段落
|
// 简单示例:按空行拆分段落
|
||||||
const paragraphs = fileContent.split('\n\n').map((p) => p.trim()).filter((p) => p);
|
const paragraphs = fileContent.split('\n\n').map((p) => p.trim()).filter((p) => p);
|
||||||
// 将处理后的段落数据设置到页面数据中
|
// 将处理后的段落数据设置到页面数据中
|
||||||
this.setData({
|
_self.txtParagraphs = paragraphs
|
||||||
txtParagraphs: paragraphs
|
console.log(_self.txtParagraphs)
|
||||||
});
|
|
||||||
},
|
},
|
||||||
fail: (readErr) => {
|
fail: (readErr) => {
|
||||||
console.error('读取txt文件内容失败:', readErr);
|
console.error('读取txt文件内容失败:', readErr);
|
||||||
@ -49,6 +57,22 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style lang="scss">
|
||||||
|
/* pages/readTxt/readTxt.wxss */
|
||||||
|
page {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: center;
|
||||||
|
color: rgb(248, 185, 50);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #dfdddd;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -135,6 +135,55 @@
|
|||||||
<view class="close-btn" @click="closeDialog">关闭</view>
|
<view class="close-btn" @click="closeDialog">关闭</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
|
<!-- 下载弹窗 -->
|
||||||
|
<uni-popup ref="downloadDialog" type="bottom" background-color="#fff" border-radius="15rpx 15rpx 0rpx 0rpx">
|
||||||
|
<view class="bottom-dialog-container">
|
||||||
|
<view class="dialog-title-box">
|
||||||
|
<view class="icon-close size-48" @click="closeDialog"></view>
|
||||||
|
<view class="dialog-title-txt has-icon">资料下载</view>
|
||||||
|
</view>
|
||||||
|
<view class="download-box" v-if="tempDownloadPro != null">
|
||||||
|
<view class="download-item"
|
||||||
|
v-if="tempDownloadPro.correctionType=='MANUAL' || tempDownloadPro.correctionType=='ALL'">
|
||||||
|
<view class="download-title">
|
||||||
|
<view class="icon-source"></view>
|
||||||
|
<view class="download-title-txt">操作手册</view>
|
||||||
|
</view>
|
||||||
|
<view class="download-btn-box">
|
||||||
|
<view class="download-btn" @click="doDownloadDatum"
|
||||||
|
data-path="/route/proj/download/manual/">
|
||||||
|
<view class="ic-doc size-48"></view>
|
||||||
|
<view class="download-btn-txt">Word格式下载</view>
|
||||||
|
</view>
|
||||||
|
<view class="download-btn" @click="doDownloadDatum"
|
||||||
|
data-path="/route/proj/download/manual/pdf/">
|
||||||
|
<view class="ic-pdf size-48"></view>
|
||||||
|
<view class="download-btn-txt">PDF格式下载</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="download-item"
|
||||||
|
v-if="tempDownloadPro.correctionType=='CODE' || tempDownloadPro.correctionType=='ALL'">
|
||||||
|
<view class="download-title">
|
||||||
|
<view class="icon-tool"></view>
|
||||||
|
<view class="download-title-txt">源代码</view>
|
||||||
|
</view>
|
||||||
|
<view class="download-btn-box">
|
||||||
|
<view class="download-btn" @click="doDownloadDatum" data-path="/route/proj/download/code/">
|
||||||
|
<view class="ic-doc size-48"></view>
|
||||||
|
<view class="download-btn-txt">Word格式下载</view>
|
||||||
|
</view>
|
||||||
|
<view class="download-btn" @click="doDownloadDatum"
|
||||||
|
data-path="/route/proj/download/code/pdf/">
|
||||||
|
<view class="ic-pdf size-48"></view>
|
||||||
|
<view class="download-btn-txt">PDF格式下载</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="hint mt-10">温馨提示:若您想把下载的文件留存到本地,打开预览页面后,在界面右上角操作栏内,选择使用其他软件打开或者保存文件功能就能实现。</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
<uni-popup type="message" ref="msg">
|
<uni-popup type="message" ref="msg">
|
||||||
<uni-popup-message :type="msgType" :message="msgHint" :duration="2000"></uni-popup-message>
|
<uni-popup-message :type="msgType" :message="msgHint" :duration="2000"></uni-popup-message>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
@ -161,7 +210,8 @@
|
|||||||
repairKind
|
repairKind
|
||||||
} from '@/common/js/conver.js'
|
} from '@/common/js/conver.js'
|
||||||
import {
|
import {
|
||||||
previewUrl
|
previewUrl,
|
||||||
|
copyrightUrl
|
||||||
} from '@/common/js/net/mainUrl';
|
} from '@/common/js/net/mainUrl';
|
||||||
import {
|
import {
|
||||||
get
|
get
|
||||||
@ -306,6 +356,7 @@
|
|||||||
},
|
},
|
||||||
closeDialog() {
|
closeDialog() {
|
||||||
this.$refs.reasonDialog.close()
|
this.$refs.reasonDialog.close()
|
||||||
|
this.$refs.downloadDialog.close()
|
||||||
},
|
},
|
||||||
//显示详情
|
//显示详情
|
||||||
showReason(e) {
|
showReason(e) {
|
||||||
@ -323,14 +374,14 @@
|
|||||||
previewImg(e) {
|
previewImg(e) {
|
||||||
const _self = this
|
const _self = this
|
||||||
_self.$refs.reasonDialog.close()
|
_self.$refs.reasonDialog.close()
|
||||||
const item = e.currentTarget.dataset.value
|
const item = e.currentTarget.dataset.item
|
||||||
console.log(item)
|
console.log(item)
|
||||||
const fileName = item.value
|
const fileName = item.value
|
||||||
const path = item.url
|
const path = item.url
|
||||||
//判断是pdf还是图片
|
//判断是pdf还是图片
|
||||||
if (fileName.toLowerCase().endsWith('.pdf')) {
|
if (fileName.toLowerCase().endsWith('.pdf')) {
|
||||||
//文件,下载文件
|
//文件,下载文件
|
||||||
_self.download(path, fileName)
|
_self.download(path)
|
||||||
} else {
|
} else {
|
||||||
//图片
|
//图片
|
||||||
const urls = [path]
|
const urls = [path]
|
||||||
@ -356,7 +407,7 @@
|
|||||||
},
|
},
|
||||||
//点击下载
|
//点击下载
|
||||||
//path :文件地址
|
//path :文件地址
|
||||||
async download(path, fileName) {
|
async download(path) {
|
||||||
const _self = this
|
const _self = this
|
||||||
_self.downloadProgress = 0 //重置下载进度
|
_self.downloadProgress = 0 //重置下载进度
|
||||||
_self.downloading = true //显示进度
|
_self.downloading = true //显示进度
|
||||||
@ -369,27 +420,20 @@
|
|||||||
const downloadRes = await _self.doDownload(url, header)
|
const downloadRes = await _self.doDownload(url, header)
|
||||||
console.log('下载返回', downloadRes)
|
console.log('下载返回', downloadRes)
|
||||||
if (downloadRes && downloadRes.statusCode == 200) {
|
if (downloadRes && downloadRes.statusCode == 200) {
|
||||||
uni.saveFile({
|
_self.downloadProgress = 0
|
||||||
tempFilePath: downloadRes.tempFilePath,
|
_self.downloading = false
|
||||||
|
uni.openDocument({
|
||||||
|
filePath: downloadRes.tempFilePath,
|
||||||
|
showMenu: true,
|
||||||
success: res => {
|
success: res => {
|
||||||
_self.downloadProgress = 0
|
|
||||||
_self.downloading = false
|
|
||||||
uni.openDocument({
|
|
||||||
filePath: res.savedFilePath,
|
|
||||||
showMenu: true,
|
|
||||||
success: openRes => {
|
|
||||||
console.log('打开文件成功')
|
|
||||||
},
|
|
||||||
fail: openErr => {
|
|
||||||
_self.showErr('很抱歉,文件下载出现问题。建议您稍作等待,之后再尝试下载。')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => {
|
||||||
console.log(err)
|
|
||||||
_self.showErr('很抱歉,文件下载出现问题。建议您稍作等待,之后再尝试下载。')
|
_self.showErr('很抱歉,文件下载出现问题。建议您稍作等待,之后再尝试下载。')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
_self.showErr('很抱歉,文件下载出现问题。建议您稍作等待,之后再尝试下载。')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showErr(msg) {
|
showErr(msg) {
|
||||||
@ -452,7 +496,15 @@
|
|||||||
},
|
},
|
||||||
//下载
|
//下载
|
||||||
downloadFile(e) {
|
downloadFile(e) {
|
||||||
const item = e.currentTarget.dataset.value
|
this.tempDownloadPro = e.currentTarget.dataset.value
|
||||||
|
this.$refs.downloadDialog.open()
|
||||||
|
},
|
||||||
|
//下载code或资料
|
||||||
|
doDownloadDatum(e) {
|
||||||
|
const _self = this
|
||||||
|
const path = e.currentTarget.dataset.path
|
||||||
|
const url = copyrightUrl + path + this.tempDownloadPro.projId
|
||||||
|
_self.download(url)
|
||||||
},
|
},
|
||||||
//去申请补正
|
//去申请补正
|
||||||
applyRepair() {
|
applyRepair() {
|
||||||
@ -885,4 +937,153 @@
|
|||||||
background-color: $bg-red-color;
|
background-color: $bg-red-color;
|
||||||
color: $text-brown-color;
|
color: $text-brown-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.download-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 5px;
|
||||||
|
height: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-item:nth-of-type(n+2) {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-item:last-child {
|
||||||
|
margin-bottom: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-title {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 10px;
|
||||||
|
width: 75px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-title-txt {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-btn-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
height: 70px;
|
||||||
|
flex: .6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-btn {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
color: black;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid #CECECE;
|
||||||
|
width: 105px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-btn-txt {
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-btn:active {
|
||||||
|
background-color: #d1d1d0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.icon-table {
|
||||||
|
content: "";
|
||||||
|
background-image: url('data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMzIgMzIiIHdpZHRoPSI2NCIgaGVpZ2h0PSI2NCIgc3R5bGU9IiIgZmlsdGVyPSJub25lIj4KICAgIAogICAgPGc+CiAgICA8cGF0aCBkPSJNMTYgMjFoLTR2Mmg0di0yek0xNyAyMWg0djJoLTR2LTJ6TTE2IDI2aC00di0yaDR2MnpNMTcgMjZoNHYtMmgtNHYyek0xNiAxOGgtNHYyaDR2LTJ6TTE3IDE4aDR2MmgtNHYtMnpNMTYgMTVoLTR2Mmg0di0yek0xNyAxNWg0djJoLTR2LTJ6TTE5IDN2Ni4wMDJjMCAxLjExMSAwLjg5OCAxLjk5OCAyLjAwNiAxLjk5OGg0Ljk5NHYxNy4wMDNjMCAxLjEwNy0wLjg5NCAxLjk5Ny0xLjk5NyAxLjk5N2gtMTUuMDA1Yy0xLjEwNyAwLTEuOTk3LTAuODk5LTEuOTk3LTIuMDA3di0yMi45ODVjMC0xLjEwOSAwLjg5OS0yLjAwNyAyLjAwOS0yLjAwN2g5Ljk5MXpNMjAgM3Y1Ljk5N2MwIDAuNTU0IDAuNDUxIDEuMDAzIDAuOTkxIDEuMDAzaDUuMDA5bC02LTd6TTExIDEzdjE0aDExdi0xNGgtMTF6IiBmaWxsPSJyZ2JhKDI1NSwxNjksMCwxKSI+PC9wYXRoPgogICAgPC9nPgogIDwvc3ZnPg==');
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.icon-tool {
|
||||||
|
background-image: url('data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSI2NCA2NCA4OTYgODk2IiB3aWR0aD0iNTIiIGhlaWdodD0iNTIiIHN0eWxlPSIiIGZpbHRlcj0ibm9uZSI+CiAgICAKICAgIDxnPgogICAgPHBhdGggZD0iTTg4MCAxMTJIMTQ0Yy0xNy43IDAtMzIgMTQuMy0zMiAzMnY3MzZjMCAxNy43IDE0LjMgMzIgMzIgMzJoNzM2YzE3LjcgMCAzMi0xNC4zIDMyLTMyVjE0NGMwLTE3LjctMTQuMy0zMi0zMi0zMnpNNTEzLjEgNTE4LjFsLTE5MiAxNjFjLTUuMiA0LjQtMTMuMS43LTEzLjEtNi4xdi02Mi43YzAtMi4zIDEuMS00LjYgMi45LTYuMUw0MjAuNyA1MTJsLTEwOS44LTkyLjJhNy42MyA3LjYzIDAgMCAxLTIuOS02LjFWMzUxYzAtNi44IDcuOS0xMC41IDEzLjEtNi4xbDE5MiAxNjAuOWMzLjkgMy4yIDMuOSA5LjEgMCAxMi4zek03MTYgNjczYzAgNC40LTMuNCA4LTcuNSA4aC0xODVjLTQuMSAwLTcuNS0zLjYtNy41LTh2LTQ4YzAtNC40IDMuNC04IDcuNS04aDE4NWM0LjEgMCA3LjUgMy42IDcuNSA4djQ4eiIgZmlsbD0icmdiYSg1MiwxMjQsMTc1LDEpIj48L3BhdGg+CiAgICA8L2c+CiAgPC9zdmc+');
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.icon-source {
|
||||||
|
background-image: url('data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSI2NCA2NCA4OTYgODk2IiB3aWR0aD0iNTIiIGhlaWdodD0iNTIiIHN0eWxlPSIiIGZpbHRlcj0ibm9uZSI+CiAgICAKICAgIDxnPgogICAgPHBhdGggZD0iTTkyOCAxNjFINjk5LjJjLTQ5LjEgMC05Ny4xIDE0LjEtMTM4LjQgNDAuN0w1MTIgMjMzbC00OC44LTMxLjNBMjU1LjIgMjU1LjIgMCAwIDAgMzI0LjggMTYxSDk2Yy0xNy43IDAtMzIgMTQuMy0zMiAzMnY1NjhjMCAxNy43IDE0LjMgMzIgMzIgMzJoMjI4LjhjNDkuMSAwIDk3LjEgMTQuMSAxMzguNCA0MC43bDQ0LjQgMjguNmMxLjMuOCAyLjggMS4zIDQuMyAxLjNzMy0uNCA0LjMtMS4zbDQ0LjQtMjguNkM2MDIgODA3LjEgNjUwLjEgNzkzIDY5OS4yIDc5M0g5MjhjMTcuNyAwIDMyLTE0LjMgMzItMzJWMTkzYzAtMTcuNy0xNC4zLTMyLTMyLTMyek00MDQgNTUzLjVjMCA0LjEtMy4yIDcuNS03LjEgNy41SDIxMS4xYy0zLjkgMC03LjEtMy40LTcuMS03LjV2LTQ1YzAtNC4xIDMuMi03LjUgNy4xLTcuNWgxODUuN2MzLjkgMCA3LjEgMy40IDcuMSA3LjV2NDV6bTAtMTQwYzAgNC4xLTMuMiA3LjUtNy4xIDcuNUgyMTEuMWMtMy45IDAtNy4xLTMuNC03LjEtNy41di00NWMwLTQuMSAzLjItNy41IDcuMS03LjVoMTg1LjdjMy45IDAgNy4xIDMuNCA3LjEgNy41djQ1em00MTYgMTQwYzAgNC4xLTMuMiA3LjUtNy4xIDcuNUg2MjcuMWMtMy45IDAtNy4xLTMuNC03LjEtNy41di00NWMwLTQuMSAzLjItNy41IDcuMS03LjVoMTg1LjdjMy45IDAgNy4xIDMuNCA3LjEgNy41djQ1em0wLTE0MGMwIDQuMS0zLjIgNy41LTcuMSA3LjVINjI3LjFjLTMuOSAwLTcuMS0zLjQtNy4xLTcuNXYtNDVjMC00LjEgMy4yLTcuNSA3LjEtNy41aDE4NS43YzMuOSAwIDcuMSAzLjQgNy4xIDcuNXY0NXoiIGZpbGw9InJnYmEoMTI5LDE3OSw1NSwxKSI+PC9wYXRoPgogICAgPC9nPgogIDwvc3ZnPg==');
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-all {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 100vw;
|
||||||
|
background-color: $primary-color;
|
||||||
|
color: white;
|
||||||
|
padding: 5px 0px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-all:active {
|
||||||
|
background-color: $primary-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.download-desc {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: flex-start;
|
||||||
|
width: 100vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link {
|
||||||
|
margin-top: 5px;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-all;
|
||||||
|
width: 85vw;
|
||||||
|
font-size: 14px;
|
||||||
|
color: rgba(114, 197, 245, 0.692);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-tips {
|
||||||
|
margin-top: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: center;
|
||||||
|
color: $primary-color;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -140,11 +140,13 @@
|
|||||||
<view class="download-title-txt">申请表</view>
|
<view class="download-title-txt">申请表</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="download-btn-box">
|
<view class="download-btn-box">
|
||||||
<view class="download-btn" @click="download" data-path="/route/proj/download/apply/">
|
<view class="download-btn" @click="download" data-path="/route/proj/download/apply/"
|
||||||
|
data-type="docx">
|
||||||
<view class="ic-doc" style="width: 20px;height: 20px;"></view>
|
<view class="ic-doc" style="width: 20px;height: 20px;"></view>
|
||||||
<view class="download-btn-txt">Word格式下载</view>
|
<view class="download-btn-txt">Word格式下载</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="download-btn" @click="download" data-path="/route/proj/download/apply-txt/">
|
<view class="download-btn" @click="download" data-path="/route/proj/download/apply-txt/"
|
||||||
|
data-type="txt">
|
||||||
<view class="ic-txt" style="width: 20px;height: 20px;"></view>
|
<view class="ic-txt" style="width: 20px;height: 20px;"></view>
|
||||||
<view class="download-btn-txt">TXT格式下载</view>
|
<view class="download-btn-txt">TXT格式下载</view>
|
||||||
</view>
|
</view>
|
||||||
@ -157,11 +159,13 @@
|
|||||||
<view class="download-title-txt">操作手册</view>
|
<view class="download-title-txt">操作手册</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="download-btn-box">
|
<view class="download-btn-box">
|
||||||
<view class="download-btn" @click="download" data-path="/route/proj/download/manual/">
|
<view class="download-btn" @click="download" data-path="/route/proj/download/manual/"
|
||||||
|
data-type="docx">
|
||||||
<view class="ic-doc" style="width: 20px;height: 20px;"></view>
|
<view class="ic-doc" style="width: 20px;height: 20px;"></view>
|
||||||
<view class="download-btn-txt">Word格式下载</view>
|
<view class="download-btn-txt">Word格式下载</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="download-btn" @click="download" data-path="/route/proj/download/manual/pdf/">
|
<view class="download-btn" @click="download" data-path="/route/proj/download/manual/pdf/"
|
||||||
|
data-type="pdf">
|
||||||
<view class="ic-pdf" style="width: 20px;height: 20px;"></view>
|
<view class="ic-pdf" style="width: 20px;height: 20px;"></view>
|
||||||
<view class="download-btn-txt">PDF格式下载</view>
|
<view class="download-btn-txt">PDF格式下载</view>
|
||||||
</view>
|
</view>
|
||||||
@ -173,11 +177,13 @@
|
|||||||
<view class="download-title-txt">源代码</view>
|
<view class="download-title-txt">源代码</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="download-btn-box">
|
<view class="download-btn-box">
|
||||||
<view class="download-btn" @click="download" data-path="/route/proj/download/code/">
|
<view class="download-btn" @click="download" data-path="/route/proj/download/code/"
|
||||||
|
data-type="docx">
|
||||||
<view class="ic-doc" style="width: 20px;height: 20px;"></view>
|
<view class="ic-doc" style="width: 20px;height: 20px;"></view>
|
||||||
<view class="download-btn-txt">Word格式下载</view>
|
<view class="download-btn-txt">Word格式下载</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="download-btn" @click="download" data-path="/route/proj/download/code/pdf/">
|
<view class="download-btn" @click="download" data-path="/route/proj/download/code/pdf/"
|
||||||
|
data-type="pdf">
|
||||||
<view class="ic-pdf" style="width: 20px;height: 20px;"></view>
|
<view class="ic-pdf" style="width: 20px;height: 20px;"></view>
|
||||||
<view class="download-btn-txt">PDF格式下载</view>
|
<view class="download-btn-txt">PDF格式下载</view>
|
||||||
</view>
|
</view>
|
||||||
@ -190,7 +196,7 @@
|
|||||||
<DownloadProgress :isShow="downloading" :progress="downloadProgress"></DownloadProgress>
|
<DownloadProgress :isShow="downloading" :progress="downloadProgress"></DownloadProgress>
|
||||||
<!-- 通知消息 -->
|
<!-- 通知消息 -->
|
||||||
<AdPopup :coupons="tempCoupons" @ad-close="doCloseAd" @ad-furl="doFurlCoupons" :visible="showAd"></AdPopup>
|
<AdPopup :coupons="tempCoupons" @ad-close="doCloseAd" @ad-furl="doFurlCoupons" :visible="showAd"></AdPopup>
|
||||||
<uni-popup ref="msg" type="message">
|
<uni-popup ref="msg" type="message" style="margin-top: 80px;">
|
||||||
<uni-popup-message :type="msgType" :message="msgTxt" :duration="2000"></uni-popup-message>
|
<uni-popup-message :type="msgType" :message="msgTxt" :duration="2000"></uni-popup-message>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
@ -529,11 +535,13 @@
|
|||||||
//点击下载
|
//点击下载
|
||||||
async download(e) {
|
async download(e) {
|
||||||
const _self = this
|
const _self = this
|
||||||
|
const postfix = e.currentTarget.dataset.type
|
||||||
_self.downloadProgress = 0 //重置下载进度
|
_self.downloadProgress = 0 //重置下载进度
|
||||||
_self.downloading = true //显示进度
|
_self.downloading = true //显示进度
|
||||||
this.$refs.downloadPopup.close() //关闭资料下载弹窗
|
this.$refs.downloadPopup.close() //关闭资料下载弹窗
|
||||||
const path = e.currentTarget.dataset.path
|
const path = e.currentTarget.dataset.path
|
||||||
const url = this.cUrl + path + _self.tempItem.projId
|
const url = this.cUrl + path + _self.tempItem.projId
|
||||||
|
const fileName = _self.tempItem.projId + '.' + postfix
|
||||||
const token = get('token')
|
const token = get('token')
|
||||||
const header = {}
|
const header = {}
|
||||||
if (token) {
|
if (token) {
|
||||||
@ -541,53 +549,32 @@
|
|||||||
}
|
}
|
||||||
const downloadRes = await _self.doDownload(url, header)
|
const downloadRes = await _self.doDownload(url, header)
|
||||||
if (downloadRes && downloadRes.statusCode == 200) {
|
if (downloadRes && downloadRes.statusCode == 200) {
|
||||||
const fileHeader = await _self.getFileHeader(url, header)
|
//判断是txt还是文件
|
||||||
console.log('请求头:', fileHeader)
|
if (downloadRes.tempFilePath.endsWith('.txt')) {
|
||||||
if (fileHeader && fileHeader.header) {
|
_self.msgTxt = '下载成功'
|
||||||
const contentDisposition = fileHeader.header['content-disposition'];
|
_self.msgType = 'success'
|
||||||
console.log('文件头:', contentDisposition);
|
_self.$refs.msg.open()
|
||||||
let fileName = ''
|
_self.showDownload = false
|
||||||
if (contentDisposition) {
|
_self.downloading = false
|
||||||
const match = contentDisposition.match(/filename=(.*)/)
|
_self.downloadProgress = 0
|
||||||
if (match && match[1]) {
|
uni.navigateTo({
|
||||||
fileName = match[1].replace(/['"]/g, '');
|
url: '/pages/common/readTxt/readTxt?filePath=' +
|
||||||
}
|
downloadRes.tempFilePath
|
||||||
}
|
})
|
||||||
if (fileName) {
|
|
||||||
console.log('下载的文件路径:', downloadRes.tempFilePath + fileName);
|
|
||||||
uni.getFileSystemManager().saveFile({
|
|
||||||
tempFilePath: res.tempFilePath,
|
|
||||||
filePath: uni.env.USER_DATA_PATH + '/' + fileName,
|
|
||||||
success: saveRes => {
|
|
||||||
//打开文件
|
|
||||||
console.log('打开文件', saveRes.savedFilePath);
|
|
||||||
if (saveRes.savedFilePath.endsWith('.txt')) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/common/readTxt/readTxt?filePath=' +
|
|
||||||
saveRes.savedFilePath
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
uni.openDocument({
|
|
||||||
filePath: saveRes.savedFilePath,
|
|
||||||
success: openRes => {
|
|
||||||
console.log('打开成功')
|
|
||||||
},
|
|
||||||
fail: openErr => {
|
|
||||||
console.log(openErr)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
fail: saveErr => {
|
|
||||||
_self.showErr('很抱歉,文件下载出现问题。建议您稍作等待,之后再尝试下载。')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
_self.showErr('很抱歉,文件下载出现问题。建议您稍作等待,之后再尝试下载。')
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
_self.showErr('很抱歉,文件下载出现问题。建议您稍作等待,之后再尝试下载。')
|
uni.openDocument({
|
||||||
|
filePath: downloadRes.tempFilePath,
|
||||||
|
showMenu:true,
|
||||||
|
success(res) {
|
||||||
|
console.log(res)
|
||||||
|
_self.showDownload = false
|
||||||
|
_self.downloading = false
|
||||||
|
_self.downloadProgress = 0
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
_self.showErr('很抱歉,文件下载出现问题。建议您稍作等待,之后再尝试下载。')
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_self.showErr('很抱歉,文件下载出现问题。建议您稍作等待,之后再尝试下载。')
|
_self.showErr('很抱歉,文件下载出现问题。建议您稍作等待,之后再尝试下载。')
|
||||||
|
Loading…
Reference in New Issue
Block a user