第一次见到那么离谱的代码,完全没有封装的意思。
if ($config['theme'] == 1) {
if ($config['plugin']['PG_SHOPPING_CART']) {
$tabIndex = [
'index' => 0,
'collection' => 1,
'bestforyou' => 2,
'cart' => 3,
'mine' => 4
];
$tablist = [
[
'pagePath' => '/pages/index/index',
'text' => '首页',
'iconPath' => '/assets/images/home_unactived.png',
'selectedIconPath' => '/assets/images/theme1_home_actived.png',
],
[
"pagePath" => "/pages/collection/collection",
"iconPath" => "/assets/images/collection.png",
"selectedIconPath" => "/assets/images/collection_actived.png",
"text" => "收藏"
],
[
"pagePath" => "/pages/bestforyou/bestforyou",
"iconPath" => "/assets/images/bestforyou_unactived.png",
"selectedIconPath" => "/assets/images/bestforyou_actived.png",
"text" => "为你优选"
],
[
'pagePath' => '/pages/cart/cart',
'text' => '购物车',
'iconPath' => '/assets/images/cart_unactived.png',
'selectedIconPath' => '/assets/images/cart_actived.png',
],
[
'pagePath' => '/pages/mine/mine',
'text' => '我的',
'iconPath' => '/assets/images/mine_unactived.png',
'selectedIconPath' => '/assets/images/mine_actived.png',
]
];
} else {
$tabIndex = [
'index' => 0,
'collection' => 1,
'bestforyou' => 2,
'mine' => 3
];
$tablist = [
[
'pagePath' => '/pages/index/index',
'text' => '首页',
'iconPath' => '/assets/images/home_unactived.png',
'selectedIconPath' => '/assets/images/theme1_home_actived.png',
],
[
"pagePath" => "/pages/collection/collection",
"iconPath" => "/assets/images/collection.png",
"selectedIconPath" => "/assets/images/collection_actived.png",
"text" => "收藏"
],
[
"pagePath" => "/pages/bestforyou/bestforyou",
"iconPath" => "/assets/images/bestforyou_unactived.png",
"selectedIconPath" => "/assets/images/bestforyou_actived.png",
"text" => "为你优选"
],
[
'pagePath' => '/pages/mine/mine',
'text' => '我的',
'iconPath' => '/assets/images/mine_unactived.png',
'selectedIconPath' => '/assets/images/mine_actived.png',
]
];
}
} else {
if ($config['plugin']['PG_SHOPPING_CART']) {
$tabIndex = [
'index' => 0,
'cart' => 1,
'mine' => 2
];
$tablist = [
[
'pagePath' => '/pages/index/index',
'text' => '首页',
'iconPath' => '/assets/images/home_unactived.png',
'selectedIconPath' => '/assets/images/home_actived.png',
],
[
'pagePath' => '/pages/cart/cart',
'text' => '购物车',
'iconPath' => '/assets/images/cart_unactived.png',
'selectedIconPath' => '/assets/images/cart_actived.png',
],
[
'pagePath' => '/pages/mine/mine',
'text' => '我的',
'iconPath' => '/assets/images/mine_unactived.png',
'selectedIconPath' => '/assets/images/mine_actived.png',
]
];
} else {
$tabIndex = [
'index' => 0,
'mine' => 1
];
$tablist = [
[
'pagePath' => '/pages/index/index',
'text' => '首页',
'iconPath' => '/assets/images/home_unactived.png',
'selectedIconPath' => '/assets/images/home_actived.png',
],
[
'pagePath' => '/pages/mine/mine',
'text' => '我的',
'iconPath' => '/assets/images/mine_unactived.png',
'selectedIconPath' => '/assets/images/mine_actived.png',
]
];
}
}