12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- const app = getApp()
- Page({
- data: {
- messageId: '',
- menu: {
- show: false,
- top: 0,
- left: 0
- }
- },
- onLoad(options) {
- },
- onShow() {
- if (typeof this.getTabBar === 'function') {
- this.getTabBar().setData({
- selected: 3
- })
- }
- },
- 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
- this.setData({
- messageId: currentTarget.dataset.id,
- 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
- })
- },
- setIsTop() {},
- delMessage() {
- this.setData({
- 'menu.show': false
- })
- },
- jump({
- currentTarget
- }) {
- console.log(currentTarget);
- wx.navigateTo({
- url: `/pages/${currentTarget.dataset.url}/index`,
- })
- }
- })
|