Files
xdd-uniapp-new/pkg_product/views/famousQianxianInvestment.vue
T

113 lines
2.3 KiB
Vue

<template>
<view class="list-page">
<view v-if="isLoad" class="file-list">
<view
v-for="(file, fileIndex) in list"
:key="fileIndex"
class="file-item"
@click="fileItemClick(file)"
>
<view class="name more-t">
·&nbsp;&nbsp;{{ file.title }}
</view>
<image
:src="webUrl + '/page/qianxian/icon-05.png'"
class="icon"
/>
</view>
<image
:src="webUrl + '/home/no-data-bg.png'"
mode="widthFix"
class="loadend"
/>
</view>
<goo-skeleton v-else />
</view>
</template>
<script>
import {
getCountyFamousInvestmentFile
} from '@/api/qianxian'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: 'famousQianxianInvestment',
mixins: [pageListenMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
isLoad: false,
pageKeyId: '',
list: []
}
},
onLoad(options) {
const id = options.id
this.getListReq(id)
},
methods: {
getListReq(id) {
getCountyFamousInvestmentFile({
countyFamousDataId: id,
page: 1,
limit: 9999
}).then(res => {
const { success, data } = res
if (success) {
this.isLoad = true
this.list = data.records || []
}
})
},
fileItemClick(file) {
const url = file.attachment || ''
if (!url) return
uni.downloadFile({
url,
success: res => {
const filePath = res.tempFilePath
wx.openDocument({
filePath,
fail: (err) => {
console.log(err)
}
})
}
})
}
}
}
</script>
<style scoped lang="less">
.list-page {
min-height: 100vh;
padding: 30rpx;
box-sizing: border-box;
background-color: #f0f0f0;
.file-item {
display: flex;
align-items: center;
justify-content: space-between;
height: 100rpx;
width: 100%;
padding: 0 20rpx;
margin: 0 0 20rpx 0;
border-radius: 20rpx;
box-sizing: border-box;
line-height: 36rpx;
background-color: #fff;
.name {
width: calc(100% - 40rpx);
font-size: 28rpx;
}
.icon {
display: block;
width: 26rpx;
height: 26rpx;
}
}
.loadend {
width: 100%;
}
}
</style>