123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- import {
- getAuthorityMsg,
- getMessageRecord,
- msgTopping
- } from '~/api/message'
- import reachBottom from '~/mixins/reachBottom'
- const app = getApp()
- Page({
- behaviors: [reachBottom],
- data: {
- targetId: "",
- menu: {
- show: false,
- top: 0,
- left: 0
- },
- authorityMsg: {},
- uid: ''
- },
- onLoad(options) {
- this.setData({
- uid: wx.getStorageSync('uid')
- })
- },
- onShow() {
- if (typeof this.getTabBar === 'function') {
- this.getTabBar().setData({
- selected: 3
- })
- }
- this.getAuthorityMsg()
- this.resetData()
- },
- async getAuthorityMsg() {
- let authorityMsg = await getAuthorityMsg()
- console.log(authorityMsg);
- this.setData({
- authorityMsg
- })
- },
- loadMore() {
- this.getData(getMessageRecord)
- console.log(this.list);
- },
- setSearch({
- detail
- }) {
- /* console.log(detail)
- if (!detail.value) {
- this.setData({
- nullList: false,
- list: []
- });
- }
- this.setData({
- text: detail.value
- }); */
- },
- async search() {
- if (!this.data.text) {
- this.setData({
- list: []
- });
- return;
- }
- this.setData({
- list,
- });
- },
- onLongPress(e) {
- console.log(e);
- let {
- currentTarget,
- detail,
- touches,
- target
- } = e
- let remainingW = app.globalData.windowWidth - touches[0].clientX
- let remainingH = app.globalData.windowHeight - touches[0].clientY
- let wFlag = remainingW - 145 > 0
- let hFlag = remainingH - 200 > 0
- let {
- receiverUid,
- senderUid
- } = currentTarget.dataset.item
- this.setData({
- targetId: receiverUid != this.data.uid ? receiverUid : senderUid,
- menu: {
- show: true,
- top: hFlag ? touches[0].clientY : touches[0].clientY - 100,
- left: wFlag ? touches[0].clientX : touches[0].clientX - 135
- }
- })
- },
- cancelMenu() {
- this.setData({
- 'menu.show': false
- })
- },
- async msgTopping() {
- await msgTopping({
- topUid: this.data.targetId
- })
- this.cancelMenu()
- this.getAuthorityMsg()
- this.resetData()
- },
- delMessage() {
- this.setData({
- 'menu.show': false
- })
- },
- jump({
- currentTarget
- }) {
- wx.navigateTo({
- url: `/pages/${currentTarget.dataset.url}/index`,
- })
- },
- jumpChat({
- currentTarget
- }) {
- console.log(currentTarget.dataset);
- /* wx.navigateTo({
- url: `/pages/${currentTarget.dataset.url}/index`,
- }) */
- },
- })
|