list.js
2.67 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
// components/list/list.js
const util = require('../../utils/util.js')
const restapi = require('../../utils/restapi.js')
const app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
list: {
type: Array
},
margin: {
type: Number,
value: 20
},
flag: {
type: Boolean,
value: false
},
authToast: {
type: Boolean,
value: true
}
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
tap(e) {
this.jump(e, this)
},
jump: util.throttle((e, _this) => {
if (!_this.properties.authToast) {
let index = e.currentTarget.dataset.index
let url = _this.properties.list[index].modulePath
let item = e.currentTarget.dataset.item
console.log(item)
let list = _this.properties.list
if (item.moduleName == '我的消息') {
list[index].redDot = false
wx.hideTabBarRedDot({
index: 1
})
}
if (item.moduleName == '隐私政策') {
var globalData = app.globalData.extConfig
restapi.getMerchantBussiness(globalData.merchantId, function (res) {
// console.log(res);
if (res.returnCode == '0') {
let path = `https://dj.glsx.com.cn/agreement/djUserPolicy.html?merchantName=${globalData.merchantName}&phone=${res.data.phone}`
wx.navigateTo({
url: `/pages/webpage/webpage?path=${encodeURIComponent(path)}`
})
}
}, function (res) {
console.log(res);
})
return true
}
if (item.moduleType == 'h5') {
let environment = {
'https://dj.test.glsx.com.cn': 'uat',
'https://dj.glsx.com.cn': 'prod'
}
let path = item.moduleH5Url[environment[restapi.domain]]
if(!path) path = 'https://dj.glsx.com.cn/dj-car-boutique-work-wechat/#/'
if(item.moduleParams) {
path = `${path}?${item.moduleParams}`
}
wx.navigateTo({
url: `/pages/webpage/webpage?path=${encodeURIComponent(path)}`
})
return
}
_this.setData({
list: list
})
wx.navigateTo({
url: url
})
} else {
wx.navigateTo({
url: '/pages/auth/index/index'
})
/*
wx.showToast({
title: '请登录查看',
icon: 'none'
})
*/
}
},
1000)
}
})