| | |
| | | getZhongTaiVideoPage, |
| | | getZhongTaiProductNewsPage |
| | | } from '../../api/index' |
| | | const { |
| | | HYEventBus |
| | | } = require('hy-event-store') |
| | | const eventBus = new HYEventBus() |
| | | const app = getApp() |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | HOME_CLASS_B2: '', |
| | | HOME_CLASS_C: '', |
| | | }, |
| | | onLoadLogin(options){ |
| | | // 已经登录,可以走依赖token的逻辑了 |
| | | console.log('首页的onLoadLogin',options,`{"token":"${app.globalData.token}"}`); |
| | | this.initData() |
| | | }, |
| | | onShow() { |
| | | let that = this |
| | | const member = wx.getStorageSync('member') |
| | | if (member && (member.authStatus == '1' || member.authStatus == '2')) { |
| | | getMemberInfo().then(res => { |
| | |
| | | member |
| | | }) |
| | | } |
| | | eventBus.on("reloadHome", () => { |
| | | console.log('reloadHome'); |
| | | this.onLoad() |
| | | }) |
| | | }, |
| | | onLoad(options) { |
| | | const member = wx.getStorageSync('member') |
| | | this.initDictData() |
| | | if (member && member.token) { |
| | | this.initData() |
| | | } else { |
| | | setTimeout(() => { |
| | | this.initData() |
| | | }, 1200) |
| | | } |
| | | }, |
| | | changePath(e) { |
| | | let index = e.currentTarget.dataset.type |
| | |
| | | url: '/pages/calculator/index' |
| | | }) |
| | | break; |
| | | |
| | | case '2': |
| | | wx.navigateTo({ |
| | | url: '/pages/design/design' |
| | |
| | | const { |
| | | videourl |
| | | } = e.currentTarget.dataset |
| | | wx.previewMedia({ |
| | | sources: [{ |
| | | url: videourl, |
| | | type: 'video' |
| | | }] |
| | | }) |
| | | let videoPlay = this.selectComponent('.videoPlay'); |
| | | if(videoPlay){ |
| | | videoPlay.startPlayVideo(videourl,this ); |
| | | } |
| | | // wx.previewMedia({ |
| | | // sources: [{ |
| | | // url: videourl, |
| | | // type: 'video' |
| | | // }] |
| | | // }) |
| | | }, |
| | | goserHeight: function (e) { |
| | | const serviceHeight = e.detail.height |
| | |
| | | }) |
| | | }, |
| | | consultClick(e) { |
| | | const id = e.currentTarget.dataset.id |
| | | const item = e.currentTarget.dataset.id |
| | | actionDo({ |
| | | actionType: 'view', |
| | | id: id |
| | | id: item.id |
| | | }) |
| | | wx.navigateTo({ |
| | | url: '/pages/consult/detail?id=' + id |
| | | }) |
| | | if(item.contentType == 'link'){ |
| | | wx.navigateTo({ |
| | | url: '/pages/webView/index', |
| | | success: function(res) { |
| | | // 通过eventChannel向被打开页面传送数据 |
| | | res.eventChannel.emit('acceptDataFromOpenerPage', { link: item.content, title: item.title }) |
| | | } |
| | | }) |
| | | }else{ |
| | | wx.navigateTo({ |
| | | url: '/pages/consult/detail?id='+item.id, |
| | | }) |
| | | } |
| | | // wx.navigateTo({ |
| | | // url: '/pages/consult/detail?id=' + id |
| | | // }) |
| | | }, |
| | | bannerClick(e) { |
| | | const { |
| | |
| | | } = e.currentTarget.dataset |
| | | const item = e.currentTarget.dataset.item |
| | | console.log('item', item); |
| | | if(item.openType){ |
| | | if (item.openType) { |
| | | actionDo({ |
| | | actionType: 'view', |
| | | id: item.id |
| | |
| | | } |
| | | if (item.openType == 'link') { |
| | | wx.navigateTo({ |
| | | url: '/pages/webView/index?link=' + item.openContent, |
| | | url: '/pages/webView/index', |
| | | success: function (res) { |
| | | res.eventChannel.emit('acceptDataFromOpenerPage', { |
| | | link: item.openContent || item.content |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | if (item.openType == 'page') { |
| | |
| | | url: `/pages/kefu/service?title=${title}&id=${id}`, |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | jumpProConsult() { |
| | | wx.switchTab({ |