From efb4a0724b286851e332bcb2e704d67562743d81 Mon Sep 17 00:00:00 2001
From: mixtan <424491071@qq.com>
Date: Wed, 18 Jun 2025 15:50:39 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0404=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=EF=BC=8C=E5=BD=93=E8=AE=BF=E9=97=AE=E4=B8=8D=E5=AD=98=E5=9C=A8?=
=?UTF-8?q?=E8=B5=84=E6=BA=90=E6=97=B6=E8=B7=B3=E8=BD=AC404=E9=A1=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components.d.ts | 1 +
src/components/PageNotFound.vue | 33 +++++++++++++++++++++++++++++++++
src/router/index.ts | 8 ++++++++
src/views/HeadMenu.vue | 12 ++++++------
src/views/index/slider.vue | 30 ++++++++++++++++++++++++++++--
5 files changed, 76 insertions(+), 8 deletions(-)
create mode 100644 src/components/PageNotFound.vue
diff --git a/components.d.ts b/components.d.ts
index 6b2082f..61bef71 100644
--- a/components.d.ts
+++ b/components.d.ts
@@ -37,6 +37,7 @@ declare module 'vue' {
ElUpload: typeof import('element-plus/es')['ElUpload']
FloatingMenu: typeof import('./src/components/floatingMenu.vue')['default']
Login: typeof import('./src/components/login.vue')['default']
+ PageNotFound: typeof import('./src/components/PageNotFound.vue')['default']
Register: typeof import('./src/components/register.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
diff --git a/src/components/PageNotFound.vue b/src/components/PageNotFound.vue
new file mode 100644
index 0000000..eda2a45
--- /dev/null
+++ b/src/components/PageNotFound.vue
@@ -0,0 +1,33 @@
+
+
+
+
+ 返回首页
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/router/index.ts b/src/router/index.ts
index 2854c0f..5503591 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -45,6 +45,14 @@ const routes=[
isFullpage: true
}
},
+ {
+ path:'/:pathMatch(.*)*',
+ name:'NotFound',
+ component:()=>import('@/components/PageNotFound.vue'),
+ meta:{
+ isFullpage: true
+ }
+ },
];
const router = createRouter({
history:createWebHistory(),
diff --git a/src/views/HeadMenu.vue b/src/views/HeadMenu.vue
index e4607c4..2f115ed 100644
--- a/src/views/HeadMenu.vue
+++ b/src/views/HeadMenu.vue
@@ -20,7 +20,7 @@
{{
- approval_status == 4 || !isLoggedIn ? "立即入驻" : "查看审核状态"
+ approval_status == -1 || approval_status == 4 || !isLoggedIn ? "立即入驻" : "查看审核状态"
}}
@@ -38,7 +38,7 @@
{{ mobile }}
@@ -101,7 +101,7 @@ const userStore = useUserStore();
// 从 userStore 中获取登录状态
const isLoggedIn = ref(userStore.isLoggedIn);
const mobile = ref("");
-const approval_status = ref(0);
+const approval_status = ref(-1);
// 每次页面加载时检查 token
onMounted(() => {
@@ -144,15 +144,15 @@ const handleOpenStartPage = () => {
return;
}
- if (approval_status.value == 4) {
+ if (approval_status.value == -1 || approval_status.value == 4) {
router.push({ name: "start" });
} else {
- router.push({ name: "check" }); // 已登录跳转到 check 页面
+ router.push({ name: "check" });
}
};
const handleUserInfoClick = () => {
- if (approval_status.value == 4) {
+ if (approval_status.value == -1 || approval_status.value == 4) {
router.push({ name: "start" });
} else {
router.push({ name: "check" });
diff --git a/src/views/index/slider.vue b/src/views/index/slider.vue
index d83dfc2..8f2930d 100644
--- a/src/views/index/slider.vue
+++ b/src/views/index/slider.vue
@@ -84,7 +84,16 @@ import { useTransition } from "@vueuse/core";
import { ref, onMounted, defineEmits } from "vue";
import { Promotion, Download } from "@element-plus/icons-vue";
import { ElMessage } from 'element-plus'
+import { getApproval_status } from "@/api/login";
+import { useRouter } from "vue-router";
+import { useUserStore } from "@/stores/userStore";
+
+const router = useRouter();
+const userStore = useUserStore();
+
+const isLoggedIn = ref(userStore.isLoggedIn);
+const approval_status = ref(-1);
const businessman = ref(0);
const product = ref(0);
const member = ref(0);
@@ -93,8 +102,16 @@ const order = ref(0);
const emits = defineEmits(["open-register-form"]);
const openRegisterForm = () => {
- console.log(1111);
- emits("open-register-form");
+ if (!isLoggedIn.value) {
+ emits("open-register-form");
+ return;
+ }
+
+ if (approval_status.value == -1 || approval_status.value == 4) {
+ router.push({ name: "start" });
+ } else {
+ router.push({ name: "check" }); // 已登录跳转到 check 页面
+ }
};
const downAndroid = ()=>{
@@ -125,6 +142,15 @@ const formatter = (value: number) => {
const formatter2 = (value: number) => {
return `${Math.round(value)}k+`;
};
+
+onMounted(()=>{
+ getApproval_status().then((res) => {
+ if (res.code === 0 && res.status === 200) {
+ approval_status.value = res.data.approval_status;
+ console.log("res.data.approval_status", res.data.approval_status);
+ }
+ });
+})