Browse Source

Merge branch 'dev/v1.0.94_yf' of jianyu/web into feature/v1.0.94

yangfeng 4 months ago
parent
commit
800ef7fbd6

+ 6 - 7
plugins/bind-phone-mobile/src/utils/directives/bind-phone.js

@@ -36,10 +36,8 @@ const BindPhoneDirective = {
 
       // 从cookie中获取是否绑定过手机号
       const needPhoneBound = Cookies.get('EXPERIENCESIGN') === 'experiencing'
-      console.log('是否需要绑定手机号:' + needPhoneBound)
-      console.log(
-        'cookie里EXPERIENCESIGN的值:' + Cookies.get('EXPERIENCESIGN')
-      )
+      // 绑定成功cookie里塞的值
+      const alreadyBind = Cookies.get('EXPERIENCE')
       // 已绑定过手机号
       if (!needPhoneBound) {
         if (typeof next === 'function') {
@@ -51,6 +49,9 @@ const BindPhoneDirective = {
           // event.target.click() // 触发不了
         }
       } else {
+        if (alreadyBind) {
+          return next?.()
+        }
         props.visible = true
         // 未绑定过手机号
         vm.$bindPhoneDialog({
@@ -58,9 +59,7 @@ const BindPhoneDirective = {
           slots: {},
           on: {
             bound: () => {
-              // 绑定完清除cookie(部分页面后端3套程序,每个程序都会塞1个同名cookie,remove方法一次只能删除一个,需要清除3个)
-              Cookies.remove('EXPERIENCESIGN')
-              Cookies.remove('EXPERIENCESIGN')
+              // 绑定完清除cookie
               Cookies.remove('EXPERIENCESIGN')
               // 绑定成功埋点
               try {

+ 5 - 2
plugins/bind-phone-mobile/src/utils/plugins/prototype-bind-phone.js

@@ -25,11 +25,16 @@ const PrototypeBindPhonePlugin = {
       const { props = {}, slots, pass, bound, next, close } = options
       props.visible = true
       const needPhoneBound = Cookies.get('EXPERIENCESIGN') === 'experiencing'
+      // 绑定成功cookie里塞的值
+      const alreadyBind = Cookies.get('EXPERIENCE')
       if (typeof pass === 'function') {
         pass()
         return
       }
       if (needPhoneBound) {
+        if (alreadyBind) {
+          return next?.()
+        }
         const DialogConstructor = Vue.extend(BindPhoneDialog)
         const instance = new DialogConstructor({ propsData: props })
 
@@ -48,8 +53,6 @@ const PrototypeBindPhonePlugin = {
             }
             // 绑定完清除cookie
             Cookies.remove('EXPERIENCESIGN')
-            Cookies.remove('EXPERIENCESIGN')
-            Cookies.remove('EXPERIENCESIGN')
             // 绑定成功埋点
             try {
               window.__EasyJTrack.addTrack(props.name, {