0.2.12 • Published 11 months ago

@hongtangyun/puzzle-libs v0.2.12

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago
import {TestPaper, TypeEnum} from '@hongtangyun/puzzle-libs'
import '@hongtangyun/puzzle-libs/dist/styles.css'

1. 编辑组件

1. 题目编辑

import { HTMLEditorLibs } from '@hongtangyun/puzzle-libs';
import '@hongtangyun/puzzle-libs/dist/styles.css';

<HTMLEditorLibs.EditorQ
  upConfig={upConfig}
  data={initData}
  bigQType={initData?.type ? initData?.type : undefined}
  onOk={async (data) => {
    await handleSave(data);
  }}
  onCancel={() => {
    
  }}
  onGetUpConfig={async () => {
    const _up = await getStorageConfig('COS');
    return {
      type: _up.type,
      cosCof: {
        bucket: _up.data.bucket,
        region: _up.data.region,
        startTime: _up.data.startTime,
        expiredTime: _up.data.expiredTime,
        prefix: _up.data.prefix,
        tmpSecretKey: _up.data.credentials.tmpSecretKey,
        tmpSecretId: _up.data.credentials.tmpSecretId,
        sessionToken: _up.data.credentials.sessionToken,
      },
    };
  }}
/>

2. 题目预览

import { HtmlPaperLibs } from '@hongtangyun/puzzle-libs';
import '@hongtangyun/puzzle-libs/dist/styles.css';

<HtmlPaperLibs.ExpandedRowRenderQ
  data={record.sourceData}
/>

3. 试卷编辑

import { EditorPaper } from '@hongtangyun/puzzle-libs';
import '@hongtangyun/puzzle-libs/dist/styles.css';

<EditorPaper
  type="HTML"
  config={{
    initData: initData,
    onGetUpConfig: async () => {
      const _up = await getStorageConfig('COS');
      return {
        type: _up.type,
        cosCof: {
          bucket: _up.data.bucket,
          region: _up.data.region,
          startTime: _up.data.startTime,
          expiredTime: _up.data.expiredTime,
          prefix: _up.data.prefix,
          tmpSecretKey: _up.data.credentials.tmpSecretKey,
          tmpSecretId: _up.data.credentials.tmpSecretId,
          sessionToken: _up.data.credentials.sessionToken,
        },
      };
    },
    onChagne: (data) => {
      setEditorData(data);
    },
    getTopicList: async (page, pageSize, params?: any) => {
      return await getPuzzlesTopic({
        ...params,
        page,
        pageSize,
      });
    },
    onTopicTags: async (page, pageSize, params?: any) => {
      return await getPuzzlesTagsTopic({
        ...params,
        page,
        pageSize,
      });
    },
  }}
/>

4. 试卷预览

import { TestPaper, TypeEnum } from '@hongtangyun/puzzle-libs';
import '@hongtangyun/puzzle-libs/dist/styles.css';

<TestPaper
  layout="all"
  answer={
    {
      // '2ec9b9c187beaae90fc558a056ebbc30': ['ccc'],
      // '5b576156cc3228a511ded14589ea859b': ['xxx'],
      // '3fee91715e83e61acbffad2889bbde0a': ['1234'],
      // '54c8a4770e2d88d19644a3d6163ef5c9': [
      //   'https://hongtangyun-1252095557.cos.ap-chengdu.myqcloud.com/hongtangyun_access/room/625e56bef7e409145c6d882b/1/2022_12_07_18/ac64cf03820a8b8b55f681020938b170.wav',
      // ],
    }
  }
  watermark="测试用户-预览"
  width={windowSize.width}
  height={windowSize.height}
  currentPaper={initData}
  readonly={true}
  showTip={true}
  onChange={async (changeValue, allValue, paperInfo) => {}}
  onSubmit={async (data) => {
    console.log('onSubmit: ', data);
  }}
  onBack={() => {}}
/>

5. 试卷做答

import { TestPaper, TypeEnum } from '@hongtangyun/puzzle-libs';
import '@hongtangyun/puzzle-libs/dist/styles.css';

<TestPaper
  layout="all"
  answer={
    {
      // '2ec9b9c187beaae90fc558a056ebbc30': ['ccc'],
      // '5b576156cc3228a511ded14589ea859b': ['xxx'],
      // '3fee91715e83e61acbffad2889bbde0a': ['1234'],
      // '54c8a4770e2d88d19644a3d6163ef5c9': [
      //   'https://hongtangyun-1252095557.cos.ap-chengdu.myqcloud.com/hongtangyun_access/room/625e56bef7e409145c6d882b/1/2022_12_07_18/ac64cf03820a8b8b55f681020938b170.wav',
      // ],
    }
  }
  watermark="测试用户-预览"
  width={windowSize.width}
  height={windowSize.height}
  currentPaper={initData}
  readonly={false}
  showTip={false}
  onChange={async (changeValue, allValue, paperInfo) => {}}
  onSubmit={async (data) => {
    console.log('onSubmit: ', data);
  }}
  onBack={() => {}}
/>

6. 试卷阅卷

import { TestPaper, TypeEnum } from '@hongtangyun/puzzle-libs';
import '@hongtangyun/puzzle-libs/dist/styles.css';

