// index.js const axios = require('../../api/index') // 获取应用实例 const app = getApp() Page({ data: { current:1,//1为买车2为我的 is_to:true, is_show_share_mask:false, detail:{} }, onLoad(options) { let { shareType, userId, } = options; if (shareType && userId) { wx.setStorageSync('shareType', shareType) wx.setStorageSync('userId', userId) } const scene = decodeURIComponent(options.scene) console.log(scene) if (scene) { var shareType_e = 'newusers' var userId_e = scene.slice(3) wx.setStorageSync('shareType', shareType_e) wx.setStorageSync('userId', userId_e); } }, bindshare(e){ this.setData({ detail:e.detail.item, is_show_share_mask:true }) console.log(e) }, // 隐藏转发窗口 hide_share_mask_fn() { this.setData({ is_show_share_mask: false }) }, // 自定义菜单事件 swichNav(e){ console.log(e.currentTarget.dataset.current) if(this.data.current==e.currentTarget.dataset.current){ return }else{ if(e.currentTarget.dataset.current==1){ wx.setNavigationBarTitle({ title: '云车二手', }) }else{ let token = wx.getStorageSync('token') if (!token) { wx.navigateTo({ url: '/pages/login/login', }) return } wx.setNavigationBarTitle({ title: '会员中心', }) } this.setData({ current:e.currentTarget.dataset.current }) } }, go_new_show(){ let token = wx.getStorageSync('token') if (!token) { wx.navigateTo({ url: '/pages/login/login', }) return } if(this.data.is_to){ this.data.is_to=false wx.navigateTo({ url: '/pages/new_show/new_show', }) this.data.is_to=true } }, to_me(){ wx.reLaunch({ url: `/pages/me/me`, }) }, onShareAppMessage(e) { let share_data = getApp().global_share() return share_data }, })