代码格式化格式调整
parent
ba98c26b01
commit
5f5207b4aa
|
@ -30,7 +30,12 @@ export function getThemeColors(color?: string) {
|
|||
return [...lightColors, ...modeColors];
|
||||
}
|
||||
|
||||
export function generateColors({ color = primaryColor, mixLighten, mixDarken, tinycolor }: GenerateColorsParams) {
|
||||
export function generateColors({
|
||||
color = primaryColor,
|
||||
mixLighten,
|
||||
mixDarken,
|
||||
tinycolor,
|
||||
}: GenerateColorsParams) {
|
||||
const arr = new Array(19).fill(0);
|
||||
const lightens = arr.map((_t, i) => {
|
||||
return mixLighten(color, i / 5);
|
||||
|
@ -63,5 +68,12 @@ export function generateColors({ color = primaryColor, mixLighten, mixDarken, ti
|
|||
.toHexString();
|
||||
})
|
||||
.filter((item) => item !== '#000000');
|
||||
return [...lightens, ...darkens, ...alphaColors, ...shortAlphaColors, ...tinycolorDarkens, ...tinycolorLightens].filter((item) => !item.includes('-'));
|
||||
return [
|
||||
...lightens,
|
||||
...darkens,
|
||||
...alphaColors,
|
||||
...shortAlphaColors,
|
||||
...tinycolorDarkens,
|
||||
...tinycolorLightens,
|
||||
].filter((item) => !item.includes('-'));
|
||||
}
|
||||
|
|
|
@ -9,7 +9,12 @@ export function resultSuccess<T = Recordable>(result: T, { message = 'ok' } = {}
|
|||
};
|
||||
}
|
||||
|
||||
export function resultPageSuccess<T = any>(pageNo: number, pageSize: number, list: T[], { message = 'ok' } = {}) {
|
||||
export function resultPageSuccess<T = any>(
|
||||
pageNo: number,
|
||||
pageSize: number,
|
||||
list: T[],
|
||||
{ message = 'ok' } = {}
|
||||
) {
|
||||
const pageData = pagination(pageNo, pageSize, list);
|
||||
|
||||
return {
|
||||
|
@ -32,7 +37,10 @@ export function resultError(message = 'Request failed', { code = -1, result = nu
|
|||
|
||||
export function pagination<T = any>(pageNo: number, pageSize: number, array: T[]): T[] {
|
||||
const offset = (pageNo - 1) * Number(pageSize);
|
||||
const ret = offset + Number(pageSize) >= array.length ? array.slice(offset, array.length) : array.slice(offset, offset + Number(pageSize));
|
||||
const ret =
|
||||
offset + Number(pageSize) >= array.length
|
||||
? array.slice(offset, array.length)
|
||||
: array.slice(offset, offset + Number(pageSize));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ export default [
|
|||
timeout: 1000,
|
||||
method: 'get',
|
||||
response: ({ query }) => {
|
||||
const { keyword, count } = query;
|
||||
const { keyword,count} = query;
|
||||
console.log(keyword);
|
||||
return resultSuccess(demoList(keyword, count));
|
||||
return resultSuccess(demoList(keyword,count));
|
||||
},
|
||||
},
|
||||
] as MockMethod[];
|
||||
|
|
|
@ -28,7 +28,7 @@ const userList = (() => {
|
|||
realname: '@cname()',
|
||||
createTime: '@datetime',
|
||||
remark: '@cword(10,20)',
|
||||
avatar: 'https://q1.qlogo.cn/g?b=qq&nk=190848757&s=640',
|
||||
avatar: 'https://q1.qlogo.cn/g?b=qq&nk=190848757&s=640'
|
||||
});
|
||||
}
|
||||
return result;
|
||||
|
@ -60,7 +60,7 @@ const newRoleList = (() => {
|
|||
roleName: ['超级管理员', '管理员', '文章管理员', '普通用户'][index],
|
||||
roleCode: '@first',
|
||||
createTime: '@datetime',
|
||||
remark: '@cword(10,20)',
|
||||
remark: '@cword(10,20)'
|
||||
});
|
||||
}
|
||||
return result;
|
||||
|
@ -74,7 +74,7 @@ const testList = (() => {
|
|||
orderNo: `${index + 1}`,
|
||||
testName: ['数据1', '数据2', '数据3', '数据4'][index],
|
||||
testValue: '@first',
|
||||
createTime: '@datetime',
|
||||
createTime: '@datetime'
|
||||
});
|
||||
}
|
||||
return result;
|
||||
|
@ -89,7 +89,7 @@ const tableDemoList = (() => {
|
|||
orderMoney: '@natural(1000,3000)',
|
||||
ctype: '@natural(1,2)',
|
||||
content: '@cword(10,20)',
|
||||
orderDate: '@datetime',
|
||||
orderDate: '@datetime'
|
||||
});
|
||||
}
|
||||
return result;
|
||||
|
@ -148,7 +148,12 @@ const menuList = (() => {
|
|||
menuName: ['菜单1', '菜单2', '菜单3', '菜单4'][j],
|
||||
icon: 'ion:document',
|
||||
permission: ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index],
|
||||
component: ['/dashboard/welcome/index', '/dashboard/Analysis/index', '/dashboard/workbench/index', '/dashboard/test/index'][j],
|
||||
component: [
|
||||
'/dashboard/welcome/index',
|
||||
'/dashboard/Analysis/index',
|
||||
'/dashboard/workbench/index',
|
||||
'/dashboard/test/index',
|
||||
][j],
|
||||
orderNo: j + 1,
|
||||
createTime: '@datetime',
|
||||
'status|1': ['0', '1'],
|
||||
|
@ -161,8 +166,16 @@ const menuList = (() => {
|
|||
type: '2',
|
||||
menuName: '按钮' + (j + 1) + '-' + (k + 1),
|
||||
icon: '',
|
||||
permission: ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index] + ':btn' + (k + 1),
|
||||
component: ['/dashboard/welcome/index', '/dashboard/Analysis/index', '/dashboard/workbench/index', '/dashboard/test/index'][j],
|
||||
permission:
|
||||
['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index] +
|
||||
':btn' +
|
||||
(k + 1),
|
||||
component: [
|
||||
'/dashboard/welcome/index',
|
||||
'/dashboard/Analysis/index',
|
||||
'/dashboard/workbench/index',
|
||||
'/dashboard/test/index',
|
||||
][j],
|
||||
orderNo: j + 1,
|
||||
createTime: '@datetime',
|
||||
'status|1': ['0', '1'],
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { resultSuccess, resultError, getRequestToken, requestParams, baseUrl } from '../_util';
|
||||
import { resultSuccess, resultError, getRequestToken, requestParams,baseUrl} from '../_util';
|
||||
import { MockMethod } from 'vite-plugin-mock';
|
||||
import { createFakeUserList } from './user';
|
||||
|
||||
|
|
|
@ -51,7 +51,9 @@ export default [
|
|||
method: 'post',
|
||||
response: ({ body }) => {
|
||||
const { username, password } = body;
|
||||
const checkUser = createFakeUserList().find((item) => item.username === username && password === item.password);
|
||||
const checkUser = createFakeUserList().find(
|
||||
(item) => item.username === username && password === item.password
|
||||
);
|
||||
if (!checkUser) {
|
||||
return resultError('Incorrect account or password!');
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = {
|
||||
printWidth: 200,
|
||||
printWidth: 150,
|
||||
tabWidth: 2,
|
||||
useTabs: false,
|
||||
semi: true, //语句末尾使用分号
|
||||
|
|
|
@ -3,7 +3,14 @@
|
|||
* @Description: Multi-language switching component
|
||||
-->
|
||||
<template>
|
||||
<Dropdown placement="bottomCenter" :trigger="['click']" :dropMenuList="localeList" :selectedKeys="selectedKeys" @menuEvent="handleMenuEvent" overlayClassName="app-locale-picker-overlay">
|
||||
<Dropdown
|
||||
placement="bottom"
|
||||
:trigger="['click']"
|
||||
:dropMenuList="localeList"
|
||||
:selectedKeys="selectedKeys"
|
||||
@menuEvent="handleMenuEvent"
|
||||
overlayClassName="app-locale-picker-overlay"
|
||||
>
|
||||
<span class="cursor-pointer flex items-center">
|
||||
<Icon icon="ion:language" />
|
||||
<span v-if="showText" class="ml-1">{{ getLocaleText }}</span>
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
<div class="flex justify-end space-x-2"
|
||||
><slot name="header"></slot>
|
||||
<Tooltip>
|
||||
<template #title> <div class="w-50">每行显示数量</div><Slider id="slider" v-bind="sliderProp" v-model:value="grid" @change="sliderChange" /></template>
|
||||
<template #title>
|
||||
<div class="w-50">每行显示数量</div><Slider id="slider" v-bind="sliderProp" v-model:value="grid" @change="sliderChange"
|
||||
/></template>
|
||||
<Button><TableOutlined /></Button>
|
||||
</Tooltip>
|
||||
<Tooltip @click="fetch">
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="register" :title="t('component.cropper.modalTitle')" width="800px" :canFullscreen="false" @ok="handleOk" :okText="t('component.cropper.okText')">
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
@register="register"
|
||||
:title="t('component.cropper.modalTitle')"
|
||||
width="800px"
|
||||
:canFullscreen="false"
|
||||
@ok="handleOk"
|
||||
:okText="t('component.cropper.okText')"
|
||||
>
|
||||
<div :class="prefixCls">
|
||||
<div :class="`${prefixCls}-left`">
|
||||
<div :class="`${prefixCls}-cropper`">
|
||||
|
@ -17,10 +25,22 @@
|
|||
<a-button type="primary" preIcon="ant-design:reload-outlined" size="small" :disabled="!src" @click="handlerToolbar('reset')" />
|
||||
</Tooltip>
|
||||
<Tooltip :title="t('component.cropper.btn_rotate_left')" placement="bottom">
|
||||
<a-button type="primary" preIcon="ant-design:rotate-left-outlined" size="small" :disabled="!src" @click="handlerToolbar('rotate', -45)" />
|
||||
<a-button
|
||||
type="primary"
|
||||
preIcon="ant-design:rotate-left-outlined"
|
||||
size="small"
|
||||
:disabled="!src"
|
||||
@click="handlerToolbar('rotate', -45)"
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip :title="t('component.cropper.btn_rotate_right')" placement="bottom">
|
||||
<a-button type="primary" preIcon="ant-design:rotate-right-outlined" size="small" :disabled="!src" @click="handlerToolbar('rotate', 45)" />
|
||||
<a-button
|
||||
type="primary"
|
||||
preIcon="ant-design:rotate-right-outlined"
|
||||
size="small"
|
||||
:disabled="!src"
|
||||
@click="handlerToolbar('rotate', 45)"
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip :title="t('component.cropper.btn_scale_x')" placement="bottom">
|
||||
<a-button type="primary" preIcon="vaadin:arrows-long-h" size="small" :disabled="!src" @click="handlerToolbar('scaleX')" />
|
||||
|
|
|
@ -6,7 +6,12 @@
|
|||
<template #overlay>
|
||||
<a-menu :class="[`${prefixCls}-menu`]" :selectedKeys="selectedKeys">
|
||||
<template v-for="item in dropMenuList" :key="`${item.event}`">
|
||||
<a-menu-item v-bind="getAttr(item.event)" @click="handleClickMenu(item)" :disabled="item.disabled" :class="[{ 'is-pop-confirm': item.popConfirm }, item.class ?? []]">
|
||||
<a-menu-item
|
||||
v-bind="getAttr(item.event)"
|
||||
@click="handleClickMenu(item)"
|
||||
:disabled="item.disabled"
|
||||
:class="[{ 'is-pop-confirm': item.popConfirm }, (item.class ?? [])]"
|
||||
>
|
||||
<a-popconfirm v-if="popconfirm && item.popConfirm" v-bind="getPopConfirmAttrs(item.popConfirm)">
|
||||
<template #icon v-if="item.popConfirm.icon">
|
||||
<Icon :icon="item.popConfirm.icon" />
|
||||
|
|
|
@ -4,7 +4,22 @@ import type { ComponentType } from './types/index';
|
|||
/**
|
||||
* Component list, register here to setting it in the form
|
||||
*/
|
||||
import { Input, Select, Radio, Checkbox, AutoComplete, Cascader, DatePicker, InputNumber, Switch, TimePicker, TreeSelect, Slider, Rate, Divider } from 'ant-design-vue';
|
||||
import {
|
||||
Input,
|
||||
Select,
|
||||
Radio,
|
||||
Checkbox,
|
||||
AutoComplete,
|
||||
Cascader,
|
||||
DatePicker,
|
||||
InputNumber,
|
||||
Switch,
|
||||
TimePicker,
|
||||
TreeSelect,
|
||||
Slider,
|
||||
Rate,
|
||||
Divider,
|
||||
} from 'ant-design-vue';
|
||||
import ApiRadioGroup from './components/ApiRadioGroup.vue';
|
||||
import RadioButtonGroup from './components/RadioButtonGroup.vue';
|
||||
import ApiSelect from './components/ApiSelect.vue';
|
||||
|
|
|
@ -16,7 +16,13 @@ export function createPlaceholderMessage(component: ComponentType) {
|
|||
if (component.includes('Picker')) {
|
||||
return t('common.chooseText');
|
||||
}
|
||||
if (component.includes('Select') || component.includes('Cascader') || component.includes('Checkbox') || component.includes('Radio') || component.includes('Switch')) {
|
||||
if (
|
||||
component.includes('Select') ||
|
||||
component.includes('Cascader') ||
|
||||
component.includes('Checkbox') ||
|
||||
component.includes('Radio') ||
|
||||
component.includes('Switch')
|
||||
) {
|
||||
// return `请选择${label}`;
|
||||
return t('common.chooseText');
|
||||
}
|
||||
|
|
|
@ -57,7 +57,8 @@ export default function ({ advanceState, emit, getProps, getSchema, formModel, d
|
|||
function getAdvanced(itemCol: Partial<ColEx>, itemColSum = 0, isLastAction = false, index = 0) {
|
||||
const width = unref(realWidthRef);
|
||||
|
||||
const mdWidth = parseInt(itemCol.md as string) || parseInt(itemCol.xs as string) || parseInt(itemCol.sm as string) || (itemCol.span as number) || BASIC_COL_LEN;
|
||||
const mdWidth =
|
||||
parseInt(itemCol.md as string) || parseInt(itemCol.xs as string) || parseInt(itemCol.sm as string) || (itemCol.span as number) || BASIC_COL_LEN;
|
||||
|
||||
const lgWidth = parseInt(itemCol.lg as string) || mdWidth;
|
||||
const xlWidth = parseInt(itemCol.xl as string) || lgWidth;
|
||||
|
|
|
@ -86,8 +86,8 @@ export function useForm(props?: Props): UseFormReturnType {
|
|||
getFieldsValue: <T>() => {
|
||||
//update-begin-author:taoyan date:2022-7-5 for: VUEN-1341【流程】编码方式 流程节点编辑表单时,填写数据报错 包括用户组件、部门组件、省市区
|
||||
let values = unref(formRef)?.getFieldsValue() as T;
|
||||
if (values) {
|
||||
Object.keys(values).map((key) => {
|
||||
if(values){
|
||||
Object.keys(values).map(key=>{
|
||||
if (values[key] instanceof Array) {
|
||||
values[key] = values[key].join(',');
|
||||
}
|
||||
|
|
|
@ -19,7 +19,16 @@ interface UseFormActionContext {
|
|||
schemaRef: Ref<FormSchema[]>;
|
||||
handleFormValues: Fn;
|
||||
}
|
||||
export function useFormEvents({ emit, getProps, formModel, getSchema, defaultValueRef, formElRef, schemaRef, handleFormValues }: UseFormActionContext) {
|
||||
export function useFormEvents({
|
||||
emit,
|
||||
getProps,
|
||||
formModel,
|
||||
getSchema,
|
||||
defaultValueRef,
|
||||
formElRef,
|
||||
schemaRef,
|
||||
handleFormValues,
|
||||
}: UseFormActionContext) {
|
||||
async function resetFields(): Promise<void> {
|
||||
const { resetFunc, submitOnReset } = unref(getProps);
|
||||
resetFunc && isFunction(resetFunc) && (await resetFunc());
|
||||
|
@ -48,6 +57,11 @@ export function useFormEvents({ emit, getProps, formModel, getSchema, defaultVal
|
|||
const schema = unref(getSchema).find((item) => item.field === key);
|
||||
let value = values[key];
|
||||
|
||||
//antd3升级后,online表单时间控件选中值报js错 TypeError: Reflect.has called on non-object
|
||||
if(!(values instanceof Object)){
|
||||
return;
|
||||
}
|
||||
|
||||
const hasKey = Reflect.has(values, key);
|
||||
|
||||
value = handleInputNumberValue(schema?.component, value);
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
<template>
|
||||
<section class="full-loading" :class="{ absolute, [theme]: !!theme }" :style="[background ? `background-color: ${background}` : '']" v-show="loading">
|
||||
<section
|
||||
class="full-loading"
|
||||
:class="{ absolute, [theme]: !!theme }"
|
||||
:style="[background ? `background-color: ${background}` : '']"
|
||||
v-show="loading"
|
||||
>
|
||||
<Spin v-bind="$attrs" :tip="tip" :size="size" :spinning="loading" />
|
||||
</section>
|
||||
</template>
|
||||
|
|
|
@ -33,7 +33,12 @@
|
|||
|
||||
const getShowMenu = computed(() => !props.item.meta?.hideMenu);
|
||||
function menuHasChildren(menuTreeItem: MenuType): boolean {
|
||||
return !menuTreeItem.meta?.hideChildrenInMenu && Reflect.has(menuTreeItem, 'children') && !!menuTreeItem.children && menuTreeItem.children.length > 0;
|
||||
return (
|
||||
!menuTreeItem.meta?.hideChildrenInMenu &&
|
||||
Reflect.has(menuTreeItem, 'children') &&
|
||||
!!menuTreeItem.children &&
|
||||
menuTreeItem.children.length > 0
|
||||
);
|
||||
}
|
||||
return {
|
||||
prefixCls,
|
||||
|
|
|
@ -45,7 +45,9 @@
|
|||
let type = props.type === null ? props.value >= props.target : props.type;
|
||||
return type ? 'up' : 'down';
|
||||
});
|
||||
const rate = computed(() => (props.percentage === null ? (Math.abs(props.value - props.target) * 100) / props.target : props.percentage).toFixed(props.fixed));
|
||||
const rate = computed(() =>
|
||||
(props.percentage === null ? (Math.abs(props.value - props.target) * 100) / props.target : props.percentage).toFixed(props.fixed)
|
||||
);
|
||||
return {
|
||||
trend,
|
||||
rate,
|
||||
|
|
|
@ -46,7 +46,9 @@ function createDocumentHandler(el: HTMLElement, binding: DirectiveBinding): Docu
|
|||
const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
|
||||
const isSelf = el === mouseUpTarget;
|
||||
|
||||
const isTargetExcluded = (excludes.length && excludes.some((item) => item?.contains(mouseUpTarget))) || (excludes.length && excludes.includes(mouseDownTarget as HTMLElement));
|
||||
const isTargetExcluded =
|
||||
(excludes.length && excludes.some((item) => item?.contains(mouseUpTarget))) ||
|
||||
(excludes.length && excludes.includes(mouseDownTarget as HTMLElement));
|
||||
const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
|
||||
if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
|
||||
return;
|
||||
|
|
|
@ -6,7 +6,7 @@ export function useRuleFormItem<T extends Recordable, K extends keyof T, V = Unw
|
|||
props: T,
|
||||
key?: K,
|
||||
changeEvent?,
|
||||
emitData?: Ref<any[]>
|
||||
emitData?: Ref<any[] | undefined>
|
||||
): [WritableComputedRef<V>, (val: V) => void, DeepReadonly<V>];
|
||||
export function useRuleFormItem<T extends Recordable>(props: T, key: keyof T = 'value', changeEvent = 'change', emitData?: Ref<any[]>) {
|
||||
const instance = getCurrentInstance();
|
||||
|
|
|
@ -99,7 +99,8 @@ export function useMenuSetting() {
|
|||
unref(getIsTopMenu) || !unref(getShowMenu) || (unref(getSplit) && unref(getMenuHidden))
|
||||
? 0
|
||||
: unref(getIsMixSidebar)
|
||||
? (unref(getCollapsed) ? SIDE_BAR_MINI_WIDTH : SIDE_BAR_SHOW_TIT_MINI_WIDTH) + (unref(getMixSideFixed) && unref(mixSideHasChildren) ? unref(getRealWidth) : 0)
|
||||
? (unref(getCollapsed) ? SIDE_BAR_MINI_WIDTH : SIDE_BAR_SHOW_TIT_MINI_WIDTH) +
|
||||
(unref(getMixSideFixed) && unref(mixSideHasChildren) ? unref(getRealWidth) : 0)
|
||||
: unref(getRealWidth);
|
||||
|
||||
return `calc(100% - ${unref(width)}px)`;
|
||||
|
|
|
@ -38,7 +38,11 @@ export function useThirdLogin() {
|
|||
//第三方登录
|
||||
function onThirdLogin(source) {
|
||||
let url = `${glob.uploadUrl}/sys/thirdLogin/render/${source}`;
|
||||
window.open(url, `login ${source}`, 'height=500, width=500, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');
|
||||
window.open(
|
||||
url,
|
||||
`login ${source}`,
|
||||
'height=500, width=500, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no'
|
||||
);
|
||||
thirdType.value = source;
|
||||
thirdLoginInfo.value = {};
|
||||
thirdLoginState.value = false;
|
||||
|
|
|
@ -12,7 +12,14 @@ export interface CreateStorageParams extends EncryptionParams {
|
|||
hasEncrypt: boolean;
|
||||
timeout?: Nullable<number>;
|
||||
}
|
||||
export const createStorage = ({ prefixKey = '', storage = sessionStorage, key = cacheCipher.key, iv = cacheCipher.iv, timeout = null, hasEncrypt = true }: Partial<CreateStorageParams> = {}) => {
|
||||
export const createStorage = ({
|
||||
prefixKey = '',
|
||||
storage = sessionStorage,
|
||||
key = cacheCipher.key,
|
||||
iv = cacheCipher.iv,
|
||||
timeout = null,
|
||||
hasEncrypt = true,
|
||||
}: Partial<CreateStorageParams> = {}) => {
|
||||
if (hasEncrypt && [key.length, iv.length].some((item) => item !== 16)) {
|
||||
throw new Error('When hasEncrypt is true, the key or iv must be 16 bits!');
|
||||
}
|
||||
|
|
|
@ -67,7 +67,10 @@ export function colorIsDark(color: string) {
|
|||
export function darken(color: string, amount: number) {
|
||||
color = color.indexOf('#') >= 0 ? color.substring(1, color.length) : color;
|
||||
amount = Math.trunc((255 * amount) / 100);
|
||||
return `#${subtractLight(color.substring(0, 2), amount)}${subtractLight(color.substring(2, 4), amount)}${subtractLight(color.substring(4, 6), amount)}`;
|
||||
return `#${subtractLight(color.substring(0, 2), amount)}${subtractLight(color.substring(2, 4), amount)}${subtractLight(
|
||||
color.substring(4, 6),
|
||||
amount
|
||||
)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,9 @@ export const rules = {
|
|||
}
|
||||
if (
|
||||
value &&
|
||||
!new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/).test(value)
|
||||
!new RegExp(
|
||||
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
).test(value)
|
||||
) {
|
||||
return Promise.reject('请输入正确邮箱格式!');
|
||||
}
|
||||
|
|
|
@ -92,7 +92,9 @@ export class VAxios {
|
|||
}, undefined);
|
||||
|
||||
// 请求拦截器错误捕获
|
||||
requestInterceptorsCatch && isFunction(requestInterceptorsCatch) && this.axiosInstance.interceptors.request.use(undefined, requestInterceptorsCatch);
|
||||
requestInterceptorsCatch &&
|
||||
isFunction(requestInterceptorsCatch) &&
|
||||
this.axiosInstance.interceptors.request.use(undefined, requestInterceptorsCatch);
|
||||
|
||||
// 响应结果拦截器处理
|
||||
this.axiosInstance.interceptors.response.use((res: AxiosResponse<any>) => {
|
||||
|
@ -104,7 +106,9 @@ export class VAxios {
|
|||
}, undefined);
|
||||
|
||||
// 响应结果拦截器错误捕获
|
||||
responseInterceptorsCatch && isFunction(responseInterceptorsCatch) && this.axiosInstance.interceptors.response.use(undefined, responseInterceptorsCatch);
|
||||
responseInterceptorsCatch &&
|
||||
isFunction(responseInterceptorsCatch) &&
|
||||
this.axiosInstance.interceptors.response.use(undefined, responseInterceptorsCatch);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -243,4 +247,25 @@ export class VAxios {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 【用于评论功能】自定义文件上传-请求
|
||||
* @param url
|
||||
* @param formData
|
||||
*/
|
||||
uploadMyFile<T = any>(url, formData) {
|
||||
const glob = useGlobSetting();
|
||||
return this.axiosInstance
|
||||
.request<T>({
|
||||
url: url,
|
||||
baseURL: glob.uploadUrl,
|
||||
method: 'POST',
|
||||
data: formData,
|
||||
headers: {
|
||||
'Content-type': ContentTypeEnum.FORM_DATA,
|
||||
ignoreCancelToken: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,6 +175,7 @@ const transform: AxiosTransform = {
|
|||
}
|
||||
// update-end--author:sunjianlei---date:20220624--for: 添加低代码应用ID
|
||||
// ========================================================================================
|
||||
|
||||
}
|
||||
return config;
|
||||
},
|
||||
|
|
|
@ -293,6 +293,7 @@ export function importViewsFile(path): Promise<any> {
|
|||
}
|
||||
//update-end-author:taoyan date:2022-6-8 for:解决老的vue2动态导入文件语法 vite不支持的问题
|
||||
|
||||
|
||||
/**
|
||||
* 跳转至积木报表的 预览页面
|
||||
* @param url
|
||||
|
@ -301,13 +302,13 @@ export function importViewsFile(path): Promise<any> {
|
|||
*/
|
||||
export function goJmReportViewPage(url, id, token) {
|
||||
// URL支持{{ window.xxx }}占位符变量
|
||||
url = url.replace(/{{([^}]+)?}}/g, (_s1, s2) => eval(s2));
|
||||
url = url.replace(/{{([^}]+)?}}/g, (_s1, s2) => eval(s2))
|
||||
if (url.includes('?')) {
|
||||
url += '&';
|
||||
url += '&'
|
||||
} else {
|
||||
url += '?';
|
||||
url += '?'
|
||||
}
|
||||
url += `id=${id}`;
|
||||
url += `&token=${token}`;
|
||||
window.open(url);
|
||||
url += `id=${id}`
|
||||
url += `&token=${token}`
|
||||
window.open(url)
|
||||
}
|
|
@ -102,6 +102,7 @@ export const isServer = typeof window === 'undefined';
|
|||
export const isClient = !isServer;
|
||||
|
||||
export function isUrl(path: string): boolean {
|
||||
const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
|
||||
const reg =
|
||||
/(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
|
||||
return reg.test(path);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
import { MenuTypeEnum, MenuModeEnum, TriggerEnum, MixSidebarTriggerEnum } from '/@/enums/menuEnum';
|
||||
import { ContentEnum, PermissionModeEnum, ThemeEnum, RouterTransitionEnum, SettingButtonPositionEnum, SessionTimeoutProcessingEnum } from '/@/enums/appEnum';
|
||||
import {
|
||||
ContentEnum,
|
||||
PermissionModeEnum,
|
||||
ThemeEnum,
|
||||
RouterTransitionEnum,
|
||||
SettingButtonPositionEnum,
|
||||
SessionTimeoutProcessingEnum,
|
||||
} from '/@/enums/appEnum';
|
||||
|
||||
import { CacheTypeEnum } from '/@/enums/cacheEnum';
|
||||
|
||||
|
|
|
@ -10,12 +10,6 @@ declare module 'ant-design-vue/es/locale/*' {
|
|||
export default locale as Locale & ReadonlyRecordable;
|
||||
}
|
||||
|
||||
declare module 'moment/dist/locale/*' {
|
||||
import { LocaleSpecification } from 'moment';
|
||||
const locale: LocaleSpecification & ReadonlyRecordable;
|
||||
export default locale;
|
||||
}
|
||||
|
||||
declare module 'virtual:*' {
|
||||
const result: any;
|
||||
export default result;
|
||||
|
|
Loading…
Reference in New Issue