Explorar o código

fix: 修复移动端三级页留资问题

zhangyuhan %!s(int64=3) %!d(string=hai) anos
pai
achega
475c6d79f7

+ 52 - 0
src/jfw/modules/app/src/web/staticres/jyapp/js/common.js

@@ -1673,3 +1673,55 @@ function newVersionUpdateLog(event,new_version){
 	})
 
 }
+
+/**
+ * 根据keys校验object必填项
+ * @param {Array} keys - 待校验字段keys
+ * @param {Object} target - 待校验object
+ * @returns {boolean} - 是否通过
+ */
+function checkRequiredKeys (keys, target) {
+  try {
+    return !keys.some(function (k) {
+      var tempValue = target[k]
+      var result = false
+      if (typeof tempValue === 'number') {
+        tempValue = tempValue.toString()
+      }
+      if (typeof tempValue === 'string') {
+        result = tempValue.trim() !== ''
+      }
+      if (typeof tempValue === 'boolean') {
+        result = true
+      }
+      return !result
+    })
+  } catch (e) {
+    console.warn(e)
+    return false
+  }
+}
+
+/**
+ * 根据keys覆盖object必填项
+ * @param {Object}target - 指定需替换的object
+ * @param {Object}now - 数据来源object
+ * @param {Array}[keys] - 指定需替换的keys
+ * @returns {Object} - 替换后的object,需注意target已被替换
+ */
+function echoRequiredValues (target, now, keys) {
+  try {
+    Object.keys(now).forEach(function (k) {
+      if (keys && keys.indexOf(k) === -1) {
+        return
+      }
+      if (target.hasOwnProperty(k)) {
+        target[k] = JSON.parse(JSON.stringify(now[k]))
+      }
+    })
+    return target
+  } catch (e) {
+    console.warn(e)
+    return {}
+  }
+}

+ 9 - 6
src/jfw/modules/app/src/web/templates/weixin/wxinfocontent.html

@@ -1170,7 +1170,7 @@
             }
         })
     }
