Kaynağa Gözat

fix: 删除无用文件

Lee 1 hafta önce
ebeveyn
işleme
f0cf9fccbf

+ 0 - 0
app/composables/index.ts → app/api/index.ts


+ 0 - 70
app/api/user/login.ts

@@ -1,70 +0,0 @@
-/*
- * @Author: ChenYaJin
- * @Date: 2023-07-10 17:00:25
- * @LastEditors: wjc
- * @LastEditTime: 2023-11-30 15:08:59
- * @Description: 登录api
- */
-import { http } from '~/utils/fetch/index'
-import type { ILogin, ILoginToken, IAccount } from '@/models/login'
-import type { BasicResponse } from '@/models/common'
-
-/**
- * 登录
- * @param data ILogin
- * @returns
- */
-export function postLogin(data: ILogin) {
-  return http.request<BasicResponse<ILoginToken>>({
-    url: '/login',
-    method: 'post',
-    data,
-  })
-}
-
-/**
- * 注册
- * http://yapi.wisdomcity.com.cn/project/136/interface/api/21953
- * @param data IAccount
- * @returns
- */
-export function postRegister(data: IAccount) {
-  return http.request<BasicResponse<string>>({
-    url: '/ent/auth/register',
-    method: 'post',
-    data,
-  })
-}
-
-/**
- * 获取新的token
- * @param data clientId 设备指纹
- * @returns
- */
-export function postRefreshToken(data: { clientId: string }) {
-  return http.request<BasicResponse<ILoginToken>>({
-    url: '/auth/refresh',
-    method: 'post',
-    data,
-  })
-}
-
-/**
- * 获取账号信息
- */
-export function getAccountInfo(uuid: string) {
-  return http.request<BasicResponse<IAccount>>({
-    url: `/ent/auth/account/${uuid}`,
-    method: 'get',
-  })
-}
-/**
- * 修改密码
- */
-export function postAccountInfo(data: IAccount) {
-  return http.request<BasicResponse<boolean>>({
-    url: `/ent/auth/account`,
-    method: 'put',
-    data: data,
-  })
-}

+ 0 - 47
app/api/user/user.ts

@@ -1,47 +0,0 @@
-/*
- * @Author: ChenYaJin
- * @Date: 2023-07-11 14:28:24
- * @LastEditors: ChenYaJin
- * @LastEditTime: 2023-11-09 09:57:44
- * @Description: 当前企业用户api
- */
-import { http } from '~/utils/fetch/index'
-import type { BasicResponse } from '~/models/common'
-import { Enterprise, type IEnterprise } from '~/models/enterprise'
-
-/**
- * 获取当前企业用户的详细信息
- * @returns
- */
-export function getEnterpriseUser() {
-  return http.request<BasicResponse<Enterprise>>({
-    url: '/enterprise/detail',
-    method: 'get',
-  })
-}
-
-/**
- * 填写当前企业用户信息
- * @param data Enterprise
- * @returns
- */
-export function postEnterpriseUser(data: IEnterprise) {
-  return http.request<BasicResponse<number>>({
-    url: `/enterprise`,
-    method: 'post',
-    data,
-  })
-}
-
-/**
- * 修改当前企业用户信息
- * @param data Enterprise
- * @returns
- */
-export function putEnterpriseUser(id: string, data: IEnterprise) {
-  return http.request<BasicResponse<number>>({
-    url: `/enterprise/${id}`,
-    method: 'put',
-    data,
-  })
-}

+ 1 - 5
app/constants/index.ts

@@ -2,7 +2,7 @@
  * @Author: LiZhiWei
  * @Date: 2026-01-13 15:01:49
  * @LastEditors: LiZhiWei
- * @LastEditTime: 2026-01-15 14:14:24
+ * @LastEditTime: 2026-01-15 17:50:20
  * @Description:
  */
 import type { Config } from '~/types/config'
