Skip to content

Commit

Permalink
remove data center
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuiantw1212 committed May 10, 2024
1 parent 8c1e703 commit 945797e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
35 changes: 25 additions & 10 deletions components/calculator/benchmark.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,39 @@
<el-card>
<template #header>
<div class="card-header card-header--custom">
<span>財務回顧
<span>回顧與匯出
</span>
<el-button v-loading="storyLoading" @click="generatStory">回顧</el-button>
<div>
<el-button v-loading="storyLoading" @click="generatStory">回顧</el-button>
<el-button @click="exportUserForm()">匯出</el-button>
</div>
</div>
</template>
<el-form label-width="auto">
<div v-html="chatGptStory">
<div v-if="modelValue.profile.story" v-html="modelValue.profile.story">

</div>
<div v-else>
點選右上角,讓我們回顧......
</div>
</el-form>
<!-- <template #footer>
<button @click="generatStory">看總結故事</button>
</template> -->
<template #footer>
<el-collapse>
<el-collapse-item title="匯出說明" name="1">
匯出給不敢登入又想保留紀錄的用戶使用。
<ul>
<li>按下匯出,會取得一包"開源財務規劃.json"。</li>
<li>下次使用就可直接匯入</li>
</ul>
</el-collapse-item>
</el-collapse>
</template>
</el-card>
</template>
<script setup lang="ts">
import { ref, computed, shallowRef, reactive, watch } from 'vue'
const { VITE_BASE_URL } = import.meta.env
const emits = defineEmits(['update:modelValue'])
const emits = defineEmits(['update:modelValue', 'export'])
const storyLoading = ref(false)
const props = defineProps({
modelValue: {
Expand All @@ -36,7 +50,6 @@ const props = defineProps({
}
},
})
const chatGptStory = ref('點選右上角,讓我們回顧......')
const userForm = computed(() => {
return props.modelValue
})
Expand All @@ -51,7 +64,6 @@ async function generatStory() {
})
const resJson = await res.text()
storyLoading.value = false
chatGptStory.value = resJson
userForm.value.profile.story = resJson
emits('update:modelValue', userForm.value)
}
Expand All @@ -75,7 +87,7 @@ function getHumanStory() {
// profile
story += `你於${Math.floor(yearOfBirth)}年,來到個世界上,`
story += `於${Math.floor(yearOfBirth + totalAge)}年時,悄悄的離開,`
story += `在這${totalAge}間,你有著屬於自己的故事。`
story += `在這${Math.floor(totalAge)}間,你有著屬於自己的故事。`
// career
const insuranceTypeItem = insuranceTypes.find(item => item.value === careerInsuranceType)
if (insuranceTypeItem) {
Expand Down Expand Up @@ -119,6 +131,9 @@ function getHumanStory() {
story += `你在${retireAge}歲時選擇退休,並維持著${qualityLevelLabel[qualityLevel - 1]}的退休生活,直到生命的最後一天。`
return story
}
async function exportUserForm() {
emits('export')
}
</script>
<style lang="scss">
.card-header--custom {
Expand Down
7 changes: 4 additions & 3 deletions components/calculator/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@

<h2 id="_試算結果" tabindex="-1">試算結果<a class="header-anchor" href="#試算結果"
aria-label="Permalink to &quot;試算結果&quot;">&ZeroWidthSpace;</a></h2>
<Bechmark v-model="userForm" :config="config" @update:model-value="onProfileChanged()"></Bechmark>
<Bechmark v-model="userForm" :config="config" @update:model-value="onProfileChanged()"
@export="exportUserForm()">
</Bechmark>
<br>
<DataCenter @export="exportUserForm()"></DataCenter>
</div>
</template>
<script setup lang="ts">
Expand All @@ -106,7 +107,6 @@ import Parenting from './parenting.vue'
import Mortgage from './mortgage.vue'
import EstateDialogContent from './estateDialog.vue'
import Bechmark from './benchmark.vue'
import DataCenter from './dataCenter.vue'
const { VITE_BASE_URL } = import.meta.env
const ProfileRef = ref()
const CareerRef = ref()
Expand Down Expand Up @@ -265,6 +265,7 @@ const userForm = reactive({
lifeExpectancy: 0,
yearOfMarriage: '',
careerInsuranceType: '',
story: '',
},
career: {
headCount: 0,
Expand Down
2 changes: 1 addition & 1 deletion components/calculator/mortgage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
</el-form>
<template #footer>
<el-collapse>
<el-collapse-item title="試算說明" name="1" :border="true">
<el-collapse-item title="試算說明" name="1">
<ul>
<li>
假設依靠投資籌措頭期款
Expand Down

0 comments on commit 945797e

Please sign in to comment.