后浪云百度小程序教程:page-video 短视频详情页模板

  • page-video 短视频详情页模板
    • 示例
    • 页面内容
      • 短视频详情页
      • 评论详情页
    • 字段说明
      • 返回示例说明
      • longVideoInfo 长视频信息说明
      • playVideoList 连播列表说明
      • operateInfo 运营位信息说明
    • npm 依赖
    • Bug & Tip

    page-video 短视频详情页模板

    从开发者工具 v2.25.1-rc 版本、基础库版本 3.190.1 版本开始支持。

    解释:本模版适用于快速搭建视频片花、预告、短视频等视频类详情页。模版在保证用户交互体验的基础上,提供了不同模块,配合使用加入书架、预约和引导关注组件,实现兴趣激发,充分发挥短视频带长视频消费的种草价值,拉动二次重访。

    示例

    扫码体验

    代码示例

    请使用百度APP扫码

    页面内容

    模板包含两个页面:短视频详情页、评论详情页。

    短视频详情页

    默认配置为导航栏、视频播放器、短视频标题及辅助信息区、长视频信息区一站式互动区等模块。

    包含导航栏、引导关注组件、视频播放器(含自动连播逻辑)、短视频标题及辅助信息区、长视频信息区、活动运营位、百青藤广告区、推荐短视频区和一站式互动区等模块,分为默认配置模块和可选配置模块。开发者可根据自身业务形态选择合适的模块进行自定义配置。

    页面路径:pages/index

    代码示例

    • 获取页面数据。可将 getIndexData 替换以发送网络请求获取真实数据。

    • JS

     
     
     
    1. Page({
    2. ...
    3. attr: {
    4. // 请求的 url,请替换为真实的请求地址,该值仅做为示例,值为 defaultData 为默认配置示例,其他值为全配置示例
    5. url: '/index',
    6. // onLoad参数
    7. options: {}
    8. },
    9. onLoad(options) {
    10. this.getPageData();
    11. ...
    12. },
    13. getPageData() {
    14. const url = this.attr.url;
    15. // 模拟请求,请进行替换
    16. getIndexData({
    17. url
    18. }).then(
    19. res => {
    20. res.playVideoList.forEach(item => {
    21. // 格式化播放数量
    22. item.playNum = this.formatPlayNum(item.playNum);
    23. item.nextInfo = false;
    24. // 过滤出长视频
    25. if (item.type === 1) {
    26. this.attr.feedList.push(item);
    27. }
    28. });
    29. let {
    30. showFeed,
    31. feedMore,
    32. feedShowList,
    33. toolbarConfig
    34. } = this.data;
    35. let feedList = this.attr.feedList;
    36. if (!feedList.length) {
    37. showFeed = false;
    38. }
    39. // feed 少于5条不展示查看更多
    40. if (feedList.length <= 5) {
    41. feedMore = false;
    42. feedShowList = feedList;
    43. } else {
    44. // 多于5条时,先展示前5条
    45. feedShowList = feedList.slice(0, 5);
    46. }
    47. toolbarConfig.title = res.longVideoInfo.name;
    48. res.longVideoInfo = this.formatVideoInfo(res.longVideoInfo);
    49. this.setData({
    50. playVideoList: res.playVideoList,
    51. feedShowList: feedShowList,
    52. longVideoInfo: res.longVideoInfo,
    53. operateInfo: res.operateInfo,
    54. feedMore: feedMore,
    55. toolbarConfig: toolbarConfig,
    56. showFeed: showFeed,
    57. commentParam: {
    58. // 文章的唯一标识
    59. snid: this.attr.options.snid,
    60. path: `/@smt-ui-template-page-video/pages/index/index?snid=${this.attr.options.snid}`,
    61. title: res.longVideoInfo.name
    62. },
    63. loading: false,
    64. // code 0: 正常获取数据 99999: 无网络 其他: 服务异常
    65. statusType: res.code === 99999 ? 'noNetwork' : res.code !== 0 ? 'warning' : ''
    66. });
    67. }
    68. );
    69. }
    70. })
    • 引导关注组件。进入页面时,可选择是否展示引导关注组件。

    • JS

     
     
     
    1. Page({
    2. ...
    3. attr: {
    4. // 页面展示时是否显示关注引导tip
    5. showFavorite: true
    6. },
    7. onShow() {
    8. if (this.attr.showFavorite) {
    9. // 页面展示时显示关注引导
    10. this.showFavoriteGuide();
    11. }
    12. }
    13. })
    • 视频播放器,支持自动连播。
      自动连播逻辑
      • 触发时机:视频即将播放完毕,进入 5s 倒计时并展示提示气泡, 若页面处于最上方倒计时结束后自动连播下一条短视频。否则阻断连播,展示蒙层。
      • 自动连播顺序:根据 playVideoList 进行去重后的顺序进行播放,推荐开发者将长视频放在 playVideoList 的最后。
    1. 当前用户退出小程序后,即删除已观看记录,下次进入小程序短视频落地页,重新执行去重逻辑。
    2. 蒙层展示下一条播放的视频信息并提供重播、观看正片、立即播放等功能。
    • SWAN
    • JS
     
     
     
    1. <!-- 视频组件-->
    2. <video
    3. id="myVideo"
    4. class="video-header-player"
    5. src="{{playVideoList[playIndex] && playVideoList[playIndex].src}}"
    6. title="{{playVideoList[playIndex].title}}"
    7. autoplay="true"
    8. objectFit="fill"
    9. direction="true"
    10. muted="true"
    11. show-mute-btn="true"
    12. show-center-play-btn="false"
    13. bindtimeupdate="videoTimeUpdateHandler"
    14. bindplay="videoPlayHandler"
    15. bindended="videoEndedHandler"
    16. >
    17. </video>
    18. <!-- 蒙层 -->
    19. <view class="video-header-cover" s-if="{{!isPlaying && nextIndex != playIndex}}">
    20. <view class="video-header-cover-title" s-if="{{!timer}}">接下来播放</view>
    21. <view class="video-header-cover-title" s-else><view class="video-header-cover-title-remaining">{{remainingTime}}s</view>后播放</view>
    22. <view class="video-header-cover-content">
    23. <image class="video-header-cover-content-left" src="{{playVideoList[nextIndex].poster}}" mode="scaleToFill"></image>
    24. <view class="video-header-cover-content-right">
    25. <view class="video-header-cover-content-right-text c-line-clamp2">{{playVideoList[nextIndex].title}}</view>
    26. <view class="video-header-cover-content-right-num">{{playVideoList[nextIndex].playNum}}次播放</view>
    27. <view class="video-header-cover-content-right-button" bindtap="playVideo">立即播放</view>
    28. </view>
    29. </view>
    30. <view class="video-header-cover-buttons">
    31. <view class="video-header-cover-buttons-item" bindtap="replayVideo">
    32. <image class="video-header-cover-buttons-item-img" src="../../common/images/replay.png" mode="aspectFit"></image>
    33. 重播
    34. </view>
    35. <view class="video-header-cover-buttons-item" bindtap="navigateTo" data-path="{{longVideoInfo.path}}">
    36. <image class="video-header-cover-buttons-item-img" src="../../common/images/play.png" mode="aspectFit"></image>
    37. 观看正片
    38. </view>
    39. </view>
    40. </view>
    41. <view class="video-header-cover replay" s-if="{{!isPlaying && nextIndex == playIndex}}" bindtap="replayVideo">
    42. <view class="video-header-cover-replay">
    43. <image class="video-header-cover-replay-icon" src="../../common/images/replay.png" mode="scaleToFill"></image>
    44. </view>
    45. 重播
    46. <
    47. <!-- 下一条视频提示 -->
    48. <view class="video-header-tips c-line-clamp1" s-if="{{isMonitoring && isPlaying}}">即将播放:{{playVideoList[nextIndex].title}}</view>
     
     
     
    1. Page({
    2. ...
    3. /**
    4. * 播放下一条视频
    5. */
    6. playVideo() {
    7. this.setData({
    8. isMonitoring: false,
    9. isPlaying: true,
    10. playIndex: this.data.nextIndex
    11. });
    12. },
    13. /**
    14. * 重播
    15. */
    16. replayVideo() {
    17. this.attr.videoContext.play();
    18. this.setData({
    19. isMonitoring: false,
    20. isPlaying: true
    21. });
    22. },
    23. /**
    24. * 监听播放开始事件
    25. */
    26. videoPlayHandler() {
    27. const {
    28. timer,
    29. playVideoList,
    30. playIndex
    31. } = this.data;
    32. // 开始播放清除倒计时器
    33. if (timer) {
    34. clearInterval(timer);
    35. this.setData({
    36. timer: null
    37. });
    38. }
    39. if (!playVideoList[playIndex].nextInfo) {
    40. playVideoList[playIndex].nextInfo = true;
    41. // 根据已播列表获取下一条视频 index
    42. for (let i = playIndex + 1; i < playVideoList.length; i++) {
    43. if (this.attr.playedList.indexOf(playVideoList[i].id) === -1) {
    44. this.setData({
    45. nextIndex: i
    46. });
    47. break;
    48. }
    49. }
    50. }
    51. this.setData({
    52. isMonitoring: false
    53. });
    54. },
    55. /**
    56. * 监听播放结束事件
    57. */
    58. videoEndedHandler() {
    59. // 短视频去重
    60. if (this.data.playVideoList[this.data.playIndex].type === 1) {
    61. this.attr.playedList.push(this.data.playVideoList[this.data.playIndex].id);
    62. }
    63. // 没有可播放的视频
    64. if (this.data.nextIndex === this.data.playIndex) {
    65. // 存在长视频落地页时跳转长视频落地页
    66. if (this.data.longVideoInfo.path) {
    67. swan.navigateTo({
    68. url: this.data.longVideoInfo.path
    69. });
    70. } else {
    71. // 显示重播按钮
    72. this.setData({
    73. playIndex: this.data.nextIndex,
    74. isPlaying: false
    75. });
    76. this.attr.videoContext.stop();
    77. return;
    78. }
    79. }
    80. // 播下一条视频时页面不在顶部
    81. if (this.attr.scrollTop !== 0) {
    82. // 取消自动连播
    83. this.attr.videoContext.stop();
    84. this.setData({
    85. isPlaying: false
    86. });
    87. // 开启计时器
    88. this.onTimer();
    89. } else {
    90. // 不被打断则直接播放下一条视频
    91. this.setData({
    92. playIndex: this.data.nextIndex
    93. });
    94. }
    95. },
    96. /**
    97. * 监听播放进度变化
    98. * @param {*} e 事件对象
    99. */
    100. videoTimeUpdateHandler(e) {
    101. if (this.data.nextIndex === this.data.playIndex) {
    102. return;
    103. }
    104. const {
    105. duration,
    106. currentTime
    107. } = e.detail;
    108. // 剩余5s 时进行自动播放提示
    109. if (duration !== 0 && currentTime !== 0 && duration - currentTime <= 5) {
    110. this.setData({
    111. isMonitoring: true
    112. });
    113. }
    114. }
    115. })
    • 短视频标题及辅助信息区。展示用户头像、昵称、播放次数、简介。可展开收起,默认为收起态。

    • SWAN

    • JS
     
     
     
    1. <!-- 短视频标题及辅助信息区 -->
    2. <view class="video-content-introduction">
    3. <view class="video-content-introduction-title">
    4. {{playVideoList[playIndex].title}}
    5. <image
    6. s-if="{{playVideoList[playIndex].time || playVideoList[playIndex].introduction}}"
    7. class="video-content-introduction-title-switch {{introSwitch ? 'off': '' }}"
    8. mode="scaleToFill"
    9. src="../../common/images/arrow.png" bindtap="introductionSwitch">
    10. </image>
    11. </view>
    12. <view class="video-content-introduction-other">
    13. <view class="video-content-introduction-other-num">{{playVideoList[playIndex].playNum}}次播放</view>
    14. <image class="video-content-introduction-other-img video-img" mode="scaleToFill"
    15. s-if="{{playVideoList[playIndex].authorImage}}" src="{{playVideoList[nextIndex].autorImage}}"></image>
    16. <view class="video-content-introduction-other-name c-line-clamp1">{{playVideoList[playIndex].authorName}}</view>
    17. </view>
    18. <view class="video-content-introduction-more"
    19. s-if="{{introSwitch && (playVideoList[playIndex].time || playVideoList[playIndex].introduction)}}">
    20. <view class="video-content-introduction-more-time" s-if="{{playVideoList[playIndex].time}}">
    21. 发布时间:{{playVideoList[playIndex].time}}
    22. </view>
    23. <view class="video-content-introduction-more-text c-line-clamp3"
    24. s-if="{{playVideoList[playIndex].introduction}}">{{playVideoList[playIndex].introduction}}
    25. </view>
    26. </view>
    27. </view>
     
     
     
    1. Page({
    2. ...
    3. /**
    4. * 展开、收起简介信息
    5. */
    6. introductionSwitch() {
    7. this.setData({
    8. introSwitch: !this.data.introSwitch
    9. });
    10. }
    11. })
    • 长视频信息区。当资源配置了落地页时,展示加入书架按钮和观看正片按钮,点击长视频封面和观看正片按钮可跳转至长视频落地页。当资源未配置落地页时(资源未上映),默认仅展示预约观看按钮。加入书架功能具体接入流程参考书架同步功能介绍,支持将资源同步至百度 App -书架;预约功能具体接入流程参考预约订阅组件(平台配置版)和预约订阅组件(API版)。

    • SWAN

     
     
     
    1. <!-- 长视频信息区 -->
    2. <view class="video-content-detail">
    3. <view class="video-content-detail-left" bindtap="navigateTo" data-path="{{longVideoInfo.path}}">
    4. <image class="video-content-detail-left-img video-img" src="{{longVideoInfo.poster}}" mode="scaleToFill">
    5. </image>
    6. <view class="video-content-detail-left-play">
    7. </view>
    8. <image class="video-content-detail-left-play-icon" src="../../common/images/play3.png" mode="scaleToFill">
    9. </image>
    10. </view>
    11. <view class="video-content-detail-right">
    12. <view class="video-content-detail-right-name">
    13. {{longVideoInfo.name}}
    14. </view>
    15. <view class="video-content-detail-right-tags c-line-clamp2">
    16. {{longVideoInfo.info}}
    17. </view>
    18. <view class="video-content-detail-right-buttons">
    19. <!-- 立即观看按钮 -->
    20. <view class="video-content-detail-right-buttons-primary" s-if="{{longVideoInfo.path}}" bindtap="navigateTo"
    21. data-path="{{longVideoInfo.path}}">观看正片</view>
    22. <!-- 加入书架按钮 -->
    23. <view class="video-content-detail-right-buttons-normal" bindtap="insertBookshelf"
    24. s-if="{{longVideoInfo.path || longVideoInfo.bookInfo}}">加入书架</view>
    25. <!-- 预约观看按钮 -->
    26. <form s-if="{{!longVideoInfo.path || longVideoInfo.subscribeId}}" report-submit="true"
    27. report-type="subscribe" template-id="BD2305" subscribe-id="1235" bindsubmit="formSubmit">
    28. <button class="video-content-detail-right-buttons-normal" formType="submit" type="primary">预约观看</button>
    29. </form>
    30. </view>
    31. </view>
    32. </view>
    • 活动运营位。开发者提供活动运营图片和跳转地址,支持跳转到当前小程序内的其他页面。例如:可配置新用户购买会员优惠活动。

    • SWAN

     
     
     
    1. <!-- 运营位 -->
    2. <view class="video-content-operational video-img" s-if="{{operateInfo.path}}" style="background-image: url({{operateInfo.img}});" bindtap="navigateTo" data-path="{{operateInfo.path}}">
    3. </view>
    • 百青藤广告区。具体接入流程参考 ad 广告组件。获取 ad 组件代码后可替换模板中的 ad 组件。

    • SWAN

     
     
     
    1. <!-- 广告位 若使用可取消注释-->
    2. <!-- <view class="video-ad">
    3. <view class="video-ad-container">
    4. <ad appid="f71feede"
    5. apid="7182325"
    6. type="feed"
    7. >
    8. </ad>
    9. </view>
    10. <view class="video-divider wrapper" s-if="{{!showFeed}}"></view>
    11. </view> -->
    • 推荐短视频区。展示播放列表的短视频。默认最多展示 5 条短视频,超过数量的短视频将被折叠,点击查看更多每次可再展开 10 条短视频,包含视频的标题、播放次数、封面、时长等,点击后跳转到短视频落地页。

    • SWAN

    • JS
     
     
     
    1. <!-- 短视频列表 -->
    2. <view s-for="item in feedShowList" class="video-feed-item" bindtap="navigateTo" data-path="{{item.path}}">
    3. <view class="video-feed-item-left">
    4. <view class="video-feed-item-left-title c-line-clamp2">
    5. {{item.title}}
    6. </view>
    7. <view class="video-feed-item-left-num">
    8. {{item.playNum}}次播放
    9. </view>
    10. </view>
    11. <view class="video-feed-item-right">
    12. <image class="video-feed-item-right-img video-img" src="{{item.poster}}" mode="scaleToFill"></image>
    13. <view class="video-feed-item-right-time">
    14. <image class="video-feed-item-right-time-icon" src="../../common/images/play2.png" mode="scaleToFill">
    15. </image>
    16. {{item.duration}}
    17. </view>
    18. </view>
    19. </view>
    20. <view class="video-feed-more" bindtap="feedMoerHandler">
    21. <view>
    22. {{feedMore ? '查看更多': '没有更多了'}}
    23. <image class="video-feed-more-icon" s-if="{{feedMore}}" src="../../common/images/arrow.png" mode="scaleToFill"></image>
    24. </view>
    25. </view>
     
     
     
    1. Page({
    2. ...
    3. /**
    4. * 查看更多短视频
    5. */
    6. feedMoerHandler() {
    7. let {
    8. feedMore,
    9. feedShowList
    10. } = this.data;
    11. const start = feedShowList.length;
    12. let end = start + 10;
    13. // 结束位超出,展示剩余的视频
    14. if (end > this.attr.feedList.length) {
    15. end = start + this.attr.feedList.length - feedShowList.length;
    16. feedMore = false;
    17. }
    18. feedShowList.push(...this.attr.feedList.slice(start, end));
    19. this.setData({
    20. feedShowList: feedShowList,
    21. feedMore: feedMore
    22. });
    23. }
    24. })
    • 互动区。使用一站式互动组件。
    1. 使用点赞、评论功能时需要进行登入。
    2. 从其他页面跳转到本模板时,snid 文章 id 需要在加在跳转到本页面的路径上,跳转本页面的路径如:@smt-ui-template-page-video/pages/index/index?snid=10070000311753961
    • SWAN
    • JS
     
     
     
    1. <!-- 评论列表组件 -->
    2. <comment-list
    3. class="video-comment"
    4. is-page-scroll="false"
    5. comment-param="{{commentParam}}"
    6. detail-path="{{detailPath}}"
    7. toolbar-config="{{toolbarConfig}}">
    8. </comment-list>
     
     
     
    1. Page({
    2. data: {
    3. ...
    4. // 评论参数
    5. commentParam: {},
    6. // 评论详情页面路径
    7. detailPath: '/@smt-ui-template-page-video/pages/comment-detail/index',
    8. },
    9. onLoad(options) {
    10. this.getPageData();
    11. // 获取文章 id,示例中 mock 数据,使用时请使用真实数据
    12. if (!options.snid) {
    13. options.snid = '10070000311753961';
    14. }
    15. this.attr.options = options;
    16. },
    17. onReady() {
    18. requireDynamicLib('myDynamicLib').listenEvent();
    19. },
    20. getPageData() {
    21. ...
    22. this.setData({
    23. ...
    24. commentParam: {
    25. // 文章的唯一标识
    26. snid: this.attr.options.snid,
    27. path: `/@smt-ui-template-page-video/pages/index/index?snid=${this.attr.options.snid}`,
    28. title: res.longVideoInfo.name
    29. }
    30. });
    31. }
    32. })

    评论详情页

    展示评论详情。

    页面路径:pages/comment-detail

    • SWAN
    • JSON
    • JS
     
     
     
    1. <comment-detail
    2. comment-param="{{commentParam}}"
    3. srid="{{srid}}">
    4. </comment-detail>
     
     
     
    1. {
    2. "navigationBarTitleText": "评论详情",
    3. "usingSwanComponents": {
    4. "comment-detail": "dynamicLib://myDynamicLib/comment-detail"
    5. }
    6. }
     
     
     
    1. import {
    2. login
    3. } from '../../utils';
    4. Page({
    5. data: {
    6. srid: '',
    7. commentParam: {}
    8. },
    9. onLoad(options) {
    10. if (options.srid) {
    11. this.setData({
    12. srid: options.srid
    13. });
    14. }
    15. const param = getApp().globalData.commentParam;
    16. if (param && Object.keys(param).length) {
    17. this.setData({
    18. 'commentParam': param
    19. });
    20. } else {
    21. this.setData({
    22. commentParam: {
    23. snid: '10070000311753961',
    24. path: '/pages/comment/index?snid=10070000311753961',
    25. title: '测试文章标题'
    26. }
    27. });
    28. }
    29. },
    30. });

    字段说明

    对模板使用到的字段进行说明,此部分的数据在使用模板时需从 server 获取。模板作为示例进行了 mock ,开发者可参考数据格式进行开发。

    返回示例说明

    字段名类型说明
    codeNumber接口信息。code 0:正常获取数据;99999:无网络;其他:服务异常
    longVideoInfoObject长视频信息,对应模板长视频信息区部分
    playVideoListArray连播列表,对应视频播放区、短视频标题及辅助信息区和短视频列表区部分
    operateInfoObject运营位信息,对应模板运营位部分
    • JSON
     
     
     
    1. {
    2. // 接口信息
    3. code: 0,
    4. // 长视频信息
    5. longVideoInfo: {
    6. // 长视频封面图
    7. poster: '../../common/images/poster1.png',
    8. // 长视频名称
    9. name: '延禧攻略',
    10. // 长视频详情页路径,已完结、更新中的资源必须填写
    11. path: '/longVideo',
    12. // 资源类型,如:电视剧、电影、综艺、动漫等
    13. type: '电视剧',
    14. // 发行时间
    15. year: '2018年',
    16. // 发行地区
    17. area: '内地',
    18. // 资源标签,建议1-3个
    19. tags: '剧情爱情古装',
    20. // 更新状态,如共X集、更新⾄X集、即将上映、已上映、更新至X期
    21. update: '共52集',
    22. // 单集片长,电视剧/综艺等可直接填写单集⽚⻓X分钟,电影可填写⽚⻓X分钟
    23. time: '单集片长45分钟'
    24. },
    25. playVideoList: [
    26. {
    27. // 连播列表
    28. // 视频 id
    29. id: 1,
    30. // 视频地址
    31. src: 'https://b.bdstatic.com/miniapp/development_tool/Smartprogram.mp4',
    32. // 视频封面
    33. poster: '../../common/images/poster2.png',
    34. // 视频标题
    35. title: '聂远年轻照片跟现在几乎是判若两人终于明白为什么现在才火了聂远年轻照片跟现在几乎是判若两人终于明白为什么现在才火了聂远年轻照片跟现在几乎是判若两人终于明白为什么现在才火了',
    36. // 视频播放次数
    37. playNum: 6334000,
    38. // 视频作者
    39. authorName: '我是作者1',
    40. // 视频作者头像
    41. authorImage: '../../common/images/author.png',
    42. // 视频时长
    43. duration: '03:20',
    44. // 视频上传时间
    45. time: '2020年3月10日',
    46. // 视频简介
    47. introduction: '这是简介内容这是简介内容这是简介内容这是简介内容这是简介内容这这是简介内容这',
    48. // 视频类型,短视频为 1、长视频为2
    49. type: 1,
    50. path: '/dasda'
    51. },
    52. {
    53. id: 2,
    54. src: 'https://b.bdstatic.com/miniapp/development_tool/2020-6/1591258607615/a332aa39e1ff.mp4',
    55. poster: '../../common/images/poster3.png',
    56. title: '贺涵强势向子君表白,子君无所君无所适从',
    57. playNum: 110011000001,
    58. authorName: '2我是作者as大大说大厦的撒旦的撒',
    59. authorImage: '../../common/images/author2.png',
    60. duration: '103:20',
    61. time: '2020年3月10日',
    62. introduction: '这是简介内容这是简介内容这是简介内容这是简介内容这是简介内容这这是简介内容这',
    63. type: 1,
    64. path: '/dasda'
    65. },
    66. {
    67. id: 3,
    68. src: 'https://b.bdstatic.com/swan-temp/940fe716b0eaad38f47b209d61657490.mp4',
    69. poster: '../../common/images/poster2.png',
    70. title: '《前半生》大结局,贺涵离职和子君远走,唐晶不原谅',
    71. playNum: 1000000,
    72. authorName: '我是作者',
    73. authorImage: '../../common/images/author3.png',
    74. duration: '03:20',
    75. time: '2020年3月10日',
    76. introduction: '这是简介内容这是简介内容这是简介内容这是简介内容这是简介内容这这是简介内容这',
    77. type: 1,
    78. path: '/dasda'
    79. },
    80. {
    81. id: 4,
    82. src: 'https://b.bdstatic.com/miniapp/development_tool/Smartprogram.mp4',
    83. poster: '../../common/images/poster3.png',
    84. title: '4聂远年轻照片跟现在',
    85. playNum: 6334000,
    86. authorName: '我是作者',
    87. authorImage: 'https://b.bdstatic.com/miniapp/images/demo-dog.png',
    88. duration: '03:20',
    89. time: '2020年3月10日',
    90. introduction: '这是简介内容这是简介内容这是简介内容这是简介内容这是简介内容这这是简介内容这',
    91. type: 2,
    92. path: '/dasda'
    93. },
    94. {
    95. id: 5,
    96. src: 'https://b.bdstatic.com/miniapp/development_tool/2020-6/1591258607615/a332aa39e1ff.mp4',
    97. poster: '../../common/images/poster2.png',
    98. title: '5聂远年轻照片跟现在几乎是判若两人终于明白为什么现在才火了',
    99. playNum: 1010000,
    100. authorName: '我是作者',
    101. authorImage: '../../common/images/author3.png',
    102. duration: '03:20',
    103. time: '2020年3月10日',
    104. introduction: '这是简介内容这是简介内容这是简介内容这是简介内容这是简介内容这这是简介内容这',
    105. type: 1,
    106. path: '/dasda'
    107. }
    108. ],
    109. // 运营位信息
    110. operateInfo: {
    111. // 运营位封面
    112. img: '../../common/images/operational.png',
    113. // 运营位落地页地址
    114. path: '/dsadassdsa'
    115. }
    116. }

    longVideoInfo 长视频信息说明

    字段名类型说明
    posterString长视频封面图
    nameString长视频名称
    pathString长视频详情页路径,已完结、更新中的资源必须填写
    typeString资源类型,如:电视剧、电影、综艺、动漫等
    yearString发行时间
    areaString发行地区
    tagsString资源标签,建议1-3个
    updateString更新状态,如共X集、更新⾄X集、即将上映、已上映、更新至X期
    timeString单集片长,电视剧/综艺等可直接填写单集⽚⻓X分钟,电影可填写⽚⻓X分钟

    playVideoList 连播列表说明

    字段名类型说明
    idNumber视频 id
    srcString视频地址
    posterString视频封面
    titleString视频标题
    playNumNumber视频播放次数
    authorNameString视频作者
    authorImageString视频作者头像
    durationString视频时长
    timeString视频上传时间
    introductionString单视频简介
    typeNumber视频类型,短视频为 1、长视频为2
    pathString视频落地页地址

    operateInfo 运营位信息说明

    字段名类型说明
    imgString运营位封面地址
    pathString运营位落地页地址

    npm 依赖

    名称版本号
    @smt-ui/component^1.1.41
    @smt-ui/content-component^0.3.3

    Bug & Tip

    • Tip:该模板使用了 ES6 语法,需要开启开发者工具的增强编译,操作步骤参看开启说明;同时也需开启上传代码时样式自动补全。
    • Tip:以上代码示例为纯客户端代码,可直接在模拟器和真机预览。
    • Tip:模板中使用的是测试数据,你需要从接口中获取真实的数据。
    • Tip:预览时,控制台报错[Dynamic(swan-interaction)][Request failed] get comment list fail with data:,是由于一站式互动组件需要填写正确的appidsnid,请开发者自行补充修改,修改方式参考一站式互动组件的使用方法。
    THE END