|
@@ -1,5 +1,6 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue';
|
|
import { computed } from 'vue';
|
|
|
|
+import { useRoute } from 'vue-router';
|
|
|
|
|
|
import { t } from '@/i18n';
|
|
import { t } from '@/i18n';
|
|
|
|
|
|
@@ -13,40 +14,45 @@ interface ConfigItem {
|
|
description: string;
|
|
description: string;
|
|
icon: string;
|
|
icon: string;
|
|
path: string;
|
|
path: string;
|
|
- done: boolean;
|
|
|
|
|
|
+ done?: boolean;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const route = useRoute();
|
|
|
|
+
|
|
const configList = computed<ConfigItem[]>(() => {
|
|
const configList = computed<ConfigItem[]>(() => {
|
|
- return [
|
|
|
|
|
|
+ const configs: ConfigItem[] = [
|
|
{
|
|
{
|
|
title: t('createCustomer.createCustomer'),
|
|
title: t('createCustomer.createCustomer'),
|
|
description: t('firstUsage.createCustomer'),
|
|
description: t('firstUsage.createCustomer'),
|
|
icon: createCustomer,
|
|
icon: createCustomer,
|
|
path: '/create-customer',
|
|
path: '/create-customer',
|
|
- done: true,
|
|
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: t('setupProtocol.setupProtocol'),
|
|
title: t('setupProtocol.setupProtocol'),
|
|
description: t('firstUsage.setupProtocol'),
|
|
description: t('firstUsage.setupProtocol'),
|
|
icon: setupProtocol,
|
|
icon: setupProtocol,
|
|
path: '/setup-protocol',
|
|
path: '/setup-protocol',
|
|
- done: false,
|
|
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: t('registerGateway.registerGateway'),
|
|
title: t('registerGateway.registerGateway'),
|
|
description: t('firstUsage.registerGateway'),
|
|
description: t('firstUsage.registerGateway'),
|
|
icon: registerGateway,
|
|
icon: registerGateway,
|
|
path: '/register-gateway',
|
|
path: '/register-gateway',
|
|
- done: false,
|
|
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: t('createDevice.createDevice'),
|
|
title: t('createDevice.createDevice'),
|
|
description: t('firstUsage.createDevice'),
|
|
description: t('firstUsage.createDevice'),
|
|
icon: createDevice,
|
|
icon: createDevice,
|
|
path: '/create-device',
|
|
path: '/create-device',
|
|
- done: false,
|
|
|
|
},
|
|
},
|
|
];
|
|
];
|
|
|
|
+
|
|
|
|
+ // 配置完成某一项时,路由查询参数 doneItems 会携带该项的页面路径,据此判断是否已经配置该项
|
|
|
|
+ configs.forEach((item) => {
|
|
|
|
+ item.done = route.query.doneItems?.includes(item.path);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return configs;
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -62,7 +68,7 @@ const configList = computed<ConfigItem[]>(() => {
|
|
:class="['config-container', { 'config-container-done': item.done }]"
|
|
:class="['config-container', { 'config-container-done': item.done }]"
|
|
v-for="(item, index) in configList"
|
|
v-for="(item, index) in configList"
|
|
:key="index"
|
|
:key="index"
|
|
- @click="$router.push(item.path)"
|
|
|
|
|
|
+ @click="$router.push({ path: item.path, query: route.query })"
|
|
>
|
|
>
|
|
<img class="config-icon" :src="item.icon" />
|
|
<img class="config-icon" :src="item.icon" />
|
|
<div>
|
|
<div>
|