Commit 329aed75 by 前端

init

1 parent f4e3c01a
Showing 220 changed files with 12174 additions and 1 deletions
# @see: http://editorconfig.org
root = true
[*] # 表示所有文件适用
charset = utf-8 # 设置文件字符集为 utf-8
end_of_line = lf # 控制换行类型(lf | cr | crlf)
insert_final_newline = true # 始终在文件末尾插入一个新行
indent_style = space # 缩进风格(tab | space)
indent_size = 2 # 缩进大小
max_line_length = 130 # 最大行长度
[*.md] # 表示仅对 md 文件适用以下规则
max_line_length = off # 关闭最大行长度限制
trim_trailing_whitespace = false # 关闭末尾空格修剪
# title
VITE_GLOB_APP_TITLE = 后台管理系统
# 本地运行端口号
VITE_PORT = 8848
# 启动时自动打开浏览器
VITE_OPEN = true
# 开启 devTools 调试
VITE_DEVTOOLS = false
# 打包后是否生成包分析文件
VITE_REPORT = false
###
# @Author: 前端 qianduan01@didihu.com.cn
# @Date: 2024-09-04 14:38:00
# @LastEditors: 前端 qianduan01@didihu.com.cn
# @LastEditTime: 2024-09-27 21:04:03
# @FilePath: \Apper-Admin-master\.env.development
# @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
###
# 本地环境
VITE_USER_NODE_ENV = development
# 公共基础路径
VITE_PUBLIC_PATH = /
# 路由模式
# Optional: hash | history
VITE_ROUTER_MODE = hash
# 打包时是否删除 console
VITE_DROP_CONSOLE = true
# 是否开启 VitePWA
VITE_PWA = false
# 开发环境接口地址
VITE_API_URL = /api
# 开发环境跨域代理,支持配置多个
VITE_PROXY = [["/api","http://192.168.1.129:3000"]]
# VITE_PROXY = [["/api","https://mock.mengxuegu.com/mock/629d727e6163854a32e8307e"]]
# VITE_PROXY = [["/api","https://www.fastmock.site/mock/f81e8333c1a9276214bcdbc170d9e0a0"]]
# VITE_PROXY = [["/api-easymock","https://mock.mengxuegu.com"],["/api-fastmock","https://www.fastmock.site"]]
# 线上环境
VITE_USER_NODE_ENV = production
# 公共基础路径
VITE_PUBLIC_PATH = /
# 路由模式
# Optional: hash | history
VITE_ROUTER_MODE = hash
# 是否启用 gzip 或 brotli 压缩打包,如果需要多个压缩规则,可以使用 “,” 分隔
# Optional: gzip | brotli | none
VITE_BUILD_COMPRESS = none
# 打包压缩后是否删除源文件
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
# 打包时是否删除 console
VITE_DROP_CONSOLE = true
# 是否开启 VitePWA
VITE_PWA = true
# 线上环境接口地址
VITE_API_URL = "https://mock.mengxuegu.com/mock/629d727e6163854a32e8307e"
# 测试环境
VITE_USER_NODE_ENV = test
# 公共基础路径
VITE_PUBLIC_PATH = /
# 路由模式
# Optional: hash | history
VITE_ROUTER_MODE = hash
# 是否启用 gzip 或 brotli 压缩打包,如果需要多个压缩规则,可以使用 “,” 分隔
# Optional: gzip | brotli | none
VITE_BUILD_COMPRESS = none
# 打包压缩后是否删除源文件
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
# 打包时是否删除 console
VITE_DROP_CONSOLE = true
# 是否开启 VitePWA
VITE_PWA = false
# 测试环境接口地址
VITE_API_URL = "https://mock.mengxuegu.com/mock/629d727e6163854a32e8307e"
*.sh
node_modules
*.md
*.woff
*.ttf
.vscode
.idea
dist
/public
/docs
.husky
.local
/bin
/src/mock/*
stats.html
// @see: http://eslint.cn
module.exports = {
root: true,
env: {
browser: true,
node: true,
es6: true
},
// 指定如何解析语法
parser: "vue-eslint-parser",
// 优先级低于 parse 的语法解析配置
parserOptions: {
parser: "@typescript-eslint/parser",
ecmaVersion: 2020,
sourceType: "module",
jsxPragma: "React",
ecmaFeatures: {
jsx: true
}
},
// 继承某些已有的规则
extends: ["plugin:vue/vue3-recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
/**
* "off" 或 0 ==> 关闭规则
* "warn" 或 1 ==> 打开的规则作为警告(不影响代码执行)
* "error" 或 2 ==> 规则作为一个错误(代码不能执行,界面报错)
*/
rules: {
// eslint (http://eslint.cn/docs/rules)
"no-var": "error", // 要求使用 let 或 const 而不是 var
"no-multiple-empty-lines": ["error", { max: 1 }], // 不允许多个空行
"prefer-const": "off", // 使用 let 关键字声明但在初始分配后从未重新分配的变量,要求使用 const
"no-use-before-define": "off", // 禁止在 函数/类/变量 定义之前使用它们
// typeScript (https://typescript-eslint.io/rules)
"@typescript-eslint/no-unused-vars": "error", // 禁止定义未使用的变量
"@typescript-eslint/no-empty-function": "error", // 禁止空函数
"@typescript-eslint/prefer-ts-expect-error": "error", // 禁止使用 @ts-ignore
"@typescript-eslint/ban-ts-comment": "error", // 禁止 @ts-<directive> 使用注释或要求在指令后进行描述
"@typescript-eslint/no-inferrable-types": "off", // 可以轻松推断的显式类型可能会增加不必要的冗长
"@typescript-eslint/no-namespace": "off", // 禁止使用自定义 TypeScript 模块和命名空间
"@typescript-eslint/no-explicit-any": "off", // 禁止使用 any 类型
"@typescript-eslint/ban-types": "off", // 禁止使用特定类型
"@typescript-eslint/no-var-requires": "off", // 允许使用 require() 函数导入模块
"@typescript-eslint/no-non-null-assertion": "off", // 不允许使用后缀运算符的非空断言(!)
// vue (https://eslint.vuejs.org/rules)
"vue/script-setup-uses-vars": "error", // 防止<script setup>使用的变量<template>被标记为未使用,此规则仅在启用该 no-unused-vars 规则时有效
"vue/v-slot-style": "error", // 强制执行 v-slot 指令样式
"vue/no-mutating-props": "error", // 不允许改变组件 prop
"vue/custom-event-name-casing": "error", // 为自定义事件名称强制使用特定大小写
"vue/html-closing-bracket-newline": "error", // 在标签的右括号之前要求或禁止换行
"vue/attribute-hyphenation": "error", // 对模板中的自定义组件强制执行属性命名样式:my-prop="prop"
"vue/attributes-order": "off", // vue api使用顺序,强制执行属性顺序
"vue/no-v-html": "off", // 禁止使用 v-html
"vue/require-default-prop": "off", // 此规则要求为每个 prop 为必填时,必须提供默认值
"vue/multi-word-component-names": "off", // 要求组件名称始终为 “-” 链接的单词
"vue/no-setup-props-destructure": "off" // 禁止解构 props 传递给 setup
}
};
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
stats.html
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no-install commitlint --edit $1
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run lint:lint-staged
/dist/*
.local
/node_modules/**
**/*.svg
**/*.sh
/public/*
stats.html
// @see: https://www.prettier.cn
module.exports = {
// 指定最大换行长度
printWidth: 130,
// 缩进制表符宽度 | 空格数
tabWidth: 2,
// 使用制表符而不是空格缩进行 (true:制表符,false:空格)
useTabs: false,
// 结尾不用分号 (true:有,false:没有)
semi: true,
// 使用单引号 (true:单引号,false:双引号)
singleQuote: false,
// 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>"
quoteProps: "as-needed",
// 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号)
jsxSingleQuote: false,
// 多行时尽可能打印尾随逗号 可选值"<none|es5|all>"
trailingComma: "none",
// 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有)
bracketSpacing: true,
// 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行)
bracketSameLine: false,
// (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号)
arrowParens: "avoid",
// 指定要使用的解析器,不需要写文件开头的 @prettier
requirePragma: false,
// 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化
insertPragma: false,
// 用于控制文本是否应该被换行以及如何进行换行
proseWrap: "preserve",
// 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的
htmlWhitespaceSensitivity: "css",
// 控制在 Vue 单文件组件中 <script> 和 <style> 标签内的代码缩进方式
vueIndentScriptAndStyle: false,
// 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>"
endOfLine: "auto",
// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 (rangeStart:开始,rangeEnd:结束)
rangeStart: 0,
rangeEnd: Infinity
};
/dist/*
/public/*
public/*
stats.html
// @see: https://stylelint.io
module.exports = {
root: true,
// 继承某些已有的规则
extends: [
"stylelint-config-standard", // 配置 stylelint 拓展插件
"stylelint-config-html/vue", // 配置 vue 中 template 样式格式化
"stylelint-config-standard-scss", // 配置 stylelint scss 插件
"stylelint-config-recommended-vue/scss", // 配置 vue 中 scss 样式格式化
"stylelint-config-recess-order" // 配置 stylelint css 属性书写顺序插件,
],
overrides: [
// 扫描 .vue/html 文件中的 <style> 标签内的样式
{
files: ["**/*.{vue,html}"],
customSyntax: "postcss-html"
}
],
rules: {
"function-url-quotes": "always", // URL 的引号 "always(必须加上引号)"|"never(没有引号)"
"color-hex-length": "long", // 指定 16 进制颜色的简写或扩写 "short(16进制简写)"|"long(16进制扩写)"
"rule-empty-line-before": "never", // 要求或禁止在规则之前的空行 "always(规则之前必须始终有一个空行)"|"never(规则前绝不能有空行)"|"always-multi-line(多行规则之前必须始终有一个空行)"|"never-multi-line(多行规则之前绝不能有空行)"
"font-family-no-missing-generic-family-keyword": null, // 禁止在字体族名称列表中缺少通用字体族关键字
"scss/at-import-partial-extension": null, // 解决不能使用 @import 引入 scss 文件
"property-no-unknown": null, // 禁止未知的属性
"no-empty-source": null, // 禁止空源码
"selector-class-pattern": null, // 强制选择器类名的格式
"value-no-vendor-prefix": null, // 关闭 vendor-prefix (为了解决多行省略 -webkit-box)
"no-descending-specificity": null, // 不允许较低特异性的选择器出现在覆盖较高特异性的选择器
"value-keyword-case": null, // 解决在 scss 中使用 v-bind 大写单词报错
"selector-pseudo-class-no-unknown": [
true,
{
ignorePseudoClasses: ["global", "v-deep", "deep"]
}
]
},
ignoreFiles: ["**/*.js", "**/*.jsx", "**/*.tsx", "**/*.ts"]
};
{
"recommendations": [
"vue.volar",
"hollowtree.vue-snippets",
"dbaeumer.vscode-eslint",
"stylelint.vscode-stylelint",
"esbenp.prettier-vscode",
"editorconfig.editorconfig",
"streetsidesoftware.code-spell-checker",
"syler.sass-indented",
"mikestead.dotenv"
]
}
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": "explicit"
},
"stylelint.enable": true,
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass", "html"],
"files.eol": "\n",
"typescript.tsdk": "node_modules/typescript/lib",
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[less]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"cSpell.words": [
"AMAP",
"apng",
"axios",
"Biao",
"brotli",
"cascader",
"commitlint",
"contentleft",
"contentright",
"CSDN",
"daterange",
"datetimerange",
"echarts",
"fangda",
"Gitee",
"hexs",
"huiche",
"iconfont",
"juejin",
"liquidfill",
"longpress",
"monthrange",
"nprogress",
"officedocument",
"openxmlformats",
"Pageable",
"persistedstate",
"pinia",
"pjpeg",
"Prefixs",
"screenfull",
"sortablejs",
"sousuo",
"spreadsheetml",
"styl",
"stylelint",
"stylelintignore",
"stylelintrc",
"suoxiao",
"truetype",
"tuichu",
"unplugin",
"unref",
"VITE",
"vuedraggable",
"vueuse",
"Vuex",
"wangeditor",
"xiala",
"xiaoxi",
"Yahei",
"yiwen",
"zhongyingwen",
"zhuti"
]
}
MIT License
Copyright (c) 2022 Halsey
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11
\ No newline at end of file
### 介绍 📖
一款基于 Vue3.4、TypeScript、Vite5、Pinia、Element-Plus 开源的后台管理框架,使用目前最新技术栈开发。项目提供强大的 [ProTable](https://juejin.cn/post/7166068828202336263) 组件,在一定程度上提高您的开发效率。另外本项目还封装了一些常用组件、Hooks、指令、动态路由、按钮级别权限控制等功能。
### 项目功能 🔨
- 使用 Vue3.4 + TypeScript 开发,单文件组件**<script setup>**
- 采用 Vite5 作为项目开发、打包工具(配置 gzip/brotli 打包、tsx 语法、跨域代理…)
- 使用 Pinia 替代 Vuex,轻量、简单、易用,集成 Pinia 持久化插件
- 使用 TypeScript 对 Axios 整个二次封装(请求拦截、取消、常用请求封装…)
- 基于 Element 二次封装 [ProTable](https://juejin.cn/post/7166068828202336263) 组件,表格页面全部为配置项 Columns
- 支持 Element 组件大小切换、多主题布局、暗黑模式、i18n 国际化
- 使用 VueRouter 配置动态路由权限拦截、路由懒加载,支持页面按钮权限控制
- 使用 KeepAlive 对页面进行缓存,支持多级嵌套路由缓存
- 常用自定义指令开发(权限、复制、水印、拖拽、节流、防抖、长按…)
- 使用 Prettier 统一格式化代码,集成 ESLint、Stylelint 代码校验规范
- 使用 husky、lint-staged、commitlint、czg、cz-git 规范提交信息
### 安装使用步骤 📔
- **Install:**
```text
pnpm install
```
- **Run:**
```text
pnpm dev
pnpm serve
```
- **Build:**
```text
# 开发环境
pnpm build:dev
# 测试环境
pnpm build:test
# 生产环境
pnpm build:pro
```
- **Lint:**
```text
# eslint 检测代码
pnpm lint:eslint
# prettier 格式化代码
pnpm lint:prettier
# stylelint 格式化样式
pnpm lint:stylelint
```
- **commit:**
```text
# 提交代码(提交前会自动执行 lint:lint-staged 命令)
pnpm commit
```
### 项目截图 📷
- 登录页:
![login_light](https://i.imgtg.com/2023/04/13/8tknp.png)
![login_dark](https://i.imgtg.com/2023/04/13/8tmpP.png)
- 首页:
![home_light](https://i.imgtg.com/2023/04/13/8tl1j.png)
![home_dark](https://i.imgtg.com/2023/04/13/8tpfb.png)
- 表格页:
![table_light](https://i.imgtg.com/2023/04/13/8tfMx.png)
![table_dark](https://i.imgtg.com/2023/04/13/8tv8F.png)
- 数据可视化
![dashboard](https://i.imgtg.com/2023/04/14/82Grx.png)
- 数据大屏:
![dataScreen](https://i.imgtg.com/2023/01/16/QP8HF.png)
### 文件资源目录 📚
```text
├─ .husky # husky 配置文件
├─ .vscode # VSCode 推荐配置
├─ build # Vite 配置项
├─ public # 静态资源文件(该文件夹不会被打包)
├─ src
│ ├─ api # API 接口管理
│ ├─ assets # 静态资源文件
│ ├─ components # 全局组件
│ ├─ config # 全局配置项
│ ├─ directives # 全局指令文件
│ ├─ enums # 项目常用枚举
│ ├─ hooks # 常用 Hooks 封装
│ ├─ languages # 语言国际化 i18n
│ ├─ layouts # 框架布局模块
│ ├─ routers # 路由管理
│ ├─ stores # pinia store
│ ├─ styles # 全局样式文件
│ ├─ typings # 全局 ts 声明
│ ├─ utils # 常用工具库
│ ├─ views # 项目所有页面
│ ├─ App.vue # 项目主组件
│ ├─ main.ts # 项目入口文件
│ └─ vite-env.d.ts # 指定 ts 识别 vue
├─ .editorconfig # 统一不同编辑器的编码风格
├─ .env # vite 常用配置
├─ .env.development # 开发环境配置
├─ .env.production # 生产环境配置
├─ .env.test # 测试环境配置
├─ .eslintignore # 忽略 Eslint 校验
├─ .eslintrc.cjs # Eslint 校验配置文件
├─ .gitignore # 忽略 git 提交
├─ .prettierignore # 忽略 Prettier 格式化
├─ .prettierrc.cjs # Prettier 格式化配置
├─ .stylelintignore # 忽略 stylelint 格式化
├─ .stylelintrc.cjs # stylelint 样式格式化配置
├─ CHANGELOG.md # 项目更新日志
├─ commitlint.config.cjs # git 提交规范配置
├─ index.html # 入口 html
├─ LICENSE # 开源协议文件
├─ lint-staged.config.cjs # lint-staged 配置文件
├─ package-lock.json # 依赖包包版本锁
├─ package.json # 依赖包管理
├─ postcss.config.cjs # postcss 配置
├─ README.md # README 介绍
├─ tsconfig.json # typescript 全局配置
└─ vite.config.ts # vite 全局配置文件
```
import path from "path";
export function isDevFn(mode: string): boolean {
return mode === "development";
}
export function isProdFn(mode: string): boolean {
return mode === "production";
}
export function isTestFn(mode: string): boolean {
return mode === "test";
}
/**
* Whether to generate package preview
*/
export function isReportMode(): boolean {
return process.env.VITE_REPORT === "true";
}
// Read all environment variable configuration files to process.env
export function wrapperEnv(envConf: Recordable): ViteEnv {
const ret: any = {};
for (const envName of Object.keys(envConf)) {
let realName = envConf[envName].replace(/\\n/g, "\n");
realName = realName === "true" ? true : realName === "false" ? false : realName;
if (envName === "VITE_PORT") realName = Number(realName);
if (envName === "VITE_PROXY") {
try {
realName = JSON.parse(realName);
} catch (error) {}
}
ret[envName] = realName;
}
return ret;
}
/**
* Get user root directory
* @param dir file path
*/
export function getRootPath(...dir: string[]) {
return path.resolve(process.cwd(), ...dir);
}
import { resolve } from "path";
import { PluginOption } from "vite";
import { VitePWA } from "vite-plugin-pwa";
import { createHtmlPlugin } from "vite-plugin-html";
import { visualizer } from "rollup-plugin-visualizer";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import eslintPlugin from "vite-plugin-eslint";
import viteCompression from "vite-plugin-compression";
import vueSetupExtend from "unplugin-vue-setup-extend-plus/vite";
import NextDevTools from "vite-plugin-vue-devtools";
/**
* 创建 vite 插件
* @param viteEnv
*/
export const createVitePlugins = (viteEnv: ViteEnv): (PluginOption | PluginOption[])[] => {
const { VITE_GLOB_APP_TITLE, VITE_REPORT, VITE_DEVTOOLS, VITE_PWA } = viteEnv;
return [
vue(),
// vue 可以使用 jsx/tsx 语法
vueJsx(),
// devTools
VITE_DEVTOOLS && NextDevTools({ launchEditor: "code" }),
// esLint 报错信息显示在浏览器界面上
eslintPlugin(),
// name 可以写在 script 标签上
vueSetupExtend({}),
// 创建打包压缩配置
createCompression(viteEnv),
// 注入变量到 html 文件
createHtmlPlugin({
minify: true,
inject: {
data: { title: VITE_GLOB_APP_TITLE }
}
}),
// 使用 svg 图标
createSvgIconsPlugin({
iconDirs: [resolve(process.cwd(), "src/assets/icons")],
symbolId: "icon-[dir]-[name]"
}),
// vitePWA
VITE_PWA && createVitePwa(viteEnv),
// 是否生成包预览,分析依赖包大小做优化处理
VITE_REPORT && (visualizer({ filename: "stats.html", gzipSize: true, brotliSize: true }) as PluginOption)
];
};
/**
* @description 根据 compress 配置,生成不同的压缩规则
* @param viteEnv
*/
const createCompression = (viteEnv: ViteEnv): PluginOption | PluginOption[] => {
const { VITE_BUILD_COMPRESS = "none", VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv;
const compressList = VITE_BUILD_COMPRESS.split(",");
const plugins: PluginOption[] = [];
if (compressList.includes("gzip")) {
plugins.push(
viteCompression({
ext: ".gz",
algorithm: "gzip",
deleteOriginFile: VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE
})
);
}
if (compressList.includes("brotli")) {
plugins.push(
viteCompression({
ext: ".br",
algorithm: "brotliCompress",
deleteOriginFile: VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE
})
);
}
return plugins;
};
/**
* @description VitePwa
* @param viteEnv
*/
const createVitePwa = (viteEnv: ViteEnv): PluginOption | PluginOption[] => {
const { VITE_GLOB_APP_TITLE } = viteEnv;
return VitePWA({
registerType: "autoUpdate",
manifest: {
name: VITE_GLOB_APP_TITLE,
short_name: VITE_GLOB_APP_TITLE,
theme_color: "#ffffff",
icons: [
{
src: "/logo.png",
sizes: "192x192",
type: "image/png"
},
{
src: "/logo.png",
sizes: "512x512",
type: "image/png"
},
{
src: "/logo.png",
sizes: "512x512",
type: "image/png",
purpose: "any maskable"
}
]
}
});
};
import type { ProxyOptions } from "vite";
type ProxyItem = [string, string];
type ProxyList = ProxyItem[];
type ProxyTargetList = Record<string, ProxyOptions>;
/**
* 创建代理,用于解析 .env.development 代理配置
* @param list
*/
export function createProxy(list: ProxyList = []) {
const ret: ProxyTargetList = {};
for (const [prefix, target] of list) {
const httpsRE = /^https:\/\//;
const isHttps = httpsRE.test(target);
// https://github.com/http-party/node-http-proxy#options
ret[prefix] = {
target: target,
changeOrigin: true,
ws: true,
rewrite: path => path.replace(new RegExp(`^${prefix}`), ""),
// https is require secure=false
...(isHttps ? { secure: false } : {})
};
}
return ret;
}
// @see: https://cz-git.qbenben.com/zh/guide
const fs = require("fs");
const path = require("path");
const scopes = fs
.readdirSync(path.resolve(__dirname, "src"), { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name.replace(/s$/, ""));
/** @type {import('cz-git').UserConfig} */
module.exports = {
ignores: [commit => commit.includes("init")],
extends: ["@commitlint/config-conventional"],
rules: {
// @see: https://commitlint.js.org/#/reference-rules
"body-leading-blank": [2, "always"],
"footer-leading-blank": [1, "always"],
"header-max-length": [2, "always", 108],
"subject-empty": [2, "never"],
"type-empty": [2, "never"],
"subject-case": [0],
"type-enum": [
2,
"always",
[
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"build",
"ci",
"chore",
"revert",
"wip",
"workflow",
"types",
"release"
]
]
},
prompt: {
messages: {
type: "Select the type of change that you're committing:",
scope: "Denote the SCOPE of this change (optional):",
customScope: "Denote the SCOPE of this change:",
subject: "Write a SHORT, IMPERATIVE tense description of the change:\n",
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
breaking: 'List any BREAKING CHANGES (optional). Use "|" to break new line:\n',
footerPrefixsSelect: "Select the ISSUES type of changeList by this change (optional):",
customFooterPrefixs: "Input ISSUES prefix:",
footer: "List any ISSUES by this change. E.g.: #31, #34:\n",
confirmCommit: "Are you sure you want to proceed with the commit above?"
// 中文版
// type: "选择你要提交的类型 :",
// scope: "选择一个提交范围(可选):",
// customScope: "请输入自定义的提交范围 :",
// subject: "填写简短精炼的变更描述 :\n",
// body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n',
// breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n',
// footerPrefixsSelect: "选择关联issue前缀(可选):",
// customFooterPrefixs: "输入自定义issue前缀 :",
// footer: "列举关联issue (可选) 例如: #31, #I3244 :\n",
// confirmCommit: "是否提交或修改commit ?"
},
types: [
{
value: "feat",
name: "feat: 🚀 A new feature",
emoji: "🚀"
},
{
value: "fix",
name: "fix: 🧩 A bug fix",
emoji: "🧩"
},
{
value: "docs",
name: "docs: 📚 Documentation only changes",
emoji: "📚"
},
{
value: "style",
name: "style: 🎨 Changes that do not affect the meaning of the code",
emoji: "🎨"
},
{
value: "refactor",
name: "refactor: ♻️ A code change that neither fixes a bug nor adds a feature",
emoji: "♻️"
},
{
value: "perf",
name: "perf: ⚡️ A code change that improves performance",
emoji: "⚡️"
},
{
value: "test",
name: "test: ✅ Adding missing tests or correcting existing tests",
emoji: "✅"
},
{
value: "build",
name: "build: 📦️ Changes that affect the build system or external dependencies",
emoji: "📦️"
},
{
value: "ci",
name: "ci: 🎡 Changes to our CI configuration files and scripts",
emoji: "🎡"
},
{
value: "chore",
name: "chore: 🔨 Other changes that don't modify src or test files",
emoji: "🔨"
},
{
value: "revert",
name: "revert: ⏪️ Reverts a previous commit",
emoji: "⏪️"
},
{
value: "wip",
name: "wip: 🕔 work in process",
emoji: "🕔"
},
{
value: "workflow",
name: "workflow: 📋 workflow improvements",
emoji: "📋"
},
{
value: "type",
name: "type: 🔰 type definition file changes",
emoji: "🔰"
}
// 中文版
// { value: "feat", name: "特性: 🚀 新增功能", emoji: "🚀" },
// { value: "fix", name: "修复: 🧩 修复缺陷", emoji: "🧩" },
// { value: "docs", name: "文档: 📚 文档变更", emoji: "📚" },
// { value: "style", name: "格式: 🎨 代码格式(不影响功能,例如空格、分号等格式修正)", emoji: "🎨" },
// { value: "refactor", name: "重构: ♻️ 代码重构(不包括 bug 修复、功能新增)", emoji: "♻️" },
// { value: "perf", name: "性能: ⚡️ 性能优化", emoji: "⚡️" },
// { value: "test", name: "测试: ✅ 添加疏漏测试或已有测试改动", emoji: "✅" },
// { value: "build", name: "构建: 📦️ 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)", emoji: "📦️" },
// { value: "ci", name: "集成: 🎡 修改 CI 配置、脚本", emoji: "🎡" },
// { value: "revert", name: "回退: ⏪️ 回滚 commit", emoji: "⏪️" },
// { value: "chore", name: "其他: 🔨 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)", emoji: "🔨" },
// { value: "wip", name: "开发: 🕔 正在开发中", emoji: "🕔" },
// { value: "workflow", name: "工作流: 📋 工作流程改进", emoji: "📋" },
// { value: "types", name: "类型: 🔰 类型定义文件修改", emoji: "🔰" }
],
useEmoji: true,
scopes: [...scopes],
customScopesAlign: "bottom",
emptyScopesAlias: "empty",
customScopesAlias: "custom",
allowBreakingChanges: ["feat", "fix"]
}
};
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vue.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%- title %></title>
</head>
<body>
<div id="app">
<style>
html,
body,
#app {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
.loading-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
.loading-box .loading-wrap {
display: flex;
align-items: center;
justify-content: center;
padding: 98px;
}
.dot {
position: relative;
box-sizing: border-box;
display: inline-block;
width: 32px;
height: 32px;
font-size: 32px;
transform: rotate(45deg);
animation: ant-rotate 1.2s infinite linear;
}
.dot i {
position: absolute;
display: block;
width: 14px;
height: 14px;
background-color: #409eff;
border-radius: 100%;
opacity: 0.3;
transform: scale(0.75);
transform-origin: 50% 50%;
animation: ant-spin-move 1s infinite linear alternate;
}
.dot i:nth-child(1) {
top: 0;
left: 0;
}
.dot i:nth-child(2) {
top: 0;
right: 0;
animation-delay: 0.4s;
}
.dot i:nth-child(3) {
right: 0;
bottom: 0;
animation-delay: 0.8s;
}
.dot i:nth-child(4) {
bottom: 0;
left: 0;
animation-delay: 1.2s;
}
@keyframes ant-rotate {
to {
transform: rotate(405deg);
}
}
@keyframes ant-spin-move {
to {
opacity: 1;
}
}
</style>
<div class="loading-box">
<div class="loading-wrap">
<span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
</div>
</div>
</div>
<script>
const globalState = JSON.parse(window.localStorage.getItem("apper-global"));
if (globalState) {
const dot = document.querySelectorAll(".dot i");
const html = document.querySelector("html");
dot.forEach(item => (item.style.background = globalState.primary));
if (globalState.isDark) html.style.background = "#141414";
}
</script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
module.exports = {
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": ["prettier --write--parser json"],
"package.json": ["prettier --write"],
"*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"],
"*.{scss,less,styl,html}": ["stylelint --fix", "prettier --write"],
"*.md": ["prettier --write"]
};
{
"name": "zhanye-admin",
"private": true,
"version": "1.2.0",
"type": "module",
"description": "zhanye-admin open source management system",
"license": "MIT",
"scripts": {
"dev": "vite",
"serve": "vite",
"build:dev": "vue-tsc && vite build --mode development",
"build:test": "vue-tsc && vite build --mode test",
"build:pro": "vue-tsc && vite build --mode production",
"type:check": "vue-tsc --noEmit --skipLibCheck",
"preview": "pnpm build:dev && vite preview",
"lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
"lint:lint-staged": "lint-staged",
"prepare": "husky install",
"release": "standard-version",
"commit": "git add -A && czg && git push"
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"@vueuse/core": "^10.11.0",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
"axios": "^1.7.2",
"dayjs": "^1.11.11",
"driver.js": "^1.3.1",
"echarts": "^5.5.1",
"echarts-liquidfill": "^3.1.0",
"element-plus": "^2.7.6",
"md5": "^2.3.0",
"mitt": "^3.0.1",
"nprogress": "^0.2.0",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"qs": "^6.12.1",
"screenfull": "^6.0.2",
"sortablejs": "^1.15.2",
"vue": "^3.4.31",
"vue-i18n": "^9.13.1",
"vue-router": "^4.4.0",
"vuedraggable": "^4.1.0"
},
"devDependencies": {
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@types/md5": "^2.3.5",
"@types/nprogress": "^0.2.3",
"@types/qs": "^6.9.15",
"@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"autoprefixer": "^10.4.19",
"cz-git": "1.9.2",
"czg": "^1.9.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-vue": "^9.26.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.5",
"postcss": "^8.4.38",
"postcss-html": "^1.7.0",
"prettier": "^3.3.2",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.77.6",
"standard-version": "^9.5.0",
"stylelint": "^16.6.1",
"stylelint-config-html": "^1.1.0",
"stylelint-config-recess-order": "^5.0.1",
"stylelint-config-recommended-scss": "^14.0.0",
"stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard": "^36.0.0",
"stylelint-config-standard-scss": "^13.1.0",
"typescript": "^5.5.2",
"unplugin-vue-setup-extend-plus": "^1.0.1",
"vite": "^5.3.2",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-html": "^3.2.2",
"vite-plugin-pwa": "^0.20.0",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-devtools": "^7.3.5",
"vue-tsc": "^2.0.22"
},
"engines": {
"node": ">=16.18.0"
},
"browserslist": {
"production": [
"> 1%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"config": {
"commitizen": {
"path": "node_modules/cz-git"
}
}
}
This diff could not be displayed because it is too large.
module.exports = {
plugins: {
autoprefixer: {}
}
};
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
\ No newline at end of file
<template>
<el-config-provider :locale="locale" :size="assemblySize" :button="buttonConfig">
<router-view></router-view>
</el-config-provider>
</template>
<script setup lang="ts">
import { onMounted, reactive, computed } from "vue";
import { useI18n } from "vue-i18n";
import { getBrowserLang } from "@/utils";
import { useTheme } from "@/hooks/useTheme";
import { ElConfigProvider } from "element-plus";
import { LanguageType } from "./stores/interface";
import { useGlobalStore } from "@/stores/modules/global";
import en from "element-plus/es/locale/lang/en";
import zhCn from "element-plus/es/locale/lang/zh-cn";
const globalStore = useGlobalStore();
// init theme
const { initTheme } = useTheme();
initTheme();
// init language
const i18n = useI18n();
onMounted(() => {
const language = globalStore.language ?? getBrowserLang();
i18n.locale.value = language;
globalStore.setGlobalState("language", language as LanguageType);
});
// element language
const locale = computed(() => {
if (globalStore.language == "zh") return zhCn;
if (globalStore.language == "en") return en;
return getBrowserLang() == "zh" ? zhCn : en;
});
// element assemblySize
const assemblySize = computed(() => globalStore.assemblySize);
// element button config
const buttonConfig = reactive({ autoInsertSpace: false });
</script>
// 后端微服务模块前缀
export const PORT1 = "/apper";
export const PORT2 = "/hooks";
import { CustomAxiosRequestConfig } from "../index";
import qs from "qs";
// 声明一个 Map 用于存储每个请求的标识和取消函数
let pendingMap = new Map<string, AbortController>();
// 序列化参数,确保对象属性顺序一致
const sortedStringify = (obj: any) => {
return qs.stringify(obj, { arrayFormat: "repeat", sort: (a, b) => a.localeCompare(b) });
};
// 获取请求的唯一标识
export const getPendingUrl = (config: CustomAxiosRequestConfig) => {
return [config.method, config.url, sortedStringify(config.data), sortedStringify(config.params)].join("&");
};
export class AxiosCanceler {
/**
* @description: 添加请求
* @param {Object} config
* @return void
*/
addPending(config: CustomAxiosRequestConfig) {
// 在请求开始前,对之前的请求做检查取消操作
this.removePending(config);
const url = getPendingUrl(config);
const controller = new AbortController();
config.signal = controller.signal;
pendingMap.set(url, controller);
}
/**
* @description: 移除请求
* @param {Object} config
*/
removePending(config: CustomAxiosRequestConfig) {
const url = getPendingUrl(config);
// 如果在 pending 中存在当前请求标识,需要取消当前请求并删除条目
const controller = pendingMap.get(url);
if (controller) {
controller.abort();
pendingMap.delete(url);
}
}
/**
* @description: 清空所有pending
*/
removeAllPending() {
pendingMap.forEach(controller => {
controller && controller.abort();
});
pendingMap.clear();
}
}
import { ElMessage } from "element-plus";
/**
* @description: 校验网络请求状态码
* @param {Number} status
* @return void
*/
export const checkStatus = (status: number) => {
switch (status) {
case 401:
ElMessage.error("登录失效!请您重新登录");
break;
case 403:
ElMessage.error("当前账号无权限访问!");
break;
case 404:
ElMessage.error("你所访问的资源不存在!");
break;
case 405:
ElMessage.error("请求方式错误!请您稍后重试");
break;
case 408:
ElMessage.error("请求超时!请您稍后重试");
break;
case 500:
ElMessage.error("服务异常!");
break;
case 502:
ElMessage.error("网关错误!");
break;
case 503:
ElMessage.error("服务不可用!");
break;
case 504:
ElMessage.error("网关超时!");
break;
default:
ElMessage.error("请求失败!");
}
};
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 14:38:00
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-10-10 10:01:35
* @FilePath: \Apper-Admin-master\src\api\index.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from "axios";
import { showFullScreenLoading, tryHideFullScreenLoading } from "@/components/Loading/fullScreen";
import { LOGIN_URL } from "@/config";
import { ElMessage } from "element-plus";
import { ResultData } from "@/api/interface";
import { ResultEnum } from "@/enums/httpEnum";
// import { checkStatus } from "./helper/checkStatus";
import { AxiosCanceler } from "./helper/axiosCancel";
import { useUserStore } from "@/stores/modules/user";
import router from "@/routers";
import { useGlobalStore } from "@/stores/modules/global";
const globalStore = useGlobalStore();
console.log(globalStore.initialData, "globalStore");
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
loading?: boolean;
cancel?: boolean;
}
const { request: config } = globalStore.initialData!;
// const config = {
// // 默认地址请求地址,可在 .env.** 文件中修改
// baseURL: import.meta.env.VITE_API_URL as string,
// // 设置超时时间
// timeout: ResultEnum.TIMEOUT as number,
// // 跨域时候允许携带凭证
// withCredentials: true
// };
const axiosCanceler = new AxiosCanceler();
class RequestHttp {
service: AxiosInstance;
public constructor(config: AxiosRequestConfig) {
// instantiation
this.service = axios.create(config);
/**
* @description 请求拦截器
* 客户端发送请求 -> [请求拦截器] -> 服务器
* token校验(JWT) : 接受服务器返回的 token,存储到 vuex/pinia/本地储存当中
*/
this.service.interceptors.request.use(
(config: CustomAxiosRequestConfig) => {
const userStore = useUserStore();
// 重复请求不需要取消,在 api 服务中通过指定的第三个参数: { cancel: false } 来控制
config.cancel ??= true;
config.cancel && axiosCanceler.addPending(config);
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制
config.loading ??= true;
config.loading && showFullScreenLoading();
if (config.headers && typeof config.headers.set === "function") {
config.headers.set("x-access-token", userStore.token);
}
return config;
},
(error: AxiosError) => {
return Promise.reject(error);
}
);
/**
* @description 响应拦截器
* 服务器换返回信息 -> [拦截统一处理] -> 客户端JS获取到信息
*/
this.service.interceptors.response.use(
(response: AxiosResponse & { config: CustomAxiosRequestConfig }) => {
const { data, config } = response;
const userStore = useUserStore();
axiosCanceler.removePending(config);
config.loading && tryHideFullScreenLoading();
// 登录失效
if (data.code == ResultEnum.OVERDUE) {
userStore.setToken("");
router.replace(LOGIN_URL);
ElMessage.error(data.msg);
return Promise.reject(data);
}
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
if (data.code && data.code !== ResultEnum.SUCCESS) {
ElMessage.error(data.message);
return Promise.reject(data);
}
// 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑)
return data;
},
async (error: AxiosError) => {
tryHideFullScreenLoading();
// 请求超时 && 网络错误单独判断,没有 response
if (error.message.indexOf("timeout") !== -1) ElMessage.error("请求超时!请您稍后重试");
if (error.message.indexOf("Network Error") !== -1 || error.message.indexOf("500") !== -1)
ElMessage.error("网络错误!请您稍后重试");
// 服务器结果都没有返回(可能服务器错误可能客户端断网),断网处理:可以跳转到断网页面
// if (!window.navigator.onLine) router.replace("/500");
return Promise.reject(error);
}
);
}
/**
* @description 常用请求方法封装
*/
get<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
return this.service.get(url, { params, ..._object });
}
post<T>(url: string, params?: object | string, _object = {}): Promise<ResultData<T>> {
return this.service.post(url, params, _object);
}
put<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
return this.service.put(url, params, _object);
}
delete<T>(url: string, params?: any, _object = {}): Promise<ResultData<T>> {
return this.service.delete(url, { params, ..._object });
}
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
return this.service.post(url, params, { ..._object, responseType: "blob" });
}
}
export default new RequestHttp(config);
import { k } from "vite/dist/node/types.d-aGj9QkWt";
// 请求响应参数(不包含data)
export interface Result {
code: string;
msg: string;
}
// 请求响应参数(包含data)
export interface ResultData<T = any> extends Result {
data: T;
}
// 分页响应参数
export interface ResPage<T> {
list: T[];
pageNum: number;
pageSize: number;
total: number;
}
// 分页请求参数
export interface ReqPage {
pageNum: number;
pageSize: number;
}
// 文件上传模块
export namespace Upload {
export interface ResFileUrl {
fileUrl: string;
}
}
// 登录模块
export namespace Login {
export interface ReqLoginForm {
username: string;
password: string;
}
export interface ResLogin {
access_token: string;
}
export interface ResAuthButtons {
[key: string]: string[];
}
}
export namespace Device {
export interface ReqDeviceParams extends ReqPage {
user?: string;
mobile?: string;
}
export interface ResDeviceList {
id: number;
user: string;
mobile: string;
log_saved_days: string;
device_id: number;
last_log_remove_time: string;
last_log_upload_time: string;
last_offline_time: string;
last_login_time: string;
sn: string;
status: number;
log_config: {
[key in string]: string;
};
log_user_fields: any[];
}
export interface ReportParams {
day: number;
isDelete: boolean;
}
export interface FileList {
id: number;
device_id: number;
filename: string;
size: number;
created_at: string;
path: string;
}
}
// 用户管理模块
export namespace User {
export interface ReqUserParams extends ReqPage {
username: string;
gender: number;
idCard: string;
email: string;
address: string;
createTime: string[];
status: number;
}
export interface ResUserList {
id: string;
username: string;
gender: number;
user: { detail: { age: number } };
idCard: string;
email: string;
address: string;
createTime: string;
status: number;
avatar: string;
photo: any[];
children?: ResUserList[];
}
export interface ResStatus {
userLabel: string;
userValue: number;
}
export interface ResGender {
genderLabel: string;
genderValue: number;
}
export interface ResDepartment {
id: string;
name: string;
children?: ResDepartment[];
}
export interface ResRole {
id: string;
name: string;
children?: ResDepartment[];
}
}
export namespace Fields {
export interface ReqFieldsParams extends ReqPage {}
export interface ResFieldsList {
id: number;
name: string;
type: string;
}
}
import { ResPage, Device } from "@/api/interface/index";
import http from "@/api";
/**
* @name 设备管理模块
*/
// 获取设备列表
export const getDeviceList = (params: Device.ReqDeviceParams) => {
return http.get<ResPage<Device.ResDeviceList>>(`/device`, params);
};
// 新增设备
export const addDevice = params => {
return http.post(`/device/add`, params);
};
// 新增设备信息
export const addDeviceInfo = params => {
return http.post(`/device/addInfo`, params);
};
// 编辑设备
export const editDevice = params => {
return http.post(`/device/updateInfo`, params);
};
// 新增配置信息
export const addConfig = params => {
return http.post(`/config/add`, params);
};
// 编辑配置信息
export const editConfig = params => {
return http.post(`/config/edit`, params);
};
// 删除设备
export const deleteDevice = params => {
return http.post(`/device/deleteInfo`, params);
};
// 给设备发指令
export const sendCmd = params => {
return http.post(`/broadcast/cmd`, params);
};
// 获取文件列表
export const FileList = params => {
return http.get(`/file/list`, params);
};
import { ResPage, Fields } from "@/api/interface/index";
import http from "@/api";
/**
* @name 字段管理模块
*/
// 获取字段列表
export const getList = (params: Fields.ReqFieldsParams) => {
return http.get<ResPage<Fields.ResFieldsList>>(`/fields/user/list`, params);
};
export const fieldAdd = (params: Fields.ReqFieldsParams) => {
return http.post<ResPage<Fields.ResFieldsList>>(`/fields/user/add`, params);
};
import { Login } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import authMenuList from "@/assets/json/authMenuList.json";
import authButtonList from "@/assets/json/authButtonList.json";
import http from "@/api";
/**
* @name 登录模块
*/
// 用户登录
export const loginApi = (params: Login.ReqLoginForm) => {
return http.post<Login.ResLogin>(PORT1 + `/login`, params, { loading: false }); // 正常 post json 请求 ==> application/json
// return http.post<Login.ResLogin>(PORT1 + `/login`, params, { loading: false }); // 控制当前请求不显示 loading
// return http.post<Login.ResLogin>(PORT1 + `/login`, {}, { params }); // post 请求携带 query 参数 ==> ?username=admin&password=123456
// return http.post<Login.ResLogin>(PORT1 + `/login`, qs.stringify(params)); // post 请求携带表单参数 ==> application/x-www-form-urlencoded
// return http.get<Login.ResLogin>(PORT1 + `/login?${qs.stringify(params, { arrayFormat: "repeat" })}`); // get 请求可以携带数组等复杂参数
};
// 获取菜单列表
export const getAuthMenuListApi = () => {
return http.get<Menu.MenuOptions[]>(PORT1 + `/menu/list`, {}, { loading: false });
// 如果想让菜单变为本地数据,注释上一行代码,并引入本地 authMenuList.json 数据
return authMenuList;
};
// 获取按钮权限
export const getAuthButtonListApi = () => {
return http.get<Login.ResAuthButtons>(PORT1 + `/auth/buttons`, {}, { loading: false });
// 如果想让按钮权限变为本地数据,注释上一行代码,并引入本地 authButtonList.json 数据
return authButtonList;
};
// 用户退出登录
export const logoutApi = () => {
return http.post(PORT1 + `/logout`);
};
import { Upload } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";
/**
* @name 文件上传模块
*/
// 图片上传
export const uploadImg = (params: FormData) => {
return http.post<Upload.ResFileUrl>(PORT1 + `/file/upload/img`, params, { cancel: false });
};
// 视频上传
export const uploadVideo = (params: FormData) => {
return http.post<Upload.ResFileUrl>(PORT1 + `/file/upload/video`, params, { cancel: false });
};
import { ResPage, User } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";
/**
* @name 用户管理模块
*/
// 获取用户列表
export const getUserList = (params: User.ReqUserParams) => {
return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/list`, params);
};
// 获取树形用户列表
export const getUserTreeList = (params: User.ReqUserParams) => {
return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/tree/list`, params);
};
// 新增用户
export const addUser = (params: { id: string }) => {
return http.post(PORT1 + `/user/add`, params);
};
// 批量添加用户
export const BatchAddUser = (params: FormData) => {
return http.post(PORT1 + `/user/import`, params);
};
// 编辑用户
export const editUser = (params: { id: string }) => {
return http.post(PORT1 + `/user/edit`, params);
};
// 删除用户
export const deleteUser = (params: { id: string[] }) => {
return http.post(PORT1 + `/user/delete`, params);
};
// 切换用户状态
export const changeUserStatus = (params: { id: string; status: number }) => {
return http.post(PORT1 + `/user/change`, params);
};
// 重置用户密码
export const resetUserPassWord = (params: { id: string }) => {
return http.post(PORT1 + `/user/rest_password`, params);
};
// 导出用户数据
export const exportUserInfo = (params: User.ReqUserParams) => {
return http.download(PORT1 + `/user/export`, params);
};
// 获取用户状态字典
export const getUserStatus = () => {
return http.get<User.ResStatus[]>(PORT1 + `/user/status`);
};
// 获取用户性别字典
export const getUserGender = () => {
return http.get<User.ResGender[]>(PORT1 + `/user/gender`);
};
// 获取用户部门列表
export const getUserDepartment = () => {
return http.get<User.ResDepartment[]>(PORT1 + `/user/department`, {}, { cancel: false });
};
// 获取用户角色字典
export const getUserRole = () => {
return http.get<User.ResRole[]>(PORT1 + `/user/role`);
};
No preview for this file type
No preview for this file type
No preview for this file type
@font-face {
font-family: YouSheBiaoTiHei;
src: url("./YouSheBiaoTiHei.ttf");
}
@font-face {
font-family: MetroDF;
src: url("./MetroDF.ttf");
}
@font-face {
font-family: DIN;
src: url("./DIN.otf");
}
@font-face {
font-family: iconfont; /* Project id 2667653 */
src: url("iconfont.ttf?t=1719667796161") format("truetype");
}
.iconfont {
font-family: iconfont !important;
font-size: 20px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
cursor: pointer;
}
.icon-yiwen::before {
font-size: 15px;
content: "\e693";
}
.icon-xiala::before {
content: "\e62b";
}
.icon-tuichu::before {
content: "\e645";
}
.icon-xiaoxi::before {
font-size: 21.2px;
content: "\e61f";
}
.icon-zhuti::before {
font-size: 22.4px;
content: "\e638";
}
.icon-sousuo::before {
content: "\e611";
}
.icon-contentright::before {
content: "\e8c9";
}
.icon-contentleft::before {
content: "\e8ca";
}
.icon-fangda::before {
content: "\e826";
}
.icon-suoxiao::before {
content: "\e641";
}
.icon-zhongyingwen::before {
content: "\e8cb";
}
.icon-huiche::before {
content: "\e637";
}
No preview for this file type
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M574 342.8m-38.3 0a38.3 38.3 0 1 0 76.6 0 38.3 38.3 0 1 0-76.6 0Z" fill="#F2B843" /><path d="M627 697c15.2-20.7 45.3-294-45-383.3-3-6.1-0.4-13.5 5.7-16.5 6.2-3 13.5-0.5 16.5 5.7C689.8 370.2 719.9 573 705.1 697H627z" fill="#EA800C" /><path d="M617.8 307.4m-38.3 0a38.3 38.3 0 1 0 76.6 0 38.3 38.3 0 1 0-76.6 0Z" fill="#F2B843" /><path d="M608 272.5L461 502.8c-33.6-47.5-37.2-112.5-3.9-164.6 33.2-52.1 93.7-76.2 150.9-65.7z" fill="#3DC38A" /><path d="M742.5 132.3L569.9 299.8c-19.2-47.5-9.1-103.9 29.9-141.8 39.1-37.9 95.8-46.3 142.7-25.7z" fill="#2F9B77" /><path d="M608.7 289.2l-239.6 21.1c15.1-49 58.5-86.4 112.7-91.1 54.2-4.8 103.5 24.4 126.9 70z" fill="#2F9B77" /><path d="M594.7 269.9L408.5 168.4c35-28.6 85.2-34.8 127.3-11.9 42.1 23 64 68.6 58.9 113.4z" fill="#3DC38A" /><path d="M825.5 331.8l-271.4-31.4c28-51 84.9-82.7 146.3-75.6 61.3 7 109.5 51 125.1 107z" fill="#3DC38A" /><path d="M75.3 868.9c0-86.5 104.3-173 233-173s233 86.5 233 173h-466z" fill="#2F9B77" /><path d="M938.2 868.9c0-116.2-130.9-232.3-292.3-232.3S353.5 752.7 353.5 868.9h584.7z" fill="#3DC38A" /><path d="M858.9 701.5c-28.1-23.1-60.4-41.4-95.9-54.3-14.5-5.3-29.3-9.5-44.3-12.8 0.2-51.3-5.5-106.3-16.2-155.9-11.9-54.8-29.5-101.6-51.2-136.3 5.6-5.3 9.7-11.8 12.2-19.1l160.8 18.6c0.4 0 0.8 0.1 1.2 0.1 2.9 0 5.7-1.3 7.6-3.5 2.2-2.5 2.9-6 2-9.2-8.3-29.8-25.1-56.3-48.5-76.7-24-20.9-53.5-33.9-85.1-37.5-9.7-1.1-19.3-1.3-28.9-0.7l76.8-74.6c2.4-2.3 3.5-5.7 2.9-8.9-0.6-3.3-2.8-6-5.8-7.4-52.3-23-112.6-12.1-153.7 27.7-7.2 7-13.6 14.7-19.1 23.1-9.4-10.5-20.6-19.4-33.1-26.2-44.7-24.3-99-19.2-138.4 12.9-2.6 2.1-3.9 5.4-3.6 8.7s2.2 6.3 5.2 7.9l62.5 34c-50.2 9.8-91.2 46.2-106.6 96-1 3.2-0.3 6.6 1.8 9.2 1.9 2.4 4.8 3.7 7.8 3.7h0.9l94.5-8.3c-5.8 6.4-11 13.3-15.8 20.8-17.2 26.9-25.7 57.9-24.7 89.7 1 31 11 60.8 28.9 86 1.9 2.7 4.9 4.2 8.2 4.2h0.2c3.3-0.1 6.4-1.8 8.2-4.6L549 383.9c7.5 4.6 16.1 7.1 25.2 7.1 13.4 0 25.9-5.5 34.8-14.7 27.2 70.9 29.2 175.3 21.8 250.6-34.9 1.5-69.1 8.3-101.8 20.2-35.5 12.9-67.8 31.2-95.9 54.3-3.2 2.6-6.3 5.3-9.4 8.1-35.7-15.5-75.4-23.6-115.1-23.6-63.1 0-123.8 19.9-170.9 56.1-45.8 35.3-72.1 81.5-72.1 126.9 0 5.5 4.5 10 10 10h862.9c5.5 0 10-4.5 10-10-0.3-59.7-32.8-120.7-89.6-167.4z m-226.2-370c-3.3 2.1-7 3.4-10.9 3.9-1-6.4-3.2-12.5-6.5-17.9l27.6 3.2c-2.3 4.4-5.8 8.1-10.2 10.8z m66.6-96.8c27.6 3.2 53.3 14.5 74.3 32.7 16.6 14.5 29.4 32.4 37.5 52.6l-152.7-17.7c-0.4-0.1-0.8-0.2-1.2-0.2-0.4 0-0.8-0.1-1.2-0.1l-65.3-7.6c-1-0.3-2-0.4-2.9-0.3l-5.5-0.6c-0.1 0-0.2-0.1-0.3-0.1-0.7-0.1-1.3-0.2-2-0.2l-8.8-1c5.3-7.5 11.3-14.5 18-20.8 0.5-0.4 1-0.8 1.4-1.3 8.7-8 18.4-14.9 29.1-20.5 8-4.2 16.4-7.6 24.9-10.2 0.5-0.1 0.9-0.2 1.4-0.4 17-4.8 35.1-6.4 53.3-4.3z m-92.5-69.4c31.5-30.5 76.2-41.2 117.4-29l-87 84.4c-9.3 2.9-18.4 6.6-27.1 11.2-2.2 1.2-4.3 2.4-6.5 3.6-2.8-15.7-8.5-30.8-17-44.4 5.5-9.5 12.3-18.2 20.2-25.8z m-75.8 0.1c14.4 7.9 26.4 18.6 35.7 31.9 10.5 15.1 16.8 32.7 18.4 51-1.2 1-2.5 2-3.6 3l-74-40.3c-0.8-0.7-1.8-1.2-2.8-1.5l-77.2-42.1c31.3-18.8 70.6-20 103.5-2z m-48.2 63.8c5.2-0.5 10.3-0.6 15.4-0.4l68.2 37.1c-5.1 5.7-9.9 11.8-14.2 18.2l-60 5.3-108.1 9.5c17.8-39.1 55-66 98.7-69.7zM461.2 484c-24.3-43.9-23-97.5 4.5-140.6 8.5-13.4 19-24.9 31.3-34.4l48.3-4.2s0 0.1 0.1 0.1c1.5 3 4.4 5 7.7 5.3l17.8 2.1-32.1 50.3c-0.6 0.7-1 1.4-1.4 2.2L461.2 484zM574 371c-5.2 0-10.1-1.4-14.4-3.9l29.3-45.9 1.1-1.8c7.6 5.2 12.4 13.9 12.4 23.4v2.1c-0.1 1.8-0.5 3.8-1.1 6.1-0.2 0.6-0.4 1.1-0.6 1.7-4.2 10.9-14.8 18.3-26.7 18.3z m47.8-15.5c4.3-0.3 8.6-1.3 12.6-2.7 20.5 32.6 37.2 77.3 48.6 129.9 10.2 47.1 15.7 99.1 15.8 148-15.9-2.5-31.9-3.8-48.1-4 2.7-28.8 5.6-76.5 1.8-130.4-4-57.6-14.3-104.8-30.7-140.8zM149.6 757.9c43.6-33.5 99.9-52 158.7-52 34.2 0 68.3 6.5 99.4 18.8-38.4 40-61.1 87.2-63.9 134.2h-258c3.6-35.9 26.4-72.2 63.8-101z m391.7 101H363.8c3.4-50.5 32.8-101.8 81.7-142 26.4-21.7 56.6-38.8 90-50.9 35.4-12.8 72.5-19.4 110.4-19.4 37.9 0 75 6.5 110.3 19.4 33.4 12.1 63.6 29.3 90 50.9 48.9 40.2 78.2 91.5 81.6 142H541.3z" fill="#4D3500" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M732 893c-210.4 121.5-479.5 49.4-601-161S81.6 252.5 292 131s479.5-49.4 601 161 49.4 479.5-161 601z" fill="#3DC38A" /><path d="M543 380.4c-3.2 0.7-9.3 2.3-12 4.4-3.3 2.7 1.9 6.1 0 7.6-3.3 2.6-5.6 7.3-12.6 6.9-14.6-0.9-37-19.8-50.4-27 21.5-22.1-12.5-25.5-25.8-24.3-17.2 1.4-46.9-0.1-62.4 8.6-10.8 6.1-25.2 31.2-33.9 41.2-12.1 13.9-24.2 26-32.1 42.6-28.9 61.1 15.6 131.2 85.4 123 19.4-2.3 39.7-14.5 56.9 1.6 12.7 11.9 6 23 9.3 36.8 2.9 12 16.1 19.3 20.7 30.3 8.8 21.1 3.2 34.2-3 53.6-8.2 25.5 13.1 55.7 21.3 80.3 4.2 12.4 16.3 47.1 28.3 52.5 18.8 8.5 48.2-17.1 59.4-30.8 8.8-10.8 5.9-21.7 11.8-31.8 6.4-10.9 14.4-14.2 18.9-28.2 4.8-15.2 9.8-18.9 20-30 16.4-17.8 13.8-28.2 7.3-49.3-13.6-43.8 35.8-64.3 58-96.5 23.2-33.6-21.7-22.4-39.2-33.9-18.1-11.8-26-34.3-34.7-52.9s-15.9-46.6-30.4-61.9c-11.2-11.6-45-17-60.8-22.8zM770.1 674.4c-7 23.6-14 47.3-21 70.9-4.9 16.5-22.2 70.6-46.6 36-9.2-13.2-1.7-30.4 3.4-42.5 6.5-15.3-2.3-23 2.3-37.4 5.2-16.6 26.6-17.1 36.7-28.8 7.1-8.1 11.4-21.1 16.6-30.6 2.9 10.8 5.8 21.6 8.6 32.4z" fill="#F2B843" /><path d="M893 292C817.2 160.8 684 83.4 543.5 73.2L486 145.4l-123.3 43.2-33.1 80.2 51 71.5 5.4-15.1c9.1-25.2 33-42.1 59.8-42.1h84.1l96.7 34 33.3 31.8V369l46.3 88.7 13.5-5c29.1-10.7 55.5-27.7 77.5-49.6L786 386.3c-3.6-5.3 0.3-12.5 6.7-12.5h27c7.9 0 15.4 3.5 20.5 9.5l22 25.8c2.1 2.5 3.7 5.3 4.8 8.3l24.3 66.9 11.6-11.6c7.3-7.3 11-17.2 11.2-27.6 0.1-8.3 3.7-16.2 9.9-21.7l8.9-7.9c2.2-2 4.7-3.6 7.4-4.8-9.7-40.6-25.3-80.6-47.3-118.7zM234.8 309.2l21-22.5c15.3-16.4 19.7-40.3 11.1-61.1-9.1-22-28.9-36.2-50.9-39.2C138.4 256.8 90.1 351.6 76.2 452c16.4 14.4 33.6 29.7 33.5 31.1-0.2 2.6 61.6-7.8 61.6-7.8l-31.8-46.6 45.6-32.6 49.7-86.9zM277.6 747.6c19.8-6.4 30.7-27.7 24.2-47.6l-5.7-17.4c-2.5-7.6-2.5-15.8 0-23.4 7.1-21.6-6.4-44.5-28.6-48.8l-44.5-8.7-81.2-61.7-67.1 21.8C81.4 620 99.8 677.9 131 732c28.9 50 66.1 92.2 108.8 125.8l20-104.4 17.8-5.8z" fill="#2F9B77" /><path d="M958.6 456.4c-2-15.9-4.8-31.6-8.4-47.1 0-0.3-0.1-0.6-0.2-0.8-0.8-3.3-1.6-6.6-2.5-9.9l-1.5-5.7c0-0.2-0.1-0.3-0.1-0.5-9.3-33.8-22.6-66.4-39.8-97.5-0.2-0.4-0.5-0.9-0.7-1.3-1.2-2.2-2.4-4.4-3.7-6.5-1.6-2.8-3.3-5.6-4.9-8.3-0.5-0.9-1-1.7-1.6-2.6-1.5-2.4-3-4.8-4.5-7.1-0.9-1.5-1.9-2.9-2.8-4.4-0.5-0.8-1.1-1.7-1.7-2.5-28-42-62.4-78.6-102.7-109.1-46.4-35.1-98.6-60.5-155-75.6s-114.3-19.2-172.1-12c-59.8 7.4-116.8 26.6-169.4 57s-97.7 70.1-134 118.2c-35.1 46.4-60.5 98.6-75.6 155C62.8 450.1 58.5 506 64.7 561.8c0 0.4 0 0.7 0.1 1.1 1.9 16.3 4.6 32.4 8.2 48.2 0.1 0.5 0.2 1 0.3 1.4 0.3 1.1 0.5 2.2 0.8 3.3 0.2 0.9 0.4 1.8 0.7 2.8 0.2 0.7 0.3 1.4 0.5 2.1 0.3 1.3 0.7 2.6 1 3.9 0.1 0.4 0.2 0.7 0.3 1 0.4 1.7 0.9 3.3 1.3 5v0.1c10.1 36.9 25 72.4 44.4 106.1 0.1 0.2 0.3 0.5 0.4 0.7 1.7 2.9 3.4 5.8 5.2 8.7 1.3 2.1 2.7 4.3 4 6.4 0.6 0.9 1.2 1.9 1.8 2.9 1.4 2.3 2.9 4.5 4.4 6.7 0.5 0.8 1 1.6 1.6 2.4 1.5 2.2 3.1 4.5 4.6 6.7 0.5 0.8 1 1.5 1.6 2.3 1.6 2.2 3.2 4.4 4.7 6.5 0.6 0.8 1.1 1.5 1.7 2.3l4.8 6.3c0.6 0.8 1.2 1.6 1.8 2.3 1.6 2 3.2 4 4.9 6 0.7 0.8 1.3 1.6 2 2.4l4.8 5.7c0.7 0.9 1.5 1.7 2.2 2.6l4.8 5.4c0.8 0.9 1.7 1.9 2.5 2.8 1.5 1.7 3.1 3.4 4.7 5 1 1 1.9 2 2.9 3.1 1.5 1.5 3 3.1 4.5 4.6l3.4 3.4c1.4 1.4 2.8 2.8 4.2 4.1 1.3 1.2 2.6 2.5 3.9 3.7l3.9 3.6c1.5 1.4 3.1 2.8 4.6 4.1 1.1 1 2.2 2 3.4 3 1.8 1.6 3.6 3.1 5.4 4.7 0.9 0.8 1.8 1.5 2.7 2.3l6.6 5.4 1.8 1.5c0.5 0.4 1 0.8 1.6 1.3 0.2 0.2 0.5 0.4 0.8 0.5 2.1 1.6 4.1 3.2 6.2 4.8 46.4 35.1 98.6 60.5 155 75.6 38.4 10.3 77.4 15.4 116.6 15.4 18.5 0 37-1.1 55.5-3.4 59.8-7.4 116.8-26.6 169.4-57 52.6-30.4 97.7-70.1 134-118.2 35.1-46.4 60.5-98.6 75.6-155s19-114.3 11.8-172z m-165.9-92.6c-6.7 0-12.8 3.7-16 9.6-3.1 5.9-2.7 13 0.9 18.4l6.5 9.8c-19.8 18.2-43.1 32.5-68 41.7l-5.2 1.9-41.1-78.7v-17.6c0-2.7-1.1-5.3-3.1-7.2l-33.3-31.8c-1-1-2.2-1.7-3.6-2.2l-96.7-34a9.6 9.6 0 0 0-3.3-0.6h-84.1c-29.9 0-56.9 18.3-68.1 45.9L341 267.5l29.3-70.9 119.1-41.7c1.8-0.6 3.3-1.7 4.5-3.2l54.2-68c131.1 11.1 249.2 81.2 321.7 189.8 0.5 0.8 1 1.5 1.5 2.3 0.9 1.4 1.8 2.7 2.7 4.1 1.4 2.2 2.9 4.5 4.3 6.8 0.5 0.8 1 1.6 1.4 2.4 1.6 2.6 3.2 5.3 4.8 8v0.1c1.1 1.9 2.2 3.8 3.3 5.8 0.3 0.5 0.5 0.9 0.8 1.4 1 1.8 1.9 3.5 2.9 5.3 0.1 0.2 0.2 0.4 0.3 0.5 14.9 28 26.7 57.5 35.1 88.1 0.1 0.4 0.2 0.9 0.4 1.3 0.3 1.3 0.7 2.5 1 3.8 0.2 0.9 0.5 1.8 0.7 2.6-0.9 0.7-1.8 1.4-2.6 2.1l-8.9 7.9c-8.3 7.4-13.1 17.9-13.3 29-0.2 8.2-3.1 15.5-8.3 20.7l-0.5 0.5-19-52.2c-1.5-4.1-3.7-7.9-6.6-11.3l-22-25.8c-7-8.3-17.3-13-28.1-13h-27z m-334.6 10c0.5 3.1 2.4 5.8 5.1 7.3 3.7 2 8.5 5.2 13.6 8.6 13.2 8.8 28.1 18.8 40.9 19.6 9.8 0.6 15.2-4.8 18-7.7 0.5-0.5 1-1.1 1.4-1.3 1.3-1 4.4-4 4.2-9.1 0.4-0.1 0.7-0.2 1.1-0.3 4.6 1.5 10.1 3 15.8 4.5 13.7 3.7 32.4 8.7 38.2 14.8 8.8 9.3 15.2 25.7 20.8 40.2 2.6 6.8 5.1 13.2 7.8 19 1.2 2.6 2.4 5.3 3.7 8.2 7.8 17.4 16.7 37.2 34.6 48.9 7.6 5 17.7 6.5 26.6 7.9 4.5 0.7 11.8 1.8 14.5 3.2-0.3 1.2-1.3 3.9-4.6 8.8-6.3 9.1-15.5 17.7-24.5 26.1-21.6 20.1-46.1 42.9-34.8 79 6 19.6 7.9 25.5-5.1 39.6-1.4 1.5-2.7 2.9-3.9 4.1-7.8 8.3-13.5 14.3-18.3 29.6-2.1 6.5-5 9.8-8.9 14.2-2.9 3.2-6.1 6.9-9.1 12-3.4 5.8-4.5 11.5-5.6 16.6-1.1 5.4-1.9 9.7-5.4 13.9-12 14.7-36.6 33-47.6 28-0.3-0.2-8.7-4.5-22.9-46.5-2.4-7.3-5.8-14.8-9.4-22.6-8.2-18.1-16.6-36.8-11.9-51.5 0.5-1.5 1-3 1.4-4.4 5.8-17.8 10.8-33.2 1.3-56.1-2.7-6.5-7.4-11.7-11.6-16.3-3.9-4.3-7.7-8.4-8.6-12.5-0.8-3.5-0.8-7.1-0.8-10.9 0.1-8.9 0.2-20-11.4-30.9-8.9-8.3-18.4-10.9-27.7-10.9-8.1 0-16.1 2-23.2 3.7-4.9 1.2-9.6 2.4-14 2.9-28.1 3.3-53.2-7.4-68.9-29.3-16.3-22.7-18.7-53.2-6.3-79.5 6-12.6 15-22.8 24.6-33.6 2-2.2 4-4.5 6-6.8 3.3-3.7 7-9.1 11-14.7 6-8.5 15.1-21.4 20.3-24.4 9.7-5.4 28.6-6.1 43.8-6.6 5.2-0.2 10.2-0.4 14.6-0.7 8.1-0.7 17.9 0.8 21.4 2.7-0.5 0.9-1.6 2.5-3.7 4.6-2 2.4-3 5.5-2.5 8.6z m-280.6 15.4l-43.8 31.3c-4.4 3.2-5.5 9.3-2.4 13.8l22.9 33.6c-16.5 2.6-32.4 4.8-39.5 5.4-2.1-2.2-5-4.8-8.8-8.3-5.6-5.1-12.7-11.4-19-17 14.6-96.4 61.3-185.1 132.3-251 17.4 3.8 31.6 15.6 38.5 32.3 7.1 17.1 3.5 36.9-9.2 50.5l-21 22.5c-0.5 0.6-1 1.2-1.4 1.9l-48.6 85z m109.1 296.5l5.7 17.4c2.3 7.1 1.7 14.6-1.6 21.2-3.4 6.6-9.1 11.5-16.1 13.8l-17.8 5.8c-3.5 1.1-6 4-6.7 7.6l-16.8 87.9c-1.4-1.2-2.8-2.3-4.1-3.5-0.6-0.6-1.3-1.1-1.9-1.7-2.2-1.9-4.3-3.9-6.5-5.8-0.4-0.3-0.8-0.7-1.1-1-2.4-2.2-4.7-4.4-7.1-6.7-1.1-1-2.1-2.1-3.2-3.2l-3.7-3.7c-1.2-1.3-2.5-2.5-3.7-3.8-1-1.1-2-2.1-3.1-3.2l-3.9-4.2-2.7-3c-1.3-1.5-2.7-3-4-4.5-0.8-0.9-1.5-1.7-2.3-2.6-1.4-1.6-2.8-3.3-4.2-4.9-0.4-0.5-0.7-0.9-1.1-1.4-3.4-4.1-6.8-8.4-10-12.6-0.1-0.2-0.3-0.3-0.4-0.5-1.3-1.7-2.6-3.5-3.9-5.2-0.7-0.9-1.4-1.8-2-2.8-1.2-1.6-2.3-3.2-3.5-4.9-0.8-1.1-1.6-2.2-2.3-3.3-1.1-1.5-2.1-3.1-3.2-4.7-0.9-1.3-1.7-2.5-2.5-3.8-1-1.5-1.9-2.9-2.9-4.4-1-1.5-1.9-3.1-2.9-4.6-0.8-1.3-1.6-2.5-2.3-3.8-1.7-2.8-3.4-5.7-5.1-8.5-19.4-33.7-34.1-69.2-43.8-106.2-0.1-0.3-0.2-0.6-0.2-1l-0.9-3.6c-0.2-0.7-0.3-1.4-0.5-2.1-0.2-0.8-0.4-1.7-0.6-2.5-0.3-1.1-0.5-2.2-0.8-3.3-0.1-0.4-0.2-0.8-0.3-1.3-2.8-12.6-5.1-25.3-6.8-38.2l54.2-17.6 77 58.5c1.2 0.9 2.6 1.6 4.1 1.9l44.5 8.7c7.8 1.5 14.5 6.3 18.6 13.2 4 6.9 4.9 15.1 2.4 22.7-3.2 9.5-3.2 19.7 0 29.4z m640.7-62.5c-14.4 54-38.8 103.8-72.3 148.2-34.7 45.9-77.8 83.9-128 112.9-50.3 29-104.7 47.3-161.8 54.4-55.2 6.8-110.5 3-164.4-11.5-54-14.3-103.8-38.7-148.2-72.2-0.6-0.5-1.2-0.9-1.8-1.4l17.7-92.5 12.2-4c12.1-3.9 22-12.3 27.8-23.7 5.8-11.4 6.8-24.3 2.8-36.5l-5.7-17.4c-1.8-5.6-1.8-11.5 0-17.2 4.3-13 2.8-27.3-4.2-39.1-6.9-11.8-18.6-20.1-32-22.7l-42.2-8.3-79.3-60.2c-2.6-2-6-2.6-9.1-1.5l-55.2 17.9c-2.2-25.5-2-51 0.3-76.3 9.4 8.4 15.1 13.7 17.1 15.8 0.5 1 1.2 1.9 2.1 2.7 2.4 2.2 5.1 2.9 9 2.9 2.5 0 5.6-0.3 9.4-0.7 5.3-0.6 12.5-1.6 21.4-2.9 15-2.2 30-4.7 30.1-4.8 3.4-0.6 6.2-2.8 7.5-5.9 1.3-3.1 1-6.7-0.9-9.6l-26.3-38.5 37.6-26.9c1.2-0.8 2.1-1.9 2.9-3.2l49.1-85.9 20.2-21.7c18-19.3 23.1-47.4 13-71.7-7.5-18.2-21.9-32.4-39.6-40 18.8-15.6 39-29.7 60.5-42.1 50.3-29 104.7-47.3 161.8-54.4 17.7-2.2 35.4-3.3 53-3.3 3.9 0 7.9 0.1 11.8 0.2L480 136.9l-120.6 42.2c-2.7 0.9-4.8 3-5.9 5.6L320.4 265c-1.3 3.2-0.9 6.8 1.1 9.6l51 71.5c0.6 0.8 1.2 1.5 2 2.1-9 5.3-17.8 17.9-26.4 30-3.7 5.2-7.1 10.1-9.7 13.1-2 2.2-3.9 4.4-5.8 6.6-10.1 11.3-20.5 23.1-27.8 38.3-15.6 32.9-12.5 71.1 8.1 99.7 19.8 27.6 52.5 41.6 87.5 37.5 5.7-0.7 11.2-2 16.5-3.4 15.1-3.8 24.1-5.5 32.4 2.3 5.2 4.9 5.1 8.6 5.1 16.1 0 4.6-0.1 9.8 1.3 15.7 2.2 9.1 8.1 15.6 13.3 21.3 3.3 3.7 6.5 7.2 7.9 10.5 6.7 16 3.5 25.9-1.8 42.2l-1.5 4.5c-7.1 22.1 3.4 45.3 12.7 65.9 3.3 7.4 6.5 14.3 8.6 20.7 12 35.3 22.3 53.3 33.7 58.4 4 1.8 8.1 2.6 12.3 2.6 23.7 0 49.6-24.8 58.9-36.2 6.6-8 8.2-16.1 9.5-22.7 0.8-4 1.5-7.5 3.2-10.4 2-3.4 4.3-6 6.8-8.8 4.5-5.1 9.6-10.9 13-21.4 3.5-10.9 6.5-14.2 13.8-21.9 1.2-1.3 2.6-2.7 4-4.3 19.7-21.4 16.5-36.4 9.5-59-7.1-23 6.5-37.2 29.4-58.5 9.7-9.1 19.8-18.4 27.3-29.4 5-7.3 11.2-18.1 6.8-28.2-4.7-11-17.6-13-30.1-14.9-6.9-1.1-14.8-2.3-18.7-4.9-13-8.5-20.3-24.7-27.3-40.3-1.3-2.8-2.5-5.7-3.8-8.5-2.4-5.2-4.8-11.3-7.3-17.8-6.3-16.2-13.3-34.6-25-46.8-9.8-10.1-29.8-15.5-47.5-20.2-6.6-1.8-12.8-3.4-17.1-5-1.8-0.7-3.7-0.8-5.6-0.4-7.3 1.6-12.7 3.7-16 6.3l-0.2 0.2c-1.9 1.6-5.6 5.5-4.6 11.9-0.4 0.4-0.6 0.4-1.1 0.3-7.4-0.5-21.1-9.6-31-16.2-1.9-1.3-3.7-2.5-5.5-3.7 3.7-7.2 2.7-13 0.8-17-8.2-17.2-40.6-14.5-41.9-14.4-3.9 0.3-8.6 0.5-13.6 0.7-11.7 0.4-25.4 0.9-37.3 3.6l4.9-13.7c7.7-21.2 27.9-35.5 50.4-35.5H528l93.1 32.7 28.6 27.4V369c0 1.6 0.4 3.2 1.1 4.6l46.3 88.7c2.3 4.5 7.6 6.5 12.3 4.8l13.5-5c30.1-11.1 58.1-29 81.1-51.9 3.4-3.4 3.9-8.7 1.3-12.6l-9.2-13.8h23.3c5 0 9.7 2.2 12.9 6l22 25.7c1.3 1.6 2.4 3.4 3.1 5.3l24.3 66.9c1.2 3.2 3.9 5.6 7.2 6.3 0.7 0.2 1.4 0.2 2.2 0.2 2.6 0 5.2-1 7.1-2.9l11.6-11.6c8.9-8.9 13.9-21.1 14.1-34.5 0.1-5.5 2.4-10.7 6.5-14.3l3.2-2.8c2 10.2 3.7 20.4 5 30.7 7 55.2 3.2 110.5-11.3 164.4z" fill="#4D3500" /><path d="M771.2 639.4c-1.1-3.9-4.4-6.8-8.5-7.3s-8 1.5-10 5.1c-1.9 3.5-3.6 7.3-5.3 10.9-3.1 6.7-6.2 13.6-10.1 17.9-2.8 3.2-7.8 5.6-13 8.2-9.5 4.6-21.3 10.3-25.6 24.1-2.9 8.9-1.8 16-1 21.7 0.8 5.6 1.4 9.2-1 14.8l-0.2 0.6c-5.4 12.7-14.3 34-2.1 51.6 8.8 12.4 17.5 15.6 24.1 15.6 1.2 0 2.3-0.1 3.4-0.3 14.9-2.4 26.6-19.7 36.9-54.2 3.5-11.8 7-23.6 10.5-35.5l10.5-35.4c0.5-1.7 0.5-3.6 0.1-5.4-3-10.9-5.9-21.8-8.7-32.4zM750 707l-10.5 35.4c-11.3 38.2-20.8 40.2-20.9 40.2-0.7 0.1-3.5-0.9-7.9-7-5.9-8.5-0.3-21.7 4.2-32.3l0.2-0.6c4.6-10.7 3.4-18.9 2.4-25.5-0.7-4.8-1.2-8.2 0.2-12.8 1.7-5.4 6.9-8.1 15.3-12.1 6.5-3.2 14-6.7 19.4-13.1 2.4-2.7 4.4-5.7 6.3-8.9 0.3 1.3 0.7 2.6 1 3.9-3.2 10.9-6.5 21.9-9.7 32.8z" fill="#4D3500" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M834.7 409.3V820c0-32.4 26.3-58.7 58.7-58.7s58.7 26.3 58.7 58.7-26.3 58.7-58.7 58.7H130.7C98.3 878.7 72 852.4 72 820s26.3-58.7 58.7-58.7 58.7 26.3 58.7 58.7V409.3h645.3z" fill="#3DC38A" /><path d="M614.1 459c17.8 7.5 29.9 21.9 29.9 38.4 0 24.3-26.3 44-58.7 44s-58.7-19.7-58.7-44c0-16.5 12.1-30.8 29.9-38.4" fill="#F2B843" /><path d="M189.3 614.7H248c16.2 0 29.3-13.1 29.3-29.3v-41.6c0-18.9 12.1-35.8 30.1-41.7l71.8-23.9c18-6 30.1-22.8 30.1-41.7v-27H468v39.2c0 37.9-24.2 71.5-60.2 83.5L346 552.7c-6 2-10 7.6-10 13.9v18.8c0 16.2 13.1 29.3 29.3 29.3h293.3c16.2 0 29.3-13.1 29.3-29.3v-176h58.7v176c0 16.2 13.1 29.3 29.3 29.3h58.7v58.7h-73.3c-8.1 0-14.7 6.6-14.7 14.7v58.7c0 8.1 6.6 14.7 14.7 14.7h73.3V820h-73.3c-8.1 0-14.7 6.6-14.7 14.7v44H688v-176c0-16.2-13.1-29.3-29.3-29.3h-132c-16.2 0-29.3 13.1-29.3 29.3v176h-58.7V673.3H336v11.6c0 69-20.4 136.4-58.7 193.8H204l13.7-19.1c38.8-54.3 59.7-119.4 59.7-186.2h-88l-0.1-58.7z" fill="#F2B843" /><path d="M72 820c0-32.4 26.3-58.7 58.7-58.7s58.7 26.3 58.7 58.7V409.3c0-32.4-26.3-58.7-58.7-58.7S72 376.9 72 409.3V820zM834.7 820c0-32.4 26.3-58.7 58.7-58.7s58.7 26.3 58.7 58.7V409.3c0-32.4-26.3-58.7-58.7-58.7s-58.7 26.3-58.7 58.7V820z" fill="#2F9B77" /><path d="M585.3 497.3l105.6-140.8c17.1-22.9 26.4-50.6 26.4-79.2 0-72.9-59.1-132-132-132s-132 59.1-132 132c0 28.6 9.3 56.3 26.4 79.2l105.6 140.8z" fill="#EA800C" /><path d="M585.3 262.7m-58.7 0a58.7 58.7 0 1 0 117.4 0 58.7 58.7 0 1 0-117.4 0Z" fill="#FFFFFF" /><path d="M893.4 340.6c-34.5 0-63.1 25.5-68 58.7H671.3l27.6-36.8c18.6-24.9 28.4-54.3 28.4-85.2 0-78.3-63.7-142-142-142s-142 63.7-142 142c0 30.9 9.8 60.3 28.4 85.2l27.6 36.8H198.7c-4.9-33.2-33.5-58.7-68-58.7-37.9 0-68.7 30.8-68.7 68.7V820c0 37.9 30.8 68.7 68.7 68.7h762.7c37.9 0 68.7-30.8 68.7-68.7V409.3c0-37.9-30.8-68.7-68.7-68.7zM761.3 751.5c-2.6 0-4.7-2.1-4.7-4.7v-58.7c0-2.6 2.1-4.7 4.7-4.7h63.4v68.1h-63.4z m63.4-146.8h-48.8c-10.6 0-19.3-8.7-19.3-19.3V419.3h68.1v185.4zM463.3 277.3c0-67.3 54.7-122 122-122s122 54.7 122 122c0 26.5-8.4 51.8-24.4 73.2l-97.6 130.1-97.6-130.1c-16-21.4-24.4-46.7-24.4-73.2zM634 497.4c0 18.4-22.3 34-48.7 34s-48.7-15.6-48.7-34c0-9.8 6.4-19.2 17-25.7l23.7 31.6c1.9 2.5 4.9 4 8 4s6.1-1.5 8-4l23.7-31.6c10.6 6.4 17 15.8 17 25.7z m-92.4-41.7c-15.6 10.2-25 25.4-25 41.7 0 15 7.5 28.9 21.2 39.1 12.8 9.6 29.7 14.9 47.5 14.9s34.7-5.3 47.5-14.9c13.7-10.2 21.2-24.1 21.2-39.1 0-16.4-9.3-31.7-24.9-41.8l27.2-36.3h21.6v166.1c0 10.6-8.7 19.3-19.3 19.3H365.3c-10.6 0-19.3-8.7-19.3-19.3v-18.8c0-2 1.3-3.8 3.1-4.4l61.8-20.5c40.1-13.4 67-50.7 67-93v-29.4h36.3l27.4 36.4z m-342.2-36.4h199.9v17.2c0 14.6-9.3 27.6-23.3 32.2l-71.8 23.9c-22.1 7.3-37 27.8-37 51.2v41.6c0 10.6-8.7 19.3-19.3 19.3h-48.6V419.3zM82 409.3c0-26.9 21.8-48.7 48.7-48.7 26.5 0 48.1 21.2 48.7 47.6 0 0.4-0.1 0.8-0.1 1.1v362.2c-12.4-12.5-29.6-20.2-48.6-20.2h-0.2c-19 0-36.2 7.8-48.6 20.3V409.3zM82 820c0-26.8 21.8-48.7 48.7-48.7 26.8 0 48.6 21.9 48.6 48.7 0 5.5 4.5 10 10 10h0.2c5.5 0 10-4.5 10-10V683.4h67.8c-1.9 61.4-21.8 120.2-57.7 170.4l-10.7 14.9h-68.2c-26.9 0-48.7-21.8-48.7-48.7z m346.7 48.7H295.4C328.6 813.1 346 750 346 684.9v-1.6h82.7v185.4z m249.3 0H507.4v-166c0-10.6 8.7-19.3 19.3-19.3h132c10.6 0 19.3 8.7 19.3 19.3v166z m20 0v-166c0-21.7-17.6-39.3-39.3-39.3h-132c-21.7 0-39.3 17.6-39.3 39.3v166h-38.7V673.3c0-5.5-4.5-10-10-10H336c-5.5 0-10 4.5-10 10v11.6c0 65.5-18.7 128.9-54.1 183.8h-48.4l2.4-3.3c40.3-56.4 61.6-122.8 61.6-192 0-5.5-4.5-10-10-10h-78v-38.7H248c21.7 0 39.3-17.6 39.3-39.3v-41.6c0-14.7 9.3-27.6 23.3-32.2l71.8-23.9c22.1-7.4 36.9-27.9 36.9-51.2v-17H458v29.2c0 33.6-21.4 63.4-53.3 74l-61.8 20.5c-10.1 3.4-16.8 12.8-16.8 23.4v18.8c0 21.7 17.6 39.3 39.3 39.3h293.3c21.7 0 39.3-17.6 39.3-39.3v-166h38.7v166c0 21.7 17.6 39.3 39.3 39.3h48.7v38.7h-63.3c-13.6 0-24.7 11.1-24.7 24.7v58.7c0 13.6 11.1 24.7 24.7 24.7h63.3V810h-63.3c-13.6 0-24.7 11.1-24.7 24.7v34H698z m195.4 0H756.6v-34c0-2.6 2.1-4.7 4.7-4.7H834.8c5.5 0 10-4.5 10-10 0-26.9 21.8-48.7 48.7-48.7 26.9 0 48.7 21.8 48.7 48.7s-21.9 48.7-48.8 48.7z m47.4-98.3c-0.4-0.4-0.8-0.8-1.2-1.1-0.4-0.4-0.8-0.7-1.2-1.1s-0.8-0.7-1.2-1.1c-0.4-0.3-0.9-0.7-1.3-1-0.4-0.3-0.9-0.7-1.3-1-0.4-0.3-0.9-0.6-1.3-0.9-0.5-0.3-0.9-0.7-1.4-1-0.4-0.3-0.9-0.6-1.3-0.9l-1.5-0.9c-0.4-0.3-0.9-0.5-1.3-0.8l-1.5-0.9c-0.5-0.2-0.9-0.5-1.4-0.7-0.5-0.3-1.1-0.6-1.6-0.8-0.5-0.2-0.9-0.4-1.4-0.6-0.5-0.2-1.1-0.5-1.6-0.7-0.5-0.2-1-0.4-1.4-0.6-0.6-0.2-1.1-0.5-1.7-0.7-0.5-0.2-1-0.3-1.5-0.5-0.6-0.2-1.1-0.4-1.7-0.6-0.5-0.2-1-0.3-1.5-0.4-0.6-0.2-1.1-0.3-1.7-0.5-0.5-0.1-1.1-0.3-1.6-0.4-0.6-0.1-1.1-0.3-1.7-0.4-0.6-0.1-1.1-0.2-1.7-0.3-0.6-0.1-1.1-0.2-1.7-0.3-0.6-0.1-1.2-0.2-1.8-0.2-0.5-0.1-1.1-0.1-1.6-0.2-0.8-0.1-1.5-0.1-2.3-0.2-0.4 0-0.8-0.1-1.2-0.1-1.2-0.1-2.4-0.1-3.5-0.1-2.4 0-4.7 0.1-7 0.4-16.2 1.7-30.8 9-41.7 19.9V409.3c0-26.9 21.8-48.7 48.7-48.7 26.9 0 48.7 21.8 48.7 48.7v362.3s-0.1 0-0.1-0.1c-0.7-0.4-1.1-0.8-1.5-1.1z" fill="#4D3500" /><path d="M654 262.7c0-37.9-30.8-68.7-68.7-68.7s-68.7 30.8-68.7 68.7 30.8 68.7 68.7 68.7 68.7-30.8 68.7-68.7z m-117.4 0c0-26.9 21.8-48.7 48.7-48.7s48.7 21.8 48.7 48.7c0 26.9-21.8 48.7-48.7 48.7s-48.7-21.8-48.7-48.7z" fill="#4D3500" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M489.6 541.1V166l283.5 375.1H489.6" fill="#3DC38A" /><path d="M489.6 101.3l-323.2 491h323.2z" fill="#F2B843" /><path d="M489.6 715.7c-16.3 0-29.6-13.2-29.6-29.6V95c0-16.3 13.2-29.6 29.6-29.6 16.3 0 29.6 13.2 29.6 29.6v591.1c-0.1 16.3-13.3 29.6-29.6 29.6z" fill="#EA800C" /><path d="M489.6 608.4H145.3c-16.3 0-29.6-13.2-29.6-29.6 0-16.3 13.2-29.6 29.6-29.6h344.3c16.3 0 29.6 13.2 29.6 29.6-0.1 16.3-13.3 29.6-29.6 29.6z" fill="#EA800C" /><path d="M783.8 557.2H503.1c-16.3 0-29.6-13.2-29.6-29.6 0-16.3 13.2-29.6 29.6-29.6h280.7c16.3 0 29.6 13.2 29.6 29.6 0 16.3-13.3 29.6-29.6 29.6z" fill="#EA800C" /><path d="M752.4 759.8l-67-88.8c-7.9-10.5-20.3-16.7-33.5-16.7H302c-18.3 0-34.5 11.9-40 29.3l-25 76.2h515.4z" fill="#2F9B77" /><path d="M920.8 704.6c15.6-0.8 26.8 14.8 21.1 29.3l-54.5 138.8-28.6 72.8H133.7L81.5 775c-4.1-13.4 5.5-27 19.4-27.8l143.3-7.5 676.6-35.1z" fill="#3DC38A" /><path d="M802.3 791.8m-27 0a27 27 0 1 0 54 0 27 27 0 1 0-54 0Z" fill="#F2B843" /><path d="M947.5 707.7c-6.3-8.7-16.4-13.6-27.2-13.1l-196.8 10.2-30-39.9c-9.8-12.9-25.3-20.6-41.5-20.6H529.2v-77.1h254.7c21.8 0 39.6-17.8 39.6-39.6S805.7 488 783.9 488h-38.3L529.2 201.7V95c0-21.8-17.8-39.6-39.6-39.6S450 73.2 450 95v48.2L189.3 539.3h-44c-21.8 0-39.6 17.8-39.6 39.6s17.8 39.6 39.6 39.6H450v25.8H302c-22.7 0-42.6 14.6-49.5 36.2l-16.2 49.6-135.9 7.1c-9.7 0.6-18.5 5.5-24.1 13.5-5.6 8-7.1 17.9-4.3 27.2l52.2 170.5c1.3 4.2 5.2 7.1 9.6 7.1h725.1c4.1 0 7.8-2.5 9.3-6.3l28.6-72.8 54.5-138.8c3.8-10 2.4-21.2-3.8-29.9zM720.5 488H529.2V234.9L720.5 488zM450 179.6v359.7H213.3L450 179.6z m20 428.8c0-5.5-4.5-10-10-10-0.5 0-0.9 0-1.3 0.1H145.3c-10.8 0-19.6-8.8-19.6-19.6s8.8-19.6 19.6-19.6H460c5.5 0 10-4.5 10-10V95c0-10.8 8.8-19.6 19.6-19.6s19.6 8.8 19.6 19.6v403c0 5.5 4.5 10 10 10h264.7c10.8 0 19.6 8.8 19.6 19.6s-8.8 19.6-19.6 19.6H519.2c-5.5 0-10 4.5-10 10v87.1H470v-35.9z m-198.5 78.3s0-0.1 0 0c4.3-13.4 16.5-22.4 30.5-22.4h350c9.9 0 19.5 4.8 25.5 12.7l21.9 29.1L257.7 729l13.8-42.3z m661.1 43.5L878.1 869 852 935.5H141.1l-50-163.4c-1-3.4-0.5-7 1.6-9.9 2-2.9 5.3-4.8 8.8-5l141.5-7.4h0.6c0.6 0 1.1-0.1 1.7-0.1l473.6-24.6h0.7l201.7-10.5c4-0.2 7.6 1.5 9.9 4.8 2.3 3.2 2.8 7.2 1.4 10.8z" fill="#4D3500" /><path d="M802.3 754.8c-20.4 0-37 16.6-37 37s16.6 37 37 37 37-16.6 37-37-16.6-37-37-37z m0 54c-9.4 0-17-7.6-17-17s7.6-17 17-17 17 7.6 17 17-7.6 17-17 17z" fill="#4D3500" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M258.5 723.4l-124.8-98.3c-6.8-5.2-9.1-14.2-5-20.1 20-29 58.6-38.9 96.4-24.7L338 644.4l-79.5 79zM300.4 765.2l98.5 125.1c5.2 6.8 14.2 9.1 20.1 5l7.4-5.2c24.5-16.9 32.9-49.5 20.9-81.6l-67.7-122.7-79.2 79.4z" fill="#F2B843" /><path d="M292.3 338.7c-15.7-15.7-16.9-40.6-2.9-57.8 20-24.6 45.1-52 60.2-67 20.6-20.6 22.4-18.2 44.4-31.6 3.2-2 7.4-1.5 10.2 1.2l43.6 43.6c2.7 2.7 3.1 6.8 1.2 10.2-13.5 22-11 23.8-31.6 44.4-15 15-42.4 40.1-67 60.2-17.3 13.7-42.3 12.5-58.1-3.2zM685.3 731.7c-15.7-15.7-16.9-40.6-2.9-57.8 20-24.6 45.1-52 60.2-67 20.6-20.6 22.4-18.2 44.4-31.6 3.2-2 7.4-1.5 10.2 1.2l43.6 43.6c2.7 2.7 3.1 6.8 1.2 10.2-13.5 22-11 23.8-31.6 44.4-15 15-42.4 40.1-67 60.2-17.5 13.7-42.4 12.4-58.1-3.2z" fill="#EA800C" /><path d="M488.9 487.1l154-154-477.2-150c-9.9-2.5-19.6-0.1-26.1 6.3l-40.3 40.3c-13.5 13.5-7.7 38.3 11.3 48.4l378.3 209zM536.9 535.1l154-154 149.9 477.1c2.5 9.9 0.1 19.6-6.3 26.1l-40.3 40.3c-13.5 13.5-38.3 7.7-48.4-11.3L536.9 535.1z" fill="#2F9B77" /><path d="M827.6 316.4L568.8 575.1c-43.5 43.4-89.6 83.9-137.9 121l-123.2 94.5c-28.5 21.9-62.4 24.5-80.6 6.3-18.3-18.3-15.5-52.2 6.3-80.6l94.5-123.2c37.1-48.3 77.6-94.5 121-137.9l258.7-258.7c35.4-35.4 76-64.9 119-85.1 36.9-17.4 76.3-28.3 95.3-9.3s8.2 58.4-9.3 95.3c-20.2 42.9-49.7 83.5-85 119z" fill="#3DC38A" /><path d="M849.1 266.7l-8.8 8.8c-8.2 8.2-100-83.6-91.8-91.8l8.8-8.8c5.6-5.6 13.8-7.3 20.4-4.4 33.2 14.7 61.1 42.6 75.8 75.8 2.9 6.7 1.1 14.9-4.4 20.4zM255.1 781.2c-3.1 0-6.3-1.2-8.7-3.6-4.8-4.8-4.8-12.6 0-17.4l107.4-107.4c4.8-4.8 12.6-4.8 17.4 0s4.8 12.6 0 17.4L263.8 777.6c-2.3 2.3-5.5 3.6-8.7 3.6z" fill="#F2B843" /><path d="M834.7 323.5c36.8-37 66.9-79.1 87-121.8C946 150.4 948.4 114.5 929 95c-19.4-19.4-55.2-16.9-106.6 7.3-42.9 20.1-85 50.2-121.8 87.1L585.4 304.6l-138.6-43.5c0.8-1.4 1.6-2.9 2.5-4.5 2.1-3.8 4.5-8.2 8.2-14.1 0.1-0.1 0.1-0.2 0.2-0.3 4.2-7.2 3-16.3-2.8-22.2l-43.6-43.6c-6-6-15.2-7.1-22.4-2.6-5.7 3.5-10 5.8-13.7 7.9-10.6 5.9-16.4 9.1-32.5 25.1-4.6 4.6-10.1 10.3-15.9 16.5l-157.7-49.5c-0.2 0-0.3-0.1-0.5-0.1-13.4-3.5-26.8-0.2-35.7 8.9l-40.3 40.3c-8 7.9-11.6 19.3-9.9 31.1 2 13.9 10.8 26.3 23.4 33.1L426.2 464c-37.7 38.9-73.4 80.2-106.3 123L301 611.7l-71-40.3c-0.5-0.3-1-0.5-1.5-0.7-12.3-4.5-25.3-6.9-37.6-6.9-29.2 0-54.9 12.9-70.5 35.5-7.1 10.3-3.9 25.4 7.1 33.7l98 77-0.1 0.1c-25 32.5-27.2 72-5.4 93.8 10 10 23.7 15 38.8 15 17.8 0 37.4-6.9 55-20.4l0.1-0.1 77.2 97.9c5.4 7.1 13.4 11 21.1 11 4.4 0 8.7-1.2 12.5-3.8 0 0 0.1 0 0.1-0.1l7.3-5.2c28.2-19.5 38.1-57 24.6-93.3-0.2-0.5-0.4-0.9-0.6-1.3l-44.3-80.3L437 704c42.5-32.6 83.8-68.3 123-106.3L736.8 918c6.9 12.8 19.4 21.6 33.3 23.5 1.9 0.3 3.8 0.4 5.6 0.4 9.7 0 18.8-3.6 25.4-10.3l40.2-40.2c9.1-9 12.5-22.4 9-35.8 0-0.2-0.1-0.3-0.1-0.5l-49.5-157.4c6.3-5.9 12.1-11.5 16.8-16.2 15.9-15.9 19.1-21.7 25-32.2 2.1-3.8 4.5-8.1 8.1-14 0.1-0.1 0.1-0.2 0.2-0.4 4.1-7.4 3-16.3-2.9-22.2l-43.6-43.6c-6-6-15.3-7.1-22.4-2.6-6 3.7-10.3 6.1-14.2 8.3-1.6 0.9-3.2 1.8-4.6 2.6l-43.6-138.8 115.2-115.1zM764.4 182c2.6-2.6 6.4-3.6 9.3-2.3 31.1 13.8 56.9 39.6 70.7 70.6 1.3 2.9 0.3 6.7-2.3 9.4l-5.1 5.1c-6.8-4.1-21.7-16-41.7-36-20-20-32-34.9-36-41.7l5.1-5.1z m66.5-61.6c25.8-12.2 47.1-18.4 62.5-18.4 9.5 0 16.8 2.3 21.5 7.1 12.5 12.5 8.5 42.3-11.3 84-10.4 22.1-23.6 44-39.2 65.1 1-5.4 0.5-11-1.7-16-15.8-35.6-45.3-65.1-80.9-80.9-5.1-2.2-10.6-2.7-16-1.7 21-15.5 42.9-28.8 65.1-39.2z m-446.2 78.8c3.5-1.9 7.8-4.3 13.3-7.6l41.6 41.6c-3.5 5.7-5.9 10.1-7.9 13.7-1.7 3.1-3.1 5.6-4.6 8L347.8 230c3.2-3.3 6.2-6.4 8.9-9.1 14-14 18.1-16.2 28-21.7z m-269.1 70.4c-7.1-3.8-12.1-10.9-13.2-18.4-0.5-3.2-0.5-9.4 4.2-14.1l40.4-40.4c3.9-3.9 9.9-5.3 16.2-3.7L327 244.4l99.9 31.3c0.8 0.4 1.7 0.7 2.6 0.8l140.1 44-127.8 127.6-1 1-325.2-179.5z m24.3 347.6c-0.1 0-0.1-0.1-0.2-0.1-2.9-2.2-3.5-5.4-2.8-6.4 11.8-17.1 31.6-26.9 54.1-26.9 9.7 0 20 1.9 29.9 5.4l67.8 38.5-51 66.5-97.8-77z m298.4 195.5c9.9 27.4 2.9 55.1-17.5 69.3l-7.3 5.1c-1.2 0.8-4.3 0.1-6.4-2.8 0-0.1-0.1-0.1-0.1-0.2l-77.1-97.8 66-50.6 42.4 77z m-13.5-124.5l-31.4 24.1-1.2 0.9-82.1 63c-0.2 0.2-0.5 0.3-0.7 0.5-0.1 0.1-0.2 0.2-0.4 0.3l-7.4 5.7c-24.4 18.8-52.8 21.8-67.4 7.2-14.6-14.6-11.6-43 7.2-67.4l94.5-123.2c35-45.5 73.1-89.3 113.5-130.2 0.3-0.2 0.5-0.5 0.7-0.8 2-2 3.9-4 5.9-6l138.2-138.2c0.9-0.6 1.7-1.4 2.3-2.3l118.2-118.2c7.7-7.7 15.7-15.2 23.9-22.2-0.7 2.1-0.9 4.7 0 7.9 3.6 13.5 31 41.9 42.6 53.6 11.6 11.6 40.1 39 53.6 42.6 1.5 0.4 2.8 0.6 4 0.6 1.5 0 2.8-0.3 3.9-0.6-7.1 8.2-14.5 16.2-22.2 24L702.4 427.4c-1 0.7-1.9 1.6-2.6 2.6l-138 138c-1.9 1.9-3.9 3.9-5.9 5.8l-0.9 0.9c-41.3 40.7-85.1 78.8-130.2 113.5z m366.3-103.8l41.7 41.7c-3.5 5.7-5.9 10.1-7.9 13.6-5.3 9.5-7.7 13.8-21.6 27.8-2.8 2.8-5.9 5.8-9.3 9.1l-24.9-79.4c2.5-1.6 5-3 8.2-4.8 3.6-2.1 8.1-4.5 13.8-8zM747.9 596l31.7 101.3L831 860.9c1.6 6.3 0.2 12.4-3.8 16.3l-40.4 40.4c-4.7 4.7-10.8 4.7-14 4.2-7.5-1.1-14.6-6.2-18.5-13.3L574.8 583.2l1-1 127.6-127.5L747.9 596z" fill="#4D3500" /><path d="M346.7 645.7L239.3 753.1c-4.2 4.2-6.5 9.8-6.5 15.8s2.3 11.6 6.5 15.8c4.1 4.2 9.9 6.5 15.8 6.5s11.6-2.4 15.8-6.5l107.4-107.4c4.2-4.2 6.5-9.8 6.5-15.8s-2.3-11.6-6.5-15.8c-8.7-8.7-22.9-8.7-31.6 0z m17.4 17.4L256.7 770.5c-0.4 0.4-1.1 0.7-1.6 0.7-0.2 0-1 0-1.6-0.7-0.9-0.9-0.9-2.4 0-3.3l107.4-107.4c0.4-0.4 1-0.7 1.6-0.7 0.6 0 1.2 0.2 1.6 0.7 0.9 1 0.9 2.4 0 3.3z" fill="#4D3500" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M252.8 862.9h-73.4c-6.8 0-12.4-5.6-12.4-12.4V134.4c0-6.8 5.6-12.4 12.4-12.4h73.4l5.3 6.8v728.8l-5.3 5.3z" fill="#F2B843" /><path d="M338.5 942l-42.9-18.1-42.8 18.1v-79.1l7.5-5.3h71.3l7 5.3-0.1 79.1z" fill="#EA800C" /><path d="M844.6 327.9h-40.7l-5.3-5.8v-93.3l5.3-7.2h40.7c6.8 0 12.4 5.6 12.4 12.4v81.5c0 6.9-5.6 12.4-12.4 12.4z" fill="#F2B843" /><path d="M844.6 540.5h-40.7l-5.3-7.3v-90.6l5.3-8.4h40.7c6.8 0 12.4 5.6 12.4 12.4v81.5c0 6.8-5.6 12.4-12.4 12.4z" fill="#EA800C" /><path d="M844.6 753h-40.7l-5.3-6.7v-92.1l5.3-7.5h40.7c6.8 0 12.4 5.6 12.4 12.4v81.5c0 6.8-5.6 12.4-12.4 12.4z" fill="#2F9B77" /><path d="M791.8 862.9h-539V122h539.1c6.7 0 12 5.4 12 12v716.8c0 6.7-5.4 12.1-12.1 12.1z" fill="#3DC38A" /><path d="M680.3 661.1H343.7c-14 0-25.5-11.5-25.5-25.5s11.5-25.5 25.5-25.5h336.6c14 0 25.5 11.5 25.5 25.5s-11.5 25.5-25.5 25.5zM680.3 779.8H343.7c-14 0-25.5-11.5-25.5-25.5s11.5-25.5 25.5-25.5h336.6c14 0 25.5 11.5 25.5 25.5s-11.5 25.5-25.5 25.5z" fill="#2F9B77" /><path d="M594.8 511.1c-79.2 45.7-180.5 18.6-226.3-60.6S350 270 429.2 224.2s180.5-18.6 226.3 60.6 18.5 180.6-60.7 226.3z" fill="#3DC38A" /><path d="M523.7 318.1c-1.2 0.3-3.5 0.9-4.5 1.7-1.2 1 0.7 2.3 0 2.9-1.2 1-2.1 2.7-4.7 2.6-5.5-0.3-13.9-7.5-19-10.2 8.1-8.3-4.7-9.6-9.7-9.1-6.5 0.5-17.7 0-23.5 3.2-4.1 2.3-9.5 11.7-12.8 15.5-4.6 5.2-9.1 9.8-12.1 16-10.9 23 5.9 49.4 32.2 46.3 7.3-0.9 14.9-5.5 21.4 0.6 4.8 4.5 2.3 8.7 3.5 13.9 1.1 4.5 6.1 7.3 7.8 11.4 3.3 7.9 1.2 12.9-1.1 20.2-3.1 9.6 4.9 21 8 30.2 1.6 4.7 6.1 17.7 10.7 19.8 7.1 3.2 18.1-6.4 22.4-11.6 3.3-4.1 2.2-8.2 4.4-12 2.4-4.1 5.4-5.3 7.1-10.6 1.8-5.7 3.7-7.1 7.5-11.3 6.2-6.7 5.2-10.6 2.7-18.6-5.1-16.5 13.5-24.2 21.8-36.3 8.7-12.6-8.2-8.4-14.8-12.8-6.8-4.4-9.8-12.9-13.1-19.9s-6-17.5-11.4-23.3c-4.2-4.3-16.9-6.4-22.8-8.6zM609.2 428.8c-2.6 8.9-5.3 17.8-7.9 26.7-1.8 6.2-8.4 26.6-17.5 13.6-3.5-5-0.6-11.4 1.3-16 2.4-5.8-0.9-8.7 0.9-14.1 2-6.2 10-6.4 13.8-10.8 2.7-3 4.3-7.9 6.2-11.5 1 4 2.1 8.1 3.2 12.1z" fill="#F2B843" /><path d="M655.4 284.9c-28.5-49.4-78.7-78.5-131.6-82.4l-21.6 27.2-46.4 16.3-12.5 30.2 19.2 26.9 2-5.7c3.4-9.5 12.4-15.8 22.5-15.8h31.7l36.4 12.8 12.5 12v7.6l17.4 33.4 5.1-1.9c11-4 20.9-10.4 29.2-18.7l-4.2-6.3c-1.4-2 0.1-4.7 2.5-4.7h10.2c3 0 5.8 1.3 7.7 3.6l8.3 9.7c0.8 0.9 1.4 2 1.8 3.1l9.1 25.2 4.4-4.4c2.7-2.7 4.1-6.5 4.2-10.4 0-3.1 1.4-6.1 3.7-8.2l3.4-3c0.8-0.8 1.8-1.4 2.8-1.8-3.6-15.3-9.5-30.4-17.8-44.7zM407.6 291.3l7.9-8.5c5.8-6.2 7.4-15.2 4.2-23-3.4-8.3-10.9-13.6-19.2-14.8-29.2 26.5-47.4 62.2-52.6 100 6.2 5.4 12.6 11.2 12.6 11.7-0.1 1 23.2-2.9 23.2-2.9l-12-17.5 17.2-12.3 18.7-32.7zM423.8 456.4c7.5-2.4 11.6-10.4 9.1-17.9l-2.1-6.6c-0.9-2.9-0.9-5.9 0-8.8 2.7-8.1-2.4-16.8-10.8-18.4l-16.8-3.3-30.6-23.2-25.3 8.2c2.5 21.9 9.4 43.7 21.2 64.1 10.9 18.8 24.9 34.7 41 47.4l7.5-39.3 6.8-2.2z" fill="#2F9B77" /><path d="M844.6 337.9c12.4 0 22.4-10 22.4-22.4V234c0-12.4-10-22.4-22.4-22.4h-30.7V134c0-12.1-9.9-22-22-22H179.4c-12.4 0-22.4 10-22.4 22.4v716.1c0 12.4 10 22.4 22.4 22.4h63.4V942c0 3.4 1.7 6.5 4.5 8.3 2.8 1.9 6.3 2.2 9.4 0.9l38.9-16.5 39 16.5c1.2 0.5 2.6 0.8 3.9 0.8 1.9 0 3.9-0.6 5.5-1.7 2.8-1.9 4.5-5 4.5-8.3v-69.1h443.3c12.2 0 22.1-9.9 22.1-22.1V763h30.7c12.4 0 22.4-10 22.4-22.4v-81.5c0-12.4-10-22.4-22.4-22.4h-30.7v-86.2h30.7c12.4 0 22.4-10 22.4-22.4v-81.5c0-12.4-10-22.4-22.4-22.4h-30.7v-86.3h30.7z m0-106.3c1.3 0 2.4 1.1 2.4 2.4v81.5c0 1.3-1.1 2.4-2.4 2.4h-30.7v-86.3h30.7zM177 850.5V134.4c0-1.3 1.1-2.4 2.4-2.4h63.4v720.9h-63.4c-1.3 0-2.4-1.1-2.4-2.4z m151.5 76.4l-29-12.2c-2.5-1-5.3-1-7.8 0l-28.9 12.2v-54h65.7v54z m465.4-76.1c0 1.2-0.9 2.1-2.1 2.1h-529V132h529.1c1.1 0 2 0.9 2 2v716.8z m50.7-194.1c1.3 0 2.4 1.1 2.4 2.4v81.5c0 1.4-1 2.4-2.4 2.4h-30.7v-86.3h30.7z m0-212.5c1.3 0 2.4 1.1 2.4 2.4v81.5c0 1.3-1.1 2.4-2.4 2.4h-30.7v-86.3h30.7z" fill="#4D3500" /><path d="M680.3 600.1H343.7c-19.6 0-35.5 15.9-35.5 35.5s15.9 35.5 35.5 35.5h336.6c19.6 0 35.5-15.9 35.5-35.5s-15.9-35.5-35.5-35.5z m0 51H343.7c-8.5 0-15.5-7-15.5-15.5s7-15.5 15.5-15.5h336.6c8.5 0 15.5 7 15.5 15.5s-7 15.5-15.5 15.5zM680.3 718.8H343.7c-19.6 0-35.5 15.9-35.5 35.5s15.9 35.5 35.5 35.5h336.6c19.6 0 35.5-15.9 35.5-35.5s-15.9-35.5-35.5-35.5z m0 51H343.7c-8.5 0-15.5-7-15.5-15.5s7-15.5 15.5-15.5h336.6c8.5 0 15.5 7 15.5 15.5s-7 15.5-15.5 15.5zM512.3 543.2c29.8 0 59.9-7.6 87.5-23.5 40.6-23.4 69.7-61.3 81.9-106.7 12.2-45.4 6-92.7-17.5-133.3-23.5-40.6-61.4-69.7-106.7-81.8-45.3-12.1-92.7-5.9-133.3 17.6-40.6 23.5-69.7 61.4-81.9 106.7-12.2 45.3-6 92.7 17.5 133.3 32.6 56.3 91.7 87.7 152.5 87.7zM361.6 327.4c10.8-40.2 36.6-73.7 72.6-94.6 24-13.9 50.6-20.9 77.6-20.9 13.5 0 27.1 1.8 40.5 5.4 40.2 10.8 73.7 36.5 94.6 72.5 20.8 36 26.3 77.9 15.5 118.1-10.8 40.2-36.6 73.7-72.6 94.5-74.3 42.9-169.7 17.3-212.6-56.9-20.8-36-26.4-77.9-15.6-118.1z" fill="#4D3500" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M92 329h277.6v523H182c-49.5 0-90-40.5-90-90V329z" fill="#2F9B77" /><path d="M510.6 622.2c0.4 0 0.8 0 1.2-0.1-0.4 0.1-0.8 0.1-1.2 0.1zM519.4 749c-0.3 0-0.7 0.1-1 0.1h-0.1c0.3 0 0.7 0 1.1-0.1zM563.1 687.2h1.5c-0.8 0-1.6 0-2.4-0.1h-0.4c-0.3 0-0.6-0.1-0.8-0.1s-0.4-0.1-0.6-0.1c-0.2 0-0.5-0.1-0.7-0.1-0.4-0.1-0.9-0.2-1.3-0.3-2.3-0.7-4.4-1.8-6.3-3.2-0.7-0.5-1.3-1-1.8-1.6-0.9-0.8-1.7-1.8-2.4-2.8-1.4-2-2.9-3.8-4.6-5.4-0.3-0.3-0.6-0.5-0.8-0.8l-1.8-1.5c-1.3-1-2.6-2-4-2.9-0.6-0.4-1.2-0.7-1.8-1-4.7-2.7-10-4.3-15.4-4.8 11.3 1 21.7 7 28.5 16.5 3.4 4.8 8.6 7.7 14.1 8.3 0.3-0.1 0.6-0.1 1-0.1zM560.5 724.8c-0.1 0-0.2 0-0.3 0.1 0.1 0 0.2-0.1 0.3-0.1zM549.9 730.1c2.9-2.8 6.5-4.5 10.3-5.2-4.9 0.9-9.5 3.6-12.6 8-6.7 9.3-17.1 15.1-28.2 16.1 1.1-0.1 2.3-0.3 3.4-0.5 0.7-0.1 1.5-0.3 2.2-0.5 1.1-0.3 2.2-0.6 3.3-1h0.1c1.4-0.5 2.8-1.1 4.1-1.7 1-0.5 2-1 3-1.6 0.7-0.4 1.3-0.8 1.9-1.2 2.2-1.5 4.3-3.2 6.2-5.2l0.8-0.8 3-3.6c0.5-0.7 1-1.3 1.6-1.9l0.9-0.9zM561.3 724.7c-0.2 0-0.5 0.1-0.7 0.1 0.2 0 0.4 0 0.7-0.1zM562.7 724.6c-0.5 0-0.9 0.1-1.4 0.1 0.4 0 0.9-0.1 1.4-0.1z" fill="#FCF6F6" /><path d="M510.6 329h-141v523h285V329h-144z" fill="#3DC38A" /><path d="M721.3 610a14.6 14.6 0 1 0 29.2 0 14.6 14.6 0 1 0-29.2 0Z" fill="#FCF6F6" /><path d="M756.3 701v9c0 21.5 17.5 39 39 39 12.6 0 24.2-6 31.7-16.3 6.5-8.9 19-10.9 27.9-4.4s10.9 19 4.5 27.9c-14.9 20.6-38.9 32.9-64.1 32.9-43.6 0-79-35.4-79-79v-9c0-43.6 35.4-79 79-79 25.6 0 49.8 12.6 64.7 33.7 6.4 9 4.2 21.5-4.8 27.9s-21.5 4.2-27.9-4.8c-7.4-10.5-19.3-16.7-32-16.7-21.5-0.2-39 17.3-39 38.8zM858 469.4c-1.2 0-2.3-0.3-3.4-0.9 0.2 1.7 0.4 3.5 0.4 5.3s-0.1 3.5-0.4 5.3c1.5-0.8 3.4-1.1 5.2-0.6l13.5 3.6c3.7 1 6 4.8 5 8.6-0.8 3.1-3.7 5.2-6.8 5.2-0.6 0-1.2-0.1-1.8-0.2l-11.5-3.1c2.5 4.9 3.9 10.5 3.9 16.4 0 20.1-16.4 36.5-36.5 36.5H741.4c-17 0-30.9-13.9-30.9-30.9 0-15.2 11-27.8 25.4-30.4 1.2-21.5 18.6-38.8 40.2-39.8l-6.7-6.7c-2.8-2.7-2.8-7.1-0.1-9.9s7.2-2.8 9.9-0.1l9.9 9.8c1.4 1.4 2.1 3.2 2.1 5 2.9-2.2 6-4 9.3-5.4-1.5-0.9-2.8-2.4-3.3-4.2l-3.6-13.5c-1-3.7 1.2-7.6 5-8.6 3.7-1 7.6 1.2 8.6 5l3.6 13.5c0.5 1.9 0.2 3.7-0.7 5.3 1.8-0.2 3.6-0.4 5.4-0.4 1.8 0 3.6 0.1 5.3 0.4-0.9-1.5-1.2-3.4-0.7-5.3l3.6-13.5c1-3.7 4.8-6 8.6-5 3.7 1 6 4.8 5 8.6l-3.6 13.5c-0.5 1.9-1.7 3.3-3.2 4.2 3.3 1.4 6.5 3.2 9.3 5.4 0-1.8 0.7-3.6 2.1-4.9l9.8-9.8c2.7-2.7 7.2-2.7 9.9 0s2.7 7.2 0 9.9l-9.8 9.8c-1.4 1.4-3.1 2-4.9 2 2.2 2.8 4 5.9 5.4 9.3 0.9-1.5 2.3-2.6 4.1-3.1l13.5-3.7c3.7-1 7.6 1.2 8.6 4.9s-1.2 7.6-4.9 8.6l-13.5 3.7c-0.9 0.1-1.5 0.2-2.1 0.2zM533.1 529.4l4.5 16.8c1 3.7-1.2 7.6-5 8.6-0.6 0.2-1.2 0.2-1.8 0.2-3.1 0-5.9-2.1-6.8-5.2l-4.5-16.8c-1-3.7 1.2-7.6 5-8.6 3.7-1 7.6 1.3 8.6 5zM532.6 401.2c3.7 1 6 4.8 5 8.6l-4.5 16.8c-0.8 3.1-3.7 5.2-6.8 5.2-0.6 0-1.2-0.1-1.8-0.2-3.7-1-6-4.8-5-8.6l4.5-16.8c1-3.7 4.9-6 8.6-5zM555.8 512l12.3 12.3c2.7 2.7 2.7 7.2 0 9.9-1.4 1.4-3.2 2-5 2s-3.6-0.7-5-2L546 521.8c-2.7-2.7-2.7-7.2 0-9.9s7.1-2.7 9.8 0.1zM568.2 431.8L555.8 444c-1.4 1.4-3.2 2-4.9 2-1.8 0-3.6-0.7-5-2-2.7-2.7-2.7-7.2 0-9.9l12.3-12.3c2.7-2.7 7.2-2.7 9.9 0 2.8 2.8 2.8 7.2 0.1 10zM588.8 498.6c-0.8 3.1-3.7 5.2-6.8 5.2-0.6 0-1.2-0.1-1.8-0.2l-16.8-4.5c-3.7-1-6-4.8-5-8.6 1-3.7 4.8-6 8.6-5l16.8 4.5c3.7 1 6 4.9 5 8.6zM588.8 457.4c1 3.7-1.2 7.6-5 8.6l-16.8 4.5c-0.6 0.2-1.2 0.2-1.8 0.2-3.1 0-5.9-2.1-6.8-5.2-1-3.7 1.2-7.6 5-8.6l16.8-4.5c3.7-1 7.6 1.3 8.6 5zM622 194h40v41c0 11-9 20-20 20s-20-9-20-20v-41zM792 194v41c0 11-9 20-20 20s-20-9-20-20v-41h40z" fill="#FCF6F6" /><path d="M533.1 529.4l4.5 16.8c1 3.7-1.2 7.6-5 8.6-0.6 0.2-1.2 0.2-1.8 0.2-3.1 0-5.9-2.1-6.8-5.2l-4.5-16.8c-1-3.7 1.2-7.6 5-8.6 3.7-1 7.6 1.3 8.6 5zM519.5 423l4.5-16.8c1-3.7 4.8-6 8.6-5s6 4.8 5 8.6l-4.5 16.8c-0.8 3.1-3.7 5.2-6.8 5.2-0.6 0-1.2-0.1-1.8-0.2-3.7-1-6-4.9-5-8.6zM555.8 512l12.3 12.3c2.7 2.7 2.7 7.2 0 9.9-1.4 1.4-3.2 2-5 2s-3.6-0.7-5-2L546 521.8c-2.7-2.7-2.7-7.2 0-9.9s7.1-2.7 9.8 0.1zM546 444c-2.7-2.7-2.7-7.2 0-9.9l12.3-12.3c2.7-2.7 7.2-2.7 9.9 0s2.7 7.2 0 9.9L555.8 444c-1.4 1.4-3.2 2-4.9 2-1.8 0.1-3.6-0.6-4.9-2zM580.2 503.6l-16.8-4.5c-3.7-1-6-4.8-5-8.6 1-3.7 4.8-6 8.6-5l16.8 4.5c3.7 1 6 4.8 5 8.6-0.8 3.1-3.7 5.2-6.8 5.2-0.6 0-1.2-0.1-1.8-0.2zM563.4 456.9l16.8-4.5c3.7-1 7.6 1.2 8.6 5 1 3.7-1.2 7.6-5 8.6l-16.8 4.5c-0.6 0.2-1.2 0.2-1.8 0.2-3.1 0-5.9-2.1-6.8-5.2-1-3.7 1.3-7.6 5-8.6z" fill="#E2D7D7" /><path d="M622 194h40v41c0 11-9 20-20 20s-20-9-20-20v-41zM792 194v41c0 11-9 20-20 20s-20-9-20-20v-41h40z" fill="#E73F5F" /><path d="M490.9 426.6c0.8 3.1 3.7 5.2 6.8 5.2 0.6 0 1.2-0.1 1.8-0.2 3.7-1 6-4.8 5-8.6l-4.5-16.8c-1-3.7-4.8-5.9-8.6-5-3.7 1-6 4.8-5 8.6l4.5 16.8zM468.2 444c1.4 1.4 3.2 2.1 4.9 2.1s3.6-0.7 4.9-2.1c2.7-2.7 2.7-7.2 0-9.9l-12.3-12.3c-2.7-2.7-7.2-2.7-9.9 0s-2.7 7.2 0 9.9l12.4 12.3zM440.2 466l16.8 4.5c0.6 0.2 1.2 0.2 1.8 0.2 3.1 0 5.9-2.1 6.8-5.2 1-3.7-1.2-7.6-5-8.6l-16.8-4.5c-3.7-1-7.6 1.2-8.6 5-1 3.7 1.3 7.6 5 8.6zM465.6 490.5c-1-3.7-4.8-5.9-8.6-5l-16.8 4.5c-3.7 1-6 4.8-5 8.6 0.8 3.1 3.7 5.2 6.8 5.2 0.6 0 1.2-0.1 1.8-0.2l16.8-4.5c3.7-1 6-4.9 5-8.6zM468.2 512l-12.3 12.3c-2.7 2.7-2.7 7.2 0 9.9 1.4 1.4 3.2 2.1 4.9 2.1 1.8 0 3.6-0.7 4.9-2L478 522c2.7-2.7 2.7-7.2 0-9.9-2.7-2.9-7.1-2.9-9.8-0.1zM499.5 524.4c-3.7-1-7.6 1.2-8.6 5l-4.5 16.8c-1 3.7 1.2 7.6 5 8.6 0.6 0.2 1.2 0.2 1.8 0.2 3.1 0 5.9-2.1 6.8-5.2l4.5-16.8c1-3.7-1.3-7.6-5-8.6zM532.6 554.8c-0.6 0.2-1.2 0.2-1.8 0.2-3.1 0-5.9-2.1-6.8-5.2l-4.5-16.8c-1-3.7 1.2-7.6 5-8.6 3.7-1 7.6 1.2 8.6 5l4.5 16.8c1 3.7-1.3 7.6-5 8.6zM568.2 534.2c-1.4 1.4-3.2 2-5 2s-3.6-0.7-5-2L546 521.8c-2.7-2.7-2.7-7.2 0-9.9s7.2-2.7 9.9 0l12.3 12.3c2.7 2.8 2.7 7.2 0 10zM588.8 498.6c-0.8 3.1-3.7 5.2-6.8 5.2-0.6 0-1.2-0.1-1.8-0.2l-16.8-4.5c-3.7-1-6-4.8-5-8.6 1-3.7 4.8-6 8.6-5l16.8 4.5c3.7 1 6 4.9 5 8.6zM583.8 466l-16.8 4.5c-0.6 0.2-1.2 0.2-1.8 0.2-3.1 0-5.9-2.1-6.8-5.2-1-3.7 1.2-7.6 5-8.6l16.8-4.5c3.7-1 7.6 1.2 8.6 5 1 3.7-1.3 7.6-5 8.6zM568.2 431.8L555.8 444c-1.4 1.4-3.2 2-4.9 2-1.8 0-3.6-0.7-5-2-2.7-2.7-2.7-7.2 0-9.9l12.3-12.3c2.7-2.7 7.2-2.7 9.9 0 2.8 2.8 2.8 7.2 0.1 10zM537.6 409.8l-4.5 16.8c-0.8 3.1-3.7 5.2-6.8 5.2-0.6 0-1.2-0.1-1.8-0.2-3.7-1-6-4.8-5-8.6l4.5-16.8c1-3.7 4.8-6 8.6-5s6 4.9 5 8.6z" fill="#F2B843" /><path d="M553 478c0 22.6-18.4 41-41 41h-1.5c-21.9-0.8-39.5-18.8-39.5-41s17.6-40.2 39.5-41h1.5c22.6 0 41 18.4 41 41z" fill="#EA800C" /><path d="M878.3 490.6c-0.8 3.1-3.7 5.2-6.8 5.2-0.6 0-1.2-0.1-1.8-0.2l-11.5-3.1-2-0.5c-1.8-0.5-3.3-1.6-4.2-3.1-1.1 2.6-3.7 4.3-6.4 4.3-0.9 0-1.7-0.2-2.6-0.5-2.8-1.1-4.4-3.7-4.4-6.5l-47.9-0.1v-26.6c-1.6 0-3.2-0.6-4.5-1.7-2.4-2.1-3-5.5-1.8-8.2h-0.3c-1.8 0-3.6-0.7-4.9-2l-3.2-3.1-6.7-6.7c-2.8-2.7-2.8-7.1-0.1-9.9s7.2-2.8 9.9-0.1l9.9 9.8c1.4 1.4 2.1 3.2 2.1 5 2.9-2.2 6-4 9.3-5.4-1.5-0.9-2.8-2.4-3.3-4.2l-3.6-13.5c-1-3.7 1.2-7.6 5-8.6 3.7-1 7.6 1.2 8.6 5l3.6 13.5c0.5 1.9 0.2 3.7-0.7 5.3 1.8-0.2 3.6-0.4 5.4-0.4 1.8 0 3.6 0.1 5.3 0.4-0.9-1.5-1.2-3.4-0.7-5.3l3.6-13.5c1-3.7 4.8-6 8.6-5 3.7 1 6 4.8 5 8.6l-3.6 13.5c-0.5 1.9-1.7 3.3-3.2 4.2 3.3 1.4 6.5 3.2 9.3 5.4 0-1.8 0.7-3.6 2.1-4.9l9.8-9.8c2.7-2.7 7.2-2.7 9.9 0s2.7 7.2 0 9.9l-9.8 9.8c-1.4 1.4-3.1 2-4.9 2 2.2 2.8 4 5.9 5.4 9.3 0.9-1.5 2.3-2.6 4.1-3.1l13.5-3.7c3.7-1 7.6 1.2 8.6 4.9s-1.2 7.6-4.9 8.6l-13.5 3.7c-0.6 0.2-1.2 0.2-1.8 0.2-1.2 0-2.3-0.3-3.4-0.9 0.2 1.7 0.4 3.5 0.4 5.3s-0.1 3.5-0.4 5.3c1.5-0.8 3.4-1.1 5.2-0.6l13.5 3.6c3.5 0.8 5.8 4.7 4.8 8.4z" fill="#F2B843" /><path d="M265.7 446c-2.8 0-5.6 0.3-8.3 0.9a43.62 43.62 0 0 0-41.6-30.3c-23.4 0-42.5 18.5-43.6 41.6-15.1 2.6-26.6 15.7-26.6 31.5 0 17.6 14.4 32 32 32h45.5c3.9 0 7-3.1 7-7 0-0.6-0.1-1.2-0.2-1.8l57.4-15.1c0.5 2 2 3.8 4 4.7 3.6 1.5 7.7-0.2 9.2-3.7 2-4.8 3-9.9 3-15 0-20.8-17-37.8-37.8-37.8z" fill="#FFFFFF" opacity=".7" /><path d="M288.7 489.5c-1 0-1.9 0.1-2.9 0.2-4.3-10.2-14.5-17.3-26.1-17.3-14.4 0-26.3 10.8-28.1 24.6-9 2.6-15.5 10.9-15.5 20.7 0 11.9 9.6 21.5 21.5 21.5h51.2c13.7 0 24.9-11.2 24.9-25-0.1-13.6-11.4-24.7-25-24.7z" fill="#FFFFFF" /><path d="M456.4 610m-14.6 0a14.6 14.6 0 1 0 29.2 0 14.6 14.6 0 1 0-29.2 0Z" fill="#F2B843" /><path d="M580 756.1c-14.8 20.6-38.8 32.9-64 32.9-1.8 0-3.6-0.1-5.4-0.2C469.5 786 437 751.7 437 710v-9c0-41.8 32.6-76.1 73.6-78.8 1.8-0.1 3.5-0.2 5.4-0.2 25.6 0 49.8 12.6 64.6 33.7 6.4 9 4.2 21.5-4.8 27.9s-21.5 4.2-27.9-4.8c-7.4-10.5-19.3-16.7-31.9-16.7-1.8 0-3.6 0.1-5.4 0.4-19 2.6-33.6 18.9-33.6 38.6v9c0 19.7 14.7 36 33.6 38.6 1.8 0.2 3.5 0.4 5.4 0.4 12.4 0 24.2-6.1 31.6-16.3 6.4-9 18.9-11 27.9-4.6 8.8 6.4 10.9 18.9 4.5 27.9z" fill="#F2B843" /><path d="M735.9 610m-14.6 0a14.6 14.6 0 1 0 29.2 0 14.6 14.6 0 1 0-29.2 0Z" fill="#3F1E01" /><path d="M859.4 756.1c-14.9 20.6-38.9 32.9-64.1 32.9-43.6 0-79-35.4-79-79v-9c0-43.6 35.4-79 79-79 25.6 0 49.8 12.6 64.7 33.7 6.4 9 4.2 21.5-4.8 27.9s-21.5 4.2-27.9-4.8c-7.4-10.5-19.3-16.7-32-16.7-21.5 0-39 17.5-39 39v9c0 21.5 17.5 39 39 39 12.6 0 24.2-6 31.7-16.3 6.5-8.9 19-10.9 27.9-4.4 9 6.3 11 18.8 4.5 27.7z" fill="#3F1E01" /><path d="M177.1 610m-14.6 0a14.6 14.6 0 1 0 29.2 0 14.6 14.6 0 1 0-29.2 0Z" fill="#EA800C" /><path d="M236.5 789c-43.6 0-79-35.4-79-79v-9c0-43.6 35.4-79 79-79 25.6 0 49.8 12.6 64.7 33.7 6.4 9 4.2 21.5-4.8 27.9s-21.5 4.2-27.9-4.8c-7.4-10.5-19.3-16.7-31.9-16.7-21.5 0-39 17.5-39 39v9c0 21.5 17.5 39 39 39 12.4 0 24.2-6.1 31.6-16.3 6.4-9 18.9-11 27.9-4.6s11 18.9 4.6 27.9c-15 20.6-38.9 32.9-64.2 32.9z" fill="#EA800C" /><path d="M862.1 508.9c0 20.1-16.4 36.5-36.5 36.5H741.4c-17 0-30.9-13.9-30.9-30.9 0-15.2 11-27.8 25.4-30.4 1.2-21.5 18.6-38.8 40.2-39.8h1.9c18.5 0 34.4 12 39.9 29 2.6-0.6 5.2-0.8 7.8-0.8 14.2 0 26.6 8.2 32.6 20.1 2.4 4.8 3.8 10.4 3.8 16.3z" fill="#FFFFFF" /><path d="M654.5 329v523H842c49.5 0 90-40.5 90-90V329H654.5z m140.8 420c12.6 0 24.2-6 31.7-16.3 6.5-8.9 19-10.9 27.9-4.4s10.9 19 4.5 27.9c-14.9 20.6-38.9 32.9-64.1 32.9-43.6 0-79-35.4-79-79v-9c0-43.6 35.4-79 79-79 25.6 0 49.8 12.6 64.7 33.7 6.4 9 4.2 21.5-4.8 27.9s-21.5 4.2-27.9-4.8c-7.4-10.5-19.3-16.7-32-16.7-21.5 0-39 17.5-39 39v9c0 21.3 17.5 38.8 39 38.8z m-74-139c0-8.1 6.5-14.6 14.6-14.6s14.6 6.5 14.6 14.6-6.5 14.6-14.6 14.6-14.6-6.5-14.6-14.6zM855 473.8c0 1.8-0.1 3.5-0.4 5.3 1.5-0.8 3.4-1.1 5.2-0.6l13.5 3.6c3.7 1 6 4.8 5 8.6-0.8 3.1-3.7 5.2-6.8 5.2-0.6 0-1.2-0.1-1.8-0.2l-11.5-3.1c2.5 4.9 3.9 10.5 3.9 16.4 0 20.1-16.4 36.5-36.5 36.5H741.4c-17 0-30.9-13.9-30.9-30.9 0-15.2 11-27.8 25.4-30.4 1.2-21.5 18.6-38.8 40.2-39.8l-6.7-6.7c-2.8-2.7-2.8-7.1-0.1-9.9s7.2-2.8 9.9-0.1l9.9 9.8c1.4 1.4 2.1 3.2 2.1 5 2.9-2.2 6-4 9.3-5.4-1.5-0.9-2.8-2.4-3.3-4.2l-3.6-13.5c-1-3.7 1.2-7.6 5-8.6 3.7-1 7.6 1.2 8.6 5l3.6 13.5c0.5 1.9 0.2 3.7-0.7 5.3 1.8-0.2 3.6-0.4 5.4-0.4 1.8 0 3.6 0.1 5.3 0.4-0.9-1.5-1.2-3.4-0.7-5.3l3.6-13.5c1-3.7 4.8-6 8.6-5 3.7 1 6 4.8 5 8.6l-3.6 13.5c-0.5 1.9-1.7 3.3-3.2 4.2 3.3 1.4 6.5 3.2 9.3 5.4 0-1.8 0.7-3.6 2.1-4.9l9.8-9.8c2.7-2.7 7.2-2.7 9.9 0s2.7 7.2 0 9.9l-9.8 9.8c-1.4 1.4-3.1 2-4.9 2 2.2 2.8 4 5.9 5.4 9.3 0.9-1.5 2.3-2.6 4.1-3.1l13.5-3.7c3.7-1 7.6 1.2 8.6 4.9s-1.2 7.6-4.9 8.6l-13.5 3.7c-0.6 0.2-1.2 0.2-1.8 0.2-1.2 0-2.3-0.3-3.4-0.9 0 1.8 0.1 3.5 0.1 5.3z" fill="#2F9B77" /><path d="M721.3 610a14.6 14.6 0 1 0 29.2 0 14.6 14.6 0 1 0-29.2 0Z" fill="#EA800C" /><path d="M756.3 701v9c0 21.5 17.5 39 39 39 12.6 0 24.2-6 31.7-16.3 6.5-8.9 19-10.9 27.9-4.4s10.9 19 4.5 27.9c-14.9 20.6-38.9 32.9-64.1 32.9-43.6 0-79-35.4-79-79v-9c0-43.6 35.4-79 79-79 25.6 0 49.8 12.6 64.7 33.7 6.4 9 4.2 21.5-4.8 27.9s-21.5 4.2-27.9-4.8c-7.4-10.5-19.3-16.7-32-16.7-21.5-0.2-39 17.3-39 38.8z" fill="#EA800C" /><path d="M842 194h-50v41c0 11-9 20-20 20s-20-9-20-20v-41h-90v41c0 11-9 20-20 20s-20-9-20-20v-41H182c-49.5 0-90 40.5-90 90v45h840v-45c0-49.5-40.5-90-90-90z" fill="#F2B843" /><path d="M532 155v80c0 11-9 20-20 20-0.5 0-1 0-1.5-0.1-10.4-0.7-18.5-9.4-18.5-19.9v-80c0-10.6 8.2-19.2 18.5-19.9 0.5 0 1-0.1 1.5-0.1 11 0 20 9 20 20zM382 255c-11 0-20-9-20-20v-80c0-11 9-20 20-20s20 9 20 20v80c0 11-9 20-20 20zM662 155v80c0 11-9 20-20 20s-20-9-20-20v-80c0-11 9-20 20-20s20 9 20 20zM792 155v80c0 11-9 20-20 20s-20-9-20-20v-80c0-11 9-20 20-20s20 9 20 20zM252 255c-11 0-20-9-20-20v-80c0-11 9-20 20-20s20 9 20 20v80c0 11-9 20-20 20z" fill="#EA800C" /><path d="M842 184h-40v-29c0-16.5-13.5-30-30-30s-30 13.5-30 30v29h-70v-29c0-16.5-13.5-30-30-30s-30 13.5-30 30v29h-70v-29c0-16.5-13.5-30-30-30-0.7 0-1.4 0.1-1.7 0.1h-0.4c-15.6 1.1-27.8 14.2-27.8 29.9v29h-70v-29c0-16.5-13.5-30-30-30s-30 13.5-30 30v29h-70v-29c0-16.5-13.5-30-30-30s-30 13.5-30 30v29h-40c-55.1 0-100 44.9-100 100v478c0 55.1 44.9 100 100 100H842c55.1 0 100-44.9 100-100V284c0-55.1-44.9-100-100-100z m-80-29c0-5.5 4.5-10 10-10s10 4.5 10 10v80c0 5.5-4.5 10-10 10s-10-4.5-10-10v-80z m-130 0c0-5.5 4.5-10 10-10s10 4.5 10 10v80c0 5.5-4.5 10-10 10s-10-4.5-10-10v-80z m-130 0c0-5.2 3.9-9.5 9-9.9 0.5 0 0.9-0.1 1.2-0.1 5.4 0.1 9.8 4.6 9.8 10v80c0 5.5-4.5 10-10 10h-0.1c-0.2 0-0.5-0.1-0.7-0.1-5.1-0.3-9.2-4.7-9.2-9.9v-80z m-130 0c0-5.5 4.5-10 10-10s10 4.5 10 10v80c0 5.5-4.5 10-10 10s-10-4.5-10-10v-80z m-130 0c0-5.5 4.5-10 10-10s10 4.5 10 10v80c0 5.5-4.5 10-10 10s-10-4.5-10-10v-80zM102 284c0-44.1 35.9-80 80-80h40v31c0 16.5 13.5 30 30 30s30-13.5 30-30v-31h70v31c0 16.5 13.5 30 30 30s30-13.5 30-30v-31h70v31c0 15.5 12 28.5 27.3 29.8 1.1 0.2 2.1 0.2 2.7 0.2 16.5 0 30-13.5 30-30v-31h70v31c0 16.5 13.5 30 30 30s30-13.5 30-30v-31h70v31c0 16.5 13.5 30 30 30s30-13.5 30-30v-31h40c44.1 0 80 35.9 80 80v35H102v-35z m0 478V339h257.6v503H182c-44.1 0-80-35.9-80-80z m277.6-423h264.9v503H379.6V339zM922 762c0 44.1-35.9 80-80 80H664.6V339H922v423z" fill="#4D3500" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M72 440.5h880v286.2H72z" fill="#F2B843" /><path d="M72 726.6V834c0 19.8 16 35.8 35.8 35.8h808.5c19.8 0 35.8-16 35.8-35.8V726.6H72zM916.2 297.4H708.7L647 174.1c-6.1-12.1-18.5-19.8-32-19.8H408.9c-13.5 0-25.9 7.7-32 19.8l-61.7 123.3h-64.4v-35.8c0-19.8-16-35.8-35.8-35.8h-35.8c-19.8 0-35.8 16-35.8 35.8v35.8h-35.8c-19.8 0-35.8 16-35.8 35.8v107.3h880V333.1c0.2-19.7-15.8-35.7-35.6-35.7z" fill="#3DC38A" /><path d="M726.6 583.5c0 118.3-95.9 214.6-214.6 214.6-118.8 0-214.6-96.4-214.6-214.6 0-118.3 95.9-214.6 214.6-214.6 118.8 0 214.6 96.4 214.6 214.6z" fill="#EA800C" /><path d="M512 440.5c78.9 0 143.1 64.2 143.1 143.1S590.9 726.7 512 726.7s-143.1-64.2-143.1-143.1S433.1 440.5 512 440.5z" fill="#FFFFFF" /><path d="M773.1 386.8c9.9 0 17.9-8 17.9-17.9s-8-17.9-17.9-17.9-17.9 8-17.9 17.9c0.1 9.9 8.1 17.9 17.9 17.9zM565.7 207.9H458.3c-9.9 0-17.9 8-17.9 17.9s8 17.9 17.9 17.9h107.3c9.9 0 17.9-8 17.9-17.9s-8-17.9-17.8-17.9zM512 744.5c88.8 0 161-72.2 161-161s-72.2-161-161-161-161 72.2-161 161 72.2 161 161 161z m0-286.2c69 0 125.2 56.2 125.2 125.2S581 708.7 512 708.7s-125.2-56.2-125.2-125.2S443 458.3 512 458.3z" fill="#2F9B77" /><path d="M440.5 601.4c9.9 0 17.9-8 17.9-17.9 0-29.6 24.1-53.7 53.7-53.7 9.9 0 17.9-8 17.9-17.9s-8-17.9-17.9-17.9c-49.3 0-89.4 40.1-89.4 89.4-0.1 10 7.9 18 17.8 18z" fill="#3DC38A" /><path d="M844.7 386.8h35.8c9.9 0 17.9-8 17.9-17.9s-8-17.9-17.9-17.9h-35.8c-9.9 0-17.9 8-17.9 17.9s8 17.9 17.9 17.9z" fill="#2F9B77" /><path d="M773.1 396.8c15.4 0 27.9-12.5 27.9-27.9S788.5 341 773.1 341s-27.9 12.5-27.9 27.9v0.1c0.2 15.3 12.7 27.8 27.9 27.8z m0-35.8c4.4 0 7.9 3.5 7.9 7.9s-3.5 7.9-7.9 7.9c-4.3 0-7.8-3.6-7.9-8 0-4.3 3.6-7.8 7.9-7.8zM458.3 253.7h107.3c15.4 0 27.9-12.5 27.9-27.9s-12.5-27.9-27.8-27.9H458.3c-15.4 0-27.9 12.5-27.9 27.9s12.5 27.9 27.9 27.9z m0-35.8h107.4c4.3 0 7.8 3.5 7.8 7.9s-3.5 7.9-7.9 7.9H458.3c-4.4 0-7.9-3.5-7.9-7.9s3.5-7.9 7.9-7.9zM512 754.5c94.3 0 171-76.7 171-171s-76.7-171-171-171-171 76.7-171 171 76.7 171 171 171z m0-322c83.3 0 151 67.7 151 151s-67.7 151-151 151-151-67.7-151-151 67.7-151 151-151z" fill="#4D3500" /><path d="M512 718.7c74.5 0 135.2-60.7 135.2-135.2S586.5 448.3 512 448.3 376.8 509 376.8 583.5 437.5 718.7 512 718.7z m0-250.4c63.5 0 115.2 51.7 115.2 115.2S575.5 698.7 512 698.7 396.8 647 396.8 583.5 448.5 468.3 512 468.3z" fill="#4D3500" /><path d="M468.4 583.5c0-24.1 19.6-43.7 43.7-43.7 15.4 0 27.9-12.5 27.9-27.9S527.5 484 512.1 484c-54.8 0-99.4 44.6-99.4 99.4-0.1 7.5 2.8 14.5 8 19.8 5.3 5.3 12.3 8.2 19.8 8.2 15.4 0 27.9-12.5 27.9-27.9z m-35.7 0s0-0.1 0 0c0-43.9 35.6-79.5 79.4-79.5 4.4 0 7.9 3.5 7.9 7.9s-3.5 7.9-7.9 7.9c-35.1 0-63.7 28.6-63.7 63.7 0 4.4-3.5 7.9-7.9 7.9-2.1 0-4.1-0.8-5.6-2.3-1.4-1.5-2.2-3.5-2.2-5.6zM844.7 396.8h35.8c15.4 0 27.9-12.5 27.9-27.9S895.9 341 880.5 341h-35.8c-15.4 0-27.9 12.5-27.9 27.9s12.5 27.9 27.9 27.9z m0-35.8h35.8c4.4 0 7.9 3.5 7.9 7.9s-3.5 7.9-7.9 7.9h-35.8c-4.4 0-7.9-3.5-7.9-7.9s3.5-7.9 7.9-7.9z" fill="#4D3500" /><path d="M916.5 287.3H715.2l-58.9-117.8c-7.8-15.6-23.5-25.3-40.9-25.3H409.1c-17.4 0-33.1 9.7-40.9 25.3l-58.9 117.8H261v-25.8c0-25.3-20.5-45.8-45.8-45.8h-35.8c-25.3 0-45.8 20.5-45.8 45.8v25.8h-25.8c-25.3 0-45.8 20.5-45.8 45.8V834c0 25.1 20.5 45.7 45.8 45.8h808.4c25.3 0 45.8-20.5 45.8-45.8V442.8c0.2-0.8 0.3-1.6 0.3-2.4V333.1c0-25.3-20.5-45.8-45.8-45.8z m-737.1-51.6h35.8c14.2 0 25.8 11.6 25.8 25.8v25.9h-87.4v-25.9c0-14.2 11.6-25.8 25.8-25.8zM82 450.5h249.1c-27.5 37.3-43.7 83.3-43.7 133 0 49.8 16.3 95.8 43.8 133.1H82V450.5z m430-71.6c112.8 0 204.6 91.8 204.6 204.6S624.8 788.1 512 788.1s-204.6-91.8-204.6-204.6S399.2 378.9 512 378.9zM942 834c0 14.2-11.6 25.8-25.8 25.8H107.9C93.6 859.7 82 848.2 82 834v-97.4h265.8c41 44 99.4 71.5 164.2 71.5s123.1-27.5 164.2-71.5H942V834z m0-117.4H692.8c27.5-37.3 43.8-83.3 43.8-133.1 0-49.7-16.3-95.7-43.7-133H942v266.1z m0.3-286.2H676.2c-41-44-99.4-71.5-164.2-71.5s-123.2 27.6-164.3 71.6H82v-97.4c0-14.2 11.6-25.8 25.8-25.8h34.4c0.4 0.1 0.9 0.1 1.3 0.1h108c0.5 0 0.9 0 1.3-0.1h62.6c3.8 0 7.2-2.1 8.9-5.5L386 178.5c4.4-8.8 13.3-14.3 23.1-14.3h206.2c9.8 0 18.7 5.5 23.1 14.3l61.7 123.3c1.7 3.4 5.2 5.5 8.9 5.5h207.5c14.2 0 25.8 11.6 25.8 25.8v97.3z" fill="#4D3500" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M578 474.8l-36.7-28.4L652.8 281l36.8-48.8 38.1 30.3L578 474.8z" fill="#EA800C" /><path d="M504.6 366.4L383.2 87.9C379 78.2 369.5 72 359 72H195.6c-5.3 0-9.5 4.3-9.5 9.5v33.8c0 5.3 4.3 9.5 9.5 9.5h146.1l105.2 241.6L501.6 491l54.9-15.3-51.9-109.3z" fill="#2F9B77" /><path d="M817.5 632.1c0 176.6-134.7 319.9-300.9 319.9S215.7 808.8 215.7 632.1c0-38.5 6.4-75.3 18.1-109.4l4.6 2.3 83.9 30.7c27.1 9.9 56.8 9.6 83.7-1l67.5-26.6c27.7-10.9 58.6-10.9 86.3 0l67.5 26.6c26.8 10.5 56.6 10.9 83.7 1l83.9-30.7 4.8-1.6c11.5 33.9 17.8 70.6 17.8 108.7z" fill="#3DC38A" /><path d="M741 419.1H292.3c15.6-18.5 33.1-35.1 52.3-49.4 2.9-2.2 6.5-3.3 10.2-3.3h323.7c3.7 0 7.2 1.1 10.2 3.3 19.2 14.3 36.8 30.9 52.3 49.4z" fill="#F2B843" /><path d="M799.7 523.4l-4.8 1.6-83.9 30.7c-27.1 9.9-56.8 9.6-83.7-1l-67.5-26.6c-27.7-10.9-58.6-10.9-86.3 0L406 554.7c-26.8 10.6-56.6 10.9-83.7 1L238.5 525l-4.6-2.3c13.2-38.6 33.2-73.6 58.4-103.6H741c25.4 30.2 45.5 65.5 58.7 104.3z" fill="#EA800C" /><path d="M817.8 373.8c-3.2 5.7-10.6 7.5-16.1 4l-62.4-40.4c48.6-75 59.6-154.4 25.2-178.8l1.9 1.3c5.9 4 11.4 8.3 16.6 12.9l0.2 0.2v0.1c56.4 50.1 71.4 133.6 34.6 200.7zM762.7 157.3c-36.1-22.7-104.8 19.9-153.8 95.5l-62.4-40.4c-5.5-3.6-6.9-11.1-3-16.3 51.3-67.7 146.7-85.4 219.2-38.8z" fill="#3DC38A" /><path d="M763.1 157.6c36 23.3 25.3 103.8-23.9 179.7l-130.4-84.5c49.3-75.8 118.3-118.5 154.3-95.2z" fill="#F2B843" /><path d="M763.2 157.6z" fill="#F9F7F8" /><path d="M430.5 760m-24 0a24 24 0 1 0 48 0 24 24 0 1 0-48 0Z" fill="#FFFFFF" /><path d="M483.5 658.9m-33.3 0a33.3 33.3 0 1 0 66.6 0 33.3 33.3 0 1 0-66.6 0Z" fill="#FFFFFF" /><path d="M497.5 833m-14 0a14 14 0 1 0 28 0 14 14 0 1 0-28 0Z" fill="#FFFFFF" /><path d="M809.2 520.2c-13.5-39.6-33.8-75.8-60.5-107.5-15.9-19-34.1-36.2-54-51-4.7-3.4-10.2-5.2-16.1-5.2h-4.8l24-34.1 35.7 23.1c0.2 0.1 0.3 0.2 0.5 0.4l62.5 40.4c3.5 2.2 7.5 3.3 11.5 3.3 1.7 0 3.5-0.2 5.2-0.6 5.7-1.4 10.6-5.2 13.4-10.2v-0.1c18.8-34.3 25.5-74.6 18.7-113.3-6.7-38.1-26-73.2-54.6-98.9-0.1-0.2-0.3-0.3-0.5-0.5l-0.2-0.2-0.4-0.4c-5.6-5-11.5-9.6-17.6-13.7l-1-0.7c-0.4-0.3-0.9-0.6-1.3-0.9-0.5-0.5-1.1-0.9-1.8-1.2-37.1-23.8-81.3-32.6-124.6-24.8-43.1 7.7-81.4 31.2-107.9 66.1-3.5 4.6-4.9 10.6-3.9 16.4 1 5.8 4.5 11 9.5 14.3l61.5 39.8c0.3 0.2 0.5 0.4 0.8 0.6l35.3 22.9-48.7 72.4h-78.8L392.4 83.9C386.6 70.6 373.5 62 359 62H195.6c-10.8 0-19.5 8.7-19.5 19.5v33.9c0 10.8 8.7 19.5 19.5 19.5h139.5l96.5 221.5h-76.8c-6 0-11.6 1.8-16.2 5.3-19.6 14.6-37.8 31.7-54 51-26.2 31.2-46.3 66.7-59.7 105.5-0.2 0.4-0.4 0.8-0.6 1.3-12.4 36.1-18.6 74-18.6 112.6 0 88 32.3 170.8 90.8 233.1 58.7 62.4 136.9 96.8 220.1 96.8 83.2 0 161.3-34.4 220.1-96.9 58.6-62.3 90.8-145 90.8-233 0-38.4-6.2-76.1-18.3-111.9zM622.8 250c9.9-14.4 20.6-27.6 31.8-39.2l0.3-0.3c0.6-0.6 1.2-1.3 1.8-1.9l0.9-0.9 1.1-1.1c0.5-0.5 1-1 1.6-1.5l0.3-0.3c11.6-11.3 23.6-20.9 35.6-28.3 25.3-15.6 47.7-19.5 61.5-10.6 0.2 0.1 0.4 0.3 0.7 0.5 0.1 0.1 0.3 0.2 0.4 0.3 1.6 1.1 3 2.4 4.4 3.9l0.3 0.3c0.2 0.2 0.3 0.4 0.5 0.5 0.2 0.3 0.5 0.6 0.7 0.8 8.7 11.1 11.8 30.1 8.6 54-4 29.9-17.1 64.1-37.1 97L701 300.6l-0.1-0.1c-0.3-0.2-0.5-0.4-0.8-0.5l-77.3-50z m202.8 18.8c6 34.2 0.1 69.8-16.5 100.1-0.2 0.3-0.5 0.5-0.8 0.6-0.3 0.1-0.7 0.1-1.1-0.1l-54.1-35c21.3-34.9 35.4-71.5 39.9-104 1.6-11.3 2-21.9 1.2-31.4 16 20.1 26.9 44.2 31.4 69.8zM551.3 203c-0.1-0.4 0-0.7 0.2-0.9 23.4-30.8 57.3-51.6 95.4-58.5 9.1-1.6 18.2-2.4 27.3-2.4 13.1 0 26.1 1.7 38.7 5-8.8 3.1-18.1 7.6-27.6 13.5-14.1 8.7-28.2 20.2-41.6 33.7l-0.9 0.9c-0.5 0.5-1 1-1.5 1.6-0.7 0.7-1.4 1.5-2.1 2.2-0.1 0.1-0.1 0.2-0.2 0.2-11.6 12.2-22.7 25.9-32.9 40.7l-54-35c-0.6-0.3-0.8-0.7-0.8-1z m104.1 91.9l25.5 16.5-31.7 44.9H614l41.4-61.4z m-304.5-174c-1.6-3.6-5.2-6-9.2-6H196.1V82H359c6.5 0 12.4 3.9 15 9.9l115.2 264.5h-35.8L350.9 120.9z m-0.3 256.8c1.1-0.8 2.6-1.3 4.2-1.3h323.6c1.6 0 3 0.4 4.2 1.3 12.7 9.5 24.7 20 35.8 31.4H314.8c11.2-11.5 23.2-22 35.8-31.4zM297 429.1h439.3c21.6 26.4 38.5 56 50.6 88.2l-79.3 29c-24.8 9.1-52 8.7-76.6-0.9l-67.5-26.6c-30.2-11.9-63.4-11.9-93.6 0l-67.5 26.6c-24 9.5-50.6 9.9-75 1.5-0.5-0.2-1.1-0.4-1.6-0.5l-79.3-29c12-32.3 29-61.9 50.5-88.3z m425.1 422.3C667.2 909.8 594.2 942 516.6 942S366 909.8 311.1 851.5C256 792.9 225.7 715 225.7 632.1c0-32.8 4.8-65 14.2-95.9l78.9 28.9c0.9 0.3 1.8 0.7 2.7 1 0.2 0.1 0.4 0.1 0.7 0.2 0.7 0.2 1.4 0.5 2.1 0.7 0.2 0.1 0.5 0.1 0.7 0.2l2.1 0.6c0.2 0.1 0.4 0.1 0.6 0.2 0.7 0.2 1.5 0.4 2.2 0.6 0.2 0 0.3 0.1 0.5 0.1 0.8 0.2 1.6 0.4 2.3 0.6 0.1 0 0.2 0.1 0.3 0.1 0.8 0.2 1.7 0.4 2.5 0.6h0.2c0.9 0.2 1.8 0.4 2.7 0.5h0.1c8 1.6 16.2 2.3 24.3 2.3 15.9 0 31.8-3 46.7-8.9l67.5-26.6c25.5-10 53.5-10 79 0l67.5 26.6h0.1c29.1 11.4 61.3 11.8 90.7 1.1l78.9-28.9c9.4 30.9 14.2 63.1 14.2 95.9 0.1 83-30.2 160.9-85.3 219.4z" fill="#4D3500" /><path d="M430.5 726c-18.7 0-34 15.3-34 34s15.3 34 34 34 34-15.3 34-34-15.3-34-34-34z m0 48c-7.7 0-14-6.3-14-14s6.3-14 14-14 14 6.3 14 14-6.3 14-14 14zM483.5 615.6c-23.9 0-43.3 19.4-43.3 43.3s19.4 43.3 43.3 43.3 43.3-19.4 43.3-43.3-19.4-43.3-43.3-43.3z m0 66.6c-12.8 0-23.3-10.5-23.3-23.3s10.5-23.3 23.3-23.3 23.3 10.5 23.3 23.3-10.5 23.3-23.3 23.3zM497.5 809c-13.2 0-24 10.8-24 24s10.8 24 24 24 24-10.8 24-24-10.8-24-24-24z m0 28c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z" fill="#4D3500" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M353.5 280.6c-8 0-14.5-6.4-14.5-14.5v-44.8c0-8 6.4-14.5 14.5-14.5 8 0 14.5 6.4 14.5 14.5v44.8c0 8-6.4 14.5-14.5 14.5z" fill="#2F9B77" /><path d="M325.8 266.1h55.4v67.5h-55.4v-67.5z" fill="#2F9B77" /><path d="M404.1 280.6H302.9c-8 0-14.5-6.4-14.5-14.5 0-8 6.4-14.5 14.5-14.5h101.2c8 0 14.5 6.4 14.5 14.5 0 8-6.4 14.5-14.5 14.5zM619.8 266.1h-73.2c-2.8 0-5.5 1.2-7.3 3.3l-56.8 64.3h147.2v-57.8c-0.1-5.4-4.5-9.8-9.9-9.8z" fill="#3DC38A" /><path d="M669.3 437.7v-94.3c0-5.3-4.4-9.8-9.8-9.8H286.1c-3.5 0-6.8 1.9-8.5 4.9l-57.1 99.2 199.3 13.5 249.5-13.5z" fill="#EA800C" /><path d="M580.1 400.2h-3.9c-8 0-14.5-6.4-14.5-14.5 0-8 6.4-14.5 14.5-14.5h3.9c8 0 14.5 6.4 14.5 14.5s-6.6 14.5-14.5 14.5zM457.2 400.2h-3.9c-8 0-14.5-6.4-14.5-14.5 0-8 6.4-14.5 14.5-14.5h3.9c8 0 14.5 6.4 14.5 14.5 0 8-6.4 14.5-14.5 14.5zM334.5 400.2h-3.9c-8 0-14.5-6.4-14.5-14.5 0-8 6.4-14.5 14.5-14.5h3.9c8 0 14.5 6.4 14.5 14.5 0 8-6.5 14.5-14.5 14.5z" fill="#FFFFFF" /><path d="M823.6 442.1c-1.9-2.7-4.8-4.3-8.1-4.3h-595L179 509.9h-66.5c-10.8 0-19.5 8.7-19.5 19.5v138.2h754.6l59.5-102-83.5-123.5z" fill="#F2B843" /><path d="M990.3 544.1L890 670.1 755.6 773.4c-7.4 9.3-18.9 14.5-30.8 14.5l-635 9.4c-4.3 0 2 7.2 0.7 3.1l-34.9-68.8L32.4 658c-1.5-4.8 1.9-9.8 6.9-10.1 39.9-2.7 93.2-16.6 116.6-38.8 1.9-1.7 4.1-2.6 6.7-2.6h494c2.9 0 5.7-1.3 7.5-3.5l55.9-68c1.9-2.3 4.6-3.5 7.5-3.5h256.6c6.6-0.2 10.3 7.4 6.2 12.6z" fill="#3DC38A" /><path d="M818.7 705c-34.6 16.8-72.5 25.5-111.1 25.5H55.3l25.2 79.9c1.3 4 5 6.9 9.3 6.9h664.3c11.9 0 23.1-5.5 30.5-14.7l104.7-131.7c-24 11.4-49.3 23.7-70.6 34.1z" fill="#2F9B77" /><path d="M268.9 502.7H265c-8 0-14.5-6.4-14.5-14.5s6.4-14.5 14.5-14.5h3.9c8 0 14.5 6.4 14.5 14.5s-6.4 14.5-14.5 14.5zM392.7 502.7h-3.9c-8 0-14.5-6.4-14.5-14.5s6.5-14.4 14.5-14.4h3.9c8 0 14.5 6.4 14.5 14.5s-6.6 14.4-14.5 14.4zM516.4 502.7h-3.9c-8 0-14.5-6.4-14.5-14.5s6.4-14.5 14.5-14.5h3.9c8 0 14.5 6.4 14.5 14.5s-6.6 14.5-14.5 14.5zM640.1 502.7h-3.9c-8 0-14.5-6.4-14.5-14.5s6.4-14.5 14.5-14.5h3.9c8 0 14.5 6.4 14.5 14.5s-6.6 14.5-14.5 14.5z" fill="#FFFFFF" /><path d="M268.9 578.4H265c-8 0-14.5-6.4-14.5-14.5s6.4-14.5 14.5-14.5h3.9c8 0 14.5 6.4 14.5 14.5 0.1 8.1-6.4 14.5-14.5 14.5zM392.7 578.4h-3.9c-8 0-14.5-6.4-14.5-14.5s6.4-14.5 14.5-14.5h3.9c8 0 14.5 6.4 14.5 14.5s-6.6 14.5-14.5 14.5zM516.4 578.4h-3.9c-8 0-14.5-6.4-14.5-14.5s6.4-14.5 14.5-14.5h3.9c8 0 14.5 6.4 14.5 14.5s-6.6 14.5-14.5 14.5zM640.1 578.4h-3.9c-8 0-14.5-6.4-14.5-14.5s6.4-14.5 14.5-14.5h3.9c8 0 14.5 6.4 14.5 14.5s-6.6 14.5-14.5 14.5z" fill="#FFFFFF" /><path d="M576.2 410.2h3.9c13.5 0 24.5-11 24.5-24.5s-11-24.5-24.5-24.5h-3.9c-13.5 0-24.5 11-24.5 24.5s11 24.5 24.5 24.5z m0-29h3.9c2.5 0 4.5 2 4.5 4.5s-2 4.5-4.5 4.5h-3.9c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5zM453.3 410.2h3.9c13.5 0 24.5-11 24.5-24.5s-11-24.5-24.5-24.5h-3.9c-13.5 0-24.5 11-24.5 24.5s11 24.5 24.5 24.5z m0-29h3.9c2.5 0 4.5 2 4.5 4.5s-2 4.5-4.5 4.5h-3.9c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5zM330.6 410.2h3.9c13.5 0 24.5-11 24.5-24.5s-11-24.5-24.5-24.5h-3.9c-13.5 0-24.5 11-24.5 24.5s11 24.5 24.5 24.5z m0-29h3.9c2.5 0 4.5 2 4.5 4.5s-2 4.5-4.5 4.5h-3.9c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5z" fill="#4D3500" /><path d="M1000 531.4c-3-6.1-9.1-9.9-15.9-9.9h-95l-57.3-84.8c-3.7-5.5-9.8-8.8-16.4-8.8H679.5v-84.6c0-10.9-8.9-19.7-19.8-19.7h-20v-47.7-0.2c-0.2-10.8-9.1-19.6-19.9-19.6h-73.2c-5.7 0-11.1 2.5-14.8 6.7l-53.7 60.8h-86.9v-33h12.9c13.5 0 24.5-11 24.5-24.5s-11-24.5-24.5-24.5h-26v-20.3c0-13.5-11-24.5-24.5-24.5s-24.5 11-24.5 24.5v20.3h-26.2c-13.5 0-24.5 11-24.5 24.5s11 24.5 24.5 24.5h12.9v33h-29.7c-7.2 0-13.8 3.8-17.2 10l-57.1 99.1-0.6 1.2-38 66.1h-60.7C96.2 500 83 513.2 83 529.5v101.3c-15.1 3.6-30.5 6-44.2 6.9-5.5 0.3-10.4 3.1-13.5 7.6-3.1 4.5-4 10.2-2.3 15.5l22.5 71.4 0.3 1.2 0.3 1v0.1L71 813.2c2.5 8.4 10 14 18.9 14h664.4c14.8 0 29.1-6.9 38.3-18.5l104.8-131.6c0.2-0.2 0.4-0.5 0.5-0.7l100.2-126 0.1-0.1c4.1-5.5 4.9-12.7 1.8-18.9zM546.7 276.1h73v47.5H504.8l41.9-47.5z m-197.6-54.8c0-2.5 2-4.5 4.5-4.5 2.6 0 4.5 1.9 4.5 4.5v20.3h-9v-20.3z m-50.7 44.8c0-2.5 2-4.5 4.5-4.5h101.2c2.5 0 4.5 2 4.5 4.5s-2 4.5-4.5 4.5H302.9c-2.5 0-4.5-2-4.5-4.5z m37.4 24.5h35.4v33h-35.4v-33z m-49.6 53h194.9c0.5 0.1 0.9 0.1 1.4 0.1h147.2c0.5 0 0.9 0 1.3-0.1h28.5v84.3H237.7l48.5-84.3zM112.5 520H179c3.6 0 6.9-1.9 8.7-5l38.6-67.1h589l49.7 73.6H727.5c-5.8 0-11.2 2.5-15.1 7 0 0.1-0.1 0.1-0.1 0.2l-55.8 67.6H162.6c-5 0-9.6 1.8-13.4 5.1-0.1 0.1-0.2 0.1-0.2 0.2-9.2 8.8-25.3 17-46 23.7v-95.8c0-5.2 4.3-9.5 9.5-9.5z m615.1 21.5zM883 663c-1.9 1.3-3.2 3-3.9 5L776.9 796.3c-5.4 6.8-13.9 10.9-22.7 10.9H90l-24.5-77.4-0.3-1.2-0.3-1v-0.1l-22.1-70c16.2-1.3 34.2-4.4 51.5-8.9 0.8-0.1 1.6-0.3 2.4-0.6 21-5.7 49-15.8 65.9-31.8h494c5.9 0 11.6-2.7 15.2-7.1l55.8-67.6h252L883 663z" fill="#4D3500" /><path d="M265 512.7h3.9c13.5 0 24.5-11 24.5-24.5s-11-24.5-24.5-24.5H265c-13.5 0-24.5 11-24.5 24.5s11 24.5 24.5 24.5z m0-29h3.9c2.5 0 4.5 2 4.5 4.5 0 2.6-1.9 4.5-4.5 4.5H265c-2.5 0-4.5-2-4.5-4.5 0-2.6 1.9-4.5 4.5-4.5zM388.8 512.7h3.9c13.5 0 24.5-10.9 24.5-24.4 0-13.5-11-24.5-24.5-24.5h-3.9c-13.5 0-24.5 10.9-24.5 24.4 0 13.5 11 24.5 24.5 24.5z m0-28.9h3.9c2.5 0 4.5 2 4.5 4.5s-2 4.4-4.5 4.4h-3.9c-2.5 0-4.5-2-4.5-4.5s1.9-4.4 4.5-4.4zM512.5 512.7h3.9c13.5 0 24.5-11 24.5-24.5s-11-24.5-24.5-24.5h-3.9c-13.5 0-24.5 11-24.5 24.5s11 24.5 24.5 24.5z m0-29h3.9c2.5 0 4.5 2 4.5 4.5s-2 4.5-4.5 4.5h-3.9c-2.5 0-4.5-2-4.5-4.5 0-2.6 1.9-4.5 4.5-4.5zM636.2 512.7h3.9c13.5 0 24.5-11 24.5-24.5s-11-24.5-24.5-24.5h-3.9c-13.5 0-24.5 11-24.5 24.5s11 24.5 24.5 24.5z m0-29h3.9c2.5 0 4.5 2 4.5 4.5s-2 4.5-4.5 4.5h-3.9c-2.5 0-4.5-2-4.5-4.5 0-2.6 1.9-4.5 4.5-4.5zM265 588.4h3.9c6.7 0 12.9-2.6 17.5-7.3 4.6-4.6 7-10.8 7-17.3 0-13.5-11-24.4-24.5-24.4H265c-13.5 0-24.5 11-24.5 24.5s11 24.5 24.5 24.5z m0-29h3.9c2.5 0 4.5 2 4.5 4.5v0.1c0 1.5-0.6 2.5-1.2 3-0.8 0.9-2 1.3-3.3 1.3H265c-2.5 0-4.5-2-4.5-4.5s1.9-4.4 4.5-4.4zM388.8 588.4h3.9c13.5 0 24.5-11 24.5-24.5s-11-24.5-24.5-24.5h-3.9c-13.5 0-24.5 11-24.5 24.5s11 24.5 24.5 24.5z m0-29h3.9c2.5 0 4.5 2 4.5 4.5s-2 4.5-4.5 4.5h-3.9c-2.5 0-4.5-2-4.5-4.5 0-2.6 1.9-4.5 4.5-4.5zM512.5 588.4h3.9c13.5 0 24.5-11 24.5-24.5s-11-24.5-24.5-24.5h-3.9c-13.5 0-24.5 11-24.5 24.5s11 24.5 24.5 24.5z m0-29h3.9c2.5 0 4.5 2 4.5 4.5s-2 4.5-4.5 4.5h-3.9c-2.5 0-4.5-2-4.5-4.5 0-2.6 1.9-4.5 4.5-4.5zM636.2 588.4h3.9c13.5 0 24.5-11 24.5-24.5s-11-24.5-24.5-24.5h-3.9c-13.5 0-24.5 11-24.5 24.5s11 24.5 24.5 24.5z m0-29h3.9c2.5 0 4.5 2 4.5 4.5s-2 4.5-4.5 4.5h-3.9c-2.5 0-4.5-2-4.5-4.5 0-2.6 1.9-4.5 4.5-4.5z" fill="#4D3500" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M332.9 258.8h25.9V311h-25.9v-52.2zM536.3 258.8h25.9V311h-25.9v-52.2z" fill="#2F9B77" /><path d="M923.7 788.5H100.3V398.4c0-56 45.4-101.5 101.5-101.5h465.7c141.5 0 256.3 114.7 256.3 256.3l-0.1 235.3z" fill="#3DC38A" /><path d="M100.3 553.2h823.5v235.2H100.3V553.2z" fill="#2F9B77" /><path d="M84.6 772.8h52v-71.9c0-6.8-5.5-12.4-12.4-12.4H97c-6.8 0-12.4 5.5-12.4 12.4v71.9z" fill="#EA800C" /><path d="M887.4 772.8h52v-53.1c0-17.2-14-31.2-31.2-31.2h-8.4c-6.8 0-12.4 5.5-12.4 12.4v71.9z" fill="#F2B843" /><path d="M916.8 823.7H107.2c-19.5 0-35.2-15.8-35.2-35.2 0-19.5 15.8-35.2 35.2-35.2h809.5c19.5 0 35.2 15.8 35.2 35.2 0.1 19.4-15.7 35.2-35.1 35.2z" fill="#3DC38A" /><path d="M711.9 788.5m-112 0a112 112 0 1 0 224 0 112 112 0 1 0-224 0Z" fill="#EA800C" /><path d="M711.9 788.5m-50.7 0a50.7 50.7 0 1 0 101.4 0 50.7 50.7 0 1 0-101.4 0Z" fill="#FFFFFF" /><path d="M289.5 788.5m-112 0a112 112 0 1 0 224 0 112 112 0 1 0-224 0Z" fill="#EA800C" /><path d="M289.5 788.5m-50.7 0a50.7 50.7 0 1 0 101.4 0 50.7 50.7 0 1 0-101.4 0Z" fill="#FFFFFF" /><path d="M843.2 466.4c-33.8-71.6-105.4-121-188.2-121h-20.7c-14.8 0-26.7 12.3-26.7 27.4v105.7c0 15.1 12 27.4 26.7 27.4h184.9c19.8-0.1 32.6-21.3 24-39.5zM547.6 345.3H429.4c-15.1 0-27.4 12.3-27.4 27.4v105.7c0 15.1 12.3 27.4 27.4 27.4h118.2c15.1 0 27.4-12.3 27.4-27.4V372.7c0-15.1-12.3-27.4-27.4-27.4zM342 345.3h-97.3c-18.5 0-33.6 15-33.6 33.6v99.5c0 15.1 12.3 27.4 27.4 27.4H342c15.1 0 27.4-12.3 27.4-27.4V372.7c0-15.1-12.2-27.4-27.4-27.4z" fill="#F2B843" /><path d="M281.1 123.5c37.8 0 37.8 103.1 0 103.1s-128.6-23.1-128.6-51.5 90.8-51.6 128.6-51.6z" fill="#EA800C" /><path d="M952 192.7c0 47.1-197 75.3-440 75.3S72 239.8 72 192.7s880-47.2 880 0z" fill="#F2B843" /><path d="M949.4 719.7c0-12.7-5.9-24.5-15.6-32.3V553.2c0-146.8-119.5-266.3-266.3-266.3h-95.3v-9.4-0.1c97.9-2 186.1-8.7 252.5-19.5 41.5-6.7 74-14.9 96.5-24.3 27.4-11.4 40.7-24.8 40.7-40.9 0-2.7 0-11.1-16.2-17.6-7-2.8-16.8-5.3-29.8-7.7-23.6-4.3-57.4-8.1-100.7-11.2-79.9-5.7-187.5-8.9-303-8.9-69.5 0-136.2 1.1-195.7 3.3-5.5-23.4-18.5-37.1-35.6-37.1-20 0-51.2 5.8-77.7 14.3-30.3 9.8-49.5 21.2-57.2 34.1-14.7 1.7-27.5 3.5-38.1 5.5-27.6 5.1-46 11.3-46 25.3 0 16.1 13.3 29.5 40.7 40.9 22.6 9.4 55 17.6 96.5 24.3 35.6 5.8 77.4 10.4 123.6 13.8V287H201.8c-61.5 0-111.5 50-111.5 111.5v281c-9.1 2.9-15.7 11.4-15.7 21.4v56.5c-8 8.4-12.5 19.5-12.5 31.2 0 24.9 20.3 45.2 45.2 45.2h68.9c18 45 62 76.8 113.3 76.8s95.3-31.8 113.3-76.8h195.8c18 45 62 76.8 113.3 76.8s95.3-31.8 113.3-76.8h91.5c24.9 0 45.2-20.3 45.2-45.2 0-11.8-4.5-22.9-12.5-31.2v-37.7z m-124.2 23.6c-18-45-62-76.8-113.3-76.8s-95.3 31.8-113.3 76.7H402.8c-18-44.9-62-76.7-113.3-76.7s-95.3 31.8-113.3 76.8h-29.6v-42.5c0-12.4-10-22.4-22.4-22.4h-13.9V563.2h803.4V679c-1.8-0.2-3.6-0.4-5.4-0.4h-8.4c-12.4 0-22.4 10-22.4 22.4v42.3h-52.3zM94.6 700.8c0-1.3 1.1-2.4 2.4-2.4h2c0.4 0.1 0.9 0.1 1.3 0.1s0.9 0 1.3-0.1h22.6c1.3 0 2.4 1.1 2.4 2.4v42.5h-19.3c-4.3 0-8.6 0.6-12.7 1.8v-44.3z m802.9 0.2c0-1.3 1.1-2.4 2.4-2.4h8.4c3.7 0 7.3 1 10.5 2.8 6.5 3.7 10.6 10.7 10.6 18.3v25.4c-1.2-0.3-2.4-0.7-3.6-0.9-2.7-0.6-5.8-0.9-9.1-0.9h-19.2V701zM552.2 286.9h-5.9v-9-0.1c2 0 3.9-0.1 5.9-0.1v9.2z m-183.4 0v-12.4c45 2.3 93.2 3.5 143.2 3.5h14.3v8.9H368.8zM209.4 146.8c24.3-7.9 53.7-13.3 71.6-13.3 7.2 0 12.2 8.3 15.1 17.9-31.6 1.3-60.9 2.9-87.2 4.8-9.8 0.7-19.2 1.4-28 2.2 7.1-3.7 16.5-7.7 28.5-11.6z m-99 68.3c-15.7-6.5-25.8-13.8-28-20 3.4-1.9 13.5-5.8 41.3-10.1 24.7-3.8 58.3-7.1 99.9-9.8 78-5.1 180.4-7.9 288.4-7.9h0.3c107.9 0 210.2 2.8 288 7.9 41.6 2.7 75.2 6 99.9 9.8 27.8 4.3 37.9 8.2 41.3 10.1-2.2 6.2-12.3 13.5-28 20-21.1 8.8-52.1 16.5-92.1 23C742.7 250.9 632.8 258 512 258s-230.7-7.1-309.5-19.9c-40-6.4-70.9-14.2-92.1-23zM342.9 273c2 0.1 3.9 0.2 5.9 0.4v13.5h-5.9V273z m-141.1 33.9h465.7c132.5 0 240.8 105.1 246.1 236.3H110.3V398.4c0-50.5 41-91.5 91.5-91.5z m-94.5 506.8c-13.9 0-25.2-11.3-25.2-25.2 0-7.4 3.3-14.5 9-19.3 4.5-3.8 10.3-5.9 16.2-5.9h62.8c-1.7 8.1-2.6 16.6-2.6 25.2s0.9 17.1 2.6 25.2h-62.8z m182.2 76.8c-44.8 0-83-29.1-96.6-69.3-0.1-0.4-0.2-0.8-0.4-1.2-3.2-9.9-5-20.5-5-31.5 0-10.7 1.7-21 4.7-30.7 0.4-0.8 0.7-1.8 0.9-2.7 13.9-39.9 51.8-68.6 96.4-68.6 56.2 0 102 45.8 102 102 0 11-1.8 21.6-5 31.5-0.2 0.4-0.3 0.8-0.4 1.2-13.6 40.2-51.8 69.3-96.6 69.3z m119.4-76.8c1.7-8.1 2.6-16.6 2.6-25.2 0-8.7-0.9-17.1-2.6-25.3h183.7c-1.7 8.2-2.6 16.6-2.6 25.3 0 8.6 0.9 17.1 2.6 25.2H408.9z m303 76.8c-44.8 0-83-29.1-96.6-69.4-0.1-0.4-0.2-0.8-0.4-1.1-3.2-9.9-5-20.5-5-31.5 0-56.2 45.8-102 102-102 44.5 0 82.5 28.7 96.4 68.6 0.2 1 0.5 1.9 0.9 2.7 3.1 9.7 4.7 20 4.7 30.7 0 11-1.8 21.6-5 31.5-0.2 0.4-0.3 0.8-0.4 1.2-13.6 40.2-51.8 69.3-96.6 69.3z m204.8-76.8h-85.4c1.7-8.1 2.6-16.6 2.6-25.2s-0.9-17.1-2.6-25.2h54.9c0.4 0.1 0.9 0.1 1.3 0.1s0.9 0 1.3-0.1h27.9c1.8 0 3.5 0.2 4.8 0.5h0.2c4.2 0.9 8 2.7 11.2 5.4 5.7 4.8 9 11.8 9 19.3 0 13.9-11.3 25.2-25.2 25.2z" fill="#4D3500" /><path d="M711.9 727.8c-33.5 0-60.7 27.2-60.7 60.7s27.2 60.7 60.7 60.7 60.7-27.2 60.7-60.7-27.2-60.7-60.7-60.7z m0 101.4c-22.4 0-40.7-18.3-40.7-40.7s18.3-40.7 40.7-40.7c22.4 0 40.7 18.3 40.7 40.7s-18.3 40.7-40.7 40.7zM289.5 727.8c-33.5 0-60.7 27.2-60.7 60.7s27.2 60.7 60.7 60.7 60.7-27.2 60.7-60.7-27.2-60.7-60.7-60.7z m0 101.4c-22.4 0-40.7-18.3-40.7-40.7s18.3-40.7 40.7-40.7 40.7 18.3 40.7 40.7-18.3 40.7-40.7 40.7zM634.3 515.9h185c12.5-0.1 24.1-6.5 30.8-17.2 7-11 7.8-24.7 2.2-36.5-17.6-37.4-45.1-69-79.3-91.4-35.2-23.1-76-35.3-118-35.3h-20.7c-20.2 0-36.7 16.8-36.7 37.4v105.7c0 20.5 16.5 37.3 36.7 37.3z m-16.7-143.1c0-9.6 7.5-17.4 16.7-17.4H655c38.1 0 75.1 11.1 107 32 31.1 20.4 56.1 49.2 72.2 83.3 2.7 5.6 2.3 12.1-1 17.3-3.1 5-8.2 7.9-13.9 7.9h-185c-9.2 0-16.7-7.8-16.7-17.4V372.8zM429.4 515.8h118.2c20.6 0 37.4-16.8 37.4-37.4V372.7c0-20.6-16.8-37.4-37.4-37.4H429.4c-20.6 0-37.4 16.8-37.4 37.4v105.7c0 20.6 16.8 37.4 37.4 37.4zM412 372.7c0-9.6 7.8-17.4 17.4-17.4h118.2c9.6 0 17.4 7.8 17.4 17.4v105.7c0 9.6-7.8 17.4-17.4 17.4H429.4c-9.6 0-17.4-7.8-17.4-17.4V372.7zM238.5 515.8H342c20.6 0 37.4-16.8 37.4-37.4V372.7c0-20.6-16.8-37.4-37.4-37.4h-97.3c-24 0-43.6 19.6-43.6 43.6v99.5c0 20.6 16.8 37.4 37.4 37.4z m-17.4-136.9c0-13 10.6-23.6 23.6-23.6H342c9.6 0 17.4 7.8 17.4 17.4v105.7c0 9.6-7.8 17.4-17.4 17.4H238.5c-9.6 0-17.4-7.8-17.4-17.4v-99.5z" fill="#4D3500" /></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" baseProfile="full" width="100%" height="100%" viewBox="0 0 1400 800">
<rect x="1300" y="400" rx="40" ry="40" width="150" height="150" stroke="rgb(129, 201, 149)" fill="rgb(129, 201, 149)">
<animateTransform attributeType="XML" attributeName="transform" begin="0s" dur="35s" type="rotate" from="0 1450 550" to="360 1450 550" repeatCount="indefinite"/>
</rect>
<path d="M 100 350 A 150 150 0 1 1 400 350 Q400 370 380 370 L 250 370 L 120 370 Q100 370 100 350" fill="#a2b3ff">
<animateMotion path="M 800 -200 L 800 -300 L 800 -200" dur="20s" begin="0s" repeatCount="indefinite"/>
<animateTransform attributeType="XML" attributeName="transform" begin="0s" dur="30s" type="rotate" values="0 210 530 ; -30 210 530 ; 0 210 530" keyTimes="0 ; 0.5 ; 1" repeatCount="indefinite"/>
</path>
<circle cx="150" cy="150" r="180" stroke="#85FFBD" fill="#85FFBD">
<animateMotion path="M 0 0 L 40 20 Z" dur="5s" repeatCount="indefinite"/>
</circle>
<!-- 三角形 -->
<path d="M 165 580 L 270 580 Q275 578 270 570 L 223 483 Q220 480 217 483 L 165 570 Q160 578 165 580" fill="#a2b3ff">
<animateTransform attributeType="XML" attributeName="transform" begin="0s" dur="35s" type="rotate" from="0 210 530" to="360 210 530" repeatCount="indefinite"/>
</path>
<!-- <circle cx="1200" cy="600" r="30" stroke="rgb(241, 243, 244)" fill="rgb(241, 243, 244)">-->
<!-- <animateMotion path="M 0 0 L -20 40 Z" dur="9s" repeatCount="indefinite"/>-->
<!-- </circle>-->
<path d="M 100 350 A 40 40 0 1 1 180 350 L 180 430 A 40 40 0 1 1 100 430 Z" fill="#3054EB">
<animateMotion path="M 140 390 L 180 360 L 140 390" dur="20s" begin="0s" repeatCount="indefinite"/>
<animateTransform attributeType="XML" attributeName="transform" begin="0s" dur="30s" type="rotate" values="0 140 390; -60 140 390; 0 140 390" keyTimes="0 ; 0.5 ; 1" repeatCount="indefinite"/>
</path>
<rect x="400" y="600" rx="40" ry="40" width="100" height="100" stroke="rgb(129, 201, 149)" fill="#3054EB">
<animateTransform attributeType="XML" attributeName="transform" begin="0s" dur="35s" type="rotate" from="-30 550 750" to="330 550 750" repeatCount="indefinite"/>
</rect>
</svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
{
"code": 200,
"data": {
"useProTable": ["add", "batchAdd", "export", "batchDelete", "status"],
"authButton": ["add", "edit", "delete", "import", "export"]
},
"msg": "成功"
}
{
"code": 200,
"data": [
{
"path": "/home/index",
"name": "home",
"component": "/home/index",
"meta": {
"icon": "HomeFilled",
"title": "首页",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": true,
"isKeepAlive": true
}
},
{
"path": "/dataScreen",
"name": "dataScreen",
"component": "/dataScreen/index",
"meta": {
"icon": "Histogram",
"title": "数据大屏",
"isLink": "",
"isHide": false,
"isFull": true,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/proTable",
"name": "proTable",
"redirect": "/proTable/useProTable",
"meta": {
"icon": "MessageBox",
"title": "超级表格",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/proTable/useProTable",
"name": "useProTable",
"component": "/proTable/useProTable/index",
"meta": {
"icon": "Menu",
"title": "使用 ProTable",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/proTable/useProTable/detail/:id",
"name": "useProTableDetail",
"component": "/proTable/useProTable/detail",
"meta": {
"icon": "Menu",
"title": "ProTable 详情",
"activeMenu": "/proTable/useProTable",
"isLink": "",
"isHide": true,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/proTable/useTreeFilter",
"name": "useTreeFilter",
"component": "/proTable/useTreeFilter/index",
"meta": {
"icon": "Menu",
"title": "使用 TreeFilter",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/proTable/useTreeFilter/detail/:id",
"name": "useTreeFilterDetail",
"component": "/proTable/useTreeFilter/detail",
"meta": {
"icon": "Menu",
"title": "TreeFilter 详情",
"activeMenu": "/proTable/useTreeFilter",
"isLink": "",
"isHide": true,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/proTable/useSelectFilter",
"name": "useSelectFilter",
"component": "/proTable/useSelectFilter/index",
"meta": {
"icon": "Menu",
"title": "使用 SelectFilter",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/proTable/treeProTable",
"name": "treeProTable",
"component": "/proTable/treeProTable/index",
"meta": {
"icon": "Menu",
"title": "树形 ProTable",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/proTable/complexProTable",
"name": "complexProTable",
"component": "/proTable/complexProTable/index",
"meta": {
"icon": "Menu",
"title": "复杂 ProTable",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/proTable/document",
"name": "proTableDocument",
"component": "/proTable/document/index",
"meta": {
"icon": "Menu",
"title": "ProTable 文档",
"isLink": "https://juejin.cn/post/7166068828202336263/#heading-14",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/auth",
"name": "auth",
"redirect": "/auth/menu",
"meta": {
"icon": "Lock",
"title": "权限管理",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/auth/menu",
"name": "authMenu",
"component": "/auth/menu/index",
"meta": {
"icon": "Menu",
"title": "菜单权限",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/auth/button",
"name": "authButton",
"component": "/auth/button/index",
"meta": {
"icon": "Menu",
"title": "按钮权限",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/assembly",
"name": "assembly",
"redirect": "/assembly/guide",
"meta": {
"icon": "Briefcase",
"title": "常用组件",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/assembly/guide",
"name": "guide",
"component": "/assembly/guide/index",
"meta": {
"icon": "Menu",
"title": "引导页",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/assembly/tabs",
"name": "tabs",
"component": "/assembly/tabs/index",
"meta": {
"icon": "Menu",
"title": "标签页操作",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/assembly/tabs/detail/:id",
"name": "tabsDetail",
"component": "/assembly/tabs/detail",
"meta": {
"icon": "Menu",
"title": "Tab 详情",
"activeMenu": "/assembly/tabs",
"isLink": "",
"isHide": true,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/assembly/selectIcon",
"name": "selectIcon",
"component": "/assembly/selectIcon/index",
"meta": {
"icon": "Menu",
"title": "图标选择器",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/assembly/selectFilter",
"name": "selectFilter",
"component": "/assembly/selectFilter/index",
"meta": {
"icon": "Menu",
"title": "分类筛选器",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/assembly/treeFilter",
"name": "treeFilter",
"component": "/assembly/treeFilter/index",
"meta": {
"icon": "Menu",
"title": "树形筛选器",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/assembly/svgIcon",
"name": "svgIcon",
"component": "/assembly/svgIcon/index",
"meta": {
"icon": "Menu",
"title": "SVG 图标",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/assembly/uploadFile",
"name": "uploadFile",
"component": "/assembly/uploadFile/index",
"meta": {
"icon": "Menu",
"title": "文件上传",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/assembly/batchImport",
"name": "batchImport",
"component": "/assembly/batchImport/index",
"meta": {
"icon": "Menu",
"title": "批量添加数据",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/assembly/wangEditor",
"name": "wangEditor",
"component": "/assembly/wangEditor/index",
"meta": {
"icon": "Menu",
"title": "富文本编辑器",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/assembly/draggable",
"name": "draggable",
"component": "/assembly/draggable/index",
"meta": {
"icon": "Menu",
"title": "拖拽组件",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/dashboard",
"name": "dashboard",
"redirect": "/dashboard/dataVisualize",
"meta": {
"icon": "Odometer",
"title": "Dashboard",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/dashboard/dataVisualize",
"name": "dataVisualize",
"component": "/dashboard/dataVisualize/index",
"meta": {
"icon": "Menu",
"title": "数据可视化",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/form",
"name": "form",
"redirect": "/form/proForm",
"meta": {
"icon": "Tickets",
"title": "表单 Form",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/form/proForm",
"name": "proForm",
"component": "/form/proForm/index",
"meta": {
"icon": "Menu",
"title": "超级 Form",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/form/basicForm",
"name": "basicForm",
"component": "/form/basicForm/index",
"meta": {
"icon": "Menu",
"title": "基础 Form",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/form/validateForm",
"name": "validateForm",
"component": "/form/validateForm/index",
"meta": {
"icon": "Menu",
"title": "校验 Form",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/form/dynamicForm",
"name": "dynamicForm",
"component": "/form/dynamicForm/index",
"meta": {
"icon": "Menu",
"title": "动态 Form",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/echarts",
"name": "echarts",
"redirect": "/echarts/waterChart",
"meta": {
"icon": "TrendCharts",
"title": "ECharts",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/echarts/waterChart",
"name": "waterChart",
"component": "/echarts/waterChart/index",
"meta": {
"icon": "Menu",
"title": "水型图",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/echarts/columnChart",
"name": "columnChart",
"component": "/echarts/columnChart/index",
"meta": {
"icon": "Menu",
"title": "柱状图",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/echarts/lineChart",
"name": "lineChart",
"component": "/echarts/lineChart/index",
"meta": {
"icon": "Menu",
"title": "折线图",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/echarts/pieChart",
"name": "pieChart",
"component": "/echarts/pieChart/index",
"meta": {
"icon": "Menu",
"title": "饼图",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/echarts/radarChart",
"name": "radarChart",
"component": "/echarts/radarChart/index",
"meta": {
"icon": "Menu",
"title": "雷达图",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/echarts/nestedChart",
"name": "nestedChart",
"component": "/echarts/nestedChart/index",
"meta": {
"icon": "Menu",
"title": "嵌套环形图",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/directives",
"name": "directives",
"redirect": "/directives/copyDirect",
"meta": {
"icon": "Stamp",
"title": "自定义指令",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/directives/copyDirect",
"name": "copyDirect",
"component": "/directives/copyDirect/index",
"meta": {
"icon": "Menu",
"title": "复制指令",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/directives/watermarkDirect",
"name": "watermarkDirect",
"component": "/directives/watermarkDirect/index",
"meta": {
"icon": "Menu",
"title": "水印指令",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/directives/dragDirect",
"name": "dragDirect",
"component": "/directives/dragDirect/index",
"meta": {
"icon": "Menu",
"title": "拖拽指令",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/directives/debounceDirect",
"name": "debounceDirect",
"component": "/directives/debounceDirect/index",
"meta": {
"icon": "Menu",
"title": "防抖指令",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/directives/throttleDirect",
"name": "throttleDirect",
"component": "/directives/throttleDirect/index",
"meta": {
"icon": "Menu",
"title": "节流指令",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/directives/longpressDirect",
"name": "longpressDirect",
"component": "/directives/longpressDirect/index",
"meta": {
"icon": "Menu",
"title": "长按指令",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/menu",
"name": "menu",
"redirect": "/menu/menu1",
"meta": {
"icon": "List",
"title": "菜单嵌套",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/menu/menu1",
"name": "menu1",
"component": "/menu/menu1/index",
"meta": {
"icon": "Menu",
"title": "菜单1",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/menu/menu2",
"name": "menu2",
"redirect": "/menu/menu2/menu21",
"meta": {
"icon": "Menu",
"title": "菜单2",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/menu/menu2/menu21",
"name": "menu21",
"component": "/menu/menu2/menu21/index",
"meta": {
"icon": "Menu",
"title": "菜单2-1",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/menu/menu2/menu22",
"name": "menu22",
"redirect": "/menu/menu2/menu22/menu221",
"meta": {
"icon": "Menu",
"title": "菜单2-2",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/menu/menu2/menu22/menu221",
"name": "menu221",
"component": "/menu/menu2/menu22/menu221/index",
"meta": {
"icon": "Menu",
"title": "菜单2-2-1",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/menu/menu2/menu22/menu222",
"name": "menu222",
"component": "/menu/menu2/menu22/menu222/index",
"meta": {
"icon": "Menu",
"title": "菜单2-2-2",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/menu/menu2/menu23",
"name": "menu23",
"component": "/menu/menu2/menu23/index",
"meta": {
"icon": "Menu",
"title": "菜单2-3",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/menu/menu3",
"name": "menu3",
"component": "/menu/menu3/index",
"meta": {
"icon": "Menu",
"title": "菜单3",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/system",
"name": "system",
"redirect": "/system/accountManage",
"meta": {
"icon": "Tools",
"title": "系统管理",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/system/accountManage",
"name": "accountManage",
"component": "/system/accountManage/index",
"meta": {
"icon": "Menu",
"title": "账号管理",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/system/roleManage",
"name": "roleManage",
"component": "/system/roleManage/index",
"meta": {
"icon": "Menu",
"title": "角色管理",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/system/menuMange",
"name": "menuMange",
"component": "/system/menuMange/index",
"meta": {
"icon": "Menu",
"title": "菜单管理",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/system/departmentManage",
"name": "departmentManage",
"component": "/system/departmentManage/index",
"meta": {
"icon": "Menu",
"title": "部门管理",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/system/dictManage",
"name": "dictManage",
"component": "/system/dictManage/index",
"meta": {
"icon": "Menu",
"title": "字典管理",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/system/timingTask",
"name": "timingTask",
"component": "/system/timingTask/index",
"meta": {
"icon": "Menu",
"title": "定时任务",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/system/systemLog",
"name": "systemLog",
"component": "/system/systemLog/index",
"meta": {
"icon": "Menu",
"title": "系统日志",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/link",
"name": "link",
"redirect": "/link/bing",
"meta": {
"icon": "Paperclip",
"title": "外部链接",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
},
"children": [
{
"path": "/link/bing",
"name": "bing",
"component": "/link/bing/index",
"meta": {
"icon": "Menu",
"title": "Bing 内嵌",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/link/gitee",
"name": "gitee",
"component": "/link/gitee/index",
"meta": {
"icon": "Menu",
"title": "Gitee 仓库",
"isLink": "https://gitee.com/HalseySpicy/Apper-Admin",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/link/github",
"name": "github",
"component": "/link/github/index",
"meta": {
"icon": "Menu",
"title": "GitHub 仓库",
"isLink": "https://github.com/HalseySpicy/Apper-Admin",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/link/docs",
"name": "docs",
"component": "/link/docs/index",
"meta": {
"icon": "Menu",
"title": "项目文档",
"isLink": "https://docs.spicyboy.cn",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
},
{
"path": "/link/juejin",
"name": "juejin",
"component": "/link/juejin/index",
"meta": {
"icon": "Menu",
"title": "掘金主页",
"isLink": "https://juejin.cn/user/3263814531551816/posts",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
]
},
{
"path": "/about/index",
"name": "about",
"component": "/about/index",
"meta": {
"icon": "InfoFilled",
"title": "关于项目",
"isLink": "",
"isHide": false,
"isFull": false,
"isAffix": false,
"isKeepAlive": true
}
}
],
"msg": "成功"
}
No preview for this file type
import * as echarts from "echarts/core";
import { BarChart, LineChart, LinesChart, PieChart, ScatterChart, RadarChart, GaugeChart } from "echarts/charts";
import {
TitleComponent,
TooltipComponent,
GridComponent,
DatasetComponent,
TransformComponent,
LegendComponent,
PolarComponent,
GeoComponent,
ToolboxComponent,
DataZoomComponent
} from "echarts/components";
import { LabelLayout, UniversalTransition } from "echarts/features";
import { CanvasRenderer } from "echarts/renderers";
import type {
BarSeriesOption,
LineSeriesOption,
LinesSeriesOption,
PieSeriesOption,
ScatterSeriesOption,
RadarSeriesOption,
GaugeSeriesOption
} from "echarts/charts";
import type {
TitleComponentOption,
TooltipComponentOption,
GridComponentOption,
DatasetComponentOption
} from "echarts/components";
import type { ComposeOption } from "echarts/core";
import "echarts-liquidfill";
export type ECOption = ComposeOption<
| BarSeriesOption
| LineSeriesOption
| LinesSeriesOption
| PieSeriesOption
| RadarSeriesOption
| GaugeSeriesOption
| TitleComponentOption
| TooltipComponentOption
| GridComponentOption
| DatasetComponentOption
| ScatterSeriesOption
>;
echarts.use([
TitleComponent,
TooltipComponent,
GridComponent,
DatasetComponent,
TransformComponent,
LegendComponent,
PolarComponent,
GeoComponent,
ToolboxComponent,
DataZoomComponent,
BarChart,
LineChart,
LinesChart,
PieChart,
ScatterChart,
RadarChart,
GaugeChart,
LabelLayout,
UniversalTransition,
CanvasRenderer
]);
export default echarts;
<template>
<div id="echarts" ref="chartRef" :style="echartsStyle" />
</template>
<script setup lang="ts" name="ECharts">
import { ref, onMounted, onBeforeUnmount, watch, computed, markRaw, nextTick, onActivated } from "vue";
import { EChartsType, ECElementEvent } from "echarts/core";
import echarts, { ECOption } from "./config";
import { useDebounceFn } from "@vueuse/core";
import { useGlobalStore } from "@/stores/modules/global";
import { storeToRefs } from "pinia";
interface Props {
option: ECOption;
renderer?: "canvas" | "svg";
resize?: boolean;
theme?: Object | string;
width?: number | string;
height?: number | string;
onClick?: (event: ECElementEvent) => any;
}
const props = withDefaults(defineProps<Props>(), {
renderer: "canvas",
resize: true
});
const echartsStyle = computed(() => {
return props.width || props.height
? { height: props.height + "px", width: props.width + "px" }
: { height: "100%", width: "100%" };
});
const chartRef = ref<HTMLDivElement | HTMLCanvasElement>();
const chartInstance = ref<EChartsType>();
const draw = () => {
if (chartInstance.value) {
chartInstance.value.setOption(props.option, { notMerge: true });
}
};
watch(props, () => {
draw();
});
const handleClick = (event: ECElementEvent) => props.onClick && props.onClick(event);
const init = () => {
if (!chartRef.value) return;
chartInstance.value = echarts.getInstanceByDom(chartRef.value);
if (!chartInstance.value) {
chartInstance.value = markRaw(
echarts.init(chartRef.value, props.theme, {
renderer: props.renderer
})
);
chartInstance.value.on("click", handleClick);
draw();
}
};
const resize = () => {
if (chartInstance.value && props.resize) {
chartInstance.value.resize({ animation: { duration: 300 } });
}
};
const debouncedResize = useDebounceFn(resize, 300, { maxWait: 800 });
const globalStore = useGlobalStore();
const { maximize, isCollapse, tabs, footer } = storeToRefs(globalStore);
watch(
() => [maximize, isCollapse, tabs, footer],
() => {
debouncedResize();
},
{ deep: true }
);
onMounted(() => {
nextTick(() => init());
window.addEventListener("resize", debouncedResize);
});
onActivated(() => {
if (chartInstance.value) {
chartInstance.value.resize();
}
});
onBeforeUnmount(() => {
chartInstance.value?.dispose();
window.removeEventListener("resize", debouncedResize);
});
defineExpose({
getInstance: () => chartInstance.value,
resize,
draw
});
</script>
<template>
<div class="not-container">
<img src="@/assets/images/403.png" class="not-img" alt="403" />
<div class="not-detail">
<h2>403</h2>
<h4>抱歉,您无权访问该页面~🙅‍♂️🙅‍♀️</h4>
<el-button type="primary" @click="router.back"> 返回上一页 </el-button>
</div>
</div>
</template>
<script setup lang="ts" name="403">
import { useRouter } from "vue-router";
const router = useRouter();
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
<template>
<div class="not-container">
<img src="@/assets/images/404.png" class="not-img" alt="404" />
<div class="not-detail">
<h2>404</h2>
<h4>抱歉,您访问的页面不存在~🤷‍♂️🤷‍♀️</h4>
<el-button type="primary" @click="router.back"> 返回上一页 </el-button>
</div>
</div>
</template>
<script setup lang="ts" name="404">
import { useRouter } from "vue-router";
const router = useRouter();
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
<template>
<div class="not-container">
<img src="@/assets/images/500.png" class="not-img" alt="500" />
<div class="not-detail">
<h2>500</h2>
<h4>抱歉,您的网络不见了~🤦‍♂️🤦‍♀️</h4>
<el-button type="primary" @click="router.back"> 返回上一页 </el-button>
</div>
</div>
</template>
<script setup lang="ts" name="500">
import { useRouter } from "vue-router";
const router = useRouter();
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
.not-container {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
.not-img {
margin-right: 120px;
}
.not-detail {
display: flex;
flex-direction: column;
h2,
h4 {
padding: 0;
margin: 0;
}
h2 {
font-size: 60px;
color: var(--el-text-color-primary);
}
h4 {
margin: 30px 0 20px;
font-size: 19px;
font-weight: normal;
color: var(--el-text-color-regular);
}
.el-button {
width: 100px;
}
}
}
<template>
<div v-show="isShow" :style="style">
<slot></slot>
</div>
</template>
<script setup lang="ts" name="GridItem">
import { computed, inject, Ref, ref, useAttrs, watch } from "vue";
import { BreakPoint, Responsive } from "../interface/index";
type Props = {
offset?: number;
span?: number;
suffix?: boolean;
xs?: Responsive;
sm?: Responsive;
md?: Responsive;
lg?: Responsive;
xl?: Responsive;
};
const props = withDefaults(defineProps<Props>(), {
offset: 0,
span: 1,
suffix: false,
xs: undefined,
sm: undefined,
md: undefined,
lg: undefined,
xl: undefined
});
const attrs = useAttrs() as { index: string };
const isShow = ref(true);
// 注入断点
const breakPoint = inject<Ref<BreakPoint>>("breakPoint", ref("xl"));
const shouldHiddenIndex = inject<Ref<number>>("shouldHiddenIndex", ref(-1));
watch(
() => [shouldHiddenIndex.value, breakPoint.value],
n => {
if (!!attrs.index) {
isShow.value = !(n[0] !== -1 && parseInt(attrs.index) >= Number(n[0]));
}
},
{ immediate: true }
);
const gap = inject("gap", 0);
const cols = inject("cols", ref(4));
const style = computed(() => {
let span = props[breakPoint.value]?.span ?? props.span;
let offset = props[breakPoint.value]?.offset ?? props.offset;
if (props.suffix) {
return {
gridColumnStart: cols.value - span - offset + 1,
gridColumnEnd: `span ${span + offset}`,
marginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : "unset"
};
} else {
return {
gridColumn: `span ${span + offset > cols.value ? cols.value : span + offset}/span ${
span + offset > cols.value ? cols.value : span + offset
}`,
marginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : "unset"
};
}
});
</script>
<template>
<div :style="style">
<slot></slot>
</div>
</template>
<script setup lang="ts" name="Grid">
import {
ref,
watch,
useSlots,
computed,
provide,
onBeforeMount,
onMounted,
onUnmounted,
onDeactivated,
onActivated,
VNodeArrayChildren,
VNode
} from "vue";
import type { BreakPoint } from "./interface/index";
type Props = {
cols?: number | Record<BreakPoint, number>;
collapsed?: boolean;
collapsedRows?: number;
gap?: [number, number] | number;
};
const props = withDefaults(defineProps<Props>(), {
cols: () => ({ xs: 1, sm: 2, md: 2, lg: 3, xl: 4 }),
collapsed: false,
collapsedRows: 1,
gap: 0
});
onBeforeMount(() => props.collapsed && findIndex());
onMounted(() => {
resize({ target: { innerWidth: window.innerWidth } } as unknown as UIEvent);
window.addEventListener("resize", resize);
});
onActivated(() => {
resize({ target: { innerWidth: window.innerWidth } } as unknown as UIEvent);
window.addEventListener("resize", resize);
});
onUnmounted(() => {
window.removeEventListener("resize", resize);
});
onDeactivated(() => {
window.removeEventListener("resize", resize);
});
// 监听屏幕变化
const resize = (e: UIEvent) => {
let width = (e.target as Window).innerWidth;
switch (!!width) {
case width < 768:
breakPoint.value = "xs";
break;
case width >= 768 && width < 992:
breakPoint.value = "sm";
break;
case width >= 992 && width < 1200:
breakPoint.value = "md";
break;
case width >= 1200 && width < 1920:
breakPoint.value = "lg";
break;
case width >= 1920:
breakPoint.value = "xl";
break;
}
};
// 注入 gap 间距
provide("gap", Array.isArray(props.gap) ? props.gap[0] : props.gap);
// 注入响应式断点
let breakPoint = ref<BreakPoint>("xl");
provide("breakPoint", breakPoint);
// 注入要开始折叠的 index
const hiddenIndex = ref(-1);
provide("shouldHiddenIndex", hiddenIndex);
// 注入 cols
const gridCols = computed(() => {
if (typeof props.cols === "object") return props.cols[breakPoint.value] ?? props.cols;
return props.cols;
});
provide("cols", gridCols);
// 寻找需要开始折叠的字段 index
const slots = useSlots().default!();
const findIndex = () => {
let fields: VNodeArrayChildren = [];
let suffix: VNode | null = null;
slots.forEach((slot: any) => {
// suffix
if (typeof slot.type === "object" && slot.type.name === "GridItem" && slot.props?.suffix !== undefined) suffix = slot;
// slot children
if (typeof slot.type === "symbol" && Array.isArray(slot.children)) fields.push(...slot.children);
});
// 计算 suffix 所占用的列
let suffixCols = 0;
if (suffix) {
suffixCols =
((suffix as VNode).props![breakPoint.value]?.span ?? (suffix as VNode).props?.span ?? 1) +
((suffix as VNode).props![breakPoint.value]?.offset ?? (suffix as VNode).props?.offset ?? 0);
}
try {
let find = false;
fields.reduce((prev = 0, current, index) => {
prev +=
((current as VNode)!.props![breakPoint.value]?.span ?? (current as VNode)!.props?.span ?? 1) +
((current as VNode)!.props![breakPoint.value]?.offset ?? (current as VNode)!.props?.offset ?? 0);
if (Number(prev) > props.collapsedRows * gridCols.value - suffixCols) {
hiddenIndex.value = index;
find = true;
throw "find it";
}
return prev;
}, 0);
if (!find) hiddenIndex.value = -1;
} catch (e) {
// console.warn(e);
}
};
// 断点变化时执行 findIndex
watch(
() => breakPoint.value,
() => {
if (props.collapsed) findIndex();
}
);
// 监听 collapsed
watch(
() => props.collapsed,
value => {
if (value) return findIndex();
hiddenIndex.value = -1;
}
);
// 设置间距
const gridGap = computed(() => {
if (typeof props.gap === "number") return `${props.gap}px`;
if (Array.isArray(props.gap)) return `${props.gap[1]}px ${props.gap[0]}px`;
return "unset";
});
// 设置 style
const style = computed(() => {
return {
display: "grid",
gridGap: gridGap.value,
gridTemplateColumns: `repeat(${gridCols.value}, minmax(0, 1fr))`
};
});
defineExpose({ breakPoint });
</script>
export type BreakPoint = "xs" | "sm" | "md" | "lg" | "xl";
export type Responsive = {
span?: number;
offset?: number;
};
<template>
<el-dialog v-model="dialogVisible" :title="`批量添加${parameter.title}`" :destroy-on-close="true" width="580px" draggable>
<el-form class="drawer-multiColumn-form" label-width="100px">
<el-form-item label="模板下载 :">
<el-button type="primary" :icon="Download" @click="downloadTemp"> 点击下载 </el-button>
</el-form-item>
<el-form-item label="文件上传 :">
<el-upload
action="#"
class="upload"
:drag="true"
:limit="excelLimit"
:multiple="true"
:show-file-list="true"
:http-request="uploadExcel"
:before-upload="beforeExcelUpload"
:on-exceed="handleExceed"
:on-success="excelUploadSuccess"
:on-error="excelUploadError"
:accept="parameter.fileType!.join(',')"
>
<slot name="empty">
<el-icon class="el-icon--upload">
<upload-filled />
</el-icon>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
</slot>
<template #tip>
<slot name="tip">
<div class="el-upload__tip">请上传 .xls , .xlsx 标准格式文件,文件最大为 {{ parameter.fileSize }}M</div>
</slot>
</template>
</el-upload>
</el-form-item>
<el-form-item label="数据覆盖 :">
<el-switch v-model="isCover" />
</el-form-item>
</el-form>
</el-dialog>
</template>
<script setup lang="ts" name="ImportExcel">
import { ref } from "vue";
import { useDownload } from "@/hooks/useDownload";
import { Download } from "@element-plus/icons-vue";
import { ElNotification, UploadRequestOptions, UploadRawFile } from "element-plus";
export interface ExcelParameterProps {
title: string; // 标题
fileSize?: number; // 上传文件的大小
fileType?: File.ExcelMimeType[]; // 上传文件的类型
tempApi?: (params: any) => Promise<any>; // 下载模板的Api
importApi?: (params: any) => Promise<any>; // 批量导入的Api
getTableList?: () => void; // 获取表格数据的Api
}
// 是否覆盖数据
const isCover = ref(false);
// 最大文件上传数
const excelLimit = ref(1);
// dialog状态
const dialogVisible = ref(false);
// 父组件传过来的参数
const parameter = ref<ExcelParameterProps>({
title: "",
fileSize: 5,
fileType: ["application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]
});
// 接收父组件参数
const acceptParams = (params: ExcelParameterProps) => {
parameter.value = { ...parameter.value, ...params };
dialogVisible.value = true;
};
// Excel 导入模板下载
const downloadTemp = () => {
if (!parameter.value.tempApi) return;
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`);
};
// 文件上传
const uploadExcel = async (param: UploadRequestOptions) => {
let excelFormData = new FormData();
excelFormData.append("file", param.file);
excelFormData.append("isCover", isCover.value as unknown as Blob);
await parameter.value.importApi!(excelFormData);
parameter.value.getTableList && parameter.value.getTableList();
dialogVisible.value = false;
};
/**
* @description 文件上传之前判断
* @param file 上传的文件
* */
const beforeExcelUpload = (file: UploadRawFile) => {
const isExcel = parameter.value.fileType!.includes(file.type as File.ExcelMimeType);
const fileSize = file.size / 1024 / 1024 < parameter.value.fileSize!;
if (!isExcel)
ElNotification({
title: "温馨提示",
message: "上传文件只能是 xls / xlsx 格式!",
type: "warning"
});
if (!fileSize)
setTimeout(() => {
ElNotification({
title: "温馨提示",
message: `上传文件大小不能超过 ${parameter.value.fileSize}MB!`,
type: "warning"
});
}, 0);
return isExcel && fileSize;
};
// 文件数超出提示
const handleExceed = () => {
ElNotification({
title: "温馨提示",
message: "最多只能上传一个文件!",
type: "warning"
});
};
// 上传错误提示
const excelUploadError = () => {
ElNotification({
title: "温馨提示",
message: `批量添加${parameter.value.title}失败,请您重新上传!`,
type: "error"
});
};
// 上传成功提示
const excelUploadSuccess = () => {
ElNotification({
title: "温馨提示",
message: `批量添加${parameter.value.title}成功!`,
type: "success"
});
};
defineExpose({
acceptParams
});
</script>
<style lang="scss" scoped>
@import "./index.scss";
</style>
import { ElLoading } from "element-plus";
/* 全局请求 loading */
let loadingInstance: ReturnType<typeof ElLoading.service>;
/**
* @description 开启 Loading
* */
const startLoading = () => {
loadingInstance = ElLoading.service({
fullscreen: true,
lock: true,
text: "Loading",
background: "rgba(0, 0, 0, 0.7)"
});
};
/**
* @description 结束 Loading
* */
const endLoading = () => {
loadingInstance.close();
};
/**
* @description 显示全屏加载
* */
let needLoadingRequestCount = 0;
export const showFullScreenLoading = () => {
if (needLoadingRequestCount === 0) {
startLoading();
}
needLoadingRequestCount++;
};
/**
* @description 隐藏全屏加载
* */
export const tryHideFullScreenLoading = () => {
if (needLoadingRequestCount <= 0) return;
needLoadingRequestCount--;
if (needLoadingRequestCount === 0) {
endLoading();
}
};
.loading-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
.loading-wrap {
display: flex;
align-items: center;
justify-content: center;
padding: 98px;
}
}
.dot {
position: relative;
box-sizing: border-box;
display: inline-block;
width: 32px;
height: 32px;
font-size: 32px;
transform: rotate(45deg);
animation: ant-rotate 1.2s infinite linear;
}
.dot i {
position: absolute;
display: block;
width: 14px;
height: 14px;
background-color: var(--el-color-primary);
border-radius: 100%;
opacity: 0.3;
transform: scale(0.75);
transform-origin: 50% 50%;
animation: ant-spin-move 1s infinite linear alternate;
}
.dot i:nth-child(1) {
top: 0;
left: 0;
}
.dot i:nth-child(2) {
top: 0;
right: 0;
animation-delay: 0.4s;
}
.dot i:nth-child(3) {
right: 0;
bottom: 0;
animation-delay: 0.8s;
}
.dot i:nth-child(4) {
bottom: 0;
left: 0;
animation-delay: 1.2s;
}
@keyframes ant-rotate {
to {
transform: rotate(405deg);
}
}
@keyframes ant-spin-move {
to {
opacity: 1;
}
}
<template>
<div class="loading-box">
<div class="loading-wrap">
<span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
</div>
</div>
</template>
<script setup lang="ts" name="Loading"></script>
<style scoped lang="scss">
@import "./index.scss";
</style>
<template>
<!-- 列设置 -->
<el-drawer v-model="drawerVisible" title="列设置" size="450px">
<div class="table-main">
<el-table :data="colSetting" :border="true" row-key="prop" default-expand-all :tree-props="{ children: '_children' }">
<el-table-column prop="label" align="center" label="列名" />
<el-table-column v-slot="scope" prop="isShow" align="center" label="显示">
<el-switch v-model="scope.row.isShow"></el-switch>
</el-table-column>
<el-table-column v-slot="scope" prop="sortable" align="center" label="排序">
<el-switch v-model="scope.row.sortable"></el-switch>
</el-table-column>
<template #empty>
<div class="table-empty">
<img src="@/assets/images/notData.png" alt="notData" />
<div>暂无可配置列</div>
</div>
</template>
</el-table>
</div>
</el-drawer>
</template>
<script setup lang="ts" name="ColSetting">
import { ref } from "vue";
import { ColumnProps } from "@/components/ProTable/interface";
defineProps<{ colSetting: ColumnProps[] }>();
const drawerVisible = ref<boolean>(false);
const openColSetting = () => {
drawerVisible.value = true;
};
defineExpose({
openColSetting
});
</script>
<style scoped lang="scss">
.cursor-move {
cursor: move;
}
</style>
<template>
<!-- 分页组件 -->
<el-pagination
:background="true"
:current-page="pageable.pageNum"
:page-size="pageable.pageSize"
:page-sizes="[10, 25, 50, 100]"
:total="pageable.total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
></el-pagination>
</template>
<script setup lang="ts" name="Pagination">
interface Pageable {
pageNum: number;
pageSize: number;
total: number;
}
interface PaginationProps {
pageable: Pageable;
handleSizeChange: (size: number) => void;
handleCurrentChange: (currentPage: number) => void;
}
defineProps<PaginationProps>();
</script>
<template>
<RenderTableColumn v-bind="column" />
</template>
<script setup lang="tsx" name="TableColumn">
import { inject, ref, useSlots } from "vue";
import { ColumnProps, RenderScope, HeaderRenderScope } from "@/components/ProTable/interface";
import { filterEnum, formatValue, handleProp, handleRowAccordingToProp } from "@/utils";
defineProps<{ column: ColumnProps }>();
const slots = useSlots();
const enumMap = inject("enumMap", ref(new Map()));
// 渲染表格数据
const renderCellData = (item: ColumnProps, scope: RenderScope<any>) => {
return enumMap.value.get(item.prop) && item.isFilterEnum
? filterEnum(handleRowAccordingToProp(scope.row, item.prop!), enumMap.value.get(item.prop)!, item.fieldNames)
: formatValue(handleRowAccordingToProp(scope.row, item.prop!));
};
// 获取 tag 类型
const getTagType = (item: ColumnProps, scope: RenderScope<any>) => {
return (
filterEnum(handleRowAccordingToProp(scope.row, item.prop!), enumMap.value.get(item.prop), item.fieldNames, "tag") || "primary"
);
};
const RenderTableColumn = (item: ColumnProps) => {
return (
<>
{item.isShow && (
<el-table-column
{...item}
align={item.align ?? "center"}
showOverflowTooltip={item.showOverflowTooltip ?? item.prop !== "operation"}
>
{{
default: (scope: RenderScope<any>) => {
if (item._children) return item._children.map(child => RenderTableColumn(child));
if (item.render) return item.render(scope);
if (item.prop && slots[handleProp(item.prop)]) return slots[handleProp(item.prop)]!(scope);
if (item.tag) return <el-tag type={getTagType(item, scope)}>{renderCellData(item, scope)}</el-tag>;
return renderCellData(item, scope);
},
header: (scope: HeaderRenderScope<any>) => {
if (item.headerRender) return item.headerRender(scope);
if (item.prop && slots[`${handleProp(item.prop)}Header`]) return slots[`${handleProp(item.prop)}Header`]!(scope);
return item.label;
}
}}
</el-table-column>
)}
</>
);
};
</script>
<!-- 📚📚📚 Pro-Table 文档: https://juejin.cn/post/7166068828202336263 -->
<template>
<!-- 查询表单 -->
<SearchForm
v-show="isShowSearch"
:search="_search"
:reset="_reset"
:columns="searchColumns"
:search-param="searchParam"
:search-col="searchCol"
/>
<!-- 表格主体 -->
<div class="card table-main">
<!-- 表格头部 操作按钮 -->
<div class="table-header">
<div class="header-button-lf">
<slot name="tableHeader" :selected-list="selectedList" :selected-list-ids="selectedListIds" :is-selected="isSelected" />
</div>
<div v-if="toolButton" class="header-button-ri">
<slot name="toolButton">
<el-button v-if="showToolButton('refresh')" :icon="Refresh" circle @click="getTableList" />
<el-button v-if="showToolButton('setting') && columns.length" :icon="Operation" circle @click="openColSetting" />
<el-button
v-if="showToolButton('search') && searchColumns?.length"
:icon="Search"
circle
@click="isShowSearch = !isShowSearch"
/>
</slot>
</div>
</div>
<!-- 表格主体 -->
<el-table
ref="tableRef"
v-bind="$attrs"
:id="uuid"
:data="processTableData"
:border="border"
:row-key="rowKey"
@selection-change="selectionChange"
>
<!-- 默认插槽 -->
<slot />
<template v-for="item in tableColumns" :key="item">
<!-- selection || radio || index || expand || sort -->
<el-table-column
v-if="item.type && columnTypes.includes(item.type)"
v-bind="item"
:align="item.align ?? 'center'"
:reserve-selection="item.type == 'selection'"
>
<template #default="scope">
<!-- expand -->
<template v-if="item.type == 'expand'">
<component :is="item.render" v-bind="scope" v-if="item.render" />
<slot v-else :name="item.type" v-bind="scope" />
</template>
<!-- radio -->
<el-radio v-if="item.type == 'radio'" v-model="radio" :label="scope.row[rowKey]">
<i></i>
</el-radio>
<!-- sort -->
<el-tag v-if="item.type == 'sort'" class="move">
<el-icon> <DCaret /></el-icon>
</el-tag>
</template>
</el-table-column>
<!-- other -->
<TableColumn v-else :column="item">
<template v-for="slot in Object.keys($slots)" #[slot]="scope">
<slot :name="slot" v-bind="scope" />
</template>
</TableColumn>
</template>
<!-- 插入表格最后一行之后的插槽 -->
<template #append>
<slot name="append" />
</template>
<!-- 无数据 -->
<template #empty>
<div class="table-empty">
<slot name="empty">
<img src="@/assets/images/notData.png" alt="notData" />
<div>暂无数据</div>
</slot>
</div>
</template>
</el-table>
<!-- 分页组件 -->
<slot name="pagination">
<Pagination
v-if="pagination"
:pageable="pageable"
:handle-size-change="handleSizeChange"
:handle-current-change="handleCurrentChange"
/>
</slot>
</div>
<!-- 列设置 -->
<ColSetting v-if="toolButton" ref="colRef" v-model:col-setting="colSetting" />
</template>
<script setup lang="ts" name="ProTable">
import { ref, watch, provide, onMounted, unref, computed, reactive } from "vue";
import { ElTable } from "element-plus";
import { useTable } from "@/hooks/useTable";
import { useSelection } from "@/hooks/useSelection";
import { BreakPoint } from "@/components/Grid/interface";
import { ColumnProps, TypeProps } from "@/components/ProTable/interface";
import { Refresh, Operation, Search } from "@element-plus/icons-vue";
import { generateUUID, handleProp } from "@/utils";
import SearchForm from "@/components/SearchForm/index.vue";
import Pagination from "./components/Pagination.vue";
import ColSetting from "./components/ColSetting.vue";
import TableColumn from "./components/TableColumn.vue";
import Sortable from "sortablejs";
export interface ProTableProps {
columns: ColumnProps[]; // 列配置项 ==> 必传
data?: any[]; // 静态 table data 数据,若存在则不会使用 requestApi 返回的 data ==> 非必传
requestApi?: (params: any) => Promise<any>; // 请求表格数据的 api ==> 非必传
requestAuto?: boolean; // 是否自动执行请求 api ==> 非必传(默认为true)
requestError?: (params: any) => void; // 表格 api 请求错误监听 ==> 非必传
dataCallback?: (data: any) => any; // 返回数据的回调函数,可以对数据进行处理 ==> 非必传
title?: string; // 表格标题 ==> 非必传
pagination?: boolean; // 是否需要分页组件 ==> 非必传(默认为true)
initParam?: any; // 初始化请求参数 ==> 非必传(默认为{})
border?: boolean; // 是否带有纵向边框 ==> 非必传(默认为true)
toolButton?: ("refresh" | "setting" | "search")[] | boolean; // 是否显示表格功能按钮 ==> 非必传(默认为true)
rowKey?: string; // 行数据的 Key,用来优化 Table 的渲染,当表格数据多选时,所指定的 id ==> 非必传(默认为 id)
searchCol?: number | Record<BreakPoint, number>; // 表格搜索项 每列占比配置 ==> 非必传 { xs: 1, sm: 2, md: 2, lg: 3, xl: 4 }
}
// 接受父组件参数,配置默认值
const props = withDefaults(defineProps<ProTableProps>(), {
columns: () => [],
requestAuto: true,
pagination: true,
initParam: {},
border: true,
toolButton: true,
rowKey: "id",
searchCol: () => ({ xs: 1, sm: 2, md: 2, lg: 3, xl: 4 })
});
// table 实例
const tableRef = ref<InstanceType<typeof ElTable>>();
// 生成组件唯一id
const uuid = ref("id-" + generateUUID());
// column 列类型
const columnTypes: TypeProps[] = ["selection", "radio", "index", "expand", "sort"];
// 是否显示搜索模块
const isShowSearch = ref(true);
// 控制 ToolButton 显示
const showToolButton = (key: "refresh" | "setting" | "search") => {
return Array.isArray(props.toolButton) ? props.toolButton.includes(key) : props.toolButton;
};
// 单选值
const radio = ref("");
// 表格多选 Hooks
const { selectionChange, selectedList, selectedListIds, isSelected } = useSelection(props.rowKey);
// 表格操作 Hooks
const { tableData, pageable, searchParam, searchInitParam, getTableList, search, reset, handleSizeChange, handleCurrentChange } =
useTable(props.requestApi, props.initParam, props.pagination, props.dataCallback, props.requestError);
// 清空选中数据列表
const clearSelection = () => tableRef.value!.clearSelection();
// 初始化表格数据 && 拖拽排序
onMounted(() => {
dragSort();
props.requestAuto && getTableList();
props.data && (pageable.value.total = props.data.length);
});
// 处理表格数据
const processTableData = computed(() => {
if (!props.data) return tableData.value;
if (!props.pagination) return props.data;
return props.data.slice(
(pageable.value.pageNum - 1) * pageable.value.pageSize,
pageable.value.pageSize * pageable.value.pageNum
);
});
// 监听页面 initParam 改化,重新获取表格数据
watch(() => props.initParam, getTableList, { deep: true });
// 接收 columns 并设置为响应式
const tableColumns = reactive<ColumnProps[]>(props.columns);
// 扁平化 columns
const flatColumns = computed(() => flatColumnsFunc(tableColumns));
// 定义 enumMap 存储 enum 值(避免异步请求无法格式化单元格内容 || 无法填充搜索下拉选择)
const enumMap = ref(new Map<string, { [key: string]: any }[]>());
const setEnumMap = async ({ prop, enum: enumValue }: ColumnProps) => {
if (!enumValue) return;
// 如果当前 enumMap 存在相同的值 return
if (enumMap.value.has(prop!) && (typeof enumValue === "function" || enumMap.value.get(prop!) === enumValue)) return;
// 当前 enum 为静态数据,则直接存储到 enumMap
if (typeof enumValue !== "function") return enumMap.value.set(prop!, unref(enumValue!));
// 为了防止接口执行慢,而存储慢,导致重复请求,所以预先存储为[],接口返回后再二次存储
enumMap.value.set(prop!, []);
// 当前 enum 为后台数据需要请求数据,则调用该请求接口,并存储到 enumMap
const { data } = await enumValue();
enumMap.value.set(prop!, data);
};
// 注入 enumMap
provide("enumMap", enumMap);
// 扁平化 columns 的方法
const flatColumnsFunc = (columns: ColumnProps[], flatArr: ColumnProps[] = []) => {
columns.forEach(async col => {
if (col._children?.length) flatArr.push(...flatColumnsFunc(col._children));
flatArr.push(col);
// column 添加默认 isShow && isSetting && isFilterEnum 属性值
col.isShow = col.isShow ?? true;
col.isSetting = col.isSetting ?? true;
col.isFilterEnum = col.isFilterEnum ?? true;
// 设置 enumMap
await setEnumMap(col);
});
return flatArr.filter(item => !item._children?.length);
};
// 过滤需要搜索的配置项 && 排序
const searchColumns = computed(() => {
return flatColumns.value
?.filter(item => item.search?.el || item.search?.render)
.sort((a, b) => a.search!.order! - b.search!.order!);
});
// 设置 搜索表单默认排序 && 搜索表单项的默认值
searchColumns.value?.forEach((column, index) => {
column.search!.order = column.search?.order ?? index + 2;
const key = column.search?.key ?? handleProp(column.prop!);
const defaultValue = column.search?.defaultValue;
if (defaultValue !== undefined && defaultValue !== null) {
searchParam.value[key] = defaultValue;
searchInitParam.value[key] = defaultValue;
}
});
// 列设置 ==> 需要过滤掉不需要设置的列
const colRef = ref();
const colSetting = tableColumns!.filter(item => {
const { type, prop, isSetting } = item;
return !columnTypes.includes(type!) && prop !== "operation" && isSetting;
});
const openColSetting = () => colRef.value.openColSetting();
// 定义 emit 事件
const emit = defineEmits<{
search: [];
reset: [];
dragSort: [{ newIndex?: number; oldIndex?: number }];
}>();
const _search = () => {
search();
emit("search");
};
const _reset = () => {
reset();
emit("reset");
};
// 表格拖拽排序
const dragSort = () => {
const tbody = document.querySelector(`#${uuid.value} tbody`) as HTMLElement;
Sortable.create(tbody, {
handle: ".move",
animation: 300,
onEnd({ newIndex, oldIndex }) {
const [removedItem] = processTableData.value.splice(oldIndex!, 1);
processTableData.value.splice(newIndex!, 0, removedItem);
emit("dragSort", { newIndex, oldIndex });
}
});
};
// 暴露给父组件的参数和方法 (外部需要什么,都可以从这里暴露出去)
defineExpose({
element: tableRef,
tableData: processTableData,
radio,
pageable,
searchParam,
searchInitParam,
isSelected,
selectedList,
selectedListIds,
// 下面为 function
getTableList,
search,
reset,
handleSizeChange,
handleCurrentChange,
clearSelection,
enumMap
});
</script>
import { VNode, ComponentPublicInstance, Ref } from "vue";
import { BreakPoint, Responsive } from "@/components/Grid/interface";
import { TableColumnCtx } from "element-plus/es/components/table/src/table-column/defaults";
import { ProTableProps } from "@/components/ProTable/index.vue";
import ProTable from "@/components/ProTable/index.vue";
export interface EnumProps {
label?: string; // 选项框显示的文字
value?: string | number | boolean | any[]; // 选项框值
disabled?: boolean; // 是否禁用此选项
tagType?: string; // 当 tag 为 true 时,此选择会指定 tag 显示类型
children?: EnumProps[]; // 为树形选择时,可以通过 children 属性指定子选项
[key: string]: any;
}
export type TypeProps = "index" | "selection" | "radio" | "expand" | "sort";
export type SearchType =
| "input"
| "input-number"
| "select"
| "select-v2"
| "tree-select"
| "cascader"
| "date-picker"
| "time-picker"
| "time-select"
| "switch"
| "slider";
export type SearchRenderScope = {
searchParam: { [key: string]: any };
placeholder: string;
clearable: boolean;
options: EnumProps[];
data: EnumProps[];
};
export type SearchProps = {
el?: SearchType; // 当前项搜索框的类型
label?: string; // 当前项搜索框的 label
props?: any; // 搜索项参数,根据 element plus 官方文档来传递,该属性所有值会透传到组件
key?: string; // 当搜索项 key 不为 prop 属性时,可通过 key 指定
tooltip?: string; // 搜索提示
order?: number; // 搜索项排序(从大到小)
span?: number; // 搜索项所占用的列数,默认为 1 列
offset?: number; // 搜索字段左侧偏移列数
defaultValue?: string | number | boolean | any[] | Ref<any>; // 搜索项默认值
render?: (scope: SearchRenderScope) => VNode; // 自定义搜索内容渲染(tsx语法)
} & Partial<Record<BreakPoint, Responsive>>;
export type FieldNamesProps = {
label: string;
value: string;
children?: string;
};
export type RenderScope<T> = {
row: T;
$index: number;
column: TableColumnCtx<T>;
[key: string]: any;
};
export type HeaderRenderScope<T> = {
$index: number;
column: TableColumnCtx<T>;
[key: string]: any;
};
export interface ColumnProps<T = any>
extends Partial<Omit<TableColumnCtx<T>, "type" | "children" | "renderCell" | "renderHeader">> {
type?: TypeProps; // 列类型
tag?: boolean | Ref<boolean>; // 是否是标签展示
isShow?: boolean | Ref<boolean>; // 是否显示在表格当中
isSetting?: boolean | Ref<boolean>; // 是否在 ColSetting 中可配置
search?: SearchProps | undefined; // 搜索项配置
enum?: EnumProps[] | Ref<EnumProps[]> | ((params?: any) => Promise<any>); // 枚举字典
isFilterEnum?: boolean | Ref<boolean>; // 当前单元格值是否根据 enum 格式化(示例:enum 只作为搜索项数据)
fieldNames?: FieldNamesProps; // 指定 label && value && children 的 key 值
headerRender?: (scope: HeaderRenderScope<T>) => VNode; // 自定义表头内容渲染(tsx语法)
render?: (scope: RenderScope<T>) => VNode | string; // 自定义单元格内容渲染(tsx语法)
_children?: ColumnProps<T>[]; // 多级表头
}
export type ProTableInstance = Omit<InstanceType<typeof ProTable>, keyof ComponentPublicInstance | keyof ProTableProps>;
<template>
<component
:is="column.search?.render ?? `el-${column.search?.el}`"
v-bind="{ ...handleSearchProps, ...placeholder, searchParam: _searchParam, clearable }"
v-model.trim="_searchParam[column.search?.key ?? handleProp(column.prop!)]"
:data="column.search?.el === 'tree-select' ? columnEnum : []"
:options="['cascader', 'select-v2'].includes(column.search?.el!) ? columnEnum : []"
>
<template v-if="column.search?.el === 'cascader'" #default="{ data }">
<span>{{ data[fieldNames.label] }}</span>
</template>
<template v-if="column.search?.el === 'select'">
<component
:is="`el-option`"
v-for="(col, index) in columnEnum"
:key="index"
:label="col[fieldNames.label]"
:value="col[fieldNames.value]"
></component>
</template>
<slot v-else></slot>
</component>
</template>
<script setup lang="ts" name="SearchFormItem">
import { computed, inject, ref } from "vue";
import { handleProp } from "@/utils";
import { ColumnProps } from "@/components/ProTable/interface";
interface SearchFormItem {
column: ColumnProps;
searchParam: { [key: string]: any };
}
const props = defineProps<SearchFormItem>();
// Re receive SearchParam
const _searchParam = computed(() => props.searchParam);
// 判断 fieldNames 设置 label && value && children 的 key 值
const fieldNames = computed(() => {
return {
label: props.column.fieldNames?.label ?? "label",
value: props.column.fieldNames?.value ?? "value",
children: props.column.fieldNames?.children ?? "children"
};
});
// 接收 enumMap (el 为 select-v2 需单独处理 enumData)
const enumMap = inject("enumMap", ref(new Map()));
const columnEnum = computed(() => {
let enumData = enumMap.value.get(props.column.prop);
if (!enumData) return [];
if (props.column.search?.el === "select-v2" && props.column.fieldNames) {
enumData = enumData.map((item: { [key: string]: any }) => {
return { ...item, label: item[fieldNames.value.label], value: item[fieldNames.value.value] };
});
}
return enumData;
});
// 处理透传的 searchProps (el 为 tree-select、cascader 的时候需要给下默认 label && value && children)
const handleSearchProps = computed(() => {
const label = fieldNames.value.label;
const value = fieldNames.value.value;
const children = fieldNames.value.children;
const searchEl = props.column.search?.el;
let searchProps = props.column.search?.props ?? {};
if (searchEl === "tree-select") {
searchProps = { ...searchProps, props: { ...searchProps, label, children }, nodeKey: value };
}
if (searchEl === "cascader") {
searchProps = { ...searchProps, props: { ...searchProps, label, value, children } };
}
return searchProps;
});
// 处理默认 placeholder
const placeholder = computed(() => {
const search = props.column.search;
if (["datetimerange", "daterange", "monthrange"].includes(search?.props?.type) || search?.props?.isRange) {
return {
rangeSeparator: search?.props?.rangeSeparator ?? "至",
startPlaceholder: search?.props?.startPlaceholder ?? "开始时间",
endPlaceholder: search?.props?.endPlaceholder ?? "结束时间"
};
}
const placeholder = search?.props?.placeholder ?? (search?.el?.includes("input") ? "请输入" : "请选择");
return { placeholder };
});
// 是否有清除按钮 (当搜索项有默认值时,清除按钮不显示)
const clearable = computed(() => {
const search = props.column.search;
return search?.props?.clearable ?? (search?.defaultValue == null || search?.defaultValue == undefined);
});
</script>
<template>
<div v-if="columns.length" class="card table-search">
<el-form ref="formRef" :model="searchParam">
<Grid ref="gridRef" :collapsed="collapsed" :gap="[20, 0]" :cols="searchCol">
<GridItem v-for="(item, index) in columns" :key="item.prop" v-bind="getResponsive(item)" :index="index">
<el-form-item>
<template #label>
<el-space :size="4">
<span>{{ `${item.search?.label ?? item.label}` }}</span>
<el-tooltip v-if="item.search?.tooltip" effect="dark" :content="item.search?.tooltip" placement="top">
<i :class="'iconfont icon-yiwen'"></i>
</el-tooltip>
</el-space>
<span>&nbsp;:</span>
</template>
<SearchFormItem :column="item" :search-param="searchParam" />
</el-form-item>
</GridItem>
<GridItem suffix>
<div class="operation">
<el-button type="primary" :icon="Search" @click="search"> 搜索 </el-button>
<el-button :icon="Delete" @click="reset"> 重置 </el-button>
<el-button v-if="showCollapse" type="primary" link class="search-isOpen" @click="collapsed = !collapsed">
{{ collapsed ? "展开" : "合并" }}
<el-icon class="el-icon--right">
<component :is="collapsed ? ArrowDown : ArrowUp"></component>
</el-icon>
</el-button>
</div>
</GridItem>
</Grid>
</el-form>
</div>
</template>
<script setup lang="ts" name="SearchForm">
import { computed, ref } from "vue";
import { ColumnProps } from "@/components/ProTable/interface";
import { BreakPoint } from "@/components/Grid/interface";
import { Delete, Search, ArrowDown, ArrowUp } from "@element-plus/icons-vue";
import SearchFormItem from "./components/SearchFormItem.vue";
import Grid from "@/components/Grid/index.vue";
import GridItem from "@/components/Grid/components/GridItem.vue";
interface ProTableProps {
columns?: ColumnProps[]; // 搜索配置列
searchParam?: { [key: string]: any }; // 搜索参数
searchCol: number | Record<BreakPoint, number>;
search: (params: any) => void; // 搜索方法
reset: (params: any) => void; // 重置方法
}
// 默认值
const props = withDefaults(defineProps<ProTableProps>(), {
columns: () => [],
searchParam: () => ({})
});
// 获取响应式设置
const getResponsive = (item: ColumnProps) => {
return {
span: item.search?.span,
offset: item.search?.offset ?? 0,
xs: item.search?.xs,
sm: item.search?.sm,
md: item.search?.md,
lg: item.search?.lg,
xl: item.search?.xl
};
};
// 是否默认折叠搜索项
const collapsed = ref(true);
// 获取响应式断点
const gridRef = ref();
const breakPoint = computed<BreakPoint>(() => gridRef.value?.breakPoint);
// 判断是否显示 展开/合并 按钮
const showCollapse = computed(() => {
let show = false;
props.columns.reduce((prev, current) => {
prev +=
(current.search![breakPoint.value]?.span ?? current.search?.span ?? 1) +
(current.search![breakPoint.value]?.offset ?? current.search?.offset ?? 0);
if (typeof props.searchCol !== "number") {
if (prev >= props.searchCol[breakPoint.value]) show = true;
} else {
if (prev >= props.searchCol) show = true;
}
return prev;
}, 0);
return show;
});
</script>
.select-filter {
width: 100%;
.select-filter-item {
display: flex;
align-items: center;
border-bottom: 1px dashed var(--el-border-color-light);
&:last-child {
border-bottom: none;
}
.select-filter-item-title {
margin-top: -2px;
span {
font-size: 14px;
color: var(--el-text-color-regular);
white-space: nowrap;
}
}
.select-filter-notData {
margin: 18px 0;
font-size: 14px;
color: var(--el-text-color-regular);
}
.select-filter-list {
display: flex;
flex: 1;
padding: 0;
margin: 13px 0;
li {
display: flex;
align-items: center;
padding: 5px 15px;
margin-right: 16px;
font-size: 13px;
color: var(--el-color-primary);
list-style: none;
cursor: pointer;
background: var(--el-color-primary-light-9);
border: 1px solid var(--el-color-primary-light-5);
border-radius: 32px;
&:hover {
color: #ffffff;
background: var(--el-color-primary);
border-color: var(--el-color-primary);
transition: 0.1s;
}
&.active {
font-weight: bold;
color: #ffffff;
background: var(--el-color-primary);
border-color: var(--el-color-primary);
}
.el-icon {
margin-right: 4px;
font-size: 16px;
font-weight: bold;
}
span {
white-space: nowrap;
}
}
}
}
}
<template>
<div class="select-filter">
<div v-for="item in data" :key="item.key" class="select-filter-item">
<div class="select-filter-item-title">
<span>{{ item.title }} :</span>
</div>
<span v-if="!item.options.length" class="select-filter-notData">暂无数据 ~</span>
<el-scrollbar>
<ul class="select-filter-list">
<li
v-for="option in item.options"
:key="option.value"
:class="{
active:
option.value === selected[item.key] ||
(Array.isArray(selected[item.key]) && selected[item.key].includes(option.value))
}"
@click="select(item, option)"
>
<slot :row="option">
<el-icon v-if="option.icon">
<component :is="option.icon" />
</el-icon>
<span>{{ option.label }}</span>
</slot>
</li>
</ul>
</el-scrollbar>
</div>
</div>
</template>
<script setup lang="ts" name="selectFilter">
import { ref, watch } from "vue";
interface OptionsProps {
value: string | number;
label: string;
icon?: string;
}
interface SelectDataProps {
title: string; // 列表标题
key: string; // 当前筛选项 key 值
multiple?: boolean; // 是否为多选
options: OptionsProps[]; // 筛选数据
}
interface SelectFilterProps {
data?: SelectDataProps[]; // 选择的列表数据
defaultValues?: { [key: string]: any }; // 默认值
}
const props = withDefaults(defineProps<SelectFilterProps>(), {
data: () => [],
defaultValues: () => ({})
});
// 重新接收默认值
const selected = ref<{ [key: string]: any }>({});
watch(
() => props.defaultValues,
() => {
props.data.forEach(item => {
if (item.multiple) selected.value[item.key] = props.defaultValues[item.key] ?? [""];
else selected.value[item.key] = props.defaultValues[item.key] ?? "";
});
},
{ deep: true, immediate: true }
);
// emit
const emit = defineEmits<{
change: [value: any];
}>();
/**
* @description 选择筛选项
* @param {Object} item 选中的哪项列表
* @param {Object} option 选中的值
* @return void
* */
const select = (item: SelectDataProps, option: OptionsProps) => {
if (!item.multiple) {
// * 单选
if (selected.value[item.key] !== option.value) selected.value[item.key] = option.value;
} else {
// * 多选
// 如果选中的是第一个值,则直接设置
if (item.options[0].value === option.value) selected.value[item.key] = [option.value];
// 如果选择的值已经选中了,则删除选中的值
if (selected.value[item.key].includes(option.value)) {
let currentIndex = selected.value[item.key].findIndex((s: any) => s === option.value);
selected.value[item.key].splice(currentIndex, 1);
// 当全部删光时,把第第一个值选中
if (selected.value[item.key].length == 0) selected.value[item.key] = [item.options[0].value];
} else {
// 未选中点击值的时候,追加选中值
selected.value[item.key].push(option.value);
// 单选中全部并且点击到了未选中的值,把第一个值删除掉
if (selected.value[item.key].includes(item.options[0].value)) selected.value[item.key].splice(0, 1);
}
}
emit("change", selected.value);
};
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
.icon-box {
width: 100%;
.el-button {
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
color: var(--el-text-color-regular);
}
:deep(.el-dialog__body) {
padding: 25px 20px 20px;
.el-input {
margin-bottom: 10px;
}
.icon-list {
display: grid;
grid-template-columns: repeat(auto-fill, 115px);
justify-content: space-evenly;
max-height: 70vh;
.icon-item {
display: flex;
flex-direction: column;
align-items: center;
width: 42px;
padding: 20px 30px;
cursor: pointer;
transition: all 0.2s;
&:hover {
transform: scale(1.3);
}
span {
margin-top: 5px;
line-height: 20px;
text-align: center;
}
}
}
}
}
<template>
<div class="icon-box">
<el-input
ref="inputRef"
v-model="valueIcon"
v-bind="$attrs"
:placeholder="placeholder"
:clearable="clearable"
@clear="clearIcon"
@click="openDialog"
>
<template #append>
<el-button :icon="customIcons[iconValue]" />
</template>
</el-input>
<el-dialog v-model="dialogVisible" :title="placeholder" top="50px" width="66%">
<el-input v-model="inputValue" placeholder="搜索图标" size="large" :prefix-icon="Icons.Search" />
<el-scrollbar v-if="Object.keys(iconsList).length">
<div class="icon-list">
<div v-for="item in iconsList" :key="item" class="icon-item" @click="selectIcon(item)">
<component :is="item"></component>
<span>{{ item.name }}</span>
</div>
</div>
</el-scrollbar>
<el-empty v-else description="未搜索到您要找的图标~" />
</el-dialog>
</div>
</template>
<script setup lang="ts" name="SelectIcon">
import { ref, computed } from "vue";
import * as Icons from "@element-plus/icons-vue";
interface SelectIconProps {
iconValue: string;
title?: string;
clearable?: boolean;
placeholder?: string;
}
const props = withDefaults(defineProps<SelectIconProps>(), {
iconValue: "",
title: "请选择图标",
clearable: true,
placeholder: "请选择图标"
});
// 重新接收一下,防止打包后 clearable 报错
const valueIcon = ref(props.iconValue);
// open Dialog
const dialogVisible = ref(false);
const openDialog = () => (dialogVisible.value = true);
// 选择图标(触发更新父组件数据)
const emit = defineEmits<{
"update:iconValue": [value: string];
}>();
const selectIcon = (item: any) => {
dialogVisible.value = false;
valueIcon.value = item.name;
emit("update:iconValue", item.name);
setTimeout(() => inputRef.value.blur(), 0);
};
// 清空图标
const inputRef = ref();
const clearIcon = () => {
valueIcon.value = "";
emit("update:iconValue", "");
setTimeout(() => inputRef.value.blur(), 0);
};
// 监听搜索框值
const inputValue = ref("");
const customIcons: { [key: string]: any } = Icons;
const iconsList = computed((): { [key: string]: any } => {
if (!inputValue.value) return Icons;
let result: { [key: string]: any } = {};
for (const key in customIcons) {
if (key.toLowerCase().indexOf(inputValue.value.toLowerCase()) > -1) result[key] = customIcons[key];
}
return result;
});
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
<template>
<svg :style="iconStyle" aria-hidden="true">
<use :xlink:href="symbolId" />
</svg>
</template>
<script setup lang="ts" name="SvgIcon">
import { computed, CSSProperties } from "vue";
interface SvgProps {
name: string; // 图标的名称 ==> 必传
prefix?: string; // 图标的前缀 ==> 非必传(默认为"icon")
iconStyle?: CSSProperties; // 图标的样式 ==> 非必传
}
const props = withDefaults(defineProps<SvgProps>(), {
prefix: "icon",
iconStyle: () => ({ width: "100px", height: "100px" })
});
const symbolId = computed(() => `#${props.prefix}-${props.name}`);
</script>
<template>
<el-switch v-model="globalStore.isDark" inline-prompt :active-icon="Sunny" :inactive-icon="Moon" @change="switchDark" />
</template>
<script setup lang="ts" name="SwitchDark">
import { useTheme } from "@/hooks/useTheme";
import { useGlobalStore } from "@/stores/modules/global";
import { Sunny, Moon } from "@element-plus/icons-vue";
const { switchDark } = useTheme();
const globalStore = useGlobalStore();
</script>
.filter {
box-sizing: border-box;
width: 220px;
height: 100%;
padding: 18px;
margin-right: 10px;
.title {
margin: 0 0 15px;
font-size: 18px;
font-weight: bold;
color: var(--el-color-info-dark-2);
letter-spacing: 0.5px;
}
.search {
display: flex;
align-items: center;
margin: 0 0 15px;
.el-icon {
cursor: pointer;
transform: rotate(90deg) translateY(-8px);
}
}
.el-scrollbar {
:deep(.el-tree) {
height: 80%;
overflow: auto;
.el-tree-node__content {
height: 33px;
}
}
:deep(.el-tree--highlight-current) {
.el-tree-node.is-current > .el-tree-node__content {
background-color: var(--el-color-primary);
.el-tree-node__label,
.el-tree-node__expand-icon {
color: white;
}
.is-leaf {
color: transparent;
}
}
}
}
}
<template>
<div class="card filter">
<h4 v-if="title" class="title sle">
{{ title }}
</h4>
<div class="search">
<el-input v-model="filterText" placeholder="输入关键字进行过滤" clearable />
<el-dropdown trigger="click">
<el-icon size="20"><More /></el-icon>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="toggleTreeNodes(true)">展开全部</el-dropdown-item>
<el-dropdown-item @click="toggleTreeNodes(false)">折叠全部</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
<el-scrollbar :style="{ height: title ? `calc(100% - 95px)` : `calc(100% - 56px)` }">
<el-tree
ref="treeRef"
default-expand-all
:node-key="id"
:data="multiple ? treeData : treeAllData"
:show-checkbox="multiple"
:check-strictly="false"
:current-node-key="!multiple ? selected : ''"
:highlight-current="!multiple"
:expand-on-click-node="false"
:check-on-click-node="multiple"
:props="defaultProps"
:filter-node-method="filterNode"
:default-checked-keys="multiple ? selected : []"
@node-click="handleNodeClick"
@check="handleCheckChange"
>
<template #default="scope">
<span class="el-tree-node__label">
<slot :row="scope">
{{ scope.node.label }}
</slot>
</span>
</template>
</el-tree>
</el-scrollbar>
</div>
</template>
<script setup lang="ts" name="TreeFilter">
import { ref, watch, onBeforeMount, nextTick } from "vue";
import { ElTree } from "element-plus";
// 接收父组件参数并设置默认值
interface TreeFilterProps {
requestApi?: (data?: any) => Promise<any>; // 请求分类数据的 api ==> 非必传
data?: { [key: string]: any }[]; // 分类数据,如果有分类数据,则不会执行 api 请求 ==> 非必传
title?: string; // treeFilter 标题 ==> 非必传
id?: string; // 选择的id ==> 非必传,默认为 “id”
label?: string; // 显示的label ==> 非必传,默认为 “label”
multiple?: boolean; // 是否为多选 ==> 非必传,默认为 false
defaultValue?: any; // 默认选中的值 ==> 非必传
}
const props = withDefaults(defineProps<TreeFilterProps>(), {
id: "id",
label: "label",
multiple: false
});
const defaultProps = {
children: "children",
label: props.label
};
const treeRef = ref<InstanceType<typeof ElTree>>();
const treeData = ref<{ [key: string]: any }[]>([]);
const treeAllData = ref<{ [key: string]: any }[]>([]);
const selected = ref();
const setSelected = () => {
if (props.multiple) selected.value = Array.isArray(props.defaultValue) ? props.defaultValue : [props.defaultValue];
else selected.value = typeof props.defaultValue === "string" ? props.defaultValue : "";
};
onBeforeMount(async () => {
setSelected();
if (props.requestApi) {
const { data } = await props.requestApi!();
treeData.value = data;
treeAllData.value = [{ id: "", [props.label]: "全部" }, ...data];
}
});
// 使用 nextTick 防止打包后赋值不生效,开发环境是正常的
watch(
() => props.defaultValue,
() => nextTick(() => setSelected()),
{ deep: true, immediate: true }
);
watch(
() => props.data,
() => {
if (props.data?.length) {
treeData.value = props.data;
treeAllData.value = [{ id: "", [props.label]: "全部" }, ...props.data];
}
},
{ deep: true, immediate: true }
);
const filterText = ref("");
watch(filterText, val => {
treeRef.value!.filter(val);
});
// 过滤
const filterNode = (value: string, data: { [key: string]: any }, node: any) => {
if (!value) return true;
let parentNode = node.parent,
labels = [node.label],
level = 1;
while (level < node.level) {
labels = [...labels, parentNode.label];
parentNode = parentNode.parent;
level++;
}
return labels.some(label => label.indexOf(value) !== -1);
};
// 切换树节点的展开或折叠状态
const toggleTreeNodes = (isExpand: boolean) => {
let nodes = treeRef.value?.store.nodesMap;
if (!nodes) return;
for (const node in nodes) {
if (nodes.hasOwnProperty(node)) {
nodes[node].expanded = isExpand;
}
}
};
// emit
const emit = defineEmits<{
change: [value: any];
}>();
// 单选
const handleNodeClick = (data: { [key: string]: any }) => {
if (props.multiple) return;
emit("change", data[props.id]);
};
// 多选
const handleCheckChange = () => {
emit("change", treeRef.value?.getCheckedKeys());
};
// 暴露给父组件使用
defineExpose({ treeData, treeAllData, treeRef });
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
<template>
<div class="upload-box">
<el-upload
:id="uuid"
action="#"
:class="['upload', self_disabled ? 'disabled' : '', drag ? 'no-border' : '']"
:multiple="false"
:disabled="self_disabled"
:show-file-list="false"
:http-request="handleHttpUpload"
:before-upload="beforeUpload"
:on-success="uploadSuccess"
:on-error="uploadError"
:drag="drag"
:accept="fileType.join(',')"
>
<template v-if="imageUrl">
<img :src="imageUrl" class="upload-image" />
<div class="upload-handle" @click.stop>
<div v-if="!self_disabled" class="handle-icon" @click="editImg">
<el-icon><Edit /></el-icon>
<span>编辑</span>
</div>
<div class="handle-icon" @click="imgViewVisible = true">
<el-icon><ZoomIn /></el-icon>
<span>查看</span>
</div>
<div v-if="!self_disabled" class="handle-icon" @click="deleteImg">
<el-icon><Delete /></el-icon>
<span>删除</span>
</div>
</div>
</template>
<template v-else>
<div class="upload-empty">
<slot name="empty">
<el-icon><Plus /></el-icon>
<!-- <span>请上传图片</span> -->
</slot>
</div>
</template>
</el-upload>
<div class="el-upload__tip">
<slot name="tip"></slot>
</div>
<el-image-viewer v-if="imgViewVisible" :url-list="[imageUrl]" @close="imgViewVisible = false" />
</div>
</template>
<script setup lang="ts" name="UploadImg">
import { ref, computed, inject } from "vue";
import { generateUUID } from "@/utils";
import { uploadImg } from "@/api/modules/upload";
import { ElNotification, formContextKey, formItemContextKey } from "element-plus";
import type { UploadProps, UploadRequestOptions } from "element-plus";
interface UploadFileProps {
imageUrl: string; // 图片地址 ==> 必传
api?: (params: any) => Promise<any>; // 上传图片的 api 方法,一般项目上传都是同一个 api 方法,在组件里直接引入即可 ==> 非必传
drag?: boolean; // 是否支持拖拽上传 ==> 非必传(默认为 true)
disabled?: boolean; // 是否禁用上传组件 ==> 非必传(默认为 false)
fileSize?: number; // 图片大小限制 ==> 非必传(默认为 5M)
fileType?: File.ImageMimeType[]; // 图片类型限制 ==> 非必传(默认为 ["image/jpeg", "image/png", "image/gif"])
height?: string; // 组件高度 ==> 非必传(默认为 150px)
width?: string; // 组件宽度 ==> 非必传(默认为 150px)
borderRadius?: string; // 组件边框圆角 ==> 非必传(默认为 8px)
}
// 接受父组件参数
const props = withDefaults(defineProps<UploadFileProps>(), {
imageUrl: "",
drag: true,
disabled: false,
fileSize: 5,
fileType: () => ["image/jpeg", "image/png", "image/gif"],
height: "150px",
width: "150px",
borderRadius: "8px"
});
// 生成组件唯一id
const uuid = ref("id-" + generateUUID());
// 查看图片
const imgViewVisible = ref(false);
// 获取 el-form 组件上下文
const formContext = inject(formContextKey, void 0);
// 获取 el-form-item 组件上下文
const formItemContext = inject(formItemContextKey, void 0);
// 判断是否禁用上传和删除
const self_disabled = computed(() => {
return props.disabled || formContext?.disabled;
});
/**
* @description 图片上传
* @param options upload 所有配置项
* */
const emit = defineEmits<{
"update:imageUrl": [value: string];
}>();
const handleHttpUpload = async (options: UploadRequestOptions) => {
let formData = new FormData();
formData.append("file", options.file);
try {
const api = props.api ?? uploadImg;
const { data } = await api(formData);
emit("update:imageUrl", data.fileUrl);
// 调用 el-form 内部的校验方法(可自动校验)
formItemContext?.prop && formContext?.validateField([formItemContext.prop as string]);
} catch (error) {
options.onError(error as any);
}
};
/**
* @description 删除图片
* */
const deleteImg = () => {
emit("update:imageUrl", "");
};
/**
* @description 编辑图片
* */
const editImg = () => {
const dom = document.querySelector(`#${uuid.value} .el-upload__input`);
dom && dom.dispatchEvent(new MouseEvent("click"));
};
/**
* @description 文件上传之前判断
* @param rawFile 选择的文件
* */
const beforeUpload: UploadProps["beforeUpload"] = rawFile => {
const imgSize = rawFile.size / 1024 / 1024 < props.fileSize;
const imgType = props.fileType.includes(rawFile.type as File.ImageMimeType);
if (!imgType)
ElNotification({
title: "温馨提示",
message: "上传图片不符合所需的格式!",
type: "warning"
});
if (!imgSize)
setTimeout(() => {
ElNotification({
title: "温馨提示",
message: `上传图片大小不能超过 ${props.fileSize}M!`,
type: "warning"
});
}, 0);
return imgType && imgSize;
};
/**
* @description 图片上传成功
* */
const uploadSuccess = () => {
ElNotification({
title: "温馨提示",
message: "图片上传成功!",
type: "success"
});
};
/**
* @description 图片上传错误
* */
const uploadError = () => {
ElNotification({
title: "温馨提示",
message: "图片上传失败,请您重新上传!",
type: "error"
});
};
</script>
<style scoped lang="scss">
.is-error {
.upload {
:deep(.el-upload),
:deep(.el-upload-dragger) {
border: 1px dashed var(--el-color-danger) !important;
&:hover {
border-color: var(--el-color-primary) !important;
}
}
}
}
:deep(.disabled) {
.el-upload,
.el-upload-dragger {
cursor: not-allowed !important;
background: var(--el-disabled-bg-color);
border: 1px dashed var(--el-border-color-darker) !important;
&:hover {
border: 1px dashed var(--el-border-color-darker) !important;
}
}
}
.upload-box {
.no-border {
:deep(.el-upload) {
border: none !important;
}
}
:deep(.upload) {
.el-upload {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: v-bind(width);
height: v-bind(height);
overflow: hidden;
border: 1px dashed var(--el-border-color-darker);
border-radius: v-bind(borderRadius);
transition: var(--el-transition-duration-fast);
&:hover {
border-color: var(--el-color-primary);
.upload-handle {
opacity: 1;
}
}
.el-upload-dragger {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
padding: 0;
overflow: hidden;
background-color: transparent;
border: 1px dashed var(--el-border-color-darker);
border-radius: v-bind(borderRadius);
&:hover {
border: 1px dashed var(--el-color-primary);
}
}
.el-upload-dragger.is-dragover {
background-color: var(--el-color-primary-light-9);
border: 2px dashed var(--el-color-primary) !important;
}
.upload-image {
width: 100%;
height: 100%;
object-fit: contain;
}
.upload-empty {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 12px;
line-height: 30px;
color: var(--el-color-info);
.el-icon {
font-size: 28px;
color: var(--el-text-color-secondary);
}
}
.upload-handle {
position: absolute;
top: 0;
right: 0;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
cursor: pointer;
background: rgb(0 0 0 / 60%);
opacity: 0;
transition: var(--el-transition-duration-fast);
.handle-icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 6%;
color: aliceblue;
.el-icon {
margin-bottom: 40%;
font-size: 130%;
line-height: 130%;
}
span {
font-size: 85%;
line-height: 85%;
}
}
}
}
}
.el-upload__tip {
line-height: 18px;
text-align: center;
}
}
</style>
<template>
<div class="upload-box">
<el-upload
v-model:file-list="_fileList"
action="#"
list-type="picture-card"
:class="['upload', self_disabled ? 'disabled' : '', drag ? 'no-border' : '']"
:multiple="true"
:disabled="self_disabled"
:limit="limit"
:http-request="handleHttpUpload"
:before-upload="beforeUpload"
:on-exceed="handleExceed"
:on-success="uploadSuccess"
:on-error="uploadError"
:drag="drag"
:accept="fileType.join(',')"
>
<div class="upload-empty">
<slot name="empty">
<el-icon><Plus /></el-icon>
<!-- <span>请上传图片</span> -->
</slot>
</div>
<template #file="{ file }">
<img :src="file.url" class="upload-image" />
<div class="upload-handle" @click.stop>
<div class="handle-icon" @click="handlePictureCardPreview(file)">
<el-icon><ZoomIn /></el-icon>
<span>查看</span>
</div>
<div v-if="!self_disabled" class="handle-icon" @click="handleRemove(file)">
<el-icon><Delete /></el-icon>
<span>删除</span>
</div>
</div>
</template>
</el-upload>
<div class="el-upload__tip">
<slot name="tip"></slot>
</div>
<el-image-viewer v-if="imgViewVisible" :url-list="[viewImageUrl]" @close="imgViewVisible = false" />
</div>
</template>
<script setup lang="ts" name="UploadImgs">
import { ref, computed, inject, watch } from "vue";
import { Plus } from "@element-plus/icons-vue";
import { uploadImg } from "@/api/modules/upload";
import type { UploadProps, UploadFile, UploadUserFile, UploadRequestOptions } from "element-plus";
import { ElNotification, formContextKey, formItemContextKey } from "element-plus";
interface UploadFileProps {
fileList: UploadUserFile[];
api?: (params: any) => Promise<any>; // 上传图片的 api 方法,一般项目上传都是同一个 api 方法,在组件里直接引入即可 ==> 非必传
drag?: boolean; // 是否支持拖拽上传 ==> 非必传(默认为 true)
disabled?: boolean; // 是否禁用上传组件 ==> 非必传(默认为 false)
limit?: number; // 最大图片上传数 ==> 非必传(默认为 5张)
fileSize?: number; // 图片大小限制 ==> 非必传(默认为 5M)
fileType?: File.ImageMimeType[]; // 图片类型限制 ==> 非必传(默认为 ["image/jpeg", "image/png", "image/gif"])
height?: string; // 组件高度 ==> 非必传(默认为 150px)
width?: string; // 组件宽度 ==> 非必传(默认为 150px)
borderRadius?: string; // 组件边框圆角 ==> 非必传(默认为 8px)
}
const props = withDefaults(defineProps<UploadFileProps>(), {
fileList: () => [],
drag: true,
disabled: false,
limit: 5,
fileSize: 5,
fileType: () => ["image/jpeg", "image/png", "image/gif"],
height: "150px",
width: "150px",
borderRadius: "8px"
});
// 获取 el-form 组件上下文
const formContext = inject(formContextKey, void 0);
// 获取 el-form-item 组件上下文
const formItemContext = inject(formItemContextKey, void 0);
// 判断是否禁用上传和删除
const self_disabled = computed(() => {
return props.disabled || formContext?.disabled;
});
const _fileList = ref<UploadUserFile[]>(props.fileList);
// 监听 props.fileList 列表默认值改变
watch(
() => props.fileList,
(n: UploadUserFile[]) => {
_fileList.value = n;
}
);
/**
* @description 文件上传之前判断
* @param rawFile 选择的文件
* */
const beforeUpload: UploadProps["beforeUpload"] = rawFile => {
const imgSize = rawFile.size / 1024 / 1024 < props.fileSize;
const imgType = props.fileType.includes(rawFile.type as File.ImageMimeType);
if (!imgType)
ElNotification({
title: "温馨提示",
message: "上传图片不符合所需的格式!",
type: "warning"
});
if (!imgSize)
setTimeout(() => {
ElNotification({
title: "温馨提示",
message: `上传图片大小不能超过 ${props.fileSize}M!`,
type: "warning"
});
}, 0);
return imgType && imgSize;
};
/**
* @description 图片上传
* @param options upload 所有配置项
* */
const handleHttpUpload = async (options: UploadRequestOptions) => {
let formData = new FormData();
formData.append("file", options.file);
try {
const api = props.api ?? uploadImg;
const { data } = await api(formData);
options.onSuccess(data);
} catch (error) {
options.onError(error as any);
}
};
/**
* @description 图片上传成功
* @param response 上传响应结果
* @param uploadFile 上传的文件
* */
const emit = defineEmits<{
"update:fileList": [value: UploadUserFile[]];
}>();
const uploadSuccess = (response: { fileUrl: string } | undefined, uploadFile: UploadFile) => {
if (!response) return;
uploadFile.url = response.fileUrl;
emit("update:fileList", _fileList.value);
// 调用 el-form 内部的校验方法(可自动校验)
formItemContext?.prop && formContext?.validateField([formItemContext.prop as string]);
ElNotification({
title: "温馨提示",
message: "图片上传成功!",
type: "success"
});
};
/**
* @description 删除图片
* @param file 删除的文件
* */
const handleRemove = (file: UploadFile) => {
_fileList.value = _fileList.value.filter(item => item.url !== file.url || item.name !== file.name);
emit("update:fileList", _fileList.value);
};
/**
* @description 图片上传错误
* */
const uploadError = () => {
ElNotification({
title: "温馨提示",
message: "图片上传失败,请您重新上传!",
type: "error"
});
};
/**
* @description 文件数超出
* */
const handleExceed = () => {
ElNotification({
title: "温馨提示",
message: `当前最多只能上传 ${props.limit} 张图片,请移除后上传!`,
type: "warning"
});
};
/**
* @description 图片预览
* @param file 预览的文件
* */
const viewImageUrl = ref("");
const imgViewVisible = ref(false);
const handlePictureCardPreview: UploadProps["onPreview"] = file => {
viewImageUrl.value = file.url!;
imgViewVisible.value = true;
};
</script>
<style scoped lang="scss">
.is-error {
.upload {
:deep(.el-upload--picture-card),
:deep(.el-upload-dragger) {
border: 1px dashed var(--el-color-danger) !important;
&:hover {
border-color: var(--el-color-primary) !important;
}
}
}
}
:deep(.disabled) {
.el-upload--picture-card,
.el-upload-dragger {
cursor: not-allowed;
background: var(--el-disabled-bg-color) !important;
border: 1px dashed var(--el-border-color-darker);
&:hover {
border-color: var(--el-border-color-darker) !important;
}
}
}
.upload-box {
.no-border {
:deep(.el-upload--picture-card) {
border: none !important;
}
}
:deep(.upload) {
.el-upload-dragger {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
padding: 0;
overflow: hidden;
border: 1px dashed var(--el-border-color-darker);
border-radius: v-bind(borderRadius);
&:hover {
border: 1px dashed var(--el-color-primary);
}
}
.el-upload-dragger.is-dragover {
background-color: var(--el-color-primary-light-9);
border: 2px dashed var(--el-color-primary) !important;
}
.el-upload-list__item,
.el-upload--picture-card {
width: v-bind(width);
height: v-bind(height);
background-color: transparent;
border-radius: v-bind(borderRadius);
}
.upload-image {
width: 100%;
height: 100%;
object-fit: contain;
}
.upload-handle {
position: absolute;
top: 0;
right: 0;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
cursor: pointer;
background: rgb(0 0 0 / 60%);
opacity: 0;
transition: var(--el-transition-duration-fast);
.handle-icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 6%;
color: aliceblue;
.el-icon {
margin-bottom: 15%;
font-size: 140%;
}
span {
font-size: 100%;
}
}
}
.el-upload-list__item {
&:hover {
.upload-handle {
opacity: 1;
}
}
}
.upload-empty {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
line-height: 30px;
color: var(--el-color-info);
.el-icon {
font-size: 28px;
color: var(--el-text-color-secondary);
}
}
}
.el-upload__tip {
line-height: 15px;
text-align: center;
}
}
</style>
/* 富文本组件校验失败样式 */
.is-error {
.editor-box {
border-color: var(--el-color-danger);
.editor-toolbar {
border-bottom-color: var(--el-color-danger);
}
}
}
/* 富文本组件禁用样式 */
.editor-disabled {
cursor: not-allowed !important;
}
/* 富文本组件样式 */
.editor-box {
/* 防止富文本编辑器全屏时 tabs组件 在其层级之上 */
z-index: 2;
width: 100%;
border: 1px solid var(--el-border-color-darker);
.editor-toolbar {
border-bottom: 1px solid var(--el-border-color-darker);
}
.editor-content {
overflow-y: hidden;
}
}
<template>
<div :class="['editor-box', self_disabled ? 'editor-disabled' : '']">
<Toolbar v-if="!hideToolBar" class="editor-toolbar" :editor="editorRef" :default-config="toolbarConfig" :mode="mode" />
<Editor
v-model="valueHtml"
class="editor-content"
:style="{ height }"
:mode="mode"
:default-config="editorConfig"
@on-created="handleCreated"
@on-blur="handleBlur"
/>
</div>
</template>
<script setup lang="ts" name="WangEditor">
import { nextTick, computed, inject, shallowRef, onBeforeUnmount } from "vue";
import { IToolbarConfig, IEditorConfig } from "@wangeditor/editor";
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
import { uploadImg, uploadVideo } from "@/api/modules/upload";
import "@wangeditor/editor/dist/css/style.css";
import { formContextKey, formItemContextKey } from "element-plus";
// 富文本 DOM 元素
const editorRef = shallowRef();
// 实列化编辑器
const handleCreated = (editor: any) => {
editorRef.value = editor;
};
// 接收父组件参数,并设置默认值
interface RichEditorProps {
value: string; // 富文本值 ==> 必传
toolbarConfig?: Partial<IToolbarConfig>; // 工具栏配置 ==> 非必传(默认为空)
editorConfig?: Partial<IEditorConfig>; // 编辑器配置 ==> 非必传(默认为空)
height?: string; // 富文本高度 ==> 非必传(默认为 500px)
mode?: "default" | "simple"; // 富文本模式 ==> 非必传(默认为 default)
hideToolBar?: boolean; // 是否隐藏工具栏 ==> 非必传(默认为false)
disabled?: boolean; // 是否禁用编辑器 ==> 非必传(默认为false)
}
const props = withDefaults(defineProps<RichEditorProps>(), {
toolbarConfig: () => {
return {
excludeKeys: []
};
},
editorConfig: () => {
return {
placeholder: "请输入内容...",
MENU_CONF: {}
};
},
height: "500px",
mode: "default",
hideToolBar: false,
disabled: false
});
// 获取 el-form 组件上下文
const formContext = inject(formContextKey, void 0);
// 获取 el-form-item 组件上下文
const formItemContext = inject(formItemContextKey, void 0);
// 判断是否禁用上传和删除
const self_disabled = computed(() => {
return props.disabled || formContext?.disabled;
});
// 判断当前富文本编辑器是否禁用
if (self_disabled.value) nextTick(() => editorRef.value.disable());
// 富文本的内容监听,触发父组件改变,实现双向数据绑定
const emit = defineEmits<{
"update:value": [value: string];
"check-validate": [];
}>();
const valueHtml = computed({
get() {
return props.value;
},
set(val: string) {
// 防止富文本内容为空时,校验失败
if (editorRef.value.isEmpty()) val = "";
emit("update:value", val);
}
});
/**
* @description 图片自定义上传
* @param file 上传的文件
* @param insertFn 上传成功后的回调函数(插入到富文本编辑器中)
* */
type InsertFnTypeImg = (url: string, alt?: string, href?: string) => void;
props.editorConfig.MENU_CONF!["uploadImage"] = {
async customUpload(file: File, insertFn: InsertFnTypeImg) {
if (!uploadImgValidate(file)) return;
let formData = new FormData();
formData.append("file", file);
try {
const { data } = await uploadImg(formData);
insertFn(data.fileUrl);
} catch (error) {
console.log(error);
}
}
};
// 图片上传前判断
const uploadImgValidate = (file: File): boolean => {
console.log(file);
return true;
};
/**
* @description 视频自定义上传
* @param file 上传的文件
* @param insertFn 上传成功后的回调函数(插入到富文本编辑器中)
* */
type InsertFnTypeVideo = (url: string, poster?: string) => void;
props.editorConfig.MENU_CONF!["uploadVideo"] = {
async customUpload(file: File, insertFn: InsertFnTypeVideo) {
if (!uploadVideoValidate(file)) return;
let formData = new FormData();
formData.append("file", file);
try {
const { data } = await uploadVideo(formData);
insertFn(data.fileUrl);
} catch (error) {
console.log(error);
}
}
};
// 视频上传前判断
const uploadVideoValidate = (file: File): boolean => {
console.log(file);
return true;
};
// 编辑框失去焦点时触发
const handleBlur = () => {
formItemContext?.prop && formContext?.validateField([formItemContext.prop as string]);
};
// 组件销毁时,也及时销毁编辑器
onBeforeUnmount(() => {
if (!editorRef.value) return;
editorRef.value.destroy();
});
defineExpose({
editor: editorRef
});
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
// ? 全局默认配置项
// 首页地址(默认)
export const HOME_URL: string = "/home/index";
// 登录页地址(默认)
export const LOGIN_URL: string = "/login";
// 默认主题颜色
export const DEFAULT_PRIMARY: string = "#009688";
// 路由白名单地址(本地存在的路由 staticRouter.ts 中)
export const ROUTER_WHITE_LIST: string[] = ["/500"];
// 高德地图 key
export const AMAP_MAP_KEY: string = "";
// 百度地图 key
export const BAIDU_MAP_KEY: string = "";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
NProgress.configure({
easing: "ease", // 动画方式
speed: 500, // 递增进度条的速度
showSpinner: true, // 是否显示加载ico
trickleSpeed: 200, // 自动递增间隔
minimum: 0.3 // 初始化时的最小百分比
});
export default NProgress;
import { App, Directive } from "vue";
import auth from "./modules/auth";
import copy from "./modules/copy";
import waterMarker from "./modules/waterMarker";
import draggable from "./modules/draggable";
import debounce from "./modules/debounce";
import throttle from "./modules/throttle";
import longpress from "./modules/longpress";
const directivesList: { [key: string]: Directive } = {
auth,
copy,
waterMarker,
draggable,
debounce,
throttle,
longpress
};
const directives = {
install: function (app: App<Element>) {
Object.keys(directivesList).forEach(key => {
app.directive(key, directivesList[key]);
});
}
};
export default directives;
/**
* v-auth
* 按钮权限指令
*/
import { useAuthStore } from "@/stores/modules/auth";
import type { Directive, DirectiveBinding } from "vue";
const auth: Directive = {
mounted(el: HTMLElement, binding: DirectiveBinding) {
const { value } = binding;
const authStore = useAuthStore();
const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? [];
if (value instanceof Array && value.length) {
const hasPermission = value.every(item => currentPageRoles.includes(item));
if (!hasPermission) el.remove();
} else {
if (!currentPageRoles.includes(value)) el.remove();
}
}
};
export default auth;
/**
* v-copy
* 复制某个值至剪贴板
* 接收参数:string类型/Ref<string>类型/Reactive<string>类型
*/
import type { Directive, DirectiveBinding } from "vue";
import { ElMessage } from "element-plus";
interface ElType extends HTMLElement {
copyData: string | number;
}
const copy: Directive = {
mounted(el: ElType, binding: DirectiveBinding) {
el.copyData = binding.value;
el.addEventListener("click", handleClick);
},
updated(el: ElType, binding: DirectiveBinding) {
el.copyData = binding.value;
},
beforeUnmount(el: ElType) {
el.removeEventListener("click", handleClick);
}
};
async function handleClick(this: any) {
try {
await navigator.clipboard.writeText(this.copyData);
ElMessage({
type: "success",
message: "复制成功"
});
} catch (err) {
console.error("复制操作不被支持或失败: ", err);
}
}
export default copy;
/**
* v-debounce
* 按钮防抖指令,可自行扩展至input
* 接收参数:function类型
*/
import type { Directive, DirectiveBinding } from "vue";
interface ElType extends HTMLElement {
__handleClick__: () => any;
}
const debounce: Directive = {
mounted(el: ElType, binding: DirectiveBinding) {
if (typeof binding.value !== "function") {
throw "callback must be a function";
}
let timer: NodeJS.Timeout | null = null;
el.__handleClick__ = function () {
if (timer) {
clearInterval(timer);
}
timer = setTimeout(() => {
binding.value();
}, 500);
};
el.addEventListener("click", el.__handleClick__);
},
beforeUnmount(el: ElType) {
el.removeEventListener("click", el.__handleClick__);
}
};
export default debounce;
/*
需求:实现一个拖拽指令,可在父元素区域任意拖拽元素。
思路:
1、设置需要拖拽的元素为absolute,其父元素为relative。
2、鼠标按下(onmousedown)时记录目标元素当前的 left 和 top 值。
3、鼠标移动(onmousemove)时计算每次移动的横向距离和纵向距离的变化值,并改变元素的 left 和 top 值
4、鼠标松开(onmouseup)时完成一次拖拽
使用:在 Dom 上加上 v-draggable 即可
<div class="dialog-model" v-draggable></div>
*/
import type { Directive } from "vue";
interface ElType extends HTMLElement {
parentNode: any;
}
const draggable: Directive = {
mounted: function (el: ElType) {
el.style.cursor = "move";
el.style.position = "absolute";
el.onmousedown = function (e) {
let disX = e.pageX - el.offsetLeft;
let disY = e.pageY - el.offsetTop;
document.onmousemove = function (e) {
let x = e.pageX - disX;
let y = e.pageY - disY;
let maxX = el.parentNode.offsetWidth - el.offsetWidth;
let maxY = el.parentNode.offsetHeight - el.offsetHeight;
if (x < 0) {
x = 0;
} else if (x > maxX) {
x = maxX;
}
if (y < 0) {
y = 0;
} else if (y > maxY) {
y = maxY;
}
el.style.left = x + "px";
el.style.top = y + "px";
};
document.onmouseup = function () {
document.onmousemove = document.onmouseup = null;
};
};
}
};
export default draggable;
/**
* v-longpress
* 长按指令,长按时触发事件
*/
import type { Directive, DirectiveBinding } from "vue";
const directive: Directive = {
mounted(el: HTMLElement, binding: DirectiveBinding) {
if (typeof binding.value !== "function") {
throw "callback must be a function";
}
// 定义变量
let pressTimer: any = null;
// 创建计时器( 2秒后执行函数 )
const start = (e: any) => {
if (e.button) {
if (e.type === "click" && e.button !== 0) {
return;
}
}
if (pressTimer === null) {
pressTimer = setTimeout(() => {
handler(e);
}, 1000);
}
};
// 取消计时器
const cancel = () => {
if (pressTimer !== null) {
clearTimeout(pressTimer);
pressTimer = null;
}
};
// 运行函数
const handler = (e: MouseEvent | TouchEvent) => {
binding.value(e);
};
// 添加事件监听器
el.addEventListener("mousedown", start);
el.addEventListener("touchstart", start);
// 取消计时器
el.addEventListener("click", cancel);
el.addEventListener("mouseout", cancel);
el.addEventListener("touchend", cancel);
el.addEventListener("touchcancel", cancel);
}
};
export default directive;
/*
需求:防止按钮在短时间内被多次点击,使用节流函数限制规定时间内只能点击一次。
思路:
1、第一次点击,立即调用方法并禁用按钮,等延迟结束再次激活按钮
2、将需要触发的方法绑定在指令上
使用:给 Dom 加上 v-throttle 及回调函数即可
<button v-throttle="debounceClick">节流提交</button>
*/
import type { Directive, DirectiveBinding } from "vue";
interface ElType extends HTMLElement {
__handleClick__: () => any;
disabled: boolean;
}
const throttle: Directive = {
mounted(el: ElType, binding: DirectiveBinding) {
if (typeof binding.value !== "function") {
throw "callback must be a function";
}
let timer: NodeJS.Timeout | null = null;
el.__handleClick__ = function () {
if (timer) {
clearTimeout(timer);
}
if (!el.disabled) {
el.disabled = true;
binding.value();
timer = setTimeout(() => {
el.disabled = false;
}, 1000);
}
};
el.addEventListener("click", el.__handleClick__);
},
beforeUnmount(el: ElType) {
el.removeEventListener("click", el.__handleClick__);
}
};
export default throttle;
/*
需求:给整个页面添加背景水印。
思路:
1、使用 canvas 特性生成 base64 格式的图片文件,设置其字体大小,颜色等。
2、将其设置为背景图片,从而实现页面或组件水印效果
使用:设置水印文案,颜色,字体大小即可
<div v-waterMarker="{text:'版权所有',textColor:'rgba(180, 180, 180, 0.4)'}"></div>
*/
import type { Directive, DirectiveBinding } from "vue";
const addWaterMarker: Directive = (str: string, parentNode: any, font: any, textColor: string) => {
// 水印文字,父元素,字体,文字颜色
let can: HTMLCanvasElement = document.createElement("canvas");
parentNode.appendChild(can);
can.width = 205;
can.height = 140;
can.style.display = "none";
let cans = can.getContext("2d") as CanvasRenderingContext2D;
cans.rotate((-20 * Math.PI) / 180);
cans.font = font || "16px Microsoft JhengHei";
cans.fillStyle = textColor || "rgba(180, 180, 180, 0.3)";
cans.textAlign = "left";
cans.textBaseline = "Middle" as CanvasTextBaseline;
cans.fillText(str, can.width / 10, can.height / 2);
parentNode.style.backgroundImage = "url(" + can.toDataURL("image/png") + ")";
};
const waterMarker = {
mounted(el: DirectiveBinding, binding: DirectiveBinding) {
addWaterMarker(binding.value.text, el, binding.value.font, binding.value.textColor);
}
};
export default waterMarker;
/**
* @description:请求配置
*/
export enum ResultEnum {
SUCCESS = 200,
ERROR = 500,
OVERDUE = 401,
TIMEOUT = 30000,
TYPE = "success"
}
/**
* @description:请求方法
*/
export enum RequestEnum {
GET = "GET",
POST = "POST",
PATCH = "PATCH",
PUT = "PUT",
DELETE = "DELETE"
}
/**
* @description:常用的 contentTyp 类型
*/
export enum ContentTypeEnum {
// json
JSON = "application/json;charset=UTF-8",
// text
TEXT = "text/plain;charset=UTF-8",
// form-data 一般配合qs
FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8",
// form-data 上传
FORM_DATA = "multipart/form-data;charset=UTF-8"
}
export namespace Table {
export interface Pageable {
pageIndex: number;
pageSize: number;
total: number;
}
export interface StateProps {
tableData: any[];
pageable: Pageable;
searchParam: {
[key: string]: any;
};
searchInitParam: {
[key: string]: any;
};
totalParam: {
[key: string]: any;
};
icon?: {
[key: string]: any;
};
}
}
export namespace HandleData {
export type MessageType = "" | "success" | "warning" | "info" | "error";
}
export namespace Theme {
export type ThemeType = "light" | "inverted" | "dark";
export type GreyOrWeakType = "grey" | "weak";
}
export namespace socket {
export type SocketType = "connect" | "disconnect" | "error";
}
import { computed } from "vue";
import { useRoute } from "vue-router";
import { useAuthStore } from "@/stores/modules/auth";
/**
* @description 页面按钮权限
* */
export const useAuthButtons = () => {
const route = useRoute();
const authStore = useAuthStore();
const authButtons = authStore.authButtonListGet[route.name as string] || [];
const BUTTONS = computed(() => {
let currentPageAuthButton: { [key: string]: boolean } = {};
authButtons.forEach(item => (currentPageAuthButton[item] = true));
return currentPageAuthButton;
});
return {
BUTTONS
};
};
import { sendCmd } from "@/api/modules/device";
import { ElMessage } from "element-plus";
/**
* @description 发送指令
*/
export const useCmd = async params => {
await sendCmd(params);
ElMessage.success({ message: `操作成功!` });
};
import { ElNotification } from "element-plus";
/**
* @description 接收数据流生成 blob,创建链接,下载文件
* @param {Function} api 导出表格的api方法 (必传)
* @param {String} tempName 导出的文件名 (必传)
* @param {Object} params 导出的参数 (默认{})
* @param {Boolean} isNotify 是否有导出消息提示 (默认为 true)
* @param {String} fileType 导出的文件格式 (默认为.xlsx)
* */
export const useDownload = async (
api: (param: any) => Promise<any>,
tempName: string,
params: any = {},
isNotify: boolean = true,
fileType: string = ".xlsx"
) => {
if (isNotify) {
ElNotification({
title: "温馨提示",
message: "如果数据庞大会导致下载缓慢哦,请您耐心等待!",
type: "info",
duration: 3000
});
}
try {
const res = await api(params);
const blob = new Blob([res]);
// 兼容 edge 不支持 createObjectURL 方法
if ("msSaveOrOpenBlob" in navigator) return window.navigator.msSaveOrOpenBlob(blob, tempName + fileType);
const blobUrl = window.URL.createObjectURL(blob);
const exportFile = document.createElement("a");
exportFile.style.display = "none";
exportFile.download = `${tempName}${fileType}`;
exportFile.href = blobUrl;
document.body.appendChild(exportFile);
exportFile.click();
// 去除下载对 url 的影响
document.body.removeChild(exportFile);
window.URL.revokeObjectURL(blobUrl);
} catch (error) {
console.log(error);
}
};
import { ElMessageBox, ElMessage } from "element-plus";
import { HandleData } from "./interface";
/**
* @description 操作单条数据信息 (二次确认【删除、禁用、启用、重置密码】)
* @param {Function} api 操作数据接口的api方法 (必传)
* @param {Object} params 携带的操作数据参数 {id,params} (必传)
* @param {String} message 提示信息 (必传)
* @param {String} confirmType icon类型 (不必传,默认为 warning)
* @returns {Promise}
*/
export const useHandleData = (
api: (params: any) => Promise<any>,
params: any = {},
message: string,
confirmType: HandleData.MessageType = "warning"
) => {
return new Promise((resolve, reject) => {
ElMessageBox.confirm(message, "温馨提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: confirmType,
draggable: true
})
.then(async () => {
const res = await api(params);
if (!res) return reject(false);
ElMessage({
type: "success",
message: `${message}成功!`
});
resolve(true);
})
.catch(() => {
// cancel operation
});
});
};
import { ref, onMounted, onUnmounted } from "vue";
/**
* @description 网络是否可用
* */
export const useOnline = () => {
const online = ref(true);
const showStatus = (val: any) => {
online.value = typeof val == "boolean" ? val : val.target.online;
};
// 在页面加载后,设置正确的网络状态
navigator.onLine ? showStatus(true) : showStatus(false);
onMounted(() => {
// 开始监听网络状态的变化
window.addEventListener("online", showStatus);
window.addEventListener("offline", showStatus);
});
onUnmounted(() => {
// 移除监听网络状态的变化
window.removeEventListener("online", showStatus);
window.removeEventListener("offline", showStatus);
});
return { online };
};
import { ref, computed } from "vue";
/**
* @description 表格多选数据操作
* @param {String} rowKey 当表格可以多选时,所指定的 id
* */
export const useSelection = (rowKey: string = "id") => {
const isSelected = ref<boolean>(false);
const selectedList = ref<{ [key: string]: any }[]>([]);
// 当前选中的所有 ids 数组
const selectedListIds = computed((): string[] => {
let ids: string[] = [];
selectedList.value.forEach(item => ids.push(item[rowKey]));
return ids;
});
/**
* @description 多选操作
* @param {Array} rowArr 当前选择的所有数据
* @return void
*/
const selectionChange = (rowArr: { [key: string]: any }[]) => {
rowArr.length ? (isSelected.value = true) : (isSelected.value = false);
selectedList.value = rowArr;
};
return {
isSelected,
selectedList,
selectedListIds,
selectionChange
};
};
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 14:38:01
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-09-23 14:21:03
* @FilePath: \Apper-Admin-master\src\hooks\useTable.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { Table } from "./interface";
import { reactive, computed, toRefs } from "vue";
/**
* @description table 页面操作方法封装
* @param {Function} api 获取表格数据 api 方法 (必传)
* @param {Object} initParam 获取数据初始化参数 (非必传,默认为{})
* @param {Boolean} isPageable 是否有分页 (非必传,默认为true)
* @param {Function} dataCallBack 对后台返回的数据进行处理的方法 (非必传)
* */
export const useTable = (
api?: (params: any) => Promise<any>,
initParam: object = {},
isPageable: boolean = true,
dataCallBack?: (data: any) => any,
requestError?: (error: any) => void
) => {
const state = reactive<Table.StateProps>({
// 表格数据
tableData: [],
// 分页数据
pageable: {
// 当前页数
pageIndex: 1,
// 每页显示条数
pageSize: 10,
// 总条数
total: 0
},
// 查询参数(只包括查询)
searchParam: {},
// 初始化默认的查询参数
searchInitParam: {},
// 总参数(包含分页和查询参数)
totalParam: {}
});
/**
* @description 分页查询参数(只包括分页和表格字段排序,其他排序方式可自行配置)
* */
const pageParam = computed({
get: () => {
return {
pageIndex: state.pageable.pageIndex,
pageSize: state.pageable.pageSize
};
},
set: (newVal: any) => {
console.log("我是分页更新之后的值", newVal);
}
});
/**
* @description 获取表格数据
* @return void
* */
const getTableList = async () => {
if (!api) return;
try {
// 先把初始化参数和分页参数放到总参数里面
Object.assign(state.totalParam, initParam, isPageable ? pageParam.value : {});
let res = await api({ ...state.searchInitParam, ...state.totalParam });
dataCallBack && (res = dataCallBack(res));
state.tableData = isPageable ? res.list : res;
// 解构后台返回的分页数据 (如果有分页更新分页信息)
if (isPageable) {
state.pageable.total = res.total;
}
} catch (error) {
requestError && requestError(error);
}
};
/**
* @description 更新查询参数
* @return void
* */
const updatedTotalParam = () => {
state.totalParam = {};
// 处理查询参数,可以给查询参数加自定义前缀操作
let nowSearchParam: Table.StateProps["searchParam"] = {};
// 防止手动清空输入框携带参数(这里可以自定义查询参数前缀)
for (let key in state.searchParam) {
// 某些情况下参数为 false/0 也应该携带参数
if (state.searchParam[key] || state.searchParam[key] === false || state.searchParam[key] === 0) {
nowSearchParam[key] = state.searchParam[key];
}
}
Object.assign(state.totalParam, nowSearchParam);
};
/**
* @description 表格数据查询
* @return void
* */
const search = () => {
state.pageable.pageIndex = 1;
updatedTotalParam();
getTableList();
};
/**
* @description 表格数据重置
* @return void
* */
const reset = () => {
state.pageable.pageIndex = 1;
// 重置搜索表单的时,如果有默认搜索参数,则重置默认的搜索参数
state.searchParam = { ...state.searchInitParam };
updatedTotalParam();
getTableList();
};
/**
* @description 每页条数改变
* @param {Number} val 当前条数
* @return void
* */
const handleSizeChange = (val: number) => {
state.pageable.pageIndex = 1;
state.pageable.pageSize = val;
getTableList();
};
/**
* @description 当前页改变
* @param {Number} val 当前页
* @return void
* */
const handleCurrentChange = (val: number) => {
state.pageable.pageIndex = val;
getTableList();
};
return {
...toRefs(state),
getTableList,
search,
reset,
handleSizeChange,
handleCurrentChange,
updatedTotalParam
};
};
import { storeToRefs } from "pinia";
import { Theme } from "./interface";
import { ElMessage } from "element-plus";
import { DEFAULT_PRIMARY } from "@/config";
import { useGlobalStore } from "@/stores/modules/global";
import { getLightColor, getDarkColor } from "@/utils/color";
import { menuTheme } from "@/styles/theme/menu";
import { asideTheme } from "@/styles/theme/aside";
import { headerTheme } from "@/styles/theme/header";
/**
* @description 全局主题 hooks
* */
export const useTheme = () => {
const globalStore = useGlobalStore();
const { primary, isDark, isGrey, isWeak, layout, asideInverted, headerInverted } = storeToRefs(globalStore);
// 切换暗黑模式 ==> 同时修改主题颜色、侧边栏、头部颜色
const switchDark = () => {
const html = document.documentElement as HTMLElement;
if (isDark.value) html.setAttribute("class", "dark");
else html.setAttribute("class", "");
changePrimary(primary.value);
setAsideTheme();
setHeaderTheme();
};
// 修改主题颜色
const changePrimary = (val: string | null) => {
if (!val) {
val = DEFAULT_PRIMARY;
ElMessage({ type: "success", message: `主题颜色已重置为 ${DEFAULT_PRIMARY}` });
}
// 计算主题颜色变化
document.documentElement.style.setProperty("--el-color-primary", val);
document.documentElement.style.setProperty(
"--el-color-primary-dark-2",
isDark.value ? `${getLightColor(val, 0.2)}` : `${getDarkColor(val, 0.3)}`
);
for (let i = 1; i <= 9; i++) {
const primaryColor = isDark.value ? `${getDarkColor(val, i / 10)}` : `${getLightColor(val, i / 10)}`;
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, primaryColor);
}
globalStore.setGlobalState("primary", val);
};
// 灰色和弱色切换
const changeGreyOrWeak = (type: Theme.GreyOrWeakType, value: boolean) => {
const body = document.body as HTMLElement;
if (!value) return body.removeAttribute("style");
const styles: Record<Theme.GreyOrWeakType, string> = {
grey: "filter: grayscale(1)",
weak: "filter: invert(80%)"
};
body.setAttribute("style", styles[type]);
const propName = type === "grey" ? "isWeak" : "isGrey";
globalStore.setGlobalState(propName, false);
};
// 设置菜单样式
const setMenuTheme = () => {
let type: Theme.ThemeType = "light";
if (layout.value === "transverse" && headerInverted.value) type = "inverted";
if (layout.value !== "transverse" && asideInverted.value) type = "inverted";
if (isDark.value) type = "dark";
const theme = menuTheme[type!];
for (const [key, value] of Object.entries(theme)) {
document.documentElement.style.setProperty(key, value);
}
};
// 设置侧边栏样式
const setAsideTheme = () => {
let type: Theme.ThemeType = "light";
if (asideInverted.value) type = "inverted";
if (isDark.value) type = "dark";
const theme = asideTheme[type!];
for (const [key, value] of Object.entries(theme)) {
document.documentElement.style.setProperty(key, value);
}
setMenuTheme();
};
// 设置头部样式
const setHeaderTheme = () => {
let type: Theme.ThemeType = "light";
if (headerInverted.value) type = "inverted";
if (isDark.value) type = "dark";
const theme = headerTheme[type!];
for (const [key, value] of Object.entries(theme)) {
document.documentElement.style.setProperty(key, value);
}
setMenuTheme();
};
// init theme
const initTheme = () => {
switchDark();
if (isGrey.value) changeGreyOrWeak("grey", true);
if (isWeak.value) changeGreyOrWeak("weak", true);
};
return {
initTheme,
switchDark,
changePrimary,
changeGreyOrWeak,
setAsideTheme,
setHeaderTheme
};
};
import { ref } from "vue";
/**
* @description 获取本地时间
*/
export const useTime = () => {
const year = ref(0); // 年份
const month = ref(0); // 月份
const week = ref(""); // 星期几
const day = ref(0); // 天数
const hour = ref<number | string>(0); // 小时
const minute = ref<number | string>(0); // 分钟
const second = ref<number | string>(0); // 秒
const nowTime = ref<string>(""); // 当前时间
// 更新时间
const updateTime = () => {
const date = new Date();
year.value = date.getFullYear();
month.value = date.getMonth() + 1;
week.value = "日一二三四五六".charAt(date.getDay());
day.value = date.getDate();
hour.value =
(date.getHours() + "")?.padStart(2, "0") ||
new Intl.NumberFormat(undefined, { minimumIntegerDigits: 2 }).format(date.getHours());
minute.value =
(date.getMinutes() + "")?.padStart(2, "0") ||
new Intl.NumberFormat(undefined, { minimumIntegerDigits: 2 }).format(date.getMinutes());
second.value =
(date.getSeconds() + "")?.padStart(2, "0") ||
new Intl.NumberFormat(undefined, { minimumIntegerDigits: 2 }).format(date.getSeconds());
nowTime.value = `${year.value}年${month.value}月${day.value} ${hour.value}:${minute.value}:${second.value}`;
};
updateTime();
return { year, month, day, hour, minute, second, week, nowTime };
};
// useWebSocket.ts
import { ref, onMounted, onBeforeUnmount } from "vue";
export default function useWebSocket(
url: string,
onMessageCallback: (data: any) => void,
onErrorCallback?: (error: Event) => void
) {
// 状态管理
const socketRef = ref<WebSocket | null>(null);
const isConnected = ref(false);
const reconnectAttempts = ref(0);
// 最大重连次数
const maxReconnectAttempts = 5;
// 重连间隔时间,单位毫秒
const reconnectInterval = 2000;
// 初始化WebSocket连接
const initWebSocket = () => {
socketRef.value = new WebSocket(url);
socketRef.value.onopen = () => {
isConnected.value = true;
console.log("----------websocket连接成功----------");
reconnectAttempts.value = 0; // 成功连接后重置重连尝试次数
};
socketRef.value.onerror = (err: Event) => {
onErrorCallback && onErrorCallback(err);
};
socketRef.value.onclose = () => {
isConnected.value = false;
//断线重连
if (reconnectAttempts.value < maxReconnectAttempts) {
setTimeout(initWebSocket, reconnectInterval);
reconnectAttempts.value++;
} else {
console.log("----------websocket连接断开,超出最大重连次数----------");
}
};
socketRef.value.onmessage = (event: MessageEvent) => {
onMessageCallback(JSON.parse(event.data));
};
};
// 断开连接
const closeWebSocket = () => {
if (socketRef.value && socketRef.value.readyState === 1) {
// 禁止断线重连
reconnectAttempts.value = 6;
socketRef.value.close();
isConnected.value = false;
}
};
// 发送消息
const sendMessage = (data: any) => {
if (socketRef.value && socketRef.value.readyState === 1) {
socketRef.value.send(JSON.stringify(data));
} else {
console.error("socket连接异常--------------");
}
};
// 生命周期钩子
onMounted(() => {
initWebSocket();
});
//页面销毁前,注销关闭socket连接
onBeforeUnmount(() => {
closeWebSocket();
});
// 返回暴露的方法和状态
return {
isConnected,
sendMessage
};
}
import { createI18n } from "vue-i18n";
import { getBrowserLang } from "@/utils";
import zh from "./modules/zh";
import en from "./modules/en";
const i18n = createI18n({
// Use Composition API, Set to false
allowComposition: true,
legacy: false,
locale: getBrowserLang(),
messages: {
zh,
en
}
});
export default i18n;
export default {
home: {
welcome: "Welcome"
},
tabs: {
refresh: "Refresh",
maximize: "Maximize",
closeCurrent: "Close current",
closeLeft: "Close Left",
closeRight: "Close Right",
closeOther: "Close other",
closeAll: "Close All"
},
header: {
componentSize: "Component size",
language: "Language",
theme: "theme",
layoutConfig: "Layout config",
primary: "primary",
darkMode: "Dark Mode",
greyMode: "Grey mode",
weakMode: "Weak mode",
fullScreen: "Full Screen",
exitFullScreen: "Exit Full Screen",
personalData: "Personal Data",
changePassword: "Change Password",
logout: "Logout"
}
};
export default {
home: {
welcome: "欢迎使用"
},
tabs: {
refresh: "刷新",
maximize: "最大化",
closeCurrent: "关闭当前",
closeLeft: "关闭左侧",
closeRight: "关闭右侧",
closeOther: "关闭其它",
closeAll: "关闭所有"
},
header: {
componentSize: "组件大小",
language: "国际化",
theme: "全局主题",
layoutConfig: "布局设置",
primary: "primary",
darkMode: "暗黑模式",
greyMode: "灰色模式",
weakMode: "色弱模式",
fullScreen: "全屏",
exitFullScreen: "退出全屏",
personalData: "个人信息",
changePassword: "修改密码",
logout: "退出登录"
}
};
.el-container {
width: 100%;
height: 100%;
:deep(.el-header) {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
height: 55px;
padding: 0 15px 0 0;
background-color: var(--el-header-bg-color);
border-bottom: 1px solid var(--el-header-border-color);
.header-lf {
display: flex;
align-items: center;
overflow: hidden;
white-space: nowrap;
.logo {
flex-shrink: 0;
width: 210px;
margin-right: 16px;
.logo-img {
width: 28px;
object-fit: contain;
}
.logo-text {
margin-left: 6px;
font-size: 15px;
font-weight: bold;
color: var(--el-header-logo-text-color);
white-space: nowrap;
}
}
}
}
.classic-content {
display: flex;
height: calc(100% - 55px);
:deep(.el-aside) {
width: auto;
background-color: var(--el-menu-bg-color);
border-right: 1px solid var(--el-aside-border-color);
.aside-box {
display: flex;
flex-direction: column;
height: 100%;
transition: width 0.3s ease;
.el-menu {
width: 100%;
overflow-x: hidden;
border-right: none;
}
}
}
.classic-main {
display: flex;
flex-direction: column;
}
}
}
<!-- 经典布局 -->
<template>
<el-container class="layout">
<el-header>
<div class="header-lf mask-image">
<div class="logo flx-center">
<img class="logo-img" src="@/assets/images/logo.svg" alt="logo" />
<span class="logo-text">{{ title }}</span>
</div>
<ToolBarLeft />
</div>
<div class="header-ri">
<ToolBarRight />
</div>
</el-header>
<el-container class="classic-content">
<el-aside>
<div class="aside-box" :style="{ width: isCollapse ? '65px' : '210px' }">
<el-scrollbar>
<el-menu
:router="false"
:default-active="activeMenu"
:collapse="isCollapse"
:unique-opened="accordion"
:collapse-transition="false"
>
<SubMenu :menu-list="menuList" />
</el-menu>
</el-scrollbar>
</div>
</el-aside>
<el-container class="classic-main">
<Main />
</el-container>
</el-container>
</el-container>
</template>
<script setup lang="ts" name="layoutClassic">
import { computed } from "vue";
import { useRoute } from "vue-router";
import { useAuthStore } from "@/stores/modules/auth";
import { useGlobalStore } from "@/stores/modules/global";
import Main from "@/layouts/components/Main/index.vue";
import SubMenu from "@/layouts/components/Menu/SubMenu.vue";
import ToolBarLeft from "@/layouts/components/Header/ToolBarLeft.vue";
import ToolBarRight from "@/layouts/components/Header/ToolBarRight.vue";
const title = import.meta.env.VITE_GLOB_APP_TITLE;
const route = useRoute();
const authStore = useAuthStore();
const globalStore = useGlobalStore();
const accordion = computed(() => globalStore.accordion);
const isCollapse = computed(() => globalStore.isCollapse);
const menuList = computed(() => authStore.showMenuListGet);
const activeMenu = computed(() => (route.meta.activeMenu ? route.meta.activeMenu : route.path) as string);
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
.el-container {
width: 100%;
height: 100%;
.aside-split {
display: flex;
flex-direction: column;
flex-shrink: 0;
width: 70px;
height: 100%;
background-color: var(--el-menu-bg-color);
border-right: 1px solid var(--el-aside-border-color);
.logo {
box-sizing: border-box;
height: 55px;
.logo-img {
width: 32px;
object-fit: contain;
}
}
.el-scrollbar {
height: calc(100% - 55px);
.split-list {
flex: 1;
.split-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 70px;
cursor: pointer;
transition: all 0.3s ease;
.el-icon {
font-size: 20px;
}
.title {
margin-top: 6px;
font-size: 12px;
}
.el-icon,
.title {
color: var(--el-menu-text-color);
}
}
.split-active {
background-color: var(--el-color-primary) !important;
.el-icon,
.title {
color: #ffffff !important;
}
}
}
}
}
.not-aside {
width: 0 !important;
border-right: none !important;
}
.el-aside {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
background-color: var(--el-menu-bg-color);
border-right: 1px solid var(--el-aside-border-color);
transition: width 0.3s ease;
.el-scrollbar {
height: calc(100% - 55px);
.el-menu {
width: 100%;
overflow-x: hidden;
border-right: none;
}
}
.logo {
box-sizing: border-box;
height: 55px;
.logo-text {
font-size: 24px;
font-weight: bold;
color: var(--el-aside-logo-text-color);
white-space: nowrap;
}
}
}
.el-header {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
height: 55px;
padding: 0 15px;
background-color: var(--el-header-bg-color);
border-bottom: 1px solid var(--el-border-color-light);
}
}
<!-- 分栏布局 -->
<template>
<el-container class="layout">
<div class="aside-split">
<div class="logo flx-center">
<img class="logo-img" src="@/assets/images/logo.svg" alt="logo" />
</div>
<el-scrollbar>
<div class="split-list">
<div
v-for="item in menuList"
:key="item.path"
class="split-item"
:class="{ 'split-active': splitActive === item.path || `/${splitActive.split('/')[1]}` === item.path }"
@click="changeSubMenu(item)"
>
<el-icon>
<component :is="item.meta.icon"></component>
</el-icon>
<span class="title">{{ item.meta.title }}</span>
</div>
</div>
</el-scrollbar>
</div>
<el-aside :class="{ 'not-aside': !subMenuList.length }" :style="{ width: isCollapse ? '65px' : '210px' }">
<div class="logo flx-center">
<span v-show="subMenuList.length" class="logo-text">{{ isCollapse ? "G" : title }}</span>
</div>
<el-scrollbar>
<el-menu
:router="false"
:default-active="activeMenu"
:collapse="isCollapse"
:unique-opened="accordion"
:collapse-transition="false"
>
<SubMenu :menu-list="subMenuList" />
</el-menu>
</el-scrollbar>
</el-aside>
<el-container>
<el-header>
<ToolBarLeft />
<ToolBarRight />
</el-header>
<Main />
</el-container>
</el-container>
</template>
<script setup lang="ts" name="layoutColumns">
import { ref, computed, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useAuthStore } from "@/stores/modules/auth";
import { useGlobalStore } from "@/stores/modules/global";
import Main from "@/layouts/components/Main/index.vue";
import ToolBarLeft from "@/layouts/components/Header/ToolBarLeft.vue";
import ToolBarRight from "@/layouts/components/Header/ToolBarRight.vue";
import SubMenu from "@/layouts/components/Menu/SubMenu.vue";
const title = import.meta.env.VITE_GLOB_APP_TITLE;
const route = useRoute();
const router = useRouter();
const authStore = useAuthStore();
const globalStore = useGlobalStore();
const accordion = computed(() => globalStore.accordion);
const isCollapse = computed(() => globalStore.isCollapse);
const menuList = computed(() => authStore.showMenuListGet);
const activeMenu = computed(() => (route.meta.activeMenu ? route.meta.activeMenu : route.path) as string);
const subMenuList = ref<Menu.MenuOptions[]>([]);
const splitActive = ref("");
watch(
() => [menuList, route],
() => {
// 当前菜单没有数据直接 return
if (!menuList.value.length) return;
splitActive.value = route.path;
const menuItem = menuList.value.filter((item: Menu.MenuOptions) => {
return route.path === item.path || `/${route.path.split("/")[1]}` === item.path;
});
if (menuItem[0].children?.length) return (subMenuList.value = menuItem[0].children);
subMenuList.value = [];
},
{
deep: true,
immediate: true
}
);
// change SubMenu
const changeSubMenu = (item: Menu.MenuOptions) => {
splitActive.value = item.path;
if (item.children?.length) return (subMenuList.value = item.children);
subMenuList.value = [];
router.push(item.path);
};
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
.el-container {
width: 100%;
height: 100%;
:deep(.el-header) {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
height: 55px;
padding: 0 15px 0 0;
background-color: var(--el-header-bg-color);
border-bottom: 1px solid var(--el-header-border-color);
.logo {
width: 210px;
margin-right: 30px;
.logo-img {
width: 28px;
object-fit: contain;
}
.logo-text {
margin-left: 6px;
font-size: 15px;
font-weight: bold;
color: var(--el-header-logo-text-color);
white-space: nowrap;
}
}
.el-menu {
flex: 1;
height: 100%;
overflow: hidden;
border-bottom: none;
.el-sub-menu__hide-arrow {
width: 65px;
height: 55px;
}
.el-menu-item.is-active {
color: #ffffff !important;
}
.is-active {
background-color: var(--el-color-primary) !important;
border-bottom-color: var(--el-color-primary) !important;
&::before {
width: 0;
}
.el-sub-menu__title {
color: #ffffff !important;
background-color: var(--el-color-primary) !important;
border-bottom-color: var(--el-color-primary) !important;
}
}
}
}
@media screen and (width <= 730px) {
.logo {
display: none !important;
}
}
}
<!-- 横向布局 -->
<template>
<el-container class="layout">
<el-header>
<div class="logo flx-center">
<img class="logo-img" src="@/assets/images/logo.svg" alt="logo" />
<span class="logo-text">{{ title }}</span>
</div>
<el-menu mode="horizontal" :router="false" :default-active="activeMenu">
<!-- 不能直接使用 SubMenu 组件,无法触发 el-menu 隐藏省略功能 -->
<template v-for="subItem in menuList" :key="subItem.path">
<el-sub-menu v-if="subItem.children?.length" :key="subItem.path" :index="subItem.path + 'el-sub-menu'">
<template #title>
<el-icon>
<component :is="subItem.meta.icon"></component>
</el-icon>
<span>{{ subItem.meta.title }}</span>
</template>
<SubMenu :menu-list="subItem.children" />
</el-sub-menu>
<el-menu-item v-else :key="subItem.path + 'el-menu-item'" :index="subItem.path" @click="handleClickMenu(subItem)">
<el-icon>
<component :is="subItem.meta.icon"></component>
</el-icon>
<template #title>
<span>{{ subItem.meta.title }}</span>
</template>
</el-menu-item>
</template>
</el-menu>
<ToolBarRight />
</el-header>
<Main />
</el-container>
</template>
<script setup lang="ts" name="layoutTransverse">
import { computed } from "vue";
import { useAuthStore } from "@/stores/modules/auth";
import { useRoute, useRouter } from "vue-router";
import Main from "@/layouts/components/Main/index.vue";
import ToolBarRight from "@/layouts/components/Header/ToolBarRight.vue";
import SubMenu from "@/layouts/components/Menu/SubMenu.vue";
const title = import.meta.env.VITE_GLOB_APP_TITLE;
const route = useRoute();
const router = useRouter();
const authStore = useAuthStore();
const menuList = computed(() => authStore.showMenuListGet);
const activeMenu = computed(() => (route.meta.activeMenu ? route.meta.activeMenu : route.path) as string);
const handleClickMenu = (subItem: Menu.MenuOptions) => {
if (subItem.meta.isLink) return window.open(subItem.meta.isLink, "_blank");
router.push(subItem.path);
};
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
.el-container {
width: 100%;
height: 100%;
:deep(.el-aside) {
width: auto;
background-color: var(--el-menu-bg-color);
border-right: 1px solid var(--el-aside-border-color);
.aside-box {
display: flex;
flex-direction: column;
height: 100%;
transition: width 0.3s ease;
.el-scrollbar {
height: calc(100% - 55px);
.el-menu {
width: 100%;
overflow-x: hidden;
border-right: none;
}
}
.logo {
box-sizing: border-box;
height: 55px;
.logo-img {
width: 28px;
object-fit: contain;
}
.logo-text {
margin-left: 6px;
font-size: 15px;
font-weight: bold;
color: var(--el-aside-logo-text-color);
white-space: nowrap;
}
}
}
}
.el-header {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
height: 55px;
padding: 0 15px;
background-color: var(--el-header-bg-color);
border-bottom: 1px solid var(--el-header-border-color);
}
}
<!-- 纵向布局 -->
<template>
<el-container class="layout">
<el-aside>
<div class="aside-box" :style="{ width: isCollapse ? '65px' : '210px' }">
<div class="logo flx-center">
<img class="logo-img" src="@/assets/images/logo.svg" alt="logo" />
<span v-show="!isCollapse" class="logo-text">{{ title }}</span>
</div>
<el-scrollbar>
<el-menu
:router="false"
:default-active="activeMenu"
:collapse="isCollapse"
:unique-opened="accordion"
:collapse-transition="false"
>
<SubMenu :menu-list="menuList" />
</el-menu>
</el-scrollbar>
</div>
</el-aside>
<el-container>
<el-header>
<ToolBarLeft />
<ToolBarRight />
</el-header>
<Main />
</el-container>
</el-container>
</template>
<script setup lang="ts" name="layoutVertical">
import { computed } from "vue";
import { useRoute } from "vue-router";
import { useAuthStore } from "@/stores/modules/auth";
import { useGlobalStore } from "@/stores/modules/global";
import Main from "@/layouts/components/Main/index.vue";
import ToolBarLeft from "@/layouts/components/Header/ToolBarLeft.vue";
import ToolBarRight from "@/layouts/components/Header/ToolBarRight.vue";
import SubMenu from "@/layouts/components/Menu/SubMenu.vue";
const title = import.meta.env.VITE_GLOB_APP_TITLE;
const route = useRoute();
const authStore = useAuthStore();
const globalStore = useGlobalStore();
const accordion = computed(() => globalStore.accordion);
const isCollapse = computed(() => globalStore.isCollapse);
const menuList = computed(() => authStore.showMenuListGet);
const activeMenu = computed(() => (route.meta.activeMenu ? route.meta.activeMenu : route.path) as string);
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
.footer {
height: 30px;
background-color: var(--el-bg-color);
border-top: 1px solid var(--el-border-color-light);
a {
font-size: 14px;
color: var(--el-text-color-secondary);
text-decoration: none;
letter-spacing: 0.5px;
}
}
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 14:38:02
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-09-04 18:05:19
* @FilePath: \Apper-Admin-master\src\layouts\components\Footer\index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="footer flx-center">
<a href="https://github.com/HalseySpicy" target="_blank"> 2024 </a>
</div>
</template>
<style scoped lang="scss">
@import "./index.scss";
</style>
<template>
<div class="tool-bar-lf">
<CollapseIcon id="collapseIcon" />
<Breadcrumb v-show="globalStore.breadcrumb" id="breadcrumb" />
</div>
</template>
<script setup lang="ts">
import { useGlobalStore } from "@/stores/modules/global";
import CollapseIcon from "./components/CollapseIcon.vue";
import Breadcrumb from "./components/Breadcrumb.vue";
const globalStore = useGlobalStore();
</script>
<style scoped lang="scss">
.tool-bar-lf {
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
white-space: nowrap;
}
</style>
<template>
<div class="tool-bar-ri">
<div class="header-icon">
<AssemblySize id="assemblySize" />
<Language id="language" />
<SearchMenu id="searchMenu" />
<ThemeSetting id="themeSetting" />
<Message id="message" />
<Fullscreen id="fullscreen" />
</div>
<span class="username">{{ username }}</span>
<Avatar />
</div>
</template>
<script setup lang="ts">
import { computed } from "vue";
import { useUserStore } from "@/stores/modules/user";
import AssemblySize from "./components/AssemblySize.vue";
import Language from "./components/Language.vue";
import SearchMenu from "./components/SearchMenu.vue";
import ThemeSetting from "./components/ThemeSetting.vue";
import Message from "./components/Message.vue";
import Fullscreen from "./components/Fullscreen.vue";
import Avatar from "./components/Avatar.vue";
const userStore = useUserStore();
const username = computed(() => userStore.userInfo.name);
</script>
<style scoped lang="scss">
.tool-bar-ri {
display: flex;
align-items: center;
justify-content: center;
padding-right: 25px;
.header-icon {
display: flex;
align-items: center;
& > * {
margin-left: 21px;
color: var(--el-header-text-color);
}
}
.username {
margin: 0 20px;
font-size: 15px;
color: var(--el-header-text-color);
}
}
</style>
<template>
<el-dropdown trigger="click" @command="setAssemblySize">
<i :class="'iconfont icon-contentright'" class="toolBar-icon"></i>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
v-for="item in assemblySizeList"
:key="item.value"
:command="item.value"
:disabled="assemblySize === item.value"
>
{{ item.label }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<script setup lang="ts">
import { computed } from "vue";
import { useGlobalStore } from "@/stores/modules/global";
import { AssemblySizeType } from "@/stores/interface";
const globalStore = useGlobalStore();
const assemblySize = computed(() => globalStore.assemblySize);
const assemblySizeList = [
{ label: "默认", value: "default" },
{ label: "大型", value: "large" },
{ label: "小型", value: "small" }
];
const setAssemblySize = (item: AssemblySizeType) => {
if (assemblySize.value === item) return;
globalStore.setGlobalState("assemblySize", item);
};
</script>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 14:38:02
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-09-04 21:38:50
* @FilePath: \Apper-Admin-master\src\layouts\components\Header\components\Avatar.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<el-dropdown trigger="click">
<div class="avatar">
<img src="@/assets/images/avatar.gif" alt="avatar" />
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="openDialog('infoRef')">
<el-icon><User /></el-icon>{{ $t("header.personalData") }}
</el-dropdown-item>
<el-dropdown-item divided @click="logout">
<el-icon><SwitchButton /></el-icon>{{ $t("header.logout") }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<!-- infoDialog -->
<InfoDialog ref="infoRef"></InfoDialog>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { LOGIN_URL } from "@/config";
import { useRouter } from "vue-router";
import { logoutApi } from "@/api/modules/login";
import { useUserStore } from "@/stores/modules/user";
import { ElMessageBox, ElMessage } from "element-plus";
import InfoDialog from "./InfoDialog.vue";
const router = useRouter();
const userStore = useUserStore();
// 退出登录
const logout = () => {
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
// 1.执行退出登录接口
await logoutApi();
// 2.清除 Token
userStore.setToken("");
// 3.重定向到登陆页
router.replace(LOGIN_URL);
ElMessage.success("退出登录成功!");
});
};
// 打开修改密码和个人信息弹窗
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
const openDialog = (ref: string) => {
if (ref == "infoRef") infoRef.value?.openDialog();
};
</script>
<style scoped lang="scss">
.avatar {
width: 40px;
height: 40px;
overflow: hidden;
cursor: pointer;
border-radius: 50%;
img {
width: 100%;
height: 100%;
}
}
</style>
<template>
<div :class="['breadcrumb-box mask-image', !globalStore.breadcrumbIcon && 'no-icon']">
<el-breadcrumb :separator-icon="ArrowRight">
<transition-group name="breadcrumb">
<el-breadcrumb-item v-for="(item, index) in breadcrumbList" :key="item.path">
<div
class="el-breadcrumb__inner is-link"
:class="{ 'item-no-icon': !item.meta.icon }"
@click="onBreadcrumbClick(item, index)"
>
<el-icon v-if="item.meta.icon && globalStore.breadcrumbIcon" class="breadcrumb-icon">
<component :is="item.meta.icon"></component>
</el-icon>
<span class="breadcrumb-title">{{ item.meta.title }}</span>
</div>
</el-breadcrumb-item>
</transition-group>
</el-breadcrumb>
</div>
</template>
<script setup lang="ts">
import { computed } from "vue";
import { HOME_URL } from "@/config";
import { useRoute, useRouter } from "vue-router";
import { ArrowRight } from "@element-plus/icons-vue";
import { useAuthStore } from "@/stores/modules/auth";
import { useGlobalStore } from "@/stores/modules/global";
const route = useRoute();
const router = useRouter();
const authStore = useAuthStore();
const globalStore = useGlobalStore();
const breadcrumbList = computed(() => {
let breadcrumbData = authStore.breadcrumbListGet[route.matched[route.matched.length - 1].path] ?? [];
// 🙅‍♀️不需要首页面包屑可删除以下判断
if (breadcrumbData[0].path !== HOME_URL) {
breadcrumbData = [{ path: HOME_URL, meta: { icon: "HomeFilled", title: "首页" } }, ...breadcrumbData];
}
return breadcrumbData;
});
// Click Breadcrumb
const onBreadcrumbClick = (item: Menu.MenuOptions, index: number) => {
if (index !== breadcrumbList.value.length - 1) router.push(item.path);
};
</script>
<style scoped lang="scss">
.breadcrumb-box {
display: flex;
align-items: center;
overflow: hidden;
.el-breadcrumb {
white-space: nowrap;
.el-breadcrumb__item {
position: relative;
display: inline-block;
float: none;
.item-no-icon {
transform: translateY(-3px);
}
.el-breadcrumb__inner {
display: inline-flex;
&.is-link {
color: var(--el-header-text-color);
&:hover {
color: var(--el-color-primary);
}
}
.breadcrumb-icon {
margin-top: 1px;
margin-right: 6px;
font-size: 16px;
}
.breadcrumb-title {
margin-top: 2px;
}
}
&:last-child .el-breadcrumb__inner,
&:last-child .el-breadcrumb__inner:hover {
color: var(--el-header-text-color-regular);
}
:deep(.el-breadcrumb__separator) {
transform: translateY(-1px);
}
}
}
}
.no-icon {
.el-breadcrumb {
.el-breadcrumb__item {
top: -2px;
:deep(.el-breadcrumb__separator) {
top: 4px;
}
.item-no-icon {
transform: translateY(0);
}
}
}
}
</style>
<template>
<el-icon class="collapse-icon" @click="changeCollapse">
<component :is="globalStore.isCollapse ? 'expand' : 'fold'"></component>
</el-icon>
</template>
<script setup lang="ts">
import { useGlobalStore } from "@/stores/modules/global";
const globalStore = useGlobalStore();
const changeCollapse = () => globalStore.setGlobalState("isCollapse", !globalStore.isCollapse);
</script>
<style scoped lang="scss">
.collapse-icon {
margin-right: 20px;
font-size: 22px;
color: var(--el-header-text-color);
cursor: pointer;
}
</style>
<template>
<div class="fullscreen">
<i :class="['iconfont', isFullscreen ? 'icon-suoxiao' : 'icon-fangda']" class="toolBar-icon" @click="handleFullScreen"></i>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { ElMessage } from "element-plus";
import screenfull from "screenfull";
const isFullscreen = ref(screenfull.isFullscreen);
onMounted(() => {
screenfull.on("change", () => {
if (screenfull.isFullscreen) isFullscreen.value = true;
else isFullscreen.value = false;
});
});
const handleFullScreen = () => {
if (!screenfull.isEnabled) ElMessage.warning("当前您的浏览器不支持全屏 ❌");
screenfull.toggle();
};
</script>
<template>
<el-dialog v-model="dialogVisible" title="个人信息" width="500px" draggable>
<span>This is userInfo</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="dialogVisible = false">确认</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref } from "vue";
const dialogVisible = ref(false);
const openDialog = () => {
dialogVisible.value = true;
};
defineExpose({ openDialog });
</script>
<template>
<el-dropdown trigger="click" @command="changeLanguage">
<i :class="'iconfont icon-zhongyingwen'" class="toolBar-icon"></i>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
v-for="item in languageList"
:key="item.value"
:command="item.value"
:disabled="language === item.value"
>
{{ item.label }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<script setup lang="ts">
import { useI18n } from "vue-i18n";
import { computed } from "vue";
import { useGlobalStore } from "@/stores/modules/global";
import { LanguageType } from "@/stores/interface";
const i18n = useI18n();
const globalStore = useGlobalStore();
const language = computed(() => globalStore.language);
const languageList = [
{ label: "简体中文", value: "zh" },
{ label: "English", value: "en" }
];
const changeLanguage = (lang: string) => {
i18n.locale.value = lang;
globalStore.setGlobalState("language", lang as LanguageType);
};
</script>
<template>
<div class="message">
<el-popover placement="bottom" :width="310" trigger="click">
<template #reference>
<el-badge :value="0" class="item">
<i :class="'iconfont icon-xiaoxi'" class="toolBar-icon"></i>
</el-badge>
</template>
<el-tabs v-model="activeName">
<el-tab-pane label="通知(0)" name="first">
<div class="message-empty">
<img src="@/assets/images/notData.png" alt="notData" />
<div>暂无待办</div>
</div>
</el-tab-pane>
<el-tab-pane label="消息(0)" name="second">
<div class="message-empty">
<img src="@/assets/images/notData.png" alt="notData" />
<div>暂无消息</div>
</div>
</el-tab-pane>
<el-tab-pane label="待办(0)" name="third">
<div class="message-empty">
<img src="@/assets/images/notData.png" alt="notData" />
<div>暂无待办</div>
</div>
</el-tab-pane>
</el-tabs>
</el-popover>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
const activeName = ref("first");
</script>
<style scoped lang="scss">
.message-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 260px;
line-height: 45px;
}
.message-list {
display: flex;
flex-direction: column;
.message-item {
display: flex;
align-items: center;
padding: 20px 0;
border-bottom: 1px solid var(--el-border-color-light);
&:last-child {
border: none;
}
.message-icon {
width: 40px;
height: 40px;
margin: 0 20px 0 5px;
}
.message-content {
display: flex;
flex-direction: column;
.message-title {
margin-bottom: 5px;
}
.message-date {
font-size: 12px;
color: var(--el-text-color-secondary);
}
}
}
}
</style>
<template>
<div class="search-menu">
<i :class="'iconfont icon-sousuo'" class="toolBar-icon" @click="handleOpen"></i>
<el-dialog class="search-dialog" v-model="isShowSearch" :width="600" :show-close="false" top="10vh">
<el-input
v-model="searchMenu"
ref="menuInputRef"
placeholder="菜单搜索:支持菜单名称、路径"
size="large"
clearable
:prefix-icon="Search"
></el-input>
<div v-if="searchList.length" class="menu-list" ref="menuListRef">
<div
v-for="item in searchList"
:key="item.path"
:class="['menu-item', { 'menu-active': item.path === activePath }]"
@mouseenter="mouseoverMenuItem(item)"
@click="handleClickMenu()"
>
<div class="menu-lf">
<el-icon class="menu-icon">
<component :is="item.meta.icon"></component>
</el-icon>
<span class="menu-title">{{ item.meta.title }}</span>
</div>
<i :class="'iconfont icon-huiche'" class="menu-enter" @click="handleOpen"></i>
</div>
</div>
<el-empty v-else class="mt20 mb20" :image-size="100" description="暂无菜单" />
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ref, computed, nextTick, watch } from "vue";
import { InputInstance } from "element-plus";
import { Search } from "@element-plus/icons-vue";
import { useAuthStore } from "@/stores/modules/auth";
import { useRouter } from "vue-router";
import { useDebounceFn } from "@vueuse/core";
const router = useRouter();
const authStore = useAuthStore();
const menuList = computed(() => authStore.flatMenuListGet.filter(item => !item.meta.isHide));
const activePath = ref("");
const mouseoverMenuItem = (menu: Menu.MenuOptions) => {
activePath.value = menu.path;
};
const menuInputRef = ref<InputInstance | null>(null);
const isShowSearch = ref<boolean>(false);
const searchMenu = ref<string>("");
watch(isShowSearch, val => {
if (val) {
document.addEventListener("keydown", keyboardOperation);
} else {
document.removeEventListener("keydown", keyboardOperation);
}
});
const handleOpen = () => {
isShowSearch.value = true;
nextTick(() => {
setTimeout(() => {
menuInputRef.value?.focus();
});
});
};
const searchList = ref<Menu.MenuOptions[]>([]);
const updateSearchList = () => {
searchList.value = searchMenu.value
? menuList.value.filter(
item =>
(item.path.toLowerCase().includes(searchMenu.value.toLowerCase()) ||
item.meta.title.toLowerCase().includes(searchMenu.value.toLowerCase())) &&
!item.meta?.isHide
)
: [];
activePath.value = searchList.value.length ? searchList.value[0].path : "";
};
const debouncedUpdateSearchList = useDebounceFn(updateSearchList, 300);
watch(searchMenu, debouncedUpdateSearchList);
const menuListRef = ref<Element | null>(null);
const keyPressUpOrDown = (direction: number) => {
const length = searchList.value.length;
if (length === 0) return;
const index = searchList.value.findIndex(item => item.path === activePath.value);
const newIndex = (index + direction + length) % length;
activePath.value = searchList.value[newIndex].path;
nextTick(() => {
if (!menuListRef.value?.firstElementChild) return;
const menuItemHeight = menuListRef.value.firstElementChild.clientHeight + 12 || 0;
menuListRef.value.scrollTop = newIndex * menuItemHeight;
});
};
const keyboardOperation = (event: KeyboardEvent) => {
if (event.key === "ArrowUp") {
event.preventDefault();
keyPressUpOrDown(-1);
} else if (event.key === "ArrowDown") {
event.preventDefault();
keyPressUpOrDown(1);
} else if (event.key === "Enter") {
event.preventDefault();
handleClickMenu();
}
};
const handleClickMenu = () => {
const menu = searchList.value.find(item => item.path === activePath.value);
if (!menu) return;
if (menu.meta?.isLink) window.open(menu.meta.isLink, "_blank");
else router.push(menu.path);
searchMenu.value = "";
isShowSearch.value = false;
};
</script>
<style scoped lang="scss">
.search-menu {
:deep(.el-dialog) {
border-radius: 4px;
.el-dialog__header {
display: none;
}
}
.menu-list {
max-height: 515px;
margin-top: 15px;
overflow: auto;
.menu-item {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
height: 45px;
padding: 0 20px;
margin: 10px 0;
color: var(--el-text-color-secondary);
cursor: pointer;
background-color: transparent;
border: 1px solid var(--el-border-color);
border-radius: 6px;
transition: all 0.2s ease;
.menu-lf {
display: flex;
align-items: center;
}
.menu-icon {
margin-right: 8px;
font-size: 16px;
}
.menu-title {
font-size: 14px;
}
.menu-enter {
font-size: 17px;
}
}
.menu-active {
color: #ffffff;
background-color: var(--el-color-primary);
.menu-icon {
font-size: 18px;
}
.menu-title {
font-size: 16px;
}
.menu-enter {
font-size: 19px;
}
}
}
}
</style>
<template>
<div class="theme-setting">
<i :class="'iconfont icon-zhuti'" class="toolBar-icon" @click="openDrawer"></i>
</div>
</template>
<script setup lang="ts">
import mittBus from "@/utils/mittBus";
const openDrawer = () => {
mittBus.emit("openThemeDrawer");
};
</script>
<template>
<div class="maximize" @click="exitMaximize">
<i :class="'iconfont icon-tuichu'"></i>
</div>
</template>
<script setup lang="ts">
import { useGlobalStore } from "@/stores/modules/global";
const globalStore = useGlobalStore();
const exitMaximize = () => {
globalStore.setGlobalState("maximize", false);
};
</script>
<style scoped lang="scss">
.maximize {
position: fixed;
top: -25px;
right: -25px;
z-index: 999;
width: 55px;
height: 55px;
cursor: pointer;
background-color: var(--el-color-info);
border-radius: 50%;
opacity: 0.9;
&:hover {
background-color: var(--el-color-info-dark-2);
}
.iconfont {
position: relative;
top: 46%;
left: 19%;
font-size: 14px;
color: #ffffff;
}
}
</style>
.el-main {
box-sizing: border-box;
padding: 10px 12px;
overflow-x: hidden;
background-color: var(--el-bg-color-page);
}
.el-footer {
height: auto;
padding: 0;
}
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 14:38:02
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-09-04 18:06:37
* @FilePath: \Apper-Admin-master\src\layouts\components\Main\index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<Maximize v-show="maximize" />
<Tabs v-show="tabs" />
<el-main>
<router-view v-slot="{ Component, route }">
<transition appear name="fade-transform" mode="out-in">
<keep-alive :include="keepAliveName">
<component :is="createComponentWrapper(Component, route)" v-if="isRouterShow" :key="route.fullPath" />
</keep-alive>
</transition>
</router-view>
</el-main>
</template>
<script setup lang="ts">
import { ref, onBeforeUnmount, provide, watch, h } from "vue";
import { storeToRefs } from "pinia";
import { useDebounceFn } from "@vueuse/core";
import { useGlobalStore } from "@/stores/modules/global";
import { useKeepAliveStore } from "@/stores/modules/keepAlive";
import Maximize from "./components/Maximize.vue";
import Tabs from "@/layouts/components/Tabs/index.vue";
const globalStore = useGlobalStore();
const { maximize, isCollapse, layout, tabs } = storeToRefs(globalStore);
const keepAliveStore = useKeepAliveStore();
const { keepAliveName } = storeToRefs(keepAliveStore);
// 注入刷新页面方法
const isRouterShow = ref(true);
const refreshCurrentPage = (val: boolean) => (isRouterShow.value = val);
provide("refresh", refreshCurrentPage);
// 解决详情页 keep-alive 问题
const wrapperMap = new Map();
function createComponentWrapper(component, route) {
if (!component) return;
const wrapperName = route.fullPath;
let wrapper = wrapperMap.get(wrapperName);
if (!wrapper) {
wrapper = { name: wrapperName, render: () => h(component) };
wrapperMap.set(wrapperName, wrapper);
}
return h(wrapper);
}
// 监听当前页面是否最大化,动态添加 class
watch(
() => maximize.value,
() => {
const app = document.getElementById("app") as HTMLElement;
if (maximize.value) app.classList.add("main-maximize");
else app.classList.remove("main-maximize");
},
{ immediate: true }
);
// 监听布局变化,在 body 上添加相对应的 layout class
watch(
() => layout.value,
() => {
const body = document.body as HTMLElement;
body.setAttribute("class", layout.value);
},
{ immediate: true }
);
// 监听窗口大小变化,折叠侧边栏
const screenWidth = ref(0);
const listeningWindow = useDebounceFn(() => {
screenWidth.value = document.body.clientWidth;
if (!isCollapse.value && screenWidth.value < 1200) globalStore.setGlobalState("isCollapse", true);
if (isCollapse.value && screenWidth.value > 1200) globalStore.setGlobalState("isCollapse", false);
}, 100);
window.addEventListener("resize", listeningWindow, false);
onBeforeUnmount(() => {
window.removeEventListener("resize", listeningWindow);
});
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
<template>
<template v-for="subItem in menuList" :key="subItem.path">
<el-sub-menu v-if="subItem.children?.length" :index="subItem.path">
<template #title>
<el-icon v-if="subItem.meta.icon">
<component :is="subItem.meta.icon"></component>
</el-icon>
<span class="sle">{{ subItem.meta.title }}</span>
</template>
<SubMenu :menu-list="subItem.children" />
</el-sub-menu>
<el-menu-item v-else :index="subItem.path" @click="handleClickMenu(subItem)">
<el-icon v-if="subItem.meta.icon">
<component :is="subItem.meta.icon"></component>
</el-icon>
<template #title>
<span class="sle">{{ subItem.meta.title }}</span>
</template>
</el-menu-item>
</template>
</template>
<script setup lang="ts">
import { useRouter } from "vue-router";
defineProps<{ menuList: Menu.MenuOptions[] }>();
const router = useRouter();
const handleClickMenu = (subItem: Menu.MenuOptions) => {
if (subItem.meta.isLink) return window.open(subItem.meta.isLink, "_blank");
router.push(subItem.path);
};
</script>
<style lang="scss">
.el-sub-menu .el-sub-menu__title:hover {
color: var(--el-menu-hover-text-color) !important;
background-color: transparent !important;
}
.el-menu--collapse {
.is-active {
.el-sub-menu__title {
color: #ffffff !important;
background-color: var(--el-color-primary) !important;
}
}
}
.el-menu-item {
&:hover {
color: var(--el-menu-hover-text-color);
}
&.is-active {
color: var(--el-menu-active-color) !important;
background-color: var(--el-menu-active-bg-color) !important;
&::before {
position: absolute;
top: 0;
bottom: 0;
width: 4px;
content: "";
background-color: var(--el-color-primary);
}
}
}
.vertical,
.classic,
.transverse {
.el-menu-item {
&.is-active {
&::before {
left: 0;
}
}
}
}
.columns {
.el-menu-item {
&.is-active {
&::before {
right: 0;
}
}
}
}
</style>
<template>
<el-dropdown trigger="click" :teleported="false">
<div class="more-button">
<i :class="'iconfont icon-xiala'"></i>
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="refresh">
<el-icon><Refresh /></el-icon>{{ $t("tabs.refresh") }}
</el-dropdown-item>
<el-dropdown-item @click="maximize">
<el-icon><FullScreen /></el-icon>{{ $t("tabs.maximize") }}
</el-dropdown-item>
<el-dropdown-item divided @click="closeCurrentTab">
<el-icon><Remove /></el-icon>{{ $t("tabs.closeCurrent") }}
</el-dropdown-item>
<el-dropdown-item @click="tabStore.closeTabsOnSide(route.fullPath, 'left')">
<el-icon><DArrowLeft /></el-icon>{{ $t("tabs.closeLeft") }}
</el-dropdown-item>
<el-dropdown-item @click="tabStore.closeTabsOnSide(route.fullPath, 'right')">
<el-icon><DArrowRight /></el-icon>{{ $t("tabs.closeRight") }}
</el-dropdown-item>
<el-dropdown-item divided @click="tabStore.closeMultipleTab(route.fullPath)">
<el-icon><CircleClose /></el-icon>{{ $t("tabs.closeOther") }}
</el-dropdown-item>
<el-dropdown-item @click="closeAllTab">
<el-icon><FolderDelete /></el-icon>{{ $t("tabs.closeAll") }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<script setup lang="ts">
import { inject, nextTick } from "vue";
import { HOME_URL } from "@/config";
import { useTabsStore } from "@/stores/modules/tabs";
import { useGlobalStore } from "@/stores/modules/global";
import { useKeepAliveStore } from "@/stores/modules/keepAlive";
import { useRoute, useRouter } from "vue-router";
const route = useRoute();
const router = useRouter();
const tabStore = useTabsStore();
const globalStore = useGlobalStore();
const keepAliveStore = useKeepAliveStore();
// refresh current page
const refreshCurrentPage: Function = inject("refresh") as Function;
const refresh = () => {
setTimeout(() => {
route.meta.isKeepAlive && keepAliveStore.removeKeepAliveName(route.fullPath as string);
refreshCurrentPage(false);
nextTick(() => {
route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route.fullPath as string);
refreshCurrentPage(true);
});
}, 0);
};
// maximize current page
const maximize = () => {
globalStore.setGlobalState("maximize", true);
};
// Close Current
const closeCurrentTab = () => {
if (route.meta.isAffix) return;
tabStore.removeTabs(route.fullPath);
};
// Close All
const closeAllTab = () => {
tabStore.closeMultipleTab();
router.push(HOME_URL);
};
</script>
<style scoped lang="scss">
@import "../index.scss";
</style>
.tabs-box {
background-color: var(--el-bg-color);
.tabs-menu {
position: relative;
width: 100%;
.el-dropdown {
position: absolute;
top: 0;
right: 0;
bottom: 0;
.more-button {
display: flex;
align-items: center;
justify-content: center;
width: 43px;
cursor: pointer;
border-left: 1px solid var(--el-border-color-light);
transition: all 0.3s;
&:hover {
background-color: var(--el-color-info-light-9);
}
.iconfont {
font-size: 12.5px;
}
}
}
:deep(.el-tabs) {
.el-tabs__header {
box-sizing: border-box;
height: 40px;
padding: 0 10px;
margin: 0;
.el-tabs__nav-wrap {
position: absolute;
width: calc(100% - 70px);
.el-tabs__nav {
display: flex;
border: none;
.el-tabs__item {
display: flex;
align-items: center;
justify-content: center;
color: #afafaf;
border: none;
.tabs-icon {
margin: 1.5px 4px 0 0;
font-size: 15px;
}
.is-icon-close {
margin-top: 1px;
}
&.is-active {
color: var(--el-color-primary);
&::before {
position: absolute;
bottom: 0;
width: 100%;
height: 0;
content: "";
border-bottom: 2px solid var(--el-color-primary) !important;
}
}
}
}
}
}
}
}
}
<template>
<div class="tabs-box">
<div class="tabs-menu">
<el-tabs v-model="tabsMenuValue" type="card" @tab-click="tabClick" @tab-remove="tabRemove">
<el-tab-pane v-for="item in tabsMenuList" :key="item.path" :label="item.title" :name="item.path" :closable="item.close">
<template #label>
<el-icon v-if="item.icon && tabsIcon" class="tabs-icon">
<component :is="item.icon"></component>
</el-icon>
{{ item.title }}
</template>
</el-tab-pane>
</el-tabs>
<MoreButton />
</div>
</div>
</template>
<script setup lang="ts">
import Sortable from "sortablejs";
import { ref, computed, watch, onMounted } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useGlobalStore } from "@/stores/modules/global";
import { useTabsStore } from "@/stores/modules/tabs";
import { useAuthStore } from "@/stores/modules/auth";
import { TabsPaneContext, TabPaneName } from "element-plus";
import MoreButton from "./components/MoreButton.vue";
const route = useRoute();
const router = useRouter();
const tabStore = useTabsStore();
const authStore = useAuthStore();
const globalStore = useGlobalStore();
const tabsMenuValue = ref(route.fullPath);
const tabsMenuList = computed(() => tabStore.tabsMenuList);
const tabsIcon = computed(() => globalStore.tabsIcon);
onMounted(() => {
tabsDrop();
initTabs();
});
// 监听路由的变化(防止浏览器后退/前进不变化 tabsMenuValue)
watch(
() => route.fullPath,
() => {
if (route.meta.isFull) return;
tabsMenuValue.value = route.fullPath;
const tabsParams = {
icon: route.meta.icon as string,
title: route.meta.title as string,
path: route.fullPath,
name: route.name as string,
close: !route.meta.isAffix,
isKeepAlive: route.meta.isKeepAlive as boolean
};
tabStore.addTabs(tabsParams);
},
{ immediate: true }
);
// 初始化需要固定的 tabs
const initTabs = () => {
authStore.flatMenuListGet.forEach(item => {
if (item.meta.isAffix && !item.meta.isHide && !item.meta.isFull) {
const tabsParams = {
icon: item.meta.icon,
title: item.meta.title,
path: item.path,
name: item.name,
close: !item.meta.isAffix,
isKeepAlive: item.meta.isKeepAlive
};
tabStore.addTabs(tabsParams);
}
});
};
// tabs 拖拽排序
const tabsDrop = () => {
Sortable.create(document.querySelector(".el-tabs__nav") as HTMLElement, {
draggable: ".el-tabs__item",
animation: 300,
onEnd({ newIndex, oldIndex }) {
const tabsList = [...tabStore.tabsMenuList];
const currRow = tabsList.splice(oldIndex as number, 1)[0];
tabsList.splice(newIndex as number, 0, currRow);
tabStore.setTabs(tabsList);
}
});
};
// Tab Click
const tabClick = (tabItem: TabsPaneContext) => {
const fullPath = tabItem.props.name as string;
router.push(fullPath);
};
// Remove Tab
const tabRemove = (fullPath: TabPaneName) => {
tabStore.removeTabs(fullPath as string, fullPath == route.fullPath);
};
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
.divider {
margin-top: 15px;
.el-icon {
position: relative;
top: 2px;
right: 5px;
font-size: 15px;
}
}
.theme-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 5px;
margin: 14px 0;
span {
display: flex;
align-items: center;
font-size: 14px;
.el-icon {
margin-left: 3px;
font-size: 15px;
color: var(--el-text-color-regular);
cursor: pointer;
}
}
}
.layout-box {
position: relative;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 15px 7px 0;
.layout-item {
position: relative;
box-sizing: border-box;
width: 100px;
height: 70px;
padding: 6px;
cursor: pointer;
border-radius: 5px;
box-shadow: 0 0 5px 1px var(--el-border-color-dark);
transition: all 0.2s;
.layout-dark {
background-color: var(--el-color-primary);
border-radius: 3px;
}
.layout-light {
background-color: var(--el-color-primary-light-5);
border-radius: 3px;
}
.layout-content {
background-color: var(--el-color-primary-light-8);
border: 1px dashed var(--el-color-primary);
border-radius: 3px;
}
.el-icon {
position: absolute;
right: 10px;
bottom: 10px;
color: var(--el-color-primary);
transition: all 0.2s;
}
&:hover {
box-shadow: 0 0 5px 1px var(--el-text-color-secondary);
}
}
.is-active {
box-shadow: 0 0 0 2px var(--el-color-primary) !important;
}
.layout-vertical {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
.layout-dark {
width: 20%;
}
.layout-container {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 72%;
.layout-light {
height: 20%;
}
.layout-content {
height: 67%;
}
}
}
.layout-classic {
display: flex;
flex-direction: column;
justify-content: space-between;
margin-bottom: 20px;
.layout-dark {
height: 22%;
}
.layout-container {
display: flex;
justify-content: space-between;
height: 70%;
.layout-light {
width: 20%;
}
.layout-content {
width: 70%;
}
}
}
.layout-transverse {
display: flex;
flex-direction: column;
justify-content: space-between;
margin-bottom: 15px;
.layout-dark {
height: 20%;
}
.layout-content {
height: 67%;
}
}
.layout-columns {
display: flex;
justify-content: space-between;
margin-bottom: 15px;
.layout-dark {
width: 14%;
}
.layout-light {
width: 17%;
}
.layout-content {
width: 55%;
}
}
}
<template>
<el-drawer v-model="drawerVisible" title="布局设置" size="290px">
<!-- 布局样式 -->
<el-divider class="divider" content-position="center">
<el-icon><Notification /></el-icon>
布局样式
</el-divider>
<div class="layout-box">
<el-tooltip effect="dark" content="纵向" placement="top" :show-after="200">
<div :class="['layout-item layout-vertical', { 'is-active': layout == 'vertical' }]" @click="setLayout('vertical')">
<div class="layout-dark"></div>
<div class="layout-container">
<div class="layout-light"></div>
<div class="layout-content"></div>
</div>
<el-icon v-if="layout == 'vertical'">
<CircleCheckFilled />
</el-icon>
</div>
</el-tooltip>
<el-tooltip effect="dark" content="经典" placement="top" :show-after="200">
<div :class="['layout-item layout-classic', { 'is-active': layout == 'classic' }]" @click="setLayout('classic')">
<div class="layout-dark"></div>
<div class="layout-container">
<div class="layout-light"></div>
<div class="layout-content"></div>
</div>
<el-icon v-if="layout == 'classic'">
<CircleCheckFilled />
</el-icon>
</div>
</el-tooltip>
<el-tooltip effect="dark" content="横向" placement="top" :show-after="200">
<div :class="['layout-item layout-transverse', { 'is-active': layout == 'transverse' }]" @click="setLayout('transverse')">
<div class="layout-dark"></div>
<div class="layout-content"></div>
<el-icon v-if="layout == 'transverse'">
<CircleCheckFilled />
</el-icon>
</div>
</el-tooltip>
<el-tooltip effect="dark" content="分栏" placement="top" :show-after="200">
<div :class="['layout-item layout-columns', { 'is-active': layout == 'columns' }]" @click="setLayout('columns')">
<div class="layout-dark"></div>
<div class="layout-light"></div>
<div class="layout-content"></div>
<el-icon v-if="layout == 'columns'">
<CircleCheckFilled />
</el-icon>
</div>
</el-tooltip>
</div>
<div class="theme-item">
<span>
侧边栏反转色
<el-tooltip effect="dark" content="侧边栏颜色变为深色模式" placement="top">
<el-icon><QuestionFilled /></el-icon>
</el-tooltip>
</span>
<el-switch v-model="asideInverted" @change="setAsideTheme" />
</div>
<div class="theme-item mb50">
<span>
头部反转色
<el-tooltip effect="dark" content="头部颜色变为深色模式" placement="top">
<el-icon><QuestionFilled /></el-icon>
</el-tooltip>
</span>
<el-switch v-model="headerInverted" @change="setHeaderTheme" />
</div>
<!-- 全局主题 -->
<el-divider class="divider" content-position="center">
<el-icon><ColdDrink /></el-icon>
全局主题
</el-divider>
<div class="theme-item">
<span>主题颜色</span>
<el-color-picker v-model="primary" :predefine="colorList" @change="changePrimary" />
</div>
<div class="theme-item">
<span>暗黑模式</span>
<SwitchDark />
</div>
<div class="theme-item">
<span>灰色模式</span>
<el-switch v-model="isGrey" @change="changeGreyOrWeak('grey', !!$event)" />
</div>
<div class="theme-item mb40">
<span>色弱模式</span>
<el-switch v-model="isWeak" @change="changeGreyOrWeak('weak', !!$event)" />
</div>
<!-- 界面设置 -->
<el-divider class="divider" content-position="center">
<el-icon><Setting /></el-icon>
界面设置
</el-divider>
<div class="theme-item">
<span>菜单折叠</span>
<el-switch v-model="isCollapse" />
</div>
<div class="theme-item">
<span>菜单手风琴</span>
<el-switch v-model="accordion" />
</div>
<div class="theme-item">
<span>水印</span>
<el-switch v-model="watermark" />
</div>
<div class="theme-item">
<span>面包屑</span>
<el-switch v-model="breadcrumb" />
</div>
<div class="theme-item">
<span>面包屑图标</span>
<el-switch v-model="breadcrumbIcon" />
</div>
<div class="theme-item">
<span>标签栏</span>
<el-switch v-model="tabs" />
</div>
<div class="theme-item">
<span>标签栏图标</span>
<el-switch v-model="tabsIcon" />
</div>
</el-drawer>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { storeToRefs } from "pinia";
import { useTheme } from "@/hooks/useTheme";
import { useGlobalStore } from "@/stores/modules/global";
import { LayoutType } from "@/stores/interface";
import { DEFAULT_PRIMARY } from "@/config";
import mittBus from "@/utils/mittBus";
import SwitchDark from "@/components/SwitchDark/index.vue";
const { changePrimary, changeGreyOrWeak, setAsideTheme, setHeaderTheme } = useTheme();
const globalStore = useGlobalStore();
const {
layout,
primary,
isGrey,
isWeak,
asideInverted,
headerInverted,
isCollapse,
accordion,
watermark,
breadcrumb,
breadcrumbIcon,
tabs,
tabsIcon
} = storeToRefs(globalStore);
// 预定义主题颜色
const colorList = [
DEFAULT_PRIMARY,
"#daa96e",
"#0c819f",
"#409eff",
"#27ae60",
"#ff5c93",
"#e74c3c",
"#fd726d",
"#f39c12",
"#9b59b6"
];
// 设置布局方式
const setLayout = (val: LayoutType) => {
globalStore.setGlobalState("layout", val);
setAsideTheme();
};
// 打开主题设置
const drawerVisible = ref(false);
mittBus.on("openThemeDrawer", () => (drawerVisible.value = true));
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 14:38:02
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-09-04 16:35:23
* @FilePath: \Apper-Admin-master\src\layouts\index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!-- 💥 这里是一次性加载 LayoutComponents -->
<template>
<el-watermark id="watermark" :font="font" :content="watermark ? ['Happy Working'] : ''">
<component :is="LayoutComponents[layout]" />
<ThemeDrawer />
</el-watermark>
</template>
<script setup lang="ts" name="layout">
import { computed, reactive, watch, type Component } from "vue";
import { LayoutType } from "@/stores/interface";
import { useGlobalStore } from "@/stores/modules/global";
import ThemeDrawer from "./components/ThemeDrawer/index.vue";
import LayoutVertical from "./LayoutVertical/index.vue";
import LayoutClassic from "./LayoutClassic/index.vue";
import LayoutTransverse from "./LayoutTransverse/index.vue";
import LayoutColumns from "./LayoutColumns/index.vue";
const LayoutComponents: Record<LayoutType, Component> = {
vertical: LayoutVertical,
classic: LayoutClassic,
transverse: LayoutTransverse,
columns: LayoutColumns
};
const globalStore = useGlobalStore();
const isDark = computed(() => globalStore.isDark);
const layout = computed(() => globalStore.layout);
const watermark = computed(() => globalStore.watermark);
const font = reactive({ color: "rgba(0, 0, 0, .15)" });
watch(isDark, () => (font.color = isDark.value ? "rgba(255, 255, 255, .15)" : "rgba(0, 0, 0, .15)"), {
immediate: true
});
</script>
<style scoped lang="scss">
.layout {
min-width: 600px;
}
</style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 14:38:02
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-09-04 18:11:57
* @FilePath: \Apper-Admin-master\src\layouts\indexAsync.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!-- 💥 这里是异步加载 LayoutComponents -->
<template>
<el-watermark id="watermark" :font="font" :content="watermark ? ['Happy Working'] : ''">
<suspense>
<template #default>
<component :is="LayoutComponents[layout]" />
</template>
<template #fallback>
<Loading />
</template>
</suspense>
<ThemeDrawer />
</el-watermark>
</template>
<script setup lang="ts" name="layoutAsync">
import { computed, defineAsyncComponent, reactive, watch, type Component } from "vue";
import { LayoutType } from "@/stores/interface";
import { useGlobalStore } from "@/stores/modules/global";
import Loading from "@/components/Loading/index.vue";
import ThemeDrawer from "./components/ThemeDrawer/index.vue";
const LayoutComponents: Record<LayoutType, Component> = {
vertical: defineAsyncComponent(() => import("./LayoutVertical/index.vue")),
classic: defineAsyncComponent(() => import("./LayoutClassic/index.vue")),
transverse: defineAsyncComponent(() => import("./LayoutTransverse/index.vue")),
columns: defineAsyncComponent(() => import("./LayoutColumns/index.vue"))
};
const globalStore = useGlobalStore();
const isDark = computed(() => globalStore.isDark);
const layout = computed(() => globalStore.layout);
const watermark = computed(() => globalStore.watermark);
const font = reactive({ color: "rgba(0, 0, 0, .15)" });
watch(isDark, () => (font.color = isDark.value ? "rgba(255, 255, 255, .15)" : "rgba(0, 0, 0, .15)"), {
immediate: true
});
</script>
<style scoped lang="scss">
.layout {
min-width: 600px;
}
</style>
import { createApp } from "vue";
import App from "./App.vue";
// reset style sheet
import "@/styles/reset.scss";
// CSS common style sheet
import "@/styles/common.scss";
// iconfont css
import "@/assets/iconfont/iconfont.scss";
// font css
import "@/assets/fonts/font.scss";
// element css
import "element-plus/dist/index.css";
// element dark css
import "element-plus/theme-chalk/dark/css-vars.css";
// custom element dark css
import "@/styles/element-dark.scss";
// custom element css
import "@/styles/element.scss";
// svg icons
import "virtual:svg-icons-register";
// element plus
import ElementPlus from "element-plus";
// element icons
import * as Icons from "@element-plus/icons-vue";
// custom directives
import directives from "@/directives/index";
// vue Router
import router from "@/routers";
// vue i18n
import I18n from "@/languages/index";
// pinia store
import pinia from "@/stores";
// errorHandler
import errorHandler from "@/utils/errorHandler";
import { useGlobalStore } from "@/stores/modules/global";
import { fetchData } from "@/utils/mock";
const app = createApp(App);
app.config.errorHandler = errorHandler;
// register the element Icons component
Object.keys(Icons).forEach(key => {
app.component(key, Icons[key as keyof typeof Icons]);
});
app.use(ElementPlus).use(directives).use(router).use(I18n).use(pinia);
// 在挂载应用之前执行fetch操作
fetchData()
.then(initialData => {
const dataStore = useGlobalStore();
console.log(initialData, "initialData");
dataStore.setInitialData(initialData);
app.mount("#app");
})
.catch(error => {
// 处理fetch错误
console.error("Failed to fetch initial data:", error);
});
import { createRouter, createWebHashHistory, createWebHistory } from "vue-router";
import { useUserStore } from "@/stores/modules/user";
import { useAuthStore } from "@/stores/modules/auth";
import { LOGIN_URL, ROUTER_WHITE_LIST } from "@/config";
import { initDynamicRouter } from "@/routers/modules/dynamicRouter";
import { staticRouter, errorRouter } from "@/routers/modules/staticRouter";
import NProgress from "@/config/nprogress";
const mode = import.meta.env.VITE_ROUTER_MODE;
const routerMode = {
hash: () => createWebHashHistory(),
history: () => createWebHistory()
};
/**
* @description 📚 路由参数配置简介
* @param path ==> 路由菜单访问路径
* @param name ==> 路由 name (对应页面组件 name, 可用作 KeepAlive 缓存标识 && 按钮权限筛选)
* @param redirect ==> 路由重定向地址
* @param component ==> 视图文件路径
* @param meta ==> 路由菜单元信息
* @param meta.icon ==> 菜单和面包屑对应的图标
* @param meta.title ==> 路由标题 (用作 document.title || 菜单的名称)
* @param meta.activeMenu ==> 当前路由为详情页时,需要高亮的菜单
* @param meta.isLink ==> 路由外链时填写的访问地址
* @param meta.isHide ==> 是否在菜单中隐藏 (通常列表详情页需要隐藏)
* @param meta.isFull ==> 菜单是否全屏 (示例:数据大屏页面)
* @param meta.isAffix ==> 菜单是否固定在标签页中 (首页通常是固定项)
* @param meta.isKeepAlive ==> 当前路由是否缓存
* */
const router = createRouter({
history: routerMode[mode](),
routes: [...staticRouter, ...errorRouter],
strict: false,
scrollBehavior: () => ({ left: 0, top: 0 })
});
/**
* @description 路由拦截 beforeEach
* */
router.beforeEach(async (to, from, next) => {
const userStore = useUserStore();
const authStore = useAuthStore();
// 1.NProgress 开始
NProgress.start();
// 2.动态设置标题
const title = import.meta.env.VITE_GLOB_APP_TITLE;
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title;
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
if (userStore.token) return next(from.fullPath);
resetRouter();
return next();
}
// 4.判断访问页面是否在路由白名单地址(静态路由)中,如果存在直接放行
if (ROUTER_WHITE_LIST.includes(to.path)) return next();
// 5.判断是否有 Token,没有重定向到 login 页面
// if (!userStore.token) return next({ path: LOGIN_URL, replace: true });
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
if (!authStore.authMenuListGet.length) {
await initDynamicRouter();
return next({ ...to, replace: true });
}
// 7.存储 routerName 做按钮权限筛选
authStore.setRouteName(to.name as string);
// 8.正常访问页面
next();
});
/**
* @description 重置路由
* */
export const resetRouter = () => {
const authStore = useAuthStore();
authStore.flatMenuListGet.forEach(route => {
const { name } = route;
if (name && router.hasRoute(name)) router.removeRoute(name);
});
};
/**
* @description 路由跳转错误
* */
router.onError(error => {
NProgress.done();
console.warn("路由错误", error.message);
});
/**
* @description 路由跳转结束
* */
router.afterEach(() => {
NProgress.done();
});
export default router;
import router from "@/routers/index";
import { LOGIN_URL } from "@/config";
import { RouteRecordRaw } from "vue-router";
import { ElNotification } from "element-plus";
import { useUserStore } from "@/stores/modules/user";
import { useAuthStore } from "@/stores/modules/auth";
// 引入 views 文件夹下所有 vue 文件
const modules = import.meta.glob("@/views/**/*.vue");
/**
* @description 初始化动态路由
*/
export const initDynamicRouter = async () => {
const userStore = useUserStore();
const authStore = useAuthStore();
try {
// 1.获取菜单列表 && 按钮权限列表
await authStore.getAuthMenuList();
await authStore.getAuthButtonList();
// 2.判断当前用户有没有菜单权限
if (!authStore.authMenuListGet.length) {
ElNotification({
title: "无权限访问",
message: "当前账号无任何菜单权限,请联系系统管理员!",
type: "warning",
duration: 3000
});
userStore.setToken("");
router.replace(LOGIN_URL);
return Promise.reject("No permission");
}
// 3.添加动态路由
authStore.flatMenuListGet.forEach(item => {
item.children && delete item.children;
if (item.component && typeof item.component == "string") {
item.component = modules["/src/views" + item.component + ".vue"];
}
if (item.meta.isFull) {
router.addRoute(item as unknown as RouteRecordRaw);
} else {
router.addRoute("layout", item as unknown as RouteRecordRaw);
}
});
console.log(authStore);
} catch (error) {
// 当按钮 || 菜单请求出错时,重定向到登陆页
userStore.setToken("");
router.replace(LOGIN_URL);
return Promise.reject(error);
}
};
import { RouteRecordRaw } from "vue-router";
import { HOME_URL, LOGIN_URL } from "@/config";
/**
* staticRouter (静态路由)
*/
export const staticRouter: RouteRecordRaw[] = [
{
path: "/",
redirect: HOME_URL
},
{
path: LOGIN_URL,
name: "login",
component: () => import("@/views/login/index.vue"),
meta: {
title: "登录"
}
},
{
path: "/layout",
name: "layout",
component: () => import("@/layouts/index.vue"),
// component: () => import("@/layouts/indexAsync.vue"),
redirect: HOME_URL,
children: []
}
];
/**
* errorRouter (错误页面路由)
*/
export const errorRouter = [
{
path: "/403",
name: "403",
component: () => import("@/components/ErrorMessage/403.vue"),
meta: {
title: "403页面"
}
},
{
path: "/404",
name: "404",
component: () => import("@/components/ErrorMessage/404.vue"),
meta: {
title: "404页面"
}
},
{
path: "/500",
name: "500",
component: () => import("@/components/ErrorMessage/500.vue"),
meta: {
title: "500页面"
}
},
// Resolve refresh page, route warnings
{
path: "/:pathMatch(.*)*",
component: () => import("@/components/ErrorMessage/404.vue")
}
];
import { PersistedStateOptions } from "pinia-plugin-persistedstate";
/**
* @description pinia 持久化参数配置
* @param {String} key 存储到持久化的 name
* @param {Array} paths 需要持久化的 state name
* @return persist
* */
const piniaPersistConfig = (key: string, paths?: string[]) => {
const persist: PersistedStateOptions = {
key,
storage: localStorage,
// storage: sessionStorage,
paths
};
return persist;
};
export default piniaPersistConfig;
import { createPinia } from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
// pinia persist
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
export default pinia;
export type LayoutType = "vertical" | "classic" | "transverse" | "columns";
export type AssemblySizeType = "large" | "default" | "small";
export type LanguageType = "zh" | "en" | null;
interface axiosParams {
request: {
baseURL: string;
timeout: number;
withCredentials: boolean;
responseType: string;
};
}
/* GlobalState */
export interface GlobalState {
layout: LayoutType;
assemblySize: AssemblySizeType;
language: LanguageType;
maximize: boolean;
primary: string;
isDark: boolean;
isGrey: boolean;
isWeak: boolean;
asideInverted: boolean;
headerInverted: boolean;
isCollapse: boolean;
accordion: boolean;
watermark: boolean;
breadcrumb: boolean;
breadcrumbIcon: boolean;
tabs: boolean;
tabsIcon: boolean;
footer: boolean;
initialData: null | axiosParams;
}
/* UserState */
export interface UserState {
token: string;
userInfo: { name: string };
}
/* tabsMenuProps */
export interface TabsMenuProps {
icon: string;
title: string;
path: string;
name: string;
close: boolean;
isKeepAlive: boolean;
}
/* TabsState */
export interface TabsState {
tabsMenuList: TabsMenuProps[];
}
/* AuthState */
export interface AuthState {
routeName: string;
authButtonList: {
[key: string]: string[];
};
authMenuList: Menu.MenuOptions[];
}
/* KeepAliveState */
export interface KeepAliveState {
keepAliveName: string[];
}
import { defineStore } from "pinia";
import { AuthState } from "@/stores/interface";
import { getFlatMenuList, getShowMenuList, getAllBreadcrumbList } from "@/utils";
import { buttonList, menuList } from "./contant";
export const useAuthStore = defineStore({
id: "admin-auth",
state: (): AuthState => ({
// 按钮权限列表
authButtonList: {},
// 菜单权限列表
authMenuList: [],
// 当前页面的 router name,用来做按钮权限筛选
routeName: ""
}),
getters: {
// 按钮权限列表
authButtonListGet: state => state.authButtonList,
// 菜单权限列表 ==> 这里的菜单没有经过任何处理
authMenuListGet: state => state.authMenuList,
// 菜单权限列表 ==> 左侧菜单栏渲染,需要剔除 isHide == true
showMenuListGet: state => getShowMenuList(state.authMenuList),
// 菜单权限列表 ==> 扁平化之后的一维数组菜单,主要用来添加动态路由
flatMenuListGet: state => getFlatMenuList(state.authMenuList),
// 递归处理后的所有面包屑导航列表
breadcrumbListGet: state => getAllBreadcrumbList(state.authMenuList)
},
actions: {
// Get AuthButtonList
async getAuthButtonList() {
this.authButtonList = buttonList;
},
// Get AuthMenuList
async getAuthMenuList() {
this.authMenuList = menuList;
},
// Set RouteName
async setRouteName(name: string) {
this.routeName = name;
}
}
});
const menuList = [
{
path: "/home/index",
name: "home",
component: "/home/index",
meta: {
icon: "HomeFilled",
title: "首页",
isLink: "",
isHide: false,
isFull: false,
isAffix: true,
isKeepAlive: true
}
},
{
path: "/log",
name: "log",
redirect: "/log/list",
meta: {
icon: "List",
title: "日志管理",
isLink: "",
isHide: false,
isFull: false,
isAffix: false,
isKeepAlive: true
},
children: [
{
path: "/log/list",
name: "list",
component: "/log/list/index",
meta: {
icon: "Menu",
title: "设备列表",
isLink: "",
isHide: false,
isFull: false,
isAffix: false,
isKeepAlive: true
}
},
{
path: "/log/dictionary",
name: "dictionary",
component: "/log/dictionary/index",
meta: {
icon: "Menu",
title: "日志字段",
isLink: "",
isHide: false,
isFull: false,
isAffix: false,
isKeepAlive: true
}
}
]
}
];
const buttonList = {
useProTable: ["add", "batchAdd", "export", "batchDelete", "status"],
authButton: ["add", "edit", "delete", "import", "export"]
};
export { buttonList, menuList };
import { defineStore } from "pinia";
// 创建一个Pinia store来存储全局数据
const useDataStore = defineStore("dataStore", {
state: () => ({
initialData: null
}),
actions: {
setInitialData(data) {
this.initialData = data;
}
}
});
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 14:38:02
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-10-09 17:34:16
* @FilePath: \Apper-Admin-master\src\stores\modules\global.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { defineStore } from "pinia";
import { GlobalState } from "@/stores/interface";
import { DEFAULT_PRIMARY } from "@/config";
import piniaPersistConfig from "@/stores/helper/persist";
export const useGlobalStore = defineStore({
id: "apper-global",
// 修改默认值之后,需清除 localStorage 数据
state: (): GlobalState => ({
// 布局模式 (纵向:vertical | 经典:classic | 横向:transverse | 分栏:columns)
layout: "vertical",
// element 组件大小
assemblySize: "default",
// 当前系统语言
language: null,
// 当前页面是否全屏
maximize: false,
// 主题颜色
primary: DEFAULT_PRIMARY,
// 深色模式
isDark: false,
// 灰色模式
isGrey: false,
// 色弱模式
isWeak: false,
// 侧边栏反转
asideInverted: false,
// 头部反转
headerInverted: false,
// 折叠菜单
isCollapse: false,
// 菜单手风琴
accordion: true,
// 页面水印
watermark: false,
// 面包屑导航
breadcrumb: true,
// 面包屑导航图标
breadcrumbIcon: true,
// 标签页
tabs: true,
// 标签页图标
tabsIcon: true,
// 页脚
footer: true,
initialData: null
}),
getters: {},
actions: {
// Set GlobalState
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
this.$patch({ [args[0]]: args[1] });
},
setInitialData(data) {
this.initialData = data;
}
},
persist: piniaPersistConfig("apper-global")
});
import { defineStore } from "pinia";
import { KeepAliveState } from "@/stores/interface";
export const useKeepAliveStore = defineStore({
id: "apper-keepAlive",
state: (): KeepAliveState => ({
keepAliveName: []
}),
actions: {
// Add KeepAliveName
async addKeepAliveName(name: string) {
!this.keepAliveName.includes(name) && this.keepAliveName.push(name);
},
// Remove KeepAliveName
async removeKeepAliveName(name: string) {
this.keepAliveName = this.keepAliveName.filter(item => item !== name);
},
// Set KeepAliveName
async setKeepAliveName(keepAliveName: string[] = []) {
this.keepAliveName = keepAliveName;
}
}
});
import router from "@/routers";
import { defineStore } from "pinia";
import { getUrlWithParams } from "@/utils";
import { useKeepAliveStore } from "./keepAlive";
import { TabsState, TabsMenuProps } from "@/stores/interface";
import piniaPersistConfig from "@/stores/helper/persist";
const keepAliveStore = useKeepAliveStore();
export const useTabsStore = defineStore({
id: "apper-tabs",
state: (): TabsState => ({
tabsMenuList: []
}),
actions: {
// Add Tabs
async addTabs(tabItem: TabsMenuProps) {
if (this.tabsMenuList.every(item => item.path !== tabItem.path)) {
this.tabsMenuList.push(tabItem);
}
// add keepalive
if (!keepAliveStore.keepAliveName.includes(tabItem.name) && tabItem.isKeepAlive) {
keepAliveStore.addKeepAliveName(tabItem.path);
}
},
// Remove Tabs
async removeTabs(tabPath: string, isCurrent: boolean = true) {
if (isCurrent) {
this.tabsMenuList.forEach((item, index) => {
if (item.path !== tabPath) return;
const nextTab = this.tabsMenuList[index + 1] || this.tabsMenuList[index - 1];
if (!nextTab) return;
router.push(nextTab.path);
});
}
// remove keepalive
const tabItem = this.tabsMenuList.find(item => item.path === tabPath);
tabItem?.isKeepAlive && keepAliveStore.removeKeepAliveName(tabItem.path);
// set tabs
this.tabsMenuList = this.tabsMenuList.filter(item => item.path !== tabPath);
},
// Close Tabs On Side
async closeTabsOnSide(path: string, type: "left" | "right") {
const currentIndex = this.tabsMenuList.findIndex(item => item.path === path);
if (currentIndex !== -1) {
const range = type === "left" ? [0, currentIndex] : [currentIndex + 1, this.tabsMenuList.length];
this.tabsMenuList = this.tabsMenuList.filter((item, index) => {
return index < range[0] || index >= range[1] || !item.close;
});
}
// set keepalive
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive);
keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.path));
},
// Close MultipleTab
async closeMultipleTab(tabsMenuValue?: string) {
this.tabsMenuList = this.tabsMenuList.filter(item => {
return item.path === tabsMenuValue || !item.close;
});
// set keepalive
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive);
keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.path));
},
// Set Tabs
async setTabs(tabsMenuList: TabsMenuProps[]) {
this.tabsMenuList = tabsMenuList;
},
// Set Tabs Title
async setTabsTitle(title: string) {
this.tabsMenuList.forEach(item => {
if (item.path == getUrlWithParams()) item.title = title;
});
}
},
persist: piniaPersistConfig("apper-tabs")
});
import { defineStore } from "pinia";
import { UserState } from "@/stores/interface";
import piniaPersistConfig from "@/stores/helper/persist";
export const useUserStore = defineStore({
id: "apper-user",
state: (): UserState => ({
token: "",
userInfo: { name: "Apper" }
}),
getters: {},
actions: {
// Set Token
setToken(token: string) {
this.token = token;
},
// Set setUserInfo
setUserInfo(userInfo: UserState["userInfo"]) {
this.userInfo = userInfo;
}
},
persist: piniaPersistConfig("apper-user")
});
/* flex */
.flx-center {
display: flex;
align-items: center;
justify-content: center;
}
.flx-justify-between {
display: flex;
align-items: center;
justify-content: space-between;
}
.flx-align-center {
display: flex;
align-items: center;
}
/* clearfix */
.clearfix::after {
display: block;
height: 0;
overflow: hidden;
clear: both;
content: "";
}
/* 文字单行省略号 */
.sle {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 文字多行省略号 */
.mle {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
/* 文字多了自动換行 */
.break-word {
word-break: break-all;
word-wrap: break-word;
}
/* fade-transform */
.fade-transform-leave-active,
.fade-transform-enter-active {
transition: all 0.2s;
}
.fade-transform-enter-from {
opacity: 0;
transition: all 0.2s;
transform: translateX(-30px);
}
.fade-transform-leave-to {
opacity: 0;
transition: all 0.2s;
transform: translateX(30px);
}
/* breadcrumb-transform */
.breadcrumb-enter-active {
transition: all 0.2s;
}
.breadcrumb-enter-from,
.breadcrumb-leave-active {
opacity: 0;
transform: translateX(10px);
}
/* scroll bar */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-thumb {
background-color: var(--el-border-color-darker);
border-radius: 20px;
}
/* nprogress */
#nprogress .bar {
background: var(--el-color-primary) !important;
}
#nprogress .spinner-icon {
border-top-color: var(--el-color-primary) !important;
border-left-color: var(--el-color-primary) !important;
}
#nprogress .peg {
box-shadow:
0 0 10px var(--el-color-primary),
0 0 5px var(--el-color-primary) !important;
}
/* 外边距、内边距全局样式 */
@for $i from 0 through 100 {
.mt#{$i} {
margin-top: #{$i}px !important;
}
.mr#{$i} {
margin-right: #{$i}px !important;
}
.mb#{$i} {
margin-bottom: #{$i}px !important;
}
.ml#{$i} {
margin-left: #{$i}px !important;
}
.pt#{$i} {
padding-top: #{$i}px !important;
}
.pr#{$i} {
padding-right: #{$i}px !important;
}
.pb#{$i} {
padding-bottom: #{$i}px !important;
}
.pl#{$i} {
padding-left: #{$i}px !important;
}
}
/* 自定义 element 暗黑模式 */
html.dark {
/* wangEditor */
--w-e-toolbar-color: #eeeeee;
--w-e-toolbar-bg-color: #141414;
--w-e-textarea-bg-color: #141414;
--w-e-textarea-color: #eeeeee;
--w-e-toolbar-active-bg-color: #464646;
--w-e-toolbar-border-color: var(--el-border-color-darker);
.w-e-bar-item button:hover,
.w-e-menu-tooltip-v5::before {
color: #eeeeee;
}
/* login */
.login-container {
background-color: #191919 !important;
.login-box {
background-color: rgb(0 0 0 / 80%) !important;
.login-form {
box-shadow: rgb(255 255 255 / 12%) 0 2px 10px 2px !important;
.logo-text {
color: var(--el-text-color-primary) !important;
}
}
}
}
}
/* el-alert */
.el-alert {
border: 1px solid;
}
/* 当前页面最大化 css */
.main-maximize {
.aside-split,
.el-aside,
.el-header,
.el-footer,
.tabs-box {
display: none !important;
}
}
/* mask image */
.mask-image {
padding-right: 50px;
mask-image: linear-gradient(90deg, #000000 0%, #000000 calc(100% - 50px), transparent);
}
/* custom card */
.card {
box-sizing: border-box;
padding: 20px;
overflow-x: hidden;
background-color: var(--el-bg-color);
border: 1px solid var(--el-border-color-light);
border-radius: 6px;
box-shadow: 0 0 12px rgb(0 0 0 / 5%);
}
/* ProTable 不需要 card 样式(在组件内使用 ProTable 会使用到) */
.no-card {
.card {
padding: 0;
background-color: transparent;
border: none;
border-radius: 0;
box-shadow: none;
}
.table-search {
padding: 18px 0 0 !important;
margin-bottom: 0 !important;
}
}
/* content-box (常用内容盒子) */
.content-box {
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
.text {
margin: 20px 0 30px;
font-size: 23px;
font-weight: bold;
color: var(--el-text-color-regular);
}
.el-descriptions {
width: 100%;
padding: 40px 0 0;
.el-descriptions__title {
font-size: 18px;
}
.el-descriptions__label {
width: 200px;
}
}
}
/* main-box (树形表格 treeFilter 页面会使用,左右布局 flex) */
.main-box {
display: flex;
width: 100%;
height: 100%;
.table-box {
overflow: hidden;
}
}
/* proTable */
.table-box,
.table-main {
display: flex;
flex: 1;
flex-direction: column;
width: 100%;
height: 100%;
// table-search 表格搜索样式
.table-search {
padding: 18px 18px 0;
margin-bottom: 10px;
.el-form {
.el-form-item__content > * {
width: 100%;
}
// 去除时间选择器上下 padding
.el-range-editor.el-input__wrapper {
padding: 0 10px;
}
}
.operation {
display: flex;
align-items: center;
justify-content: flex-end;
margin-bottom: 18px;
}
}
// 表格 header 样式
.table-header {
.header-button-lf,
.header-button-ri {
display: flex;
flex-wrap: wrap;
gap: 15px 12px;
margin-bottom: 15px;
.el-button:not(.el-input .el-button) {
margin-left: 0;
}
}
.header-button-lf {
float: left;
}
.header-button-ri {
float: right;
}
}
// el-table 表格样式
.el-table {
flex: 1;
table {
width: 100%;
}
.el-table__header th {
height: 45px;
font-size: 15px;
font-weight: bold;
color: var(--el-text-color-primary);
background: var(--el-fill-color-light);
}
.el-table__row {
height: 45px;
font-size: 14px;
.move {
cursor: move;
.el-icon {
cursor: move;
}
}
}
// 设置 el-table 中 header 文字不换行,并省略
.el-table__header .el-table__cell > .cell {
// white-space: nowrap;
white-space: wrap;
}
// 解决表格数据为空时样式不居中问题(仅在element-plus中)
.el-table__empty-block {
position: absolute;
.table-empty {
line-height: 30px;
img {
display: inline-flex;
}
}
}
// table 中 image 图片样式
.table-image {
width: 50px;
height: 50px;
border-radius: 50%;
}
}
// 表格 pagination 样式
.el-pagination {
display: flex;
justify-content: flex-end;
margin-top: 20px;
}
}
/* el-table 组件大小 */
.el-table--small {
.el-table__header th {
height: 40px !important;
font-size: 14px !important;
}
.el-table__row {
height: 40px !important;
font-size: 13px !important;
}
}
.el-table--large {
.el-table__header th {
height: 50px !important;
font-size: 16px !important;
}
.el-table__row {
height: 50px !important;
font-size: 15px !important;
}
}
/* el-drawer */
.el-drawer {
.el-drawer__header {
padding: 16px 20px;
margin-bottom: 0;
border-bottom: 1px solid var(--el-border-color-lighter);
span {
font-size: 17px;
line-height: 17px;
color: var(--el-text-color-primary) !important;
}
}
.el-drawer__footer {
border-top: 1px solid var(--el-border-color-lighter);
}
// select 样式
.el-select {
width: 100%;
}
// drawer-form 中存在两列 form-item 样式
.drawer-multiColumn-form {
display: flex;
flex-wrap: wrap;
.el-form-item {
width: 47%;
&:nth-child(2n-1) {
margin-right: 5%;
}
}
}
}
/* el-dialog */
.el-dialog {
padding: 0;
.el-dialog__header {
padding: 15px 20px;
margin: 0;
border-bottom: 1px solid var(--el-border-color-lighter);
.el-dialog__title {
font-size: 17px;
}
}
.el-dialog__body,
.el-dialog__footer {
padding: 15px 20px;
}
}
/* Reset style sheet */
/* 目前项目中使用富文本编辑器需要注释,如果你项目中没有使用富文本编辑器,可以取消注释 */
// html,
// body,
// div,
// span,
// applet,
// object,
// iframe,
// h1,
// h2,
// h3,
// h4,
// h5,
// h6,
// p,
// blockquote,
// pre,
// a,
// abbr,
// acronym,
// address,
// big,
// cite,
// code,
// del,
// dfn,
// em,
// img,
// ins,
// kbd,
// q,
// s,
// samp,
// small,
// strike,
// strong,
// sub,
// sup,
// tt,
// var,
// b,
// u,
// i,
// center,
// dl,
// dt,
// dd,
// ol,
// ul,
// li,
// fieldset,
// form,
// label,
// legend,
// table,
// caption,
// tbody,
// tfoot,
// thead,
// tr,
// th,
// td,
// article,
// aside,
// canvas,
// details,
// embed,
// figure,
// figcaption,
// footer,
// header,
// hgroup,
// menu,
// nav,
// output,
// ruby,
// section,
// summary,
// time,
// mark,
// audio,
// video {
// padding: 0;
// margin: 0;
// font: inherit;
// font-size: 100%;
// vertical-align: baseline;
// border: 0;
// }
// /* HTML5 display-role reset for older browsers */
// article,
// aside,
// details,
// figcaption,
// figure,
// footer,
// header,
// hgroup,
// menu,
// nav,
// section {
// display: block;
// }
// body {
// padding: 0;
// margin: 0;
// }
// ol,
// ul {
// list-style: none;
// }
// blockquote,
// q {
// quotes: none;
// }
// blockquote::before,
// blockquote::after,
// q::before,
// q::after {
// content: "";
// content: none;
// }
// table {
// border-spacing: 0;
// border-collapse: collapse;
// }
html,
body,
#app,
#watermark {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
/* 解决 h1 标签在 webkit 内核浏览器中文字大小失效问题 */
:-webkit-any(article, aside, nav, section) h1 {
font-size: 2em;
}
import { Theme } from "@/hooks/interface";
export const asideTheme: Record<Theme.ThemeType, { [key: string]: string }> = {
light: {
"--el-aside-logo-text-color": "#303133",
"--el-aside-border-color": "#e4e7ed"
},
inverted: {
"--el-aside-logo-text-color": "#dadada",
"--el-aside-border-color": "#414243"
},
dark: {
"--el-aside-logo-text-color": "#dadada",
"--el-aside-border-color": "#414243"
}
};
import { Theme } from "@/hooks/interface";
export const headerTheme: Record<Theme.ThemeType, { [key: string]: string }> = {
light: {
"--el-header-logo-text-color": "#303133",
"--el-header-bg-color": "#ffffff",
"--el-header-text-color": "#303133",
"--el-header-text-color-regular": "#606266",
"--el-header-border-color": "#e4e7ed"
},
inverted: {
"--el-header-logo-text-color": "#dadada",
"--el-header-bg-color": "#191a20",
"--el-header-text-color": "#e5eaf3",
"--el-header-text-color-regular": "#cfd3dc",
"--el-header-border-color": "#414243"
},
dark: {
"--el-header-logo-text-color": "#dadada",
"--el-header-bg-color": "#141414",
"--el-header-text-color": "#e5eaf3",
"--el-header-text-color-regular": "#cfd3dc",
"--el-header-border-color": "#414243"
}
};
import { Theme } from "@/hooks/interface";
export const menuTheme: Record<Theme.ThemeType, { [key: string]: string }> = {
light: {
"--el-menu-bg-color": "#ffffff",
"--el-menu-hover-bg-color": "#cccccc",
"--el-menu-active-bg-color": "var(--el-color-primary-light-9)",
"--el-menu-text-color": "#333333",
"--el-menu-active-color": "var(--el-color-primary)",
"--el-menu-hover-text-color": "#333333",
"--el-menu-horizontal-sub-item-height": "50px"
},
inverted: {
"--el-menu-bg-color": "#191a20",
"--el-menu-hover-bg-color": "#000000",
"--el-menu-active-bg-color": "#000000",
"--el-menu-text-color": "#bdbdc0",
"--el-menu-active-color": "#ffffff",
"--el-menu-hover-text-color": "#ffffff",
"--el-menu-horizontal-sub-item-height": "50px"
},
dark: {
"--el-menu-bg-color": "#141414",
"--el-menu-hover-bg-color": "#000000",
"--el-menu-active-bg-color": "#000000",
"--el-menu-text-color": "#bdbdc0",
"--el-menu-active-color": "#ffffff",
"--el-menu-hover-text-color": "#ffffff",
"--el-menu-horizontal-sub-item-height": "50px"
}
};
/* global css variable */
$primary-color: var(--el-color-primary);
/* Menu */
declare namespace Menu {
interface MenuOptions {
path: string;
name: string;
component?: string | (() => Promise<unknown>);
redirect?: string;
meta: MetaProps;
children?: MenuOptions[];
}
interface MetaProps {
icon: string;
title: string;
activeMenu?: string;
isLink?: string;
isHide: boolean;
isFull: boolean;
isAffix: boolean;
isKeepAlive: boolean;
}
}
/* FileType */
declare namespace File {
type ImageMimeType =
| "image/apng"
| "image/bmp"
| "image/gif"
| "image/jpeg"
| "image/pjpeg"
| "image/png"
| "image/svg+xml"
| "image/tiff"
| "image/webp"
| "image/x-icon";
type ExcelMimeType = "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
}
/* Vite */
declare type Recordable<T = any> = Record<string, T>;
declare interface ViteEnv {
VITE_USER_NODE_ENV: "development" | "production" | "test";
VITE_GLOB_APP_TITLE: string;
VITE_PORT: number;
VITE_OPEN: boolean;
VITE_REPORT: boolean;
VITE_ROUTER_MODE: "hash" | "history";
VITE_BUILD_COMPRESS: "gzip" | "brotli" | "gzip,brotli" | "none";
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
VITE_DROP_CONSOLE: boolean;
VITE_PWA: boolean;
VITE_DEVTOOLS: boolean;
VITE_PUBLIC_PATH: string;
VITE_API_URL: string;
VITE_PROXY: [string, string][];
}
interface ImportMetaEnv extends ViteEnv {
__: unknown;
}
/* __APP_INFO__ */
declare const __APP_INFO__: {
pkg: {
name: string;
version: string;
dependencies: Recordable<string>;
devDependencies: Recordable<string>;
};
lastBuildTime: string;
};
type ObjToKeyValUnion<T> = {
[K in keyof T]: { key: K; value: T[K] };
}[keyof T];
type ObjToKeyValArray<T> = {
[K in keyof T]: [K, T[K]];
}[keyof T];
type ObjToSelectedValueUnion<T> = {
[K in keyof T]: T[K];
}[keyof T];
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
type GetOptional<T> = {
[P in keyof T as T[P] extends Required<T>[P] ? never : P]: T[P];
};
declare global {
interface Navigator {
msSaveOrOpenBlob: (blob: Blob, fileName: string) => void;
browserLanguage: string;
}
}
export {};
import { ElMessage } from "element-plus";
/**
* @description hex颜色转rgb颜色
* @param {String} str 颜色值字符串
* @returns {String} 返回处理后的颜色值
*/
export function hexToRgb(str: any) {
let hexs: any = "";
let reg = /^\#?[0-9A-Fa-f]{6}$/;
if (!reg.test(str)) return ElMessage.warning("输入错误的hex");
str = str.replace("#", "");
hexs = str.match(/../g);
for (let i = 0; i < 3; i++) hexs[i] = parseInt(hexs[i], 16);
return hexs;
}
/**
* @description rgb颜色转Hex颜色
* @param {*} r 代表红色
* @param {*} g 代表绿色
* @param {*} b 代表蓝色
* @returns {String} 返回处理后的颜色值
*/
export function rgbToHex(r: any, g: any, b: any) {
let reg = /^\d{1,3}$/;
if (!reg.test(r) || !reg.test(g) || !reg.test(b)) return ElMessage.warning("输入错误的rgb颜色值");
let hexs = [r.toString(16), g.toString(16), b.toString(16)];
for (let i = 0; i < 3; i++) if (hexs[i].length == 1) hexs[i] = `0${hexs[i]}`;
return `#${hexs.join("")}`;
}
/**
* @description 加深颜色值
* @param {String} color 颜色值字符串
* @param {Number} level 加深的程度,限0-1之间
* @returns {String} 返回处理后的颜色值
*/
export function getDarkColor(color: string, level: number) {
let reg = /^\#?[0-9A-Fa-f]{6}$/;
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
let rgb = hexToRgb(color);
for (let i = 0; i < 3; i++) rgb[i] = Math.round(20.5 * level + rgb[i] * (1 - level));
return rgbToHex(rgb[0], rgb[1], rgb[2]);
}
/**
* @description 变浅颜色值
* @param {String} color 颜色值字符串
* @param {Number} level 加深的程度,限0-1之间
* @returns {String} 返回处理后的颜色值
*/
export function getLightColor(color: string, level: number) {
let reg = /^\#?[0-9A-Fa-f]{6}$/;
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
let rgb = hexToRgb(color);
for (let i = 0; i < 3; i++) rgb[i] = Math.round(255 * level + rgb[i] * (1 - level));
return rgbToHex(rgb[0], rgb[1], rgb[2]);
}
// ? 系统全局字典
/**
* @description:用户性别
*/
export const genderType = [
{ label: "男", value: 1 },
{ label: "女", value: 2 }
];
/**
* @description:用户状态
*/
export const userStatus = [
{ label: "启用", value: 1, tagType: "success" },
{ label: "禁用", value: 0, tagType: "danger" }
];
/**
* @description:指令
*/
export const cmdList = [
{
value: "getLog",
label: "上传日志"
},
{
value: "getStorage",
label: "获取缓存"
},
{
value: "message",
label: "发送信息"
},
{
value: "getLogList",
label: "时间日志"
},
{
value: "removeLog",
label: "删除日志"
},
{
value: "removeRecord",
label: "删除记录"
},
{
value: "stopPolling",
label: "停止轮询"
},
{
value: "startPolling",
label: "开始轮询"
},
{
value: "setPollingInterval",
label: "设置轮询时间"
}
];
/**
* @description:缓存值
*/
export const storageList = [
{
value: "userInfo",
label: "个人信息"
},
{
value: "recordList",
label: "接待记录"
}
];
/**
* @description:表单类型
*/
export const formList = {
setPollingInterval: [
{
label: "设置轮询时间",
type: "number",
maxlength: 5,
name: "interval"
}
],
getLogList: [
{
label: "时间",
type: "daterange",
name: "times"
}
],
getStorage: [
{
label: "缓存字段",
type: "select",
optionList: storageList,
optionLabel: "label",
optionId: "value",
name: "key"
}
],
removeLog: [
{
label: "天数",
maxlength: 2,
type: "number",
name: "days"
}
],
removeRecord: [
{
label: "日志id",
maxlength: 50,
type: "input",
name: "id"
}
]
};
// ? Element 常用表单校验规则
/**
* @rule 手机号
*/
export function checkPhoneNumber(rule: any, value: any, callback: any) {
const regexp = /^(((13[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(17[3-8]{1})|(18[0-9]{1})|(19[0-9]{1})|(14[5-7]{1}))+\d{8})$/;
if (value === "") callback("请输入手机号码");
if (!regexp.test(value)) {
callback(new Error("请输入正确的手机号码"));
} else {
return callback();
}
}
import { ElNotification } from "element-plus";
/**
* @description 全局代码错误捕捉
* */
const errorHandler = (error: any) => {
// 过滤 HTTP 请求错误
if (error.status || error.status == 0) return false;
let errorMap: { [key: string]: string } = {
InternalError: "Javascript引擎内部错误",
ReferenceError: "未找到对象",
TypeError: "使用了错误的类型或对象",
RangeError: "使用内置对象时,参数超范围",
SyntaxError: "语法错误",
EvalError: "错误的使用了Eval",
URIError: "URI错误"
};
let errorName = errorMap[error.name] || "未知错误";
ElNotification({
title: errorName,
message: error,
type: "error",
duration: 3000
});
};
export default errorHandler;
import { isArray } from "@/utils/is";
import { FieldNamesProps } from "@/components/ProTable/interface";
const mode = import.meta.env.VITE_ROUTER_MODE;
/**
* @description 获取localStorage
* @param {String} key Storage名称
* @returns {String}
*/
export function localGet(key: string) {
const value = window.localStorage.getItem(key);
try {
return JSON.parse(window.localStorage.getItem(key) as string);
} catch (error) {
return value;
}
}
/**
* @description 存储localStorage
* @param {String} key Storage名称
* @param {*} value Storage值
* @returns {void}
*/
export function localSet(key: string, value: any) {
window.localStorage.setItem(key, JSON.stringify(value));
}
/**
* @description 清除localStorage
* @param {String} key Storage名称
* @returns {void}
*/
export function localRemove(key: string) {
window.localStorage.removeItem(key);
}
/**
* @description 清除所有localStorage
* @returns {void}
*/
export function localClear() {
window.localStorage.clear();
}
/**
* @description 判断数据类型
* @param {*} val 需要判断类型的数据
* @returns {String}
*/
export function isType(val: any) {
if (val === null) return "null";
if (typeof val !== "object") return typeof val;
else return Object.prototype.toString.call(val).slice(8, -1).toLocaleLowerCase();
}
/**
* @description 生成唯一 uuid
* @returns {String}
*/
export function generateUUID() {
let uuid = "";
for (let i = 0; i < 32; i++) {
let random = (Math.random() * 16) | 0;
if (i === 8 || i === 12 || i === 16 || i === 20) uuid += "-";
uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16);
}
return uuid;
}
/**
* 判断两个对象是否相同
* @param {Object} a 要比较的对象一
* @param {Object} b 要比较的对象二
* @returns {Boolean} 相同返回 true,反之 false
*/
export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]: any }) {
if (!a || !b) return false;
let aProps = Object.getOwnPropertyNames(a);
let bProps = Object.getOwnPropertyNames(b);
if (aProps.length != bProps.length) return false;
for (let i = 0; i < aProps.length; i++) {
let propName = aProps[i];
let propA = a[propName];
let propB = b[propName];
if (!b.hasOwnProperty(propName)) return false;
if (propA instanceof Object) {
if (!isObjectValueEqual(propA, propB)) return false;
} else if (propA !== propB) {
return false;
}
}
return true;
}
/**
* @description 生成随机数
* @param {Number} min 最小值
* @param {Number} max 最大值
* @returns {Number}
*/
export function randomNum(min: number, max: number): number {
let num = Math.floor(Math.random() * (min - max) + max);
return num;
}
/**
* @description 获取当前时间对应的提示语
* @returns {String}
*/
export function getTimeState() {
let timeNow = new Date();
let hours = timeNow.getHours();
if (hours >= 6 && hours <= 10) return `早上好 ⛅`;
if (hours >= 10 && hours <= 14) return `中午好 🌞`;
if (hours >= 14 && hours <= 18) return `下午好 🌞`;
if (hours >= 18 && hours <= 24) return `晚上好 🌛`;
if (hours >= 0 && hours <= 6) return `凌晨好 🌛`;
}
/**
* @description 获取浏览器默认语言
* @returns {String}
*/
export function getBrowserLang() {
let browserLang = navigator.language ? navigator.language : navigator.browserLanguage;
let defaultBrowserLang = "";
if (["cn", "zh", "zh-cn"].includes(browserLang.toLowerCase())) {
defaultBrowserLang = "zh";
} else {
defaultBrowserLang = "en";
}
return defaultBrowserLang;
}
/**
* @description 获取不同路由模式所对应的 url + params
* @returns {String}
*/
export function getUrlWithParams() {
const url = {
hash: location.hash.substring(1),
history: location.pathname + location.search
};
return url[mode];
}
/**
* @description 使用递归扁平化菜单,方便添加动态路由
* @param {Array} menuList 菜单列表
* @returns {Array}
*/
export function getFlatMenuList(menuList: Menu.MenuOptions[]): Menu.MenuOptions[] {
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList));
return newMenuList.flatMap(item => [item, ...(item.children ? getFlatMenuList(item.children) : [])]);
}
/**
* @description 使用递归过滤出需要渲染在左侧菜单的列表 (需剔除 isHide == true 的菜单)
* @param {Array} menuList 菜单列表
* @returns {Array}
* */
export function getShowMenuList(menuList: Menu.MenuOptions[]) {
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList));
return newMenuList.filter(item => {
item.children?.length && (item.children = getShowMenuList(item.children));
return !item.meta?.isHide;
});
}
/**
* @description 使用递归找出所有面包屑存储到 pinia/vuex 中
* @param {Array} menuList 菜单列表
* @param {Array} parent 父级菜单
* @param {Object} result 处理后的结果
* @returns {Object}
*/
export const getAllBreadcrumbList = (menuList: Menu.MenuOptions[], parent = [], result: { [key: string]: any } = {}) => {
for (const item of menuList) {
result[item.path] = [...parent, item];
if (item.children) getAllBreadcrumbList(item.children, result[item.path], result);
}
return result;
};
/**
* @description 使用递归处理路由菜单 path,生成一维数组 (第一版本地路由鉴权会用到,该函数暂未使用)
* @param {Array} menuList 所有菜单列表
* @param {Array} menuPathArr 菜单地址的一维数组 ['**','**']
* @returns {Array}
*/
export function getMenuListPath(menuList: Menu.MenuOptions[], menuPathArr: string[] = []): string[] {
for (const item of menuList) {
if (typeof item === "object" && item.path) menuPathArr.push(item.path);
if (item.children?.length) getMenuListPath(item.children, menuPathArr);
}
return menuPathArr;
}
/**
* @description 递归查询当前 path 所对应的菜单对象 (该函数暂未使用)
* @param {Array} menuList 菜单列表
* @param {String} path 当前访问地址
* @returns {Object | null}
*/
export function findMenuByPath(menuList: Menu.MenuOptions[], path: string): Menu.MenuOptions | null {
for (const item of menuList) {
if (item.path === path) return item;
if (item.children) {
const res = findMenuByPath(item.children, path);
if (res) return res;
}
}
return null;
}
/**
* @description 使用递归过滤需要缓存的菜单 name (该函数暂未使用)
* @param {Array} menuList 所有菜单列表
* @param {Array} keepAliveNameArr 缓存的菜单 name ['**','**']
* @returns {Array}
* */
export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNameArr: string[] = []) {
menuList.forEach(item => {
item.meta.isKeepAlive && item.name && keepAliveNameArr.push(item.name);
item.children?.length && getKeepAliveRouterName(item.children, keepAliveNameArr);
});
return keepAliveNameArr;
}
/**
* @description 格式化表格单元格默认值 (el-table-column)
* @param {Number} row 行
* @param {Number} col 列
* @param {*} callValue 当前单元格值
* @returns {String}
* */
export function formatTableColumn(row: number, col: number, callValue: any) {
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
return callValue ?? "--";
}
/**
* @description 处理 ProTable 值为数组 || 无数据
* @param {*} callValue 需要处理的值
* @returns {String}
* */
export function formatValue(callValue: any) {
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
return callValue ?? "--";
}
/**
* @description 处理 prop 为多级嵌套的情况,返回的数据 (列如: prop: user.name)
* @param {Object} row 当前行数据
* @param {String} prop 当前 prop
* @returns {*}
* */
export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string) {
if (!prop.includes(".")) return row[prop] ?? "--";
prop.split(".").forEach(item => (row = row[item] ?? "--"));
return row;
}
/**
* @description 处理 prop,当 prop 为多级嵌套时 ==> 返回最后一级 prop
* @param {String} prop 当前 prop
* @returns {String}
* */
export function handleProp(prop: string) {
const propArr = prop.split(".");
if (propArr.length == 1) return prop;
return propArr[propArr.length - 1];
}
/**
* @description 根据枚举列表查询当需要的数据(如果指定了 label 和 value 的 key值,会自动识别格式化)
* @param {String} callValue 当前单元格值
* @param {Array} enumData 字典列表
* @param {Array} fieldNames label && value && children 的 key 值
* @param {String} type 过滤类型(目前只有 tag)
* @returns {String}
* */
export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: "tag") {
const value = fieldNames?.value ?? "value";
const label = fieldNames?.label ?? "label";
const children = fieldNames?.children ?? "children";
let filterData: { [key: string]: any } = {};
// 判断 enumData 是否为数组
if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children);
// 判断是否输出的结果为 tag 类型
if (type == "tag") {
return filterData?.tagType ? filterData.tagType : "";
} else {
return filterData ? filterData[label] : "--";
}
}
/**
* @description 递归查找 callValue 对应的 enum 值
* */
export function findItemNested(enumData: any, callValue: any, value: string, children: string) {
return enumData.reduce((accumulator: any, current: any) => {
if (accumulator) return accumulator;
if (current[value] === callValue) return current;
if (current[children]) return findItemNested(current[children], callValue, value, children);
}, null);
}
/**
* @description: 判断值是否未某个类型
*/
export function is(val: unknown, type: string) {
return Object.prototype.toString.call(val) === `[object ${type}]`;
}
/**
* @description: 是否为函数
*/
export function isFunction<T = Function>(val: unknown): val is T {
return is(val, "Function");
}
/**
* @description: 是否已定义
*/
export const isDef = <T = unknown>(val?: T): val is T => {
return typeof val !== "undefined";
};
/**
* @description: 是否未定义
*/
export const isUnDef = <T = unknown>(val?: T): val is T => {
return !isDef(val);
};
/**
* @description: 是否为对象
*/
export const isObject = (val: any): val is Record<any, any> => {
return val !== null && is(val, "Object");
};
/**
* @description: 是否为时间
*/
export function isDate(val: unknown): val is Date {
return is(val, "Date");
}
/**
* @description: 是否为数值
*/
export function isNumber(val: unknown): val is number {
return is(val, "Number");
}
/**
* @description: 是否为AsyncFunction
*/
export function isAsyncFunction<T = any>(val: unknown): val is Promise<T> {
return is(val, "AsyncFunction");
}
/**
* @description: 是否为promise
*/
export function isPromise<T = any>(val: unknown): val is Promise<T> {
return is(val, "Promise") && isObject(val) && isFunction(val.then) && isFunction(val.catch);
}
/**
* @description: 是否为字符串
*/
export function isString(val: unknown): val is string {
return is(val, "String");
}
/**
* @description: 是否为boolean类型
*/
export function isBoolean(val: unknown): val is boolean {
return is(val, "Boolean");
}
/**
* @description: 是否为数组
*/
export function isArray(val: any): val is Array<any> {
return val && Array.isArray(val);
}
/**
* @description: 是否客户端
*/
export const isClient = () => {
return typeof window !== "undefined";
};
/**
* @description: 是否为浏览器
*/
export const isWindow = (val: any): val is Window => {
return typeof window !== "undefined" && is(val, "Window");
};
/**
* @description: 是否为 element 元素
*/
export const isElement = (val: unknown): val is Element => {
return isObject(val) && !!val.tagName;
};
/**
* @description: 是否为 null
*/
export function isNull(val: unknown): val is null {
return val === null;
}
/**
* @description: 是否为 null || undefined
*/
export function isNullOrUnDef(val: unknown): val is null | undefined {
return isUnDef(val) || isNull(val);
}
/**
* @description: 是否为 16 进制颜色
*/
export const isHexColor = (str: string) => {
return /^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(str);
};
import mitt from "mitt";
const mittBus = mitt();
export default mittBus;
export function fetchData() {
// 替换下面的URL为您需要获取数据的URL
return fetch("https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=app-admin-config").then(response => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
});
}
/**
* @description Loading Svg
*/
export const loadingSvg = `
<path class="path" d="
M 30 15
L 28 17
M 25.61 25.61
A 15 15, 0, 0, 1, 15 30
A 15 15, 0, 1, 1, 27.99 7.5
L 15 15
" style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
`;
.home {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
.home-bg {
width: 70%;
max-width: 1200px;
margin-bottom: 20px;
}
}
<template>
<div class="home card">
<img class="home-bg" src="@/assets/images/welcome.png" alt="welcome" />
</div>
</template>
<script setup lang="ts" name="home"></script>
<style scoped lang="scss">
@import "./index.scss";
</style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 21:13:18
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-09-25 16:06:16
* @FilePath: \Apper-Admin-master\src\views\log\dictionary\components\Dailog.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<el-dialog v-model="dialogVisible" width="30%" :title="`${dialogProps.title}字段`">
<el-form
ref="ruleFormRef"
label-width="120px"
label-suffix=" :"
:rules="rules"
:disabled="dialogProps.isView"
:model="dialogProps.row"
:hide-required-asterisk="dialogProps.isView"
>
<el-form-item label="字段名" prop="name">
<el-input v-model="dialogProps.row!.name" placeholder="请填写字段名" clearable></el-input>
</el-form-item>
<el-form-item label="字段值" prop="type">
<el-input v-model="dialogProps.row!.type" placeholder="请填写字段值" clearable></el-input>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialogVisible = false">取消</el-button>
<el-button v-show="!dialogProps.isView" type="primary" @click="handleSubmit">确定</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="DictionaryDailog">
import { ref, reactive } from "vue";
import { ElMessage, FormInstance } from "element-plus";
import { Fields } from "@/api/interface";
const rules = reactive({
name: [{ required: true, message: "请填写字段名" }],
type: [{ required: true, message: "请填写字段名类型" }]
});
interface DialogProps {
title: string;
isView: boolean;
row: Partial<Fields.ResFieldsList>;
api?: (params: any) => Promise<any>;
getTableList?: () => void;
}
const dialogVisible = ref(false);
const dialogProps = ref<DialogProps>({
isView: false,
title: "",
row: {}
});
// 接收父组件传过来的参数
const acceptParams = (params: DialogProps) => {
dialogProps.value = params;
dialogVisible.value = true;
};
// 提交数据(新增/编辑)
const ruleFormRef = ref<FormInstance>();
const handleSubmit = () => {
ruleFormRef.value!.validate(async valid => {
if (!valid) return;
try {
await dialogProps.value.api!(dialogProps.value.row);
ElMessage.success({ message: `${dialogProps.value.title}成功!` });
dialogProps.value.getTableList!();
dialogVisible.value = false;
} catch (error) {
console.log(error);
}
});
};
defineExpose({
acceptParams
});
</script>
<template>
<div class="table-box">
<ProTable ref="proTable" :columns="columns" :request-api="getTableList" :init-param="initParam" :data-callback="dataCallback">
<!-- 表格 header 按钮 -->
<template #tableHeader>
<el-button type="primary" :icon="CirclePlus" @click="openDailog('新增')">新增字段</el-button>
</template>
<!-- 表格操作 -->
<template #operation="scope">
<el-button type="primary" link :icon="EditPen" @click="openDailog('编辑', scope.row)">编辑</el-button>
<el-button type="primary" link :icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</ProTable>
<DeviceDrawer ref="dialogRef" />
</div>
</template>
<script setup lang="tsx" name="DictionaryProTable">
import { ref, reactive } from "vue";
import { Fields } from "@/api/interface";
import { useHandleData } from "@/hooks/useHandleData";
import ProTable from "@/components/ProTable/index.vue";
import DeviceDrawer from "./components/Dailog.vue";
import { ProTableInstance, ColumnProps } from "@/components/ProTable/interface";
import { CirclePlus, Delete, EditPen } from "@element-plus/icons-vue";
import { getList, fieldAdd } from "@/api/modules/fields";
// ProTable 实例
const proTable = ref<ProTableInstance>();
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
const initParam = reactive({});
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
const dataCallback = (data: any) => {
return {
list: data.data,
total: data.total
};
};
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getDeviceList"
const getTableList = (params: any) => {
let newParams = JSON.parse(JSON.stringify(params));
newParams.createTime && (newParams.startTime = newParams.createTime[0]);
newParams.createTime && (newParams.endTime = newParams.createTime[1]);
delete newParams.createTime;
return getList(newParams);
};
// 表格配置项
const columns = reactive<ColumnProps<Fields.ResFieldsList>[]>([
{
prop: "name",
label: "字段名"
},
{
prop: "type",
label: "字段值"
},
{ prop: "operation", label: "操作", fixed: "right", width: 330 }
]);
// 删除
const handleDelete = async (params: Fields.ResFieldsList) => {
await useHandleData(getList, { id: [params.id] }, `是否确定删除该记录?`);
proTable.value?.getTableList();
};
// 打开 drawer(新增、查看、编辑)
const dialogRef = ref<InstanceType<typeof DeviceDrawer> | null>(null);
const openDailog = (title: string, row: Partial<Fields.ResFieldsList> = {}) => {
const params = {
title,
isView: title === "查看",
row: { ...row },
api: title === "新增" ? fieldAdd : title === "编辑" ? fieldAdd : undefined,
getTableList: proTable.value?.getTableList
};
dialogRef.value?.acceptParams(params);
};
</script>
<template>
<el-dialog v-model="dialogVisible" width="30%" :title="`${dialogProps.title}`">
<el-form ref="ruleFormRef" label-width="120px" label-suffix=" :" :rules="rules" :model="dialogProps.row">
<el-form-item label="字段" prop="user_fields">
<el-select multiple v-model="dialogProps.row!.user_fields" placeholder="请选择字段" clearable>
<el-option v-for="item in getAllList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="日志存储时间" prop="log_saved_days">
<el-input-number v-model="dialogProps.row!.log_saved_days" :min="1" :max="100" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleSubmit">确定</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="logDailog">
import { ref, reactive } from "vue";
import { ElMessage, FormInstance } from "element-plus";
import { Device } from "@/api/interface";
import { getList } from "@/api/modules/fields";
const rules = reactive({
user_fields: [{ required: true, message: "请选择字段" }],
log_saved_days: [{ required: true, message: "请填写日志存储时间" }]
});
interface DialogParams {
user_fields: string[];
}
interface DialogProps {
title: string;
row: Partial<Device.ResDeviceList> & Partial<DialogParams>;
api?: (params: any) => Promise<any>;
getTableList?: () => void;
}
const dialogVisible = ref(false);
const getAllList = ref();
const dialogProps = ref<DialogProps>({
title: "",
row: {}
});
// 接收父组件传过来的参数
const acceptParams = async (params: DialogProps) => {
dialogProps.value = params;
dialogVisible.value = true;
const res = await getList({
pageNum: 1,
pageSize: 9999999
});
console.log(res);
getAllList.value = res.data;
};
// 提交数据(新增/编辑)
const ruleFormRef = ref<FormInstance>();
const handleSubmit = () => {
ruleFormRef.value!.validate(async valid => {
if (!valid) return;
try {
const { user_fields, log_saved_days, device_id } = dialogProps.value.row;
const params = {
user_fields,
device_id,
log_config: { log_saved_days }
};
await dialogProps.value.api!(params);
ElMessage.success({ message: `${dialogProps.value.title}成功!` });
dialogProps.value.getTableList!();
dialogVisible.value = false;
} catch (error) {
console.log(error);
}
});
};
defineExpose({
acceptParams
});
</script>
<template>
<el-dialog v-model="dialogVisible" width="30%" :title="`${dialogProps.title}`">
<el-form
ref="ruleFormRef"
label-width="120px"
label-suffix=" :"
:rules="rules"
:disabled="dialogProps.isView"
:model="dialogProps.row"
:hide-required-asterisk="dialogProps.isView"
>
<el-form-item label="设备号" prop="sn" v-if="!dialogProps.row!.device_id">
<el-input v-model="dialogProps.row!.sn" placeholder="请选择输入设备号" clearable></el-input>
</el-form-item>
<el-form-item label="用户名" prop="user">
<el-input v-model="dialogProps.row!.user" placeholder="请填写用户名" clearable></el-input>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="dialogProps.row!.mobile" maxlength="11" placeholder="请填写手机号" clearable></el-input>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialogVisible = false">取消</el-button>
<el-button v-show="!dialogProps.isView" type="primary" @click="handleSubmit">确定</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="logDailog">
import { ref, reactive } from "vue";
import { ElMessage, FormInstance } from "element-plus";
import { Device } from "@/api/interface";
const rules = reactive({
user: [{ required: true, message: "请填写用户名" }],
mobile: [{ required: true, message: "请填写手机号" }],
sn: [{ required: true, message: "请填写设备号" }]
});
interface DialogParams {
sn: string;
device_id: string;
}
interface DialogProps {
title: string;
isView: boolean;
row: Partial<Device.ResDeviceList> & Partial<DialogParams>;
api?: (params: any) => Promise<any>;
getTableList?: () => void;
}
const dialogVisible = ref(false);
// const getAllDeviceList = ref();
const dialogProps = ref<DialogProps>({
isView: false,
title: "",
row: {}
});
// 接收父组件传过来的参数
const acceptParams = async (params: DialogProps) => {
dialogProps.value = params;
dialogVisible.value = true;
// const res = await getDeviceList({
// pageNum: 1,
// pageSize: 9999999
// });
// getAllDeviceList.value = res.data;
};
// 提交数据(新增/编辑)
const ruleFormRef = ref<FormInstance>();
const handleSubmit = () => {
ruleFormRef.value!.validate(async valid => {
if (!valid) return;
try {
if (dialogProps.value.row!.device_id) {
delete dialogProps.value!.row.sn;
}
const { sn } = dialogProps.value.row;
await dialogProps.value.api!({ sn, device_info: dialogProps.value.row });
ElMessage.success({ message: `${dialogProps.value.title}成功!` });
dialogProps.value.getTableList!();
dialogVisible.value = false;
} catch (error) {
console.log(error);
}
});
};
defineExpose({
acceptParams
});
</script>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 21:13:18
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-09-27 21:05:51
* @FilePath: \Apper-Admin-master\src\views\log\dictionary\components\Dailog.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<el-dialog :before-close="handleClose" v-model="detailVisible" width="50%" title="日志详情">
<el-input v-model="detail" :rows="27" type="textarea" />
</el-dialog>
</template>
<script setup lang="ts" name="LogDetail">
import { toRefs } from "vue";
const props = defineProps<{
detailVisible: boolean;
detail: string;
}>();
const emit = defineEmits<{
(e: "close"): void;
}>();
const handleClose = () => {
emit("close");
};
const { detailVisible, detail } = toRefs(props);
</script>
<style lang="scss" scoped>
.table-box {
max-height: 80vh;
overflow-y: auto;
}
</style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 21:13:18
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-09-25 09:53:19
* @FilePath: \Apper-Admin-master\src\views\log\dictionary\components\Dailog.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<el-dialog :before-close="handleClose" v-model="showLog" width="50%" title="日志文件列表">
<el-table class="table-box" :data="tableData" style="width: 100%">
<el-table-column prop="filename" label="文件名" />
<el-table-column prop="created_at" label="日期" />
<el-table-column fixed="right" label="操作" width="120">
<template #default="scope">
<el-button link type="primary" size="small" @click="handleClick(scope.row)"> 详情 </el-button>
</template>
</el-table-column>
</el-table>
<Detail :detail-visible="detailVisible" v-if="detailVisible" @close="detailVisible = false" :detail="detail" />
</el-dialog>
</template>
<script setup lang="ts" name="LogFile">
import { FileList } from "@/api/modules/device";
import { toRefs, ref } from "vue";
import { Device } from "@/api/interface";
import Detail from "./Detail.vue";
const detailVisible = ref(false);
const detail = ref();
const props = defineProps<{
showLog: boolean;
deviceId: number;
}>();
const emit = defineEmits<{
(e: "close"): void;
}>();
let tableData = ref<Device.FileList[]>([]);
const handleClose = () => {
emit("close");
};
const handleClick = async (row: Device.FileList) => {
detailVisible.value = true;
detail.value = await getFileContent(row.path);
};
const getFileContent = async (url): Promise<string | void> => {
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error("Network response was not ok");
}
const text = await response.text();
console.log(text);
return text;
} catch (error) {
console.log(error);
}
};
const { showLog, deviceId } = toRefs(props);
FileList({ device_id: deviceId.value }).then(res => {
tableData.value = res.data as Device.FileList[];
});
</script>
<style lang="scss" scoped>
.table-box {
max-height: 60vh;
overflow-y: auto;
}
</style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 21:58:42
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-10-10 15:02:47
* @FilePath: \Apper-Admin-master\src\views\log\list\components\Report.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-04 21:13:18
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-09-05 09:40:12
* @FilePath: \Apper-Admin-master\src\views\log\dictionary\components\Dailog.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<el-dialog v-model="showReport" width="30%" :before-close="handleClose" title="开启通信">
<el-form
ref="ruleFormRef"
label-width="120px"
label-suffix=" :"
:rules="rules"
:model="dialogProps"
:hide-required-asterisk="dialogProps"
>
<el-form-item label="指令" prop="command">
<el-select v-model="dialogProps.command" placeholder="请选择日志字段" clearable>
<el-option v-for="item in cmdList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<template v-for="(item, index) in formList[dialogProps.command]" :key="index">
<el-form-item :label="item.label" :prop="item.value">
<el-select v-model="dialogProps[item.name]" placeholder="请选择" v-if="item.type === 'select'" clearable>
<el-option
v-for="i in item.optionList"
:key="i[item.optionId]"
:label="i[item.optionLabel]"
:value="i[item.optionId]"
/></el-select>
<el-input
v-model="dialogProps[item.name]"
:maxlength="item.maxlength"
placeholder="请输入"
v-if="item.type === 'input'"
clearable
></el-input>
<el-input-number v-model="dialogProps[item.name]" v-if="item.type === 'number'" :min="1" />
<el-date-picker
v-model="dialogProps[item.name]"
type="daterange"
v-if="item.type === 'daterange'"
range-separator="至"
value-format="YYYY-MM-DD"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
</template>
</el-form>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleSubmit">确定</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="logReport">
import { ref, reactive, toRefs, watch } from "vue";
import { FormInstance } from "element-plus";
import { useCmd } from "@/hooks/useCmd";
import { cmdList } from "@/utils/dict";
import { formList } from "@/utils/dict";
const rules = reactive({
command: [{ required: true, message: "请选择指令" }],
storage: [{ required: true, message: "请用户信息" }],
days: [{ required: true, message: "请填写上报日志天数" }]
});
interface DialogProps {
id?: string;
days?: number | null;
interval?: number;
command?: string;
key?: string;
storage?: string;
times?: string[];
beginDate?: string;
endDate?: string;
}
const props = defineProps<{
showReport: boolean;
deviceId: number;
}>();
const { showReport, deviceId } = toRefs(props);
console.log(deviceId);
const dialogProps = ref<DialogProps>({});
watch(
() => dialogProps.value.command,
val => {
console.log(val);
}
);
const emit = defineEmits<{
(e: "close"): void;
}>();
const handleClose = () => {
emit("close");
};
// 提交数据
const ruleFormRef = ref<FormInstance>();
const handleSubmit = () => {
ruleFormRef.value!.validate(async valid => {
if (!valid) return;
try {
let { times } = dialogProps.value;
const data = dialogProps.value;
if (times) {
Object.assign(data, { beginDate: times[0], endDate: times[1] });
}
const params = {
event: "private",
device_id: deviceId.value,
data
};
await useCmd(params);
handleClose();
} catch (error) {
console.log(error);
handleClose();
} finally {
handleClose();
}
});
};
</script>
<template>
<div class="table-box">
<ProTable ref="proTable" :columns="columns" :request-api="getTableList" :init-param="initParam" :data-callback="dataCallback">
<!-- 表格 header 按钮 -->
<template #tableHeader>
<el-button type="primary" :icon="CirclePlus" @click="openDailog('新增设备')">新增设备</el-button>
</template>
<!-- 表格操作 -->
<template #operation="scope">
<el-button type="primary" link @click="openReport(scope.row)">通信</el-button>
<el-button type="primary" link @click="openLog(scope.row)">日志文件</el-button>
<el-button type="primary" link @click="openConfig('更新配置', scope.row)">更新配置</el-button>
<!-- <el-button type="primary" link @click="openDailog('查看', scope.row)">查看</el-button> -->
<el-button type="primary" link @click="openDailog('更新设备信息', scope.row)">更新设备信息</el-button>
<!-- <el-button type="primary" link @click="handleDelete(scope.row)">删除</el-button> -->
<!-- <el-button type="primary" link @click="sendCmd(scope.row)">上报信息</el-button> -->
</template>
</ProTable>
<Dialog ref="dialogRef" />
<Config ref="configRef" />
<Report ref="reportRef" :show-report="showReport" v-if="showReport" @close="showReport = false" :device-id="deviceId" />
<LogFile ref="logFileRef" :show-log="showLog" v-if="showLog" @close="showLog = false" :device-id="deviceId" />
</div>
</template>
<script setup lang="tsx" name="logProTable">
import { ref, reactive } from "vue";
import { Device } from "@/api/interface";
// import { useHandleData } from "@/hooks/useHandleData";
import ProTable from "@/components/ProTable/index.vue";
import Dialog from "./components/Dailog.vue";
import Config from "./components/Config.vue";
import LogFile from "./components/LogFile.vue";
import Report from "./components/Report.vue";
import { ProTableInstance, ColumnProps } from "@/components/ProTable/interface";
import { CirclePlus } from "@element-plus/icons-vue";
import { getDeviceList, editDevice, addDevice } from "@/api/modules/device";
// import { useCmd } from "@/hooks/useCmd";
// import useWebSocket from "@/hooks/useWebSocket";
// const socketUrl = import.meta.env.VITE_API_URL + "/ws/device";
// ProTable 实例
const proTable = ref<ProTableInstance>();
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
const initParam = reactive({});
const showLog = ref<boolean>(false);
let showReport = ref<boolean>(false);
const deviceId = ref<number>(0);
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
const dataCallback = (data: any) => {
return {
list: data.data,
total: data.total
};
};
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getDeviceList"
const getTableList = (params: any) => {
let newParams = JSON.parse(JSON.stringify(params));
return getDeviceList(newParams);
};
// 表格配置项
const columns = reactive<ColumnProps<Device.ResDeviceList>[]>([
{
prop: "user",
label: "用户名",
search: { el: "input", props: { placeholder: "请输入用户名", maxlength: 15 } }
},
{
prop: "mobile",
label: "手机号",
search: { el: "input", props: { placeholder: "请输入手机号", maxlength: 11 } }
},
{ prop: "sn", label: "设备编号" },
{
prop: "log_saved_days",
label: "日志存储时间",
render: scope => {
return scope.row.log_saved_days;
},
width: 120
},
{
prop: "last_log_remove_time",
label: "删除日志时间",
render: scope => {
return new Date(scope.row.last_log_remove_time).toLocaleString();
}
},
{
prop: "last_log_upload_time",
label: "上传日志时间",
render: scope => {
return new Date(scope.row.last_log_upload_time).toLocaleString();
}
},
{
prop: "last_offline_time",
label: "上次上线时间",
render: scope => {
return new Date(scope.row.last_offline_time).toLocaleString();
}
},
{
prop: "last_login_time",
label: "上次登录时间",
render: scope => {
return new Date(scope.row.last_login_time).toLocaleString();
}
},
{
prop: "status",
label: "在线状态",
width: 90,
render: scope => {
return <el-tag type={scope.row.status == 1 ? "success" : "danger"}>{scope.row.status == 1 ? "在线" : "离线"}</el-tag>;
}
},
{ prop: "operation", label: "操作", fixed: "right", width: 320 }
]);
// 删除
// const handleDelete = async (params: Device.ResDeviceList) => {
// await useHandleData(deleteDevice, { id: [params.id] }, `是否确定删除该记录?`);
// proTable.value?.getTableList();
// };
// 打开 dialog(新增、查看、编辑)
const dialogRef = ref<InstanceType<typeof Dialog> | null>(null);
const openDailog = (title: string, row: Partial<Device.ResDeviceList> = {}) => {
const { sn, user, mobile, id: device_id } = row;
const params = {
title,
isView: title === "查看",
row: { sn, user, mobile, device_id },
api: title === "新增设备" ? addDevice : title === "更新设备信息" ? editDevice : undefined,
getTableList: proTable.value?.getTableList
};
dialogRef.value?.acceptParams(params);
};
//打开 dialog(配置)
const configRef = ref<InstanceType<typeof Config> | null>(null);
const openConfig = (title: string, row: Partial<Device.ResDeviceList> = {}) => {
const params = {
title,
row: { device_id: row.id, log_saved_days: row.log_saved_days },
api: editDevice,
getTableList: proTable.value?.getTableList
};
configRef.value?.acceptParams(params);
};
const reportRef = ref<InstanceType<typeof Report> | null>(null);
const openReport = (row: Partial<Device.ResDeviceList> = {}) => {
showReport.value = true;
deviceId.value = row.id!;
};
const openLog = (row: Partial<Device.ResDeviceList> = {}) => {
showLog.value = true;
deviceId.value = row.id!;
};
// const sendCmd = async (row: Partial<Device.ResDeviceList> = {}) => {
// await useCmd({
// device_id: row.id!,
// event: "private",
// data: { command: "getStorage", key: "recordList" }
// });
// };
// //websocket连接
// const { sendMessage } = useWebSocket(socketUrl, (message: any) => {
// console.log(message);
// });
// // sendMessage 数据推送方法
// //向成功连接的服务端推送数据
// sendMessage({ filed: "hello" });
</script>
<template>
<el-form ref="loginFormRef" :model="loginForm" :rules="loginRules" size="large">
<el-form-item prop="username">
<el-input v-model="loginForm.username" placeholder="用户名:admin / user">
<template #prefix>
<el-icon class="el-input__icon">
<user />
</el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" placeholder="密码:123456" show-password autocomplete="new-password">
<template #prefix>
<el-icon class="el-input__icon">
<lock />
</el-icon>
</template>
</el-input>
</el-form-item>
</el-form>
<div class="login-btn">
<el-button :icon="CircleClose" round size="large" @click="resetForm(loginFormRef)"> 重置 </el-button>
<el-button :icon="UserFilled" round size="large" type="primary" :loading="loading" @click="login(loginFormRef)">
登录
</el-button>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, onBeforeUnmount } from "vue";
import { useRouter } from "vue-router";
import { HOME_URL } from "@/config";
// import { getTimeState } from "@/utils";
import { Login } from "@/api/interface";
// import { ElNotification } from "element-plus";
import { loginApi } from "@/api/modules/login";
import { useUserStore } from "@/stores/modules/user";
import { useTabsStore } from "@/stores/modules/tabs";
import { useKeepAliveStore } from "@/stores/modules/keepAlive";
import { initDynamicRouter } from "@/routers/modules/dynamicRouter";
import { CircleClose, UserFilled } from "@element-plus/icons-vue";
import type { ElForm } from "element-plus";
import md5 from "md5";
const router = useRouter();
const userStore = useUserStore();
const tabsStore = useTabsStore();
const keepAliveStore = useKeepAliveStore();
type FormInstance = InstanceType<typeof ElForm>;
const loginFormRef = ref<FormInstance>();
const loginRules = reactive({
username: [{ required: true, message: "请输入用户名", trigger: "blur" }],
password: [{ required: true, message: "请输入密码", trigger: "blur" }]
});
const loading = ref(false);
const loginForm = reactive<Login.ReqLoginForm>({
username: "",
password: ""
});
// login
const login = (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.validate(async valid => {
if (!valid) return;
loading.value = true;
try {
// 1.执行登录接口
const { data } = await loginApi({ ...loginForm, password: md5(loginForm.password) });
userStore.setToken(data.access_token);
// 2.添加动态路由
await initDynamicRouter();
// 3.清空 tabs、keepAlive 数据
tabsStore.setTabs([]);
keepAliveStore.setKeepAliveName([]);
// 4.跳转到首页
router.push(HOME_URL);
} finally {
loading.value = false;
}
});
};
// resetForm
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.resetFields();
};
onMounted(() => {
// 监听 enter 事件(调用登录)
document.onkeydown = (e: KeyboardEvent) => {
if (e.code === "Enter" || e.code === "enter" || e.code === "NumpadEnter") {
if (loading.value) return;
login(loginFormRef.value);
}
};
});
onBeforeUnmount(() => {
document.onkeydown = null;
});
</script>
<style scoped lang="scss">
@import "../index.scss";
</style>
.login-container {
height: 100%;
min-height: 550px;
background-color: #eeeeee;
background-image: url("@/assets/images/login_bg.svg");
background-size: 100% 100%;
background-size: cover;
.login-box {
position: relative;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-around;
width: 96.5%;
height: 94%;
padding: 0 50px;
background-color: rgb(255 255 255 / 80%);
border-radius: 10px;
.dark {
position: absolute;
top: 13px;
right: 18px;
}
.login-left {
width: 800px;
margin-right: 10px;
.login-left-img {
width: 100%;
height: 100%;
}
}
.login-form {
width: 420px;
padding: 50px 40px 45px;
background-color: var(--el-bg-color);
border-radius: 10px;
box-shadow: rgb(0 0 0 / 10%) 0 2px 10px 2px;
.login-logo {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 45px;
.login-icon {
width: 60px;
height: 52px;
}
.logo-text {
padding: 0 0 0 25px;
margin: 0;
font-size: 30px;
font-weight: bold;
color: #34495e;
white-space: nowrap;
}
}
.el-form-item {
margin-bottom: 40px;
}
.login-btn {
display: flex;
justify-content: space-between;
width: 100%;
margin-top: 40px;
white-space: nowrap;
.el-button {
width: 185px;
}
}
}
}
}
@media screen and (width <= 1250px) {
.login-left {
display: none;
}
}
@media screen and (width <= 600px) {
.login-form {
width: 97% !important;
}
}
<template>
<div class="login-container flx-center">
<div class="login-box">
<SwitchDark class="dark" />
<div class="login-left">
<img class="login-left-img" src="@/assets/images/login_left.png" alt="login" />
</div>
<div class="login-form">
<div class="login-logo">
<h2 class="logo-text">展业助手后台管理系统</h2>
</div>
<LoginForm />
</div>
</div>
</div>
</template>
<script setup lang="ts" name="login">
import LoginForm from "./components/LoginForm.vue";
import SwitchDark from "@/components/SwitchDark/index.vue";
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
/// <reference types="vite/client" />
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"moduleResolution": "Node",
"types": ["vite/client", "element-plus/global"],
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
"noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */,
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
"jsx": "preserve",
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["ESNext", "DOM"],
"skipLibCheck": true,
"noEmit": true,
"baseUrl": "./",
"paths": {
"@": ["src"],
"@/*": ["src/*"]
}
},
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx",
"src/**/*.vue",
"build/**/*.ts",
"build/**/*.d.ts",
"vite.config.ts"
],
"exclude": ["node_modules", "dist", "**/*.js"]
}
import { defineConfig, loadEnv, ConfigEnv, UserConfig } from "vite";
import { resolve } from "path";
import { wrapperEnv } from "./build/getEnv";
import { createProxy } from "./build/proxy";
import { createVitePlugins } from "./build/plugins";
import pkg from "./package.json";
import dayjs from "dayjs";
const { dependencies, devDependencies, name, version } = pkg;
const __APP_INFO__ = {
pkg: { dependencies, devDependencies, name, version },
lastBuildTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
};
// @see: https://vitejs.dev/config/
export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
const root = process.cwd();
const env = loadEnv(mode, root);
const viteEnv = wrapperEnv(env);
return {
base: viteEnv.VITE_PUBLIC_PATH,
root,
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
"vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js"
}
},
define: {
__APP_INFO__: JSON.stringify(__APP_INFO__)
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@/styles/var.scss";`
}
}
},
server: {
host: "0.0.0.0",
port: viteEnv.VITE_PORT,
open: viteEnv.VITE_OPEN,
cors: true,
// Load proxy configuration from .env.development
proxy: createProxy(viteEnv.VITE_PROXY)
},
plugins: createVitePlugins(viteEnv),
esbuild: {
pure: viteEnv.VITE_DROP_CONSOLE ? ["console.log", "debugger"] : []
},
build: {
outDir: "dist",
minify: "esbuild",
// esbuild 打包更快,但是不能去除 console.log,terser打包慢,但能去除 console.log
// minify: "terser",
// terserOptions: {
// compress: {
// drop_console: viteEnv.VITE_DROP_CONSOLE,
// drop_debugger: true
// }
// },
sourcemap: false,
// 禁用 gzip 压缩大小报告,可略微减少打包时间
reportCompressedSize: false,
// 规定触发警告的 chunk 大小
chunkSizeWarningLimit: 2000,
rollupOptions: {
output: {
// Static resource classification and packaging
chunkFileNames: "assets/js/[name]-[hash].js",
entryFileNames: "assets/js/[name]-[hash].js",
assetFileNames: "assets/[ext]/[name]-[hash].[ext]"
}
}
}
};
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!