Explorar el Código

wip:新增菜单

wkyuer hace 2 meses
padre
commit
84fbae91f9

+ 4 - 4
internal/cmd/cmd.go

@@ -34,13 +34,13 @@ var (
 					group.GET("/{type}/{areaCode}_{sId}/", controller.AreaPageHandler)           //地区列表页面
 					group.GET("/{type}/{areaCode}_{sId}/p{pageNum}", controller.AreaPageHandler) //地区列表页面
 
-					group.GET("/stype/{sType}.html", controller.STypePageHandler)       //信息类型
-					group.GET("/stype/{sType}/p{pageNum}", controller.STypePageHandler) //信息类型
+					group.GET("/stype/{code}.html", controller.STypePageHandler)       //信息类型
+					group.GET("/stype/{code}/p{pageNum}", controller.STypePageHandler) //信息类型
 
 					group.GET("/industry/{industryCode}.html", controller.ListIndustryHandler) //行业列表
 
-					group.GET("/{signCode}/", controller.SignPageHandler)           //项目标签列表
-					group.GET("/{signCode}/p{pageNum}", controller.SignPageHandler) //项目标签列表
+					group.GET("/{code}/", controller.SignPageHandler)           //项目标签列表
+					group.GET("/{code}/p{pageNum}", controller.SignPageHandler) //项目标签列表
 
 					group.GET("/area/", controller.SiteAreaIndexHandler)                                         //site省份汇总页
 					group.GET("/city/", controller.SiteCityIndexHandler)                                         //site城市汇总页

+ 39 - 14
internal/controller/sign.go

@@ -10,28 +10,53 @@ import (
 )
 
 func SignPageHandler(r *ghttp.Request) {
-	signCode := r.Get("signCode").String() //标志code
-	pageNum := r.Get("pageNum", 1).Int()   //页码
-	signNode := service.JySeoSIGNRoot.GetNodeByCode(signCode)
+	signCode := r.Get("code").String()   //标志code
+	pageNum := r.Get("pageNum", 1).Int() //页码
+	signNode, isNew := service.JySeoSIGNRoot.GetAllNodeByCode(signCode)
 	if signNode == nil {
 		service.HtmlRender.NotFound(r)
 		return
 	}
+
+	var (
+		err   error
+		rData *service.ListResp
+	)
+
 	// 查询数据
-	query := service.NewBiddingQuery().EquipSIGN(signNode.Id)
-	rData, err := query.GetDataPageList(r.Context(), pageNum, 0, consts.BiddingListMaxTotal, "SignPageHandler", service.JySeoSIGNRoot.GetData)
+	if signNode.Id > 0 {
+		query := service.NewBiddingQuery().EquipSIGN(signNode.Id)
+		rData, err = query.GetDataPageList(r.Context(), pageNum, 0, consts.BiddingListMaxTotal, "SignPageHandler", service.JySeoSIGNRoot.GetData)
+	} else {
+		query := service.NewBiddingQuery()
+		rData, err = query.GetDataPageList(r.Context(), pageNum, 0, consts.BiddingListMaxTotal, "SignPageHandler", service.JySeoSIGNRoot.GetEsData)
+	}
 	if err != nil {
 		g.Log().Errorf(r.Context(), err.Error())
 		service.HtmlRender.RenderError(r, fmt.Errorf("获取列表数据异常"))
 		return
 	}
-
-	service.HtmlRender.Render(r, "project_sign_list.html",
-		g.Map{
-			"signNode":   signNode,
-			"list":       rData.List,
-			"tdk":        service.JySeoTdk.GetSignTdk(r.Context(), signNode.Code),
-			"pagination": service.GetLetterPaging(pageNum, gconv.Int(rData.Total), fmt.Sprintf("/list/%s/p%s", signCode, "%d")),
-		},
-	)
+	if isNew {
+		var pageUrl = fmt.Sprintf("/list/%s/p%s", signCode, "%d")
+		if signCode == "CGYX" {
+			pageUrl = fmt.Sprintf("/list/stype/%s/p%s", signCode, "%d")
+		}
+		service.HtmlRender.Render(r, "project_new_sign_list.html",
+			g.Map{
+				"signNode":   signNode,
+				"list":       rData.List,
+				"tdk":        service.JySeoTdk.GetSignTdk(r.Context(), signNode.Code),
+				"pagination": service.GetLetterPaging(pageNum, gconv.Int(rData.Total), pageUrl),
+			},
+		)
+	} else {
+		service.HtmlRender.Render(r, "project_sign_list.html",
+			g.Map{
+				"signNode":   signNode,
+				"list":       rData.List,
+				"tdk":        service.JySeoTdk.GetSignTdk(r.Context(), signNode.Code),
+				"pagination": service.GetLetterPaging(pageNum, gconv.Int(rData.Total), fmt.Sprintf("/list/%s/p%s", signCode, "%d")),
+			},
+		)
+	}
 }

+ 10 - 1
internal/controller/stype.go

@@ -7,11 +7,20 @@ import (
 	"github.com/gogf/gf/v2/util/gconv"
 	"jyseo/internal/consts"
 	"jyseo/internal/service"
+	"jyseo/utility"
+	"strings"
 )
 
 func STypePageHandler(r *ghttp.Request) {
-	sType := r.Get("sType").String()     //地区code
+	sType := r.Get("code").String()      //地区code
 	pageNum := r.Get("pageNum", 1).Int() //页码
+	////采购意向迁移板块儿 url不变
+	if sType == "CGYX" && !utility.IsMobile(r.Request.UserAgent()) {
+		s := r.URL.Path
+		r.URL.Path = strings.Replace(s, "/stype", "", 1)
+		SignPageHandler(r)
+		return
+	}
 	sNode := service.JySeoSTypeRoot.GetNodeByCode(sType)
 	if sNode == nil {
 		service.HtmlRender.NotFound(r)

+ 1 - 2
internal/service/keyWordLetterStruct.go

@@ -4,7 +4,6 @@ import (
 	"context"
 	"fmt"
 	"github.com/gogf/gf/v2/frame/g"
-	"github.com/gogf/gf/v2/os/gctx"
 	"github.com/gogf/gf/v2/util/gconv"
 	"jyseo/utility"
 )
@@ -33,7 +32,7 @@ type (
 )
 
 func init() {
-	JySeoKeyWordLetterRoot.LoadLetterKeyWord(gctx.New())
+	//JySeoKeyWordLetterRoot.LoadLetterKeyWord(gctx.New())
 }
 
 func (sRoot *keyWordLetterRoot) LoadLetterKeyWord(ctx context.Context) {

+ 35 - 3
internal/service/signStruct.go

@@ -18,7 +18,11 @@ type (
 	SIGNRoot struct {
 		signCodeMap        map[string]*SignNode //字母code所有节点平铺
 		allProjectSignNode []*SignNode
-		CodeNameMap        *NzjCodeMap
+
+		newSignCodeMap        map[string]*SignNode
+		newAllProjectSignNode []*SignNode
+
+		CodeNameMap *NzjCodeMap
 	}
 	SignNode struct {
 		Name string `json:"name" doc:"名称"`
@@ -47,6 +51,20 @@ func (sRoot *SIGNRoot) LoadGlobalConfig(ctx context.Context) {
 		allProjectSignNode = append(allProjectSignNode, sn)
 		signCodeMap[sn.Code] = sn
 	}
+	var (
+		newSignCodeMap        = map[string]*SignNode{}
+		newAllProjectSignNode []*SignNode
+	)
+	for _, m := range g.Cfg("global").MustGet(context.Background(), "signTypeTreeNew").Maps() {
+		sn := &SignNode{
+			Name: gconv.String(m["name"]),
+			Code: gconv.String(m["code"]),
+			Id:   gconv.Int(m["signId"]),
+		}
+		newAllProjectSignNode = append(newAllProjectSignNode, sn)
+		newSignCodeMap[sn.Code] = sn
+	}
+
 	nCodeMap := &NzjCodeMap{
 		Stage:    map[string]string{},
 		Category: map[string]string{},
@@ -69,14 +87,14 @@ func (sRoot *SIGNRoot) LoadGlobalConfig(ctx context.Context) {
 			}
 		}
 	}
-
+	sRoot.newSignCodeMap = newSignCodeMap
+	sRoot.newAllProjectSignNode = newAllProjectSignNode
 	sRoot.signCodeMap = signCodeMap
 	sRoot.allProjectSignNode = allProjectSignNode
 	sRoot.CodeNameMap = nCodeMap
 }
 
 func (sRoot *SIGNRoot) GetData(ctx context.Context, maxTotal int, query *SeoBiddingQuery) []map[string]interface{} {
-
 	if query.SIGN <= 0 {
 		return nil
 	}
@@ -156,6 +174,16 @@ func (sRoot *SIGNRoot) GetData(ctx context.Context, maxTotal int, query *SeoBidd
 	return FillingBiddingBaseFields(ctx, queryRes.List(), true)
 }
 
+func (sRoot *SIGNRoot) GetAllNodeByCode(code string) (*SignNode, bool) {
+	if t, ok := sRoot.signCodeMap[code]; ok {
+		return t, false
+	}
+	if t, ok := sRoot.newSignCodeMap[code]; ok {
+		return t, true
+	}
+	return nil, false
+}
+
 func (sRoot *SIGNRoot) GetNodeByCode(code string) *SignNode {
 	return sRoot.signCodeMap[code]
 }
@@ -164,6 +192,10 @@ func (sRoot *SIGNRoot) GetAllProjectNodes() []*SignNode {
 	return sRoot.allProjectSignNode
 }
 
+func (sRoot *SIGNRoot) GetAllNewSignProjectNodes() []*SignNode {
+	return sRoot.newAllProjectSignNode
+}
+
 func (sRoot *SIGNRoot) GetEsData(ctx context.Context, maxTotal int, query *SeoBiddingQuery) []map[string]interface{} {
 	chKey := fmt.Sprintf("bidDetail_BiddingStrategy")
 	res := GetL2CacheData(BidStrategyLock, chKey, func() interface{} {

+ 1 - 0
internal/tags/init.go

@@ -80,6 +80,7 @@ func init() {
 	g.View().BindFunc("MapsSub", MapsSub)           //查询Tab数据
 	g.View().BindFunc("GetSTypeParentNodes", service.JySeoSTypeRoot.GetParentNodes)
 	g.View().BindFunc("GetAllSignProjectNodes", service.JySeoSIGNRoot.GetAllProjectNodes)
+	g.View().BindFunc("GetAllNewSignProjectNodes", service.JySeoSIGNRoot.GetAllNewSignProjectNodes)
 	g.View().BindFunc("GetSubWebDomain", GetSubWebDomain)
 	g.View().BindFunc("GetEachIndustryRandomKeyWords", service.JySeoIndustryKeyWordRoot.GetEachIndustryRandomKeyWords)
 	g.View().BindFunc("GetEnterprisesSimpleList", GetEnterprisesSimpleList)

+ 17 - 3
manifest/config/global.yaml

@@ -95,9 +95,6 @@ signTypeTree:
   - name: 拟在建项目
     code: nzjxm
     signId: 9
-  - name: 审批项目
-    code: spxm
-    signId: 10
   - name: 推荐项目
     code: tjxm
     signId: 11
@@ -117,6 +114,23 @@ signTypeTree:
     code: sjxm
     signId: 16
 
+signTypeTreeNew:
+  - name: 项目立项审批
+    code: spxm
+    signId: 10
+  - name: 采购意向
+    id: "06"
+    code: CGYX
+    signId: 5
+  - name: 国家地方重大项目
+    code: zdxm
+    signId: 1001 #手动数据
+  - name: 周期性采购项目
+    code: wydqxm
+    signId: -1
+  - name: 合约到期项目
+    code: zqcgxm
+    signId: 99  
 
 
 

+ 114 - 0
resource/template/pc/components/header-nav-second-project-new.html

@@ -0,0 +1,114 @@
+<link rel="stylesheet" href='{{Cdn}}/jyseo/css/header-nav-second.css?v={{Msg "version"}}'>
+<nav class="header-nav">
+  <div class="header-nav-second">
+    <img class="head-logo" src='{{Cdn}}/jyseo/image/icon/jy-logo.png?v={{Msg "version"}}' alt="" />
+    <div class="head-right-box padding-right">
+    {{$global := .}}
+    {{$signNode := GetAllNewSignProjectNodes}}
+    <ul class="nav-ul">
+      <li>
+        <a class="list-title" href="/" data-value="项目首页">项目首页</a>
+        <!-- <span class="line">/</span> -->
+      </li>
+      {{range $k,$v:= $signNode}}
+      <li>
+        {{$active:= false}}
+        {{if eq $global.signNode.Code $v.Code }}
+        {{ $active = true}}
+        {{end}}
+        {{if eq $v.Code "CGYX"}}
+          <a class="list-title {{if $active}} highlight-text {{end}}" href="/list/stype/{{$v.Code}}.html" data-value="{{$v.Name}}">{{$v.Name}}</a>
+        {{else}}
+          <a class="list-title {{if $active}} highlight-text {{end}}" href="/list/{{$v.Code}}/" data-value="{{$v.Name}}">{{$v.Name}}</a>
+        {{end}}
+        {{if lt $k (1 |minus ($signNode|len))}}
+        <!-- <span class="line">/</span> -->
+        {{end}}
+      </li>
+      {{end}}
+    </ul>
+    <form class="nav-search-form" id="nav-search-form" method="post" action="/jylab/supsearch/index.html" target="stop" onsubmit="return false">
+      <input class="nav-search-input" type="text" name="keywords" placeholder="请输入项目名称等关键词" autocomplete="off">
+      <div class="nav-search-icons">
+        <i class="j-icon jy-icon-search"></i>
+        <span class="splitter">/</span>
+        <i class="j-icon jy-icon-close"></i>
+      </div>
+    </form>
+  </div>
+  </div>
+</nav>
+<script>
+  /**
+   * 打开工作桌面链接
+   * @param options
+   * @param {string} [options.link] - 链接
+   * @param {string} [options.appType=iframe] - [iframe,qiankun] 打开类型
+   * @param {string} [options.openType=outer] - [_blank,replace,outer] 打开方式
+   */
+  function openWorkBenchLink (options) {
+    var workBase = '/page_workDesktop/work-bench/'
+    options.appType = options.appType || 'iframe'
+    options.openType = options.openType || 'outer'
+    var toHref = options.link
+    switch (options.appType) {
+      case 'iframe': {
+        toHref = workBase + 'page?link=' + location.origin + options.link
+        break
+      }
+      case 'qiankun': {
+        toHref = workBase + 'app' + options.link
+        break
+      }
+    }
+    switch (options.openType) {
+      case '_blank': {
+        window.open(toHref)
+        break
+      }
+      case 'replace': {
+        if (window !== window.parent) {
+          window.parent.location.replace(toHref)
+        } else {
+          location.replace(toHref)
+        }
+        break
+      }
+      case 'outer': {
+        if (window !== window.parent) {
+          window.parent.location.href = toHref
+        } else {
+          location.href = toHref
+        }
+        break
+      }
+    }
+  }
+  function onsubmit () {
+    if(!window.seoLoginModule.hasLogin()){
+      window.open('/jylab/supsearch/index.html' + '?' + $('#nav-search-form').serialize() + '&searchvalue=&selectType=title')
+    } else {
+      openWorkBenchLink({
+        link: '/jylab/supsearch/index.html' + '?' + $('#nav-search-form').serialize() + '&searchvalue=&selectType=title',
+        openType: '_blank'
+      })
+    }
+  }
+  $(function() {
+    $('.nav-search-input').focus(function() {
+      $('.nav-search-form').addClass('opened')
+      $('.jy-icon-close').click(function() {
+        $('.nav-search-form').removeClass('opened')
+        $('.nav-search-input').val('')
+      })
+    })
+    $('.nav-search-input').keydown(function(e) {
+      if (e.keyCode === 13) {
+        onsubmit()
+      }
+    })
+    $('.jy-icon-search').click(function(){
+      onsubmit()
+    })
+  })
+</script>

+ 70 - 0
resource/template/pc/project_new_sign_list.html

@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+  {{include "pc/common/meta.html" .}}
+  {{include "pc/common/tdk.html" .}}
+  {{include "pc/common/link.html" .}}
+  <link href="https://cdn-common.jianyu360.com/cdn/lib/element-ui/2.15.13-rc/lib/theme-chalk/index.css" rel="stylesheet">
+  <link href='{{Cdn}}/jyseo/css/index.css?v={{Msg "version"}}' rel="stylesheet" type="text/css" />
+
+  <script src="https://cdn-common.jianyu360.com/cdn/lib/jquery/3.6.0/jquery.min.js"></script>
+  <script src="/common-module/public/head.js"></script>
+
+</head>
+<body style="background-color: #F5F6F7;">
+  <div class="page-container">
+    <header class="page-header">
+      <!-- 顶部导航 -->
+      {{include "pc/common/header.html" .}}
+    </header>
+    <main class="page-main page-main-stype">
+      {{$global:=.}}
+      <!-- 顶部二级导航 -->
+      {{include "pc/components/header-nav-second-project-new.html" .}}
+      <section class="w page-main-container page-main-1">
+        <section class="page-main-content">
+          <div class="breadcrumb-nav">
+            <span class="label-tag">当前位置:</span>
+            <a href="/">项目首页</a>
+            <em>></em>
+            <h1 class="current-tag" style="display: inline">全国{{$global.signNode.Name}}信息</h1>
+          </div>
+          <section class="page-bidding-container">
+            {{include "pc/components/bidding-cell-sign.html" .}}
+            <div class="pagination-container">
+              {{include "pc/components/seo-pagination.html" .}}
+            </div>
+          </section>
+        </section>
+        <section class="page-main-aside">
+          <section class="section-aside area-section">
+            <!--登录注册-->
+            <div class="aside-module aside-login" data-nologin-show>
+              {{include "pc/components/login-card.html" .}}
+            </div>
+            <!--城市导航-->
+            <!--城市导航-->
+            {{if eq .areaNode.Type 1}}
+              <div class="aside-module">
+                {{include "pc/components/area-city-aside-card.html" .}}
+              </div>
+            {{end}}
+            <!-- 地区导航 -->
+            <div class="aside-module">
+              {{include "pc/components/area-aside-card.html" .}}
+            </div>
+          </section>
+        </section>
+      </section>
+    </main>
+    <footer class="page-footer">
+      {{include "pc/components/ad-bottom.html" .}}
+      {{include "pc/common/footer.html" .}}
+    </footer>
+  </div>
+  <script src="https://cdn-common.jianyu360.com/cdn/lib/bootstrap/4.5.0/bootstrap.min.js"></script>
+  <script src='{{Cdn}}/jyseo/js/common.js?v={{Msg "version"}}'></script>
+  <script src='{{Cdn}}/jyseo/js/area-stype-list-pagination.js?v={{Msg "version"}}'></script>
+  <script src='{{Cdn}}/jyseo/js/index.js?v={{Msg "version"}}'></script>
+</body>
+</html>