162 lines
3.5 KiB
Vue
162 lines
3.5 KiB
Vue
<template>
|
|
<view class="policy">
|
|
<view class="list-item" v-for="(item, index) in currentList" :key="index" @click="fileItemClick(item)">
|
|
<view class="v12-justify-start v12-align-center">
|
|
<view class="v12-font-bold v12-font-28">·</view>
|
|
<view class="item-title one-t">{{ item.title }}</view>
|
|
</view>
|
|
<view class="item-action v12-dark"><u-icon name="arrow-right" color="#fff" size="8"></u-icon></view>
|
|
</view>
|
|
<view class="more-wrap">
|
|
<view class="more-btn v12-primary v12-align-center" @click="showMore">
|
|
{{ isMore ? '查看更多' : '查看更多' }}
|
|
<view class="item-action v12-white"><u-icon name="arrow-right" color="#C52733 " size="12"></u-icon></view>
|
|
</view>
|
|
</view>
|
|
<image
|
|
v-if="list.length === 0"
|
|
:src="webUrl + '/20231023131208675588.png'"
|
|
class="img-nodata"
|
|
mode="scaleToFill"
|
|
/>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getPorjectPolicyFiles,
|
|
} from "@/api/product"
|
|
export default {
|
|
props: {
|
|
landmarkDataId: null
|
|
},
|
|
data() {
|
|
return {
|
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
|
list: [],
|
|
currentList: [],
|
|
isMore: false
|
|
}
|
|
},
|
|
watch: {
|
|
landmarkDataId(value) {
|
|
if(value) {
|
|
this.getData()
|
|
}
|
|
}
|
|
},
|
|
mounted() {
|
|
this.getData()
|
|
},
|
|
methods: {
|
|
getData() {
|
|
const params = {
|
|
landmarkDataId: this.landmarkDataId,
|
|
page: 1,
|
|
limit: 99999
|
|
}
|
|
getPorjectPolicyFiles(params).then(res => {
|
|
this.list = res.data.records
|
|
if(this.isMore) {
|
|
this.currentList = this.list
|
|
} else {
|
|
this.currentList = this.list.filter((item, index) => index < 3)
|
|
}
|
|
})
|
|
},
|
|
showMore() {
|
|
// this.isMore = !this.isMore
|
|
// if(this.isMore) {
|
|
// this.currentList = this.list
|
|
// } else {
|
|
// this.currentList = this.list.filter((item, index) => index < 3)
|
|
// }
|
|
uni.navigateTo({ url: `/pages/home/searchPage?id=${this.landmarkDataId}&type=2` })
|
|
|
|
},
|
|
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 lang="scss" scoped>
|
|
.more-btn{
|
|
.item-action{
|
|
width: 20rpx;
|
|
height: 20rpx;
|
|
margin-left: 10rpx;
|
|
}
|
|
}
|
|
.policy{
|
|
padding: 20rpx;
|
|
background: #f0f0f0;
|
|
border-radius: 24rpx;
|
|
}
|
|
.list-item{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
background: #fff;
|
|
margin-bottom: 20rpx;
|
|
border-radius: 24rpx;
|
|
align-items: center;
|
|
padding: 10rpx 20rpx;
|
|
}
|
|
.item-action{
|
|
font-size: 22rpx;
|
|
width: 24rpx;
|
|
height: 24rpx;
|
|
color: #fff;
|
|
padding: 5rpx;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
line-height: 24rpx;
|
|
}
|
|
.item-title{
|
|
font-size: 24rpx;
|
|
color: #333;
|
|
margin-left: 10rpx;
|
|
}
|
|
.log-img{
|
|
width: 68rpx;
|
|
height: 68rpx;
|
|
background: rgba(197,39,51,0.39);
|
|
border-radius: 50%;
|
|
}
|
|
.more-wrap{
|
|
display: flex;
|
|
align-content: center;
|
|
justify-content: center;
|
|
}
|
|
.more-btn{
|
|
color: #fff;
|
|
font-size: 28rpx;
|
|
padding: 5rpx 20rpx;
|
|
border-radius: 30rpx;
|
|
}
|
|
.img-nodata {
|
|
position: relative;
|
|
top: 0;
|
|
left: 50%;
|
|
transform: translate(-50%, 0);
|
|
width: 352rpx;
|
|
height: 338rpx;
|
|
margin-bottom: 60rpx;
|
|
}
|
|
</style> |