diff --git a/api/index.js b/api/index.js
index b983a61..e8bab20 100644
--- a/api/index.js
+++ b/api/index.js
@@ -4,21 +4,28 @@
*/
// 用户相关
-export const user = {
- login: (data) => post('/api/user/login', data),
- logout: () => post('/api/user/logout'),
- info: () => get('/api/user/info')
+
+export const api = {
+ /**
+ * GET 请求(一般不需要认证)
+ */
+ get(path) {
+
+ },
+
+ /**
+ * POST JSON
+ */
+ post(path, data = {},callback) {
+ console.log("post")
+ },
+
+ /**
+ * POST FormData(文件上传)
+ */
+ upload(path, file) {
+
+ },
}
-// 订单相关
-export const order = {
- list: (data) => get('/api/order/list', data),
- detail: (id) => get('/api/order/detail', { id }),
- create: (data) => post('/api/order/create', data)
-}
-
-// 消息相关
-export const message = {
- list: (data) => get('/api/message/list', data),
- read: (id) => post('/api/message/read', { id })
-}
+export default api
\ No newline at end of file
diff --git a/api/request.js b/api/request.js
index 26478bc..d21fd71 100644
--- a/api/request.js
+++ b/api/request.js
@@ -1,50 +1,4 @@
import { useConfigStore } from '@/stores/config'
-/**
- * 基础请求封装
- * @param {string} path - 接口路径
- * @param {object} data - 请求参数
- * @param {string} method - 请求方法
- */
-export const request = (path, data = {}, method = 'GET') => {
- const config = useConfigStore()
-
- return new Promise((resolve, reject) => {
- uni.request({
- url: config.apiBaseUrl + path,
- data,
- method,
- header: {
- 'Content-Type': 'application/json'
- },
- success: (res) => {
- if (res.statusCode === 200) {
- resolve(res.data)
- } else {
- uni.showToast({
- title: '请求失败',
- icon: 'none'
- })
- reject(res)
- }
- },
- fail: (err) => {
- uni.showToast({
- title: '网络错误',
- icon: 'none'
- })
- reject(err)
- }
- })
- })
-}
+const useConfig=useConfigStore()
-/**
- * GET 请求
- */
-export const get = (path, data) => request(path, data, 'GET')
-
-/**
- * POST 请求
- */
-export const post = (path, data) => request(path, data, 'POST')
diff --git a/api/user.js b/api/user.js
new file mode 100644
index 0000000..532c7f6
--- /dev/null
+++ b/api/user.js
@@ -0,0 +1,9 @@
+import api from ".";
+
+export const userApi = {
+
+ login(username, password, remember) {
+ return api.post('/users/login', { username, password, remember })
+ },
+
+}
\ No newline at end of file
diff --git a/components/my-toast/my-toast.vue b/components/my-toast/my-toast.vue
new file mode 100644
index 0000000..363ec9f
--- /dev/null
+++ b/components/my-toast/my-toast.vue
@@ -0,0 +1,74 @@
+
+
+ {{ message }}
+
+
+
+
+
+
diff --git a/pages.json b/pages.json
index 12069a8..988f9b9 100644
--- a/pages.json
+++ b/pages.json
@@ -41,7 +41,10 @@
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
- "backgroundColor": "#F8F8F8"
+ "backgroundColor": "#F8F8F8",
+ "usingComponents": {
+ "my-toast": "/components/my-toast/my-toast"
+ }
},
"tabBar": {
"color": "#7A7E83",
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 1a7c109..b5b9331 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -6,14 +6,21 @@
+
diff --git a/pages/settings/settings.vue b/pages/settings/settings.vue
index cd40f78..7ae3bca 100644
--- a/pages/settings/settings.vue
+++ b/pages/settings/settings.vue
@@ -1,23 +1,205 @@
-
- 设置
-
+
+
+
+
+
+
+ base url
+
+
+
+
+ {{ useConfig.getApiBaseUrl() || '未设置' }}
+
+
+
+
+
+
+ {{ isTestok ? '✅ 连接成功' : '❌ 连接失败' }}
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/user/user.vue b/pages/user/user.vue
index 4877493..f946741 100644
--- a/pages/user/user.vue
+++ b/pages/user/user.vue
@@ -8,6 +8,7 @@