Polyv Help Center

Help Center

CheckIn

Updated: 2021-10-14 16:15:55

Import Component

import CheckIn from '@polyv/interactions-launch-sdk-ui-default/lib/CheckIn';

Code Example

<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

Attribute Type Default Description
core object null Check-in SDK instance
lang string 'zh_CN' Language pack type. Values:
'zh_CN' Chinese
'en' English
canStart boolean true Whether interaction can be initiated currently.
cantStartTips string '当前不可以发起互动' Prompt text when clicking the start button if interaction cannot be initiated.
resultId string '' Check-in ID for displaying results.
right object {sendResult: false, showHistoryEntry: true, download: true} Operation permissions. Type definition see Right.

Right Object Description

Attribute Type Default Description
sendResult boolean false Permission for the "Send Result" operation.
showHistoryEntry boolean true Whether to display the "Historical Check-in Records" entry.
download boolean true Whether to display the download link.
联系客服,在线咨询