diff --git a/_doc/完整使用文档.md b/_doc/完整使用文档.md
index 9fbb58e..7deb185 100644
--- a/_doc/完整使用文档.md
+++ b/_doc/完整使用文档.md
@@ -335,19 +335,19 @@ export default {
```javascript
// src/api/business/productServer.js
-import http from '@/utils/admin-framework.js'
+// 注意:不需要 import http,直接使用 window.framework.http
class ProductServer {
async getList(params) {
- return await http.http.get('/product/list', params)
+ return await window.framework.http.get('/product/list', params)
}
async save(data) {
- return await http.http.post('/product/save', data)
+ return await window.framework.http.post('/product/save', data)
}
async delete(id) {
- return await http.http.post('/product/delete', { id })
+ return await window.framework.http.post('/product/delete', { id })
}
}
diff --git a/demo/src/api/ad/sysAdServer.js b/demo/src/api/ad/sysAdServer.js
index 1ac32f3..1ae6e49 100644
--- a/demo/src/api/ad/sysAdServer.js
+++ b/demo/src/api/ad/sysAdServer.js
@@ -2,19 +2,19 @@ import http from "@/libs/http";
class SysAdServer {
async getAll(param) {
- return await http.get("/sys_ad/index", param);
+ return await window.framework.httpget("/sys_ad/index", param);
}
async add(row) {
- return await http.post("/sys_ad/add", row);
+ return await window.framework.http.post("/sys_ad/add", row);
}
async edit(row) {
- return await http.post("/sys_ad/edit", row);
+ return await window.framework.http.post("/sys_ad/edit", row);
}
async del(row) {
- return await http.post("/sys_ad/del", row);
+ return await window.framework.http.post("/sys_ad/del", row);
}
}
const sysAdServer = new SysAdServer();
diff --git a/demo/src/api/ai/ai_messages_server.js b/demo/src/api/ai/ai_messages_server.js
index e144a17..14d4d7c 100644
--- a/demo/src/api/ai/ai_messages_server.js
+++ b/demo/src/api/ai/ai_messages_server.js
@@ -1,12 +1,12 @@
-import http from '@/libs/http';
+
class ai_messagesClServer {
async all(param) {
- let res= await http.get('/ai_messages/all', param);
+ let res= await window.framework.httpget('/ai_messages/all', param);
return res;
}
async page(row) {
- let res= await http.post('/ai_messages/page', row);
+ let res= await window.framework.http.post('/ai_messages/page', row);
return res;
}
@@ -16,17 +16,17 @@ class ai_messagesClServer {
}
async add(row) {
- let res= await http.post('/ai_messages/add', row);
+ let res= await window.framework.http.post('/ai_messages/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/ai_messages/edit', row);
+ let res= await window.framework.http.post('/ai_messages/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/ai_messages/del', row);
+ let res= await window.framework.http.post('/ai_messages/del', row);
return res;
}
}
diff --git a/demo/src/api/ball/gamesServer.js b/demo/src/api/ball/gamesServer.js
new file mode 100644
index 0000000..40eba12
--- /dev/null
+++ b/demo/src/api/ball/gamesServer.js
@@ -0,0 +1,86 @@
+/**
+ * 球赛管理 API
+ *
+ * 使用说明:
+ * 1. 不需要 import http
+ * 2. 直接使用 window.framework.http 调用接口
+ * 3. 所有方法返回 Promise
+ */
+
+class GamesServer {
+ /**
+ * 获取球赛列表(分页)
+ * @param {Object} params - 查询参数 { page, size, keyword }
+ * @returns {Promise}
+ */
+ async getPage(params) {
+ return await window.framework.http.post('/games/page', params)
+ }
+
+ /**
+ * 获取所有球赛
+ * @returns {Promise}
+ */
+ async getAll() {
+ return await window.framework.http.get('/games/all')
+ }
+
+ /**
+ * 获取球赛详情
+ * @param {Number|String} id - 球赛ID
+ * @returns {Promise}
+ */
+ async getDetail(id) {
+ return await window.framework.http.get(`/games/detail/${id}`)
+ }
+
+ /**
+ * 创建球赛
+ * @param {Object} data - 球赛数据
+ * @returns {Promise}
+ */
+ async create(data) {
+ return await window.framework.http.post('/games/create', data)
+ }
+
+ /**
+ * 更新球赛
+ * @param {Number|String} id - 球赛ID
+ * @param {Object} data - 球赛数据
+ * @returns {Promise}
+ */
+ async update(id, data) {
+ return await window.framework.http.post(`/games/update/${id}`, data)
+ }
+
+ /**
+ * 删除球赛
+ * @param {Number|String} id - 球赛ID
+ * @returns {Promise}
+ */
+ async delete(id) {
+ return await window.framework.http.post(`/games/delete/${id}`, { id })
+ }
+
+ /**
+ * 批量删除球赛
+ * @param {Array} ids - 球赛ID数组
+ * @returns {Promise}
+ */
+ async batchDelete(ids) {
+ return await window.framework.http.post('/games/batch_delete', { ids })
+ }
+
+ /**
+ * 导出数据
+ * @param {Object} params - 查询参数
+ * @returns {Promise}
+ */
+ async exportData(params) {
+ return await window.framework.http.fileExport('/games/export', params)
+ }
+}
+
+// 导出单例
+export default new GamesServer()
+
diff --git a/demo/src/api/ball/games_server.js b/demo/src/api/ball/games_server.js
index 1843529..55f4c47 100644
--- a/demo/src/api/ball/games_server.js
+++ b/demo/src/api/ball/games_server.js
@@ -1,12 +1,12 @@
-import http from '@/libs/http';
+
class gamesClServer {
async all(param) {
- let res= await http.get('/gme_games/all', param);
+ let res= await window.framework.httpget('/gme_games/all', param);
return res;
}
async page(row) {
- let res= await http.post('/gme_games/page', row);
+ let res= await window.framework.http.post('/gme_games/page', row);
return res;
}
@@ -16,32 +16,32 @@ class gamesClServer {
}
async add(row) {
- let res= await http.post('/gme_games/add', row);
+ let res= await window.framework.http.post('/gme_games/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/gme_games/edit', row);
+ let res= await window.framework.http.post('/gme_games/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/gme_games/del', row);
+ let res= await window.framework.http.post('/gme_games/del', row);
return res;
}
async cancel(row) {
- let res = await http.post('/gme_games/cancel', row);
+ let res = await window.framework.http.post('/gme_games/cancel', row);
return res;
}
async updateStatus(row) {
- let res = await http.post('/gme_games/update_status', row);
+ let res = await window.framework.http.post('/gme_games/update_status', row);
return res;
}
async statistics() {
- let res = await http.get('/gme_games/statistics', {});
+ let res = await window.framework.httpget('/gme_games/statistics', {});
return res;
}
}
diff --git a/demo/src/api/ball/payment_orders_server.js b/demo/src/api/ball/payment_orders_server.js
index 03ca67b..dc9a01e 100644
--- a/demo/src/api/ball/payment_orders_server.js
+++ b/demo/src/api/ball/payment_orders_server.js
@@ -1,13 +1,13 @@
-import http from '@/libs/http';
+
class paymentOrdersClServer {
async all(param) {
- let res= await http.get('/pay_orders/all', param);
+ let res= await window.framework.httpget('/pay_orders/all', param);
return res;
}
async page(row) {
- let res= await http.post('/pay_orders/page', row);
+ let res= await window.framework.http.post('/pay_orders/page', row);
return res;
}
@@ -18,17 +18,17 @@ class paymentOrdersClServer {
}
async add(row) {
- let res= await http.post('/pay_orders/add', row);
+ let res= await window.framework.http.post('/pay_orders/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/pay_orders/edit', row);
+ let res= await window.framework.http.post('/pay_orders/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/pay_orders/del', row);
+ let res= await window.framework.http.post('/pay_orders/del', row);
return res;
}
}
diff --git a/demo/src/api/ball/venues_server.js b/demo/src/api/ball/venues_server.js
index 41c0114..b7f0fb1 100644
--- a/demo/src/api/ball/venues_server.js
+++ b/demo/src/api/ball/venues_server.js
@@ -1,13 +1,13 @@
-import http from '@/libs/http';
+
class venuesClServer {
async all(param) {
- let res= await http.get('/ven_venues/all', param);
+ let res= await window.framework.httpget('/ven_venues/all', param);
return res;
}
async page(row) {
- let res= await http.post('/ven_venues/page', row);
+ let res= await window.framework.http.post('/ven_venues/page', row);
return res;
}
@@ -18,17 +18,17 @@ class venuesClServer {
}
async add(row) {
- let res= await http.post('/ven_venues/add', row);
+ let res= await window.framework.http.post('/ven_venues/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/ven_venues/edit', row);
+ let res= await window.framework.http.post('/ven_venues/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/ven_venues/del', row);
+ let res= await window.framework.http.post('/ven_venues/del', row);
return res;
}
}
diff --git a/demo/src/api/ball/wallet_transactions_server.js b/demo/src/api/ball/wallet_transactions_server.js
index 49639a1..1aca99c 100644
--- a/demo/src/api/ball/wallet_transactions_server.js
+++ b/demo/src/api/ball/wallet_transactions_server.js
@@ -1,13 +1,13 @@
-import http from '@/libs/http';
+
class walletTransactionsClServer {
async all(param) {
- let res= await http.get('/wch_wallet_transactions/all', param);
+ let res= await window.framework.httpget('/wch_wallet_transactions/all', param);
return res;
}
async page(row) {
- let res= await http.post('/wch_wallet_transactions/page', row);
+ let res= await window.framework.http.post('/wch_wallet_transactions/page', row);
return res;
}
@@ -17,17 +17,17 @@ class walletTransactionsClServer {
}
async detail(id) {
- let res= await http.get('/wch_wallet_transactions/detail', { id });
+ let res= await window.framework.httpget('/wch_wallet_transactions/detail', { id });
return res;
}
async edit(row) {
- let res= await http.post('/wch_wallet_transactions/edit', row);
+ let res= await window.framework.http.post('/wch_wallet_transactions/edit', row);
return res;
}
async statistics() {
- let res = await http.get('/wch_wallet_transactions/statistics', {});
+ let res = await window.framework.httpget('/wch_wallet_transactions/statistics', {});
return res;
}
}
diff --git a/demo/src/api/ball/wallets_server.js b/demo/src/api/ball/wallets_server.js
index 8fa1811..a139ee4 100644
--- a/demo/src/api/ball/wallets_server.js
+++ b/demo/src/api/ball/wallets_server.js
@@ -1,13 +1,13 @@
-import http from '@/libs/http';
+
class walletsClServer {
async all(param) {
- let res= await http.get('/wch_wallets/all', param);
+ let res= await window.framework.httpget('/wch_wallets/all', param);
return res;
}
async page(row) {
- let res= await http.post('/wch_wallets/page', row);
+ let res= await window.framework.http.post('/wch_wallets/page', row);
return res;
}
@@ -17,17 +17,17 @@ class walletsClServer {
}
async edit(row) {
- let res= await http.post('/wch_wallets/edit', row);
+ let res= await window.framework.http.post('/wch_wallets/edit', row);
return res;
}
async adjustBalance(row) {
- let res= await http.post('/wch_wallets/adjust_balance', row);
+ let res= await window.framework.http.post('/wch_wallets/adjust_balance', row);
return res;
}
async statistics() {
- let res = await http.get('/wch_wallets/statistics', {});
+ let res = await window.framework.httpget('/wch_wallets/statistics', {});
return res;
}
}
diff --git a/demo/src/api/ball/wch_users_server.js b/demo/src/api/ball/wch_users_server.js
index ccc28e8..31727e5 100644
--- a/demo/src/api/ball/wch_users_server.js
+++ b/demo/src/api/ball/wch_users_server.js
@@ -1,13 +1,13 @@
-import http from '@/libs/http';
+
class wch_usersClServer {
async all(param) {
- let res= await http.get('/wch_users/all', param);
+ let res= await window.framework.httpget('/wch_users/all', param);
return res;
}
async page(row) {
- let res= await http.post('/wch_users/page', row);
+ let res= await window.framework.http.post('/wch_users/page', row);
return res;
}
@@ -18,17 +18,17 @@ class wch_usersClServer {
}
async add(row) {
- let res= await http.post('/wch_users/add', row);
+ let res= await window.framework.http.post('/wch_users/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/wch_users/edit', row);
+ let res= await window.framework.http.post('/wch_users/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/wch_users/del', row);
+ let res= await window.framework.http.post('/wch_users/del', row);
return res;
}
}
diff --git a/demo/src/api/cote/info_server.js b/demo/src/api/cote/info_server.js
index 5bc6ffb..004d980 100644
--- a/demo/src/api/cote/info_server.js
+++ b/demo/src/api/cote/info_server.js
@@ -1,13 +1,13 @@
-import http from '@/libs/http';
+
class infoClServer {
async all(param) {
- let res= await http.get('/inf_info/all', param);
+ let res= await window.framework.httpget('/inf_info/all', param);
return res;
}
async page(row) {
- let res= await http.post('/inf_info/page', row);
+ let res= await window.framework.http.post('/inf_info/page', row);
return res;
}
@@ -18,17 +18,17 @@ class infoClServer {
}
async add(row) {
- let res= await http.post('/inf_info/add', row);
+ let res= await window.framework.http.post('/inf_info/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/inf_info/edit', row);
+ let res= await window.framework.http.post('/inf_info/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/inf_info/del', row);
+ let res= await window.framework.http.post('/inf_info/del', row);
return res;
}
}
diff --git a/demo/src/api/cote/info_type_server.js b/demo/src/api/cote/info_type_server.js
index d0fad7f..98fa068 100644
--- a/demo/src/api/cote/info_type_server.js
+++ b/demo/src/api/cote/info_type_server.js
@@ -1,13 +1,13 @@
-import http from '@/libs/http';
+
class info_typeClServer {
async all(param) {
- let res= await http.get('/inf_info_type/all', param);
+ let res= await window.framework.httpget('/inf_info_type/all', param);
return res;
}
async page(row) {
- let res= await http.post('/inf_info_type/page', row);
+ let res= await window.framework.http.post('/inf_info_type/page', row);
return res;
}
@@ -18,17 +18,17 @@ class info_typeClServer {
}
async add(row) {
- let res= await http.post('/inf_info_type/add', row);
+ let res= await window.framework.http.post('/inf_info_type/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/inf_info_type/edit', row);
+ let res= await window.framework.http.post('/inf_info_type/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/inf_info_type/del', row);
+ let res= await window.framework.http.post('/inf_info_type/del', row);
return res;
}
}
diff --git a/demo/src/api/home/homeServer.js b/demo/src/api/home/homeServer.js
index fcd0124..4e0d743 100644
--- a/demo/src/api/home/homeServer.js
+++ b/demo/src/api/home/homeServer.js
@@ -2,22 +2,22 @@ import http from "@/libs/http";
class HomeServer {
// 获取订单统计
async getOderCount() {
- let res = await http.get("/order/count");
+ let res = await window.framework.httpget("/order/count");
return res;
}
async getUserCount() {
- let res = await http.get("/user/count");
+ let res = await window.framework.httpget("/user/count");
return res;
}
async getSalesRank() {
- let res = await http.get("/index/salesRank");
+ let res = await window.framework.httpget("/index/salesRank");
return res;
}
async userRecommendRank() {
- let res = await http.get("/index/userRecommendRank");
+ let res = await window.framework.httpget("/index/userRecommendRank");
return res;
}
}
diff --git a/demo/src/api/message/msg_notifications_server.js b/demo/src/api/message/msg_notifications_server.js
index 61d4a6b..7f40df7 100644
--- a/demo/src/api/message/msg_notifications_server.js
+++ b/demo/src/api/message/msg_notifications_server.js
@@ -3,7 +3,7 @@ import http from '@/libs/http'
export default {
// 获取消息通知列表
page: (params) => {
- return http.post('/msg_notifications/page', params)
+ return http.post('/msg_notifications/page', params)
},
// 新增消息通知
diff --git a/demo/src/api/ntrp/ntr_questions_server.js b/demo/src/api/ntrp/ntr_questions_server.js
index 13552b1..3647d94 100644
--- a/demo/src/api/ntrp/ntr_questions_server.js
+++ b/demo/src/api/ntrp/ntr_questions_server.js
@@ -1,12 +1,12 @@
-import http from '@/libs/http';
+
class ntr_questionsClServer {
async all(param) {
- let res= await http.get('/ntr_questions/all', param);
+ let res= await window.framework.httpget('/ntr_questions/all', param);
return res;
}
async page(row) {
- let res= await http.post('/ntr_questions/page', row);
+ let res= await window.framework.http.post('/ntr_questions/page', row);
return res;
}
@@ -16,17 +16,17 @@ class ntr_questionsClServer {
}
async add(row) {
- let res= await http.post('/ntr_questions/add', row);
+ let res= await window.framework.http.post('/ntr_questions/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/ntr_questions/edit', row);
+ let res= await window.framework.http.post('/ntr_questions/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/ntr_questions/del', row);
+ let res= await window.framework.http.post('/ntr_questions/del', row);
return res;
}
}
diff --git a/demo/src/api/ntrp/ntr_records_server.js b/demo/src/api/ntrp/ntr_records_server.js
index ab246ea..9c95796 100644
--- a/demo/src/api/ntrp/ntr_records_server.js
+++ b/demo/src/api/ntrp/ntr_records_server.js
@@ -1,12 +1,12 @@
-import http from '@/libs/http';
+
class ntr_recordsClServer {
async all(param) {
- let res= await http.get('/ntr_records/all', param);
+ let res= await window.framework.httpget('/ntr_records/all', param);
return res;
}
async page(row) {
- let res= await http.post('/ntr_records/page', row);
+ let res= await window.framework.http.post('/ntr_records/page', row);
return res;
}
@@ -16,17 +16,17 @@ class ntr_recordsClServer {
}
async add(row) {
- let res= await http.post('/ntr_records/add', row);
+ let res= await window.framework.http.post('/ntr_records/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/ntr_records/edit', row);
+ let res= await window.framework.http.post('/ntr_records/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/ntr_records/del', row);
+ let res= await window.framework.http.post('/ntr_records/del', row);
return res;
}
}
diff --git a/demo/src/api/order/transfer_details_server.js b/demo/src/api/order/transfer_details_server.js
index d659c27..467b98b 100644
--- a/demo/src/api/order/transfer_details_server.js
+++ b/demo/src/api/order/transfer_details_server.js
@@ -1,12 +1,12 @@
-import http from '@/libs/http';
+
class transfer_detailsClServer {
async all(param) {
- let res= await http.get('/transfer_details/all', param);
+ let res= await window.framework.httpget('/transfer_details/all', param);
return res;
}
async page(row) {
- let res= await http.post('/transfer_details/page', row);
+ let res= await window.framework.http.post('/transfer_details/page', row);
return res;
}
@@ -16,17 +16,17 @@ class transfer_detailsClServer {
}
async add(row) {
- let res= await http.post('/transfer_details/add', row);
+ let res= await window.framework.http.post('/transfer_details/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/transfer_details/edit', row);
+ let res= await window.framework.http.post('/transfer_details/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/transfer_details/del', row);
+ let res= await window.framework.http.post('/transfer_details/del', row);
return res;
}
}
diff --git a/demo/src/api/system/fileServe.js b/demo/src/api/system/fileServe.js
index b60abbe..e2ce1d4 100644
--- a/demo/src/api/system/fileServe.js
+++ b/demo/src/api/system/fileServe.js
@@ -1,12 +1,12 @@
import http from "@/libs/http";
class FileServe {
async upload_oos_img(row) {
- let res = await http.postFormData("/sys_file/upload_oos_img", row);
+ let res = await window.framework.http.postFormData("/sys_file/upload_oos_img", row);
return res;
}
async upload_Img(row) {
- let res = await http.postFormData("/file/upload_Img", row);
+ let res = await window.framework.http.postFormData("/file/upload_Img", row);
return res;
}
}
diff --git a/demo/src/api/system/rolePermissionServer.js b/demo/src/api/system/rolePermissionServer.js
index e222a1c..5fd7179 100644
--- a/demo/src/api/system/rolePermissionServer.js
+++ b/demo/src/api/system/rolePermissionServer.js
@@ -1,27 +1,27 @@
import http from '@/libs/http'
class RolePermissionServer {
async getRoles(callback) {
- let res = await http.get('/SysRolePermission/Query', {})
+ let res = await window.framework.httpget('/SysRolePermission/Query', {})
return res
}
async getRole(row) {
- let res = await http.get('/SysRolePermission/QueryByRoleId', row)
+ let res = await window.framework.httpget('/SysRolePermission/QueryByRoleId', row)
return res
}
async add(row) {
- let res = await http.post('/SysRolePermission/add', row)
+ let res = await window.framework.http.post('/SysRolePermission/add', row)
return res
}
async edit(row) {
- let res = await http.post('/SysRolePermission/edit', row)
+ let res = await window.framework.http.post('/SysRolePermission/edit', row)
return res
}
async del(row) {
- let res = await http.post('/SysRolePermission/del', row)
+ let res = await window.framework.http.post('/SysRolePermission/del', row)
return res
}
}
diff --git a/demo/src/api/system/roleServer.js b/demo/src/api/system/roleServer.js
index dbc40ce..47ad35e 100644
--- a/demo/src/api/system/roleServer.js
+++ b/demo/src/api/system/roleServer.js
@@ -1,23 +1,23 @@
import http from "@/libs/http";
class RoleServer {
async list() {
- let res = await http.get("/sys_role/index", {});
+ let res = await window.framework.httpget("/sys_role/index", {});
return res;
}
async add(row) {
- let res = await http.post("/sys_role/add", row);
+ let res = await window.framework.http.post("/sys_role/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_role/edit", row);
+ let res = await window.framework.http.post("/sys_role/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_role/del", row);
+ let res = await window.framework.http.post("/sys_role/del", row);
return res;
}
}
diff --git a/demo/src/api/system/shpProfitServer.js b/demo/src/api/system/shpProfitServer.js
index d2835fe..23daba4 100644
--- a/demo/src/api/system/shpProfitServer.js
+++ b/demo/src/api/system/shpProfitServer.js
@@ -1,12 +1,12 @@
import http from '@/libs/http'
class ShpProfitServer {
async report(param) {
- let res = await http.post('/shpProfit/report', param)
+ let res = await window.framework.http.post('/shpProfit/report', param)
return res
}
async list(param) {
- let res = await http.post('/shpProfit/list', param)
+ let res = await window.framework.http.post('/shpProfit/list', param)
return res
}
}
diff --git a/demo/src/api/system/specificationServer.js b/demo/src/api/system/specificationServer.js
index 4a8f1f4..effa5d6 100644
--- a/demo/src/api/system/specificationServer.js
+++ b/demo/src/api/system/specificationServer.js
@@ -1,22 +1,22 @@
import http from '@/libs/http'
class SpecificationServer {
async list() {
- let res = await http.post('/specification/list', {})
+ let res = await window.framework.http.post('/specification/list', {})
return res
}
async add(row) {
- let res = await http.post('/specification/add', row)
+ let res = await window.framework.http.post('/specification/add', row)
return res
}
async edit(row) {
- let res = await http.post('/specification/edit', row)
+ let res = await window.framework.http.post('/specification/edit', row)
return res
}
async del(row) {
- let res = await http.post('/specification/del', row)
+ let res = await window.framework.http.post('/specification/del', row)
return res
}
}
diff --git a/demo/src/api/system/sysAddressServer.js b/demo/src/api/system/sysAddressServer.js
index d0cde93..0ad8054 100644
--- a/demo/src/api/system/sysAddressServer.js
+++ b/demo/src/api/system/sysAddressServer.js
@@ -1,7 +1,7 @@
import http from "@/libs/http";
class SysAddress {
async index(param) {
- let res = await http.get("/sys_address/index", param);
+ let res = await window.framework.httpget("/sys_address/index", param);
return res;
}
}
diff --git a/demo/src/api/system/sysModuleServer.js b/demo/src/api/system/sysModuleServer.js
index a4ddd6d..8fdbaa1 100644
--- a/demo/src/api/system/sysModuleServer.js
+++ b/demo/src/api/system/sysModuleServer.js
@@ -1,27 +1,27 @@
import http from "@/libs/http";
class SysModuleServer {
async all() {
- let res = await http.get("/sys_menu/all", {});
+ let res = await window.framework.httpget("/sys_menu/all", {});
return res;
}
async list(row) {
- let res = await http.get("/sys_menu/all", row);
+ let res = await window.framework.httpget("/sys_menu/all", row);
return res;
}
async add(row) {
- let res = await http.post("/sys_menu/add", row);
+ let res = await window.framework.http.post("/sys_menu/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_menu/edit", row);
+ let res = await window.framework.http.post("/sys_menu/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_menu/del", row);
+ let res = await window.framework.http.post("/sys_menu/del", row);
return res;
}
}
diff --git a/demo/src/api/system/sys_log_serve.js b/demo/src/api/system/sys_log_serve.js
index 3a3e379..7dfc86f 100644
--- a/demo/src/api/system/sys_log_serve.js
+++ b/demo/src/api/system/sys_log_serve.js
@@ -1,27 +1,27 @@
import http from "@/libs/http";
class SysLogServe {
async all(param) {
- let res = await http.get("/sys_log/all", param);
+ let res = await window.framework.httpget("/sys_log/all", param);
return res;
}
async detail(param) {
- let res = await http.get("/sys_log/detail", param);
+ let res = await window.framework.httpget("/sys_log/detail", param);
return res;
}
async delete(param) {
- let res = await http.get("/sys_log/delete", param);
+ let res = await window.framework.httpget("/sys_log/delete", param);
return res;
}
async delete_all(param) {
- let res = await http.get("/sys_log/delete_all", param);
+ let res = await window.framework.httpget("/sys_log/delete_all", param);
return res;
}
async operates(param) {
- let res = await http.get("/sys_log/operates", param);
+ let res = await window.framework.httpget("/sys_log/operates", param);
return res;
}
}
diff --git a/demo/src/api/system/systemType_server.js b/demo/src/api/system/systemType_server.js
index cea2467..accabd4 100644
--- a/demo/src/api/system/systemType_server.js
+++ b/demo/src/api/system/systemType_server.js
@@ -1,13 +1,13 @@
-import http from '@/libs/http';
+
class systemTypeClServer {
async all(param) {
- let res= await http.get('/sys_project_type/all', param);
+ let res= await window.framework.httpget('/sys_project_type/all', param);
return res;
}
async page(row) {
- let res= await http.post('/sys_project_type/page', row);
+ let res= await window.framework.http.post('/sys_project_type/page', row);
return res;
}
@@ -18,17 +18,17 @@ class systemTypeClServer {
}
async add(row) {
- let res= await http.post('/sys_project_type/add', row);
+ let res= await window.framework.http.post('/sys_project_type/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/sys_project_type/edit', row);
+ let res= await window.framework.http.post('/sys_project_type/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/sys_project_type/del', row);
+ let res= await window.framework.http.post('/sys_project_type/del', row);
return res;
}
}
diff --git a/demo/src/api/system/tableServer.js b/demo/src/api/system/tableServer.js
index 93330c4..73f77dc 100644
--- a/demo/src/api/system/tableServer.js
+++ b/demo/src/api/system/tableServer.js
@@ -1,29 +1,29 @@
import http from '@/libs/http'
class TableServer {
async getAll(callback) {
- return await http.get('/table/index', {})
+ return await window.framework.httpget('/table/index', {})
}
async add(row, callback) {
- return await http.post('/table/add', row)
+ return await window.framework.http.post('/table/add', row)
}
async edit(row, callback) {
- return await http.post('/table/edit', row, function(res) {
+ return await window.framework.http.post('/table/edit', row, function(res) {
callback && callback(res)
})
}
async del(row, callback) {
- return await http.post('/table/del', row)
+ return await window.framework.http.post('/table/del', row)
}
async autoApi(id) {
- return await http.get('/template/api', { id: id })
+ return await window.framework.httpget('/template/api', { id: id })
}
async autoDb(id) {
- return await http.get('/template/autoDb', { id: id })
+ return await window.framework.httpget('/template/autoDb', { id: id })
}
}
diff --git a/demo/src/api/system/userServer.js b/demo/src/api/system/userServer.js
index 0929ac8..f6d4eca 100644
--- a/demo/src/api/system/userServer.js
+++ b/demo/src/api/system/userServer.js
@@ -1,12 +1,12 @@
import http from "@/libs/http";
class UserServer {
async login(row) {
- let res = await http.post("/sys_user/login", row);
+ let res = await window.framework.http.post("/sys_user/login", row);
return res;
}
async all() {
- let res = await http.get("/sys_user/index", {});
+ let res = await window.framework.httpget("/sys_user/index", {});
return res;
}
@@ -16,22 +16,22 @@ class UserServer {
}
async authorityMenus() {
- let res = await http.post("/sys_user/authorityMenus", {});
+ let res = await window.framework.http.post("/sys_user/authorityMenus", {});
return res;
}
async add(row) {
- let res = await http.post("/sys_user/add", row);
+ let res = await window.framework.http.post("/sys_user/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_user/edit", row);
+ let res = await window.framework.http.post("/sys_user/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_user/del", row);
+ let res = await window.framework.http.post("/sys_user/del", row);
return res;
}
}
diff --git a/demo/src/api/system_high/formFieldServer.js b/demo/src/api/system_high/formFieldServer.js
index 627d13a..f5379ed 100644
--- a/demo/src/api/system_high/formFieldServer.js
+++ b/demo/src/api/system_high/formFieldServer.js
@@ -1,27 +1,27 @@
import http from "@/libs/http";
class FormFieldServer {
async all(param) {
- let res = await http.get("/sys_form_field/all", param);
+ let res = await window.framework.httpget("/sys_form_field/all", param);
return res;
}
async page(row) {
- let res = await http.post("/sys_form_field/page", row);
+ let res = await window.framework.http.post("/sys_form_field/page", row);
return res;
}
async add(row) {
- let res = await http.post("/sys_form_field/add", row);
+ let res = await window.framework.http.post("/sys_form_field/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_form_field/edit", row);
+ let res = await window.framework.http.post("/sys_form_field/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_form_field/del", row);
+ let res = await window.framework.http.post("/sys_form_field/del", row);
return res;
}
}
diff --git a/demo/src/api/system_high/formServer.js b/demo/src/api/system_high/formServer.js
index 2621d83..43d9986 100644
--- a/demo/src/api/system_high/formServer.js
+++ b/demo/src/api/system_high/formServer.js
@@ -1,32 +1,32 @@
import http from "@/libs/http";
class FormServer {
async all(param) {
- let res = await http.get("/sys_form/all", param);
+ let res = await window.framework.httpget("/sys_form/all", param);
return res;
}
async page(row) {
- let res = await http.post("/sys_form/page", row);
+ let res = await window.framework.http.post("/sys_form/page", row);
return res;
}
async generate(row) {
- let res = await http.post("/sys_form/generate", row);
+ let res = await window.framework.http.post("/sys_form/generate", row);
return res;
}
async add(row) {
- let res = await http.post("/sys_form/add", row);
+ let res = await window.framework.http.post("/sys_form/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_form/edit", row);
+ let res = await window.framework.http.post("/sys_form/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_form/del", row);
+ let res = await window.framework.http.post("/sys_form/del", row);
return res;
}
}
diff --git a/demo/src/api/system_high/menuServer.js b/demo/src/api/system_high/menuServer.js
index b561f1b..b44089b 100644
--- a/demo/src/api/system_high/menuServer.js
+++ b/demo/src/api/system_high/menuServer.js
@@ -2,46 +2,46 @@ import http from "@/libs/http";
class MenuServer {
async list(row) {
- let res = await http.get("/sys_menu/index", row);
+ let res = await window.framework.httpget("/sys_menu/index", row);
return res;
}
async generate(row) {
- let res = await http.post("/sys_menu/generate", row);
+ let res = await window.framework.http.post("/sys_menu/generate", row);
return res;
}
async add(row) {
- let res = await http.post("/sys_menu/add", row);
+ let res = await window.framework.http.post("/sys_menu/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_menu/edit", row);
+ let res = await window.framework.http.post("/sys_menu/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_menu/del", row);
+ let res = await window.framework.http.post("/sys_menu/del", row);
return res;
}
async generate(row) {
- let res = await http.post("/form/generate", row);
+ let res = await window.framework.http.post("/form/generate", row);
return res;
}
async generateModel(row) {
- let res = await http.post("/model/generate", row);
+ let res = await window.framework.http.post("/model/generate", row);
return res;
}
async modelAll(row) {
- let res = await http.post("/model/all", row);
+ let res = await window.framework.http.post("/model/all", row);
return res;
}
async modelInterface(row) {
- let res = await http.post("/model/interface", row);
+ let res = await window.framework.http.post("/model/interface", row);
return res;
}
}
diff --git a/demo/src/api/system_high/modelFieldServer.js b/demo/src/api/system_high/modelFieldServer.js
index 44ecf1f..cf3f3fb 100644
--- a/demo/src/api/system_high/modelFieldServer.js
+++ b/demo/src/api/system_high/modelFieldServer.js
@@ -1,29 +1,29 @@
import http from "@/libs/http";
class ModelFieldServer {
async all(row) {
- let res = await http.get("/sys_model_field/all", row);
+ let res = await window.framework.httpget("/sys_model_field/all", row);
return res;
}
async allByKey(row) {
- let res = await http.get("/sys_model_field/allByKey", row, {
+ let res = await window.framework.httpget("/sys_model_field/allByKey", row, {
hideLoad: true
});
return res;
}
async add(row) {
- let res = await http.post("/sys_model_field/add", row);
+ let res = await window.framework.http.post("/sys_model_field/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_model_field/edit", row);
+ let res = await window.framework.http.post("/sys_model_field/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_model_field/del", row);
+ let res = await window.framework.http.post("/sys_model_field/del", row);
return res;
}
}
diff --git a/demo/src/api/system_high/modelServer.js b/demo/src/api/system_high/modelServer.js
index 1eb83fd..23af85f 100644
--- a/demo/src/api/system_high/modelServer.js
+++ b/demo/src/api/system_high/modelServer.js
@@ -1,37 +1,37 @@
import http from "@/libs/http";
class ModelServer {
async interface(row) {
- let res = await http.post("/sys_model/interface", row);
+ let res = await window.framework.http.post("/sys_model/interface", row);
return res;
}
async all() {
- let res = await http.get("/sys_model/all", {});
+ let res = await window.framework.httpget("/sys_model/all", {});
return res;
}
async detail(row) {
- let res = await http.get("/sys_model/detail", row);
+ let res = await window.framework.httpget("/sys_model/detail", row);
return res;
}
async regenerate(row) {
- let res = await http.post("/sys_model/regenerate", row);
+ let res = await window.framework.http.post("/sys_model/regenerate", row);
return res;
}
async add(row) {
- let res = await http.post("/sys_model/add", row);
+ let res = await window.framework.http.post("/sys_model/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_model/edit", row);
+ let res = await window.framework.http.post("/sys_model/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_model/del", row);
+ let res = await window.framework.http.post("/sys_model/del", row);
return res;
}
}
diff --git a/demo/src/api/system_high/paramSetupServer.js b/demo/src/api/system_high/paramSetupServer.js
index 07831c0..66ee240 100644
--- a/demo/src/api/system_high/paramSetupServer.js
+++ b/demo/src/api/system_high/paramSetupServer.js
@@ -1,27 +1,27 @@
import http from "@/libs/http";
class ParamSetupServer {
async getAll() {
- return await http.get("/sys_parameter/index", {});
+ return await window.framework.httpget("/sys_parameter/index", {});
}
async getOne(key) {
- return await http.get("/sys_parameter/key", { key });
+ return await window.framework.httpget("/sys_parameter/key", { key });
}
async add(row) {
- return await http.post("/sys_parameter/add", row);
+ return await window.framework.http.post("/sys_parameter/add", row);
}
async edit(row) {
- return await http.post("/sys_parameter/edit", row);
+ return await window.framework.http.post("/sys_parameter/edit", row);
}
async setSysConfig(row) {
- return await http.post("/sys_parameter/setSysConfig", row);
+ return await window.framework.http.post("/sys_parameter/setSysConfig", row);
}
async del(row) {
- return await http.post("/sys_parameter/del", row);
+ return await window.framework.http.post("/sys_parameter/del", row);
}
}
diff --git a/demo/src/api/system_high/sysControlTypeServer.js b/demo/src/api/system_high/sysControlTypeServer.js
index 1a97b3a..1b54b9f 100644
--- a/demo/src/api/system_high/sysControlTypeServer.js
+++ b/demo/src/api/system_high/sysControlTypeServer.js
@@ -1,26 +1,26 @@
import http from "@/libs/http";
class SysControlTypeServer {
async all(param) {
- let res = await http.get("/sys_control_type/all", param);
+ let res = await window.framework.httpget("/sys_control_type/all", param);
return res;
}
async page(row) {
- let res = await http.post("/sys_control_type/page", row);
+ let res = await window.framework.http.post("/sys_control_type/page", row);
return res;
}
async add(param) {
- let res = await http.post("/sys_control_type/add", param);
+ let res = await window.framework.http.post("/sys_control_type/add", param);
return res;
}
async edit(param) {
- let res = await http.post("/sys_control_type/edit", param);
+ let res = await window.framework.http.post("/sys_control_type/edit", param);
return res;
}
async del(param) {
- let res = await http.post("/sys_control_type/del", param);
+ let res = await window.framework.http.post("/sys_control_type/del", param);
return res;
}
}
diff --git a/demo/src/api/users/recommend_blocks_server.js b/demo/src/api/users/recommend_blocks_server.js
index ad9a228..09246c0 100644
--- a/demo/src/api/users/recommend_blocks_server.js
+++ b/demo/src/api/users/recommend_blocks_server.js
@@ -1,12 +1,12 @@
-import http from '@/libs/http';
+
class recommend_blocksClServer {
async all(param) {
- let res= await http.get('/recommend_blocks/all', param);
+ let res= await window.framework.httpget('/recommend_blocks/all', param);
return res;
}
async page(row) {
- let res= await http.post('/recommend_blocks/page', row);
+ let res= await window.framework.http.post('/recommend_blocks/page', row);
return res;
}
@@ -16,17 +16,17 @@ class recommend_blocksClServer {
}
async add(row) {
- let res= await http.post('/recommend_blocks/add', row);
+ let res= await window.framework.http.post('/recommend_blocks/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/recommend_blocks/edit', row);
+ let res= await window.framework.http.post('/recommend_blocks/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/recommend_blocks/del', row);
+ let res= await window.framework.http.post('/recommend_blocks/del', row);
return res;
}
}
diff --git a/demo/src/api/users/user_follows_server.js b/demo/src/api/users/user_follows_server.js
index 9acec6f..bacaf93 100644
--- a/demo/src/api/users/user_follows_server.js
+++ b/demo/src/api/users/user_follows_server.js
@@ -1,12 +1,12 @@
-import http from '@/libs/http';
+
class user_followsClServer {
async all(param) {
- let res= await http.get('/user_follows/all', param);
+ let res= await window.framework.httpget('/user_follows/all', param);
return res;
}
async page(row) {
- let res= await http.post('/user_follows/page', row);
+ let res= await window.framework.http.post('/user_follows/page', row);
return res;
}
@@ -16,17 +16,17 @@ class user_followsClServer {
}
async add(row) {
- let res= await http.post('/user_follows/add', row);
+ let res= await window.framework.http.post('/user_follows/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/user_follows/edit', row);
+ let res= await window.framework.http.post('/user_follows/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/user_follows/del', row);
+ let res= await window.framework.http.post('/user_follows/del', row);
return res;
}
}
diff --git a/demo/src/api/users/user_tracking_server.js b/demo/src/api/users/user_tracking_server.js
index faef804..576e270 100644
--- a/demo/src/api/users/user_tracking_server.js
+++ b/demo/src/api/users/user_tracking_server.js
@@ -1,12 +1,12 @@
-import http from '@/libs/http';
+
class user_trackingClServer {
async all(param) {
- let res= await http.get('/user_tracking/all', param);
+ let res= await window.framework.httpget('/user_tracking/all', param);
return res;
}
async page(row) {
- let res= await http.post('/user_tracking/page', row);
+ let res= await window.framework.http.post('/user_tracking/page', row);
return res;
}
@@ -16,17 +16,17 @@ class user_trackingClServer {
}
async add(row) {
- let res= await http.post('/user_tracking/add', row);
+ let res= await window.framework.http.post('/user_tracking/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/user_tracking/edit', row);
+ let res= await window.framework.http.post('/user_tracking/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/user_tracking/del', row);
+ let res= await window.framework.http.post('/user_tracking/del', row);
return res;
}
}
diff --git a/demo/src/api/venues/wch_cities_server.js b/demo/src/api/venues/wch_cities_server.js
index cabcbd7..6e4567b 100644
--- a/demo/src/api/venues/wch_cities_server.js
+++ b/demo/src/api/venues/wch_cities_server.js
@@ -1,12 +1,12 @@
-import http from '@/libs/http';
+
class wch_citiesClServer {
async all(param) {
- let res= await http.get('/wch_cities/all', param);
+ let res= await window.framework.httpget('/wch_cities/all', param);
return res;
}
async page(row) {
- let res= await http.post('/wch_cities/page', row);
+ let res= await window.framework.http.post('/wch_cities/page', row);
return res;
}
@@ -16,17 +16,17 @@ class wch_citiesClServer {
}
async add(row) {
- let res= await http.post('/wch_cities/add', row);
+ let res= await window.framework.http.post('/wch_cities/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/wch_cities/edit', row);
+ let res= await window.framework.http.post('/wch_cities/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/wch_cities/del', row);
+ let res= await window.framework.http.post('/wch_cities/del', row);
return res;
}
}
diff --git a/demo/src/main.js b/demo/src/main.js
index c4eae90..b72ac57 100644
--- a/demo/src/main.js
+++ b/demo/src/main.js
@@ -39,10 +39,29 @@ const app = new Vue({
router: AdminFramework.router,
store: AdminFramework.store,
render: h => h('router-view'),
- created() {
+ async created() {
console.log('=== Admin Framework Demo 启动成功 ===')
console.log('框架版本:', AdminFramework.version)
console.log('配置信息:', this.$config)
+
+ // 刷新时恢复菜单
+ const token = this.$store.state.user.token
+ const authorityMenus = localStorage.getItem('authorityMenus')
+
+ if (token && authorityMenus) {
+ console.log('检测到登录状态,恢复菜单...')
+ try {
+ await this.$store.dispatch('user/setAuthorityMenus', {
+ Main: AdminFramework.Main,
+ ParentView: AdminFramework.ParentView,
+ Page404: AdminFramework.Page404,
+ authorityMenus: authorityMenus
+ })
+ console.log('菜单恢复成功')
+ } catch (error) {
+ console.error('恢复菜单失败:', error)
+ }
+ }
}
})
diff --git a/demo/使用说明.md b/demo/使用说明.md
new file mode 100644
index 0000000..452b7e5
--- /dev/null
+++ b/demo/使用说明.md
@@ -0,0 +1,584 @@
+# Admin Framework 正确使用方法
+
+## 一、框架打包说明
+
+Admin Framework 打包后是一个单独的 JS 文件:
+- **生产版本**: `dist/admin-framework.js` (压缩,无 sourcemap)
+- **开发版本**: `dist/admin-framework.dev.js` (不压缩,有 sourcemap)
+
+## 二、在业务页面中使用框架功能
+
+### 1. HTTP 请求
+
+❌ **错误用法**(不要这样写):
+```javascript
+import http from '@/utils/admin-framework.js' // ❌ 错误!
+```
+
+✅ **正确用法**:
+```javascript
+// 方式一:在 Vue 组件中使用 this.$http(推荐)
+export default {
+ async mounted() {
+ // GET 请求
+ const res = await this.$http.get('/api/users')
+
+ // POST 请求
+ const res2 = await this.$http.post('/api/users', { name: '张三' })
+ }
+}
+
+// 方式二:使用全局 framework.http
+const res = await window.framework.http.get('/api/users')
+```
+
+### 2. 工具函数
+
+✅ **正确用法**:
+```javascript
+export default {
+ methods: {
+ formatDate() {
+ // 使用 this.$tools
+ const formatted = this.$tools.formatDate(new Date(), 'yyyy-MM-dd')
+
+ // 或使用全局 framework.tools
+ const formatted2 = window.framework.tools.formatDate(new Date(), 'yyyy-MM-dd')
+ }
+ }
+}
+```
+
+### 3. UI 工具
+
+✅ **正确用法**:
+```javascript
+export default {
+ methods: {
+ showMessage() {
+ // 使用 this.$uiTool
+ this.$uiTool.success('操作成功')
+ this.$uiTool.error('操作失败')
+
+ // 或使用全局 framework.uiTool
+ window.framework.uiTool.success('操作成功')
+ },
+
+ async confirmDelete() {
+ // 确认对话框
+ try {
+ await this.$uiTool.confirm('确定删除吗?')
+ // 确认后的操作
+ this.$Message.success('已删除')
+ } catch {
+ // 取消操作
+ this.$Message.info('已取消')
+ }
+ }
+ }
+}
+```
+
+### 4. 配置信息
+
+✅ **正确用法**:
+```javascript
+export default {
+ data() {
+ return {
+ // 从配置中获取 API 地址
+ uploadUrl: this.$config.uploadUrl
+ }
+ },
+
+ mounted() {
+ console.log('系统标题:', this.$config.title)
+ console.log('API 地址:', this.$config.apiUrl)
+ }
+}
+```
+
+### 5. Vuex Store
+
+✅ **正确用法**:
+```javascript
+import { mapGetters, mapActions } from 'vuex'
+
+export default {
+ computed: {
+ // 使用框架内置的 store
+ ...mapGetters('user', ['userName', 'menuList']),
+ ...mapGetters('app', ['sysFormModel'])
+ },
+
+ methods: {
+ ...mapActions('user', ['handleLogOut'])
+ }
+}
+```
+
+### 6. 路由跳转
+
+✅ **正确用法**:
+```javascript
+export default {
+ methods: {
+ goToPage() {
+ // 使用 path 跳转(推荐)
+ this.$router.push({ path: '/ball/games' })
+
+ // 带参数跳转
+ this.$router.push({
+ path: '/ball/game_comments',
+ query: { id: 123 }
+ })
+ }
+ }
+}
+```
+
+## 三、创建业务 API 模块
+
+### 正确的 API 封装方式
+
+```javascript
+// src/api/ball/gamesServer.js
+
+/**
+ * 球赛管理 API
+ * 注意:不需要 import http,直接使用 window.framework.http
+ */
+
+class GamesServer {
+ /**
+ * 获取球赛列表
+ */
+ async getList(params) {
+ return await window.framework.http.post('/games/page', params)
+ }
+
+ /**
+ * 获取球赛详情
+ */
+ async getDetail(id) {
+ return await window.framework.http.get(`/games/detail/${id}`)
+ }
+
+ /**
+ * 创建球赛
+ */
+ async create(data) {
+ return await window.framework.http.post('/games/create', data)
+ }
+
+ /**
+ * 更新球赛
+ */
+ async update(id, data) {
+ return await window.framework.http.post(`/games/update/${id}`, data)
+ }
+
+ /**
+ * 删除球赛
+ */
+ async delete(id) {
+ return await window.framework.http.post(`/games/delete/${id}`)
+ }
+
+ /**
+ * 批量删除
+ */
+ async batchDelete(ids) {
+ return await window.framework.http.post('/games/batch_delete', { ids })
+ }
+}
+
+export default new GamesServer()
+```
+
+### 在组件中使用 API
+
+```vue
+
+
+
+
+
+```
+
+## 四、完整的页面示例
+
+```vue
+
+
+
+
+
+ 球赛管理
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+## 五、全局可用的对象
+
+在任何 Vue 组件中,都可以使用以下对象:
+
+| 对象 | 说明 | 使用示例 |
+|-----|------|---------|
+| `this.$http` | HTTP 请求实例 | `this.$http.get('/api/users')` |
+| `this.$tools` | 工具函数集合 | `this.$tools.formatDate(new Date())` |
+| `this.$uiTool` | UI 工具函数 | `this.$uiTool.success('成功')` |
+| `this.$config` | 配置对象 | `this.$config.apiUrl` |
+| `this.$router` | 路由实例 | `this.$router.push({ path: '/home' })` |
+| `this.$store` | Vuex Store | `this.$store.state.user.userName` |
+| `window.framework` | 框架实例 | `window.framework.version` |
+| `window.app` | Vue 根实例 | `window.app.$router` |
+
+## 六、注意事项
+
+1. ❌ **不要尝试导入框架内部模块**
+ ```javascript
+ import http from '@/utils/admin-framework.js' // ❌ 错误
+ import tools from 'admin-framework/tools' // ❌ 错误
+ ```
+
+2. ✅ **使用 Vue 实例上的属性**
+ ```javascript
+ this.$http // ✅ 正确
+ this.$tools // ✅ 正确
+ this.$uiTool // ✅ 正确
+ ```
+
+3. ✅ **或使用全局对象**
+ ```javascript
+ window.framework.http // ✅ 正确
+ window.framework.tools // ✅ 正确
+ window.framework.uiTool // ✅ 正确
+ ```
+
+4. **路由跳转使用 path 而不是 name**
+ ```javascript
+ this.$router.push({ path: '/ball/games' }) // ✅ 正确
+ this.$router.push({ name: '球赛管理' }) // ❌ 错误(name 可能不存在)
+ ```
+
+## 七、快速开始检查清单
+
+- [ ] 框架已构建:`npm run build`
+- [ ] Demo 依赖已安装:`cd demo && npm install`
+- [ ] 组件映射表已配置:`demo/src/router/component-map.js`
+- [ ] API 地址已配置:`demo/src/main.js` 中的 `config.apiUrl`
+- [ ] 页面中使用 `this.$http` 而不是 `import http`
+- [ ] 路由跳转使用 `path` 而不是 `name`
+
diff --git a/demo/快速修复指南.md b/demo/快速修复指南.md
new file mode 100644
index 0000000..400bfc0
--- /dev/null
+++ b/demo/快速修复指南.md
@@ -0,0 +1,145 @@
+# 🚀 快速修复指南
+
+## ❌ 常见错误用法
+
+### 1. 错误的 HTTP 导入
+```javascript
+// ❌ 错误!不要这样写
+import http from '@/utils/admin-framework.js'
+import { http } from 'admin-framework'
+
+// ✅ 正确!直接使用
+this.$http.get('/api/xxx')
+window.framework.http.get('/api/xxx')
+```
+
+### 2. 错误的工具函数导入
+```javascript
+// ❌ 错误!不要这样写
+import tools from 'admin-framework/tools'
+
+// ✅ 正确!直接使用
+this.$tools.formatDate(new Date())
+window.framework.tools.formatDate(new Date())
+```
+
+## ✅ 正确的使用方式
+
+### 在 Vue 组件中
+
+```vue
+
+```
+
+### 在 API 模块中
+
+```javascript
+// src/api/ball/gamesServer.js
+
+class GamesServer {
+ async getList(params) {
+ // ✅ 使用 window.framework.http
+ return await window.framework.http.post('/games/page', params)
+ }
+}
+
+export default new GamesServer()
+```
+
+### 在组件中使用 API
+
+```vue
+
+```
+
+## 📝 修改步骤
+
+### 步骤1:修改所有 API 文件
+
+查找并替换:
+```javascript
+// 查找
+import http from '@/utils/admin-framework.js'
+http.http.get(...)
+
+// 替换为
+window.framework.http.get(...)
+```
+
+### 步骤2:修改路由跳转
+
+查找并替换:
+```javascript
+// 查找
+this.$router.push({ name: 'xxx' })
+
+// 替换为
+this.$router.push({ path: '/xxx/yyy' })
+```
+
+### 步骤3:重新构建框架
+
+```bash
+# 在项目根目录
+npm run build
+```
+
+### 步骤4:测试
+
+```bash
+# 在 demo 目录
+cd demo
+npm run dev
+```
+
+## 🔍 检查清单
+
+- [ ] 所有 API 文件都使用 `window.framework.http`
+- [ ] 所有路由跳转都使用 `path` 而不是 `name`
+- [ ] 组件中使用 `this.$http`、`this.$tools`、`this.$uiTool`
+- [ ] 组件映射表已配置(`demo/src/router/component-map.js`)
+- [ ] 框架已重新构建(`npm run build`)
+- [ ] Demo 可以正常运行(`cd demo && npm run dev`)
+
+## 📚 更多说明
+
+详细使用说明请查看:
+- `demo/使用说明.md` - 完整的使用指南
+- `demo/src/api/ball/gamesServer.js` - API 模块示例
+- `_doc/完整使用文档.md` - 框架完整文档
+
diff --git a/src/api/system/fileServe.js b/src/api/system/fileServe.js
index bac6313..4507b35 100644
--- a/src/api/system/fileServe.js
+++ b/src/api/system/fileServe.js
@@ -1,12 +1,12 @@
import http from "@/utils/http";
class FileServe {
async upload_oos_img(row) {
- let res = await http.postFormData("/sys_file/upload_oos_img", row);
+ let res = await window.framework.http.postFormData("/sys_file/upload_oos_img", row);
return res;
}
async upload_Img(row) {
- let res = await http.postFormData("/file/upload_Img", row);
+ let res = await window.framework.http.postFormData("/file/upload_Img", row);
return res;
}
}
diff --git a/src/api/system/rolePermissionServer.js b/src/api/system/rolePermissionServer.js
index 7911b0c..61eefec 100644
--- a/src/api/system/rolePermissionServer.js
+++ b/src/api/system/rolePermissionServer.js
@@ -1,27 +1,27 @@
import http from '@/utils/http'
class RolePermissionServer {
async getRoles(callback) {
- let res = await http.get('/SysRolePermission/Query', {})
+ let res = await window.framework.httpget('/SysRolePermission/Query', {})
return res
}
async getRole(row) {
- let res = await http.get('/SysRolePermission/QueryByRoleId', row)
+ let res = await window.framework.httpget('/SysRolePermission/QueryByRoleId', row)
return res
}
async add(row) {
- let res = await http.post('/SysRolePermission/add', row)
+ let res = await window.framework.http.post('/SysRolePermission/add', row)
return res
}
async edit(row) {
- let res = await http.post('/SysRolePermission/edit', row)
+ let res = await window.framework.http.post('/SysRolePermission/edit', row)
return res
}
async del(row) {
- let res = await http.post('/SysRolePermission/del', row)
+ let res = await window.framework.http.post('/SysRolePermission/del', row)
return res
}
}
diff --git a/src/api/system/roleServer.js b/src/api/system/roleServer.js
index 896fe1a..298db1b 100644
--- a/src/api/system/roleServer.js
+++ b/src/api/system/roleServer.js
@@ -1,23 +1,23 @@
import http from "@/utils/http";
class RoleServer {
async list() {
- let res = await http.get("/sys_role/index", {});
+ let res = await window.framework.httpget("/sys_role/index", {});
return res;
}
async add(row) {
- let res = await http.post("/sys_role/add", row);
+ let res = await window.framework.http.post("/sys_role/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_role/edit", row);
+ let res = await window.framework.http.post("/sys_role/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_role/del", row);
+ let res = await window.framework.http.post("/sys_role/del", row);
return res;
}
}
diff --git a/src/api/system/shpProfitServer.js b/src/api/system/shpProfitServer.js
index 42e7511..19171ff 100644
--- a/src/api/system/shpProfitServer.js
+++ b/src/api/system/shpProfitServer.js
@@ -1,12 +1,12 @@
import http from '@/utils/http'
class ShpProfitServer {
async report(param) {
- let res = await http.post('/shpProfit/report', param)
+ let res = await window.framework.http.post('/shpProfit/report', param)
return res
}
async list(param) {
- let res = await http.post('/shpProfit/list', param)
+ let res = await window.framework.http.post('/shpProfit/list', param)
return res
}
}
diff --git a/src/api/system/specificationServer.js b/src/api/system/specificationServer.js
index df329f3..5e2d9fb 100644
--- a/src/api/system/specificationServer.js
+++ b/src/api/system/specificationServer.js
@@ -1,22 +1,22 @@
import http from '@/utils/http'
class SpecificationServer {
async list() {
- let res = await http.post('/specification/list', {})
+ let res = await window.framework.http.post('/specification/list', {})
return res
}
async add(row) {
- let res = await http.post('/specification/add', row)
+ let res = await window.framework.http.post('/specification/add', row)
return res
}
async edit(row) {
- let res = await http.post('/specification/edit', row)
+ let res = await window.framework.http.post('/specification/edit', row)
return res
}
async del(row) {
- let res = await http.post('/specification/del', row)
+ let res = await window.framework.http.post('/specification/del', row)
return res
}
}
diff --git a/src/api/system/sysAddressServer.js b/src/api/system/sysAddressServer.js
index 5902b29..4e2b895 100644
--- a/src/api/system/sysAddressServer.js
+++ b/src/api/system/sysAddressServer.js
@@ -1,7 +1,7 @@
import http from "@/utils/http";
class SysAddress {
async index(param) {
- let res = await http.get("/sys_address/index", param);
+ let res = await window.framework.httpget("/sys_address/index", param);
return res;
}
}
diff --git a/src/api/system/sysModuleServer.js b/src/api/system/sysModuleServer.js
index 7ce1b07..57c87e6 100644
--- a/src/api/system/sysModuleServer.js
+++ b/src/api/system/sysModuleServer.js
@@ -1,27 +1,27 @@
import http from "@/utils/http";
class SysModuleServer {
async all() {
- let res = await http.get("/sys_menu/all", {});
+ let res = await window.framework.httpget("/sys_menu/all", {});
return res;
}
async list(row) {
- let res = await http.get("/sys_menu/all", row);
+ let res = await window.framework.httpget("/sys_menu/all", row);
return res;
}
async add(row) {
- let res = await http.post("/sys_menu/add", row);
+ let res = await window.framework.http.post("/sys_menu/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_menu/edit", row);
+ let res = await window.framework.http.post("/sys_menu/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_menu/del", row);
+ let res = await window.framework.http.post("/sys_menu/del", row);
return res;
}
}
diff --git a/src/api/system/sys_log_serve.js b/src/api/system/sys_log_serve.js
index 9121304..4c5c9aa 100644
--- a/src/api/system/sys_log_serve.js
+++ b/src/api/system/sys_log_serve.js
@@ -1,27 +1,27 @@
import http from "@/utils/http";
class SysLogServe {
async all(param) {
- let res = await http.get("/sys_log/all", param);
+ let res = await window.framework.httpget("/sys_log/all", param);
return res;
}
async detail(param) {
- let res = await http.get("/sys_log/detail", param);
+ let res = await window.framework.httpget("/sys_log/detail", param);
return res;
}
async delete(param) {
- let res = await http.get("/sys_log/delete", param);
+ let res = await window.framework.httpget("/sys_log/delete", param);
return res;
}
async delete_all(param) {
- let res = await http.get("/sys_log/delete_all", param);
+ let res = await window.framework.httpget("/sys_log/delete_all", param);
return res;
}
async operates(param) {
- let res = await http.get("/sys_log/operates", param);
+ let res = await window.framework.httpget("/sys_log/operates", param);
return res;
}
}
diff --git a/src/api/system/systemType_server.js b/src/api/system/systemType_server.js
index 46f4d74..17fc674 100644
--- a/src/api/system/systemType_server.js
+++ b/src/api/system/systemType_server.js
@@ -1,13 +1,13 @@
import http from '@/utils/http';
class systemTypeClServer {
async all(param) {
- let res= await http.get('/sys_project_type/all', param);
+ let res= await window.framework.httpget('/sys_project_type/all', param);
return res;
}
async page(row) {
- let res= await http.post('/sys_project_type/page', row);
+ let res= await window.framework.http.post('/sys_project_type/page', row);
return res;
}
@@ -18,17 +18,17 @@ class systemTypeClServer {
}
async add(row) {
- let res= await http.post('/sys_project_type/add', row);
+ let res= await window.framework.http.post('/sys_project_type/add', row);
return res;
}
async edit(row) {
- let res= await http.post('/sys_project_type/edit', row);
+ let res= await window.framework.http.post('/sys_project_type/edit', row);
return res;
}
async del(row) {
- let res= await http.post('/sys_project_type/del', row);
+ let res= await window.framework.http.post('/sys_project_type/del', row);
return res;
}
}
diff --git a/src/api/system/tableServer.js b/src/api/system/tableServer.js
index 2650df6..c47208d 100644
--- a/src/api/system/tableServer.js
+++ b/src/api/system/tableServer.js
@@ -1,29 +1,29 @@
import http from '@/utils/http'
class TableServer {
async getAll(callback) {
- return await http.get('/table/index', {})
+ return await window.framework.httpget('/table/index', {})
}
async add(row, callback) {
- return await http.post('/table/add', row)
+ return await window.framework.http.post('/table/add', row)
}
async edit(row, callback) {
- return await http.post('/table/edit', row, function(res) {
+ return await window.framework.http.post('/table/edit', row, function(res) {
callback && callback(res)
})
}
async del(row, callback) {
- return await http.post('/table/del', row)
+ return await window.framework.http.post('/table/del', row)
}
async autoApi(id) {
- return await http.get('/template/api', { id: id })
+ return await window.framework.httpget('/template/api', { id: id })
}
async autoDb(id) {
- return await http.get('/template/autoDb', { id: id })
+ return await window.framework.httpget('/template/autoDb', { id: id })
}
}
diff --git a/src/api/system/userServer.js b/src/api/system/userServer.js
index 23529ce..86f597f 100644
--- a/src/api/system/userServer.js
+++ b/src/api/system/userServer.js
@@ -1,12 +1,12 @@
import http from "@/utils/http";
class UserServer {
async login(row) {
- let res = await http.post("/sys_user/login", row);
+ let res = await window.framework.http.post("/sys_user/login", row);
return res;
}
async all() {
- let res = await http.get("/sys_user/index", {});
+ let res = await window.framework.httpget("/sys_user/index", {});
return res;
}
@@ -16,22 +16,22 @@ class UserServer {
}
async authorityMenus() {
- let res = await http.post("/sys_user/authorityMenus", {});
+ let res = await window.framework.http.post("/sys_user/authorityMenus", {});
return res;
}
async add(row) {
- let res = await http.post("/sys_user/add", row);
+ let res = await window.framework.http.post("/sys_user/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_user/edit", row);
+ let res = await window.framework.http.post("/sys_user/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_user/del", row);
+ let res = await window.framework.http.post("/sys_user/del", row);
return res;
}
}
diff --git a/src/api/system_high/formFieldServer.js b/src/api/system_high/formFieldServer.js
index 1e843ea..09022f9 100644
--- a/src/api/system_high/formFieldServer.js
+++ b/src/api/system_high/formFieldServer.js
@@ -1,27 +1,27 @@
import http from "@/utils/http";
class FormFieldServer {
async all(param) {
- let res = await http.get("/sys_form_field/all", param);
+ let res = await window.framework.httpget("/sys_form_field/all", param);
return res;
}
async page(row) {
- let res = await http.post("/sys_form_field/page", row);
+ let res = await window.framework.http.post("/sys_form_field/page", row);
return res;
}
async add(row) {
- let res = await http.post("/sys_form_field/add", row);
+ let res = await window.framework.http.post("/sys_form_field/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_form_field/edit", row);
+ let res = await window.framework.http.post("/sys_form_field/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_form_field/del", row);
+ let res = await window.framework.http.post("/sys_form_field/del", row);
return res;
}
}
diff --git a/src/api/system_high/formServer.js b/src/api/system_high/formServer.js
index e47ba25..c7e57a4 100644
--- a/src/api/system_high/formServer.js
+++ b/src/api/system_high/formServer.js
@@ -1,32 +1,32 @@
import http from "@/utils/http";
class FormServer {
async all(param) {
- let res = await http.get("/sys_form/all", param);
+ let res = await window.framework.httpget("/sys_form/all", param);
return res;
}
async page(row) {
- let res = await http.post("/sys_form/page", row);
+ let res = await window.framework.http.post("/sys_form/page", row);
return res;
}
async generate(row) {
- let res = await http.post("/sys_form/generate", row);
+ let res = await window.framework.http.post("/sys_form/generate", row);
return res;
}
async add(row) {
- let res = await http.post("/sys_form/add", row);
+ let res = await window.framework.http.post("/sys_form/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_form/edit", row);
+ let res = await window.framework.http.post("/sys_form/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_form/del", row);
+ let res = await window.framework.http.post("/sys_form/del", row);
return res;
}
}
diff --git a/src/api/system_high/menuServer.js b/src/api/system_high/menuServer.js
index e36be2e..d99d9ba 100644
--- a/src/api/system_high/menuServer.js
+++ b/src/api/system_high/menuServer.js
@@ -2,46 +2,46 @@ import http from "@/utils/http";
class MenuServer {
async list(row) {
- let res = await http.get("/sys_menu/index", row);
+ let res = await window.framework.httpget("/sys_menu/index", row);
return res;
}
async generate(row) {
- let res = await http.post("/sys_menu/generate", row);
+ let res = await window.framework.http.post("/sys_menu/generate", row);
return res;
}
async add(row) {
- let res = await http.post("/sys_menu/add", row);
+ let res = await window.framework.http.post("/sys_menu/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_menu/edit", row);
+ let res = await window.framework.http.post("/sys_menu/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_menu/del", row);
+ let res = await window.framework.http.post("/sys_menu/del", row);
return res;
}
async generate(row) {
- let res = await http.post("/form/generate", row);
+ let res = await window.framework.http.post("/form/generate", row);
return res;
}
async generateModel(row) {
- let res = await http.post("/model/generate", row);
+ let res = await window.framework.http.post("/model/generate", row);
return res;
}
async modelAll(row) {
- let res = await http.post("/model/all", row);
+ let res = await window.framework.http.post("/model/all", row);
return res;
}
async modelInterface(row) {
- let res = await http.post("/model/interface", row);
+ let res = await window.framework.http.post("/model/interface", row);
return res;
}
}
diff --git a/src/api/system_high/modelFieldServer.js b/src/api/system_high/modelFieldServer.js
index 6929014..800dfea 100644
--- a/src/api/system_high/modelFieldServer.js
+++ b/src/api/system_high/modelFieldServer.js
@@ -1,29 +1,29 @@
import http from "@/utils/http";
class ModelFieldServer {
async all(row) {
- let res = await http.get("/sys_model_field/all", row);
+ let res = await window.framework.httpget("/sys_model_field/all", row);
return res;
}
async allByKey(row) {
- let res = await http.get("/sys_model_field/allByKey", row, {
+ let res = await window.framework.httpget("/sys_model_field/allByKey", row, {
hideLoad: true
});
return res;
}
async add(row) {
- let res = await http.post("/sys_model_field/add", row);
+ let res = await window.framework.http.post("/sys_model_field/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_model_field/edit", row);
+ let res = await window.framework.http.post("/sys_model_field/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_model_field/del", row);
+ let res = await window.framework.http.post("/sys_model_field/del", row);
return res;
}
}
diff --git a/src/api/system_high/modelServer.js b/src/api/system_high/modelServer.js
index 5b20d87..438cfef 100644
--- a/src/api/system_high/modelServer.js
+++ b/src/api/system_high/modelServer.js
@@ -1,37 +1,37 @@
import http from "@/utils/http";
class ModelServer {
async interface(row) {
- let res = await http.post("/sys_model/interface", row);
+ let res = await window.framework.http.post("/sys_model/interface", row);
return res;
}
async all() {
- let res = await http.get("/sys_model/all", {});
+ let res = await window.framework.httpget("/sys_model/all", {});
return res;
}
async detail(row) {
- let res = await http.get("/sys_model/detail", row);
+ let res = await window.framework.httpget("/sys_model/detail", row);
return res;
}
async regenerate(row) {
- let res = await http.post("/sys_model/regenerate", row);
+ let res = await window.framework.http.post("/sys_model/regenerate", row);
return res;
}
async add(row) {
- let res = await http.post("/sys_model/add", row);
+ let res = await window.framework.http.post("/sys_model/add", row);
return res;
}
async edit(row) {
- let res = await http.post("/sys_model/edit", row);
+ let res = await window.framework.http.post("/sys_model/edit", row);
return res;
}
async del(row) {
- let res = await http.post("/sys_model/del", row);
+ let res = await window.framework.http.post("/sys_model/del", row);
return res;
}
}
diff --git a/src/api/system_high/paramSetupServer.js b/src/api/system_high/paramSetupServer.js
index 590dadf..21ff496 100644
--- a/src/api/system_high/paramSetupServer.js
+++ b/src/api/system_high/paramSetupServer.js
@@ -1,27 +1,27 @@
import http from "@/utils/http";
class ParamSetupServer {
async getAll() {
- return await http.get("/sys_parameter/index", {});
+ return await window.framework.httpget("/sys_parameter/index", {});
}
async getOne(key) {
- return await http.get("/sys_parameter/key", { key });
+ return await window.framework.httpget("/sys_parameter/key", { key });
}
async add(row) {
- return await http.post("/sys_parameter/add", row);
+ return await window.framework.http.post("/sys_parameter/add", row);
}
async edit(row) {
- return await http.post("/sys_parameter/edit", row);
+ return await window.framework.http.post("/sys_parameter/edit", row);
}
async setSysConfig(row) {
- return await http.post("/sys_parameter/setSysConfig", row);
+ return await window.framework.http.post("/sys_parameter/setSysConfig", row);
}
async del(row) {
- return await http.post("/sys_parameter/del", row);
+ return await window.framework.http.post("/sys_parameter/del", row);
}
}
diff --git a/src/api/system_high/sysControlTypeServer.js b/src/api/system_high/sysControlTypeServer.js
index e2c831f..b0be274 100644
--- a/src/api/system_high/sysControlTypeServer.js
+++ b/src/api/system_high/sysControlTypeServer.js
@@ -1,26 +1,26 @@
import http from "@/utils/http";
class SysControlTypeServer {
async all(param) {
- let res = await http.get("/sys_control_type/all", param);
+ let res = await window.framework.httpget("/sys_control_type/all", param);
return res;
}
async page(row) {
- let res = await http.post("/sys_control_type/page", row);
+ let res = await window.framework.http.post("/sys_control_type/page", row);
return res;
}
async add(param) {
- let res = await http.post("/sys_control_type/add", param);
+ let res = await window.framework.http.post("/sys_control_type/add", param);
return res;
}
async edit(param) {
- let res = await http.post("/sys_control_type/edit", param);
+ let res = await window.framework.http.post("/sys_control_type/edit", param);
return res;
}
async del(param) {
- let res = await http.post("/sys_control_type/del", param);
+ let res = await window.framework.http.post("/sys_control_type/del", param);
return res;
}
}
diff --git a/src/store/user.js b/src/store/user.js
index 3301657..3980bb4 100644
--- a/src/store/user.js
+++ b/src/store/user.js
@@ -10,7 +10,7 @@ export default {
avatorImgPath: '',
token: getToken(),
authorityMenus: [],
- menuList: []
+ menuList: localStorage.getItem('menuList') ? JSON.parse(localStorage.getItem('menuList')) : []
},
mutations: {
setAvator(state, avatorPath) {
@@ -30,6 +30,7 @@ export default {
},
setMenuList(state, menus) {
state.menuList = menus
+ localStorage.setItem('menuList', JSON.stringify(menus))
}
},
getters: {
@@ -173,6 +174,8 @@ export default {
async handleLogOut({ state, commit }, vue) {
commit('setToken', '')
commit('setAuthorityMenus', '[]')
+ commit('setMenuList', [])
+ localStorage.removeItem('menuList')
window.location.reload()
}
}
diff --git a/src/utils/http.js b/src/utils/http.js
index 0d2e9a2..7c40a58 100644
--- a/src/utils/http.js
+++ b/src/utils/http.js
@@ -72,7 +72,7 @@ class Http {
this.store.commit('user/setToken', '')
}
if (window.rootVue && window.rootVue.$router) {
- window.rootVue.$router.push({ name: 'login' })
+ window.rootVue.$router.push({ path: '/login' }) // 使用 path 而不是 name
}
return Promise.reject(error)
}
diff --git a/src/utils/uiTool.js b/src/utils/uiTool.js
index c7b63d0..de33d14 100644
--- a/src/utils/uiTool.js
+++ b/src/utils/uiTool.js
@@ -245,11 +245,12 @@ export default class uiTool {
let curRoutes = uiTool.menuToRoute(menus, ParentView, Page404)
// 合并权限路由,保留默认 home 路由
- const homeRoute = mainRoute.children.find(r => r.name === 'home')
- const hasHome = curRoutes.some(r => r.name === 'home')
+ const homeRoute = mainRoute.children.find(r => r.path === '/home')
+ // 检查权限路由中是否有首页(基于 path 判断)
+ const hasHome = curRoutes.some(r => r.path === '/home' || r.path === 'home')
if (hasHome) {
- // 如果权限路由中有 home,使用权限路由的 home
+ // 如果权限路由中有 home,使用权限路由的 home(不添加默认首页)
mainRoute.children = curRoutes
} else {
// 如果权限路由中没有 home,保留默认 home 并添加其他路由