intro.vue
4.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!--
* @Date: 2024-04-10 16:08:09
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-04-12 15:31:51
* @FilePath: /fxPark/src/views/fxPark/intro.vue
* @Description: 文件描述
-->
<template>
<div class="intro-page">
<div></div>
<div style="margin: 1rem;">
<div style="margin-bottom: 1rem;">
<span style="font-size: 1.25rem;">{{ tree_data?.name }}</span>
<span style="font-size: 0.85rem;">{{ tree_data?.nickname }}</span>
</div>
<div style="border: 1px solid #000; padding: 1rem; border-radius: 8px;">
<div style="margin-bottom: 1.5rem;"><span style="background-color: #D0FCF0; padding: 0.5rem 0.75rem; border-radius: 1rem;">植被类型:</span> {{ tree_data?.type }}</div>
<div style="margin-bottom: 1.5rem;"><span style="background-color: #D0FCF0; padding: 0.5rem 0.75rem; border-radius: 1rem;">植被学名:</span> {{ tree_data?.study_name }}</div>
<div style="margin-bottom: 1.5rem;white-space: pre-wrap;line-height: 1.8;">
{{ tree_data?.note }}
</div>
<div style="margin-bottom: 1rem;"><span style="background-color: #D0FCF0; padding: 0.5rem 0.75rem; border-radius: 1rem;">植被介绍:</span></div>
<div class="tree-intro" v-html="formattedIntro"></div>
</div>
</div>
<div class="task-tips">
<div class="title-wrapper">
<span class="title-text">任务卡</span>
</div>
<div class="task-wrapper">
<div class="task-title">{{ tree_data?.mission_title }}</div>
<div class="tree-mission-note" v-html="formattedNote"></div>
</div>
</div>
<div class="light-up-text">恭喜您植被已被点亮</div>
<div style="margin: 1rem 1rem 2rem 1rem; color: white; text-align: center;">
<div @click="goToPoster" style="background-color: #F68015; display: inline-block; padding: 0.7rem 2rem; border-radius: 1.5rem;">生成海报</div>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
//import { } from '@/utils/generateModules.js'
//import { } from '@/utils/generateIcons.js'
//import { } from '@/composables'
import { getTreeAPI, activeTreeAPI } from '@/api/carbon.js';
const $route = useRoute();
const $router = useRouter();
useTitle($route.meta.title);
const revision = $route.query.revision; // revision 植被编号
const tree_data = ref({});
onMounted(async () => {
const { code, data } = await getTreeAPI();
if (code) {
let index = data.findIndex(item => item.revision == revision); // 植被信息index
tree_data.value = data[index];
// 植被介绍样式
nextTick(() => {
$('.tree-intro').find('p').css('lineHeight', '1.8').css('marginBottom', '0.5rem');
$('.tree-mission-note').find('p').css('lineHeight', '1.8').css('marginBottom', '0.5rem');
})
}
// 进入页面激活
const activeTree = await activeTreeAPI({ tree_revision: revision });
});
const formattedIntro = computed(() => {
return tree_data?.value?.intro?.split("\n").map((line) => `<p>${line}</p>`).join("");
});
const formattedNote = computed(() => {
return tree_data?.value?.mission_note?.split("\n").map((line) => `<p>${line}</p>`).join("");
});
const goToPoster = () => {
$router.push({
path: '/poster',
query: {
revision
}
});
};
</script>
<style lang="less" scoped>
.intro-page {
display: flex;
flex-direction: column;
.task-tips {
.title-wrapper {
text-align: center;
.title-text {
font-size: 24px;
font-weight: bold;
color: #BBFEE2; /* 文字颜色 */
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
}
.task-wrapper {
border: 1px solid #000;
margin: 1rem;
padding: 1rem;
border-radius: 10px;
background: linear-gradient(to bottom, #FBFFE9, #BEE9F8);
text-align: center;
.task-title {
background-color: #D6F4BD;
padding: 0.5rem 1.5rem;
border-radius: 1.5rem;
display: inline-block;
font-weight: bold;
margin-bottom: 1rem;
}
}
}
.light-up-text {
text-align: center;
font-size: 24px;
font-weight: bold;
color: #F8E9C1; /* 文字颜色 */
text-shadow:
-1px -1px 0 #000,
1px -1px 0 #000,
-1px 1px 0 #000,
1px 1px 0 #000;
margin: 1rem 0;
}
}
</style>