appCenterCtrl.js
2.07 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
(function(angular) {
function appCenterCtrl($scope, $state, toaster) {
$scope.style = {
height: `${document.body.clientHeight - 90}px`
}
$scope.appList = [
{
iconImg: 'icon-applet',
name: '小程序',
explain: '高频触达,维系客户',
url: 'wechatauth.scan-auth',
router: '小程序授权',
targetName: 'wechatauth'
},
{
iconImg: 'icon-message',
name: '活动',
explain: '创建活动、线上营销',
url: 'marketing.shopactivity.shoplist',
router: '活动列表',
targetName: 'shopList'
},
{
iconImg: 'icon-coupon',
name: '优惠券',
explain: '创建优惠券、促进客户返店',
url: 'marketing.coupon.list',
router: '优惠券列表',
targetName: 'couponList'
}
]
$scope.wechatauth = false
$scope.shopList = false
$scope.couponList = false
$scope.jumpLink = function(name, target,url) {
checkPermission(name, $scope.menuList, target)
if ($scope[target]) {
$state.go(url)
} else {
toaster.pop({
type: 'error',
body: '您暂未开通该服务,请联系客服处理',
showCloseButton: true,
timeout: 3000
})
}
}
function checkPermission(pageTitle, data, name) {
angular.forEach(data, function(e) {
if (e.children) {
checkPermission(pageTitle, e.children, name)
} else {
if (e.pageTitle == pageTitle) {
$scope[name] = true
}
}
})
}
}
angular.module('appCenter').controller('appCenterCtrl', appCenterCtrl)
})(angular);