@@ -12,10 +12,6 @@ export const apiBase = import.meta.env.VITE_API_URL
 
 const config: Config = {
   websiteTitle: appName,
-  footerWrite: {
-    url: import.meta.env.VITE_INDEX_URL,
-    adminUrl: import.meta.env.VITE_ADMIN_URL,
-  },
   defaultSettings: {
     /**
      * @type String

+ 0 - 0
app/middleware/index.ts


+ 81 - 1
app/models/common.ts

@@ -2,7 +2,7 @@
  * @Author: LiZhiWei
  * @Date: 2026-01-13 15:01:49
  * @LastEditors: LiZhiWei
- * @LastEditTime: 2026-01-15 08:47:44
+ * @LastEditTime: 2026-01-15 17:51:48
  * @Description:
  */
 declare global {
@@ -37,6 +37,86 @@ declare global {
     id: string
     title: string
   }
+
+  type BasicResponse<T = any> = {
+    code: number
+    message: string
+    data: T
+  }
+
+  /**
+   * 接口返回数据模型
+   */
+  type ApiResponse<T = unknown> = {
+    data: BasicResponse<T>
+  }
+
+  /**
+   * table
+   */
+  type TableData<T = unknown> = {
+    list: Array<T>
+    pageSize?: number
+    pageNum?: number
+    pages?: number
+    total?: number
+  }
+
+  type Page = {
+    pageSize?: number
+    pageNum?: number
+    isPage?: boolean
+  }
+
+  /**
+   * dialog数据
+   */
+  type ModalData<T = unknown> = {
+    isShow?: boolean
+    type?: string
+    loading?: boolean
+    row?: T
+    title?: string
+  }
+
+  /**
+   * 枚举
+   */
+  type IOption = {
+    id?: string
+    code?: string
+    value?: string
+    name?: string
+    label?: string
+    type?: string
+    leaf?: boolean
+    children?: IOption[]
+  }
+
+  /**
+   * 表单验证
+   */
+  type IFormValidateCallback = {
+    (message?: string | Error | undefined): Error | void
+  }
+
+  type IFormValidator = (
+    rule: {
+      field: string
+    },
+    value: string,
+    callback: IFormValidateCallback
+  ) => void
+
+  type FormRuleItemParams = {
+    required?: boolean
+    message?: string
+    validator?: IFormValidator
+    trigger?: string
+  }
+  type AnyObject<T = unknown> = {
+    [key: string]: T
+  }
 }
 
 export {}

+ 0 - 140
app/stores/user/login.ts

@@ -1,140 +0,0 @@
-/*
- * @Author: ChenYaJin
- * @Date: 2023-07-04 11:07:44
- * @LastEditors: LiZhiWei
- * @LastEditTime: 2026-01-09 16:41:58
- * @Description: 登录相关状态
- */
-import {
-  setToken as setTokenCache,
-  getToken as getTokenCache,
-  setRefreshToken,
-  getRefreshToken,
-  setUuIdSave,
-} from '~/utils/auth'
-import { postLogin, postRegister, getAccountInfo, postAccountInfo } from '~/api/user/login'
-import type { ILogin, IAccount, ILoginToken } from '~/models/login'
-import { useUserStore } from './user'
-
-export interface LoginState {
-  token: string
-  refreshToken: string
-  isAccessTokenNoWorking: boolean // accessToken是否过期
-  timer: unknown
-  isShowAccount: boolean // 是否显示账号信息
-  accountInfo: IAccount
-}
-export const useLoginStore = defineStore('login', {
-  state: (): LoginState => {
-    return {
-      token: '',
-      refreshToken: '',
-      isAccessTokenNoWorking: false,
-      timer: '',
-      isShowAccount: false,
-      accountInfo: {},
-    }
-  },
-  getters: {
-    getToken(): string {
-      return this.token || getTokenCache() || ''
-    },
-    getRefreshToken(): string {
-      return this.refreshToken || getRefreshToken() || ''
-    },
-    isLogin(): boolean {
-      return !!this.token || !!getTokenCache()
-    },
-    isAccessTokenExpire(): boolean {
-      return this.isAccessTokenNoWorking
-    },
-  },
-  actions: {
-    setAccountClose(flag: boolean) {
-      this.isShowAccount = flag
-    },
-    setToken(info: string) {
-      this.token = info ?? ''
-      setTokenCache(info)
-    },
-    setRefreshToken(info: string) {
-      this.refreshToken = info ?? ''
-      setRefreshToken(info)
-    },
-    // 登录
-    login(loginForm: ILogin) {
-      return new Promise((resolve, reject) => {
-        postLogin(loginForm)
-          .then((res) => {
-            this.isAccessTokenNoWorking = false
-            const data = res.data
-            this.setToken(data.accessToken)
-            this.setRefreshToken(data.refreshToken)
-            setUuIdSave(data.uid)
-            resolve(res.data)
-          })
-          .catch((error: Error) => {
-            reject(error)
-          })
-      })
-    },
-    // 注册
-    register(registerForm: IAccount) {
-      return new Promise((resolve, reject) => {
-        postRegister(registerForm)
-          .then((res) => {
-            resolve(res.data)
-          })
-          .catch((error: Error) => {
-            reject(error)
-          })
-      })
-    },
-    updateToken(data: ILoginToken) {
-      this.setToken(data.accessToken)
-    },
-    // 退出登录
-    logout() {
-      return new Promise((resolve) => {
-        const userStore = useUserStore()
-        // 数据清理
-        if (process.browser) {
-          localStorage.clear()
-        }
-        userStore.$reset()
-        this.$reset()
-        resolve(1)
-      })
-    },
-    // 获取用户账号信息
-    getUserAccountInfo(uuid: string): Promise<IAccount> {
-      return new Promise((resolve, reject) => {
-        if (this.accountInfo.name) {
-          resolve(this.accountInfo)
-          return
-        }
-        getAccountInfo(uuid)
-          .then((res) => {
-            const data = res.data
-            this.accountInfo = data
-            resolve(res.data)
-          })
-          .catch((error: Error) => {
-            reject(error)
-          })
-      })
-    },
-    updateAccountInfo(data: IAccount) {
-      return new Promise((resolve, reject) => {
-        postAccountInfo(data)
-          .then((res) => {
-            this.accountInfo = {}
-            resolve(res.data)
-          })
-          .catch((error: Error) => {
-            reject(error)
-          })
-      })
-    },
-  },
-})

+ 0 - 43
app/stores/user/user.ts

@@ -1,43 +0,0 @@
-/*
- * @Author: wjc
- * @Date: 2023-11-27 15:35:24
- * @LastEditors: LiZhiWei
- * @LastEditTime: 2026-01-09 16:45:59
- * @Description:
- */
-import { getToken } from '@/utils/auth'
-
-interface IUser {
-  id?: string
-}
-
-export const useUserStore = defineStore('user', {
-  state: () => {
-    return {
-      userInfo: {} as IUser,
-      navMenu: [],
-    }
-  },
-  getters: {
-    getUser(): IUser {
-      if (process.browser) {
-        const token = getToken()
-        const userInfo = localStorage.getItem('userInfo')
-        if (userInfo && token) {
-          return JSON.parse(userInfo)
-        }
-        return this.userInfo
-      } else {
-        return this.userInfo
-      }
-    },
-    getEnterpriseUserId(): string {
-      return this.userInfo.id || ''
-    },
-  },
-  actions: {
-    clearUserInfo() {
-      this.userInfo = {}
-    },
-  },
-})

+ 2 - 2
app/types/config.d.ts

@@ -2,12 +2,12 @@
  * @Author: wjc
  * @Date: 2023-10-31 11:13:23
  * @LastEditors: LiZhiWei
- * @LastEditTime: 2026-01-09 16:37:06
+ * @LastEditTime: 2026-01-15 17:50:15
  * @Description:
  */
 export interface Config {
   websiteTitle: string
-  footerWrite: {
+  footerWrite?: {
     url: string
     adminUrl?: string
     holdUnit?: string

+ 1 - 2
app/utils/fetch/interface.ts

@@ -2,11 +2,10 @@
  * @Author: wjc
  * @Date: 2023-11-27 15:35:24
  * @LastEditors: LiZhiWei
- * @LastEditTime: 2026-01-09 15:47:12
+ * @LastEditTime: 2026-01-15 17:52:25
  * @Description:
  */
 import type { UseFetchOptions } from '#app'
-import type { BasicResponse } from '@/models/common'
 
 export type _AsyncData<DataT, ErrorT> = {
   data: Ref<DataT | null>