Explorar o código

fix:绑定手机号完成剑鱼币任务提示

zhangsiya hai 1 ano
pai
achega
c5374304c3

+ 7 - 31
src/jfw/modules/app/src/web/staticres/jyapp/me/js/phone_bind.js

@@ -42,9 +42,7 @@ var vm = new Vue({
         },
         conf: {
             phoneReg: /^1[3-9]\d{9}$/
-        },
-      // 剑鱼币任务信息
-      pointTaskInfo: {}
+        }
     },
     computed: {
         someText: function () {
@@ -108,10 +106,6 @@ var vm = new Vue({
         if (this.mode === 'mergeBind') {
             this.needShowEntItem = false
         }
-        // 获取剑鱼币任务信息
-        if(this.from === 'task' && this.type === 'bind'){
-          this.getPointsTask()
-        }
     },
 
     mounted: function () {
@@ -424,6 +418,7 @@ var vm = new Vue({
         bindPhoneSuccess: function (state) {
             var _this = this
             if (state == 1) {
+                this.pointsTaskSuccessTip()
                 // 绑定手机号完成后,如果已经填写过公司。则不发送提交公司的请求
                 // 可以直接判断计算属性showEntItem,来判断需不需要填写公司
                 if (_this.showEntItem) {
@@ -443,9 +438,6 @@ var vm = new Vue({
                 this.setPhone(function (state) {
                     _this.bindPhoneSuccess(state)
                 })
-                if(this.form === 'task'){
-                  this.pointsTaskSuccessTip()
-                }
             } else {
                 console.log('更换手机号...')
                 this.setPhone(function () {
@@ -477,29 +469,13 @@ var vm = new Vue({
                 // location.replace('/jyapp/jylab/mainSearch')
             })
         },
-        // 获取剑鱼币数据
-        getPointsTask: function() {
-          var _this = this
-          $.ajax({
-            type: 'POST',
-            url: '/jyActivity/task',
-            success: function (res) {
-              if (res.error_code == 0 && res.data) {
-                var arr = res.data.taskType === 1 ? res.data.limitedTask : res.data.newbieTask
-                var infoArr = arr.filter(function(item) {
-                  return item.type === 'bindPhone'
-                })
-                _this.pointTaskInfo = infoArr.length > 0 ? infoArr[0] : {}
-              } else {
-                _this.pointTaskInfo = {point: 0}
-              }
-            }
-          })
-        },
         // 赚剑鱼币任务完成提示
         pointsTaskSuccessTip () {
-          var point = this.pointTaskInfo.point || 0
-          this.showToast(`绑定手机号成功,获得${point}剑鱼币。`)
+          // 获取剑鱼币任务信息
+          if(this.from === 'task' && this.type === 'bind'){
+            var point = utils.getParam('point') || 0
+            this.showToast(`绑定手机号成功,获得${point}剑鱼币。`)
+          }
         }
     }
 })

+ 10 - 32
src/web/staticres/me/js/phone_bind.js

@@ -41,9 +41,7 @@ var vm = new Vue({
         },
         conf: {
             phoneReg: /^1[3-9]\d{9}$/
-        },
-        // 剑鱼币任务信息
-        pointTaskInfo: {}
+        }
     },
     computed: {
         someText: function () {
@@ -114,10 +112,6 @@ var vm = new Vue({
           // 埋点--打开绑定手机号页面
           _this.trackClick('绑定-打开绑定手机号页面')
         }
-      // 获取剑鱼币任务信息
-      if(this.from === 'task' && this.type === 'bind'){
-        this.getPointsTask()
-      }
     },
     methods: {
         // 注册埋点
@@ -377,6 +371,9 @@ var vm = new Vue({
         bindPhoneSuccess: function (state) {
             var _this = this
             if (state == 1) {
+                if(this.form === 'task'){
+                  _this.pointsTaskSuccessTip()
+                }
                 // 绑定手机号完成后,如果已经填写过公司。则不发送提交公司的请求
                 // 可以直接判断计算属性showEntItem,来判断需不需要填写公司
                 if (_this.showEntItem) {
@@ -396,9 +393,6 @@ var vm = new Vue({
                 this.setPhone(function (state) {
                     _this.bindPhoneSuccess(state)
                 })
-                if(this.form === 'task'){
-                  _this.pointsTaskSuccessTip()
-                }
             } else {
                 console.log('更换手机号...')
                 this.setPhone(function () {
@@ -406,29 +400,13 @@ var vm = new Vue({
                 })
             }
         },
-        // 获取剑鱼币数据
-        getPointsTask: function() {
-          var _this = this
-          $.ajax({
-            type: 'POST',
-            url: '/jyActivity/task',
-            success: function (res) {
-              if (res.error_code == 0 && res.data) {
-                var arr = res.data.taskType === 1 ? res.data.limitedTask : res.data.newbieTask
-                var infoArr = arr.filter(function(item) {
-                  return item.type === 'bindPhone'
-                })
-                _this.pointTaskInfo = infoArr.length > 0 ? infoArr[0] : {}
-              } else {
-                _this.pointTaskInfo = {point: 0}
-              }
-            }
-          })
-        },
-        // 赚剑鱼币任务完成提示
-        pointsTaskSuccessTip () {
-          var point = this.pointTaskInfo.point || 0
+      // 赚剑鱼币任务完成提示
+       pointsTaskSuccessTip () {
+        // 获取剑鱼币任务信息
+        if(this.from === 'task' && this.type === 'bind'){
+          var point = utils.getParam('point') || 0
           this.showToast(`绑定手机号成功,获得${point}剑鱼币。`)
         }
+      }
     }
 })