Commit 92f7c49e authored by 14699's avatar 14699

fix:合同签约及发票附件下载调整

parent 0a05f5b3
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
</template> </template>
<script setup> <script setup>
import { goBack } from "@/utils/globalFun" import {Copy, goBack, isAndroid} from "@/utils/globalFun"
import { NavBar, Toast } from "vant"; import {Dialog, NavBar, Toast} from "vant";
import VuePdfEmbed from 'vue-pdf-embed' import VuePdfEmbed from 'vue-pdf-embed'
import { watchEffect } from 'vue' import { watchEffect } from 'vue'
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import downfileHips from "@/utils/downfileHips" import { downfileHips, openFileUrl} from "@/utils/downfileHips"
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
...@@ -33,30 +33,49 @@ watchEffect(() => { ...@@ -33,30 +33,49 @@ watchEffect(() => {
}) })
const download = () => { const download = () => {
downfileHips( Copy(pdfSource, '已将文件地址复制至剪切板,请至浏览器下载')
pdfSource, // if (isAndroid()) {
(msg) => { // downfileHips(
console.log(msg); // pdfSource,
const msgObj = JSON.parse(msg) // (msg) => {
switch (msgObj.status) { // console.log(msg);
case "PROGRESS": // const msgObj = JSON.parse(msg)
console.log("正在传输") // switch (msgObj.status) {
break // case "PROGRESS":
case "FINISH": // console.log("正在传输")
Toast({ // Toast.loading({
message: `下载成功!保存地址是:${msgObj.response}`, // duration: 0,
position: 'bottom', // forbidClick: true,
}); // message: '下载中...',
break // });
case "FAIL": // break
Toast.fail('下载失败'); // case "FINISH":
} // Toast.clear();
// Dialog.alert({
}, // title: "下载成功",
(err) => { // message: `保存地址是:${msgObj.response}`
console.error('下载失败:', err) // });
Toast.fail('下载失败'); // break
}) // case "FAIL":
// Toast.clear();
// Toast.fail('下载失败');
// }
//
// },
// (err) => {
// console.error('下载失败:', err)
// Toast.fail('下载失败');
// })
// } else {
// openFileUrl(
// pdfSource,
// (msg) => {
// console.log(msg);
// },
// (err) => {
// Copy(pdfSource, '已将文件地址复制至剪切板,请至浏览器下载')
// })
// }
} }
const handleDocumentRender = (args) => { const handleDocumentRender = (args) => {
......
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
</template> </template>
<script setup> <script setup>
import { goBack } from "@/utils/globalFun" import {Copy, goBack, isAndroid} from "@/utils/globalFun"
import { NavBar, List, PullRefresh, Toast } from "vant"; import {NavBar, List, PullRefresh, Toast, Dialog} from "vant";
import api from "../api"; import api from "../api";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import downfileHips from "@/utils/downfileHips" import { downfileHips, openFileUrl} from "@/utils/downfileHips"
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
...@@ -49,30 +49,49 @@ const getDailyLiquidatedDetail = async () => { ...@@ -49,30 +49,49 @@ const getDailyLiquidatedDetail = async () => {
getDailyLiquidatedDetail(); getDailyLiquidatedDetail();
const download = (item) => { const download = (item) => {
downfileHips( Copy(item.fileUrl, '已将文件地址复制至剪切板,请至浏览器下载')
item.fileUrl, // if (isAndroid()) {
(msg) => { // downfileHips(
console.log(msg); // item.fileUrl,
const msgObj = JSON.parse(msg) // (msg) => {
switch (msgObj.status) { // console.log(msg);
case "PROGRESS": // const msgObj = JSON.parse(msg)
console.log("正在传输") // switch (msgObj.status) {
break // case "PROGRESS":
case "FINISH": // console.log("正在传输")
Toast({ // Toast.loading({
message: `下载成功!保存地址是:${msgObj.response}`, // duration: 0,
position: 'bottom', // forbidClick: true,
}); // message: '下载中...',
break // });
case "FAIL": // break
Toast.fail('下载失败'); // case "FINISH":
} // Toast.clear();
// Dialog.alert({
}, // title: "下载成功",
(err) => { // message: `保存地址是:${msgObj.response}`
console.error('下载失败:', err) // });
Toast.fail('下载失败'); // break
}) // case "FAIL":
// Toast.clear();
// Toast.fail('下载失败');
// }
//
// },
// (err) => {
// console.error('下载失败:', err)
// Toast.fail('下载失败');
// })
// } else {
// openFileUrl(
// item.fileUrl,
// (msg) => {
// console.log(msg);
// },
// (err) => {
// Copy(item.fileUrl, '已将文件地址复制至剪切板,请至浏览器下载')
// })
// }
} }
const jump = (item) => { const jump = (item) => {
......
...@@ -9,7 +9,10 @@ ...@@ -9,7 +9,10 @@
<img src="../../../assets/list.png"/> <img src="../../../assets/list.png"/>
<div class="title">{{item.documentName}}</div> <div class="title">{{item.documentName}}</div>
</div> </div>
<div class="button-status sign" @click="jump(item)">查看</div> <div style="display: flex;">
<div class="button-status sign" @click="jump(item)">查看</div>
<div class="button-status sign" @click="download(item)">下载</div>
</div>
</div> </div>
</List> </List>
</PullRefresh> </PullRefresh>
...@@ -18,12 +21,13 @@ ...@@ -18,12 +21,13 @@
</template> </template>
<script setup> <script setup>
import { goBack,HIPSDownLoad} from "@/utils/globalFun" import {Copy, goBack, HIPSDownLoad, isAndroid} from "@/utils/globalFun"
import { NavBar, List, PullRefresh, Empty, Toast} from "vant"; import {NavBar, List, PullRefresh, Empty, Toast, Dialog} from "vant";
import ListItem from '@/components/ListItem.vue' import ListItem from '@/components/ListItem.vue'
import api from "../api"; import api from "../api";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useIntention } from "../store"; import { useIntention } from "../store";
import {downfileHips, openFileUrl} from "@/utils/downfileHips";
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
...@@ -60,6 +64,52 @@ const jump = (item) => { ...@@ -60,6 +64,52 @@ const jump = (item) => {
} }
} }
const download = (item) => {
Copy(item.downloadUrl, '已将文件地址复制至剪切板,请至浏览器下载')
// if (isAndroid()) {
// downfileHips(
// item.downloadUrl,
// (msg) => {
// console.log(msg);
// const msgObj = JSON.parse(msg)
// switch (msgObj.status) {
// case "PROGRESS":
// console.log("正在传输")
// Toast.loading({
// duration: 0,
// forbidClick: true,
// message: '下载中...',
// });
// break
// case "FINISH":
// Toast.clear();
// Dialog.alert({
// title: "下载成功",
// message: `保存地址是:${msgObj.response}`
// });
// break
// case "FAIL":
// Toast.clear();
// Toast.fail('下载失败');
// }
//
// },
// (err) => {
// console.error('下载失败:', err)
// Toast.fail('下载失败');
// })
// } else {
// openFileUrl(
// item.downloadUrl,
// (msg) => {
// console.log(msg);
// },
// (err) => {
// Copy(item.downloadUrl, '已将文件地址复制至剪切板,请至浏览器下载')
// })
// }
}
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
...@@ -90,6 +140,7 @@ const jump = (item) => { ...@@ -90,6 +140,7 @@ const jump = (item) => {
} }
.left { .left {
display: flex; display: flex;
//width: calc(100% - 100px);
} }
.item img{ .item img{
width: 20px; width: 20px;
...@@ -102,16 +153,16 @@ const jump = (item) => { ...@@ -102,16 +153,16 @@ const jump = (item) => {
margin-left: 16px; margin-left: 16px;
font-weight: 600; font-weight: 600;
line-height: 20px; line-height: 20px;
word-break:break-all;
} }
.button-status{ .button-status{
width: 54px; width: 50px;
height: 20px; height: 20px;
font-size: 12px; font-size: 12px;
border-radius: 10px; border-radius: 10px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-right: 15px;
} }
.sign{ .sign{
color: #2499FF; color: #2499FF;
......
...@@ -23,6 +23,8 @@ function downloadFile(source, target, isTemp = 'N',succesE,errorE) { ...@@ -23,6 +23,8 @@ function downloadFile(source, target, isTemp = 'N',succesE,errorE) {
HandBridge.postMessage(JSON.stringify(args)) HandBridge.postMessage(JSON.stringify(args))
} }
// { // {
// "status":"PROGRESS"/"FINISH"/"FAIL" //正在传输/完成/失败 // "status":"PROGRESS"/"FINISH"/"FAIL" //正在传输/完成/失败
// "fileSize":1234 //文件总大小,当为-1时则表示文件的大小不可获取 // "fileSize":1234 //文件总大小,当为-1时则表示文件的大小不可获取
...@@ -30,6 +32,29 @@ function downloadFile(source, target, isTemp = 'N',succesE,errorE) { ...@@ -30,6 +32,29 @@ function downloadFile(source, target, isTemp = 'N',succesE,errorE) {
// "response":"xxxxx" //传输完成后文件的本地路径 // "response":"xxxxx" //传输完成后文件的本地路径
// } // }
export default function downfileHips(source, succesE, errorE, target, isTemp = 'N') { export function downfileHips(source, succesE, errorE, target, isTemp = 'N') {
downloadFile(source, target, isTemp,succesE,errorE) downloadFile(source, target, isTemp,succesE,errorE)
} }
export function openFileUrl(source, succesE, errorE) {
window.onSuccess = function(res){
console.log('success:',res);
succesE(res)
};
window.onError = function(res){
console.log('download:',res);
errorE(res)
};
let options = {
scheme: source
}
let args = {
className: "BaseBridge",
function: "gotoScheme",
params: options,
successCallBack: "onSuccess",
failCallBack: "onError"
}
console.log(JSON.stringify(args));
HandBridge.postMessage(JSON.stringify(args))
}
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