@x-edu/channel
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

@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

登陆状态

备注

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

TODO

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

Readme

Keywords

none

Package Sidebar

Install

npm i @x-edu/channel

Weekly Downloads

2

Version

0.0.2

License

none

Unpacked Size

205 kB

Total Files

15

Last publish

Collaborators

  • huhb500
  • eliseisgood
  • dont_write_code
  • guoyh
  • caijiexuan
  • janya
  • githoniel
  • gylllll
  • caolvchong