@@ -0,0 +1,134 @@
|
||||
<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" v-if="isMore ? isMore : list.length > 3">
|
||||
<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>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getPorjectPolicyFiles,
|
||||
} from "@/api/product"
|
||||
export default {
|
||||
props: {
|
||||
landmarkDataId: null
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
currentList: [],
|
||||
isMore: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
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)
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
showMore() {
|
||||
this.isMore = !this.isMore
|
||||
if(this.isMore) {
|
||||
this.currentList = this.list
|
||||
} else {
|
||||
this.currentList = this.list.filter((item, index) => index < 3)
|
||||
}
|
||||
},
|
||||
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;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user