bayi 1 年之前
父節點
當前提交
f33e9b7142
共有 8 個文件被更改,包括 178 次插入158 次删除
  1. 6 1
      README.md
  2. 6 6
      app.json
  3. 156 148
      pages/childClassify/index.js
  4. 2 0
      pages/editUser/index.js
  5. 2 1
      pages/otherWork/index.js
  6. 2 1
      pages/pkPage/index.js
  7. 2 0
      pages/reading/index.js
  8. 2 1
      pages/works/index.js

+ 6 - 1
README.md

@@ -12,10 +12,15 @@
 - pages/message/index 消息页面
 - pages/resource/index 资源页面
 - pages/my/index 我的页面
+- pages/works/index 作品页面
 - pages/like/index 点赞记录页面
 - pages/chat/index 聊天页面
 - pages/comment/index 评论记录页面
 - pages/notice/index 通知页面
 - pages/searchFriend/index 搜索好友页面
-- pages/searchFriend/index 搜索好友页面
+- pages/editUser/index 修改资料
+- pages/childClassify/index 一级分类
+- pages/reading/index 朗读页面
+- pages/otherWork/index 全部配音作品
+- pages/pkPage/index 挑战pk页面
 

+ 6 - 6
app.json

@@ -4,25 +4,25 @@
         "pages/message/index",
         "pages/resource/index",
         "pages/my/index",
+        "pages/works/index",
         "pages/like/index",
         "pages/chat/index",
         "pages/comment/index",
         "pages/notice/index",
         "pages/searchFriend/index",
+        "pages/editUser/index",
+        "pages/childClassify/index",
+        "pages/reading/index",
+        "pages/otherWork/index",
+        "pages/pkPage/index",
         "pages/match/index",
         "pages/pkResult/index",
         "pages/medalStore/index",
         "pages/score/index",
-        "pages/pkPage/index",
         "pages/rankIntro/index",
         "pages/ranking/index",
         "pages/userWorks/index",
-        "pages/works/index",
         "pages/personal/index",
-        "pages/childClassify/index",
-        "pages/reading/index",
-        "pages/otherWork/index",
-        "pages/editUser/index",
         "pages/friend/index",
         "pages/invite/index",
         "pages/inviteRanking/index",

+ 156 - 148
pages/childClassify/index.js

@@ -1,153 +1,161 @@
-import { getCategoryWorks, searchWorks } from '~/api/works';
+import {
+    getCategoryWorks,
+    searchWorks
+} from '~/api/works';
 import reachBottom from '~/mixins/reachBottom';
