sign-stream/src/views/upload-id-card/index.vue

106 lines
2.7 KiB
Vue
Raw Normal View History

2024-01-31 08:18:27 +00:00
<script setup>
2024-02-05 05:10:46 +00:00
import steps from '@/components/steps/index.vue'
2024-02-05 08:27:29 +00:00
import one from './content/one.vue'
import { useRoute, useRouter } from 'vue-router'
import two from './content/two.vue'
import three from './content/three.vue'
import {computed, ref} from "vue";
const route = useRoute()
const router = useRouter()
const active = ref(Number(route.params.active))
const buttons = ref([{label: "下一步", type: "next"}])
const contentComputed = computed(() => {
switch (active.value) {
case 0:
return one
case 1:
return two
case 2:
return three
}
})
const stepsClick = (item) => {
switch (active.value) {
case 0:
active.value=1
router.replace(`/title-forward/upload-id-card/${1}`)
buttons.value = [{label: "上一步", type: "back"}, {label: "下一步", type: "next"}]
break
case 1:
if (item.type === 'next') {
active.value=2
router.replace(`/title-forward/upload-id-card/${2}`)
2024-02-05 08:51:32 +00:00
buttons.value = [{label: "上一步", type: "back"}, {label: "提交", type: "submit"}]
2024-02-05 08:27:29 +00:00
} else if (item.type === 'back') {
active.value=0
router.replace(`/title-forward/upload-id-card/${0}`)
buttons.value = [{label: "下一步", type: "next"}]
}
break
case 2:
if (item.type === 'next') {
active.value=3
router.replace(`/title-forward/upload-id-card/${3}`)
buttons.value = [{label: "上一步", type: "back"}, {label: "提交", type: "submit"}]
} else if (item.type === 'back') {
active.value=1
router.replace(`/title-forward/upload-id-card/${1}`)
buttons.value = [{label: "上一步", type: "back"}, {label: "下一步", type: "next"}]
}
break
}
}
2024-01-31 08:18:27 +00:00
</script>
<template>
2024-02-05 05:10:46 +00:00
<div class="container">
2024-02-05 08:27:29 +00:00
<steps v-model:active="active"/>
<div class="content">
<component :is="contentComputed"/>
</div>
2024-02-05 05:10:46 +00:00
<div class="bottom-btn">
2024-02-05 08:27:29 +00:00
<div class="item" @click="stepsClick(item)" v-for="item in buttons"
:class="[item.type==='back'?'back':'']">
2024-02-05 05:10:46 +00:00
{{ item.label }}
</div>
</div>
</div>
2024-01-31 08:18:27 +00:00
</template>
<style scoped lang="scss">
2024-02-05 05:10:46 +00:00
.container {
box-sizing: border-box;
padding-top: 14px;
padding-right: 21px;
padding-left: 21px;
2024-02-05 08:27:29 +00:00
.content {
margin-top: 20px;
}
.bottom-btn {
width: 100%;
2024-02-05 05:10:46 +00:00
display: flex;
justify-content: center;
2024-01-31 08:18:27 +00:00
2024-02-05 08:27:29 +00:00
.item {
display: flex;
justify-content: center;
align-items: center;
color: #fff;
font-size: 16px;
border-radius: 20px;
width: 142px;
height: 32px;
background-color: #2159C4;
&.back {
background-color: #24437E;
margin-right: 30px;
}
}
}
2024-02-05 05:10:46 +00:00
}
2024-01-31 08:18:27 +00:00
</style>