Compare commits
3 Commits
f1934ba444
...
9d4581a2b5
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d4581a2b5 | |||
| 3e13b4f7b0 | |||
| 7138838183 |
@@ -10,7 +10,7 @@
|
||||
"host": "",
|
||||
"basePath": "",
|
||||
"paths": {
|
||||
"/devices": {
|
||||
"/api/v1/devices": {
|
||||
"get": {
|
||||
"description": "获取系统中所有设备的列表",
|
||||
"produces": [
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/devices/{id}": {
|
||||
"/api/v1/devices/{id}": {
|
||||
"get": {
|
||||
"description": "根据设备ID获取单个设备的详细信息",
|
||||
"produces": [
|
||||
@@ -157,7 +157,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans": {
|
||||
"/api/v1/plans": {
|
||||
"get": {
|
||||
"description": "获取所有计划的列表",
|
||||
"produces": [
|
||||
@@ -209,7 +209,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}": {
|
||||
"/api/v1/plans/{id}": {
|
||||
"get": {
|
||||
"description": "根据计划ID获取单个计划的详细信息。",
|
||||
"produces": [
|
||||
@@ -304,7 +304,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}/start": {
|
||||
"/api/v1/plans/{id}/start": {
|
||||
"post": {
|
||||
"description": "根据计划ID启动一个计划的执行。",
|
||||
"produces": [
|
||||
@@ -333,7 +333,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}/stop": {
|
||||
"/api/v1/plans/{id}/stop": {
|
||||
"post": {
|
||||
"description": "根据计划ID停止一个正在执行的计划。",
|
||||
"produces": [
|
||||
@@ -362,7 +362,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users": {
|
||||
"/api/v1/users": {
|
||||
"post": {
|
||||
"description": "根据用户名和密码创建一个新的系统用户。",
|
||||
"consumes": [
|
||||
@@ -396,7 +396,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users/login": {
|
||||
"/api/v1/users/login": {
|
||||
"post": {
|
||||
"description": "用户使用用户名和密码登录,成功后返回 JWT 令牌。",
|
||||
"consumes": [
|
||||
@@ -650,6 +650,10 @@
|
||||
"type": "string",
|
||||
"example": "根据温度自动调节风扇和加热器"
|
||||
},
|
||||
"execute_num": {
|
||||
"type": "integer",
|
||||
"example": 10
|
||||
},
|
||||
"execution_type": {
|
||||
"allOf": [
|
||||
{
|
||||
@@ -863,6 +867,10 @@
|
||||
"type": "string",
|
||||
"example": "更新后的描述"
|
||||
},
|
||||
"execute_num": {
|
||||
"type": "integer",
|
||||
"example": 10
|
||||
},
|
||||
"execution_type": {
|
||||
"allOf": [
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ export class DeviceApi {
|
||||
* @returns {Promise} 设备列表
|
||||
*/
|
||||
static list() {
|
||||
return http.get('/devices');
|
||||
return http.get('/api/v1/devices');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ export class DeviceApi {
|
||||
* @returns {Promise} 创建结果
|
||||
*/
|
||||
static create(deviceData) {
|
||||
return http.post('/devices', deviceData);
|
||||
return http.post('/api/v1/devices', deviceData);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ export class DeviceApi {
|
||||
* @returns {Promise} 设备详情
|
||||
*/
|
||||
static get(id) {
|
||||
return http.get(`/devices/${id}`);
|
||||
return http.get(`/api/v1/devices/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ export class DeviceApi {
|
||||
* @returns {Promise} 更新结果
|
||||
*/
|
||||
static update(id, deviceData) {
|
||||
return http.put(`/devices/${id}`, deviceData);
|
||||
return http.put(`/api/v1/devices/${id}`, deviceData);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ export class DeviceApi {
|
||||
* @returns {Promise} 删除结果
|
||||
*/
|
||||
static delete(id) {
|
||||
return http.delete(`/devices/${id}`);
|
||||
return http.delete(`/api/v1/devices/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export class PlanApi {
|
||||
* @returns {Promise} 计划列表
|
||||
*/
|
||||
static list() {
|
||||
return http.get('/plans');
|
||||
return http.get('/api/v1/plans');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ export class PlanApi {
|
||||
* @returns {Promise} 创建结果
|
||||
*/
|
||||
static create(planData) {
|
||||
return http.post('/plans', planData);
|
||||
return http.post('/api/v1/plans', planData);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ export class PlanApi {
|
||||
* @returns {Promise} 计划详情
|
||||
*/
|
||||
static get(id) {
|
||||
return http.get(`/plans/${id}`);
|
||||
return http.get(`/api/v1/plans/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ export class PlanApi {
|
||||
* @returns {Promise} 更新结果
|
||||
*/
|
||||
static update(id, planData) {
|
||||
return http.put(`/plans/${id}`, planData);
|
||||
return http.put(`/api/v1/plans/${id}`, planData);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ export class PlanApi {
|
||||
* @returns {Promise} 删除结果
|
||||
*/
|
||||
static delete(id) {
|
||||
return http.delete(`/plans/${id}`);
|
||||
return http.delete(`/api/v1/plans/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ export class PlanApi {
|
||||
* @returns {Promise} 启动结果
|
||||
*/
|
||||
static start(id) {
|
||||
return http.post(`/plans/${id}/start`);
|
||||
return http.post(`/api/v1/plans/${id}/start`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +64,7 @@ export class PlanApi {
|
||||
* @returns {Promise} 停止结果
|
||||
*/
|
||||
static stop(id) {
|
||||
return http.post(`/plans/${id}/stop`);
|
||||
return http.post(`/api/v1/plans/${id}/stop`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ export class UserApi {
|
||||
* @returns {Promise} 创建结果
|
||||
*/
|
||||
static create(userData) {
|
||||
return http.post('/users', userData);
|
||||
return http.post('/api/v1/users', userData);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -19,7 +19,7 @@ export class UserApi {
|
||||
* @returns {Promise} 登录结果
|
||||
*/
|
||||
static login(credentials) {
|
||||
return http.post('/users/login', credentials);
|
||||
return http.post('/api/v1/users/login', credentials);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// API配置文件
|
||||
const API_CONFIG = {
|
||||
// 后端服务基础URL
|
||||
BASE_URL: 'http://localhost:8086',
|
||||
BASE_URL: '',
|
||||
|
||||
// API端点
|
||||
ENDPOINTS: {
|
||||
DEVICES: '/devices'
|
||||
DEVICES: '/v1/devices'
|
||||
},
|
||||
|
||||
// 请求超时时间(毫秒)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import axios from 'axios';
|
||||
import API_CONFIG from '../config/api.js';
|
||||
|
||||
// 创建axios实例
|
||||
// 创建axios实例,自动将请求发送到 BASE_URL + 相对路径
|
||||
// 例如:http.get('/api/pigs') 会请求 BASE_URL + '/api/pigs'
|
||||
const http = axios.create({
|
||||
baseURL: API_CONFIG.BASE_URL,
|
||||
timeout: API_CONFIG.TIMEOUT,
|
||||
|
||||
@@ -46,7 +46,14 @@ module.exports = (env, argv) => {
|
||||
hot: true,
|
||||
open: true,
|
||||
historyApiFallback: true,
|
||||
port: 8080
|
||||
port: 8080,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8086',
|
||||
changeOrigin: true,
|
||||
secure: false
|
||||
}
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user