bayi 1 年之前
父節點
當前提交
6fea6e56e1
共有 11 個文件被更改,包括 171 次插入149 次删除
  1. 11 0
      README.md
  2. 4 4
      app.json
  3. 140 138
      pages/chat/index.js
  4. 2 1
      pages/comment/index.js
  5. 2 1
      pages/index/index.js
  6. 2 1
      pages/like/index.js
  7. 2 1
      pages/message/index.js
  8. 2 0
      pages/my/index.js
  9. 2 1
      pages/notice/index.js
  10. 2 1
      pages/resource/index.js
  11. 2 1
      pages/searchFriend/index.js

+ 11 - 0
README.md

@@ -8,3 +8,14 @@
 - pages/management/index 分销订单管理
 - pages/gzhShare/index 分销公众号邀请
 - pages/commission/index 佣金规则
+- pages/index/index 推荐页面
+- pages/message/index 消息页面
+- pages/resource/index 资源页面
+- pages/my/index 我的页面
+- pages/like/index 点赞记录页面
+- pages/chat/index 聊天页面
+- pages/comment/index 评论记录页面
+- pages/notice/index 通知页面
+- pages/searchFriend/index 搜索好友页面
+- pages/searchFriend/index 搜索好友页面
+

+ 4 - 4
app.json

