153 lines
3.4 KiB
Vue
153 lines
3.4 KiB
Vue
<template>
|
|
<view class="list-page">
|
|
<view class="v12-mb-3">
|
|
<u-search
|
|
placeholder="请输入关键词查询"
|
|
v-model="keyword"
|
|
shape="round"
|
|
:show-action="false"
|
|
height="72rpx"
|
|
@search="handleSearch"
|
|
bg-color="#fff">
|
|
</u-search>
|
|
</view>
|
|
<view v-if="isLoad" class="file-list">
|
|
<view
|
|
v-for="(file, fileIndex) in currentList"
|
|
:key="fileIndex"
|
|
class="file-item"
|
|
@click="fileItemClick(file)"
|
|
>
|
|
<view class="name more-t">
|
|
· {{ file.title }}
|
|
</view>
|
|
<image
|
|
:src="webUrl + '/page/qianxian/icon-05.png'"
|
|
class="icon"
|
|
/>
|
|
</view>
|
|
<view v-if="currentList.length === 0" class="no-data-txt">
|
|
暂无数据~
|
|
</view>
|
|
</view>
|
|
<goo-skeleton v-else />
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import {
|
|
getCountyFamousInvestmentFile,
|
|
getCountyFamousIndustryProjectFile
|
|
} 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: [],
|
|
keyword: '',
|
|
currentList: []
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
const id = options.id
|
|
const type = options.type || 'investment'
|
|
const title = options.title || ''
|
|
if (title) {
|
|
uni.setNavigationBarTitle({ title })
|
|
}
|
|
this.getListReq(id, type)
|
|
},
|
|
methods: {
|
|
handleSearch() {
|
|
this.currentList = this.list.filter(item => item.title.indexOf(this.keyword) > -1)
|
|
},
|
|
getListReq(id, type) {
|
|
let reqFn = null
|
|
let params = {}
|
|
if (type === 'investment') {
|
|
reqFn = getCountyFamousInvestmentFile
|
|
params = {
|
|
countyFamousDataId: id,
|
|
page: 1,
|
|
limit: 9999
|
|
}
|
|
} else {
|
|
reqFn = getCountyFamousIndustryProjectFile
|
|
params = {
|
|
industryProjectId: id,
|
|
page: 1,
|
|
limit: 9999
|
|
}
|
|
}
|
|
reqFn(params).then(res => {
|
|
const { success, data } = res
|
|
if (success) {
|
|
this.isLoad = true
|
|
this.list = data.records || []
|
|
this.currentList = [...this.list]
|
|
}
|
|
})
|
|
},
|
|
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%;
|
|
}
|
|
.no-data-txt {
|
|
text-align: center;
|
|
line-height: 200rpx;
|
|
color: #999;
|
|
font-size: 36rpx;
|
|
}
|
|
}
|
|
</style> |