This commit is contained in:
Theluyuan 2022-11-15 09:17:55 +08:00
parent 30c5b4c8a5
commit fd4a5faf7c
6 changed files with 101 additions and 25 deletions

View File

@ -16,7 +16,11 @@
<li <li
v-for="item of MONTH_NAME" v-for="item of MONTH_NAME"
:key="item" :key="item"
:class="{ 'layui-this': MONTH_NAME.indexOf(item) === Month }" :class="{
'layui-this': MONTH_NAME.indexOf(item) === Month,
'layui-laydate-current':
Month === '' && parseInt(item) - 1 === dayjs().month(),
}"
@click="handleMonthClick(item)" @click="handleMonthClick(item)"
> >
{{ item.slice(0, 3) }} {{ item.slice(0, 3) }}

View File

@ -36,6 +36,9 @@
'laydate-range-hover': ifHasRangeHoverClass( 'laydate-range-hover': ifHasRangeHoverClass(
getUnix(item, 'left') getUnix(item, 'left')
), ),
'layui-laydate-current':
(startTime.unix === -1 || endTime.unix === -1) &&
getUnix(item, 'left') === dayjs().startOf('month').valueOf(),
}" }"
@click="handleMonthClick(getUnix(item, 'left'))" @click="handleMonthClick(getUnix(item, 'left'))"
@mouseenter="monthItemMouseEnter($event, item)" @mouseenter="monthItemMouseEnter($event, item)"
@ -80,6 +83,9 @@
'laydate-range-hover': ifHasRangeHoverClass( 'laydate-range-hover': ifHasRangeHoverClass(
getUnix(item, 'right') getUnix(item, 'right')
), ),
'layui-laydate-current':
(startTime.unix === -1 || endTime.unix === -1) &&
getUnix(item, 'right') === dayjs().startOf('month').valueOf(),
}" }"
@click="handleMonthClick(getUnix(item, 'right'))" @click="handleMonthClick(getUnix(item, 'right'))"
@mouseenter="monthItemMouseEnter($event, item)" @mouseenter="monthItemMouseEnter($event, item)"

View File

@ -18,7 +18,10 @@
<li <li
v-for="item of yearList" v-for="item of yearList"
:key="item" :key="item"
:class="{ 'layui-this': Year === item }" :class="{
'layui-this': Year === item,
'layui-laydate-current': !Year && item === dayjs().year(),
}"
@click="handleYearClick(item)" @click="handleYearClick(item)"
> >
{{ item }} {{ item }}

View File

@ -27,6 +27,9 @@
(item.value == startDate || item.value == endDate)), (item.value == startDate || item.value == endDate)),
'laydate-range-hover': ifHasRangeHoverClass(item), 'laydate-range-hover': ifHasRangeHoverClass(item),
'layui-disabled': item.type !== 'current' && datePicker.range, 'layui-disabled': item.type !== 'current' && datePicker.range,
'layui-laydate-current':
modelValue === -1 &&
item.value === dayjs().startOf('day').valueOf(),
}" }"
@click="handleDayClick(item)" @click="handleDayClick(item)"
@mouseenter="dayItemMouseEnter($event, item)" @mouseenter="dayItemMouseEnter($event, item)"
@ -48,6 +51,7 @@ export default {
import { useI18n } from "../../../../language"; import { useI18n } from "../../../../language";
import { computed, inject } from "vue"; import { computed, inject } from "vue";
import { provideType } from "../../interface"; import { provideType } from "../../interface";
import dayjs from "dayjs";
export interface DateContentProps { export interface DateContentProps {
dateList: any; dateList: any;

View File

@ -248,6 +248,21 @@ html #layuicss-laydate {
line-height: 26px; line-height: 26px;
padding: 10px; padding: 10px;
} }
.layui-laydate-footer .laydate-footer-btns span {
border-radius: 0px;
}
.layui-laydate-footer .laydate-footer-btns span:first-child {
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}
.layui-laydate-footer .laydate-footer-btns span:last-child {
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
}
.layui-laydate-footer span { .layui-laydate-footer span {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
@ -577,3 +592,6 @@ html #layuicss-laydate {
width: 340px; width: 340px;
} }
} }
.layui-laydate-current{
background-color: var(--global-neutral-color-3);
}

View File

