lushixing 3 veckor sedan
förälder
incheckning
b143b335d9

+ 3 - 0
components.d.ts

@@ -24,10 +24,13 @@ declare module 'vue' {
     NavigationNavOctocat: typeof import('./src/components/Navigation/NavOctocat.vue')['default']
     NavigationNavSideBar: typeof import('./src/components/Navigation/NavSideBar.vue')['default']
     NButton: typeof import('naive-ui')['NButton']
+    NCard: typeof import('naive-ui')['NCard']
     NConfigProvider: typeof import('naive-ui')['NConfigProvider']
     NDialogProvider: typeof import('naive-ui')['NDialogProvider']
     NEmpty: typeof import('naive-ui')['NEmpty']
     NFloatButton: typeof import('naive-ui')['NFloatButton']
+    NForm: typeof import('naive-ui')['NForm']
+    NFormItem: typeof import('naive-ui')['NFormItem']
     NIcon: typeof import('naive-ui')['NIcon']
     NInput: typeof import('naive-ui')['NInput']
     NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider']

+ 0 - 1
public/favicon.svg

@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="undefined" height="undefined" viewBox="0 0 14 14"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M12.512 7.463a6 6 0 1 1-6-6m-6 6h6.923"/><path d="M6.512 1.463a10.357 10.357 0 0 0-2.308 6a10.357 10.357 0 0 0 2.308 6a10.357 10.357 0 0 0 2.142-4.615"/><path d="M7.404 3.97c-.35-.06-.35-.564 0-.625A3.176 3.176 0 0 0 9.963.895l.02-.097c.077-.347.57-.35.65-.003l.025.113a3.193 3.193 0 0 0 2.566 2.435c.352.061.352.568 0 .63a3.193 3.193 0 0 0-2.566 2.435l-.025.112c-.08.346-.573.344-.65-.003l-.02-.096a3.176 3.176 0 0 0-2.559-2.45Z"/></g></svg>

+ 4 - 1
src/components/Navigation/NavBar.vue

@@ -20,7 +20,10 @@ withDefaults(
 
 const gotoHome = () => {
   router.push({
-    name: 'Home'
+    name: 'Home',
+    query: {
+      tkn_8f9a1c7b3e24fd: 'c154d4a7-dad3-45d0-a11f-07893dd4fbba'
+    }
   })
 }
 

+ 1 - 1
src/router/child-routes.ts

@@ -2,7 +2,7 @@ const LayoutDefault = () => import('@/components/Layout/default.vue')
 
 const childrenRoutes: Array<RouteRecordRaw> = [
   {
-    path: '/chat',
+    path: '/chat-pages',
     component: LayoutDefault,
     name: 'ChatRoot',
     redirect: {

+ 3 - 4
src/router/permission.ts

@@ -11,11 +11,10 @@ export function createRouterGuards(router: Router) {
 
   router.beforeEach(async (to, from, next) => {
     const accessKey = to.query[VALID_PARAM_NAME]
-    if (accessKey !== VALID_ACCESS_KEY && location.hostname.includes('zszs.gloria.com.cn')) {
+    // location.hostname.includes('zszs.gloria.com.cn')
+    if (accessKey !== VALID_ACCESS_KEY && to.name !== 'Login' && location.hostname.includes('zszs.gloria.com.cn')) {
       // 可以跳转到提示页面,或者终止导航
-      next(false) // 阻止路由跳转
-      // eslint-disable-next-line no-alert
-      window.alert('禁止访问:缺少或无效的访问凭证')
+      next('/login') // 阻止路由跳转
     } else {
       NProgress.start()
       next()

+ 6 - 1
src/router/routes.ts

@@ -7,10 +7,15 @@ const routes: Array<RouteRecordRaw> = [
     component: () => import('@/views/index.vue')
   },
   {
-    path: '/search',
+    path: '/search-pages',
     name: 'Search',
     component: () => import('@/views/search.vue')
   },
+  {
+    path: '/login',
+    name: 'Login',
+    component: () => import('@/views/login.vue')
+  },
   ...childRoutes,
   {
     path: '/:pathMatch(.*)',

+ 8 - 2
src/views/index.vue

@@ -38,13 +38,19 @@ handleResetState()
 
 const gotoChat = () => {
   router.push({
-    name: 'ChatIndex'
+    name: 'ChatIndex',
+    query: {
+      tkn_8f9a1c7b3e24fd: 'c154d4a7-dad3-45d0-a11f-07893dd4fbba'
+    }
   })
 }
 
 const gotoSearch = () => {
   router.push({
-    name: 'Search'
+    name: 'Search',
+    query: {
+      tkn_8f9a1c7b3e24fd: 'c154d4a7-dad3-45d0-a11f-07893dd4fbba'
+    }
   })
 }
 

+ 124 - 0
src/views/login.vue

@@ -0,0 +1,124 @@
+<script lang="tsx" setup>
+import { useMessage } from 'naive-ui'
+
+const loading = ref(true)
+
+setTimeout(() => {
+  loading.value = false
+}, 700)
+
+const rules = {
+  username: [
+    {
+      required: true,
+      message: '请输入账号',
+      trigger: 'blur'
+    }
+  ],
+  password: [
+    {
+      required: true,
+      message: '请输入密码',
+      trigger: 'blur'
+    }
+  ]
+}
+
+const handleLogin = () => {
+  formRef.value?.validate((errors: any) => {
+    if (!errors) {
+      // 模拟登录逻辑
+      message.error('账号或密码有误!')
+      // 这里可以跳转或调用接口
+    } else {
+      message.error('请填写完整信息!')
+    }
+  })
+}
+
+const message = useMessage()
+
+const formRef = ref()
+const form = ref({
+  username: '',
+  password: ''
+})
+
+
+</script>
+
+<template>
+  <LayoutCenterPanel
+    :loading="loading"
+  >
+    <!-- 内容区域 -->
+    <div
+      flex="~ col"
+      h-full
+    >
+      <div
+        flex="1 ~ col"
+        min-h-0
+        class="login-black"
+      >
+        <div class="login-wrapper">
+          <n-card
+            title="登录"
+            class="login-card"
+            bordered
+          >
+            <n-form
+              ref="formRef"
+              :model="form"
+              :rules="rules"
+              label-placement="top"
+            >
+              <n-form-item
+                label="账号"
+                path="username"
+              >
+                <n-input
+                  v-model:value="form.username"
+                  placeholder="请输入账号"
+                />
+              </n-form-item>
+              <n-form-item
+                label="密码"
+                path="password"
+              >
+                <n-input
+                  v-model:value="form.password"
+                  type="password"
+                  placeholder="请输入密码"
+                />
+              </n-form-item>
+              <n-form-item>
+                <n-button
+                  type="primary"
+                  block
+                  @click="handleLogin"
+                >
+                  登录
+                </n-button>
+              </n-form-item>
+            </n-form>
+          </n-card>
+        </div>
+      </div>
+    </div>
+  </LayoutCenterPanel>
+</template>
+
+<style lang="scss">
+  .login-wrapper {
+    height: 100vh;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    background: #f5f7fa;
+  }
+
+  .login-card {
+    width: 320px;
+  }
+</style>

+ 4 - 1
src/views/search.vue

@@ -46,7 +46,10 @@ handleResetState()
 
 const gotoHome = () => {
   router.push({
-    name: 'Home'
+    name: 'Home',
+    query: {
+      tkn_8f9a1c7b3e24fd: 'c154d4a7-dad3-45d0-a11f-07893dd4fbba'
+    }
   })
 }
 function debounce<T extends (...args: any[]) => void>(