diff --git a/module/product/model.php b/module/product/model.php index e4be98ce2d..a1c14c2ac6 100755 --- a/module/product/model.php +++ b/module/product/model.php @@ -80,7 +80,6 @@ class productModel extends model if($this->app->tab == 'execution') $extra = $this->session->execution; } - /* 查询产品数据。*/ $product = $this->getById($productID); $this->session->set('currentProductType', $product->type); @@ -90,32 +89,18 @@ class productModel extends model if($this->app->tab == 'feedback') $moduleName = 'feedback'; $dropMenuLink = helper::createLink($moduleName, 'ajaxGetDropMenu', "objectID=$productID&module=$currentModule&method=$currentMethod&extra=$extra"); - /* 根据是否显示分支,处理分支语言项,获取分支数据。 */ - $showBranch = ($product->type != 'normal' && $withBranch && $currentModule != 'programplan'); - if(!$showBranch) unset($this->lang->product->menu->settings['subMenu']->branch); - if($showBranch) - { - /* 修正分支显示语言项。 */ - $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]); - $this->lang->product->menu->settings['subMenu']->branch['link'] = str_replace('@branch@', $this->lang->product->branch, $this->lang->product->menu->settings['subMenu']->branch['link']); - - $branches = $this->loadModel('branch')->getPairs($product->id, 'all'); - $branchName = zget($branches, $branch, reset($branches)); - } - /* 构建移动端产品1.5级导航代码。 */ if($this->app->viewType == 'mhtml') { - $output = "{$product->name} "; - if($showBranch) $output .= "id}', '$currentModule', '$currentMethod', '$extra')\">{$branchName} "; + $output = "{$product->name} "; + $output .= $this->productTao->getBranchDropMenu4Select($product, $branch, $currentModule, $currentMethod, $extra, $withBranch); return $output; } /* 构建PC端产品1.5级导航代码。 */ $output = "
"; - if($showBranch) $output .= "{$branchName} "; + $output .= '
'; + $output .= $this->productTao->getBranchDropMenu4Select($product, $branch, $currentModule, $currentMethod, $extra, $withBranch); $output .= ''; return $output; @@ -513,7 +498,7 @@ class productModel extends model $output = "
"; - $output .= $this->productTao->getBranchSelect4PC($currentProduct, $branch, $locateModule, $locateMethod, $extra); + $output .= $this->productTao->getBranchDropMenu4Switch($currentProduct, $branch, $locateModule, $locateMethod, $extra); return $output; } diff --git a/module/product/tao.php b/module/product/tao.php index 889aa46f32..88666848ce 100644 --- a/module/product/tao.php +++ b/module/product/tao.php @@ -474,18 +474,18 @@ class productTao extends productModel } /** - * 获取PC端分支下拉的HTML - * Get branch select for mobile + * 获取getSwitch方法中的分支下拉的HTML。 + * Get branch drop menu for getSwitch method. * * @param object $product * @param string|int $branch * @param string $currentModule * @param string $currentMethod * @param string $extra - * @access private + * @access protected * @return string */ - protected function getBranchSelect4PC(object $product, string|int $branch, string $currentModule, string $currentMethod, string $extra = ''): string + protected function getBranchDropMenu4Switch(object $product, string|int $branch, string $currentModule, string $currentMethod, string $extra = ''): string { if(!isset($product->type) or $product->type == 'normal') return ''; @@ -507,12 +507,51 @@ class productTao extends productModel /* 生成分支HTML代码。*/ $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]); - $output = "