| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- import {
- getGroupDetail,
- groupApply
- } from '../../services/index.js'
- import {
- imgServerUrl
- } from '../../config/config.js'
- import {
- showToast
- } from '../../utils/tips.js'
- const WxParse = require('../../plugins/wxParse/wxParse.js');
- var app = getApp()
- Page({
- data: {
- imgServerUrl: imgServerUrl,
- clearTimer: false,
- myFormat: ['天', ':', ':', ' '],
- },
- onLoad: function(options) {
- this.setData({
- hpPositionGroupId: options.hpPositionGroupId,
- positionCategory: options.positionCategory,
- positionId: options.positionId
- })
- },
- onShow: function(options) {
- if (app.globalData.userInfo) {
- console.log('有info===', app.globalData)
- this.fetchData()
- } else if (this.data.canIUse) {
- // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
- // 所以此处加入 callback 以防止这种情况
- app.userInfoReadyCallback = res => {
- console.log('userInfoReadyCallback===', app.globalData)
- this.fetchData()
- }
- } else {
- // 在没有 open-type=getUserInfo 版本的兼容处理
- wx.getUserInfo({
- success: res => {
- app.globalData.userInfo = res.userInfo
- console.log('兼容处理===', app.globalData)
- this.fetchData()
- }
- })
- }
- },
- onUnload: function() {
- this.setData({
- clearTimer: true
- })
- },
- onShareAppMessage: function() {
- return {
- title: '开心工作参团有奖',
- path: '/pages/pt-detail/index?hpPositionGroupId=' + this.data.hpPositionGroupId,
- imageUrl: ''
- }
- },
- //获取历史记录
- fetchData() {
- },
- // 拼团倒计时结束
- myLinsterner(e) {
- // this.setData({
- // clearTimer: true
- // })
- // showToast('拼团已结束')
- },
- // 一键参团
- joinGroup(e) {
- let {
- formId
- } = e.detail
- wx.setStorageSync('resumeUrl', '/pages/user-info/user-info?hpPositionGroupId=' + this.options.hpPositionGroupId + "&formId=" + formId)
- groupApply(this.options.hpPositionGroupId, formId).then(data => {
- this.fetchData()
- })
- },
- ptTip() {
- wx.navigateTo({
- url: '../pt-tip/index',
- })
- },
- //分享图片
- toShare() {
- wx.navigateTo({
- url: '../pt-share/pt-share?hpPositionGroupId=' + this.data.hpPositionGroupId,
- })
- },
- onError(err) {
- app.aldstat.sendEvent('报错', {
- 'err': err
- });
- },
- })
|