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

Merge remote-tracking branch 'origin/main'

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