This commit is contained in:
ahjung
2024-09-14 22:39:11 +08:00
parent 1ae5372396
commit 7a62de39c2
62 changed files with 1996 additions and 2938 deletions

View File

@@ -1,44 +1,44 @@
import { Random } from 'mockjs';
import { defineMock } from '@alova/mock';
import { faker } from '@faker-js/faker';
import { resultSuccess } from '../_util';
const consoleInfo = {
function getRandom(options) {
return Number(faker.commerce.price(options));
}
const result = {
//访问量
visits: {
dayVisits: Random.float(10000, 99999, 2, 2),
rise: Random.float(10, 99),
decline: Random.float(10, 99),
amount: Random.float(99999, 999999, 3, 5),
dayVisits: getRandom({ min: 10000, max: 99999, dec: 2 }),
rise: getRandom({ min: 10000, max: 99999, dec: 0 }),
decline: getRandom({ min: 10000, max: 99999, dec: 0 }),
amount: getRandom({ min: 10000, max: 99999, dec: 2 }),
},
//销售额
saleroom: {
weekSaleroom: Random.float(10000, 99999, 2, 2),
amount: Random.float(99999, 999999, 2, 2),
degree: Random.float(10, 99),
weekSaleroom: getRandom({ min: 10000, max: 99999, dec: 2 }),
amount: getRandom({ min: 10000, max: 99999, dec: 2 }),
degree: getRandom({ min: 10000, max: 99999, dec: 0 }),
},
//订单量
orderLarge: {
weekLarge: Random.float(10000, 99999, 2, 2),
rise: Random.float(10, 99),
decline: Random.float(10, 99),
amount: Random.float(99999, 999999, 2, 2),
weekLarge: getRandom({ min: 10000, max: 99999, dec: 2 }),
rise: getRandom({ min: 10000, max: 99999, dec: 0 }),
decline: getRandom({ min: 10000, max: 99999, dec: 0 }),
amount: getRandom({ min: 10000, max: 99999, dec: 2 }),
},
//成交额度
volume: {
weekLarge: Random.float(10000, 99999, 2, 2),
rise: Random.float(10, 99),
decline: Random.float(10, 99),
amount: Random.float(99999, 999999, 2, 2),
weekLarge: getRandom({ min: 10000, max: 99999, dec: 2 }),
rise: getRandom({ min: 10000, max: 99999, dec: 0 }),
decline: getRandom({ min: 10000, max: 99999, dec: 0 }),
amount: getRandom({ min: 10000, max: 99999, dec: 2 }),
},
};
export default [
//主控台 卡片数据
{
url: '/api/dashboard/console',
timeout: 1000,
method: 'get',
response: () => {
return resultSuccess(consoleInfo);
},
export default defineMock({
// 主控台数据
'/api/dashboard/console': () => {
return resultSuccess(result);
},
];
});