index.js
2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* @Description: huyue
* @Author: huyue
* @Date: 2022-12-15 17:13:19
* @LastEditors: huyue
* @LastEditTime: 2022-12-29 15:13:16
*/
Component({
externalClasses: ['glscene-class', 'gldiscover-class', 'novideo-img', 'sub-menu-active-custom', 'sidebar-active-custom'],
options: {
multipleSlots: true // 在组件定义时的选项中启用多 slot 支持
},
/**
* 组件的属性列表
*/
properties: {
// 客户数字化Data
list: {
type: Array,
// observer: function (n) {
// this.init(n)
// }
},
// 选中活动tab下标,默认第一个
discoverIndex: {
type: Number,
value: 0
}
},
/**
* 组件的初始数据
*/
data: {
bannerSrc: '',
defaultBannerSrc: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/banner/banner_default.png'
},
/**
* 组件的方法列表
*/
methods: {
// // 初始化数据,新增数字化转型案例视频
// init(n) {
// if (n.length === 0) return
// let operationVideoList = []
// let videoList = []
// n.forEach(item => {
// operationVideoList = operationVideoList.concat(item.operationVideoList)
// videoList = videoList.concat(item.videoList)
// })
// this.data.list.push({
// name: '数字化转型案例',
// videoList: videoList,
// operationVideoList: operationVideoList
// })
// this.setData({
// list: this.data.list
// })
// },
// 点击特色产品
proClick(e) {
const sceneCode = this.data.sceneCode || this.data.list[this.data.discoverIndex].sceneCode
this.triggerEvent('proClick', {info: e.detail, sceneCode});
},
// 点击案例视频或操作指引
videoClick(e) {
const sceneCode = this.data.sceneCode || this.data.list[this.data.discoverIndex].sceneCode
this.triggerEvent('videoClick', {info: e.detail, sceneCode});
},
// 点击切换菜单
menuClick(e) {
const menuInfo = this.data.list.find(
(item) => item.sceneCode === e.detail.info.sceneCode
);
const bannerSrc = menuInfo.banner;
const sceneCode = menuInfo.sceneCode
this.setData({
discoverIndex: e.detail.id,
bannerSrc,
sceneCode
});
},
// 点击场景banner
senceClick() {
const info = this.data.list.find(
(item) => item.sceneCode === this.data.sceneCode
);
this.triggerEvent('senceClick', info);
},
// 初始化菜单
initMenu(e) {
const menuInfo = e.detail
const bannerSrc = menuInfo.banner;
const sceneCode = menuInfo.sceneCode
this.setData({
bannerSrc,
sceneCode
})
}
}
})