From 3508c76f824c6632b47aff17b1ec2f2a11c504fc Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 01 八月 2024 14:31:12 +0800
Subject: [PATCH] lll
---
wechat_jiaxuan/pages/index/index.js | 96 +++++++++++++++++++++++++++++-------------------
1 files changed, 58 insertions(+), 38 deletions(-)
diff --git a/wechat_jiaxuan/pages/index/index.js b/wechat_jiaxuan/pages/index/index.js
index 2e777c9..097386a 100644
--- a/wechat_jiaxuan/pages/index/index.js
+++ b/wechat_jiaxuan/pages/index/index.js
@@ -8,10 +8,8 @@
getZhongTaiVideoPage,
getZhongTaiProductNewsPage
} from '../../api/index'
-const {
- HYEventBus
-} = require('hy-event-store')
-const eventBus = new HYEventBus()
+import { eventBus } from '../../utils/eventBus'
+const app = getApp()
Page({
/**
@@ -48,34 +46,28 @@
HOME_CLASS_B2: '',
HOME_CLASS_C: '',
},
+ onLoadLogin(options){
+ // 宸茬粡鐧诲綍锛屽彲浠ヨ蛋渚濊禆token鐨勯�昏緫浜�
+ console.log('棣栭〉鐨刼nLoadLogin',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 => {
- this.setData({
- member: res.data
- })
- })
- } else {
- this.setData({
- member
- })
- }
- eventBus.on("reloadHome", () => {
+ this.setData({ member })
+
+ eventBus.once("reloadHome", () => {
console.log('reloadHome');
this.onLoad()
+ this.initData()
})
},
onLoad(options) {
- const member = wx.getStorageSync('member')
this.initDictData()
- setTimeout(() => {
- this.initData()
- }, 1200)
+ this.initData()
},
changePath(e) {
let index = e.currentTarget.dataset.type
+ const member = this.data.member
let that = this
switch (index) {
case '0':
@@ -96,9 +88,16 @@
})
break;
case '2':
- wx.navigateTo({
- url: '/pages/design/design'
- })
+ if(member && member.phone){
+ wx.navigateTo({
+ url: '/pages/design/design'
+ })
+ }else{
+ wx.navigateTo({
+ url: '/pages/auth/auth',
+ })
+ }
+
// wx.navigateTo({
// url: '/pages/wonderful_activity/index',
// success: function(res) {
@@ -212,12 +211,16 @@
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
@@ -226,9 +229,13 @@
})
},
bannerbindload(e) {
- const height = e.detail.height
+ const {
+ height,
+ width
+ } = e.detail
+ let activeHeight = height * 670 / width
this.setData({
- bannerImgHeight: height
+ bannerImgHeight: activeHeight
})
},
consultbindload(e) {
@@ -238,18 +245,31 @@
} = e.detail
let activeHeight = height * 670 / width
this.setData({
- consultImgHeight: activeHeight
+ consultImgHeight: activeHeight + 100
})
},
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 {
--
Gitblit v1.9.3