<TestPaper
  layout="all"
  /**
   * 批改试卷
   */
  isCorrection?: boolean;
  /**
   * 批改试卷回调
   * @param data
   * @returns
   */
  onCorrection?: (
    data:
      | Array<{ score: number; question: SubItem }>
      | { score: number; question: SubItem },
  ) => Promise<boolean>;
  /**
   * 获取当前用户批改试卷分数
   * @param id 题目id
   * @returns
   */
  onGetCorrectionScore?: (id: string) => Promise<number | undefined>;
  answer={
    {
      // '2ec9b9c187beaae90fc558a056ebbc30': ['ccc'],
      // '5b576156cc3228a511ded14589ea859b': ['xxx'],
      // '3fee91715e83e61acbffad2889bbde0a': ['1234'],
      // '54c8a4770e2d88d19644a3d6163ef5c9': [
      //   'https://hongtangyun-1252095557.cos.ap-chengdu.myqcloud.com/hongtangyun_access/room/625e56bef7e409145c6d882b/1/2022_12_07_18/ac64cf03820a8b8b55f681020938b170.wav',
      // ],
    }
  }
  watermark="测试用户-预览"
  width={windowSize.width}
  height={windowSize.height}
  currentPaper={initData}
  readonly={true}
  showTip={true}
  onChange={async (changeValue, allValue, paperInfo) => {}}
  onSubmit={async (data) => {
    console.log('onSubmit: ', data);
  }}
  onBack={() => {}}
/>

7. 参数

upConfig = {
  type: _up.type,
  cosCof: {
    bucket: _up.data.bucket,
    region: _up.data.region,
    startTime: _up.data.startTime,
    expiredTime: _up.data.expiredTime,
    prefix: _up.data.prefix,
    tmpSecretKey: _up.data.credentials.tmpSecretKey,
    tmpSecretId: _up.data.credentials.tmpSecretId,
    sessionToken: _up.data.credentials.sessionToken,
  },
}

utils

import { utils } from '@hongtangyun/puzzle-libs';
// class100题目导入
utils.class100QInput
// class100题目导出 
utils.class100QExport
// class100试卷导入
utils.class100PaperInput
// class100试卷导出 
utils.class100PaperExport
// 编辑器试卷转class100试卷
utils.editorPaperToClass100Paper
// 试卷值转class100值
utils.editorValuesToClass100Values
// 试卷标记转class100标记
utils.editorFlagsToClass100Flags
// 提交试卷 - 检测 必答是否完成
utils.checkPaperAnswerInComplete
// class100提交试卷 - 检测 必答是否完成
utils.checkPaperAnswerIsCompleteForClass100
// 判断富文本为空
utils.isContentEmpty
0.0.84

12 months ago

0.0.85

12 months ago

0.0.86

12 months ago

0.0.87

12 months ago

0.0.88

12 months ago

0.0.89

12 months ago

0.0.80

12 months ago

0.0.81

12 months ago

0.0.82

12 months ago

0.0.83

12 months ago

0.0.73

12 months ago

0.0.74

12 months ago

0.0.75

12 months ago

0.0.76

12 months ago

0.0.77

12 months ago

0.0.78

12 months ago

0.0.79

12 months ago

0.2.12

11 months ago

0.2.11

11 months ago

0.0.70

12 months ago

0.2.10

11 months ago

0.0.71

12 months ago

0.0.72

12 months ago

0.0.62

12 months ago

0.0.63

12 months ago

0.0.64

12 months ago

0.0.65

12 months ago

0.0.66

12 months ago

0.0.67

12 months ago

0.0.68

12 months ago

0.0.69

12 months ago

0.0.60

12 months ago

0.0.61

12 months ago

0.0.59

12 months ago

0.0.51

12 months ago

0.0.52

12 months ago

0.0.53

12 months ago

0.0.54

12 months ago

0.0.55

12 months ago

0.0.56

12 months ago

0.0.57

12 months ago

0.0.58

12 months ago

0.0.50

12 months ago

0.0.48

12 months ago

0.0.49

12 months ago

0.0.40

12 months ago

0.0.41

12 months ago

0.0.42

12 months ago

0.0.43

12 months ago

0.0.44

12 months ago

0.0.46

12 months ago

0.0.47

12 months ago

0.0.37

12 months ago

0.0.38

12 months ago

0.0.39

12 months ago

0.0.30

12 months ago

0.0.31

12 months ago

0.0.32

12 months ago

0.0.33

12 months ago

0.0.34

12 months ago

0.0.35

12 months ago

0.0.36

12 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.0.26

12 months ago

0.0.27

12 months ago

0.0.28

12 months ago

0.0.29

12 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.0.20

12 months ago

0.0.21

12 months ago

0.0.22

12 months ago

0.0.23

12 months ago

0.0.24

12 months ago

0.0.25

12 months ago

0.0.95

11 months ago

0.0.96

11 months ago

0.0.97

11 months ago

0.0.98

11 months ago

0.0.99

11 months ago

0.2.0-beta.1

11 months ago

0.2.0-beta.0

11 months ago

0.0.90

12 months ago

0.0.91

12 months ago

0.0.92

12 months ago

0.0.94

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.2.7

11 months ago

0.2.6

11 months ago

0.2.9

11 months ago

0.2.8

11 months ago

0.2.3

11 months ago

0.2.2

11 months ago

0.2.5

11 months ago

0.2.4

11 months ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago