Răsfoiți Sursa

Merge branch 'dev4.6.2.1' of http://192.168.3.207:8080/qmx/jy into dev4.6.2.1

yangfeng 3 ani în urmă
părinte
comite
356c8099a8

+ 96 - 54
src/jfw/modules/app/src/web/staticres/jyapp/js/searchindex.js

@@ -439,73 +439,115 @@ var SuperSearch = {
       SuperSearch.dyDiv=true;
     });
 
-    //订阅
-    $("#supersearchPage #zjdy").on("tap",function(even){
-      if(userId == ""||userId == null){
-        SuperSearch.setSessionStorage();
-        window.location.href = "/jyapp/free/login?to=back";
-        return;
-      }
-      var rFlag = false;
-      if(SuperSearch.isVip || window.jyUserPower.member){
-        $.ajax({
-          type: "post",
-          url: "/publicapply/subscribe/setUserInfo",
-          data: {
-            pageType:'keyWords',
-            actionType: 'directSubKWS',
-            kws_name:SuperSearch.s_words,
-            vSwitch: vSwitch
-          },
-          // dataType: "json",
-          async: false,
-          success: function(r){
-            if(r.flag=="y"){
-              rFlag = true;
-            }else if(r.flag=="o"){
-              EasyAlert.show("您已经订阅过此关键字");
-            }else if(r.flag=="m"){
-              EasyAlert.show("您已经超过订阅<br>关键字上限");
+    // 获取用户信息-用于立即订阅按钮
+    function getKeyUserInfo () {
+      // 免费用户
+      // --> 已设置10组关键词,订阅失败提示
+      // --> 小于10组
+      //    --> 历史老用户-未选择区域-提示更新
+      //           --> -选择区域-关键词列表
+      //    --> 新用户-未选择区域-关键词列表
+
+      var isOldUser = false
+      var nowKeyLength = 8
+      var isSelectArea = false
+
+     // 获取用户关键词数据
+      $.ajax({
+        url: '/publicapply/free/subscribe',
+        type: 'post',
+        success: function (res) {
+          if (res.error_code === 0 && res.data) {
+            try {
+              isSelectArea = !!res.data.area
+              nowKeyLength = res.data.keys.length
+            } catch (e) {
+              console.warn('error format keys length')
             }
-          },error: function(){
-            rFlag = true;
           }
-        });
-        if(rFlag){
+        },
+      })
+
+      // S-直接订阅
+      $("#supersearchPage #zjdy").on("tap",function(even){
+        if(userId == ""||userId == null){
           SuperSearch.setSessionStorage();
-          window.location.href = "/jyapp/vipsubscribe/toSetKeyWordPage";
+          window.location.href = "/jyapp/free/login?to=back";
+          return;
         }
-      }else{
-        $.ajax({
-          type: "post",
-          url: "/jyapp/member/swordfish/ajaxReq",
-          data: {keys:SuperSearch.s_words,reqType: "subscribe"},
-          dataType: "json",
-          async: false,
-          success: function(r){
-            if(r.flag=="y"){
+        var rFlag = false;
+        if(SuperSearch.isVip || window.jyUserPower.member){
+          $.ajax({
+            type: "post",
+            url: "/publicapply/subscribe/setUserInfo",
+            data: {
+              pageType:'keyWords',
+              actionType: 'directSubKWS',
+              kws_name:SuperSearch.s_words,
+              vSwitch: vSwitch
+            },
+            // dataType: "json",
+            async: false,
+            success: function(r){
+              if(r.flag=="y"){
+                rFlag = true;
+              }else if(r.flag=="o"){
+                EasyAlert.show("您已经订阅过此关键字");
+              }else if(r.flag=="m"){
+                EasyAlert.show("您已经超过订阅<br>关键字上限");
+              }
+            },error: function(){
               rFlag = true;
-            }else if(r.flag=="o"){
-              EasyAlert.show("您已经超过订阅<br>关键字上限");
             }
-          },error: function(){
-            rFlag = true;
+          });
+          if(rFlag){
+            SuperSearch.setSessionStorage();
+            window.location.href = "/jyapp/vipsubscribe/toSetKeyWordPage";
           }
-        });
-        if(rFlag){
-          //JyObj.redirectKeyset();
-          if (!newUserType) {
-            $('#tipsType').show()
+        }else{
+          // 免费用户
+          isOldUser = !jyAddInfo.isUpgrade
+          if (nowKeyLength >= 10) {
+            return EasyAlert.show("您已经超过订阅<br>关键字上限");
           } else {
+            if (isSelectArea) {
+              // 执行下方原有逻辑
+            } else if (isOldUser) {
+              return $('#tipsType').show()
+            }
+          }
+
+          $.ajax({
+            type: "post",
+            url: "/jyapp/member/swordfish/ajaxReq",
+            data: {keys:SuperSearch.s_words,reqType: "subscribe"},
+            dataType: "json",
+            async: false,
+            success: function(r){
+              if(r.flag=="y"){
+                rFlag = true;
+              }else if(r.flag=="o"){
+                EasyAlert.show("您已经超过订阅<br>关键字上限");
+              }
+            },
+            error: function(){
+              rFlag = true;
+            }
+          });
+          if(rFlag){
             SuperSearch.setSessionStorage();
             setTimeout(function(){
-              window.location.href = "/jyapp/wxkeyset/keyset/index";
+              window.location.href = "/jyapp/vipsubscribe/toSetKeyWordPage";
             },100);
           }
         }
-      }
-    });
-    //订阅结束==========================================================================
+      });
+      // E-直接订阅
+    }
+
+    getKeyUserInfo()
+
+
     //删除历史搜索
     $("#supersearchPage").on("click", " #del_history", function(){
       if(localStorage){

+ 1 - 1
src/jfw/modules/app/src/web/templates/weixin/historypush.html

@@ -1612,7 +1612,7 @@ function hasNoData() {
   //
   function appendList(content) {
       content.children(".tslist").on("click", function (event) {
-        if (!window.userNewType) {
+        if (!window.userNewType&&!(vm.rootInfo.vipStatus>0||vm.rootInfo.memberStatus>0)) {
             $('#tipsType').show()
           } else {
             $('#tipsType').hide()

+ 10 - 15
src/jfw/modules/app/src/web/templates/weixin/search/mainSearch.html

@@ -729,7 +729,7 @@
     var distance = {{Msg "seo" "distance"}};
     var member_status;
     var isMember = false;
-    var vSwitch = 'v'
+    var vSwitch = 'f'
     // 消息总数
     try {
         checkMsgCount(true, 0)
@@ -737,25 +737,20 @@
         console.log(e)
     }
     // 子账户判断
+    window.jyAddInfo = {
+        isUpgrade: false
+    }
     $.ajax({
         type:'POST',
         url:'/bigmember/use/isAdd?t' + new Date().getTime(),
         success: function (r) {
             if (r && r.data) {
-                $.ajax({
-                    url: '/publicapply/subscribe/vipSwitch',
-                    type: 'POST',
-                    success: function(res) {
-                        if(res.error_code == 0) {
-                            vSwitch = res.data.vt
-                            if(vSwitch == 'm' && r.data.isSubCount) {
-                                $('#resbm').hide()
-                            } else {
-                                $('#resbm').show()
-                            }
-                        }
-                    }
-                })
+                window.jyAddInfo = r.data
+                if(res.data.memberStatus > 0 && r.data.isSubCount) {
+                    $('#resbm').hide()
+                } else {
+                    $('#resbm').show()
+                }
                 if (r.data.isSubCount) {
                     $("#mainSearch-tab4").attr('data-sub','true')
                 }

+ 1 - 0
src/jfw/modules/bigmember/src/service/use/use.go

@@ -612,6 +612,7 @@ func (u *Use) IsAdd() {
 		d["viper"] = bigPower.Vip_BuySet.Upgrade == 1
 		d["isSubCount"] = bigPower.Pid != ""
 		d["is_member_trial"] = bigPower.HasTrial
+		d["entniche"] = false                       //是否是商机管理用户
 		d["freeEntPort"] = bigPower.FreeEntPort     //免费用户可查看企业画像次数
 		d["freeBuyerPort"] = bigPower.FreeBuyerPort //免费用户可查看采购单位画像次数
 		d["freeFile"] = bigPower.FreeFile           //免费用户可以进行附件下载次数

+ 4 - 1
src/jfw/modules/publicapply/src/subscribe/entity/entity.go

@@ -63,7 +63,10 @@ func (this *ParamInfo) SetAreaByOneProvince() (b bool) {
 			"o_jy.i_newfree": 1, //老免费用户=>新订阅设置页面 20211122
 		}
 		if len(areas) == 1 {
-			setMap["o_jy.o_area"] = areas //设置地区
+			//设置地区
+			setMap["o_jy.o_area"] = map[string]interface{}{
+				areas[0]: []string{},
+			}
 		}
 		if db.Mgo.UpdateById("user", this.UserId, map[string]interface{}{"$set": setMap}) {
 			jy.ClearBigVipUserPower(this.UserId)

+ 10 - 2
src/jfw/modules/publicapply/src/subscribePush/entity/setting.go

@@ -129,14 +129,22 @@ func IsCanSet(userId string, areamap map[string]interface{}) (bool, bool, int) {
 		areacount = qutil.IntAll(o_buyset_p["areacount"]) //-1 全国无限制
 		myareamap = *qutil.ObjToMap(o_jy["o_area_p"])
 	}
+	myareabool := map[string]bool{}
+	areasize := 0
+	//库中地区
 	for oak, _ := range myareamap {
+		myareabool[oak] = true
 		myarea = append(myarea, oak)
 	}
+	//参数地区
 	for sak, _ := range areamap {
+		if myareabool[sak] {
+			areasize += 1
+		}
 		setarea = append(setarea, sak)
 	}
-	if areaSort(setarea) == areaSort(myarea) {
-		log.Println(setarea, "-地区选择前后一致-", myarea)
+	if areaSort(setarea) == areaSort(myarea) || areasize == len(setarea) {
+		log.Println(setarea, "-地区选择前后一致或地区调整在已选择地区范围内-", myarea)
 		return true, qutil.IntAll(o_jy["i_ppstatus"]) > 0, areacount
 	}
 	// log.Println(areaSort(setarea) == areaSort(myarea), "---areacount:", areacount)

+ 1 - 4
src/web/staticres/common-module/vipsubscribe/css/vip-subscribe-set-template.css

@@ -495,7 +495,7 @@
   border-radius: 0.08rem 0.08rem 0.08rem 0.08rem;
   font-size: 0.32rem;
   font-weight: 500;
-  color: #C0C4CC;
+  color: #5f5e64;
   line-height: 0.8rem;
   text-align: center;
 }
@@ -520,9 +520,6 @@
   background-size: 100% 100%;
   z-index: 2;
 }
-.thisChange {
-  color:#5f5e64 !important;
-}
 @keyframes bottomUp {
   0% {
     transform: translateY(100%);

+ 29 - 88
src/web/staticres/common-module/vipsubscribe/js/vip-subscribe-set-template.js

@@ -159,14 +159,14 @@ var subScribeTemplate = `
         <div class="close-btn" @click="closeInfoType"></div>
       </div>
       <div class="menu-content">
-        <div class="infoType-btn" @click="changeBtnType('全部')" :class="infoTypeData.indexOf('全部') !== -1 ? 'infoTypeActive' : ''">全部</div>
+        <div class="infoType-btn" @click="changeBtnType('all')" :class="infoTypeData.length === 0 ? 'infoTypeActive' : ''">全部</div>
         <div v-for="(item, index) in infoTypeList" :key="index" class="infoType-item">
           <div class="infoType-btn" @click="changeBtnType(item.value)" :class="infoTypeData.indexOf(item.value) !== -1 ? 'infoTypeActive' : ''">{{item.title}}</div>
           <div class="infoType-msg">{{item.desc}}</div>
         </div>
       </div>
       <div class="bottom-btn-wrap">
-        <div class="bottom-btn cancel" @click="reset" :class="isChange?'thisChange':''">重置</div>
+        <button class="bottom-btn cancel" @click="reset" :disabled="infoTypeData.length === 0">重置</button>
         <div class="bottom-btn enter" @click="confirm">确认</div>
       </div>
     </div>
@@ -255,8 +255,7 @@ var subComponent = {
       userType: false, // 用户是否为付费用户
       userAreaAllNum: 1, // 用户可修改地区总次数
       infoTypeMenu: false, // 信息类型弹窗状态
-      infoTypeData: ['全部'], // 信息类型选择列表
-      isChange: false, // 信息类型是否做过更改
+      infoTypeData: [], // 信息类型选择列表
       conf: {}, // 信息类型数据
       noAreaFreeType: false, // 免费用户未设置地区时显示弹窗
       backTipShowCount: 0, // 离开页面展示弹窗次数
@@ -288,7 +287,6 @@ var subComponent = {
       }
     },
     vSwitch: function (val) {
-      sessionStorage.setItem('infoTypeVswitch', val)
       if (val === 'f') {
         this.getUserSubscribe()
       }
@@ -730,25 +728,31 @@ var subComponent = {
     },
     // 重置信息类型
     reset: function () {
-      if (this.isChange) {
-        this.infoTypeData = ['全部']
-        this.isChange = false
-      }
+      this.infoTypeData = []
     },
     // 确认信息类型
     confirm: function () {
       this.infoTypeMenu = false
-      // var callback = utils.getParam('callback')
-      // 如果有callback,则使用页面内部自己定义的方法来恢复和保存数据
-      if (true) {
-          try {
-              custom['_setting_save'](this.infoTypeData)
-          } catch (error) {
-              console.log(error)
+      this.saveInfoTypeChange()
+    },
+    saveInfoTypeChange: function () {
+      var _this = this
+      $.ajax({
+        type:'POST',
+        url:'/publicapply/subscribe/setUserInfo',
+        data: {
+          pageType: 'infoType',
+          infoTypeArr: this.infoTypeData.join(','),
+          vSwitch: this.vSwitch
+        },
+        success:function(res){
+          if(res.flag) {
+            location.reload()
+          } else {
+            _this.$toast(res.data.error_msg)
           }
-      } else {
-          setInfoTypeFn.saveToSessionStorage(this.infoTypeData)
-      }
+        }
+      })
     },
     // 关闭信息类型菜单
     closeInfoType: function () {
@@ -756,23 +760,15 @@ var subComponent = {
     },
     // 点击按钮改变按钮状态
     changeBtnType: function (item) {
-      this.isChange = true
-      let thisIndex = this.infoTypeData.indexOf(item)
-      let allType = this.infoTypeData.indexOf('全部')
-      if (allType !== -1) {
-        this.infoTypeData.splice(allType,1)
-      }
-      if (item === '全部') {
-        this.infoTypeData = ['全部']
+      if (item === 'all') {
+        this.infoTypeData = []
       } else {
+        let thisIndex = this.infoTypeData.indexOf(item)
         if (thisIndex !== -1) {
-          this.infoTypeData.splice(thisIndex,1)
+          this.infoTypeData.splice(thisIndex, 1)
         } else {
           this.infoTypeData.push(item)
         }
-        if (this.infoTypeData.length === 0 || this.infoTypeData.length === this.infoTypeList.length) {
-          this.infoTypeData = ['全部']
-        }
       }
     },
     // 跳转地区选择
@@ -798,8 +794,8 @@ var subComponent = {
               _this.userType = res.data.provincenum === 0 ? false : true
               _this.userAreaAllNum = res.data.provincenum
               _this.initdata.infotype = res.data.infotype || []
-              _this.info.infoType = _this.initdata.infotype.join('、')
-              // _this.$emit('UserSubscribe',res)
+              _this.infoTypeData = res.data.infotype || []
+              _this.info.infoType = _this.infoTypeData.length === 0 ? '全部类型' : _this.infoTypeData.join('、')
 
               // let proStr = ''
               // Object.keys(res.data.area).forEach(function(item,index) {
@@ -832,7 +828,6 @@ var subComponent = {
                 }
               }
               $('#menuArea').text('已选:'+ areaArr.join('、'))
-              _this.info.infoType = sessionStorage.getItem('thisUserInfoType')
           }
       })
     },
@@ -922,57 +917,3 @@ var subComponent = {
     },
   },
 }
-
-var setInfoTypeFn = {
-  conf: {
-      sKey: 'big-setInfoType'
-  },
-  init: function () {
-      var setKey = ''
-      if (setKey) {
-          this.conf.sKey = setKey
-      }
-
-      var initData = sessionStorage.getItem(this.conf.sKey)
-      if (initData) {
-          initData = JSON.parse(initData)
-          console.log(initData)
-          // vNode.data.initInfoType = initData
-          // vueComponent.setInfoTypeState(vNode.data.initInfoType)
-      }
-  },
-  saveToSessionStorage: function (data) {
-      sessionStorage.setItem(this.conf.sKey, JSON.stringify(data))
-  }
-}
-
-var custom = {
-  _setting_save: function (setdata) {
-      if(setdata.length == 0) {
-          setdata = ''
-      } else {
-          setdata = setdata.join(',')
-      }
-      sessionStorage.setItem('thisUserInfoType', setdata)
-      let vswitch = sessionStorage.getItem('infoTypeVswitch')
-      $.ajax({
-          type:'POST',
-          url:'/publicapply/subscribe/setUserInfo',
-          data: {
-              pageType: 'infoType',
-              infoTypeArr: setdata,
-              vSwitch: vswitch
-          },
-          success:function(res){
-            sessionStorage.removeItem('infoTypeVswitch')
-              if(res.flag) {
-                  sessionStorage.removeItem('big-setInfoType')
-                  location.reload()
-              } else {
-                  vueComponent.$toast(res.data.error_msg)
-              }
-          }
-      })
-  }
-}
-setInfoTypeFn.init()

+ 93 - 46
src/web/staticres/js/wxSupersearch.js

@@ -10,11 +10,9 @@ function getUserType() {
       type: 'POST',
       url: '/publicapply/subscribe/vipSwitch',
       success: function(res) {
-          if (res.data.vt !== 'v' ) {
-              vSwitch = 'f'
-          } else {
-              vSwitch = 'v'
-          }
+        if (res && res.data) {
+          vSwitch = res.data.vt || 'f'
+        }
       }
   })
 }
@@ -28,11 +26,16 @@ function gotoPay() {
 }
 // 获取用户是否为新用户
 function getUserNewType() {
+  window.jyAddInfo = {
+    isUpgrade: false
+  }
   $.ajax({
       url: '/bigmember/use/isAdd',
       type: 'POST',
-      success: function (res) {
-        newUserType = res.data.isUpgrade
+      success: function (r) {
+        if (r && r.data) {
+          window.jyAddInfo = r.data
+        }
       }
   })
 }
@@ -50,7 +53,7 @@ function updateJump2() {
       location.href = '/front/vipsubscribe/toSubVipSetPage'
     }
   })
-  
+
 }
 var nowClientHeight = document.documentElement.clientHeight || document.body.clientHeight
 // 监听banner高度变化
@@ -420,18 +423,52 @@ var SuperSearch = {
       SuperSearch.dyDiv=true;
     });
 
-    //订阅
+        // 获取用户信息-用于立即订阅按钮
+    function getKeyUserInfo () {
+      // 免费用户
+      // --> 已设置10组关键词,订阅失败提示
+      // --> 小于10组
+      //    --> 历史老用户-未选择区域-提示更新
+      //           --> -选择区域-关键词列表
+      //    --> 新用户-未选择区域-关键词列表
+
+      var isOldUser = false
+      var nowKeyLength = 8
+      var isSelectArea = false
+
+     // 获取用户关键词数据
+      $.ajax({
+        url: '/publicapply/free/subscribe',
+        type: 'post',
+        success: function (res) {
+          if (res.error_code === 0 && res.data) {
+            try {
+              isSelectArea = !!res.data.area
+              nowKeyLength = res.data.keys.length
+            } catch (e) {
+              console.warn('error format keys length')
+            }
+          }
+        },
+      })
+
+      // S-直接订阅
     $("#supersearchPage #zjdy").on("tap",function(){
       var rFlag = false;
       if (SuperSearch.s_words==""){
         SuperSearch.s_words=$.trim($("#supersearchPage [name='super_searchinput']").val());
         SuperSearch.s_words=SuperSearch.s_words.replace(/\s+/g," ");
       }
-      if(SuperSearch.isVip){
+      if(SuperSearch.isVip ||  window.jyUserPower.member){
         $.ajax({
           type: "post",
-          url: "/subscribepay/afterPay/directSubKWS",
-          data: {keys:SuperSearch.s_words},
+          url: "/publicapply/subscribe/setUserInfo",
+          data: {
+            pageType:'keyWords',
+            actionType: 'directSubKWS',
+            kws_name:SuperSearch.s_words,
+            vSwitch: vSwitch
+          },
           dataType: "json",
           async: false,
           success: function(r){
@@ -451,6 +488,17 @@ var SuperSearch = {
           window.location.href = "/front/vipsubscribe/toSetKeyWordPage";
         }
       }else{
+      // 免费用户
+          isOldUser = !jyAddInfo.isUpgrade
+          if (nowKeyLength >= 10) {
+            return EasyAlert.show("您已经超过订阅<br>关键字上限");
+          } else {
+            if (isSelectArea) {
+              // 执行下方原有逻辑
+            } else if (isOldUser) {
+              return $('#tipsType').show()
+            }
+          }
         $.ajax({
           type: "post",
           url: "/member/swordfish/ajaxReq",
@@ -468,16 +516,15 @@ var SuperSearch = {
           }
         });
         if(rFlag){
-          if (!newUserType) {
-            $('#tipsType').show()
-          } else {
             SuperSearch.setSessionStorage();
-            window.location.href = "/wxkeyset/keyset/index";
-          }
+            window.location.href = "/front/vipsubscribe/toSetKeyWordPage";
         }
       }
     });
-    //订阅结束==========================================================================
+      // E-直接订阅
+    }
+
+    getKeyUserInfo()
     //删除历史搜索
     $("#supersearchPage").on("click", " #del_history", function(){
       if(localStorage){
@@ -1377,26 +1424,26 @@ var SuperSearch = {
       $(".newdialog .sub-show-list").find("li[dataval='showlist']").addClass("active");
     }
     var IframeOnClick = {
-      resolution: 200,  
-      iframes: [],  
-      interval: null,  
-      Iframe: function() {  
-          this.element = arguments[0];  
-          this.cb = arguments[1];   
-          this.hasTracked = false;  
-      },  
-      track: function(element, cb) {  
-          this.iframes.push(new this.Iframe(element, cb));  
-          var _this = this;  
-              this.interval = setInterval(function() { _this.checkClick(); }, this.resolution);  
-      },  
-      checkClick: function() {  
-          if (document.activeElement) {  
-              var activeElement = document.activeElement;  
-              for (var i in this.iframes) {  
-                  if (activeElement === this.iframes[i].element) { // user is in this Iframe  
-                      if (this.iframes[i].hasTracked == false) {   
-                          this.iframes[i].cb.apply(window, []);   
+      resolution: 200,
+      iframes: [],
+      interval: null,
+      Iframe: function() {
+          this.element = arguments[0];
+          this.cb = arguments[1];
+          this.hasTracked = false;
+      },
+      track: function(element, cb) {
+          this.iframes.push(new this.Iframe(element, cb));
+          var _this = this;
+              this.interval = setInterval(function() { _this.checkClick(); }, this.resolution);
+      },
+      checkClick: function() {
+          if (document.activeElement) {
+              var activeElement = document.activeElement;
+              for (var i in this.iframes) {
+                  if (activeElement === this.iframes[i].element) { // user is in this Iframe
+                      if (this.iframes[i].hasTracked == false) {
+                          this.iframes[i].cb.apply(window, []);
                           this.iframes[i].hasTracked = true;
                           $.ajax({
                               type: 'POST',
@@ -1410,15 +1457,15 @@ var SuperSearch = {
                                   console.log(res)
                               }
                           })
-                      }  
-                  } else {  
-                      this.iframes[i].hasTracked = false;  
-                  }  
-              }  
-          }  
-      }  
+                      }
+                  } else {
+                      this.iframes[i].hasTracked = false;
+                  }
+              }
+          }
+      }
   };
-    
+
     $.ajax({
       type: "post",
       url: "/swordfish/searchlist/paging",

+ 1 - 1
src/web/templates/weixin/historypush.html

@@ -1762,7 +1762,7 @@
       //
       function appendList(content) {
           content.children(".tslist").on("click", function () {
-            if (!userNewType) {
+            if (!userNewType&&window.isFreeUserStatus) {
                 $('#tipsType').show()
             } else {
                 $('#tipsType').hide()