Files
ks-app-employment-service/packageRc/components/verifition/utils/util.js
wuzhimiao e84b367360 提交
2025-10-31 09:30:04 +08:00

39 lines
1.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export function resetSize (vm) {
var imgWidth, imgHeight, barWidth, barHeight // 图片的宽度、高度,移动条的宽度、高度
// 修复使用window.innerWidth/innerHeight替代不存在的window.offsetWidth
var parentWidth = vm.$el?.parentNode?.offsetWidth || window.innerWidth
var parentHeight = vm.$el?.parentNode?.offsetHeight || window.innerHeight
// 修复使用vm替代this来访问组件属性
if (vm.imgSize && vm.imgSize.width && vm.imgSize.width.indexOf('%') !== -1) {
imgWidth = parseInt(vm.imgSize.width) / 100 * parentWidth + 'px'
} else {
imgWidth = vm.imgSize?.width || '300px'
}
if (vm.imgSize && vm.imgSize.height && vm.imgSize.height.indexOf('%') !== -1) {
imgHeight = parseInt(vm.imgSize.height) / 100 * parentHeight + 'px'
} else {
imgHeight = vm.imgSize?.height || '150px'
}
if (vm.barSize && vm.barSize.width && vm.barSize.width.indexOf('%') !== -1) {
barWidth = parseInt(vm.barSize.width) / 100 * parentWidth + 'px'
} else {
barWidth = vm.barSize?.width || '300px'
}
if (vm.barSize && vm.barSize.height && vm.barSize.height.indexOf('%') !== -1) {
barHeight = parseInt(vm.barSize.height) / 100 * parentHeight + 'px'
} else {
barHeight = vm.barSize?.height || '40px'
}
return { imgWidth: imgWidth, imgHeight: imgHeight, barWidth: barWidth, barHeight: barHeight }
}
export const codeChars = [1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
export const codeColor1 = ['#fffff0', '#f0ffff', '#f0fff0', '#fff0f0']
export const codeColor2 = ['#FF0033', '#006699', '#993366', '#FF9900', '#66CC66', '#FF33CC']