lushixing 3 周之前
父节点
当前提交
8b40ebc5b7
共有 7 个文件被更改,包括 22 次插入9 次删除
  1. 0 1
      components.d.ts
  2. 12 3
      src/router/permission.ts
  3. 5 0
      src/styles/index.scss
  4. 1 1
      src/utils/location.ts
  5. 1 1
      src/utils/request.ts
  6. 1 1
      src/views/chat.vue
  7. 2 2
      src/views/index.vue

+ 0 - 1
components.d.ts

@@ -36,7 +36,6 @@ declare module 'vue' {
     NResult: typeof import('naive-ui')['NResult']
     NSelect: typeof import('naive-ui')['NSelect']
     NSpin: typeof import('naive-ui')['NSpin']
-    NTooltip: typeof import('naive-ui')['NTooltip']
     Pagination: typeof import('./src/components/Pagination/index.vue')['default']
     RouterLink: typeof import('vue-router')['RouterLink']
     RouterView: typeof import('vue-router')['RouterView']

+ 12 - 3
src/router/permission.ts

@@ -4,13 +4,22 @@ import type { Router } from 'vue-router'
 NProgress.configure({
   showSpinner: false
 })
+const VALID_PARAM_NAME = 'tkn_8f9a1c7b3e24fd'
+const VALID_ACCESS_KEY = 'c154d4a7-dad3-45d0-a11f-07893dd4fbba'
 
 export function createRouterGuards(router: Router) {
 
   router.beforeEach(async (to, from, next) => {
-
-    NProgress.start()
-    next()
+    const accessKey = to.query[VALID_PARAM_NAME]
+    if (accessKey !== VALID_ACCESS_KEY && location.hostname.includes('zszs.gloria.com.cn')) {
+      // 可以跳转到提示页面,或者终止导航
+      next(false) // 阻止路由跳转
+      // eslint-disable-next-line no-alert
+      window.alert('禁止访问:缺少或无效的访问凭证')
+    } else {
+      NProgress.start()
+      next()
+    }
   })
 
   router.afterEach(() => {

+ 5 - 0
src/styles/index.scss

@@ -14,6 +14,11 @@ body {
   --at-apply: bg-#fff;
 }
 
+#app {
+  max-width: 750px;
+  margin: 0 auto;
+}
+
 html {
   font-size: 14px;
   box-sizing: border-box;

+ 1 - 1
src/utils/location.ts

@@ -1,7 +1,7 @@
 const locationHost = {
   hostname: 'localhost',
   baseApiIp: 'http://10.41.1.57:5666',
-  baseApi: 'http://10.41.1.57:5666'
+  baseApi: location.hostname.includes('zszs.gloria.com.cn') ? 'https://zszs.gloria.com.cn:8888' : 'http://10.41.1.57:5666'
 }
 
 const hostList = [

+ 1 - 1
src/utils/request.ts

@@ -8,6 +8,7 @@ import Cookie from 'js-cookie'
 import Router from '@/router'
 import { currentHost } from '@/utils/location'
 
+
 // redirect error
 function errorRedirect(url: string) {
   Router.push(`/${ url }`)
@@ -34,7 +35,6 @@ const codeMessage: {
   503: '服务不可用,服务器暂时过载或维护。',
   504: '网关超时。'
 }
-
 // 创建axios实例
 const service: AxiosInstance = axios.create({
   // api 的 base_url

+ 1 - 1
src/views/chat.vue

@@ -387,7 +387,7 @@ handleResetState()
         pb-20
         style="align-items: center;justify-content: center;color: #999;"
       >
-        Hi,有任何关于这个知识库的问题,都尽管问!
+        Hi,有任何关于导购知识问题,都尽管问!
       </div>
 
       <div

+ 2 - 2
src/views/index.vue

@@ -102,9 +102,9 @@ const gotoSearch = () => {
         flex="1 ~ col"
         min-h-0
         pb-20
-        style="align-items: center;justify-content: center;color: #999;font-size: 18px;"
+        style="align-items: center;justify-content: center;color: #999;font-size: 16px;"
       >
-        此页面功能在规划中,敬请期待...
+        欢迎大家在这里输入关键词咨询公司规则
       </div>
 
       <div