修复由于没有根节点导致的其他页面不显示

This commit is contained in:
lingling 2025-02-26 21:12:23 +08:00
parent 6186c68bc8
commit 95ebce0990
1 changed files with 91 additions and 90 deletions

View File

@ -1,84 +1,87 @@
<template>
<div class="container">
<Breadcrumb :items="['menu.promotion', 'menu.promotion.Table']" />
<a-card class="general-card" :title="$t('menu.promotion.Table') + invite_code">
<a-row style="padding: 20px;">
<a-col :flex="1">
<a-form :model="queryParams" :label-col-props="{ span: 6 }" :wrapper-col-props="{ span: 18 }"
label-align="left">
<a-row :gutter="16">
<a-col :span="18">
<a-form-item field="createdTime" :label="'按照时间查询'">
<a-range-picker v-model="queryParams" style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-col>
<a-col :flex="'86px'" style="text-align: right">
<a-space :size="18">
<a-button type="primary" @click="search">
<template #icon>
<icon-search />
</template>
查询
</a-button>
<a-button @click="reset">
<template #icon>
<icon-refresh />
</template>
重置
</a-button>
</a-space>
</a-col>
</a-row>
<div class="left-side">
<div>
<div class="panel">
<div class="container">
<Breadcrumb :items="['menu.promotion', 'menu.promotion.Table']" />
<a-card class="general-card" :title="$t('menu.promotion.Table') + invite_code">
<a-row style="padding: 20px;">
<a-col :flex="1">
<a-form :model="queryParams" :label-col-props="{ span: 6 }" :wrapper-col-props="{ span: 18 }"
label-align="left">
<a-row :gutter="16">
<a-col :span="18">
<a-form-item field="createdTime" :label="'按照时间查询'">
<a-range-picker v-model="queryParams" style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-col>
<a-col :flex="'86px'" style="text-align: right">
<a-space :size="18">
<a-button type="primary" @click="search">
<template #icon>
<icon-search />
</template>
查询
</a-button>
<a-button @click="reset">
<template #icon>
<icon-refresh />
</template>
重置
</a-button>
</a-space>
</a-col>
</a-row>
<div class="left-side">
<a-grid :cols="24" :row-gap="16" class="panel">
<a-grid-item class="panel-col" :span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 8 }">
<a-space>
<a-avatar :size="54" class="col-avatar">
<img alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/288b89194e657603ff40db39e8072640.svg~tplv-49unhts6dw-image.image" />
</a-avatar>
<a-statistic :title="'注册人数'" :value="data.register" :value-from="0" animation show-group-separator>
<template #suffix>
<span class="unit"></span>
</template>
</a-statistic>
</a-space>
</a-grid-item>
<a-grid-item class="panel-col" :span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 8 }">
<a-space>
<a-avatar :size="54" class="col-avatar">
<img alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/fdc66b07224cdf18843c6076c2587eb5.svg~tplv-49unhts6dw-image.image" />
</a-avatar>
<a-statistic :title="'绑定人数'" :value="data.binding" :value-from="0" animation show-group-separator>
<template #suffix>
<span class="unit">{{ $t('workplace.pecs') }}</span>
</template>
</a-statistic>
</a-space>
</a-grid-item>
</a-grid>
<div class="panel">
<a-grid :cols="24" :row-gap="16" class="panel">
<a-grid-item class="panel-col" :span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 8 }">
<a-space>
<a-avatar :size="54" class="col-avatar">
<img alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/288b89194e657603ff40db39e8072640.svg~tplv-49unhts6dw-image.image" />
</a-avatar>
<a-statistic :title="'注册人数'" :value="data.register" :value-from="0" animation show-group-separator>
<template #suffix>
<span class="unit"></span>
</template>
</a-statistic>
</a-space>
</a-grid-item>
<a-grid-item class="panel-col" :span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 8 }">
<a-space>
<a-avatar :size="54" class="col-avatar">
<img alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/fdc66b07224cdf18843c6076c2587eb5.svg~tplv-49unhts6dw-image.image" />
</a-avatar>
<a-statistic :title="'绑定人数'" :value="data.binding" :value-from="0" animation show-group-separator>
<template #suffix>
<span class="unit">{{ $t('workplace.pecs') }}</span>
</template>
</a-statistic>
</a-space>
</a-grid-item>
</a-grid>
</div>
</div>
</a-card>
</div>
</a-card>
</div>
<div >
</div>
<div>
<a-row>
<a-col :span="12">
<div>注册的用户</div>
<a-table :data="data.register_user">
<template #columns>
<a-table-column title="用户id" data-index="id"></a-table-column>
<a-table-column title="用户名称" data-index="username"></a-table-column>
@ -97,7 +100,7 @@
<a-col :span="12">
<div>绑定手机号的用户</div>
<a-table :data="data.binding_user">
<template #columns>
<a-table-column title="用户id" data-index="id"></a-table-column>
<a-table-column title="用户名称" data-index="username"></a-table-column>
@ -117,6 +120,7 @@
</div>
</div>
</template>
<script setup>
@ -130,8 +134,8 @@ import dayjs from 'dayjs';
import { useRoute } from 'vue-router';
const route = useRoute()
const invite_code = ref(route.params.invite_code)
import router from '@/router';
const invite_code = ref("")
// const data = reactive({
// register: 0,
@ -143,24 +147,21 @@ const data = ref({
register_user: [], //
binding_user: [] //
});
const queryParams = ref([dayjs().subtract(1, 'day').format("YYYY-MM-DD"), dayjs().format("YYYY-MM-DD")])
onMounted(async () => {
//
const startDate = dayjs().format("YYYY-MM-DD");
const endDate = startDate; //
try {
const res = await detailed(invite_code.value, queryParams.value[0], queryParams.value[1]); //
//
data.value.register = res.data.register;
data.value.binding = res.data.binding;
data.value.register_user = res.data.register_user;
data.value.binding_user = res.data.binding_user;
} catch (error) {
console.error("Error fetching data:", error);
//
if (route.params.invite_code) {
invite_code.value = route.params.invite_code
} else {
router.go(-1)
}
const res = await detailed(invite_code.value, queryParams.value[0], queryParams.value[1]); //
//
data.value.register = res.data.register;
data.value.binding = res.data.binding;
data.value.register_user = res.data.register_user;
data.value.binding_user = res.data.binding_user;
});
const reset = () => { }
const search = async () => {
@ -172,7 +173,7 @@ const search = async () => {
data.value.register_user = res.data.register_user;
data.value.binding_user = res.data.binding_user;
}
const queryParams = ref([dayjs().subtract(1, 'day').format("YYYY-MM-DD"), dayjs().format("YYYY-MM-DD")])
</script>