@ -172,6 +172,7 @@ const slots = slot.default && slot.default();
const context = getCurrentInstance(); const context = getCurrentInstance();
const emit = defineEmits([ const emit = defineEmits([
"choose", "choose",
"chooseAfter",
"before", "before",
"done", "done",
"error", "error",
@ -193,8 +194,8 @@ const isDragEnter = ref(false);
const activeUploadFiles = ref<any[]>([]); const activeUploadFiles = ref<any[]>([]);
const activeUploadFilesImgs = ref<any[]>([]); const activeUploadFilesImgs = ref<any[]>([]);
const orgFileInput = templateRef<HTMLElement>("orgFileInput"); const orgFileInput = templateRef<HTMLElement>("orgFileInput");
let _cropper: any = null;
let _cropper: any = null;
let computedCutLayerOption: ComputedRef<LayerModal>; let computedCutLayerOption: ComputedRef<LayerModal>;
if (props.cutOptions && props.cutOptions.layerOption) { if (props.cutOptions && props.cutOptions.layerOption) {
@ -264,14 +265,13 @@ const errorF = (errorText: string) => {
let errorMsg = errorText ? errorText : defaultErrorMsg; let errorMsg = errorText ? errorText : defaultErrorMsg;
errorMsg = `layui-vue:${errorMsg}`; errorMsg = `layui-vue:${errorMsg}`;
console.warn(errorMsg); console.warn(errorMsg);
layer.msg(errorMsg, { icon: 2, time: 1000 }, function (res: unknown) { }); layer.msg(errorMsg, { icon: 2, time: 1000 }, function (res: unknown) {});
emit("error", Object.assign({ currentTimeStamp, msg: errorMsg })); emit("error", Object.assign({ currentTimeStamp, msg: errorMsg }));
}; };
const localUpload = (option: localUploadOption, callback: Function) => { const localUpload = (option: localUploadOption, callback: Function) => {
let xhr: XMLHttpRequest, url; let xhr: XMLHttpRequest = new XMLHttpRequest();
xhr = new XMLHttpRequest(); let url = option.url;
url = option.url;
let formData = option.formData; let formData = option.formData;
const cb = callback; const cb = callback;
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
@ -352,6 +352,7 @@ const uploadChange = (e: any) => {
props.cut && props.cut &&
props.acceptMime.indexOf("image") != -1 && props.acceptMime.indexOf("image") != -1 &&
props.multiple == false; props.multiple == false;
let arm2 = let arm2 =
props.cut && props.cut &&
props.acceptMime.indexOf("image") != -1 && props.acceptMime.indexOf("image") != -1 &&
@ -441,9 +442,22 @@ onUnmounted(() => {
</script> </script>
<template> <template>
<div class="layui-upload layui-upload-wrap" :class="disabledPreview ? 'layui-upload-file-disabled' : ''"> <div
<input type="file" class="layui-upload-file" ref="orgFileInput" :name="field" :field="field" :multiple="multiple" class="layui-upload layui-upload-wrap"
:accept="acceptMime" :disabled="disabled" @click="clickOrgInput" @change="uploadChange" /> :class="disabledPreview ? 'layui-upload-file-disabled' : ''"
>
<input
type="file"
class="layui-upload-file"
ref="orgFileInput"
:name="field"
:field="field"
:multiple="multiple"
:accept="acceptMime"
:disabled="disabled"
@click="clickOrgInput"
@change="uploadChange"
/>
<div v-if="!drag"> <div v-if="!drag">
<div class="layui-upload-btn-box" @click.stop="chooseFile"> <div class="layui-upload-btn-box" @click.stop="chooseFile">
<template v-if="slot.default"> <template v-if="slot.default">
@ -451,18 +465,24 @@ onUnmounted(() => {
</template> </template>
<template v-else> <template v-else>
<lay-button type="primary" :disabled="disabled">{{ <lay-button type="primary" :disabled="disabled">{{
text text
}}</lay-button> }}</lay-button>
</template> </template>
</div> </div>
</div> </div>
<div v-else ref="dragRef" class="layui-upload-drag" :class=" <div
disabled v-else
? 'layui-upload-drag-disable' ref="dragRef"
: isDragEnter class="layui-upload-drag"
:class="
disabled
? 'layui-upload-drag-disable'
: isDragEnter
? 'layui-upload-drag-draging' ? 'layui-upload-drag-draging'
: '' : ''
" @click.stop="chooseFile"> "
@click.stop="chooseFile"
>
<i class="layui-icon"></i> <i class="layui-icon"></i>
<p>{{ dragText }}</p> <p>{{ dragText }}</p>
<div class="layui-hide" id="uploadDemoView"> <div class="layui-hide" id="uploadDemoView">
@ -470,17 +490,38 @@ onUnmounted(() => {
<img src="" alt="上传成功后渲染" style="max-width: 196px" /> <img src="" alt="上传成功后渲染" style="max-width: 196px" />
</div> </div>
</div> </div>
<lay-layer v-model="innerCutVisible" :title="computedCutLayerOption.title" :move="computedCutLayerOption.move" <lay-layer
:resize="computedCutLayerOption.resize" :shade="computedCutLayerOption.shade" v-model="innerCutVisible"
:shadeClose="computedCutLayerOption.shadeClose" :shadeOpacity="computedCutLayerOption.shadeOpacity" :title="computedCutLayerOption.title"
:zIndex="computedCutLayerOption.zIndex" :btnAlign="computedCutLayerOption.btnAlign" :move="computedCutLayerOption.move"
:area="computedCutLayerOption.area" :anim="computedCutLayerOption.anim" :resize="computedCutLayerOption.resize"
:isOutAnim="computedCutLayerOption.isOutAnim" :btn="computedCutLayerOption.btn" @close="clearAllCutEffect"> :shade="computedCutLayerOption.shade"
<div class="copper-container" v-for="(base64str, index) in activeUploadFilesImgs" :key="`file${index}`"> :shadeClose="computedCutLayerOption.shadeClose"
<img :src="base64str" :id="`_lay_upload_img${index}`" class="_lay_upload_img" /> :shadeOpacity="computedCutLayerOption.shadeOpacity"
:zIndex="computedCutLayerOption.zIndex"
:btnAlign="computedCutLayerOption.btnAlign"
:area="computedCutLayerOption.area"
:anim="computedCutLayerOption.anim"
:isOutAnim="computedCutLayerOption.isOutAnim"
:btn="computedCutLayerOption.btn"
@close="clearAllCutEffect"
>
<div
class="copper-container"
v-for="(base64str, index) in activeUploadFilesImgs"
:key="`file${index}`"
>
<img
:src="base64str"
:id="`_lay_upload_img${index}`"
class="_lay_upload_img"
/>
</div> </div>
</lay-layer> </lay-layer>
<div class="layui-upload-list" :class="disabledPreview ? 'layui-upload-list-disabled' : ''"> <div
class="layui-upload-list"
:class="disabledPreview ? 'layui-upload-list-disabled' : ''"
>
<slot name="preview"></slot> <slot name="preview"></slot>
</div> </div>
</div> </div>