Prechádzať zdrojové kódy

资源类返回显示上一级名字。作品展播/官方推荐/官方活动点击只显示返回

bayi 2 rokov pred
rodič
commit
288b809eba

+ 6 - 2
pages/childClassify/index.js

@@ -20,7 +20,8 @@ Page({
     currentIndex: 0,
     scrollTop: 0,
     text: '',
-    currentId: ''
+    currentId: '',
+    navBarTitle: ''
   },
   /**
    * 生命周期函数--监听页面加载
@@ -44,6 +45,7 @@ Page({
     })
     this.setData({
       type: options.type,
+      navBarTitle: options.title
     })
     this.storeBindings = createStoreBindings(this, {
       store,
@@ -67,8 +69,10 @@ Page({
   setClass({
     currentTarget
   }) {
+    console.log(currentTarget);
     this.setData({
       scrollTop: 0,
+      navBarTitle: currentTarget.dataset.title,
       currentIndex: currentTarget.dataset.index,
       currentId: `class${currentTarget.dataset.index}`
     })
@@ -97,7 +101,7 @@ Page({
     currentTarget
   }) {
     wx.navigateTo({
-      url: `/pages/reading/index?videoId=${currentTarget.dataset.id}`
+      url: `/pages/reading/index?videoId=${currentTarget.dataset.id}&navBarTitle=${this.data.navBarTitle||''}`
     })
   },
   onUnload() {

+ 1 - 1
pages/childClassify/index.wxml

@@ -3,7 +3,7 @@
   <scroll-view class="classify" scroll-x="true" scroll-into-view="{{currentId}}" enhanced show-scrollbar="{{false}}"
     wx:if="{{type=='class'&&!childType}}">
     <view id="{{'class'+index}}" class="name {{currentIndex==index?'currentClass':''}}" wx:for="{{categoryList}}"
-      wx:key="id" data-index="{{index}}" bindtap="setClass">
+      wx:key="id" data-index="{{index}}" data-title='{{item.title}}' bindtap="setClass">
       {{item.title}}
     </view>
   </scroll-view>

+ 4 - 3
pages/reading/index.js

@@ -68,6 +68,9 @@ Page({
   onLoad(options) {
     console.log(options);
     let videoId = options.videoId
+    wx.setNavigationBarTitle({
+      title: options.navBarTitle
+    })
     this.getreadInfo(videoId, options.reset).then(res => {
       if (options.voluntarily) {
         this.setCountDown()
@@ -164,9 +167,7 @@ Page({
   getreadInfo(videoId, reset = false) {
     return new Promise(async (resolve, reject) => {
       let videoInfo = await getreadInfo(videoId)
-      /*  wx.setNavigationBarTitle({
-         title: videoInfo.userRead.title
-       }) */
+
       let data = JSON.parse(videoInfo.userReadExtend.lessonText)
       data = data.map((item, index) => {
         item.time = Number(item.time)