This commit is contained in:
孟帅
2023-05-10 23:54:50 +08:00
parent bbe655a4d8
commit 49a96750bf
314 changed files with 15138 additions and 6244 deletions

View File

@@ -178,11 +178,15 @@ export function defShortcuts() {
export function defRangeShortcuts() {
const nowDate = new Date();
const dayBase = 86400 * 1000;
return {
: [startOfToday().getTime(), endOfToday().getTime()] as const,
: () => {
return [startOfYesterday().getTime(), endOfYesterday().getTime()] as const;
},
7: [startOfToday().getTime() - dayBase * 6, endOfToday().getTime()] as const,
30: [startOfToday().getTime() - dayBase * 29, endOfToday().getTime()] as const,
90: [startOfToday().getTime() - dayBase * 89, endOfToday().getTime()] as const,
: () => {
return [
startOfWeek(nowDate, { weekStartsOn: 1 }).getTime(),
@@ -192,7 +196,7 @@ export function defRangeShortcuts() {
: () => {
return [startOfMonth(nowDate).getTime(), endOfMonth(nowDate).getTime()] as const;
},
: () => {
: () => {
return [
startOfMonth(subMonths(nowDate, 1)).getTime(),
endOfMonth(subMonths(nowDate, 1)).getTime(),

View File

@@ -19,6 +19,7 @@ import { useUserStoreWidthOut } from '@/store/modules/user';
import router from '@/router';
import { storage } from '@/utils/Storage';
import { encodeParams } from '@/utils/urlUtils';
import { delNullProperty } from '@/utils/array';
const globSetting = useGlobSetting();
const urlPrefix = globSetting.urlPrefix || '';
@@ -287,7 +288,22 @@ export const jumpExport = function (url, params) {
urlPrefix +
url +
'?' +
encodeParams({ ...params, ...{ authorization: useUserStoreWidthOut().token } });
encodeParams({
...delNullProperty(params),
...{ authorization: useUserStoreWidthOut().token },
});
};
// 跳转
export const jump = function (url, params) {
window.location.href =
urlPrefix +
url +
'?' +
encodeParams({
...delNullProperty(params),
...{ authorization: useUserStoreWidthOut().token },
});
};
// 项目,多个不同 api 地址,直接在这里导出多个

View File

@@ -142,3 +142,8 @@ export function isLetterBegin(str) {
export function isUrl(url: string): boolean {
return /(^http|https:\/\/)/g.test(url);
}
// 判断是否为微信浏览器
export function isWechatBrowser(): boolean {
return /micromessenger/.test(navigator.userAgent.toLowerCase()) ? true : false;
}