Compare commits
1 Commits
main
...
feat/antdv
| Author | SHA1 | Date |
|---|---|---|
|
|
122c27ea91 |
|
|
@ -3,4 +3,4 @@ ports:
|
|||
onOpen: open-preview
|
||||
tasks:
|
||||
- init: pnpm install
|
||||
command: pnpm run dev
|
||||
command: pnpm dev
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
|
||||
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': ['prettier --write--parser json'],
|
||||
'package.json': ['prettier --write'],
|
||||
'*.vue': ['eslint --fix', 'prettier --write', 'stylelint --fix'],
|
||||
'*.{scss,less,styl,html}': ['stylelint --fix', 'prettier --write'],
|
||||
'*.md': ['prettier --write'],
|
||||
};
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"recommendations": [
|
||||
"johnsoncodehk.volar",
|
||||
"octref.vetur",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"stylelint.vscode-stylelint",
|
||||
"esbenp.prettier-vscode",
|
||||
|
|
|
|||
21
index.html
21
index.html
|
|
@ -8,6 +8,7 @@
|
|||
name="viewport"
|
||||
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
|
||||
/>
|
||||
|
||||
<title><%= title %></title>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</head>
|
||||
|
|
@ -29,7 +30,7 @@
|
|||
}
|
||||
|
||||
html[data-theme='dark'] .app-loading .app-loading-title {
|
||||
color: rgb(255 255 255 / 85%);
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
|
||||
.app-loading {
|
||||
|
|
@ -47,6 +48,7 @@
|
|||
top: 50%;
|
||||
left: 50%;
|
||||
display: flex;
|
||||
-webkit-transform: translate3d(-50%, -50%, 0);
|
||||
transform: translate3d(-50%, -50%, 0);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
|
@ -64,7 +66,7 @@
|
|||
display: flex;
|
||||
margin-top: 30px;
|
||||
font-size: 30px;
|
||||
color: rgb(0 0 0 / 85%);
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
|
@ -95,7 +97,7 @@
|
|||
height: 20px;
|
||||
background-color: #0065cc;
|
||||
border-radius: 100%;
|
||||
opacity: 30%;
|
||||
opacity: 0.3;
|
||||
transform: scale(0.75);
|
||||
animation: antSpinMove 1s infinite linear alternate;
|
||||
transform-origin: 50% 50%;
|
||||
|
|
@ -109,38 +111,43 @@
|
|||
.dot i:nth-child(2) {
|
||||
top: 0;
|
||||
right: 0;
|
||||
-webkit-animation-delay: 0.4s;
|
||||
animation-delay: 0.4s;
|
||||
}
|
||||
|
||||
.dot i:nth-child(3) {
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
-webkit-animation-delay: 0.8s;
|
||||
animation-delay: 0.8s;
|
||||
}
|
||||
|
||||
.dot i:nth-child(4) {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
-webkit-animation-delay: 1.2s;
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
@keyframes antRotate {
|
||||
to {
|
||||
-webkit-transform: rotate(405deg);
|
||||
transform: rotate(405deg);
|
||||
}
|
||||
}
|
||||
@keyframes antRotate {
|
||||
@-webkit-keyframes antRotate {
|
||||
to {
|
||||
-webkit-transform: rotate(405deg);
|
||||
transform: rotate(405deg);
|
||||
}
|
||||
}
|
||||
@keyframes antSpinMove {
|
||||
to {
|
||||
opacity: 100%;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes antSpinMove {
|
||||
@-webkit-keyframes antSpinMove {
|
||||
to {
|
||||
opacity: 100%;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
30
package.json
30
package.json
|
|
@ -23,7 +23,7 @@
|
|||
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix",
|
||||
"lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
|
||||
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
|
||||
"lint:lint-staged": "lint-staged",
|
||||
"lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
|
||||
"test:unit": "jest",
|
||||
"test:unit-coverage": "jest --coverage",
|
||||
"test:gzip": "npx http-server dist --cors --gzip -c-1",
|
||||
|
|
@ -41,16 +41,16 @@
|
|||
"@vueuse/core": "^6.8.0",
|
||||
"@vueuse/shared": "^6.8.0",
|
||||
"@zxcvbn-ts/core": "^1.0.0",
|
||||
"ant-design-vue": "2.2.8",
|
||||
"ant-design-vue": "3.0.0-alpha.11",
|
||||
"axios": "^0.24.0",
|
||||
"codemirror": "^5.63.3",
|
||||
"cropperjs": "^1.5.12",
|
||||
"crypto-js": "^4.1.1",
|
||||
"dayjs": "^1.10.7",
|
||||
"echarts": "^5.2.2",
|
||||
"intro.js": "^4.3.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"mockjs": "^1.1.0",
|
||||
"moment": "^2.29.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"path-to-regexp": "^6.2.0",
|
||||
"pinia": "2.0.2",
|
||||
|
|
@ -159,29 +159,5 @@
|
|||
"homepage": "https://github.com/anncwb/vue-vben-admin",
|
||||
"engines": {
|
||||
"node": "^12 || >=14"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,jsx,ts,tsx}": [
|
||||
"eslint --fix",
|
||||
"prettier --write"
|
||||
],
|
||||
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": [
|
||||
"prettier --write--parser json"
|
||||
],
|
||||
"package.json": [
|
||||
"prettier --write"
|
||||
],
|
||||
"*.vue": [
|
||||
"eslint --fix",
|
||||
"prettier --write",
|
||||
"stylelint --fix"
|
||||
],
|
||||
"*.{scss,less,styl,html}": [
|
||||
"stylelint --fix",
|
||||
"prettier --write"
|
||||
],
|
||||
"*.md": [
|
||||
"prettier --write"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ specifiers:
|
|||
'@vueuse/core': ^6.8.0
|
||||
'@vueuse/shared': ^6.8.0
|
||||
'@zxcvbn-ts/core': ^1.0.0
|
||||
ant-design-vue: 2.2.8
|
||||
ant-design-vue: 3.0.0-alpha.11
|
||||
autoprefixer: ^10.4.0
|
||||
axios: ^0.24.0
|
||||
codemirror: ^5.63.3
|
||||
|
|
@ -48,6 +48,7 @@ specifiers:
|
|||
cropperjs: ^1.5.12
|
||||
cross-env: ^7.0.3
|
||||
crypto-js: ^4.1.1
|
||||
dayjs: ^1.10.7
|
||||
dotenv: ^10.0.0
|
||||
echarts: ^5.2.2
|
||||
eslint: ^8.2.0
|
||||
|
|
@ -66,7 +67,6 @@ specifiers:
|
|||
lint-staged: 11.2.6
|
||||
lodash-es: ^4.17.21
|
||||
mockjs: ^1.1.0
|
||||
moment: ^2.29.1
|
||||
npm-run-all: ^4.1.5
|
||||
nprogress: ^0.2.0
|
||||
path-to-regexp: ^6.2.0
|
||||
|
|
@ -123,16 +123,16 @@ dependencies:
|
|||
'@vueuse/core': 6.8.0_vue@3.2.21
|
||||
'@vueuse/shared': 6.8.0_vue@3.2.21
|
||||
'@zxcvbn-ts/core': 1.0.0
|
||||
ant-design-vue: 2.2.8_076477a87ad5f7673ec470dd8ffa7935
|
||||
ant-design-vue: 3.0.0-alpha.11_076477a87ad5f7673ec470dd8ffa7935
|
||||
axios: 0.24.0
|
||||
codemirror: 5.63.3
|
||||
cropperjs: 1.5.12
|
||||
crypto-js: 4.1.1
|
||||
dayjs: 1.10.7
|
||||
echarts: 5.2.2
|
||||
intro.js: 4.3.0
|
||||
lodash-es: 4.17.21
|
||||
mockjs: 1.1.0
|
||||
moment: 2.29.1
|
||||
nprogress: 0.2.0
|
||||
path-to-regexp: 6.2.0
|
||||
pinia: 2.0.2_typescript@4.4.4+vue@3.2.21
|
||||
|
|
@ -2963,24 +2963,24 @@ packages:
|
|||
engines: {node: '>=10'}
|
||||
dev: true
|
||||
|
||||
/ant-design-vue/2.2.8_076477a87ad5f7673ec470dd8ffa7935:
|
||||
resolution: {integrity: sha512-3graq9/gCfJQs6hznrHV6sa9oDmk/D1H3Oo0vLdVpPS/I61fZPk8NEyNKCHpNA6fT2cx6xx9U3QS63uuyikg/Q==}
|
||||
/ant-design-vue/3.0.0-alpha.11_076477a87ad5f7673ec470dd8ffa7935:
|
||||
resolution: {integrity: sha512-cEbWtdoXYU6h5yUXBTbUzi3Zyh4JQDqRZI3n8Hkj0DeWYAM1SvWvQ7JhEY2Xnw1/3fjJw+j4GTP7lcob1e16wg==}
|
||||
peerDependencies:
|
||||
'@vue/compiler-sfc': '>=3.1.0'
|
||||
vue: '>=3.1.0'
|
||||
dependencies:
|
||||
'@ant-design/colors': 6.0.0
|
||||
'@ant-design/icons-vue': 6.0.1_vue@3.2.21
|
||||
'@babel/runtime': 7.16.0
|
||||
'@simonwep/pickr': 1.8.2
|
||||
'@vue/compiler-sfc': 3.2.21
|
||||
array-tree-filter: 2.1.0
|
||||
async-validator: 3.5.2
|
||||
async-validator: 4.0.7
|
||||
dayjs: 1.10.7
|
||||
dom-align: 1.12.2
|
||||
dom-scroll-into-view: 2.0.1
|
||||
lodash: 4.17.21
|
||||
lodash-es: 4.17.21
|
||||
moment: 2.29.1
|
||||
omit.js: 2.0.2
|
||||
resize-observer-polyfill: 1.5.1
|
||||
scroll-into-view-if-needed: 2.2.28
|
||||
shallow-equal: 1.2.1
|
||||
|
|
@ -3083,8 +3083,8 @@ packages:
|
|||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/async-validator/3.5.2:
|
||||
resolution: {integrity: sha512-8eLCg00W9pIRZSB781UUX/H6Oskmm8xloZfr09lz5bikRpBVDlJ3hRVuxxP1SxcwsEYfJ4IU8Q19Y8/893r3rQ==}
|
||||
/async-validator/4.0.7:
|
||||
resolution: {integrity: sha512-Pj2IR7u8hmUEDOwB++su6baaRi+QvsgajuFB9j95foM1N2gy5HM4z60hfusIO0fBPG5uLAEl6yCJr1jNSVugEQ==}
|
||||
dev: false
|
||||
|
||||
/async/0.9.2:
|
||||
|
|
@ -4319,6 +4319,10 @@ packages:
|
|||
resolution: {integrity: sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==}
|
||||
dev: true
|
||||
|
||||
/dayjs/1.10.7:
|
||||
resolution: {integrity: sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig==}
|
||||
dev: false
|
||||
|
||||
/debug/2.6.9:
|
||||
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
|
||||
dependencies:
|
||||
|
|
@ -8250,10 +8254,6 @@ packages:
|
|||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/moment/2.29.1:
|
||||
resolution: {integrity: sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==}
|
||||
dev: false
|
||||
|
||||
/mousetrap/1.6.5:
|
||||
resolution: {integrity: sha512-QNo4kEepaIBwiT8CDhP98umTetp+JNfQYBWvC1pc6/OAibuXtRcxZ58Qz8skvEHYvURne/7R8T5VoOI7rDsEUA==}
|
||||
dev: false
|
||||
|
|
@ -8503,10 +8503,6 @@ packages:
|
|||
isobject: 3.0.1
|
||||
dev: true
|
||||
|
||||
/omit.js/2.0.2:
|
||||
resolution: {integrity: sha512-hJmu9D+bNB40YpL9jYebQl4lsTW6yEHRTroJzNLqQJYHm7c+NQnJGfZmIWh8S3q3KoaxV1aLhV6B3+0N0/kyJg==}
|
||||
dev: false
|
||||
|
||||
/on-finished/2.3.0:
|
||||
resolution: {integrity: sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@
|
|||
if (!Array.isArray(defaultValue)) {
|
||||
schema.defaultValue = dateUtil(defaultValue);
|
||||
} else {
|
||||
const def: moment.Moment[] = [];
|
||||
const def: any[] = [];
|
||||
defaultValue.forEach((item) => {
|
||||
def.push(dateUtil(item));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ export function useFormValues({
|
|||
if (isObject(value)) {
|
||||
value = transformDateFunc?.(value);
|
||||
}
|
||||
if (isArray(value) && value[0]?._isAMomentObject && value[1]?._isAMomentObject) {
|
||||
|
||||
if (isArray(value) && value[0]?.format && value[1]?.format) {
|
||||
value = value.map((item) => transformDateFunc?.(item));
|
||||
}
|
||||
// Remove spaces
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export const basicProps = {
|
|||
transformDateFunc: {
|
||||
type: Function as PropType<Fn>,
|
||||
default: (date: any) => {
|
||||
return date._isAMomentObject ? date?.format('YYYY-MM-DD HH:mm:ss') : date;
|
||||
return date?.format?.('YYYY-MM-DD HH:mm:ss') ?? date;
|
||||
},
|
||||
},
|
||||
rulesMessageJoinLabel: propTypes.bool.def(true),
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
<CheckboxGroup v-model:value="checkedList" @change="onChange" ref="columnListRef">
|
||||
<template v-for="item in plainOptions" :key="item.value">
|
||||
<div :class="`${prefixCls}__check-item`" v-if="!('ifShow' in item && !item.ifShow)">
|
||||
<DragOutlined class="table-column-drag-icon" />
|
||||
<DragOutlined class="table-coulmn-drag-icon" />
|
||||
<Checkbox :value="item.value">
|
||||
{{ item.label }}
|
||||
</Checkbox>
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
import { useSortable } from '/@/hooks/web/useSortable';
|
||||
import { isFunction, isNullAndUnDef } from '/@/utils/is';
|
||||
import { getPopupContainer as getParentContainer } from '/@/utils';
|
||||
import { cloneDeep, omit } from 'lodash-es';
|
||||
import { omit } from 'lodash-es';
|
||||
|
||||
interface State {
|
||||
checkAll: boolean;
|
||||
|
|
@ -250,15 +250,16 @@
|
|||
|
||||
const indeterminate = computed(() => {
|
||||
const len = plainOptions.value.length;
|
||||
let checkedLen = state.checkedList.length;
|
||||
unref(checkIndex) && checkedLen--;
|
||||
return checkedLen > 0 && checkedLen < len;
|
||||
let checkdedLen = state.checkedList.length;
|
||||
unref(checkIndex) && checkdedLen--;
|
||||
return checkdedLen > 0 && checkdedLen < len;
|
||||
});
|
||||
|
||||
// Trigger when check/uncheck a column
|
||||
function onChange(checkedList: string[]) {
|
||||
const len = plainSortOptions.value.length;
|
||||
const len = plainOptions.value.length;
|
||||
state.checkAll = checkedList.length === len;
|
||||
|
||||
const sortList = unref(plainSortOptions).map((item) => item.value);
|
||||
checkedList.sort((prev, next) => {
|
||||
return sortList.indexOf(prev) - sortList.indexOf(next);
|
||||
|
|
@ -285,14 +286,14 @@
|
|||
if (!el) return;
|
||||
// Drag and drop sort
|
||||
const { initSortable } = useSortable(el, {
|
||||
handle: '.table-column-drag-icon',
|
||||
handle: '.table-coulmn-drag-icon ',
|
||||
onEnd: (evt) => {
|
||||
const { oldIndex, newIndex } = evt;
|
||||
if (isNullAndUnDef(oldIndex) || isNullAndUnDef(newIndex) || oldIndex === newIndex) {
|
||||
return;
|
||||
}
|
||||
// Sort column
|
||||
const columns = cloneDeep(plainSortOptions.value);
|
||||
const columns = getColumns();
|
||||
|
||||
if (oldIndex > newIndex) {
|
||||
columns.splice(newIndex, 0, columns[oldIndex]);
|
||||
|
|
@ -303,6 +304,7 @@
|
|||
}
|
||||
|
||||
plainSortOptions.value = columns;
|
||||
plainOptions.value = columns;
|
||||
setColumns(columns);
|
||||
},
|
||||
});
|
||||
|
|
@ -345,7 +347,7 @@
|
|||
|
||||
function setColumns(columns: BasicColumn[] | string[]) {
|
||||
table.setColumns(columns);
|
||||
const data: ColumnChangeParam[] = unref(plainSortOptions).map((col) => {
|
||||
const data: ColumnChangeParam[] = unref(plainOptions).map((col) => {
|
||||
const visible =
|
||||
columns.findIndex(
|
||||
(c: BasicColumn | string) =>
|
||||
|
|
@ -388,7 +390,7 @@
|
|||
<style lang="less">
|
||||
@prefix-cls: ~'@{namespace}-basic-column-setting';
|
||||
|
||||
.table-column-drag-icon {
|
||||
.table-coulmn-drag-icon {
|
||||
margin: 0 5px;
|
||||
cursor: move;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,17 +216,25 @@ export function useColumns(
|
|||
const columnKeys = columns as string[];
|
||||
const newColumns: BasicColumn[] = [];
|
||||
cacheColumns.forEach((item) => {
|
||||
newColumns.push({
|
||||
...item,
|
||||
defaultHidden: !columnKeys.includes(item.dataIndex! || (item.key as string)),
|
||||
});
|
||||
if (columnKeys.includes(item.dataIndex! || (item.key as string))) {
|
||||
newColumns.push({
|
||||
...item,
|
||||
defaultHidden: false,
|
||||
});
|
||||
} else {
|
||||
newColumns.push({
|
||||
...item,
|
||||
defaultHidden: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Sort according to another array
|
||||
if (!isEqual(cacheKeys, columns)) {
|
||||
newColumns.sort((prev, next) => {
|
||||
return (
|
||||
columnKeys.indexOf(prev.dataIndex as string) -
|
||||
columnKeys.indexOf(next.dataIndex as string)
|
||||
cacheKeys.indexOf(prev.dataIndex as string) -
|
||||
cacheKeys.indexOf(next.dataIndex as string)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
import { basicProps } from './props';
|
||||
import { createTableColumns, createActionColumn } from './data';
|
||||
// utils
|
||||
import { checkImgType, getBase64WithFile } from './helper';
|
||||
import { checkFileType, checkImgType, getBase64WithFile } from './helper';
|
||||
import { buildUUID } from '/@/utils/uuid';
|
||||
import { isFunction } from '/@/utils/is';
|
||||
import { warn } from '/@/utils/log';
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
const { t } = useI18n();
|
||||
const [register, { closeModal }] = useModalInner();
|
||||
|
||||
const { getStringAccept, getHelpText } = useUploadType({
|
||||
const { getAccept, getStringAccept, getHelpText } = useUploadType({
|
||||
acceptRef: accept,
|
||||
helpTextRef: helpText,
|
||||
maxNumberRef: maxNumber,
|
||||
|
|
@ -124,12 +124,18 @@
|
|||
function beforeUpload(file: File) {
|
||||
const { size, name } = file;
|
||||
const { maxSize } = props;
|
||||
const accept = unref(getAccept);
|
||||
// 设置最大值,则判断
|
||||
if (maxSize && file.size / 1024 / 1024 >= maxSize) {
|
||||
createMessage.error(t('component.upload.maxSizeMultiple', [maxSize]));
|
||||
return false;
|
||||
}
|
||||
|
||||
// 设置类型,则判断
|
||||
if (accept.length > 0 && !checkFileType(file, accept)) {
|
||||
createMessage.error!(t('component.upload.acceptUpload', [accept.join(',')]));
|
||||
return false;
|
||||
}
|
||||
const commonItem = {
|
||||
uuid: buildUUID(),
|
||||
file,
|
||||
|
|
|
|||
|
|
@ -1,18 +1,7 @@
|
|||
import type { App } from 'vue';
|
||||
import { Button } from './Button';
|
||||
import {
|
||||
// Need
|
||||
Button as AntButton,
|
||||
Input,
|
||||
Layout,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
const compList = [AntButton.Group];
|
||||
import { Input, Layout } from 'ant-design-vue';
|
||||
|
||||
export function registerGlobComp(app: App) {
|
||||
compList.forEach((comp) => {
|
||||
app.component(comp.name || comp.displayName, comp);
|
||||
});
|
||||
|
||||
app.use(Input).use(Button).use(Layout);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@
|
|||
if (!meta) {
|
||||
return !!name;
|
||||
}
|
||||
const { title, hideBreadcrumb, hideMenu } = meta;
|
||||
if (!title || hideBreadcrumb || hideMenu) {
|
||||
const { title, hideBreadcrumb } = meta;
|
||||
if (!title || hideBreadcrumb) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { genMessage } from '../helper';
|
||||
import antdLocale from 'ant-design-vue/es/locale/en_US';
|
||||
// import momentLocale from 'moment/dist/locale/en-us';
|
||||
|
||||
const modules = import.meta.globEager('./en/**/*.ts');
|
||||
export default {
|
||||
|
|
@ -8,6 +7,6 @@ export default {
|
|||
...genMessage(modules, 'en'),
|
||||
antdLocale,
|
||||
},
|
||||
momentLocale: null,
|
||||
momentLocaleName: 'en',
|
||||
dateLocale: null,
|
||||
dateLocaleName: 'en',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { genMessage } from '../helper';
|
||||
import antdLocale from 'ant-design-vue/es/locale/zh_CN';
|
||||
import momentLocale from 'moment/dist/locale/zh-cn';
|
||||
|
||||
const modules = import.meta.globEager('./zh-CN/**/*.ts');
|
||||
export default {
|
||||
|
|
@ -8,6 +7,4 @@ export default {
|
|||
...genMessage(modules, 'zh-CN'),
|
||||
antdLocale,
|
||||
},
|
||||
momentLocale,
|
||||
momentLocaleName: 'zh-cn',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
*/
|
||||
import type { LocaleType } from '/#/config';
|
||||
|
||||
import moment from 'moment';
|
||||
|
||||
import { i18n } from './setupI18n';
|
||||
import { useLocaleStoreWithOut } from '/@/store/modules/locale';
|
||||
import { unref, computed } from 'vue';
|
||||
|
|
@ -12,8 +10,8 @@ import { loadLocalePool, setHtmlPageLang } from './helper';
|
|||
|
||||
interface LangModule {
|
||||
message: Recordable;
|
||||
momentLocale: Recordable;
|
||||
momentLocaleName: string;
|
||||
dateLocale: Recordable;
|
||||
dateLocaleName: string;
|
||||
}
|
||||
|
||||
function setI18nLanguage(locale: LocaleType) {
|
||||
|
|
@ -53,10 +51,9 @@ export function useLocale() {
|
|||
const langModule = ((await import(`./lang/${locale}.ts`)) as any).default as LangModule;
|
||||
if (!langModule) return;
|
||||
|
||||
const { message, momentLocale, momentLocaleName } = langModule;
|
||||
const { message } = langModule;
|
||||
|
||||
globalI18n.setLocaleMessage(locale, message);
|
||||
moment.updateLocale(momentLocaleName, momentLocale);
|
||||
loadLocalePool.push(locale);
|
||||
|
||||
setI18nLanguage(locale);
|
||||
|
|
|
|||
|
|
@ -1,20 +1,23 @@
|
|||
/**
|
||||
* Independent time operation tool to facilitate subsequent switch to dayjs
|
||||
*/
|
||||
import moment from 'moment';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
||||
const DATE_FORMAT = 'YYYY-MM-DD';
|
||||
const DATE_FORMAT = 'YYYY-MM-DD ';
|
||||
|
||||
export function formatToDateTime(
|
||||
date: moment.MomentInput = undefined,
|
||||
date: dayjs.Dayjs | undefined = undefined,
|
||||
format = DATE_TIME_FORMAT,
|
||||
): string {
|
||||
return moment(date).format(format);
|
||||
return dayjs(date).format(format);
|
||||
}
|
||||
|
||||
export function formatToDate(date: moment.MomentInput = undefined, format = DATE_FORMAT): string {
|
||||
return moment(date).format(format);
|
||||
export function formatToDate(
|
||||
date: dayjs.Dayjs | undefined = undefined,
|
||||
format = DATE_FORMAT,
|
||||
): string {
|
||||
return dayjs(date).format(format);
|
||||
}
|
||||
|
||||
export const dateUtil = moment;
|
||||
export const dateUtil = dayjs;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export function dataURLtoBlob(base64Buf: string): Blob {
|
|||
const arr = base64Buf.split(',');
|
||||
const typeItem = arr[0];
|
||||
const mime = typeItem.match(/:(.*?);/)![1];
|
||||
const bstr = window.atob(arr[1]);
|
||||
const bstr = atob(arr[1]);
|
||||
let n = bstr.length;
|
||||
const u8arr = new Uint8Array(n);
|
||||
while (n--) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ export function formatRequestDate(params: Recordable) {
|
|||
}
|
||||
|
||||
for (const key in params) {
|
||||
if (params[key] && params[key]._isAMomentObject) {
|
||||
const format = params[key]?.format ?? null;
|
||||
if (format && typeof format === 'function') {
|
||||
params[key] = params[key].format(DATE_TIME_FORMAT);
|
||||
}
|
||||
if (isString(key)) {
|
||||
|
|
|
|||
|
|
@ -71,10 +71,9 @@ module.exports = {
|
|||
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.vue', '**/*.vue', '*.html', '**/*.html'],
|
||||
files: ['*.vue', '**/*.vue'],
|
||||
extends: ['stylelint-config-recommended', 'stylelint-config-html'],
|
||||
rules: {
|
||||
'keyframes-name-pattern': null,
|
||||
'selector-pseudo-class-no-unknown': [
|
||||
true,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { UserConfig, ConfigEnv } from 'vite';
|
||||
import pkg from './package.json';
|
||||
import moment from 'moment';
|
||||
import dayjs from 'dayjs';
|
||||
import { loadEnv } from 'vite';
|
||||
import { resolve } from 'path';
|
||||
import { generateModifyVars } from './build/generate/generateModifyVars';
|
||||
|
|
@ -16,7 +16,7 @@ function pathResolve(dir: string) {
|
|||
const { dependencies, devDependencies, name, version } = pkg;
|
||||
const __APP_INFO__ = {
|
||||
pkg: { dependencies, devDependencies, name, version },
|
||||
lastBuildTime: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||
lastBuildTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
};
|
||||
|
||||
export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
|
|
@ -97,9 +97,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
|||
include: [
|
||||
'@iconify/iconify',
|
||||
'ant-design-vue/es/locale/zh_CN',
|
||||
'moment/dist/locale/zh-cn',
|
||||
'ant-design-vue/es/locale/en_US',
|
||||
'moment/dist/locale/eu',
|
||||
],
|
||||
exclude: ['vue-demi'],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export default defineConfig({
|
|||
* Used for animation when the element is displayed
|
||||
* @param maxOutput The larger the maxOutput output, the larger the generated css volume
|
||||
*/
|
||||
function createEnterPlugin(maxOutput = 6) {
|
||||
function createEnterPlugin(maxOutput = 7) {
|
||||
const createCss = (index: number, d = 'x') => {
|
||||
const upd = d.toUpperCase();
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in New Issue