张延森 vor 5 Jahren
Ursprung
Commit
180a7bd787
2 geänderte Dateien mit 15 neuen und 28 gelöschten Zeilen
  1. 2
    4
      src/pages/project/detail/index.js
  2. 13
    24
      src/utils/page.js

+ 2
- 4
src/pages/project/detail/index.js Datei anzeigen

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

+ 13
- 24
src/utils/page.js Datei anzeigen

@@ -1,7 +1,7 @@
1 1
 import Taro from '@tarojs/taro'
2 2
 import { getQrCodeParams } from '@/utils/qrcode'
3 3
 import { savePoint, updatePoint } from '@/services/common'
4
-import { report } from '@/utils/customer'
4
+// import { report } from '@/utils/customer'
5 5
 
6 6
 function isFunction(fn) {
7 7
   return typeof fn === 'function'
@@ -10,10 +10,6 @@ function isFunction(fn) {
10 10
 export function withDetail(opts = {}) {
11 11
   return function (OrigComp) {  
12 12
     class WrapperComponent extends OrigComp {
13
-
14
-      // 进入当前页面的场景值
15
-      _$_pageScene = this.$router.params.scene ? getLaunchScene() : undefined
16
-
17 13
       // 数据详情加载
18 14
       // _$_dataReady 被透传到父组件,  父组件加载完数据之后需要调用 this._$_dataReady()
19 15
       _$_dataReady;
@@ -37,23 +33,27 @@ export function withDetail(opts = {}) {
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 50
         if (isFunction(this._$_trackOverFn)) {
52 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,17 +71,6 @@ export function withDetail(opts = {}) {
71 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 76
     return WrapperComponent