-import { createStoreBindings } from 'mobx-miniprogram-bindings';
-import { store } from '~/store/index';
+import {
+    createStoreBindings
+} from 'mobx-miniprogram-bindings';
+import event from '~/mixins/event'
+import {
+    store
+} from '~/store/index';
 let storeBindings;
 Page({
-  behaviors: [reachBottom],
-  data: {
-    // class为二级,search为搜索
-    type: 'class',
-    categoryList: [],
-    childType: '',
-    currentIndex: 0,
-    scrollTop: 0,
-    text: '',
-    currentId: '',
-    navBarTitle: '',
-    historySearch: []
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad(options) {
-    // 没有二级分类
-    if (options.id) {
-      this.setData({
-        childType: options.id
-      });
-      this.resetData();
-    } else if (options.list) {
-      let categoryList = JSON.parse(decodeURIComponent(options.list));
-      this.setData({
-        categoryList
-      });
-      this.resetData();
-    }
-    wx.setNavigationBarTitle({
-      title: options.title || '搜索'
-    });
-    this.setData({
-      type: options.type,
-      historySearch: wx.getStorageSync('search'),
-      navBarTitle: options.title
-    });
-    this.storeBindings = createStoreBindings(this, {
-      store,
-      fields: {
-        userInfo: 'userInfo'
-      }
-    });
-    // 立刻更新
-    this.storeBindings.updateStoreBindings();
-  },
-  // 获取分类的内容
-  loadMore() {
-    if (this.data.type == 'search') {
-      return;
-    }
-    let columnId = this.data.childType ? this.data.childType : this.data.categoryList[this.data.currentIndex].id;
-    this.getData(getCategoryWorks, {
-      columnId
-    });
-  },
-  setClass({
-    currentTarget
-  }) {
-    this.setData({
-      scrollTop: 0,
-      navBarTitle: currentTarget.dataset.title,
-      currentIndex: currentTarget.dataset.index,
-      currentId: `class${currentTarget.dataset.index}`
-    });
-    this.resetData();
-  },
-  setSearch({
-    detail
-  }) {
-    if (!detail.value) {
-      this.setData({
-        nullList: false,
-        list: []
-      });
-    }
-    this.setData({
-      text: detail.value
-    });
-  },
-  async search() {
-    if (!this.data.text) {
-      this.setData({
-        list: []
-      });
-      return;
-    }
-    let list = await searchWorks({
-      title: this.data.text,
-      grade: this.data.userInfo.grade
-    });
-    if (!this.data.historySearch.includes(this.data.text)) {
-      this.setData({
-        historySearch: [this.data.text, ...this.data.historySearch].slice(0, 20)
-      });
-      wx.setStorageSync('search', this.data.historySearch);
-    }
-    this.setData({
-      list,
-      nullList: list.length == 0
-    });
-  },
-  historySearch({
-    currentTarget
-  }) {
-    this.setData({
-      text: currentTarget.dataset.text
-    });
-    this.search();
-  },
-  deleteHistory({
-    currentTarget
-  }) {
-    let newList = this.data.historySearch.filter(item => {
-      return item != currentTarget.dataset.text;
-    });
-    this.setData({
-      historySearch: newList.slice(0, 20)
-    });
-    wx.setStorageSync('search', this.data.historySearch);
-  },
-  clearHistory() {
-    wx.showModal({
-      title: '温馨提示',
-      content: '历史记录清除后无法恢复,是否清除全部记录',
-      success: res => {
-        if (res.confirm) {
-          this.setData({
-            historySearch: []
-          });
-          wx.setStorageSync('search', this.data.historySearch);
+    behaviors: [reachBottom, event],
+    data: {
+        // class为二级,search为搜索
+        type: 'class',
+        categoryList: [],
+        childType: '',
+        currentIndex: 0,
+        scrollTop: 0,
+        text: '',
+        currentId: '',
+        navBarTitle: '',
+        historySearch: []
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad(options) {
+        // 没有二级分类
+        if (options.id) {
+            this.setData({
+                childType: options.id
+            });
+            this.resetData();
+        } else if (options.list) {
+            let categoryList = JSON.parse(decodeURIComponent(options.list));
+            this.setData({
+                categoryList
+            });
+            this.resetData();
         }
-      }
-    });
-  },
-  goRead({
-    currentTarget
-  }) {
-    wx.navigateTo({
-      url: `/pages/reading/index?videoId=${currentTarget.dataset.id}&navBarTitle=${this.data.navBarTitle || ''}`
-    });
-  },
-  onUnload() {
-    this.storeBindings.destroyStoreBindings();
-  }
+        wx.setNavigationBarTitle({
+            title: options.title || '搜索'
+        });
+        this.setData({
+            type: options.type,
+            historySearch: wx.getStorageSync('search'),
+            navBarTitle: options.title
+        });
+        this.storeBindings = createStoreBindings(this, {
+            store,
+            fields: {
+                userInfo: 'userInfo'
+            }
+        });
+        // 立刻更新
+        this.storeBindings.updateStoreBindings();
+    },
+    // 获取分类的内容
+    loadMore() {
+        if (this.data.type == 'search') {
+            return;
+        }
+        let columnId = this.data.childType ? this.data.childType : this.data.categoryList[this.data.currentIndex].id;
+        this.getData(getCategoryWorks, {
+            columnId
+        });
+    },
+    setClass({
+        currentTarget
+    }) {
+        this.setData({
+            scrollTop: 0,
+            navBarTitle: currentTarget.dataset.title,
+            currentIndex: currentTarget.dataset.index,
+            currentId: `class${currentTarget.dataset.index}`
+        });
+        this.resetData();
+    },
+    setSearch({
+        detail
+    }) {
+        if (!detail.value) {
+            this.setData({
+                nullList: false,
+                list: []
+            });
+        }
+        this.setData({
+            text: detail.value
+        });
+    },
+    async search() {
+        if (!this.data.text) {
+            this.setData({
+                list: []
+            });
+            return;
+        }
+        let list = await searchWorks({
+            title: this.data.text,
+            grade: this.data.userInfo.grade
+        });
+        if (!this.data.historySearch.includes(this.data.text)) {
+            this.setData({
+                historySearch: [this.data.text, ...this.data.historySearch].slice(0, 20)
+            });
+            wx.setStorageSync('search', this.data.historySearch);
+        }
+        this.setData({
+            list,
+            nullList: list.length == 0
+        });
+    },
+    historySearch({
+        currentTarget
+    }) {
+        this.setData({
+            text: currentTarget.dataset.text
+        });
+        this.search();
+    },
+    deleteHistory({
+        currentTarget
+    }) {
+        let newList = this.data.historySearch.filter(item => {
+            return item != currentTarget.dataset.text;
+        });
+        this.setData({
+            historySearch: newList.slice(0, 20)
+        });
+        wx.setStorageSync('search', this.data.historySearch);
+    },
+    clearHistory() {
+        wx.showModal({
+            title: '温馨提示',
+            content: '历史记录清除后无法恢复,是否清除全部记录',
+            success: res => {
+                if (res.confirm) {
+                    this.setData({
+                        historySearch: []
+                    });
+                    wx.setStorageSync('search', this.data.historySearch);
+                }
+            }
+        });
+    },
+    goRead({
+        currentTarget
+    }) {
+        wx.navigateTo({
+            url: `/pages/reading/index?videoId=${currentTarget.dataset.id}&navBarTitle=${this.data.navBarTitle || ''}`
+        });
+    },
+    onUnload() {
+        this.storeBindings.destroyStoreBindings();
+    }
 });

+ 2 - 0
pages/editUser/index.js

@@ -10,8 +10,10 @@ import {
     getMyInfo,
     bindPhone
 } from '~/api/user'
+import event from '~/mixins/event'
 let storeBindings
 Page({
+    behaviors: [event],
     data: {
         gradeIndex: 0,
         gradeArray: [{

+ 2 - 1
pages/otherWork/index.js

@@ -3,8 +3,9 @@ import {
   getUserReadByExampleId
 } from '~/api/works'
 import reachBottom from '~/mixins/reachBottom'
+import event from '~/mixins/event'
 Page({
-  behaviors: [reachBottom,share],
+  behaviors: [reachBottom,share,event],
   data: {
     exampleId: ''
   },

+ 2 - 1
pages/pkPage/index.js

@@ -1,4 +1,5 @@
 import behavior from '~/mixins/video'
+import event from '~/mixins/event'
 import share from '~/mixins/share'
 import {
     getreadInfo
@@ -7,7 +8,7 @@ import {
     getPkRecord
 } from '~/api/works'
 Page({
-    behaviors: [behavior, share],
+    behaviors: [behavior, share,event],
     data: {
         videoInfo: '',
         videoId: '',

+ 2 - 0
pages/reading/index.js

@@ -25,6 +25,7 @@ import {
 import {
     setDuration
 } from '~/utils/util'
+import event from '~/mixins/event'
 let aiengine = require('~/utils/ChivoxAiEngine')
 let sha1 = require('~/utils/sha1');
 // 文章行高
@@ -43,6 +44,7 @@ let wsEngine = aiengine.createWsEngine({});
 /*微信录音*/
 let recorderManager = wx.getRecorderManager();
 Page({
+    behaviors: [event],
     data: {
         videoInfo: {},
         videoPath: '',

+ 2 - 1
pages/works/index.js

@@ -7,6 +7,7 @@ import {
 import {
   getFollowWorks
 } from '~/api/works'
+import event from '~/mixins/event'
 import reachBottom from '~/mixins/reachBottom'
 import {
   createStoreBindings
@@ -15,7 +16,7 @@ import {
   store
 } from '~/store/index'
 Page({
-  behaviors: [reachBottom, share],
+  behaviors: [reachBottom, share,event],
   data: {
     navBarHeight: app.globalData.navBarHeight,
     // 4关注作品,5我的作品,6收藏作品