日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)新互聯(lián)百度小程序教程:page-video短視頻詳情頁(yè)模板
  • page-video 短視頻詳情頁(yè)模板
    • 示例
    • 頁(yè)面內(nèi)容
      • 短視頻詳情頁(yè)
      • 評(píng)論詳情頁(yè)
    • 字段說(shuō)明
      • 返回示例說(shuō)明
      • longVideoInfo 長(zhǎng)視頻信息說(shuō)明
      • playVideoList 連播列表說(shuō)明
      • operateInfo 運(yùn)營(yíng)位信息說(shuō)明
    • npm 依賴
    • Bug & Tip

    page-video 短視頻詳情頁(yè)模板

    從開(kāi)發(fā)者工具 v2.25.1-rc 版本、基礎(chǔ)庫(kù)版本 3.190.1 版本開(kāi)始支持。

    納雍網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián),納雍網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為納雍近千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的納雍做網(wǎng)站的公司定做!

    解釋:本模版適用于快速搭建視頻片花、預(yù)告、短視頻等視頻類詳情頁(yè)。模版在保證用戶交互體驗(yàn)的基礎(chǔ)上,提供了不同模塊,配合使用加入書架、預(yù)約和引導(dǎo)關(guān)注組件,實(shí)現(xiàn)興趣激發(fā),充分發(fā)揮短視頻帶長(zhǎng)視頻消費(fèi)的種草價(jià)值,拉動(dòng)二次重訪。

    示例

    掃碼體驗(yàn)

    代碼示例

    請(qǐng)使用百度APP掃碼

    頁(yè)面內(nèi)容

    模板包含兩個(gè)頁(yè)面:短視頻詳情頁(yè)、評(píng)論詳情頁(yè)。

    短視頻詳情頁(yè)

    默認(rèn)配置為導(dǎo)航欄、視頻播放器、短視頻標(biāo)題及輔助信息區(qū)、長(zhǎng)視頻信息區(qū)一站式互動(dòng)區(qū)等模塊。

    包含導(dǎo)航欄、引導(dǎo)關(guān)注組件、視頻播放器(含自動(dòng)連播邏輯)、短視頻標(biāo)題及輔助信息區(qū)、長(zhǎng)視頻信息區(qū)、活動(dòng)運(yùn)營(yíng)位、百青藤?gòu)V告區(qū)、推薦短視頻區(qū)和一站式互動(dòng)區(qū)等模塊,分為默認(rèn)配置模塊和可選配置模塊。開(kāi)發(fā)者可根據(jù)自身業(yè)務(wù)形態(tài)選擇合適的模塊進(jìn)行自定義配置。

    頁(yè)面路徑:pages/index

    代碼示例

    • 獲取頁(yè)面數(shù)據(jù)??蓪?getIndexData 替換以發(fā)送網(wǎng)絡(luò)請(qǐng)求獲取真實(shí)數(shù)據(jù)。

    • JS

     
     
     
    1. Page({
    2. ...
    3. attr: {
    4. // 請(qǐng)求的 url,請(qǐng)?zhí)鎿Q為真實(shí)的請(qǐng)求地址,該值僅做為示例,值為 defaultData 為默認(rèn)配置示例,其他值為全配置示例
    5. url: '/index',
    6. // onLoad參數(shù)
    7. options: {}
    8. },
    9. onLoad(options) {
    10. this.getPageData();
    11. ...
    12. },
    13. getPageData() {
    14. const url = this.attr.url;
    15. // 模擬請(qǐng)求,請(qǐng)進(jìn)行替換
    16. getIndexData({
    17. url
    18. }).then(
    19. res => {
    20. res.playVideoList.forEach(item => {
    21. // 格式化播放數(shù)量
    22. item.playNum = this.formatPlayNum(item.playNum);
    23. item.nextInfo = false;
    24. // 過(guò)濾出長(zhǎng)視頻
    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條時(shí),先展示前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. // 文章的唯一標(biāo)識(shí)
    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: 正常獲取數(shù)據(jù) 99999: 無(wú)網(wǎng)絡(luò) 其他: 服務(wù)異常
    65. statusType: res.code === 99999 ? 'noNetwork' : res.code !== 0 ? 'warning' : ''
    66. });
    67. }
    68. );
    69. }
    70. })
    • 引導(dǎo)關(guān)注組件。進(jìn)入頁(yè)面時(shí),可選擇是否展示引導(dǎo)關(guān)注組件。

    • JS

     
     
     
    1. Page({
    2. ...
    3. attr: {
    4. // 頁(yè)面展示時(shí)是否顯示關(guān)注引導(dǎo)tip
    5. showFavorite: true
    6. },
    7. onShow() {
    8. if (this.attr.showFavorite) {
    9. // 頁(yè)面展示時(shí)顯示關(guān)注引導(dǎo)
    10. this.showFavoriteGuide();
    11. }
    12. }
    13. })
    • 視頻播放器,支持自動(dòng)連播。
      自動(dòng)連播邏輯
      • 觸發(fā)時(shí)機(jī):視頻即將播放完畢,進(jìn)入 5s 倒計(jì)時(shí)并展示提示氣泡, 若頁(yè)面處于最上方倒計(jì)時(shí)結(jié)束后自動(dòng)連播下一條短視頻。否則阻斷連播,展示蒙層。
      • 自動(dòng)連播順序:根據(jù) playVideoList 進(jìn)行去重后的順序進(jìn)行播放,推薦開(kāi)發(fā)者將長(zhǎng)視頻放在 playVideoList 的最后。
    1. 當(dāng)前用戶退出小程序后,即刪除已觀看記錄,下次進(jìn)入小程序短視頻落地頁(yè),重新執(zhí)行去重邏輯。
    2. 蒙層展示下一條播放的視頻信息并提供重播、觀看正片、立即播放等功能。
    • SWAN
    • JS
     
     
     
    1. id="myVideo"
    2. class="video-header-player"
    3. src="{{playVideoList[playIndex] && playVideoList[playIndex].src}}"
    4. title="{{playVideoList[playIndex].title}}"
    5. autoplay="true"
    6. objectFit="?ll"
    7. direction="true"
    8. muted="true"
    9. show-mute-btn="true"
    10. show-center-play-btn="false"
    11. bindtimeupdate="videoTimeUpdateHandler"
    12. bindplay="videoPlayHandler"
    13. bindended="videoEndedHandler"
    14. >
    15. 接下來(lái)播放
    16. {{remainingTime}}s后播放
    17. {{playVideoList[nextIndex].title}}
    18. {{playVideoList[nextIndex].playNum}}次播放
    19. 立即播放
    20. 重播
    21. 觀看正片
    22. 重播
    23. <
    24. 即將播放:{{playVideoList[nextIndex].title}}
     
     
     
    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. * 監(jiān)聽(tīng)播放開(kāi)始事件
    25. */
    26. videoPlayHandler() {
    27. const {
    28. timer,
    29. playVideoList,
    30. playIndex
    31. } = this.data;
    32. // 開(kāi)始播放清除倒計(jì)時(shí)器
    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. // 根據(jù)已播列表獲取下一條視頻 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. * 監(jiān)聽(tīng)播放結(jié)束事件
    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. // 沒(méi)有可播放的視頻
    64. if (this.data.nextIndex === this.data.playIndex) {
    65. // 存在長(zhǎng)視頻落地頁(yè)時(shí)跳轉(zhuǎn)長(zhǎng)視頻落地頁(yè)
    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. // 播下一條視頻時(shí)頁(yè)面不在頂部
    81. if (this.attr.scrollTop !== 0) {
    82. // 取消自動(dòng)連播
    83. this.attr.videoContext.stop();
    84. this.setData({
    85. isPlaying: false
    86. });
    87. // 開(kāi)啟計(jì)時(shí)器
    88. this.onTimer();
    89. } else {
    90. // 不被打斷則直接播放下一條視頻
    91. this.setData({
    92. playIndex: this.data.nextIndex
    93. });
    94. }
    95. },
    96. /**
    97. * 監(jiān)聽(tīng)播放進(jìn)度變化
    98. * @param {*} e 事件對(duì)象
    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 時(shí)進(jìn)行自動(dòng)播放提示
    109. if (duration !== 0 && currentTime !== 0 && duration - currentTime <= 5) {
    110. this.setData({
    111. isMonitoring: true
    112. });
    113. }
    114. }
    115. })
    • 短視頻標(biāo)題及輔助信息區(qū)。展示用戶頭像、昵稱、播放次數(shù)、簡(jiǎn)介??烧归_(kāi)收起,默認(rèn)為收起態(tài)。

    • SWAN

    • JS
     
     
     
    1. {{playVideoList[playIndex].title}}
    2. s-if="{{playVideoList[playIndex].time || playVideoList[playIndex].introduction}}"
    3. class="video-content-introduction-title-switch {{introSwitch ? 'off': '' }}"
    4. mode="scaleToFill"
    5. src="../../common/images/arrow.png" bindtap="introductionSwitch">
    6. {{playVideoList[playIndex].playNum}}次播放
    7. s-if="{{playVideoList[playIndex].authorImage}}" src="{{playVideoList[nextIndex].autorImage}}">
    8. {{playVideoList[playIndex].authorName}}
    9. s-if="{{introSwitch && (playVideoList[playIndex].time || playVideoList[playIndex].introduction)}}">
    10. 發(fā)布時(shí)間:{{playVideoList[playIndex].time}}
    11. s-if="{{playVideoList[playIndex].introduction}}">{{playVideoList[playIndex].introduction}}
     
     
     
    1. Page({
    2. ...
    3. /**
    4. * 展開(kāi)、收起簡(jiǎn)介信息
    5. */
    6. introductionSwitch() {
    7. this.setData({
    8. introSwitch: !this.data.introSwitch
    9. });
    10. }
    11. })
    • 長(zhǎng)視頻信息區(qū)。當(dāng)資源配置了落地頁(yè)時(shí),展示加入書架按鈕和觀看正片按鈕,點(diǎn)擊長(zhǎng)視頻封面和觀看正片按鈕可跳轉(zhuǎn)至長(zhǎng)視頻落地頁(yè)。當(dāng)資源未配置落地頁(yè)時(shí)(資源未上映),默認(rèn)僅展示預(yù)約觀看按鈕。加入書架功能具體接入流程參考書架同步功能介紹,支持將資源同步至百度 App -書架;預(yù)約功能具體接入流程參考預(yù)約訂閱組件(平臺(tái)配置版)和預(yù)約訂閱組件(API版)。

    • SWAN

     
     
     
    1. {{longVideoInfo.name}}
    2. {{longVideoInfo.info}}
    3. data-path="{{longVideoInfo.path}}">觀看正片
    4. s-if="{{longVideoInfo.path || longVideoInfo.bookInfo}}">加入書架
    5. report-type="subscribe" template-id="BD2305" subscribe-id="1235" bindsubmit="formSubmit">
    • 活動(dòng)運(yùn)營(yíng)位。開(kāi)發(fā)者提供活動(dòng)運(yùn)營(yíng)圖片和跳轉(zhuǎn)地址,支持跳轉(zhuǎn)到當(dāng)前小程序內(nèi)的其他頁(yè)面。例如:可配置新用戶購(gòu)買會(huì)員優(yōu)惠活動(dòng)。

    • SWAN

     
     
     
    • 百青藤?gòu)V告區(qū)。具體接入流程參考 ad 廣告組件。獲取 ad 組件代碼后可替換模板中的 ad 組件。

    • SWAN

     
     
     
    • 推薦短視頻區(qū)。展示播放列表的短視頻。默認(rèn)最多展示 5 條短視頻,超過(guò)數(shù)量的短視頻將被折疊,點(diǎn)擊查看更多每次可再展開(kāi) 10 條短視頻,包含視頻的標(biāo)題、播放次數(shù)、封面、時(shí)長(zhǎng)等,點(diǎn)擊后跳轉(zhuǎn)到短視頻落地頁(yè)。

    • SWAN

    • JS
     
     
     
    1. {{item.title}}
    2. {{item.playNum}}次播放
    3. {{item.duration}}
    4. {{feedMore ? '查看更多': '沒(méi)有更多了'}}
     
     
     
    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. // 結(jié)束位超出,展示剩余的視頻
    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. })
    • 互動(dòng)區(qū)。使用一站式互動(dòng)組件。
    1. 使用點(diǎn)贊、評(píng)論功能時(shí)需要進(jìn)行登入。
    2. 從其他頁(yè)面跳轉(zhuǎn)到本模板時(shí),snid 文章 id 需要在加在跳轉(zhuǎn)到本頁(yè)面的路徑上,跳轉(zhuǎn)本頁(yè)面的路徑如:@smt-ui-template-page-video/pages/index/index?snid=10070000311753961
    • SWAN
    • JS
     
     
     
    1. class="video-comment"
    2. is-page-scroll="false"
    3. comment-param="{{commentParam}}"
    4. detail-path="{{detailPath}}"
    5. toolbar-config="{{toolbarConfig}}">
     
     
     
    1. Page({
    2. data: {
    3. ...
    4. // 評(píng)論參數(shù)
    5. commentParam: {},
    6. // 評(píng)論詳情頁(yè)面路徑
    7. detailPath: '/@smt-ui-template-page-video/pages/comment-detail/index',
    8. },
    9. onLoad(options) {
    10. this.getPageData();
    11. // 獲取文章 id,示例中 mock 數(shù)據(jù),使用時(shí)請(qǐng)使用真實(shí)數(shù)據(jù)
    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. // 文章的唯一標(biāo)識(shí)
    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. })

    評(píng)論詳情頁(yè)

    展示評(píng)論詳情。

    頁(yè)面路徑:pages/comment-detail

    • SWAN
    • JSON
    • JS
     
     
     
    1. comment-param="{{commentParam}}"
    2. srid="{{srid}}">
     
     
     
    1. {
    2. "navigationBarTitleText": "評(píng)論詳情",
    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: '測(cè)試文章標(biāo)題'
    26. }
    27. });
    28. }
    29. },
    30. });

    字段說(shuō)明

    對(duì)模板使用到的字段進(jìn)行說(shuō)明,此部分的數(shù)據(jù)在使用模板時(shí)需從 server 獲取。模板作為示例進(jìn)行了 mock ,開(kāi)發(fā)者可參考數(shù)據(jù)格式進(jìn)行開(kāi)發(fā)。

    返回示例說(shuō)明

    字段名 類型 說(shuō)明
    code Number 接口信息。code 0:正常獲取數(shù)據(jù);99999:無(wú)網(wǎng)絡(luò);其他:服務(wù)異常
    longVideoInfo Object 長(zhǎng)視頻信息,對(duì)應(yīng)模板長(zhǎng)視頻信息區(qū)部分
    playVideoList Array 連播列表,對(duì)應(yīng)視頻播放區(qū)、短視頻標(biāo)題及輔助信息區(qū)和短視頻列表區(qū)部分
    operateInfo Object 運(yùn)營(yíng)位信息,對(duì)應(yīng)模板運(yùn)營(yíng)位部分
    • JSON
     
     
     
    1. {
    2. // 接口信息
    3. code: 0,
    4. // 長(zhǎng)視頻信息
    5. longVideoInfo: {
    6. // 長(zhǎng)視頻封面圖
    7. poster: '../../common/images/poster1.png',
    8. // 長(zhǎng)視頻名稱
    9. name: '延禧攻略',
    10. // 長(zhǎng)視頻詳情頁(yè)路徑,已完結(jié)、更新中的資源必須填寫
    11. path: '/longVideo',
    12. // 資源類型,如:電視劇
      文章名稱:創(chuàng)新互聯(lián)百度小程序教程:page-video短視頻詳情頁(yè)模板
      當(dāng)前URL:http://www.5511xx.com/article/dhphepd.html