This commit is contained in:
张成
2025-10-09 18:17:41 +08:00
parent 366c18bcea
commit ba61c9e45d
63 changed files with 1133 additions and 295 deletions

View File

@@ -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 })
}
}

View File

@@ -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();

View File

@@ -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;
}
}

View File

@@ -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()

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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
}
}

View File

@@ -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;
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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 })
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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);
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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)
}
}
}
})

584
demo/使用说明.md Normal file
View File

@@ -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
<template>
<div>
<Tables
:columns="columns"
:data="tableData"
:loading="loading"
@on-refresh="getList"
/>
</div>
</template>
<script>
// 导入 API 模块
import gamesServer from '@/api/ball/gamesServer.js'
export default {
name: 'Games',
data() {
return {
columns: [
{ title: 'ID', key: 'id' },
{ title: '名称', key: 'name' },
{ title: '时间', key: 'time' }
],
tableData: [],
loading: false,
queryParams: {
page: 1,
size: 20
}
}
},
mounted() {
this.getList()
},
methods: {
async getList() {
this.loading = true
try {
const res = await gamesServer.getList(this.queryParams)
if (res.code === 0) {
this.tableData = res.data.list
}
} catch (error) {
this.$uiTool.error('获取数据失败')
} finally {
this.loading = false
}
},
async handleDelete(id) {
try {
await this.$uiTool.confirm('确定删除吗?')
const res = await gamesServer.delete(id)
if (res.code === 0) {
this.$uiTool.success('删除成功')
this.getList()
}
} catch (error) {
// 取消删除
}
}
}
}
</script>
```
## 四、完整的页面示例
```vue
<template>
<div class="page-container">
<Card>
<p slot="title">
<Icon type="ios-list" />
球赛管理
</p>
<!-- 搜索栏 -->
<Form inline style="margin-bottom: 16px;">
<FormItem>
<Input
v-model="queryParams.keyword"
placeholder="请输入关键词"
clearable
style="width: 200px;"
/>
</FormItem>
<FormItem>
<Button type="primary" @click="handleSearch">
<Icon type="ios-search" />
搜索
</Button>
<Button @click="handleReset" style="margin-left: 8px;">
重置
</Button>
<Button type="success" @click="handleAdd" style="margin-left: 8px;">
<Icon type="ios-add" />
新增
</Button>
</FormItem>
</Form>
<!-- 数据表格 -->
<Tables
ref="table"
:columns="columns"
:data="tableData"
:loading="loading"
:total="total"
:page-size="queryParams.size"
:current-page="queryParams.page"
@on-page-change="handlePageChange"
@on-page-size-change="handlePageSizeChange"
/>
</Card>
<!-- 编辑弹窗 -->
<Modal
v-model="modalVisible"
:title="modalTitle"
width="600"
@on-ok="handleSubmit"
@on-cancel="handleCancel"
>
<Form ref="form" :model="formData" :rules="rules" :label-width="100">
<FormItem label="名称" prop="name">
<Input v-model="formData.name" placeholder="请输入名称" />
</FormItem>
<FormItem label="时间" prop="time">
<DatePicker
v-model="formData.time"
type="datetime"
placeholder="请选择时间"
style="width: 100%;"
/>
</FormItem>
</Form>
</Modal>
</div>
</template>
<script>
import gamesServer from '@/api/ball/gamesServer.js'
export default {
name: 'Games',
data() {
return {
// 查询参数
queryParams: {
page: 1,
size: 20,
keyword: ''
},
// 表格数据
columns: [
{ title: 'ID', key: 'id', width: 80 },
{ title: '名称', key: 'name' },
{
title: '时间',
key: 'time',
render: (h, params) => {
return h('span', this.$tools.formatDate(params.row.time, 'yyyy-MM-dd HH:mm'))
}
},
{
title: '操作',
width: 200,
render: (h, params) => {
return h('div', [
h('Button', {
props: { type: 'primary', size: 'small' },
style: { marginRight: '5px' },
on: { click: () => this.handleEdit(params.row) }
}, '编辑'),
h('Button', {
props: { type: 'error', size: 'small' },
on: { click: () => this.handleDelete(params.row.id) }
}, '删除')
])
}
}
],
tableData: [],
total: 0,
loading: false,
// 弹窗相关
modalVisible: false,
modalTitle: '新增',
formData: {
name: '',
time: ''
},
rules: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
],
time: [
{ required: true, type: 'date', message: '请选择时间', trigger: 'change' }
]
}
}
},
mounted() {
this.getList()
},
methods: {
// 获取列表
async getList() {
this.loading = true
try {
const res = await gamesServer.getList(this.queryParams)
if (res.code === 0) {
this.tableData = res.data.list
this.total = res.data.total
} else {
this.$uiTool.error(res.message || '获取数据失败')
}
} catch (error) {
this.$uiTool.error('获取数据失败')
} finally {
this.loading = false
}
},
// 搜索
handleSearch() {
this.queryParams.page = 1
this.getList()
},
// 重置
handleReset() {
this.queryParams = {
page: 1,
size: 20,
keyword: ''
}
this.getList()
},
// 新增
handleAdd() {
this.modalTitle = '新增'
this.formData = {
name: '',
time: ''
}
this.modalVisible = true
},
// 编辑
handleEdit(row) {
this.modalTitle = '编辑'
this.formData = { ...row }
this.modalVisible = true
},
// 删除
async handleDelete(id) {
try {
await this.$uiTool.confirm('确定删除吗?')
const res = await gamesServer.delete(id)
if (res.code === 0) {
this.$uiTool.success('删除成功')
this.getList()
} else {
this.$uiTool.error(res.message || '删除失败')
}
} catch (error) {
// 取消删除
}
},
// 提交表单
handleSubmit() {
this.$refs.form.validate(async (valid) => {
if (valid) {
try {
const res = this.formData.id
? await gamesServer.update(this.formData.id, this.formData)
: await gamesServer.create(this.formData)
if (res.code === 0) {
this.$uiTool.success('操作成功')
this.modalVisible = false
this.getList()
} else {
this.$uiTool.error(res.message || '操作失败')
}
} catch (error) {
this.$uiTool.error('操作失败')
}
}
})
},
// 取消
handleCancel() {
this.$refs.form.resetFields()
},
// 分页
handlePageChange(page) {
this.queryParams.page = page
this.getList()
},
handlePageSizeChange(size) {
this.queryParams.size = size
this.queryParams.page = 1
this.getList()
}
}
}
</script>
<style scoped>
.page-container {
padding: 20px;
}
</style>
```
## 五、全局可用的对象
在任何 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`

145
demo/快速修复指南.md Normal file
View File

@@ -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
<script>
export default {
data() {
return {
// ✅ 从配置中获取
uploadUrl: this.$config.uploadUrl
}
},
methods: {
async loadData() {
// ✅ 使用 this.$http
const res = await this.$http.get('/api/users')
// ✅ 使用 this.$tools
const date = this.$tools.formatDate(new Date(), 'yyyy-MM-dd')
// ✅ 使用 this.$uiTool
this.$uiTool.success('操作成功')
// ✅ 路由跳转使用 path
this.$router.push({ path: '/home' })
}
}
}
</script>
```
### 在 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
<script>
import gamesServer from '@/api/ball/gamesServer.js'
export default {
methods: {
async loadData() {
const res = await gamesServer.getList({ page: 1, size: 20 })
}
}
}
</script>
```
## 📝 修改步骤
### 步骤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` - 框架完整文档

View File

@@ -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;
}
}

View File

@@ -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
}
}

View File

@@ -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;
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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 })
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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);
}
}

View File

@@ -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;
}
}

View File

@@ -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()
}
}

View File

@@ -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)
}

View File

@@ -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 并添加其他路由