张延森 5 years ago
parent
commit
180a7bd787
2 changed files with 15 additions and 28 deletions
  1. 2
    4
      src/pages/project/detail/index.js
  2. 13
    24
      src/utils/page.js

+ 2
- 4
src/pages/project/detail/index.js View File

260
     const id = this.$router.params.id || sceneParams.id
260
     const id = this.$router.params.id || sceneParams.id
261
     const consultantId = this.$router.params.consultantId || sceneParams.consultantId
261
     const consultantId = this.$router.params.consultantId || sceneParams.consultantId
262
     const recommender = this.$router.params.recommender || sceneParams.recommender
262
     const recommender = this.$router.params.recommender || sceneParams.recommender
263
-    const sceneId = this.$router.scene
264
 
263
 
265
     return {
264
     return {
266
       id,
265
       id,
267
-      sceneId,
268
       buildingId: id,
266
       buildingId: id,
269
       consultantId,
267
       consultantId,
270
-      // sharePersonId: recommender,
268
+      sharePersonId: recommender,
271
     }
269
     }
272
   }
270
   }
273
 
271
 
319
           })
317
           })
320
         }
318
         }
321
 
319
 
322
-        // this._$_dataReady()
320
+        this._$_dataReady()
323
       })
321
       })
324
 
322
 
325
       Taro.hideToast()
323
       Taro.hideToast()

+ 13
- 24
src/utils/page.js View File

1
 import Taro from '@tarojs/taro'
1
 import Taro from '@tarojs/taro'
2
 import { getQrCodeParams } from '@/utils/qrcode'
2
 import { getQrCodeParams } from '@/utils/qrcode'
3
 import { savePoint, updatePoint } from '@/services/common'
3
 import { savePoint, updatePoint } from '@/services/common'
4
-import { report } from '@/utils/customer'
4
+// import { report } from '@/utils/customer'
5
 
5
 
6
 function isFunction(fn) {
6
 function isFunction(fn) {
7
   return typeof fn === 'function'
7
   return typeof fn === 'function'
10
 export function withDetail(opts = {}) {
10
 export function withDetail(opts = {}) {
11
   return function (OrigComp) {  
11
   return function (OrigComp) {  
12
     class WrapperComponent extends OrigComp {
12
     class WrapperComponent extends OrigComp {
13
-
14
-      // 进入当前页面的场景值
15
-      _$_pageScene = this.$router.params.scene ? getLaunchScene() : undefined
16
-
17
       // 数据详情加载
13
       // 数据详情加载
18
       // _$_dataReady 被透传到父组件,  父组件加载完数据之后需要调用 this._$_dataReady()
14
       // _$_dataReady 被透传到父组件,  父组件加载完数据之后需要调用 this._$_dataReady()
19
       _$_dataReady;
15
       _$_dataReady;
37
         }
33
         }
38
       }
34
       }
39
 
35
 
40
-      async componentDidShow() {
41
-        this._$_pageShow()
36
+      componentDidHide() {
37
+        // 埋点
38
+        if (isFunction(this._$_trackOverFn)) {
39
+          this._$_trackOverFn()
40
+          this._$_trackOverFn = undefined
41
+        }
42
 
42
 
43
-        if (super.componentDidShow) {
44
-          super.componentDidShow();
43
+        if (super.componentDidHide) {
44
+          super.componentDidHide();
45
         }
45
         }
46
       }
46
       }
47
 
47
 
48
-      componentDidHide() {
49
-        console.log('--------componentDidHide-------', this)
48
+      componentWillUnmount() {
50
         // 埋点
49
         // 埋点
51
         if (isFunction(this._$_trackOverFn)) {
50
         if (isFunction(this._$_trackOverFn)) {
52
           this._$_trackOverFn()
51
           this._$_trackOverFn()
52
+          this._$_trackOverFn = undefined
53
         }
53
         }
54
 
54
 
55
-        if (super.componentDidHide) {
56
-          super.componentDidHide();
55
+        if (super.componentWillUnmount) {
56
+          super.componentWillUnmount();
57
         }
57
         }
58
       }
58
       }
59
 
59
 
71
           this._$_trackOverFn = () => updatePoint(recordId)
71
           this._$_trackOverFn = () => updatePoint(recordId)
72
         }
72
         }
73
       }
73
       }
74
-
75
-      reportCustomer () {
76
-        let consultant = this.$router.params.consultant
77
-        if (!consultant && this._$_scene && this._$_scene.consultant) {
78
-          consultant = this._$_scene.consultant
79
-        }
80
-
81
-        const { userInfo: { person } } = this.props
82
-
83
-        report(person, consultant, )
84
-      }
85
     }
74
     }
86
 
75
 
87
     return WrapperComponent
76
     return WrapperComponent