2024-11-05 10:14:41 +08:00

396 lines
9.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="project-summary-page">
<tn-navbar
fixed
bg-color="rgba(255, 255, 255, 0.01)"
:bottom-shadow="false"
:placeholder="false"
/>
<view class="project-summary"
:style="{'background':'url('+ menuData.pic +') no-repeat','backgroundPosition':'center center','backgroundSize':'100% 100%'}"
>
<view class="summary-content">
<view class="summary-info">
<view class="title">{{ menuData.title }}</view>
<view class="desc">{{ menuData.description }}</view>
</view>
</view>
</view>
<view class="project-container tn-pt-lg" v-if="flag">
<view class="tn-radius tn-m-lg">
<view class="title-container">
<view class="left">
<view class="title">{{projectData.title}}</view>
<view class="desc tn-text-lg">
<tn-icon name="clock" size="36rpx"/>
&nbsp;{{projectData.dateMonth}}
</view>
</view>
</view>
<view class="project-detail tn-pt-lg">
<view class="summary introduction-content tn-border tn-shadow-sm tn-p-sm tn-radius" :style="{'borderColor':color,'boxShadow':'0 0.3125rem 1.875rem -1.25rem '+ color}">
<view class="tn-p-lg tn-text-bold tn-text-2xl tn-text-center" :style="{'color':color}">
项目建设概况
</view>
<view class="text tn-text-lg" style="text-indent: 2em;">
{{projectData.pre_intro}}
</view>
<view class="project-review tn-flex tn-flex-wrap tn-flex-center-between tn-p">
<view style="width: 100%;" class="review-item tn-pt tn-pb tn-border tn-border-none-top tn-border-none-left tn-border-none-right tn-grey-disabled_border">
<view class="tn-text-lg tn-text-center">
重点投资类项目
</view>
<view class="tn-text-center tn-pt tn-text-bold tn-text-2xl">
<tn-count-scroll :value="projectData.investment" :text-color="color"/>
</view>
</view>
<view class="review-item tn-pt tn-pb tn-border tn-border-none-top tn-border-none-bottom tn-border-none-right tn-border-none-left tn-grey-disabled_border">
<view class="tn-text-lg tn-text-center">
政府类投资项目
</view>
<view class="tn-text-center tn-pt tn-text-bold tn-text-2xl">
<tn-count-scroll :value="projectData.goverment" :text-color="color"/>
</view>
</view>
<view class="review-item tn-pt tn-pb tn-border tn-border-none-bottom tn-border-none-top tn-border-none-right tn-grey-disabled_border">
<view class="tn-text-lg tn-text-center">
产业类投资项目
</view>
<view class="tn-text-center tn-pt tn-text-bold tn-text-2xl">
<tn-count-scroll :value="projectData.industry" :text-color="color"/>
</view>
</view>
</view>
<view class="text tn-text-lg" style="text-indent: 2em;">
截止目前园区共有重点投资类项目<span class="tn-text-bold tn-text-2xl" :style="{'color':color}">{{projectData.investment}}</span>
其中政府类投资项目<span class="tn-text-bold tn-text-2xl" :style="{'color':color}">{{projectData.goverment}}</span>
重点产业类投资项目<span class="tn-text-bold tn-text-2xl" :style="{'color':color}">{{projectData.industry}}</span>
</view>
<view class="tn-p-lg tn-text-bold tn-text-2xl tn-text-center" :style="{'color':color}">
重点项目建设清单
</view>
<view class="text tn-text-lg" style="text-indent: 2em;line-height: 1.8em;color: #444444;">
<mp-html :content="projectData.project_list" :copy-link="false" @linktap="downloadFile"/>
</view>
<view v-if="projectData.explan" class="tn-p-lg tn-text-bold tn-text-2xl tn-text-center" :style="{'color':color}">
其他说明
</view>
<view v-if="projectData.explan" class="text tn-text-lg" style="text-indent: 2em;line-height: 1.8em;color: #444444;">
<mp-html :content="projectData.explan" :copy-link="false" @linktap="downloadFile"/>
</view>
</view>
</view>
</view>
</view>
<tn-date-time-picker v-model="dateTimeValue" v-model:open="openDateTimePicker" init-current-date-time format="YYYY-MM" mode="yearmonth" @confirm="getDate"/>
<view class="picker-btn" @click="showPicker">
<tn-button shape="circle" type="success" size="lg" shadow shadow-color="tn-type-primary_shadow">
<tn-icon name="history" :size="50"/>
</tn-button>
</view>
</view>
</template>
<script lang="ts" setup>
import { onMounted, reactive, ref } from 'vue';
import request from '@/utils/request';
import { onLoad } from "@dcloudio/uni-app";
import TnCountScroll from '@/uni_modules/tuniaoui-vue3/components/count-scroll/src/count-scroll.vue'
import TnDateTimePicker from '@/uni_modules/tuniaoui-vue3/components/date-time-picker/src/date-time-picker.vue'
import onShare from '@/utils/share';
const { onShareAppMessage,onShareTimeline } = onShare()
const shareTitle = ref()
const shareParam = ref()
const color = ref();
const flag = ref(false);
const orgId = ref();
const openDateTimePicker = ref(false);
const projectData = reactive({
dateMonth:'',
title:'',
organizationName:'',
pre_intro:'',
investment:0,
project_list:'',
industry:0,
goverment:0,
explan:''
})
const dateTimeValue = ref();
const menuData = reactive({
pic:'',
title:'',
color:'',
description:''
})
const showPicker = () => {
openDateTimePicker.value = true
}
const getDate = (value:string) => {
getProjectData(value)
}
const getMenuData = (id:number) => {
request({
url:'/front/report/menu',
method:'GET',
data:{menuId:id}
}).then((res:any)=>{
if(res.data.code === 0){
Object.assign(menuData,res.data.data)
shareParam.value = res.data.data.menuId
color.value = res.data.data.color
}else{
uni.showToast({
icon:'none',
title:res.data.message
})
}
})
}
const downloadFile = (file:any) => {
uni.downloadFile({
url:file.href,
success(res) {
if (res.statusCode === 200) {
uni.saveFile({
tempFilePath: res.tempFilePath, //临时路径
success: function(res) {
uni.showToast({
icon: 'none',
mask: true,
title: '文件已保存:' + res.savedFilePath, //保存路径
duration: 3000,
});
setTimeout(() => {
//打开文档查看
uni.openDocument({
filePath: res.savedFilePath,
showMenu: true,
success: function() {
console.log('打开文档成功');
}
});
}, 3000)
}
})
console.log('下载成功');
}
},
fail: (err) => {
console.log(err);
uni.showToast({
icon: 'none',
mask: true,
title: '失败请重新下载',
});
},
})
}
const getProjectData = (date:string) => {
request({
url:'/front/report/project/summary',
method:'GET',
data:{id:orgId.value,month:date}
}).then((res:any) => {
if(res.data.code === 0){
Object.assign(projectData,res.data.data)
shareTitle.value = res.data.data.title
}else{
uni.showToast({
icon:'none',
title:res.data.message
})
}
flag.value = true
})
}
onShareAppMessage(() => {
return {
title:shareTitle.value,
path:'/pages/report/project/build/child/index?mid=' + shareParam.value + '&id=' + orgId.value
}
})
onShareTimeline(() => {
return {
title:shareTitle.value,
path:'/pages/report/project/build/child/index?mid=' + shareParam.value + '&id=' + orgId.value
}
})
onLoad((option)=>{
getMenuData(option.mid)
orgId.value = option.id
})
onMounted(()=>{
getProjectData('')
})
</script>
<style lang="scss" scoped>
.project-summary {
position: relative;
width: 100%;
height: 450rpx;
z-index: 2;
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: linear-gradient(
0deg,
rgba(0, 0, 0, 0.4) 0%,
rgba(0, 0, 0, 0) 100%
);
z-index: 1;
}
.summary-content {
position: absolute;
left: 0;
bottom: 80rpx;
width: 100%;
padding: 0rpx 30rpx;
z-index: 2;
display: flex;
align-items: center;
.summary-info {
flex: 1;
color: #fff;
.title {
font-size: 52rpx;
font-weight: bold;
letter-spacing: 8rpx;
text-shadow: 4rpx 4rpx 10rpx #585858;
}
.desc {
font-size: 34rpx;
margin-top: 20rpx;
letter-spacing: 4rpx;
text-shadow: 4rpx 4rpx 10rpx #585858;
}
}
}
}
.project-container{
position: relative;
top: -40rpx;
z-index: 99;
background-color: #fff;
border-radius: 40rpx 40rpx 0 0;
.title-container {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
line-height: 1;
.left {
flex: 1;
.title {
font-size: 40rpx;
font-weight: bold;
}
.desc {
margin-top: 32rpx;
}
}
.right {
flex-grow: 0;
flex-shrink: 0;
display: flex;
flex-direction: column;
align-items: center;
margin-left: 20rpx;
.icon {
font-size: 70rpx;
}
.text {
font-size: 26rpx;
margin-top: 10rpx;
}
}
}
.project-detail {
position: relative;
border-radius: 20rpx 20rpx 0 0;
z-index: 10;
.text{
letter-spacing: 4rpx;
text-align: justify;
}
.topic-item {
& + .topic-item {
margin-top: 36rpx;
}
}
.project-review{
.review-item{
width: 50%;
box-sizing: border-box;
}
}
}
}
.park-container {
width: fit-content;
height:100%;
.scroll-item {
flex-grow: 1;
.empty {
width: 100rpx;
height: 100rpx;
border-radius: 15rpx;
}
.title {
margin-top: 10rpx;
}
}
}
.picker-btn{
position: fixed;
z-index: 999;
right: 40rpx;
bottom: 60rpx;
}
</style>