添加gitignore
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
|||||||
|
# 依赖目录
|
||||||
|
node_modules/
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# 构建产物
|
||||||
|
dist/
|
||||||
|
dist-ssr/
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# 日志
|
||||||
|
logs/
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# 本地环境变量(含敏感信息,不提交)
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# 编辑器 / IDE 目录和文件
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea/
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
# 操作系统文件
|
||||||
|
Thumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# 缓存
|
||||||
|
.cache/
|
||||||
|
.temp/
|
||||||
|
*.tsbuildinfo
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
import{r as e,a as r,o as t,c as o,b as s,w as n,F as i,d as l,e as a,t as c,f as u,g as d}from"./vendor.3763ac43.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const t of e)if("childList"===t.type)for(const e of t.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerpolicy&&(r.referrerPolicy=e.referrerpolicy),"use-credentials"===e.crossorigin?r.credentials="include":"anonymous"===e.crossorigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();const f=l("img",{alt:"Vue logo",src:"/assets/logo.03d6d6da.png"},null,-1),p=u({setup(l){const u=e("Hello Element Plus via Vite");return(e,l)=>{const d=r("el-button");return t(),o(i,null,[f,s(d,{type:"primary"},{default:n((()=>[a(c(u.value),1)])),_:1})],64)}}});p.use(d),p.mount("#app");
|
|
||||||
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 6.7 KiB |
Vendored
-39
File diff suppressed because one or more lines are too long
Vendored
+15
-16
@@ -1,16 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<title>Element Plus Demo</title>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<script type="module" crossorigin src="/assets/index.a712a2e4.js"></script>
|
<title>设备管理系统</title>
|
||||||
<link rel="modulepreload" href="/assets/vendor.3763ac43.js">
|
<script type="module" crossorigin src="/assets/index-BhGvW7tT.js"></script>
|
||||||
<link rel="stylesheet" href="/assets/index.a7868d2c.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-BpBnxyAz.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<!-- 引入 Vite 的核心模块入口 -->
|
<!-- Vite 入口,指向 src/main.js,不要删除 -->␍
|
||||||
|
</body>
|
||||||
</body>
|
</html>
|
||||||
</html>
|
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>设备管理系统</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<!-- Vite 入口,指向 src/main.js,不要删除 -->
|
||||||
|
<script type="module" src="/src/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 设备列表
|
||||||
|
export const getEquipmentList = (params) => request.get('/equipment/list', { params })
|
||||||
|
|
||||||
|
// 设备详情
|
||||||
|
export const getEquipmentDetail = (id) => request.get(`/equipment/${id}`)
|
||||||
|
|
||||||
|
// 新增设备
|
||||||
|
export const addEquipment = (data) => request.post('/equipment', data)
|
||||||
|
|
||||||
|
// 修改设备
|
||||||
|
export const updateEquipment = (id, data) => request.put(`/equipment/${id}`, data)
|
||||||
|
|
||||||
|
// 删除设备
|
||||||
|
export const deleteEquipment = (id) => request.delete(`/equipment/${id}`)
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
|
||||||
|
// 创建 axios 实例
|
||||||
|
const request = axios.create({
|
||||||
|
baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
|
||||||
|
timeout: 10000
|
||||||
|
})
|
||||||
|
|
||||||
|
// 请求拦截器:发请求前统一加 token
|
||||||
|
request.interceptors.request.use(config => {
|
||||||
|
const token = localStorage.getItem('token')
|
||||||
|
if (token) config.headers.Authorization = `Bearer ${token}`
|
||||||
|
return config
|
||||||
|
})
|
||||||
|
|
||||||
|
// 响应拦截器:统一处理返回结构和错误(全局处理放这里)
|
||||||
|
request.interceptors.response.use(
|
||||||
|
response => {
|
||||||
|
const res = response.data
|
||||||
|
// 假设后端统一返回 { code, data, message }
|
||||||
|
if (res.code !== 0) {
|
||||||
|
ElMessage.error(res.message || '请求失败')
|
||||||
|
return Promise.reject(new Error(res.message))
|
||||||
|
}
|
||||||
|
// 直接返回 data,页面拿到的就是干净数据,不用每次再 .data
|
||||||
|
return res.data
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
ElMessage.error(error.message || '网络错误')
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export default request
|
||||||
Binary file not shown.
Reference in New Issue
Block a user