This commit is contained in:
dzc committed 2025-10-17 13:01:55 +08:00
commit 5485c3b85a
94 files changed
+10131

No files matched your search

+90
View File
@@ -0,0 +1,90 @@
import { service } from "./share/request"
/**
* 用餐数据统计(根据时间段和日期分类统计)
*/
export const groupByTimeAndHourType = (data) => {
return service({
url: 'hard/panel-canteen/group/by-time-and-hour-type',
method: 'post',
data,
})
}
/**
* 各个食堂的用餐人数
*/
export const mchPayPersonCount = (data) => {
return service({
url: 'hard/panel-canteen/mch-pay-person-count',
method: 'post',
data,
})
}
/**
* 各个食堂的用餐人数(趋势)
*/
export const payPersonCountTrend = (data) => {
return service({
url: 'hard/panel-canteen/pay-person-count-trend',
method: 'post',
data,
})
}
/**
* 用餐数据统计(根据自定义时间段和日期分类统计)
*/
export const groupByTimeAndCustomHour = (data) => {
return service({
url: "hard/panel-canteen/group/by-time-and-custom-hour",
method: 'post',
data,
})
}
/**
* 排行榜
*/
export const mchPayCountTop = (data) => {
return service({
url: 'hard/panel-canteen/mch-pay-count-top',
method: 'post',
data,
})
}
/**
* 食堂报表
*/
export const canteenReport = (data) => {
return service({
url: 'hard/panel-canteen/report',
method: 'post',
data,
})
}
/**
* 最新的吃饭数据
*/
export const newPage = (data) => {
return service({
url: 'hard/panel-canteen/new-page',
method: 'post',
data,
})
}
/**
* 最近吃饭数据
*/
export const recentlyCanteen = (data) => {
return service({
url: 'hard/panel-canteen/recently',
method: 'post',
data,
})
}
+8
View File
@@ -0,0 +1,8 @@
export * as canteenApi from "./canteen"
export * as shopApi from "./shop"
export * as nutritionApi from "./nutrition"
export * as userApi from "./user"
+68
View File
@@ -0,0 +1,68 @@
import { service } from "./share/request"
/**
* 食堂用餐分类统计
*/
export const classCount = (data) => {
return service({
url: 'hard/panel-nutrition/class-count',
method: 'post',
data,
})
}
/**
* 食堂用餐分类统计
*/
export const cuisineTop = (data) => {
return service({
url: 'hard/panel-nutrition/cuisine-top',
method: 'post',
data,
})
}
/**
* 营养分析(按照购买时间统计)
*/
export const nutritionByTime = (data) => {
return service({
url: 'hard/panel-nutrition/nutrition/by-time',
method: 'post',
data,
})
}
/**
* 营养分析(总数统计)
*/
export const nutritionTotal = (data) => {
return service({
url: 'hard/panel-nutrition/nutrition/total',
method: 'post',
data,
})
}
/**
* 营养分析(趋势)
*/
export const nutritionTrend = (data) => {
return service({
url: 'hard/panel-nutrition/nutrition/trend',
method: 'post',
data,
})
}
/**
* 复购排行榜(top5)
*/
export const repurchase = (data) => {
return service({
url: 'hard/panel-nutrition/repurchase',
method: 'post',
data,
})
}
+76
View File
@@ -0,0 +1,76 @@
import axios from "axios";
import Cookies from 'js-cookie';
import router from '@/router';
export const service = axios.create({
baseURL: import.meta.env.VITE_BASE_API,
// 请求超时时间
timeout: 20000,
headers: {
"Content-Type": "application/json",
},
withCredentials: false,
});
// 请求拦截
service.interceptors.request.use(
(config) => {
// get请求映射params参数
if (config.method === "get" && config.params) {
let url = config.url + "?" + tansParams(config.params);
url = url.slice(0, -1);
config.params = {};
config.url = url;
}
// 加token
const token = Cookies.get("panel_token") ?? ""
if (token) {
config.headers["Authorization"] = `Bearer ${token}`;
}
return config;
},
(error) => {
return Promise.reject(error);
}
);
// 响应拦截
service.interceptors.response.use(
(res) => {
return res.data;
},
(error) => {
console.log(error);
// 登录失效
if (error.status == 424) {
// 清除token
// Cookies.remove("panel_token")
// Cookies.remove("panel_refresh_token")
// router.replace("/no-permission")
}
return Promise.reject(error);
}
);
function tansParams(params) {
let result = "";
for (const propName of Object.keys(params)) {
const value = params[propName];
var part = encodeURIComponent(propName) + "=";
if (value !== null && value !== "" && typeof value !== "undefined") {
if (typeof value === "object") {
for (const key of Object.keys(value)) {
if (value[key] !== null && value[key] !== "" && typeof value[key] !== "undefined") {
let params = propName + "[" + key + "]";
var subPart = encodeURIComponent(params) + "=";
result += subPart + encodeURIComponent(value[key]) + "&";
}
}
} else {
result += part + encodeURIComponent(value) + "&";
}
}
}
return result;
}
+67
View File
@@ -0,0 +1,67 @@
import { service } from "./share/request"
/**
* 各个超市的购买数量统计
*/
export const mchPayPersonCount = (data) => {
return service({
url: 'hard/panel-shop/mch-pay-count',
method: 'post',
data,
})
}
/**
* 各个自营超市的统计数据
*/
export const mchPayCountTrend = (data) => {
return service({
url: 'hard/panel-shop/mch-pay-count-trend',
method: 'post',
data,
})
}
/**
* 超市报表
*/
export const canteenReport = (data) => {
return service({
url: 'hard/panel-shop/report',
method: 'post',
data,
})
}
/**
* 最新的超市购买数据
*/
export const newPage = (data) => {
return service({
url: 'hard/panel-shop/new-page',
method: 'post',
data,
})
}
/**
* 最近的超市购买数据
*/
export const recentlyShop = (data) => {
return service({
url: 'hard/panel-shop/recently',
method: 'post',
data,
})
}
/**
* 排行榜
*/
export const mchPayCountTop = (data) => {
return service({
url: 'hard/panel-shop/mch-pay-count-top',
method: 'post',
data,
})
}
+45
View File
@@ -0,0 +1,45 @@
import { service } from "./share/request"
/**
* 获取个人信息
*/
export const getUserInfo = (params) => {
return service({
url: '/admin/user/info',
method: 'get',
params,
})
}
/**
* 刷新token
*/
export const refreshToken = (refresh_token) => {
const basicAuth = 'Basic ' + window.btoa('pig:pig');
const grant_type = 'refresh_token';
const scope = 'server';
return service({
url: '/auth/oauth2/token',
method: 'post',
headers: {
skipToken: true,
Authorization: basicAuth,
'Content-Type': "application/x-www-form-urlencoded",
},
params: { refresh_token, grant_type, scope },
})
}
export const checkToken = (token) => {
const basicAuth = 'Basic ' + window.btoa('pig:pig');
return service({
url: '/auth/token/check_token',
method: 'get',
headers: {
skipToken: true,
Authorization: basicAuth,
'Content-Type': 'application/x-www-form-urlencoded',
},
params: { token },
})
}