Sfoglia il codice sorgente

style: 代码格式化2

chaooo 2 anni fa
parent
commit
8ad5d53585

+ 1 - 1
.eslintrc-auto-import.json

@@ -266,4 +266,4 @@
     "watchWithFilter": true,
     "whenever": true
   }
-}
+}

+ 1 - 0
.eslintrc.cjs

@@ -23,6 +23,7 @@ module.exports = {
     "@typescript-eslint/no-explicit-any": "off", // 关闭any类型的警告
     "vue/no-v-model-argument": "off",
     "@typescript-eslint/no-non-null-assertion": "off",
+    "vue/comment-directive": "off",
   },
   // https://eslint.org/docs/latest/use/configure/language-options#specifying-globals
   globals: {

+ 12 - 12
index.html

@@ -1,15 +1,15 @@
 <!DOCTYPE html>
 <html lang="en">
-<head>
-  <meta charset="UTF-8" />
-  <link rel="icon" href="/favicon.ico" />
-  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-  <meta name="description" content="水母星球数据看板系统" />
-  <meta name="keywords" content="水母星球,数据看板,后台系统" />
-  <title>水母星球数据看板系统</title>
-</head>
-<body>
-  <div id="app"></div>
-  <script type="module" src="/src/main.ts"></script>
-</body>
+  <head>
+    <meta charset="UTF-8" />
+    <link rel="icon" href="/favicon.ico" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="description" content="水母星球数据看板系统" />
+    <meta name="keywords" content="水母星球,数据看板,后台系统" />
+    <title>水母星球数据看板系统</title>
+  </head>
+  <body>
+    <div id="app"></div>
+    <script type="module" src="./src/main.ts"></script>
+  </body>
 </html>

+ 0 - 3
src/App.vue

@@ -1,11 +1,8 @@
 <script setup lang="ts">
-import { ElConfigProvider } from "element-plus";
 import { useAppStore } from "@/store/modules/app";
 const appStore = useAppStore();
 </script>
 
 <template>
-  <!--  <el-config-provider :locale="appStore.locale" :size="appStore.size">-->
   <router-view />
-  <!--  </el-config-provider>-->
 </template>

+ 3 - 3
src/directive/index.ts

@@ -1,9 +1,9 @@
-import type { App } from 'vue';
+import type { App } from "vue";
 
-import { hasPerm } from './permission';
+import { hasPerm } from "./permission";
 
 // 全局注册 directive
 export function setupDirective(app: App<Element>) {
   // 使 v-hasPerm 在所有组件中都可用
-  app.directive('hasPerm', hasPerm);
+  app.directive("hasPerm", hasPerm);
 }

+ 12 - 10
src/layout/components/Sidebar/Link.vue

@@ -1,9 +1,9 @@
 <script lang="ts" setup>
-import { computed } from 'vue';
-import { isExternal } from '@/utils/index';
-import { useRouter } from 'vue-router';
+import { computed } from "vue";
+import { isExternal } from "@/utils";
+import { useRouter } from "vue-router";
 
-import { useAppStore } from '@/store/modules/app';
+import { useAppStore } from "@/store/modules/app";
 const appStore = useAppStore();
 
 const sidebar = computed(() => appStore.sidebar);
@@ -12,18 +12,20 @@ const device = computed(() => appStore.device);
 const props = defineProps({
   to: {
     type: String,
-    required: true
-  }
+    required: true,
+  },
 });
 
 const router = useRouter();
 function push() {
-  if (device.value === 'mobile' && sidebar.value.opened == true) {
+  if (device.value === "mobile" && sidebar.value.opened == true) {
     appStore.closeSideBar(false);
   }
-  router.push(props.to).catch(err => {
-    console.error(err);
-  });
+  if (props.to) {
+    router.push(props.to).catch((err) => {
+      console.error(err);
+    });
+  }
 }
 </script>
 

+ 2 - 2
src/store/index.ts

@@ -1,5 +1,5 @@
-import type { App } from 'vue';
-import { createPinia } from 'pinia';
+import type { App } from "vue";
+import { createPinia } from "pinia";
 
 const store = createPinia();
 

+ 4 - 4
src/styles/variables.module.scss

@@ -1,6 +1,6 @@
 // 导出 variables.module.scss 变量提供给TypeScript使用
 :export {
-    menuBg: $menuBg;
-    menuText: $menuText;
-    menuActiveText: $menuActiveText
-}
+  menuBg: $menuBg;
+  menuText: $menuText;
+  menuActiveText: $menuActiveText;
+}

+ 2 - 2
src/types/env.d.ts

@@ -1,7 +1,7 @@
 /// <reference types="vite/client" />
 
-declare module '*.vue' {
-  import { DefineComponent } from 'vue';
+declare module "*.vue" {
+  import { DefineComponent } from "vue";
   // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
   const component: DefineComponent<{}, {}, any>;
   export default component;

+ 0 - 154
src/user/index.ts

@@ -1,154 +0,0 @@
-import request from '@/utils/request';
-import { AxiosPromise } from 'axios';
-import { UserForm, UserInfo, UserPageVO, UserQuery } from './types';
-
-/**
- * 登录成功后获取用户信息(昵称、头像、权限集合和角色集合)
- */
-export function getUserInfo(): AxiosPromise<UserInfo> {
-  return request({
-    url: '/api/v1/users/me',
-    method: 'get'
-  });
-}
-
-/**
- * 获取用户分页列表
- *
- * @param queryParams
- */
-export function getUserPage(
-  queryParams: UserQuery
-): AxiosPromise<PageResult<UserPageVO[]>> {
-  return request({
-    url: '/api/v1/users/page',
-    method: 'get',
-    params: queryParams
-  });
-}
-
-/**
- * 获取用户表单详情
- *
- * @param userId
- */
-export function getUserForm(userId: number): AxiosPromise<UserForm> {
-  return request({
-    url: '/api/v1/users/' + userId + '/form',
-    method: 'get'
-  });
-}
-
-/**
- * 添加用户
- *
- * @param data
- */
-export function addUser(data: any) {
-  return request({
-    url: '/api/v1/users',
-    method: 'post',
-    data: data
-  });
-}
-
-/**
- * 修改用户
- *
- * @param id
- * @param data
- */
-export function updateUser(id: number, data: UserForm) {
-  return request({
-    url: '/api/v1/users/' + id,
-    method: 'put',
-    data: data
-  });
-}
-
-/**
- * 修改用户状态
- *
- * @param id
- * @param status
- */
-export function updateUserStatus(id: number, status: number) {
-  return request({
-    url: '/api/v1/users/' + id + '/status',
-    method: 'patch',
-    params: { status: status }
-  });
-}
-
-/**
- * 修改用户密码
- *
- * @param id
- * @param password
- */
-export function updateUserPassword(id: number, password: string) {
-  return request({
-    url: '/api/v1/users/' + id + '/password',
-    method: 'patch',
-    params: { password: password }
-  });
-}
-
-/**
- * 删除用户
- *
- * @param ids
- */
-export function deleteUsers(ids: string) {
-  return request({
-    url: '/api/v1/users/' + ids,
-    method: 'delete'
-  });
-}
-
-/**
- * 下载用户导入模板
- *
- * @returns
- */
-export function downloadTemplateApi() {
-  return request({
-    url: '/api/v1/users/template',
-    method: 'get',
-    responseType: 'arraybuffer'
-  });
-}
-
-/**
- * 导出用户
- *
- * @param queryParams
- * @returns
- */
-export function exportUser(queryParams: UserQuery) {
-  return request({
-    url: '/api/v1/users/_export',
-    method: 'get',
-    params: queryParams,
-    responseType: 'arraybuffer'
-  });
-}
-
-/**
- * 导入用户
- *
- * @param file
- */
-export function importUser(deptId: number, file: File) {
-  const formData = new FormData();
-  formData.append('file', file);
-  return request({
-    url: '/api/v1/users/_import',
-    method: 'post',
-    params: { deptId: deptId },
-    data: formData,
-    headers: {
-      'Content-Type': 'multipart/form-data'
-    }
-  });
-}

+ 0 - 112
src/user/types.ts

@@ -1,112 +0,0 @@
-/**
- * 登录用户信息
- */
-export interface UserInfo {
-  userId: number;
-  nickname: string;
-  avatar: string;
-  roles: string[];
-  perms: string[];
-}
-
-/**
- * 用户查询对象类型
- */
-export interface UserQuery extends PageQuery {
-  keywords?: string;
-  status?: number;
-  deptId?: number;
-}
-
-/**
- * 用户分页对象
- */
-export interface UserPageVO {
-  /**
-   * 用户头像地址
-   */
-  avatar?: string;
-  /**
-   * 创建时间
-   */
-  createTime?: Date;
-  /**
-   * 部门名称
-   */
-  deptName?: string;
-  /**
-   * 用户邮箱
-   */
-  email?: string;
-  /**
-   * 性别
-   */
-  genderLabel?: string;
-  /**
-   * 用户ID
-   */
-  id?: number;
-  /**
-   * 手机号
-   */
-  mobile?: string;
-  /**
-   * 用户昵称
-   */
-  nickname?: string;
-  /**
-   * 角色名称,多个使用英文逗号(,)分割
-   */
-  roleNames?: string;
-  /**
-   * 用户状态(1:启用;0:禁用)
-   */
-  status?: number;
-  /**
-   * 用户名
-   */
-  username?: string;
-}
-
-/**
- * 用户表单类型
- */
-export interface UserForm {
-  /**
-   * 用户头像
-   */
-  avatar?: string;
-  /**
-   * 部门ID
-   */
-  deptId?: number;
-  /**
-   * 邮箱
-   */
-  email?: string;
-  /**
-   * 性别
-   */
-  gender?: number;
-  /**
-   * 用户ID
-   */
-  id?: number;
-  mobile?: string;
-  /**
-   * 昵称
-   */
-  nickname?: string;
-  /**
-   * 角色ID集合
-   */
-  roleIds?: number[];
-  /**
-   * 用户状态(1:正常;0:禁用)
-   */
-  status?: number;
-  /**
-   * 用户名
-   */
-  username?: string;
-}

+ 2 - 2
src/utils/scroll-to.ts

@@ -47,7 +47,7 @@ export const scrollTo = (to: number, duration: number, callback?: any) => {
   const change = to - start;
   const increment = 20;
   let currentTime = 0;
-  duration = typeof duration === 'undefined' ? 500 : duration;
+  duration = typeof duration === "undefined" ? 500 : duration;
   const animateScroll = function () {
     // increment the time
     currentTime += increment;
@@ -59,7 +59,7 @@ export const scrollTo = (to: number, duration: number, callback?: any) => {
     if (currentTime < duration) {
       requestAnimFrame(animateScroll);
     } else {
-      if (callback && typeof callback === 'function') {
+      if (callback && typeof callback === "function") {
         // the animation is done so lets callback
         callback();
       }