CheckIn 簽到
更新時間:2021-10-14 16:15:55
引入元件
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>
Attributes
| 屬性名 | 類型 | 預設值 | 含義 |
|---|---|---|---|
| core | object | null | 簽到 SDK 實例 |
| lang | string | 'zh_CN' | 語言套件類型。取值範圍: 'zh_CN' 中文 'en' 英文 |
| canStart | boolean | true | 目前是否可以發起互動。 |
| cantStartTips | string | '目前不可以發起互動' | 如果目前不可以發起互動,點擊發起按鈕時的提示文案。 |
| resultId | string | '' | 需要顯示結果的簽到 id |
| right | object | {sendResult: false,showHistoryEntry: true,download: true,} | 操作權限。型別定義詳見Right。 |
Right 物件說明
| 屬性名 | 類型 | 預設值 | 含義 |
|---|---|---|---|
| sendResult | boolean | false | 表示操作「發送結果」的權限 |
| showHistoryEntry | boolean | true | 是否顯示「歷史簽到記錄」入口 |
| download | boolean | true | 是否顯示下載連結。 |