-    
+
 
     function getNewEntRoot () {
       $.ajax({
@@ -1221,16 +1221,20 @@
     }
     //是否显示遮罩层
     function checkShowDialog () {
-        
+
         if (subtype == '采购意向') {
             $('#dialog-tip-title').text('想中标?提前介入很关键!')
             $(".dialog-tip-text").html('采购意向项目全公开,抢先获知采购项目需求,<br> 提前主动介入,中标几率更高!')
         }
-        if (canRead== false){
+        if (!canRead){
             $('#dialog-tip-title').text('免费查看更多公告')
             $(".dialog-tip-text").html('请完善个人信息,获取更多免费查看公告权限')
+            $(".free-btn-reword").text('立即解锁')
+            $(".tab-ct").hide()
+            $(".atta-list").hide()
+            $(".abs").hide()
         }
-        if (subtype == '拟建'||subtype == '采购意向' || canRead== false) {
+        if (subtype == '拟建'||subtype == '采购意向' || !canRead) {
             $(".prebuilt").remove()
             $(".mask-zz").removeClass("hidden");
         } else {
@@ -1248,9 +1252,8 @@
         if (subType == '采购意向') {
             sourceKey = 'article_purchase_intention'
         }
-        if( canRead ==false) {
+        if(!canRead) {
             sourceKey ="jyarticle_see3_plus_app"
-            location.href = '/jyapp/frontPage/bigmember/free/perfect_info?source=jyarticle_see3_plus_app'
         }
         //  留资判断
         location.href = '/jyapp/frontPage/bigmember/free/perfect_info?source=' + sourceKey

+ 11 - 10
src/web/staticres/common-module/keep-tags/keep-tags-template.js

@@ -22,7 +22,7 @@ var tempStyleComponent = `<style>
     }
     .van-dialog.ent-search-dialog.add-close-after .van-dialog__content {
         position: relative;
-        pointer-events: none; 
+        pointer-events: none;
     }
     .van-dialog.ent-search-dialog.add-close-after .van-dialog__content::after {
         content: "";
@@ -52,22 +52,22 @@ var tempStyleComponent = `<style>
       color: #171826;
       z-index: 2031 !important;
     }
-    
+
     .z-2030 {
         z-index: 2030 !important;
     }
-    
+
     .van-dialog.ent-search-dialog .van-dialog__content .van-dialog__message {
       text-align: left;
     }
-    
+
     .van-dialog.ent-search-dialog .van-dialog__confirm,
     .van-dialog.ent-search-dialog .van-dialog__cancel {
       font-size: 0.36rem;
       line-height: 0.52rem;
       color: #171826;
     }
-    
+
     .van-dialog.ent-search-dialog .van-dialog__confirm {
       color: #2ABED1;
     }
@@ -408,12 +408,13 @@ Vue.component('keep-component', {
       }
       if (type) {
         $.post('/salesLeads/retainedCapital', { source: 'article_collection' }).done(function (r) {
+          var checkKeys = ['name', 'phone', 'company', 'mail', 'branch', 'position']
+          var result = checkRequiredKeys(checkKeys, r.info)
           // 判断当前信息否在其他页面留资  如果全部留资 直接弹窗提交成功
-          if(r.info.branch && r.info.company && r.info.name && r.info.phone && r.info.position){
-            tempFn()
-            return true
+          if (result) {
+            return tempFn()
           }
-          if (r && r.error_msg === '' && r.data) {
+          if (r && r.data) {
             if (r.data.retainedCapital) {
               _this.$dialog.close()
               _this.$dialog.confirm({
@@ -604,4 +605,4 @@ $(function () {
         }
       }, false);
     }
-})
+})

+ 53 - 2
src/web/staticres/js/common.js

@@ -367,7 +367,7 @@ function getUrlParam(name){
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r != null)
-		return unescape(r[2]); 
+		return unescape(r[2]);
 	return null;
 }
 
@@ -616,4 +616,55 @@ $(function(){
 			$target.trigger("tap");
 	    });
 	}
-});
+});
+/**
+ * 根据keys校验object必填项
+ * @param {Array} keys - 待校验字段keys
+ * @param {Object} target - 待校验object
+ * @returns {boolean} - 是否通过
+ */
+function checkRequiredKeys (keys, target) {
+  try {
+    return !keys.some(function (k) {
+      var tempValue = target[k]
+      var result = false
+      if (typeof tempValue === 'number') {
+        tempValue = tempValue.toString()
+      }
+      if (typeof tempValue === 'string') {
+        result = tempValue.trim() !== ''
+      }
+      if (typeof tempValue === 'boolean') {
+        result = true
+      }
+      return !result
+    })
+  } catch (e) {
+    console.warn(e)
+    return false
+  }
+}
+
+/**
+ * 根据keys覆盖object必填项
+ * @param {Object}target - 指定需替换的object
+ * @param {Object}now - 数据来源object
+ * @param {Array}[keys] - 指定需替换的keys
+ * @returns {Object} - 替换后的object,需注意target已被替换
+ */
+function echoRequiredValues (target, now, keys) {
+  try {
+    Object.keys(now).forEach(function (k) {
+      if (keys && keys.indexOf(k) === -1) {
+        return
+      }
+      if (target.hasOwnProperty(k)) {
+        target[k] = JSON.parse(JSON.stringify(now[k]))
+      }
+    })
+    return target
+  } catch (e) {
+    console.warn(e)
+    return {}
+  }
+}

+ 12 - 9
src/web/templates/weixin/wxinfocontent_rec.html

@@ -1634,11 +1634,15 @@ function checkShowDialog () {
 		$('#dialog-tip-title').text('想中标?提前介入很关键!')
 		$(".dialog-tip-text").html('采购意向项目全公开,抢先获知采购项目需求,<br> 提前主动介入,中标几率更高!')
 	}
-	if (canRead==false ){
-            $('#dialog-tip-title').text('免费查看更多公告')
-            $(".dialog-tip-text").html('请完善个人信息,获取更多免费查看公告权限')
-        }
-	if (subtype == '拟建'||subtype == '采购意向'|| canRead==false) {
+	if (!canRead){
+      $('#dialog-tip-title').text('免费查看更多公告')
+      $(".dialog-tip-text").html('请完善个人信息,获取更多免费查看公告权限')
+      $(".free-btn-reword").text('立即解锁')
+      $(".tab-ct").hide()
+      $(".atta-list").hide()
+      $(".abs").hide()
+  }
+	if (subtype == '拟建'||subtype == '采购意向'|| !canRead) {
 		$(".prebuilt").remove()
 		$(".mask-zz").removeClass("hidden");
     $(".reward").hide();
@@ -1657,10 +1661,9 @@ $('.free-btn-reword').on('click', function() {
 	if (subType == '采购意向') {
 		sourceKey = 'article_purchase_intention'
 	}
-	if( canRead==false) {
-		sourceKey ="jyarticle_see3_plus_wx"
-            location.href = '/jyapp/frontPage/bigmember/free/perfect_info?source=jyarticle_see3_plus_wx'
-        }
+	if(!canRead) {
+    sourceKey = "jyarticle_see3_plus_wx"
+  }
 	//  留资判断
 	location.href = '/weixin/frontPage/bigmember/free/perfect_info?source=' + sourceKey
 })