import { getInviteList } from '~/api/user' import event from '~/mixins/event' Page({ behaviors: [event], data: { list: [{ num: 1, top: -60, left: 428 }, { num: 2, top: 230, left: 274 }, { num: 3, top: 580, left: 224 }, { num: 4, top: 770, left: 570 }, { num: 5, top: 856, left: 360 }, { num: 6, top: 1194, left: 140 }, { num: 7, top: 1194, left: 460 }, { num: 8, top: 1466, left: 140 }, { num: 9, top: 1466, left: 460 }, { num: 10, top: 1740, left: 140 }, { num: 11, top: 2088, left: 140 }, { num: 12, top: 2088, left: 460 }, { num: 13, top: 2360, left: 140 }, { num: 14, top: 2360, left: 460 }, { num: 15, top: 2636, left: 460 }, { num: 16, top: 3036, left: 140 }, { num: 17, top: 3036, left: 460 }, { num: 18, top: 3310, left: 140 }, { num: 19, top: 3310, left: 460 }, { num: 20, top: 3580, left: 140 }, { num: 21, top: 3580, left: 460 }, { num: 22, top: 3852, left: 140 }, { num: 23, top: 3852, left: 460 }, { num: 24, top: 4126, left: 140 }, { num: 25, top: 4126, left: 460 }, { num: 26, top: 4396, left: 140 }, { num: 27, top: 4396, left: 460 }, { num: 28, top: 4670, left: 140 }, { num: 29, top: 4670, left: 460 }, { num: 30, top: 4944, left: 460 }, { num: 31, top: 5332, left: 140 }, { num: 32, top: 5332, left: 460 }, { num: 33, top: 5604, left: 140 }, { num: 34, top: 5604, left: 460 }, { num: 35, top: 5878, left: 140 }, { num: 36, top: 5878, left: 460 }, { num: 37, top: 6148, left: 140 }, { num: 38, top: 6148, left: 460 }, { num: 39, top: 6418, left: 140 }, { num: 40, top: 6418, left: 460 }, { num: 41, top: 6692, left: 140 }, { num: 42, top: 6692, left: 460 }, { num: 43, top: 6960, left: 140 }, { num: 44, top: 6960, left: 460 }, { num: 45, top: 7284, left: 140 }, { num: 46, top: 7284, left: 460 }, { num: 47, top: 7554, left: 140 }, { num: 48, top: 7554, left: 460 }, { num: 49, top: 7828, left: 140 }, { num: 50, top: 7828, left: 460 }, { num: 51, top: 8100, left: 140 }, { num: 52, top: 8100, left: 460 }, { num: 53, top: 8372, left: 140 }, { num: 54, top: 8372, left: 460 }, { num: 55, top: 8642, left: 140 }, { num: 56, top: 8642, left: 460 }, { num: 57, top: 8912, left: 140 }, { num: 58, top: 8912, left: 460 }, { num: 59, top: 9120, left: 300 }, { num: 60, top: 9422, left: 440 }], treasureList: [{ id: 2, num: 1, text: '加油!继续挑战第2关', text2: '你的成绩会被记录在排行榜上哦! 快来展示你的实力吧!', close: '/static/2t.png', open: '/static/2t-2.png', top: 310, left: -10 }, { id: 5, num: 2, text: '再接再厉!通往下一关!', close: '/static/5.png', open: '/static/5-2.png', top: 840, left: 20 }, { id: 10, num: 3, text: '挑战更高级难度!赢取更多奖励', close: '/static/10.png', open: '/static/10-2.png', top: 1736, left: 510 }, { id: 15, num: 4, text: '保持冷静,一步一个脚印!', close: '/static/15.png', open: '/static/15-2.png', top: 2632, left: 26 }, { id: 30, num: 5, text: '全力以赴,冲刺胜利!', text2: '不要气馁,坚持到底就能成功通关!', close: '/static/30.png', open: '/static/30-2.png', top: 4924, left: 16 }], count: 0, state: false, modelInfo: { title: '', text: '', text2: '' } }, async onLoad() { let { list } = await getInviteList({ pageSize: 9999 }) this.setData({ count: list.length }) if (this.data.count > 2) { wx.pageScrollTo({ selector: `#p${this.data.count<60?this.data.count-1:60}`, duration: 800 }) } }, openTips({ currentTarget }) { let info = currentTarget.dataset.info this.setData({ state: true, modelInfo: this.data.count >= 60 ? { title: '恭喜,冲关成功!', text: '您展现了非凡的实力和毅力,获得SVIP终身会员', text2: '也期待着您未来的更多精彩表现!' } : info.id <= this.data.count ? { title: `恭喜,您已通关第${info.num}关`, text: info.text, text2: info.text2 } : { title: '加油!冲关!', text: '保持积极的态度和努力的精神, 相信您可以顺利完成后面的关卡', text2: '展示您的实力吧!🏆' } }) }, applyOr({ currentTarget }) { if (this.data.count < currentTarget.dataset.num) { this.setData({ state: true, modelInfo: { title: '加油!冲关!', text: '保持积极的态度和努力的精神, 相信您可以顺利完成后面的关卡', text2: '展示您的实力吧!🏆' } }) } }, closeMediaBox() { this.setData({ state: false }) }, jumpIntro({ currentTarget }) { let iconDetail = currentTarget.dataset.icondetail if (iconDetail) { wx.navigateTo({ url: `/pages/rankIntro/index?img=${iconDetail}`, }) } }, jumpRanking() { wx.navigateTo({ url: '/pages/inviteRanking/index', }) }, /** * 用户点击右上角分享 */ onShareAppMessage() { const user = wx.getStorageSync('user'); // #if MP return { title: '自从用了它,家里朗朗书声,美妙极了!你家孩子也快来试试!', path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`, imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300-1.jpg' } // #elif ANDROID return { title: '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!', userName: 'gh_50f61361ad1d', path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`, imagePath: '/static/375-300-1.jpg', webpageUrl: 'http://www.efunbox.cn', withShareTicket: true, miniprogramType: 1, scene: 0, } // #endif } })