This commit is contained in:
lcw
2025-08-16 16:54:03 +08:00
parent 71487ac647
commit 42f5e37f65
69 changed files with 5913 additions and 978 deletions

View File

@ -2,14 +2,14 @@
import ImageCompressor from "image-compressor.js";
// 随机颜色 - 把16进制的颜色换成rgba格式
export function choseRbgb(color,opcity) {
if(color){
return 'rgba('+ parseInt('0x'+color.slice(1,3)) + ','+ parseInt('0x'+color.slice(3,5))+','+parseInt('0x'+color.slice(5,7)) + ','+opcity+')'
}else{
let r = Math.floor(Math.random()*256)
let g = Math.floor(Math.random()*256)
let b = Math.floor(Math.random()*256)
let a = opcity ? opcity :1
export function choseRbgb(color, opcity) {
if (color) {
return 'rgba(' + parseInt('0x' + color.slice(1, 3)) + ',' + parseInt('0x' + color.slice(3, 5)) + ',' + parseInt('0x' + color.slice(5, 7)) + ',' + opcity + ')'
} else {
let r = Math.floor(Math.random() * 256)
let g = Math.floor(Math.random() * 256)
let b = Math.floor(Math.random() * 256)
let a = opcity ? opcity : 1
return `rgba(${r},${g},${b},${a})`
}
}
@ -25,7 +25,7 @@ export function randomHexColor() { // 随机生成十六进制颜色
/**
* 压缩图片
* @param {*} file
* @param {*} file
* @param {*} quality 压缩比
*/
export function compressImage(file, quality = 0.6) {
@ -96,11 +96,11 @@ export function timeValidate(date, type) {
export function timeSlotChange(val) {
let startTime, endTime;
let now = new Date(); //当前日期
let nowDayOfWeek = now.getDay(); //今天本周的第几天
let nowDay = now.getDate(); //当前日
let nowMonth = now.getMonth(); //当前月
let nowYear = now.getFullYear(); //当前年
let now = new Date(); //当前日期
let nowDayOfWeek = now.getDay(); //今天本周的第几天
let nowDay = now.getDate(); //当前日
let nowMonth = now.getMonth(); //当前月
let nowYear = now.getFullYear(); //当前年
let jd = Math.ceil((nowMonth + 1) / 3)
switch (val) {
case '天':
@ -318,3 +318,8 @@ function _setTime(date) {
}
//拼接地址
export function setAddress(val) {
const url = '/mosty-api/mosty-base/minio/image/download/'
return url + val
}