@xm-fe/xm-pc-base
Advanced tools
Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "@xm-fe/xm-pc-base", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "2022 鲜沐pc-base", | ||
@@ -12,2 +12,17 @@ "author": { | ||
], | ||
"scripts": { | ||
"dev": "vite --mode development", | ||
"tool": "node tools/node-server/index.js", | ||
"build:stage": "vue-tsc --noEmit && vite build --mode staging", | ||
"build:prod": "vite build", | ||
"preview:stage": "pnpm build:stage && vite preview", | ||
"preview:prod": "pnpm build:prod && vite preview", | ||
"ts": "vue-tsc --noEmit", | ||
"lint:eslint": "eslint \"src/**/*.{vue,ts,tsx}\" --fix", | ||
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"", | ||
"lint": "pnpm lint:eslint && pnpm lint:prettier", | ||
"prepare": "husky install", | ||
"create": "node tools/create", | ||
"capi": "node tools/create-api/index.js" | ||
}, | ||
"peerDependencies": { | ||
@@ -51,4 +66,34 @@ "@ant-design/icons-vue": "^6.1.0", | ||
"vue": "^3.2.41", | ||
"vue-router": "^4.0.15" | ||
"vue-router": "^4.0.15", | ||
"@types/js-cookie": "^3.0.2", | ||
"@types/lodash-es": "^4.17.6", | ||
"@types/node": "^17.0.35", | ||
"@types/path-browserify": "^1.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.26.0", | ||
"@typescript-eslint/parser": "^5.26.0", | ||
"@vitejs/plugin-legacy": "^1.8.2", | ||
"@vitejs/plugin-vue": "^2.3.3", | ||
"@vitejs/plugin-vue-jsx": "^1.3.10", | ||
"@vue/eslint-config-prettier": "^7.0.0", | ||
"@vue/eslint-config-typescript": "^10.0.0", | ||
"body-parser": "^1.20.0", | ||
"chalk": "2.4.1", | ||
"eslint": "^8.16.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-vue": "^8.7.1", | ||
"express": "^4.18.1", | ||
"husky": "^7.0.4", | ||
"lint-staged": "^12.4.2", | ||
"mkdirp": "^1.0.4", | ||
"prettier": "^2.6.2", | ||
"readline-sync": "^1.4.10", | ||
"request": "^2.88.2", | ||
"sass": "^1.52.1", | ||
"terser": "^5.15.0", | ||
"typescript": "^4.7.2", | ||
"vite": "^2.9.9", | ||
"vite-plugin-svg-icons": "^2.0.1", | ||
"vue-eslint-parser": "^8.3.0", | ||
"vue-tsc": "^0.34.16" | ||
} | ||
} |
@@ -11,2 +11,6 @@ ## ⚡️ 简介 | ||
### 0.0.8 | ||
- 同步正式版 | ||
### 0.0.7 | ||
@@ -30,7 +34,4 @@ | ||
# 初始化 husky | ||
pnpm prepare | ||
# 启动服务 | ||
pnpm dev | ||
``` |
@@ -15,6 +15,7 @@ import { App } from 'Vue' | ||
app.component('SEditButton', SEditButton) | ||
app.component('SCard', SCard) | ||
// 下面的将要废弃 | ||
app.component('SFormCard', SFormCard) | ||
app.component('SField', SField) | ||
app.component('SForm', SForm) | ||
app.component('SCard', SCard) | ||
}, | ||
@@ -21,0 +22,0 @@ } |
@@ -0,1 +1,2 @@ | ||
// 待优化 | ||
/** | ||
@@ -2,0 +3,0 @@ * 集中处理几种模式 |
@@ -1,3 +0,2 @@ | ||
export { useList } from './useList1' | ||
// export { useList} from './useList' | ||
export { useList } from './useList' | ||
export { useUpload } from './useUpload' |
@@ -75,2 +75,3 @@ import { onActivated, onMounted, onUnmounted, reactive, Ref, ref, UnwrapNestedRefs } from 'vue' | ||
//注意未使用SCustomFilter的情况首次请调用getList或者onSearch或者reload | ||
//reload 刷新当前页 适合编辑 onsearch(params) 适合新增编辑 | ||
const onSearch = (_params: Partial<T>) => { | ||
@@ -77,0 +78,0 @@ pagination.current = 1 |
@@ -67,2 +67,3 @@ import axios from 'axios' | ||
const previewTitle = ref('') | ||
const previewType = ref('') | ||
@@ -77,2 +78,3 @@ const handleCancel = () => { | ||
} | ||
previewType.value = file.url?.indexOf('pdf') !== -1 ? 'application/pdf' : '' | ||
previewImage.value = (file.url || file.preview) as string | ||
@@ -82,2 +84,37 @@ previewVisible.value = true | ||
} | ||
const downloadImage = (file: UploadFile) => { | ||
let downloadUrl = '' | ||
if (file.url && file.url?.indexOf('https://azure.summerfarm.net/') !== -1) { | ||
downloadUrl = file.url! | ||
} else { | ||
downloadUrl = `https://azure.summerfarm.net/${file.response.data.key}` | ||
} | ||
const a = document.createElement('a') | ||
a.download = downloadUrl | ||
a.href = downloadUrl | ||
a.click() | ||
} | ||
const drawImage = (info: any, fileName?: string) => { | ||
const src = info.url ? info.url : `https://azure.summerfarm.net/${info.response.data.key}` | ||
const name = fileName || src.substring(src.lastIndexOf('/') + 1) | ||
//分割最后文件名 | ||
const img = new Image(), | ||
canvas = document.createElement('canvas'), | ||
ctx = canvas.getContext('2d'), | ||
extName = src.match(/\.[a-zA-z]+$/) ? src.match(/\.[a-zA-z]+$/)![0].slice(1) : 'jpg' | ||
img.src = src | ||
img.setAttribute('crossOrigin', 'Anonymous') | ||
img.onload = () => { | ||
canvas.width = img.width | ||
canvas.height = img.height | ||
ctx!.drawImage(img, 0, 0) | ||
const dataURL = canvas.toDataURL(`image/${extName}`) | ||
const a = document.createElement('a') | ||
a.download = name || 'image' | ||
a.href = dataURL | ||
a.click() | ||
} | ||
} | ||
return { | ||
@@ -87,6 +124,9 @@ customRequest, | ||
handlePreview, | ||
downloadImage, | ||
previewVisible, | ||
previewImage, | ||
previewTitle, | ||
previewType, | ||
drawImage, | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
66920
36
48
38
934