Jelajahi Sumber

feat: 关注企业新增剑鱼币任务提示

zhangsiya 1 tahun lalu
induk
melakukan
fa4ac6667c

+ 16 - 0
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/ent_portrait.js

@@ -933,6 +933,9 @@ var vNode = {
             if (res.data && res.data == 'success') {
               _this.entInfo.follow = !_this.entInfo.follow
             }
+            if(_this.entInfo.follow) {
+              _this.pointsTaskSuccessTip()
+            }
 
             if (!_this.entInfo.follow) {
               history.back()
@@ -947,6 +950,19 @@ var vNode = {
         }
       })
     },
+    // 赚剑鱼币任务完成提示
+    pointsTaskSuccessTip: function() {
+      // 获取剑鱼币任务信息
+      const from =  utils.getParam('from')
+      var point = utils.getParam('point') || 0
+      if(from && from === 'task'){
+        this.$toast({
+          message: `绑定邮箱成功,获得${point}剑鱼币。`,
+          duration: 1500
+        })
+        utils.delUrlParam('from')
+      }
+    },
     // 初始化图标数据
     initChartsData: function () {
       var dataSet = this.entPortraitInfo

+ 7 - 0
src/web/staticres/big-member/js/utils.js

@@ -97,6 +97,13 @@ var utils = {
         r = null;
         return context == null || context == '' || context == 'undefined' ? '' : context;
     },
+    // 移除url参数,但是不刷新页面
+    delUrlParam: function (name){
+      var href = window.location.href;
+      const e = eval(`/&?${name}=[^&#]*/g`);
+      href = href.replace(e, '');
+      history.replaceState('','',href);// replaceState方法不会触发页面刷新,只是导致history对象发生变化,地址栏
+    },
     // 取[m, n]随机数
     getRandomNumber: function (min, max) {
         return Math.floor(Math.random() * (max - min + 1) + min);

+ 16 - 1
src/web/staticres/common-module/collection/js/ent_portrait.js

@@ -901,7 +901,9 @@ var vNode = {
             if (res.data && res.data == 'success') {
               _this.entInfo.follow = !_this.entInfo.follow
             }
-
+            if(_this.entInfo.follow) {
+              _this.pointsTaskSuccessTip()
+            }
             if (!_this.entInfo.follow) {
               history.back()
             }
@@ -913,7 +915,20 @@ var vNode = {
           console.log(error)
         }
       })
+    }, // 赚剑鱼币任务完成提示
+    pointsTaskSuccessTip: function() {
+      // 获取剑鱼币任务信息
+      const from =  utils.getParam('from')
+      var point = utils.getParam('point') || 0
+      if(from && from === 'task'){
+        this.$toast({
+          message: `绑定邮箱成功,获得${point}剑鱼币。`,
+          duration: 1500
+        })
+        utils.delUrlParam('from')
+      }
     },
+
     // 初始化图标数据
     initChartsData: function () {
       var dataSet = this.entPortraitInfo

+ 7 - 0
src/web/staticres/common-module/public/js/utils.js

@@ -197,6 +197,13 @@ var utils = {
     r = null;
     return context == null || context == '' || context == 'undefined' ? '' : context;
   },
+  // 移除url参数,但是不刷新页面
+  delUrlParam: function (name){
+    var href = window.location.href;
+    const e = eval(`/&?${name}=[^&#]*/g`);
+    href = href.replace(e, '');
+    history.replaceState('','',href);// replaceState方法不会触发页面刷新,只是导致history对象发生变化,地址栏
+  },
   // 取[m, n]随机数
   getRandomNumber: function (min, max) {
     return Math.floor(Math.random() * (max - min + 1) + min);