From a10685261031220102e2d4594bda505d5539b51c Mon Sep 17 00:00:00 2001 From: abab2320 <1589841436@qq.com> Date: Fri, 21 Mar 2025 14:20:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Front/vue-unilife/src/api/user.js | 37 +++++++++++++++++++ Front/vue-unilife/src/utils/request.ts | 30 +++++++++++++++ v1.md => 文档/v1.md | 0 v2.md => 文档/v2.md | 0 .../大模型互动过程.md | 0 .../焦点访谈报告.md | 0 6 files changed, 67 insertions(+) create mode 100644 Front/vue-unilife/src/api/user.js create mode 100644 Front/vue-unilife/src/utils/request.ts rename v1.md => 文档/v1.md (100%) rename v2.md => 文档/v2.md (100%) rename 大模型互动过程.md => 文档/大模型互动过程.md (100%) rename 焦点访谈报告.md => 文档/焦点访谈报告.md (100%) diff --git a/Front/vue-unilife/src/api/user.js b/Front/vue-unilife/src/api/user.js new file mode 100644 index 00000000..11606354 --- /dev/null +++ b/Front/vue-unilife/src/api/user.js @@ -0,0 +1,37 @@ +import request from '../utils/request'; + +// 用户注册 +export function register(data) { + return request({ + url: '/auth/register', + method: 'post', + data + }); +} + +// 用户密码登录 +export function login(data) { + return request({ + url: '/auth/login', + method: 'post', + data + }); +} + +// 获取邮箱验证码 +export function getEmailCode(data) { + return request({ + url: '/auth/email/code', + method: 'post', + data + }); +} + +// 邮箱验证码登录 +export function loginWithCode(data) { + return request({ + url: '/auth/login/code', + method: 'post', + data + }); +} \ No newline at end of file diff --git a/Front/vue-unilife/src/utils/request.ts b/Front/vue-unilife/src/utils/request.ts new file mode 100644 index 00000000..39c2ab75 --- /dev/null +++ b/Front/vue-unilife/src/utils/request.ts @@ -0,0 +1,30 @@ +import axios from 'axios'; + +const service = axios.create({ + baseURL: 'http://localhost:8080', + timeout: 5000 +}); + +service.interceptors.request.use( + config => { + console.log(1); + return config; + }, + error => { + // 对请求错误做些什么 + return Promise.reject(error); + } +); + +service.interceptors.response.use( + response => { + console.log(2); + return response.data; + }, + error => { + // 对响应错误做些什么 + return Promise.reject(error); + } +); + +export default service; diff --git a/v1.md b/文档/v1.md similarity index 100% rename from v1.md rename to 文档/v1.md diff --git a/v2.md b/文档/v2.md similarity index 100% rename from v2.md rename to 文档/v2.md diff --git a/大模型互动过程.md b/文档/大模型互动过程.md similarity index 100% rename from 大模型互动过程.md rename to 文档/大模型互动过程.md diff --git a/焦点访谈报告.md b/文档/焦点访谈报告.md similarity index 100% rename from 焦点访谈报告.md rename to 文档/焦点访谈报告.md