Bläddra i källkod

feat: pc用户留资成功执行原有操作

yangfeng 4 år sedan
förälder
incheckning
f22448c74d

+ 20 - 39
src/web/staticres/js/pc-collect-user-info.js

@@ -242,7 +242,6 @@ var vm = new Vue({
       }
     }
     var validJob = function(rule,value,callback) {
-      console.log(value, '职位', vm.form.otherJob)
       if(value === '') {
         return callback(new Error('职位不能为空'));
       } else {
@@ -327,7 +326,8 @@ var vm = new Vue({
       showForm: false,  // 显示表单填写弹框
       showSuccess: false, // 显示提交成功弹框
       isForce: false, // 是否强制
-      source: '' // 来源模块
+      source: '', // 来源模块
+      curDom: null
     }
   },
   computed: {
@@ -372,7 +372,7 @@ var vm = new Vue({
       this.$refs['ruleForm'].clearValidate(['job','otherJob']);
     },
     // 是否留资
-    isNeedSubmit: function(source, callback) {
+    isNeedSubmit: function(source, callback, dom) {
       /*
         三级页-阅读原文	article_original
         三级页-收藏	article_collection
@@ -388,9 +388,11 @@ var vm = new Vue({
         },
         success:function (res) {
           if (res.data) {
+            window.isRetained = res.data.retainedCapital
             if (res.data.retainedCapital) {
               _this.showForm = true
               _this.getOldInfo()
+              _this.curDom = dom
             } else {
               callback && callback()
             }
@@ -413,40 +415,6 @@ var vm = new Vue({
     },
     // 表单提交请求
     formAjax: function(source) {
-      /*
-        var params;
-        if (this.form.mold == '公司') {
-          params = {
-            source: source, // 来源模块
-            name: this.form.name,
-            phone: this.form.phone, // 手机号
-            mail: this.form.mail, // 邮箱
-            province: this.form.region[0],
-            city: this.form.region[1] ? this.form.region[1] : '',
-            industry: this.form.industry.join('_'), // 行业值
-            hireType: this.form.mold, // 受雇类型值
-            company: this.form.companyName, // 公司名称
-            companyType: this.form.companyType.join(','), // 公司类型值
-            position: this.form.job == '其他' ? this.form.otherJob : this.form.job, // 职位值
-            company_size: this.form.scale, // 公司规模
-            workScope: this.form.business, // 业务范围
-            partnerNeeds: this.form.need, // 合作需求
-            agree: true
-          }
-        } else {
-          params = {
-            source: source, // 来源模块
-            name: this.form.name,
-            phone: this.form.phone, // 手机号
-            mail: this.form.mail, // 邮箱
-            province: this.form.region[0],
-            city: this.form.region[1] ? this.form.region[1] : '',
-            industry: this.form.industry.join('_'), // 行业值
-            hireType: this.form.mold, // 受雇类型值
-            agree: true
-          }
-        }
-      */
       var params = {
         source: source,
         name: this.form.name,
@@ -464,7 +432,6 @@ var vm = new Vue({
         partnerNeeds: this.form.need, 
         agree: this.form.agreeChecked
       }
-      console.log(params)
       var _this = this
       $.ajax({
         type:'POST',
@@ -474,7 +441,21 @@ var vm = new Vue({
         success:function (res) {
           if (res.data) {
             _this.showForm = false
-            _this.showSuccess = true
+            if(source == 'member_freeuse') {
+              _this.showSuccess = true
+            } else if (source == 'article_original') {
+              // 如果是阅读原文点击的 留完用户资料执行原点击操作
+              $(".com-original").trigger('click')
+            } else if (source == 'article_collection'){
+              $('#bidCollect').trigger('click') // 三级页收藏事件
+              // 单个收藏事件传当前点击的dom
+              if(_this.curDom) {
+                _this.curDom.trigger('click') // 列表页单个收藏事件
+                _this.curDom = null
+              } else {
+                $('#bid-collect').trigger('click') // 列表页批量收藏事件
+              }
+            }
           }
         }
       })

+ 1 - 1
src/web/staticres/js/superSearch.js

@@ -1113,7 +1113,7 @@ function collectClick() {
             }
           }
         })
-      })
+      }, $(this))
     }
   })
   // 批量收藏

+ 2 - 0
src/web/templates/pc/biddetail_rec.html

@@ -484,6 +484,8 @@ function isWechat() {
                 $('#bidCollect').hide()
                 $('.tags-box').show().css('top', top)
                 getUserTags()
+              } else {
+                toastFn(r.error_msg)
               }
             })
           })