签到完成

This commit is contained in:
aixianling
2023-02-03 15:19:34 +08:00
parent 5b41cd85e0
commit 0bed825f70
7 changed files with 370 additions and 267 deletions

View File

@@ -1,117 +1,113 @@
<template>
<div class="aibar" :style="{ marginBottom: marginBottom }" :class="[titlePosition === 'center' ? 'aibar-center' : '']">
<div v-if="titlePosition === 'center'"></div>
<div class="aibar" :style="{ marginBottom }" :class="{'aibar-cente':titlePosition === 'center',card}">
<div v-if="titlePosition === 'center'"/>
<div class="aibar-left" :class="[titlePosition === 'center' ? 'aibar-left__center' : '']">
<template v-if="!isHasTitleSlot">{{ title }}</template>
<template v-if="!$scopedSlots.title">{{ title }}</template>
<slot name="title" v-else></slot>
</div>
<div class="aibar-right">
<slot name="right"></slot>
<slot v-if="$scopedSlots.right" name="right"/>
<slot/>
</div>
</div>
</template>
<script>
export default {
name: 'AiBar',
export default {
name: 'AiBar',
props: {
title: {
type: String
},
customCliker: {
type: Boolean,
default: false
},
marginBottom: {
type: String,
default: '16px'
},
titlePosition: {
type: String,
default: 'left'
}
props: {
title: {
type: String
},
computed: {
isHasTitleSlot () {
return this.$slots.title
}
customCliker: {
type: Boolean,
default: false
},
data () {
return {
}
}
}
marginBottom: {
type: String,
default: '16px'
},
titlePosition: {
type: String,
default: 'left'
},
card: Boolean
},
}
</script>
<style lang="scss" scoped>
.aibar {
display: flex;
.aibar {
display: flex;
position: relative;
align-items: center;
justify-content: space-between;
height: 56px;
padding: 0 16px;
box-sizing: border-box;
border-bottom: 1px solid #EEEEEE;
box-shadow: 0 4px 6px -2px rgba(15, 15, 21, 0.15);
&.card {
background: #fff;
}
.aibar-left {
color: #222;
font-size: 16px;
font-weight: 700;
}
.aibar-left__center {
position: relative;
width: 556px;
text-align: center;
word-break: break-all;
line-height: 24px;
}
.aibar-right {
display: flex;
align-items: center;
justify-content: space-between;
height: 56px;
padding: 0 16px;
box-sizing: border-box;
border-bottom: 1px solid #EEEEEE;
color: #5088FF;
font-size: 12px;
.aibar-left {
color: #222;
font-size: 16px;
font-weight: 700;
i {
line-height: 1;
color: #5088FF;
}
.aibar-left__center {
position: relative;
width: 556px;
text-align: center;
word-break: break-all;
line-height: 24px;
span {
font-size: 12px;
}
.aibar-right {
& > div, & > a {
display: flex;
align-items: center;
color: #5088FF;
font-size: 12px;
margin-right: 20px;
i {
line-height: 1;
color: #5088FF;
}
span {
font-size: 12px;
}
& > div, & > a {
display: flex;
align-items: center;
margin-right: 20px;
&:last-child {
margin-right: 0;
}
&:last-child {
margin-right: 0;
}
}
}
}
.aibar-center {
height: auto;
padding: 10px 0;
.aibar-center {
height: auto;
padding: 10px 0;
h2 {
margin: 0 0 10px 0;
}
p {
color: #888;
font-size: 14px;
}
h2 {
margin: 0 0 10px 0;
}
p {
color: #888;
font-size: 14px;
}
}
</style>

View File

@@ -1,163 +1,165 @@
<template>
<section class="ai-dialog__wrapper">
<el-dialog
custom-class="ai-dialog"
v-on="$listeners"
v-if="isEmpty"
:close-on-click-modal="closeOnClickModal"
v-bind="$attrs"
:destroy-on-close="destroyOnClose"
:visible.sync="dialogVisible">
<div class="ai-dialog__header" slot="title">
<h2>{{ title }}</h2>
</div>
<div class="ai-dialog__content" :style="{'max-height': isScrool ? '500px' : 'auto'}">
<div class="ai-dialog__content--wrapper" :style="{'padding-right': isScrool ? '8px' : '0'}">
<slot></slot>
</div>
</div>
<template v-if="customFooter" slot="footer">
<slot name="footer"></slot>
</template>
<div v-else class="dialog-footer" slot="footer">
<el-button @click="onCancel">取消</el-button>
<el-button @click="onConfirm" type="primary" style="width: 92px;">确认</el-button>
</div>
</el-dialog>
<el-dialog
custom-class="ai-dialog"
v-on="$listeners"
v-if="isEmpty"
:close-on-click-modal="closeOnClickModal"
v-bind="$attrs"
:destroy-on-close="destroyOnClose"
:visible.sync="dialogVisible">
<div class="ai-dialog__header" slot="title">
<h2>{{ title }}</h2>
</div>
<div class="ai-dialog__content" :style="{'max-height': isScrool ? '500px' : 'auto'}">
<div class="ai-dialog__content--wrapper" :style="{'padding-right': isScrool ? '8px' : '0'}">
<slot></slot>
</div>
</div>
<template v-if="customFooter" slot="footer">
<slot name="footer"></slot>
</template>
<div v-else class="dialog-footer" slot="footer">
<el-button @click="onCancel">取消</el-button>
<el-button @click="onConfirm" type="primary" style="width: 92px;">确认</el-button>
</div>
</el-dialog>
</section>
</template>
<script>
export default {
name: 'AiDialog',
props: {
visible: {
type: Boolean,
default: false
},
title: {
type: String,
default: ''
},
customFooter: {
type: Boolean,
default: false
},
'close-on-click-modal': {
type: Boolean,
default: false
},
destroyOnClose: {
type: Boolean,
default: true
}
},
export default {
name: 'AiDialog',
props: {
visible: {
type: Boolean,
default: false
},
title: {
type: String,
default: ''
},
customFooter: {
type: Boolean,
default: false
},
'close-on-click-modal': {
type: Boolean,
default: false
},
destroyOnClose: {
type: Boolean,
default: true
}
},
data () {
return {
dialogVisible: false,
isScrool: true,
isEmpty: true
}
},
data() {
return {
dialogVisible: false,
isScrool: true,
isEmpty: true
}
},
watch: {
visible: {
handler (val) {
this.dialogVisible = val
watch: {
visible: {
handler(val) {
this.dialogVisible = val
// if (val) {
// this.$nextTick(() => {
// setTimeout(() => {
// this.isScrool = document.querySelector('.ai-dialog__content') && document.querySelector('.ai-dialog__content').clientHeight >= 500
// }, 100)
// })
// }
// if (val) {
// this.$nextTick(() => {
// setTimeout(() => {
// this.isScrool = document.querySelector('.ai-dialog__content') && document.querySelector('.ai-dialog__content').clientHeight >= 500
// }, 100)
// })
// }
if (this.destroyOnClose && !val) {
setTimeout(() => {
this.isEmpty = false
if (this.destroyOnClose && !val) {
setTimeout(() => {
this.isEmpty = false
setTimeout(() => {
this.isEmpty = true
}, 50)
}, 500)
}
}
}
},
setTimeout(() => {
this.isEmpty = true
}, 50)
}, 500)
}
}
}
},
mounted () {
},
mounted() {
},
methods: {
onCancel () {
this.$emit('update:visible', false)
this.$emit('onCancel')
},
methods: {
onCancel() {
this.$emit('update:visible', false)
this.$emit('onCancel')
this.$emit('cancel')
},
onConfirm () {
this.$emit('onConfirm')
}
}
}
onConfirm() {
this.$emit('onConfirm')
this.$emit('confirm')
}
}
}
</script>
<style lang="scss">
.ai-dialog {
margin: 0!important;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
.ai-dialog {
margin: 0 !important;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
.el-dialog__body {
padding: 20px 40px 20px;
}
.el-dialog__body {
padding: 20px 40px 20px;
}
.ai-dialog__content {
overflow-y: auto;
padding-bottom: 4px;
.ai-dialog__content {
overflow-y: auto;
padding-bottom: 4px;
.ai-dialog__content--wrapper {
height: 100%;
overflow-x: hidden;
overflow-y: overlay;
}
}
.ai-dialog__content--wrapper {
height: 100%;
overflow-x: hidden;
overflow-y: overlay;
}
}
.ai-dialog__header {
height: 48px;
line-height: 48px;
padding: 0 16px;
border-bottom: 1px solid #eee;
.ai-dialog__header {
height: 48px;
line-height: 48px;
padding: 0 16px;
border-bottom: 1px solid #eee;
h2 {
font-size: 16px;
font-weight: 700;
}
}
h2 {
font-size: 16px;
font-weight: 700;
}
}
.el-dialog__footer {
padding: 16px 20px;
box-sizing: border-box;
background: #F3F6F9;
text-align: center;
.el-dialog__footer {
padding: 16px 20px;
box-sizing: border-box;
background: #F3F6F9;
text-align: center;
& + .el-button {
margin-left: 8px;
}
& + .el-button {
margin-left: 8px;
}
.el-button {
width: 92px!important;
}
}
.el-button {
width: 92px !important;
}
}
.el-dialog__header {
padding: 0;
}
.el-dialog__header {
padding: 0;
}
.el-dialog__headerbtn {
top: 24px;
transform: translateY(-50%);
}
}
.el-dialog__headerbtn {
top: 24px;
transform: translateY(-50%);
}
}
</style>