@@ -1,15 +1,17 @@
 {
     "pages": [
         "pages/index/index",
-        "pages/resource/index",
         "pages/message/index",
+        "pages/resource/index",
+        "pages/my/index",
         "pages/like/index",
         "pages/chat/index",
         "pages/comment/index",
+        "pages/notice/index",
+        "pages/searchFriend/index",
         "pages/match/index",
         "pages/pkResult/index",
         "pages/medalStore/index",
-        "pages/my/index",
         "pages/score/index",
         "pages/pkPage/index",
         "pages/rankIntro/index",
@@ -21,12 +23,10 @@
         "pages/reading/index",
         "pages/otherWork/index",
         "pages/editUser/index",
-        "pages/notice/index",
         "pages/friend/index",
         "pages/invite/index",
         "pages/inviteRanking/index",
         "pages/aiAvatar/index",
-        "pages/searchFriend/index",
         "pages/orderRecord/index"
     ],
     "subpackages": [{

+ 140 - 138
pages/chat/index.js

@@ -1,154 +1,156 @@
 import {
-  getMsgDet,
-  sendMsg,
-  getNewMsgDet
+    getMsgDet,
+    sendMsg,
+    getNewMsgDet
 } from "~/api/message"
 import {
-  createStoreBindings
+    createStoreBindings
 } from 'mobx-miniprogram-bindings'
+import event from '~/mixins/event'
 import {
-  store
+    store
 } from '~/store/index'
 let interval = null
 const app = getApp()
 Page({
-  data: {
-    targetUid: '',
-    value: '',
-    list: [],
-    pageNo: 1,
-    totalNo: 1,
-    scrollTop: 0,
-    triggered: false,
-    isIos: app.globalData.isIOS,
-    navBarHeight: app.globalData.navBarHeight,
-    uid: ''
-  },
-  onLoad(options) {
-    console.log(options);
-    wx.setNavigationBarTitle({
-      title: options.title,
-    })
-    this.setData({
-      targetUid: options.uid,
-      uid: wx.getStorageSync('uid')
-    })
-    this.storeBindings = createStoreBindings(this, {
-      store,
-      fields: {
-        userInfo: 'userInfo'
-      },
-    })
-    this.storeBindings.updateStoreBindings()
-    this.getMsgDet().then(() => {
-      this.setData({
-        scrollTop: 10000
-      })
-    })
-    this.interval = setInterval(() => {
-      this.getNewMsgDet()
-    }, 5000)
-  },
-  getMsgDet() {
-    return new Promise(async (reslove) => {
-      let pageNo = this.data.pageNo
-      if (this.data.totalNo < pageNo) {
-        return this.setData({
-          triggered: false,
-        })
-      }
-      let data = await getMsgDet({
-        senderUid: this.data.targetUid,
-        pageNo,
-        pageSize: 10
-      })
-      let {
-        list,
-        totalNo
-      } = data
-      this.setData({
-        list: [...list, ...this.data.list],
-        totalNo,
-        pageNo: totalNo >= pageNo ? ++pageNo : pageNo,
+    behaviors: [event],
+    data: {
+        targetUid: '',
+        value: '',
+        list: [],
+        pageNo: 1,
+        totalNo: 1,
+        scrollTop: 0,
         triggered: false,
-      })
-      reslove()
-    })
-  },
-  async getNewMsgDet() {
-    let res = await getNewMsgDet({
-      senderUid: this.data.targetUid,
-    })
-    let newList = [...this.data.list, ...res]
-    this.setData({
-      list: newList,
-    })
-  },
-  async sendReply() {
-    if (!this.data.value) {
-      return
-    }
-    await sendMsg({
-      content: this.data.value,
-      type: '1',
-      receiverUid: this.data.targetUid
-    })
-    this.setData({
-      value: '',
-      scrollTop: this.data.list.length * 1000
-    })
-    this.getNewMsgDet()
-  },
-  previewImage(e) {
-    var imageUrl = e.currentTarget.dataset.src;
-    wx.previewImage({
-      urls: [imageUrl]
-    })
-  },
-  chooseImage() {
-    wx.chooseImage({
-      count: 1, // 可选择的图片数量
-      sizeType: ['compressed'], // 压缩图片
-      sourceType: ['album', 'camera'], // 来源:相册或相机
-      success: (res) => {
-        this.uploadImage(res.tempFilePaths[0]);
-      }
-    })
-  },
-  uploadImage(imagePath) {
-    wx.uploadFile({
-      url: 'https://reader-api.ai160.com/file/upload',
-      filePath: imagePath,
-      name: '朗读录音',
-      header: {
-        uid: wx.getStorageSync('uid')
-      },
-      success: async (res) => {
+        isIos: app.globalData.isIOS,
+        navBarHeight: app.globalData.navBarHeight,
+        uid: ''
+    },
+    onLoad(options) {
+        console.log(options);
+        wx.setNavigationBarTitle({
+            title: options.title,
+        })
+        this.setData({
+            targetUid: options.uid,
+            uid: wx.getStorageSync('uid')
+        })
+        this.storeBindings = createStoreBindings(this, {
+            store,
+            fields: {
+                userInfo: 'userInfo'
+            },
+        })
+        this.storeBindings.updateStoreBindings()
+        this.getMsgDet().then(() => {
+            this.setData({
+                scrollTop: 10000
+            })
+        })
+        this.interval = setInterval(() => {
+            this.getNewMsgDet()
+        }, 5000)
+    },
+    getMsgDet() {
+        return new Promise(async (reslove) => {
+            let pageNo = this.data.pageNo
+            if (this.data.totalNo < pageNo) {
+                return this.setData({
+                    triggered: false,
+                })
+            }
+            let data = await getMsgDet({
+                senderUid: this.data.targetUid,
+                pageNo,
+                pageSize: 10
+            })
+            let {
+                list,
+                totalNo
+            } = data
+            this.setData({
+                list: [...list, ...this.data.list],
+                totalNo,
+                pageNo: totalNo >= pageNo ? ++pageNo : pageNo,
+                triggered: false,
+            })
+            reslove()
+        })
+    },
+    async getNewMsgDet() {
+        let res = await getNewMsgDet({
+            senderUid: this.data.targetUid,
+        })
+        let newList = [...this.data.list, ...res]
+        this.setData({
+            list: newList,
+        })
+    },
+    async sendReply() {
+        if (!this.data.value) {
+            return
+        }
         await sendMsg({
-          content: JSON.parse(res.data).data,
-          type: '2',
-          receiverUid: this.data.targetUid
+            content: this.data.value,
+            type: '1',
+            receiverUid: this.data.targetUid
+        })
+        this.setData({
+            value: '',
+            scrollTop: this.data.list.length * 1000
         })
         this.getNewMsgDet()
+    },
+    previewImage(e) {
+        var imageUrl = e.currentTarget.dataset.src;
+        wx.previewImage({
+            urls: [imageUrl]
+        })
+    },
+    chooseImage() {
+        wx.chooseImage({
+            count: 1, // 可选择的图片数量
+            sizeType: ['compressed'], // 压缩图片
+            sourceType: ['album', 'camera'], // 来源:相册或相机
+            success: (res) => {
+                this.uploadImage(res.tempFilePaths[0]);
+            }
+        })
+    },
+    uploadImage(imagePath) {
+        wx.uploadFile({
+            url: 'https://reader-api.ai160.com/file/upload',
+            filePath: imagePath,
+            name: '朗读录音',
+            header: {
+                uid: wx.getStorageSync('uid')
+            },
+            success: async (res) => {
+                await sendMsg({
+                    content: JSON.parse(res.data).data,
+                    type: '2',
+                    receiverUid: this.data.targetUid
+                })
+                this.getNewMsgDet()
+                this.setData({
+                    scrollTop: this.data.list.length * 1000
+                })
+            }
+        })
+    },
+    bindKeyInput(e) {
         this.setData({
-          scrollTop: this.data.list.length * 1000
+            value: e.detail.value
         })
-      }
-    })
-  },
-  bindKeyInput(e) {
-    this.setData({
-      value: e.detail.value
-    })
-  },
-  jumpUserInfo({
-    currentTarget
-  }) {
-    wx.navigateTo({
-      url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
-    })
-  },
-  onUnload() {
-    clearInterval(this.interval)
-  }
+    },
+    jumpUserInfo({
+        currentTarget
+    }) {
+        wx.navigateTo({
+            url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
+        })
+    },
+    onUnload() {
+        clearInterval(this.interval)
+    }
 })

+ 2 - 1
pages/comment/index.js

@@ -4,9 +4,10 @@ import {
 import {
   ReplyComment
 } from '~/api/video'
+import event from '~/mixins/event'
 import reachBottom from '~/mixins/reachBottom'
 Page({
-  behaviors: [reachBottom],
+  behaviors: [reachBottom,event],
   data: {},
   onShow(options) {
     this.resetData()

+ 2 - 1
pages/index/index.js

@@ -6,6 +6,7 @@ import {
     getBannerList
 } from '~/api/global'
 import reachBottom from '~/mixins/reachBottom'
+import event from '~/mixins/event'
 import share from '~/mixins/share'
 import {
     createStoreBindings
@@ -14,7 +15,7 @@ import {
     store
 } from '~/store/index'
 Page({
-    behaviors: [reachBottom, share],
+    behaviors: [reachBottom, share,event],
     data: {
         navBarHeight: app.globalData.navBarHeight,
         background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],

+ 2 - 1
pages/like/index.js

@@ -1,9 +1,10 @@
 import {
   getBeLikeList
 } from '~/api/message'
+import event from '~/mixins/event'
 import reachBottom from '~/mixins/reachBottom'
 Page({
-  behaviors: [reachBottom],
+  behaviors: [reachBottom,event],
   data: {},
   onShow(options) {
     this.resetData()

+ 2 - 1
pages/message/index.js

@@ -12,10 +12,11 @@ import {
 import {
   store
 } from '~/store/index'
+import event from '~/mixins/event'
 import reachBottom from '~/mixins/reachBottom'
 const app = getApp()
 Page({
-  behaviors: [reachBottom],
+  behaviors: [reachBottom,event],
   data: {
     targetId: "",
     menu: {

+ 2 - 0
pages/my/index.js

@@ -5,6 +5,7 @@ import {
     getWxQrcode,
     getLearnCard
 } from '~/api/user'
+import event from '~/mixins/event'
 import {
     getProducts,
     userEvent
@@ -17,6 +18,7 @@ import {
 } from '~/store/index'
 const app = getApp()
 Page({
+    behaviors: [event],
     data: {
         userInfo: {},
         vipTime: '',

+ 2 - 1
pages/notice/index.js

@@ -1,9 +1,10 @@
 import {
   getMessageList
 } from '~/api/message'
+import event from '~/mixins/event'
 import reachBottom from '~/mixins/reachBottom'
 Page({
-  behaviors: [reachBottom],
+  behaviors: [reachBottom,event],
   data: {},
   onLoad(options) {
     this.resetData()

+ 2 - 1
pages/resource/index.js

@@ -6,12 +6,13 @@ import {
     getResourceList
 } from "~/api/works"
 import share from '~/mixins/share'
+import event from '~/mixins/event'
 import reachBottom from '~/mixins/reachBottom'
 import {
     store
 } from '~/store/index'
 Page({
-    behaviors: [reachBottom, share],
+    behaviors: [reachBottom, share,event],
     data: {
         categoryList: [],
         listOptions: {},

+ 2 - 1
pages/searchFriend/index.js

@@ -2,9 +2,10 @@ import {
   getOtherUser,
   setFans
 } from '~/api/user';
+import event from '~/mixins/event'
 import reachBottom from '~/mixins/reachBottom';
 Page({
-  behaviors: [reachBottom],
+  behaviors: [reachBottom,event],
   data: {
     text: '',
     historySearch: [],