import CheckIn from '@polyv/interactions-launch-sdk-ui-default/lib/CheckIn';
<template>
<!-- 建议弹窗宽度为 560px,弹窗内容高度为 350px -->
<el-dialog
v-if="checkInCore"
:custom-class="'c-interactions-dialog c-interactions-dialog__h350'"
width="560px"
title="签到"
:visible.sync="checkInVisible"
:close-on-click-modal="false"
>
<check-in
:lang="lang"
:result-id="checkInResultId"
:core="checkInCore"
:right="{
sendResult: true,
showHistoryEntry: false,
download: false,
}"
/>
</el-dialog>
</template>
<script>
import CheckIn from '@polyv/interactions-launch-sdk-ui-default/lib/CheckIn';
import * as InteractionsLaunchSDK from '@polyv/interactions-launch-sdk';
// 弹窗组件可以选择其他 UI 库组件或自行开发,这里没有限制。
import { Dialog } from 'element-ui';
export default {
components: {
ElDialog: Dialog,
CheckIn,
},
data() {
return {
// 中英文设置 'zh_CN'/'en'
lang: 'zh_CN',
checkInCore: null,
checkInVisible: false,
// 需要显示结果的签到 id
checkInResultId: '',
};
},
mounted() {
// TODO: 关于初始化 InteractionsLaunchSDK 的其他设置
this.checkInCore = new InteractionsLaunchSDK.CheckIn();
this.checkInCore
.on('show-result', ({ checkInId }) => {
this.checkInVisible = true;
this.checkInResultId = checkInId;
});
}
};
</script>