Commit 1a486554 by zhangzhen

细节优化

parent c8afd4b9
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<view class="flex-row"> <view class="flex-row">
<text class="text-gray part-1">版本</text> <text class="text-gray part-1">版本</text>
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
<text class="text-title">V{{orderInfo.docVersion}}</text> <text v-if="orderInfo&&orderInfo.docVersion" class="text-title">{{'v'+orderInfo.docVersion}}</text>
</view> </view>
<view class="flex-row"> <view class="flex-row">
<text class="text-gray part-1">附件名称</text> <text class="text-gray part-1">附件名称</text>
...@@ -78,12 +78,19 @@ ...@@ -78,12 +78,19 @@
</view> </view>
</view> </view>
<view v-if="previewStatus" class="preview-box"> <view v-if="previewStatus && ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg'].includes(orderInfo.fileSuffix)" class="preview-box">
<view class="text-box"> <view class="text-box">
<text class="text-title">图片预览</text> <text class="text-title">图片预览</text>
</view> </view>
<image :src="assetsPath+'/hggp/file/download/'+orderInfo.docId" mode="widthFix" @tap="onPre"></image> <image :src="assetsPath+'/hggp/file/download/'+orderInfo.docId" mode="widthFix" @tap="onPre"></image>
</view> </view>
<view v-if="previewStatus && ['mp4','3gp','avi'].includes(orderInfo.fileSuffix)" class="preview-box">
<view class="text-box">
<text class="text-title">视频预览</text>
</view>
<video :src="assetsPath+'/hggp/file/download/'+orderInfo.docId"></video>
</view>
<!-- <view class="flex-col content-part-1"> <!-- <view class="flex-col content-part-1">
...@@ -123,7 +130,9 @@ ...@@ -123,7 +130,9 @@
data() { data() {
return { return {
assetsPath: config.assetsPath, assetsPath: config.assetsPath,
hostUrl:config.hostUrl,
id: '', id: '',
fileId:'',
minDate: moment().subtract(1, 'M').format("YYYY-MM-DD"), minDate: moment().subtract(1, 'M').format("YYYY-MM-DD"),
content: "", content: "",
addStatus: false, addStatus: false,
...@@ -131,14 +140,17 @@ ...@@ -131,14 +140,17 @@
orderInfo: {}, orderInfo: {},
fileTypeEnum: {}, fileTypeEnum: {},
previewStatus: false, previewStatus: false,
imgUrl: '' imgUrl: '',
}; };
}, },
onLoad(option) { onLoad(option) {
if (option && option.id) { if (option && option.id) {
this.id = option.id this.id = option.id
this.onLoading()
} }
if (option && option.docId) {
this.docId = option.docId
}
this.onLoading()
}, },
methods: { methods: {
onPre() { onPre() {
...@@ -150,41 +162,57 @@ ...@@ -150,41 +162,57 @@
}, },
islmage(filename) { islmage(filename) {
const extension = filename.split('.').pop().toLowerCase(); const extension = filename.split('.').pop().toLowerCase();
console.log(extension, 9999) const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg','mp4','3gp','avi']
const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']
return imageExtensions.includes(extension); return imageExtensions.includes(extension);
}, },
onNavToPreview() { onNavToPreview() {
addPreview(this.orderInfo).then(res => { addPreview(this.orderInfo).then(res => {
console.log(res, 99999); if (res.data.__sys__.status === 1) {
if (res.data.__sys__.status === 1) { if(this.islmage(this.orderInfo.docName)){
this.imgUrl = "" this.previewStatus = true;
this.previewStatus = true; }else{
} let urlStr = this.assetsPath + '/hggp/file/download/' + this.orderInfo.docId;
this.onGetList(); uni.downloadFile({
}) url: urlStr,
success: (res)=> {
console.log(res,999999)
let filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
showMenu: true,
success: (res) =>{
console.log('打开文档成功');
}
});
}
});
}
}
this.onGetList();
})
}, },
onDownLoad() { onDownLoad() {
addDownLoad(this.orderInfo).then(res => { addDownLoad(this.orderInfo).then(res => {
console.log(res, 99999);
if (res.data.__sys__.status === 1) { if (res.data.__sys__.status === 1) {
let url = this.assetsPath + '/hggp/file/download/' + this.orderInfo.docId;
// #ifdef H5
window.open(url)
// #endif
// #ifndef H5
uni.showLoading({ uni.showLoading({
title:"文件下载中..." title:"文件下载中..."
}) })
let url = this.assetsPath + '/hggp/file/download/' + this.orderInfo.docId;
// #ifdef H5
window.open(url)
uni.hideLoading()
// #endif
// #ifndef H5
uni.downloadFile({ uni.downloadFile({
url, url,
success: (res2) => { success: (res2) => {
console.log(res2,999999)
uni.hideLoading() uni.hideLoading()
uni.saveFile({ uni.saveFile({
tempFilePath: res2.tempFilePath, tempFilePath: res2.tempFilePath,
success: (result) => { success: (result) => {
console.log(result) console.log(result,99999)
} }
}) })
} }
...@@ -209,7 +237,9 @@ ...@@ -209,7 +237,9 @@
}, },
onGetList() { onGetList() {
getList({ getList({
id: this.id id:this.id,
docId: this.docId,
bizType: "WD"
}).then(res => { }).then(res => {
if (res.data.__sys__.status === 0) { if (res.data.__sys__.status === 0) {
let list = toJsonData(res.data.__blocks__.result.rows, res.data.__blocks__.result.meta let list = toJsonData(res.data.__blocks__.result.rows, res.data.__blocks__.result.meta
...@@ -218,12 +248,12 @@ ...@@ -218,12 +248,12 @@
if (list && list.length) { if (list && list.length) {
this.orderInfo = { this.orderInfo = {
...list[0], ...list[0],
fileSuffix:list[0].docName.split('.').pop().toLowerCase(),
previewStatus: this.islmage(list[0].docName), previewStatus: this.islmage(list[0].docName),
releaseDate: updatedTime.length >= 13 ? releaseDate: updatedTime.length >= 13 ?
`${updatedTime[0]}${updatedTime[1]}${updatedTime[2]}${updatedTime[3]}/${updatedTime[4]}${updatedTime[5]}/${updatedTime[6]}${updatedTime[7]} ${updatedTime[8]}${updatedTime[9]}:${updatedTime[10]}${updatedTime[11]}:${updatedTime[12]}${updatedTime[13]}` : `${updatedTime[0]}${updatedTime[1]}${updatedTime[2]}${updatedTime[3]}/${updatedTime[4]}${updatedTime[5]}/${updatedTime[6]}${updatedTime[7]} ${updatedTime[8]}${updatedTime[9]}:${updatedTime[10]}${updatedTime[11]}:${updatedTime[12]}${updatedTime[13]}` :
'' ''
}; };
console.log(this.orderInfo, "this.orderInfo")
} }
} }
}) })
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<view class="flex-row"> <view class="flex-row">
<text class="text-gray part-1">版本</text> <text class="text-gray part-1">版本</text>
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
<text class="text-title">V{{item.docVersion}}</text> <text class="text-title">{{'v'+ item.docVersion}}</text>
</view> </view>
<!-- <view class="flex-row"> <!-- <view class="flex-row">
<text class="text-gray part-1">附件名称</text> <text class="text-gray part-1">附件名称</text>
...@@ -294,7 +294,7 @@ ...@@ -294,7 +294,7 @@
}, },
onNavToOrderInfo(val) { onNavToOrderInfo(val) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/document/edit?id=${val.id}` url: `/pages/document/edit?id=${val.id}&docId=${val.docId}`
}) })
} }
} }
......
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