Migrated repository
Go to file
2024-11-26 09:56:12 +08:00
.husky feat: 新增 commitlint,修改部分规则 2022-06-15 17:09:40 +08:00
.workflow fix: 补充丢失的flow文件 2022-12-22 19:43:24 +08:00
build Merge branch 'dev' into master-fetch-dev 2022-12-16 12:56:28 +08:00
plop fix: 修改plop模板的错误 2022-05-21 13:43:31 +08:00
public docs: 修改文档路径 2022-05-06 20:23:08 +08:00
readme docs: 修改 readme 图片展示 2022-08-10 16:05:34 +08:00
src Merge branch 'master-fetch-dev' into master-fetch 2024-11-26 09:56:12 +08:00
types Merge branch 'dev' into master-fetch-dev 2024-03-14 12:09:36 +08:00
.commitlintrc.js feat: 新增 commitlint,修改部分规则 2022-06-15 17:09:40 +08:00
.env fix: 修改地址 2022-11-02 21:33:20 +08:00
.eslintignore fix:路由处理,CSS处理,样式处理,全局变量处理 2021-12-14 15:53:30 +08:00
.eslintrc.js feat: 添加图层模式控制选项 2022-09-27 20:14:00 +08:00
.gitignore style: 优化 pr_200 代码 2023-09-03 18:02:01 +08:00
index.css perf: 去除屏幕大小处理 2022-10-01 17:26:52 +08:00
index.html feat: 处理移动端拖拽 2024-04-26 16:54:36 +08:00
LICENSE update LICENSE. 2022-08-29 12:19:15 +00:00
Makefile feat: 新增 preview 模式 2022-06-15 17:30:24 +08:00
package.json build: 修改版本号到2.2.8 2024-03-14 12:10:07 +08:00
pnpm-lock.yaml Merge branch 'dev' into master-fetch-dev 2023-12-17 20:46:33 +08:00
prettier.config.js feat: 新增 commitlint,修改部分规则 2022-06-15 17:09:40 +08:00
README.md Merge branch 'dev' into master-fetch-dev 2023-05-28 15:59:08 +08:00
tsconfig.json fix: 解决 TS 类型错误问题 2023-06-27 18:11:37 +08:00
vite.config.ts !222 build.brotliSize(改为了 build.reportCompressedSize) 2024-03-06 11:04:44 +08:00

总览

master-fetch 分支是带有后端接口请求的分支

后端项目地址:https://gitee.com/MTrun/go-view-serve

接口说明地址:https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb

使用

所有的接口地址位置:src\api\path\*

接口地址修改:.env

# port
VITE_DEV_PORT = '8080'

# development path
VITE_DEV_PATH = 'http://127.0.0.1:8080'

# production path
VITE_PRO_PATH = 'http://127.0.0.1:8080'

公共前缀修改:src\settings\httpSetting.ts

// 请求前缀
export const axiosPre = '/api/goview'

接口封装:src\api\http.ts

import axiosInstance from './axios'
import { RequestHttpEnum, ContentTypeEnum } from '@/enums/httpEnum'

export const get = (url: string, params?: object) => {
  return axiosInstance({
    url: url,
    method: RequestHttpEnum.GET,
    params: params,
  })
}

export const post = (url: string, data?: object, headersType?: string) => {
  return axiosInstance({
    url: url,
    method: RequestHttpEnum.POST,
    data: data,
    headers: {
      'Content-Type': headersType || ContentTypeEnum.JSON
    }
  })
}

export const put = (url: string, data?: object, headersType?: string) => {
  return axiosInstance({
    url: url,
    method: RequestHttpEnum.PUT,
    data: data,
    headers: {
      'Content-Type': headersType || ContentTypeEnum.JSON
    }
  })
}

export const del = (url: string, params?: object) => {
  return axiosInstance({
    url: url,
    method: RequestHttpEnum.DELETE,
    params
  })
}

// 获取请求函数默认get
export const http = (type?: RequestHttpEnum) => {
  switch (type) {
    case RequestHttpEnum.GET:
      return get

    case RequestHttpEnum.POST:
      return post

    case RequestHttpEnum.PUT:
      return put

    case RequestHttpEnum.DELETE:
      return del

    default:
      return get
  }
}

代码提交

  • feat: 新功能
  • fix: 修复 Bug
  • docs: 文档修改
  • perf: 性能优化
  • revert: 版本回退
  • ci: CICD集成相关
  • test: 添加测试代码
  • refactor: 代码重构
  • build: 影响项目构建或依赖修改
  • style: 不影响程序逻辑的代码修改
  • chore: 不属于以上类型的其他类型(日常事务)

交流

QQ 群1030129384

QQ群

渲染海报