Browse Source

feat:公告页、企业搜索权限判断跳转

yangfeng 3 years ago
parent
commit
f3e7a1b1f5

+ 26 - 4
src/web/staticres/js/ent-search-index-pc.js

@@ -508,12 +508,34 @@ var vm = new Vue({
             var svipLink = '/swordfish/page_big_pc/svip/ent_ser_portrait/' + id
             // 大会员画像
             var memberLink = '/swordfish/page_big_pc/ent_portrait/' + id
-
+            console.log(window.memberStatus, this.powerInfo.vip)
             if (this.powerInfo.member) {
-                if (this.powerInfo.vip > 0) {
-                    window.open(svipLink)
+                // 如果是专家版、智慧版 跳大会员页面
+                if (window.memberStatus <= 2) {
+                  window.open(memberLink)
                 } else {
-                    window.open(memberLink)
+                  // 如果是商机版、自定义版
+                  // 如果同时是超级订阅 判断有没有画像查看次数
+                  if (this.powerInfo.vip > 0) {
+                    $.ajax({
+                      type: "POST",
+                      url: "/bigmember/portrait/subVipPortrait/usage",
+                      data: {
+                        entId: id
+                      },
+                      success: function(r){
+                        // 如果次数已用完 跳大会员企业画像页面
+                        if (r.data.usage >= r.data.total) {
+                          window.open(memberLink)
+                        } else {
+                          // 没用完 超级订阅跳企业画像页面
+                          window.open(svipLink)
+                        }
+                      }
+                    });
+                  } else {
+                      window.open(memberLink)
+                  }
                 }
             } else {
                 window.open(svipLink)

+ 2 - 0
src/web/staticres/js/login.js

@@ -295,6 +295,8 @@ function checkBigStatus () {
     success: function (res) {
       if (res && res.data) {
         window.memberStatus = res.data.memberStatus
+        window.memberPower = res.data.power
+        window.vipStatus = res.data.vipStatus
         sessionStorage.setItem('bidPower', JSON.stringify(res.data.power))
         if (res.data.memberStatus > 0) {
           $(".myorderDiv.lastBox").show()

+ 16 - 30
src/web/templates/pc/biddetail_rec.html

@@ -689,7 +689,7 @@ function isWechat() {
                   {{end}} -->
                   <div class="cont-cont portrait_img" {{if .T.obj.entId}} tip-data="查看企业画像"{{end}}>{{.T.obj.winner}}</div>
                   <div class="cont-recy" onclick="recoveryerr(this,'winner','')">纠错</div>
-                  <div class="portrait_img only-text">{{if .T.obj.winner}}立即查看{{end}}</div>
+                  <div class="portrait_img only-text" {{if .T.obj.entId}} tip-data="查看企业画像"{{end}}>{{if .T.obj.winner}}立即查看{{end}}</div>
                   <div style="display:none;"></div>
                 </div>
                 {{else}}
@@ -848,25 +848,13 @@ function isWechat() {
 				</div>
 			</div>
 			<script>
-        var isMember = {{.T.isMember}}
-		$.ajax({
-			type:"GET",
-			url:'/bigmember/use/isAdd',
-			success:function(res){
-				if(res && res.data) {
-					if (res.data.memberStatus <= 0 || res.data.power.indexOf(3) == -1) {
-            window.isMember = false
-            window.memberStatus = res.data.memberStatus
-					}
-				}
-			}
-		})
         function goDownload(url) {
+          console.log(window.memberPower, '11')
           if (!loginflag) {
             openLoginDig()
             return
           }
-          if (isMember) {
+          if (window.memberPower.indexOf(3) > -1) {
             location.href = url
           } else {
             // vm.dialogTitle = '请完善个人信息,免费下载附件,发现商机!'
@@ -887,7 +875,6 @@ function isWechat() {
                 html += "<div class='downs'>"+"<a class='menu_list' style='text-decoration:underline;color: #2CB7CA' onclick='goDownload(\""+data.data.attachment[i].downurl+"\")'>"+(i+1)+"."+data.data.attachment[i].filename+"</a></div>"
 							}
 							if(html!==""){
-								console.log(html)
 								$("#attach-list").css("display","").find(".download-list").html(html)
               }
 						}
@@ -2532,15 +2519,18 @@ $(function(){
 		}
 	}).on("click",function (){
     var toHref=$(this).attr("href-data") || $(this).parents('.tab-cont').children('.cont-cont.portrait_img').attr("href-data")
-    var href1 = "/swordfish/page_big_pc/ent_portrait/{{.T.obj.entId}}"
-    var href2 = "/swordfish/page_big_pc/svip/ent_ser_portrait/{{.T.obj.entId}}"
-    var isMember = {{.T.isMember}} // 大会员
-    var isVip = {{.T.isVip}} // 超级订阅
+    var memberLink = "/swordfish/page_big_pc/ent_portrait/{{.T.obj.entId}}"
+    var vipLink = "/swordfish/page_big_pc/svip/ent_ser_portrait/{{.T.obj.entId}}"
+    if ($(this).attr("tip-data") == '查看采购单位画像') {
+      if (toHref){
+        window.open(toHref)
+        return
+      }
+    }
     if (isMember) {
       // 如果是专家版、智慧版 跳大会员页面
       if(window.memberStatus <=2) {
-        window.open(href1)
-        return
+        window.open(memberLink)
       } else {
         // 如果是商机版、自定义版
         // 如果同时是超级订阅 判断有没有画像查看次数
@@ -2554,28 +2544,24 @@ $(function(){
             success: function(r){
               // 如果次数已用完 跳大会员企业画像页面
               if (r.data.usage >= r.data.total) {
-                window.open(href1)
+                window.open(memberLink)
               } else {
                 // 没用完 超级订阅跳企业画像页面
-                window.open(href2)
+                window.open(vipLink)
               }
             }
           });
         } else {
           // 不是超级订阅用户跳大会员企业画像页面
-          window.open(href1)
+          window.open(memberLink)
         }
       }
     } else {
       // 非大会员用户跳超级订阅企业画像页面
-      window.open(href2)
+      window.open(vipLink)
     }
-		// if (toHref){
-		// 	window.open(toHref)
-		// }
 	})
 })
-//
 function companyAdd(){
 	if(s_winner){
         var winner_con = $(".winner");