Commit 1a486554 by zhangzhen

细节优化

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