Vue3 之 Lark预约活动

一、前情提要

1. 需求

系统中方便客户进行预约活动操作,故接入Lark快速开发

2. 安装Lark

二、配置活动

1. 创建活动

2. 复制代码

三、项目中引入 

1. 效果

2. 代码

<!-- ? 预约培训模块 -->
<template>
    <div class="appointment-train-view">
        <div class="main-view">
            <aside class="right-lark">
                <!-- Lark Scheduler Inline Embed Begin -->
                <div
                    :key="Math.random()"
                    class="scheduler-inline-widget"
                    data-url="https://zj94kt0oujr.larksuite.com/scheduler/embed/1249b5e3b8a9fa8e?hideEventDetail=true"
                    style="width: 100%; height: 606px"
                ></div>
                <!-- Lark Scheduler Inline Embed End -->
                <!-- loading -->
                <ElementIcon
                    class="is-loading"
                    iconName="Loading"
                    :iconSize="40"
                    iconColor="#86909C"
                />
                <!-- 遮挡四周box-shadow -->
                <i class="mark mark-l" />
                <i class="mark mark-t" />
                <i class="mark mark-r" />
                <i class="mark mark-b" />
            </aside>
        </div>
    </div>
</template>
<script setup>
import { onUnmounted, computed } from 'vue'

const loadLarkSchedulerScript = () => {
    const script = document.createElement('script')
    script.className = 'lark-scheduler-script'
    script.src = 'https://zj94kt0oujr.larksuite.com/scheduler/embed/scheduler-widget.js'
    script.async = true
    script.onload = () => {
        console.log('Lark Scheduler 脚本加载完成')
    }
    document.body.appendChild(script)
}
// 加载 Lark Scheduler 脚本
loadLarkSchedulerScript()

onUnmounted(() => {
    // 卸载 Lark Scheduler 脚本
    const script = document.querySelector('.lark-scheduler-script')
    document.body.removeChild(script)
})
</script>

<style lang="scss" scoped>
.appointment-train-view {
    height: 100vh;
    background-color: #f2f3f5;
    padding-top: 104px;
    .header-view {
        width: 1184px;
        margin: 0 auto 16px;
        :deep(.el-dropdown) {
            .support {
                margin-right: 0;
                position: relative;
                top: 2px;
            }
        }
    }
    .main-view {
        width: 1184px;
        height: 606px;
        margin: 0 auto;
        background-color: #fff;
        display: flex;
        justify-content: space-between;
        border-radius: 8px;
        .left-img {
            width: 334px;
            height: 100%;
            position: relative;
            img {
                width: 100%;
                height: 100%;
            }
            overflow: hidden;
        }
        .right-lark {
            flex: 1;
            position: relative;
            z-index: 2;
            .scheduler-inline-widget {
                position: relative;
                z-index: 2;
            }
            .is-loading {
                position: absolute;
                left: 50%;
                top: 45%;
                transform: translate(-50%, -50%);
                z-index: 1;
            }
            .mark {
                position: absolute;
                background-color: #fff;
                z-index: 3;
                &.mark-l,
                &.mark-r {
                    height: 100%;
                    top: 0;
                }
                &.mark-l {
                    width: 20px;
                    left: 86px;
                }
                &.mark-r {
                    width: 20px;
                    right: 86px;
                }

                &.mark-t,
                &.mark-b {
                    width: 90%;
                    height: 28px;
                }
                &.mark-t {
                    top: 0px;
                }
                &.mark-b {
                    bottom: 0px;
                }
            }
        }
    }
}
</style>

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值