//index.js var listData = require('../../data/test-data.js'); var utils = require("../../utils/util.js"); var app = getApp(); var requestTimes = 0; var requestSum = 5; // var SocketTask; // let socketOpen = false; //websocket连接是否开启 // let SocketTask; import {IndexModel} from "../../models/index"; const indexModel = new IndexModel() console.log(listData) Page({ /** * 页面的初始数据 */ data: { // 判断标题title是否被修改过 onshow:0,//记录每次onShow事件 isTitle: false, shopName: '', homeLayoutStyle: "", isAuthorize: true, SocketTask: null, socketOpen: false, pageOpen: true, //页面打开状态 allContentList: [], newMsg: '', //最新消息 textColor:'#333', //顶部标题颜色 backStyle:'', customNavBarHeight: app.globalData.customNavBarHeight||0, showHidelayer: false, //显示切换联盟滑动层 navList:[], //图标菜单 parallelNumberForInnerMenuOnHomePage:4, isAutoPlay: true }, reload(){ // let UpdateManager= wx.getUpdateManager(); // UpdateManager.applyUpdate(); wx.reLaunch({ url: '../index/index' }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { this.isFirstOpen = true; console.log(app.globalData.AppId) var that = this; // app.FromUserIdOnChange= ()=>{ // this.getSetting(); // this.getIndexData(); // } // if (app.globalData.openID == '') { // //第一次登录,获取登录状态 // app.getSession().then(function(res) { // console.log(2) // that.getSetting(); // that.getIndexData(); // //_this.getData(); //此时token必然已经获取到,且getData()在此时才会执行 // }) // } else { // console.log(3) // that.getSetting(); // that.getIndexData(); // //有token的情况直接获取数据 // //_this.getData(); // } // app.globalData.indexCallback = (res) => { // that.getSetting(); // that.getIndexData(); // this.setData({ // shopName: wx.getStorageSync('shopName') // }) // } console.log('。。。首页获取的openid与fromuserid',app.globalData.openID,!app.globalData.openID,app.globalData.FromUserId,!app.globalData.FromUserId) if (!app.globalData.openID || !app.globalData.FromUserId) { app.globalData.indexCallback = (res) => { that.getSetting(); that.getIndexData(); this.setData({ shopName: wx.getStorageSync('shopName'), ProductListStyle:app.globalData.ProductListStyle }) } } else{ that.getSetting(); that.getIndexData(); this.setData({ shopName: wx.getStorageSync('shopName'), ProductListStyle:app.globalData.ProductListStyle }) } // wx.setTabBarBadge({ // index: 2, // text: "0" // }) // wx.request({ // url: 'https://www.easy-mock.com/mock/5b3c70513e96141ffe9caf72/data/tabbar', // method: "GET", // success: function (res) { // console.log(res); // wx.hideLoading() // var tabbarDatas = res.data.tabbarData; // var tabbarData = JSON.parse(JSON.stringify(tabbarDatas)); // console.log(that.data) // // 这里为何在修改tabbarData前打印tabbarData,却得到修改后的值 // // 对象在引用时,结果会随最新的修改状态而动态发生变化 // // 就算是先复制再修改,复制的也会是之后修改的结果 // // 解决思路:修改后再次初始化,初始化后再保存到缓存 // // wx.setStorageSync("tabbarData", tabbarData); // // 查询包含首页字符的页面id // function checkData(item) { // return item.text == "首页"; // } // var tabbarId = tabbarData.find(checkData).id; // that.setData({ // tabbarId: tabbarId // }) // utils.tabbar("tabBar", that.data.tabbarId, that, tabbarData); // // tabbarData[0].active = false; // // tabbarData[0].iconPath = "/imgs/icon/index.png"; // // console.log(tabbarData) // wx.setStorageSync("tabbarData", tabbarDatas); // console.log(that.data.bindData) // that.setData({ // menuList:res.data.menuList, // goodsItem: listData.goodsItem // }) // }, // // fail: function () { // // tabbarData: null // // } // }); // this.setData({ // // navList: listData.navList, // // menuList: listData.menuList, // // goodsItem: listData.goodsItem, // bannerList: listData.bannerList // }); }, // getSetting() { // 获取设置 console.log('首页发送获取设置数据。。。',utils.getUrl('/shopping/getSettingEntity.do')) wx.request({ url: utils.getUrl('/shopping/getSettingEntity.do'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, success: res => { if(!utils.requestError(res)){ return false; } console.log('。。。首页获取设置数据完成。。。',utils.getUrl('/shopping/getSettingEntity.do'),res) this.setData({ homeLayoutStyle: res.data.homeLayoutStyle, homePageBackgroundColor: res.data.homePageBackgroundColor||'', cosmoHomePageImageUrl: res.data.cosmoHomePageImageUrl +'?'+ Math.random() / 9999, defaultShopCcCode: res.data.defaultShopCcCode, longitude: res.data.longitude, latitude: res.data.latitude, isStartupLeagueShopCcCode: res.data.isStartupLeagueShopCcCode, parallelNumberForInnerMenuOnHomePage: res.data.parallelNumberForInnerMenuOnHomePage || 4, }) // if (res.data.homeLayoutStyle=="Cosmo"){ // return false; // } wx.setNavigationBarTitle({ title: res.data.name||'', }) app.globalData.titleName = res.data.name || ''; app.globalData.categoryListStyle = res.data.categoryListStyle||0; app.globalData.normalSearchKey = res.data.normalSearchKey||''; app.globalData.ChooseFloorId = res.data.chooseFloorId||''; }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/getSettingEntity.do'); } // fail: function(errmsg) { // console.log(errmsg); // wx.showToast({ // title: '请求失败!', // icon: 'none', // duration: 1000 // }) // } }) }, getIndexData() { wx.showLoading({ mask: false, title: '加载中', }) console.log('首页数据加载中。。。。。') var that = this; // 顶部广告条 indexModel.getBanner().then((res)=>{ console.log('顶部广告条',res); that.setData({ bannerList: res.list||'', }) }) //活动图 indexModel.getPromotion().then((res)=>{ // console.log('',res); that.setData({ PromotionData: res.list||'', }) }) // 通用广告卡片 indexModel.getInformation().then((res)=>{ // console.log(res); that.setData({ InformationData: res.list||'', }) }) // wx.request({ // url: utils.getUrl('/shopping/getBanner.do'), // header: { // "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') // }, // method: "GET", // success: function (res) { // utils.requestError(res); // that.setData({ // bannerList: res.data.list||'', // }) // }, // fail: function (errmsg) { // utils.requestFail(errmsg, '/shopping/getHomePageSubMenu.do'); // }, // complete: function () { // // requestTimes++; // // if (requestTimes == requestSum) { // // wx.hideLoading(); // // } // } // // // }); //充值广告 wx.request({ url: utils.getUrl('/shopping/giftamount.do?m=getGiftAmount'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, success: function(res) { if(!utils.requestError(res)){ return false; } that.setData({ GiftAmount: res.data.Photo||'', }) }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/giftamount.do?m=getGiftAmount'); } }); //优惠券 wx.request({ url: utils.getUrl('/shopping/coupon.do?m=getCouponList&isShowBannerImage=true'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, success: function(res) { if(!utils.requestError(res)){ return false; } that.setData({ CouponList: res.data.List, }) }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/coupon.do?m=getCouponList&isShowBannerImage=true'); } }); that.setData({ navList: [], }) console.log('开始发送图标菜单请求。。。。',that.data.navList, utils.getUrl('/shopping/getHomePageSubMenu.do')) // 图标菜单 wx.request({ url: utils.getUrl('/shopping/getHomePageSubMenu.do'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, method: "GET", success: function(res) { console.log('图标菜单请求完毕。。。。',utils.getUrl('/shopping/getHomePageSubMenu.do'),'请求结果是。',res.data.list,'。。。清空原来的图标菜单数据:',that.data.navList) if(!utils.requestError(res)){ return false; } that.setData({ navList: res.data.list||[], }) }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/getHomePageSubMenu.do'); }, complete: function() { // requestTimes++; // if (requestTimes == requestSum) { // wx.hideLoading(); // } } }); // 请求会员申请 wx.request({ url: utils.getUrl('/shopping/getMemberListByShowBannerOnHomePage.do'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, method: "GET", success: function(res) { if(!utils.requestError(res)){ return false; } // console.log(res); that.setData({ imgBar: res.data.list, }) }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/getMemberInfo.do'); }, complete: function() { // requestTimes++; // if (requestTimes == requestSum) { // wx.hideLoading(); // } // console.log('wancheng') } }); wx.request({ url: utils.getUrl('/shopping/getMemberGroupListByShowBannerOnHomePage.do'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, method: "GET", success: function(res) { if(!utils.requestError(res)){ return false; } // console.log(res); that.setData({ imgBar2: res.data.list, }) }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/getMemberGroup.do'); }, complete: function() { // requestTimes++; // if (requestTimes == requestSum) { // wx.hideLoading(); // } } }); // 请求下拉菜单 wx.request({ url: utils.getUrl('/shopping/getMatGroupInHomePage.do'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, method: "GET", success: function(res) { if(!utils.requestError(res)){ return false; } // console.log(res); that.setData({ menuList: res.data.list, }) }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/getMatGroupInHomePage.do'); }, complete: function() { // requestTimes++; // if (requestTimes == requestSum) { // wx.hideLoading(); // } } }); // 首次推荐商品请求 console.log('开始推荐商品请求。。',utils.getUrl('/shopping/getMatCodeList.do?fromdata=8')) wx.request({ url: utils.getUrl('/shopping/getMatCodeList.do?fromdata=8'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, method: "GET", success: function(res) { console.log('推荐商品请求完成。。',utils.getUrl('/shopping/getMatCodeList.do?fromdata=8'),res) wx.hideLoading(); if(!utils.requestError(res)){ return false; } that.setData({ goodsList: res.data.ShowGroup, }) }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/getMatCodeList.do'); }, complete: function() { // requestTimes++; // if (requestTimes == requestSum) { // wx.hideLoading(); // } } }); // 订金商品 this.getEventsData(); this.getAllLiveRoomList(); }, getAllLiveRoomList(){ // 获取直播房间 wx.request({ url: utils.getUrl('/shopping/live/getLiveRoomList.do'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, success: (res)=> { if(!utils.requestError(res)){ return false; } console.log(res) this.setData({ LiveRoomData:res.data.list }) // wx.hideLoading(); // this.handleLiveRoomData(); }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/live/getLiveRoomList.do'); } }); }, getEventsData(){ wx.request({ url: utils.getUrl('/shopping/getMatCodeList.do?fromdata=9'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, method: "GET", success: (res)=> { console.log('订金商品',utils.getUrl('/shopping/getMatCodeList.do?fromdata=9'),res) // wx.hideLoading(); if(!utils.requestError(res)){ return false; } this.setData({ goodsList2: res.data.ShowGroup, }) }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/getMatCodeList.do?fromdata=9'); }, complete: function() { // requestTimes++; // if (requestTimes == requestSum) { // wx.hideLoading(); // } } }); }, getUnionData(){ wx.request({ url: utils.getUrl('/shopping/switcharea.do?m=getShopCcCodeList'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, method: "GET", success: (res)=> { console.log('联盟数据',res.data.list) // wx.hideLoading(); if(!utils.requestError(res)){ return false; } this.setData({ unionData: res.data.list, showHidelayer: true }) // this.setData({ // }); }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/switcharea.do?m=getShopCcCodeList'); } }); }, handelChangeUnion(ccCode){ wx.request({ url: utils.getUrl('/shopping/switcharea.do?m=switchShopCcCode'), data:{ shopcccode:ccCode }, header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, method: "GET", success: (res)=> { // console.log('联盟数据',res.data.list) // wx.hideLoading(); if(!utils.requestError(res)){ return false; } app.getFromUserId().then((res) => { app.globalData.SocketTask.close({ success: (res) => { console.log('主动关闭 WebSocket 连接。', res) } }); // 把上个联系人的消息清空并重连 app.globalData.allContentList = []; app.globalData.unreadMsgNum = 0; app.socketReconnect(); wx.reLaunch({ url: '../index/index', }) }) }, fail: function(errmsg) { utils.requestFail(errmsg, '/shopping/switcharea.do?m=switchShopCcCode'); } }); }, preventMove: function () { // 利用catchtouchmove阻止背景滚动 不用添加任何代码 // 只适合模态层不需要滚动的场景 }, changeUnion(e){ let ccCode = e.currentTarget.dataset.cccode; let isSelected = e.currentTarget.dataset.isSelected; console.log('切换联盟..',ccCode,isSelected); if(isSelected){ return; } wx.showModal({ title: '提示', content: '确定要切换联盟吗?', success: (res)=> { if (res.confirm) { this.handelChangeUnion(ccCode); } else if (res.cancel) { console.log('用户点击取消') } } }) }, // 切换联盟隐藏层 openHidelayer() { // 联盟数据 wx.showLoading(); this.getUnionData(); }, maskTap(event) { this.setData({ showHidelayer: event.detail.isShow }); }, toAddr: function() { wx.navigateTo({ url: '../location/location', }) }, scanTap () { wx.scanCode({ success: async (res) => { console.log(res) if(res.path){ wx.reLaunch({ url: '/'+res.path, }) } else if(res.result){ let [err,result] = await utils.to( wx.$http.request({ url:'/shopping/getQrCodeForMiniApp.do', data:{ qrcode:res.result } }) ) if (err) { console.log(err); return; } console.log('/shopping/getQrCodeForMiniApp.do....',result); wx.reLaunch({ url: '/'+result.path, }) } } }) }, openMap(e){ let longitude = e.currentTarget.dataset.longitude; let latitude = e.currentTarget.dataset.latitude; wx.navigateTo({ url: `../map/map?longitude=${longitude}&latitude=${latitude}` }) }, // // Tabbar跳转 // goTab: function (e) { // utils.goTab(e, this, this.data.tabbarId) // }, // 一级列表点击事件 changeClass: function(e) { var idx = e.currentTarget.dataset.num; // 给一级菜单添加自定义属性isChecked; for (var i in this.data.menuList) { var Item = this.data.menuList[i]; if (Item.MatGroup == idx) { Item.isChecked = !Item.isChecked; } else { Item.isChecked = false; } } this.setData({ menuList: this.data.menuList, }) // console.log(this.data) }, // 二级列表点击事件 changeClass2: function(e) { var that = this; console.log(e.target.dataset.url); if (e.target.dataset.url){ this.setData({ goodsTitle: e.target.dataset.name, isTitle: true }) wx.showLoading({ mask: false, title: '加载中', }) // 请求分类里的商品数据 wx.request({ url: utils.getUrl('/shopping/getMatCodeList.do', 'path=' + e.target.dataset.url + '&fromdata=2'), header: { "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') }, method: "GET", success: function (res) { if(!utils.requestError(res)){ return false; } wx.hideLoading() that.setData({ goodsItem: res.data.list, }) }, fail: function (errmsg) { utils.requestFail(errmsg, '/shopping/getMatCodeList.do'); } }); } }, // 商品点击 goodsItemTap: function(e,str) { var goodsId = e.currentTarget.dataset.goodsId; var externalUrl = e.currentTarget.dataset.externalUrl; if (str ==='btnTap'){ var goodsId = e.detail.target.dataset.goodsId; var externalUrl = e.detail.target.dataset.externalUrl; } if (externalUrl) { wx.navigateTo({ // 此时?后面的id为其他页面接收时参数后的变量名 // url: "../webView/webView?externalUrl=" + encodeURIComponent(utils.getUrl('/shopping/mobile/product/OpenExternalUrl.jsp?matcode=' + goodsId)) url: "../webView/webView?externalUrl=" + encodeURIComponent(externalUrl) }) utils.userBehavior('ViewProductDetail',{matcode:goodsId}); } else{ wx.navigateTo({ // 此时?后面的id为其他页面接收时参数后的变量名 url: "../detail/detail?matcode=" + goodsId }) } console.log(goodsId) }, goDetailEvents(e){ var goodsId = e.currentTarget.dataset.goodsId; var DepositDocCode = e.currentTarget.dataset.depositDoccode; var DepositRowId = e.currentTarget.dataset.depositRowid; wx.navigateTo({ // 此时?后面的id为其他页面接收时参数后的变量名 url: "../detailEvents/detailEvents?matcode=" + goodsId+"&DepositDocCode="+DepositDocCode+"&DepositRowId="+DepositRowId }) console.log(e) }, cosmoItemTap(e) { // console.log(e) // var goodsId = e.currentTarget.dataset.goodsId; // var index = e.currentTarget.dataset.index; var goodsId = e.detail.target.dataset.goodsId; var index = e.detail.target.dataset.index; var externalUrl = e.detail.target.dataset.externalUrl; if (externalUrl){ wx.navigateTo({ // 此时?后面的id为其他页面接收时参数后的变量名 url: "../webView/webView?externalUrl=" + encodeURIComponent(externalUrl) }) }else{ wx.navigateTo({ // 此时?后面的id为其他页面接收时参数后的变量名 url: "../detailCosmo/detailCosmo?homeLayoutStyle=Cosmo&id=" + goodsId + "&index=" + index }) } }, // 广告条点击 onSwiperTap: function(event) { console.log('广告条链接为',event.target.dataset) let url = event.target.dataset.url; let istab = event.target.dataset.istab; let isvideo = event.target.dataset.isvideo; let video = event.target.dataset.video; if (isvideo) { wx.navigateTo({ url: '../videoView/videoView', success: function(res) { // 通过eventChannel向被打开页面传送数据 res.eventChannel.emit('getVideoToPlay', { video }) } }) // wx.navigateTo({ // url: "../videoView/videoView?url=" + encodeURIComponent(video) // }) return; } if(url.indexOf('http')>=0){ wx.navigateTo({ url: "../webView/webView?externalUrl=" + encodeURIComponent(url) }) } else if (url !== ''&&!istab) { wx.navigateTo({ url: '/'+url }) } else if (url !== '' && istab){ wx.switchTab({ url: '/' + url }) } }, // 导航菜单点击 navListTap: function (event) { // console.log('e.detail.isAuthorize',event.detail.isAuthorize); // if (!event.detail.isAuthorize) { // return; // } var url = event.currentTarget.dataset.url||''; var name = event.currentTarget.dataset.name||''; var appid = event.currentTarget.dataset.appid||''; var istab = event.currentTarget.dataset.istab; console.log(event) if(appid!==''){ wx.navigateToMiniProgram({ appId: appid, path: 'page/index/index', extraData: { // foo: 'bar' }, // envVersion: 'develop', success(res) { // 打开成功 console.log('跳转小程序成功'); } }) } else if (url.indexOf('http') >= 0) { wx.navigateTo({ url: "../webView/webView?externalUrl=" + encodeURIComponent(url) }) } else if (url !== '' && !istab) { if(url.indexOf('?')<0){ url = url+'?'; } wx.navigateTo({ url: '/' +url+'&name='+name }) } else if (url !== '' && istab) { wx.switchTab({ url: '/' + url }) } console.log('当前点击链接为', url) }, imgOnload(){ // 获取scroll-view高度 wx.getSystemInfo({ success: (res) => { this.setData({ height: res.windowHeight }) console.log(this.data.height) } }) var query = wx.createSelectorQuery(); //选择id var that = this; query.select('.horizon').boundingClientRect(function (rect) { // console.log(rect.height) let navHeight = that.data.height - rect.height that.setData({ navHeight: navHeight }) // WscrollTop = rect.height }).exec(); }, swiperImgload(e){ // console.log('banner 图加载完成。。。',e); var imgWidth=e.detail.width; //图片的原始宽度 var imgHeight = e.detail.height; //图片的原始高度 var sysInfo = wx.getSystemInfoSync();//同步获取设备宽度 var screenWidth=sysInfo.screenWidth; //获取屏幕的宽度 var scale = screenWidth / imgWidth; //获取屏幕和原图的比例 this.setData({ swiperHeight:imgHeight*scale }) }, imgbarLoad(e){ console.log(e,'活动图'); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { }, // goNavDetails: function(e){ // var that = this; // var MatCode = that.data.goodsItem[0].MatCode; // wx.navigateTo({ // url: '../detailCosmo/detailCosmo?homeLayoutStyle=Cosmo&index=0&id=' + MatCode, // }) // }, // 点击授权 getUserInfo: function(e) { utils.authorize(e, this, ()=>{ if (this.data.homeLayoutStyle=='Cosmo') { this.imgOnload() } }) }, getUserInfo2(e) { console.log("信息页点击") // utils.isAuthorize(this); // if(!this.data.isAuthorize){ // utils.authorize(e, this) // // if (!utils.authorize(e, this)){ // // return; // // } // } wx.navigateTo({ url: '../information/information?infordoc='+ e.currentTarget.dataset.doccode, }) }, // 提交fromid // 普通样式提交fromid itemFormIdSubmit1: function (e) { // console.log(e) // utils.formIdSubmit(e, this); this.goodsItemTap(e,'btnTap'); }, // cosmo样式提交fromid itemFormIdSubmit: function(e) { // utils.formIdSubmit(e, this); this.cosmoItemTap(e) }, // authorizeSubmit: function (e) { // utils.formIdSubmit(e, this); // }, /** * 生命周期函数--监听页面显示 */ onShow: function() { console.log('index主页onshow') // utils.isAuthorize(this); // if (app.globalData.FromUserId && !this.isFirstOpen) { if (app.globalData.FromUserId) { utils.userBehavior('ViewHomePage'); utils.cartNum(); this.getEventsData(); } // this.getEventsData(); let onshow = this.data.onshow; this.setData({ onshow: onshow++ }) // console.log(!'' === !undefined); // if((app.globalData.FromUserId!=''&&app.globalData.FromUserId!=undefined)&&(app.globalData.tempFromUserId!=''&&app.globalData.tempFromUserId!=undefined)&&app.globalData.FromUserId != app.globalData.tempFromUserId){ // app.globalData.FromUserId = app.globalData.tempFromUserId; // console.log('两个FromUserId不相等,index页面onshow事件发生,首页数据重加载', app.globalData.FromUserId); // } // app.FromUserIdOnChange(()=>{ // this.getSetting(); // this.getIndexData(); // }) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { // utils.closeSocket(this) console.log('首页隐藏了') this.isFirstOpen = false; // this.setData({ // pageOpen: false // }) // SocketTask.close({ // success: (res) => { // socketOpen = false; // console.log('主动关闭 WebSocket 连接。', res) // } // }) }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { // utils.closeSocket(this) // this.setData({ // pageOpen: false // }) // SocketTask.close({ // success: (res) => { // socketOpen = false; // console.log('主动关闭 WebSocket 连接。', res) // } // }) }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { // console.log("99999900000000088") return { title: utils.getShareTitle(), // title: '我发现' + app.globalData.titleName +'有很多好物,赶快来看看吧', path: 'pages/index/index?FromUserId=' + app.globalData.FromUserId + '&FromOpenId=' + app.globalData.openID + '&OpenFrom=fromShare', success: function (res) { // 转发成功 console.log("转发成功:" + JSON.stringify(res)); // 发送行为信息 // utils.userBehavior('ForwardMyCard'); // utils.showModal(res) }, fail: function (res) { // 转发失败 console.log("转发失败:" + JSON.stringify(res)); } } } })