123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <template>
- <view class="center">
- <view class="c-list">
- <view class="xinxiup">
- <view>{{title}}</view>
- <view v-for="item in list">
- <view class="c-row b-b">
- <text class="tit">{{item.appendixName}}</text>
- </view>
- <view class="c-row b-b">
- <text class="tit">{{item.appendixSize}}</text>
- </view>
- <view class="c-row b-b">
- <text class="tit">{{item.appendixPath}}</text>
- </view>
- <u-button @click="download(item.appendixPath)">下载</u-button>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "trust",
- data() {
- return {
- list:[],
- title:""
- };
- },
- onLoad(param) {
- var that = this
- this.$api.doRequest('get', '/appendix/query/getFileList', {appendixIds:param.addressUrl}).then(res => {
- if (res.data.code == 200) {
- that.list = res.data.data
- that.title = "共"+that.list.length+"个附件"
- } else {
- uni.showToast({
- title: res.data.message,
- icon: 'none',
- duration: 2000
- })
- }
- })
- .catch(res => {
- if(res.errmsg){
- uni.showToast({
- title: res.errmsg,
- icon: 'none',
- duration: 2000
- })
- }
- else{
- uni.showToast({
- title: "系统异常,请联系管理员",
- icon: 'none',
- duration: 2000
- })
- }
- });
- },
- methods: {
- download(path){
- uni.downloadFile({
- url: path,
- success: function (res) {
- var filePath = res.tempFilePath;
- uni.saveFile({
- tempFilePath: filePath,
- success: function (res) {
- var savedFilePath = res.savedFilePath;
- uni.showModal({
- title: '提示',
- content: '下载成功,是否打开文件?',
- showCancel: true,
- success: (e) => {
- if (e.confirm) {
- uni.openDocument({
- filePath: savedFilePath,
- success: function (res) {
- uni.showToast({
- title: "打开成功",
- icon: 'none',
- duration: 2000
- })
- }
- });
- }
- },
- fail: () => {},
- complete: () => {}
- })
-
- }
- });
- },
- })
- }
- }
- }
- </script>
- <style>
- </style>
|