|
@@ -1,3 +1,175 @@
|
|
|
+<script setup lang="ts">
|
|
|
+import { computed, ref } from 'vue';
|
|
|
+
|
|
|
+import { t } from '@/i18n';
|
|
|
+import { addUnit } from '@/utils';
|
|
|
+
|
|
|
+import type { Component, CSSProperties } from 'vue';
|
|
|
+import type { UseGuideStepItem } from '@/types';
|
|
|
+
|
|
|
+interface Props {
|
|
|
+ title: string;
|
|
|
+ steps: UseGuideStepItem[];
|
|
|
+ contentOffset?: number;
|
|
|
+}
|
|
|
+
|
|
|
+const props = defineProps<Props>();
|
|
|
+
|
|
|
+const current = ref(0);
|
|
|
+
|
|
|
+const isFirstStep = computed(() => {
|
|
|
+ return current.value === 0;
|
|
|
+});
|
|
|
+
|
|
|
+const isLastStep = computed(() => {
|
|
|
+ return current.value === props.steps.length - 1;
|
|
|
+});
|
|
|
+
|
|
|
+const nextStepButtonText = computed(() => {
|
|
|
+ return isLastStep.value ? t('common.finishSetup') : t('common.nextStep');
|
|
|
+});
|
|
|
+
|
|
|
+const currentComponent = computed<Component>(() => {
|
|
|
+ return props.steps[current.value].component;
|
|
|
+});
|
|
|
+
|
|
|
+const contentStyle = computed<CSSProperties>(() => {
|
|
|
+ return {
|
|
|
+ paddingLeft: addUnit(props.contentOffset || 312),
|
|
|
+ };
|
|
|
+});
|
|
|
+
|
|
|
+const goNextStep = () => {
|
|
|
+ current.value++;
|
|
|
+};
|
|
|
+
|
|
|
+const goPrevStep = () => {
|
|
|
+ current.value--;
|
|
|
+};
|
|
|
+
|
|
|
+const finishCurrentStep = () => {
|
|
|
+ if (isLastStep.value) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ goNextStep();
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
<template>
|
|
|
- <slot></slot>
|
|
|
+ <ALayout class="use-guide-container">
|
|
|
+ <ALayoutSider class="use-guide-sider" :width="268">
|
|
|
+ <div class="use-guide-title">{{ title }}</div>
|
|
|
+ <div class="use-guide-steps">
|
|
|
+ <ASteps v-model:current="current" :items="steps" direction="vertical" />
|
|
|
+ </div>
|
|
|
+ <AButton class="use-guide-doc-button">
|
|
|
+ <img src="@/assets/img/file-black.png" />
|
|
|
+ {{ $t('common.viewDoc') }}
|
|
|
+ </AButton>
|
|
|
+ </ALayoutSider>
|
|
|
+ <ALayout>
|
|
|
+ <ALayoutContent class="use-guide-main" :style="contentStyle">
|
|
|
+ <Component :is="currentComponent" />
|
|
|
+ </ALayoutContent>
|
|
|
+ <ALayoutFooter class="use-guide-footer">
|
|
|
+ <AButton type="text" :disabled="isLastStep" @click="goNextStep">{{ $t('common.skip') }}</AButton>
|
|
|
+ <AButton type="text" :disabled="isFirstStep" @click="goPrevStep">{{ $t('common.return') }}</AButton>
|
|
|
+ <AButton type="primary" @click="finishCurrentStep">{{ nextStepButtonText }}</AButton>
|
|
|
+ </ALayoutFooter>
|
|
|
+ </ALayout>
|
|
|
+ </ALayout>
|
|
|
</template>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.use-guide-container {
|
|
|
+ height: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+.use-guide-sider {
|
|
|
+ padding-top: 46px;
|
|
|
+ padding-bottom: 34px;
|
|
|
+ background: #f0f0f0;
|
|
|
+
|
|
|
+ :deep(.ant-layout-sider-children) {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .use-guide-title {
|
|
|
+ margin-bottom: 26px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .use-guide-steps {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ :deep(.ant-steps) {
|
|
|
+ .ant-steps-item {
|
|
|
+ height: 80px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ant-steps-item-wait {
|
|
|
+ .ant-steps-item-icon {
|
|
|
+ background-color: initial;
|
|
|
+ border-color: var(--antd-color-fill);
|
|
|
+ }
|
|
|
+
|
|
|
+ .ant-steps-icon {
|
|
|
+ color: var(--antd-color-text-quaternary);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .ant-steps-item-process {
|
|
|
+ .ant-steps-item-title {
|
|
|
+ font-weight: 500;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .ant-steps-item-finish {
|
|
|
+ .ant-steps-item-icon {
|
|
|
+ background-color: initial;
|
|
|
+ border-color: var(--antd-color-primary);
|
|
|
+ }
|
|
|
+
|
|
|
+ .ant-steps-item-title {
|
|
|
+ color: var(--antd-color-text-secondary);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .ant-steps-item-process,
|
|
|
+ .ant-steps-item-wait {
|
|
|
+ .ant-steps-item-tail::after {
|
|
|
+ background-color: var(--antd-color-fill);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .use-guide-doc-button {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ img {
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.use-guide-main {
|
|
|
+ padding-top: 60px;
|
|
|
+ overflow: auto;
|
|
|
+ background: var(--antd-color-bg-base);
|
|
|
+}
|
|
|
+
|
|
|
+.use-guide-footer {
|
|
|
+ padding-right: 211px;
|
|
|
+ padding-left: 187px;
|
|
|
+ background: var(--antd-color-bg-base);
|
|
|
+
|
|
|
+ button:last-of-type {
|
|
|
+ float: right;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|