添加:装修组件 - 菜单按钮组件 - 添加可以设置一行显示3个按钮

添加:用户没有收藏品时不显示典藏室按钮(仅按钮组有效)
This commit is contained in:
wuhui_zzw 2023-10-17 15:33:35 +08:00
parent d784c030cf
commit 7308a011f3
6 changed files with 64 additions and 14 deletions

View File

@ -286,16 +286,16 @@ class MemberCenterService extends BaseMemberCenterService
];
}
// 权重值
$data[] = [
'key' => 'weight_value',
'name' => '权重值',
'value' => Member::current()['weight_value'],
'unit' => '',
'url' => 'weight_value',
'min_url' => '',
'diy_key' => 'weight_value',
'weight' => 60
];
// $data[] = [
// 'key' => 'weight_value',
// 'name' => '权重值',
// 'value' => Member::current()['weight_value'],
// 'unit' => '',
// 'url' => 'weight_value',
// 'min_url' => '',
// 'diy_key' => 'weight_value',
// 'weight' => 60
// ];

View File

@ -0,0 +1,50 @@
<?php
namespace Yunshop\Decorate\common\services\component;
use app\backend\modules\member\models\Member;
use Yunshop\CollectionRoom\models\CollectionRoomModel;
class Button{
public function __construct($commonData = []){
if($commonData && !$this->commonData){
$this->commonData = $commonData;
}
}
// 处理组件数据
public function index($data = []){
foreach($data as &$item){
if($item['remote_data']) $item['remote_data']['list'] = $this->handleList($item['remote_data']['list']);
}
return $data;
}
// 处理自定义列表菜单
public function handleList($list){
$uid = \YunShop::app()->getMemberId(); //用户id
// 循环判断
foreach($list as $handleListIndex => $handleListItem){
// 判断:当前用户是否存在收藏 不存在隐藏典藏室按钮
if(strpos($handleListItem['h5_link'],'/member/collection_room') !== false){
$hasCount = (int)CollectionRoomModel::where('member_id',$uid)->count();
if($hasCount <= 0) unset($list[$handleListIndex]);
}
}
return array_values($list);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long