index.js
2.56 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
105
106
107
// pages/tab/storeAssistant/pages/index/components/menu/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
totals: Number,
tabIndex: {
type: Number,
value: 0,
observer(newVal) {
this.setData({
current: newVal || 0
})
}
},
tabs: {
type: Array,
observer(newVal) {
this.getMenuData(newVal)
}
}
},
data: {
current: 0,
menus: []
},
methods: {
closeMenu() {
this.setData({
show: false
})
},
selectMenu(e) {
const { index } = e.currentTarget.dataset
this.setData({
current: index,
show: false
})
this.triggerEvent('currentMenu', index)
},
jump() {
this.setData({
show: false
})
wx.navigateTo({
url: '/packagesList/log/log',
})
},
async getVersionInfo() {
let versionData = await getApp().getVersionInfo()
if (versionData) {
versionData = wx.$versionConfig.compare()
wx.nextTick(() => {
this.setData({
versionData
})
})
}
},
getMenuData(tabs) {
let res = []
let data = [{
logo: 'zc-icon',
title: '售后众筹',
count: 0,
serviceType: 0
}, {
logo: 'jpzs',
title: '精品升级',
count: 0,
serviceType: 1
}, {
logo: 'hyqy-icon',
title: '会员权益/升级',
count: 0,
serviceType: 2
}, {
logo: 'esc-icon',
title: '二手车',
count: 0,
serviceType: 7
}]
tabs.forEach(item => {
data.forEach(el => {
if (item.serviceType == el.serviceType) {
el.title = item.serviceTypeName
res.push(el)
}
})
})
this.setData({
menus: res
})
}
},
lifetimes: {
attached() {
this.getVersionInfo()
}
},
})