提交 4c16ffa3 编写于 作者: Z zuihou

Merge remote-tracking branch 'origin/main'

......@@ -7,7 +7,7 @@ import styleImport from 'vite-plugin-style-import';
export function configStyleImportPlugin(isBuild: boolean) {
if (!isBuild) return [];
const pwaPlugin = styleImport({
const styleImportPlugin = styleImport({
libs: [
{
libraryName: 'ant-design-vue',
......@@ -18,5 +18,5 @@ export function configStyleImportPlugin(isBuild: boolean) {
},
],
});
return pwaPlugin;
return styleImportPlugin;
}
......@@ -32,17 +32,17 @@
"postinstall": "npm run install:husky"
},
"dependencies": {
"@iconify/iconify": "^2.0.0-rc.6",
"@logicflow/core": "^0.3.4",
"@logicflow/extension": "^0.3.4",
"@vueuse/core": "^4.9.0",
"@iconify/iconify": "^2.0.0",
"@logicflow/core": "^0.3.6",
"@logicflow/extension": "^0.3.6",
"@vueuse/core": "^4.9.2",
"@zxcvbn-ts/core": "^0.3.0",
"ant-design-vue": "^2.1.3",
"axios": "^0.21.1",
"codemirror": "^5.61.0",
"cropperjs": "^1.5.11",
"crypto-js": "^4.0.0",
"echarts": "^5.1.0",
"echarts": "^5.1.1",
"lodash-es": "^4.17.21",
"mockjs": "^1.1.0",
"nprogress": "^0.2.0",
......@@ -51,7 +51,7 @@
"print-js": "^1.6.0",
"qrcode": "^1.4.4",
"sortablejs": "^1.13.0",
"tinymce": "^5.7.1",
"tinymce": "^5.8.0",
"vditor": "^3.8.4",
"vue": "3.0.11",
"vue-i18n": "9.0.0",
......@@ -63,9 +63,9 @@
"devDependencies": {
"@commitlint/cli": "^12.1.1",
"@commitlint/config-conventional": "^12.1.1",
"@iconify/json": "^1.1.333",
"@iconify/json": "^1.1.340",
"@purge-icons/generated": "^0.7.0",
"@types/codemirror": "^0.0.109",
"@types/codemirror": "^5.60.0",
"@types/crypto-js": "^4.0.1",
"@types/fs-extra": "^9.0.11",
"@types/inquirer": "^7.3.1",
......@@ -75,59 +75,59 @@
"@types/qrcode": "^1.4.0",
"@types/qs": "^6.9.6",
"@types/sortablejs": "^1.10.6",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"@vitejs/plugin-legacy": "^1.3.2",
"@typescript-eslint/eslint-plugin": "^4.22.1",
"@typescript-eslint/parser": "^4.22.1",
"@vitejs/plugin-legacy": "^1.3.3",
"@vitejs/plugin-vue": "^1.2.2",
"@vitejs/plugin-vue-jsx": "^1.1.3",
"@vitejs/plugin-vue-jsx": "^1.1.4",
"@vue/compiler-sfc": "3.0.11",
"autoprefixer": "^10.2.5",
"commitizen": "^4.2.3",
"commitizen": "^4.2.4",
"conventional-changelog-cli": "^2.1.1",
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"eslint": "^7.25.0",
"dotenv": "^9.0.1",
"eslint": "^7.26.0",
"eslint-config-prettier": "^8.3.0",
"eslint-define-config": "^1.0.8",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-vue": "^7.9.0",
"esno": "^0.5.0",
"fs-extra": "^9.1.0",
"fs-extra": "^10.0.0",
"http-server": "^0.12.3",
"husky": "^6.0.0",
"inquirer": "^8.0.0",
"is-ci": "^3.0.0",
"less": "^4.1.1",
"lint-staged": "^10.5.4",
"postcss": "^8.2.12",
"lint-staged": "^11.0.0",
"postcss": "^8.2.14",
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0",
"rimraf": "^3.0.2",
"rollup-plugin-visualizer": "5.3.4",
"stylelint": "^13.13.0",
"rollup-plugin-visualizer": "5.5.0",
"stylelint": "^13.13.1",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-standard": "^22.0.0",
"stylelint-order": "^4.1.0",
"ts-node": "^9.1.1",
"typescript": "4.2.4",
"vite": "2.2.3",
"vite-plugin-compression": "^0.2.4",
"vite": "2.2.4",
"vite-plugin-compression": "^0.2.5",
"vite-plugin-html": "^2.0.7",
"vite-plugin-imagemin": "^0.3.0",
"vite-plugin-imagemin": "^0.3.2",
"vite-plugin-mock": "^2.5.0",
"vite-plugin-purge-icons": "^0.7.0",
"vite-plugin-pwa": "^0.7.2",
"vite-plugin-pwa": "^0.7.3",
"vite-plugin-style-import": "^0.10.0",
"vite-plugin-svg-icons": "^0.4.3",
"vite-plugin-svg-icons": "^0.5.0",
"vite-plugin-theme": "^0.7.1",
"vite-plugin-windicss": "0.14.6",
"vite-plugin-windicss": "0.15.10",
"vue-eslint-parser": "^7.6.0",
"vue-tsc": "^0.0.25"
"vue-tsc": "^0.1.2"
},
"resolutions": {
"//": "Used to install imagemin dependencies, because imagemin may not be installed in China.If it is abroad, you can delete it",
"bin-wrapper": "npm:bin-wrapper-china",
"rollup": "^2.45.2"
"rollup": "^2.47.0"
},
"repository": {
"type": "git",
......
<template>
<div class="h-full">
<CodeMirrorEditor :value="getValue" @change="handleValueChange" :mode="mode" />
<CodeMirrorEditor :value="getValue" @change="handleValueChange" :mode="mode" :readonly="readonly" />
</div>
</template>
<script lang="ts">
......@@ -24,6 +24,10 @@
type: String,
default: MODE.JSON,
},
readonly: {
type: Boolean,
default: false,
},
},
emits: ['change'],
setup(props, { emit }) {
......
......@@ -122,12 +122,14 @@
wrapClassName: toRef(getMergeProps.value, 'wrapClassName'),
});
// modal component does not need title
// modal component does not need title and origin buttons
const getProps = computed(
(): ModalProps => {
const opt = {
...unref(getMergeProps),
visible: unref(visibleRef),
okButtonProps: undefined,
cancelButtonProps: undefined,
title: undefined,
};
return {
......
......@@ -8,6 +8,7 @@
import { toCanvas, QRCodeRenderersOptions, LogoType } from './qrcodePlus';
import { toDataURL } from 'qrcode';
import { downloadByUrl } from '/@/utils/file/download';
import { QrcodeDoneEventParams } from './types';
export default defineComponent({
name: 'QrCode',
......@@ -38,10 +39,9 @@
validator: (v: string) => ['canvas', 'img'].includes(v),
},
},
emits: { done: (url: string) => !!url, error: (error: any) => !!error },
emits: { done: (data: QrcodeDoneEventParams) => !!data, error: (error: any) => !!error },
setup(props, { emit }) {
const wrapRef = ref<HTMLCanvasElement | HTMLImageElement | null>(null);
const urlRef = ref<string>('');
async function createQrcode() {
try {
const { tag, value, options = {}, width, logo } = props;
......@@ -58,8 +58,7 @@
content: renderValue,
options: options || {},
});
urlRef.value = url;
emit('done', url);
emit('done', { url, ctx: (wrapEl as HTMLCanvasElement).getContext('2d') });
return;
}
......@@ -70,8 +69,7 @@
...options,
});
(unref(wrapRef) as HTMLImageElement).src = url;
urlRef.value = url;
emit('done', url);
emit('done', { url });
}
} catch (error) {
emit('error', error);
......@@ -81,7 +79,13 @@
* file download
*/
function download(fileName?: string) {
const url = unref(urlRef);
let url = '';
const wrapEl = unref(wrapRef);
if (wrapEl instanceof HTMLCanvasElement) {
url = wrapEl.toDataURL();
} else if (wrapEl instanceof HTMLImageElement) {
url = wrapEl.src;
}
if (!url) return;
downloadByUrl({
url,
......
......@@ -31,3 +31,8 @@ export type ToCanvasFn = (options: RenderQrCodeParams) => Promise<unknown>;
export interface QrCodeActionType {
download: (fileName?: string) => void;
}
export interface QrcodeDoneEventParams {
url: string;
ctx?: CanvasRenderingContext2D | null;
}
......@@ -113,7 +113,7 @@ export function useColumns(
let cacheColumns = unref(propsRef).columns;
const getColumnsRef = computed(() => {
const columns = unref(columnsRef);
const columns = cloneDeep(unref(columnsRef));
handleIndexColumn(propsRef, getPaginationRef, columns);
handleActionColumn(propsRef, columns);
......@@ -122,8 +122,7 @@ export function useColumns(
}
const { ellipsis } = unref(propsRef);
const cloneColumns = cloneDeep(columns);
cloneColumns.forEach((item) => {
columns.forEach((item) => {
const { customRender, slots } = item;
handleItem(
......@@ -131,7 +130,7 @@ export function useColumns(
Reflect.has(item, 'ellipsis') ? !!item.ellipsis : !!ellipsis && !customRender && !slots
);
});
return cloneColumns;
return columns;
});
function isIfShow(column: BasicColumn): boolean {
......
......@@ -3,6 +3,7 @@ import type { I18n, I18nOptions } from 'vue-i18n';
import { createI18n } from 'vue-i18n';
import { setLoadLocalePool } from './useLocale';
import { localeSetting } from '/@/settings/localeSetting';
import { useLocaleStoreWithOut } from '/@/store/modules/locale';
......@@ -16,6 +17,10 @@ async function createI18nOptions(): Promise<I18nOptions> {
const defaultLocal = await import(`./lang/${locale}.ts`);
const message = defaultLocal.default?.message ?? {};
setLoadLocalePool((loadLocalePool) => {
loadLocalePool.push(locale);
});
return {
legacy: false,
locale,
......
......@@ -17,6 +17,10 @@ interface LangModule {
const loadLocalePool: LocaleType[] = [];
export function setLoadLocalePool(cb: (loadLocalePool: LocaleType[]) => void) {
cb(loadLocalePool);
}
function setI18nLanguage(locale: LocaleType) {
const localeStore = useLocaleStoreWithOut();
......
......@@ -30,7 +30,7 @@ export function getAppEnvConfig() {
VITE_GLOB_UPLOAD_URL,
} = ENV;
if (!/[a-zA-Z\_]*/.test(VITE_GLOB_APP_SHORT_NAME)) {
if (!/^[a-zA-Z\_]*$/.test(VITE_GLOB_APP_SHORT_NAME)) {
warn(
`VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.`
);
......
......@@ -58,6 +58,19 @@
<CollapseContainer title="配置大小示例" class="text-center qrcode-demo-item">
<QrCode :value="qrCodeUrl" :width="300" />
</CollapseContainer>
<CollapseContainer title="扩展绘制示例" class="text-center qrcode-demo-item">
<QrCode
:value="qrCodeUrl"
:width="200"
:options="{ margin: 5 }"
ref="qrDiyRef"
:logo="LogoImg"
@done="onQrcodeDone"
/>
<a-button class="mb-2" type="primary" @click="downloadDiy"> 下载 </a-button>
<div class="msg"> 要进行扩展绘制则不能将tag设为img </div>
</CollapseContainer>
</div>
</PageWrapper>
</template>
......@@ -73,16 +86,36 @@
components: { CollapseContainer, QrCode, PageWrapper },
setup() {
const qrRef = ref<Nullable<QrCodeActionType>>(null);
const qrDiyRef = ref<Nullable<QrCodeActionType>>(null);
function download() {
const qrEl = unref(qrRef);
if (!qrEl) return;
qrEl.download('文件名');
}
function downloadDiy() {
const qrEl = unref(qrDiyRef);
if (!qrEl) return;
qrEl.download('Qrcode');
}
function onQrcodeDone({ ctx }) {
if (ctx instanceof CanvasRenderingContext2D) {
// 额外绘制
ctx.fillStyle = 'black';
ctx.font = '16px "微软雅黑"';
ctx.textBaseline = 'bottom';
ctx.textAlign = 'center';
ctx.fillText('你帅你先扫', 100, 195, 200);
}
}
return {
onQrcodeDone,
qrCodeUrl,
LogoImg,
download,
downloadDiy,
qrRef,
qrDiyRef,
};
},
});
......
......@@ -69,7 +69,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
},
// Turning off brotliSize display can slightly reduce packaging time
brotliSize: false,
chunkSizeWarningLimit: 1500,
chunkSizeWarningLimit: 2000,
},
define: {
// setting vue-i18-next
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册