Socket
Book a DemoInstallSign in
Socket

@x-edu/channel

Package Overview
Dependencies
Maintainers
9
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@x-edu/channel

## API

latest
npmnpm
Version
0.0.2
Version published
Maintainers
9
Created
Source

@x-edu/channel

API

getChannelData

获取频道数据

  await getChannelData({
    channelId, // 必填 频道 ID
    userRole, // 选填 用户角色,用于过滤频道板块
    loginStatus, // 选填 登陆状态 用于过滤频道板块
    platform, // 选填 平台 WEB | AAP,默认 WEB
    env, // 选填 环境 ‘preprodcution’ | ‘ncet-xedu’ 默认 ‘ncet-xedu’
    libraryServiceName, // 选填 库服务名 默认 zxx
    appid, // 必填
    isPreset, // 选填 默认 false
    filter, // 选填 (section) => boolean 板块过滤函数
  })

  /**
   * 1. 内部根据配置进行过滤,配置项为 是否需要登陆 角色权限
   * 2. platform 只有在管理台选中 APP 时才需要特殊处理,主要用于 web 和 app 展示不同数据的情况
   * 3. 自定义板块的数据格式和移动端保持一致
   **/

convertBannerSection

图片轮播板块数据转换

  convertBannerSection(section) // section 为 getChannelData 返回的数组中的一项

convertWindowRecommend

橱窗推荐板块数据转换

  await convertWindowRecommend(section) // section 为 getChannelData 返回的数组中的一项

convertMutipleGroupRecommend

专题多组推荐板块数据转换

  await convertMutipleGroupRecommend(section) // section 为 getChannelData 返回的数组中的一项

convertProvider

自定义板块数据转换

  await convertProvider(section) // section 为 getChannelData 返回的数组中的一项

convertSpecialRecommend

专题推荐板块数据转换

  await convertSpecialRecommend(section) // section 为 getChannelData 返回的数组中的一项

Platform

平台枚举

export enum Platform {
  WEB = 'WEB',
  APP = 'APP',
}

Env

环境枚举

LibraryServiceName

库服务名枚举

LoginStatus

登陆状态

备注

  • 图标导航板块不提供数据转换函数,直接取里面的 static_data 即可

TODO

  • 支持点赞、浏览、收藏等动态数据获取

FAQs

Package last updated on 10 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts