zhoulisen 5 anni fa
parent
commit
09f1fde99d

+ 0
- 5
src/components/consultant/index.js Vedi File

@@ -66,11 +66,6 @@ export default class Index extends Component {
66 66
     }
67 67
 
68 68
     handleConsuItemClick(item) {
69
-        console.log(item, '1231123')
70
-        wx.setStorage({
71
-            key: "isConsultant",
72
-            data: "true"
73
-        })
74 69
         Taro.navigateTo({
75 70
             url: `/pages/card/index?id=${item.id}`
76 71
         })

+ 8
- 0
src/pages/card/index.js Vedi File

@@ -62,6 +62,14 @@ export default class Index extends Component {
62 62
       this.initPageData()
63 63
     })
64 64
   }
65
+
66
+  componentDidShow() {
67
+      wx.setStorage({
68
+        key: "from-card",
69
+        data: "true"
70
+      })
71
+  }
72
+
65 73
   initPageData() {
66 74
 
67 75
     const id = this.$router.params.id

+ 54
- 25
src/pages/project/detail/index.js Vedi File

@@ -98,34 +98,38 @@ export default class Index extends Component {
98 98
         this.toggleGrantAvatar()
99 99
       }
100 100
 
101
-      const id = this.$router.params.id
102
-
103
-      // 没有找到 id , 再重新找一次
104
-      if (this.$router.params.scene) {
105
-        getQrCodeParams(this.$router.params.scene).then(res => {
106
-          console.log(res, "扫码参数")
107
-          this.setState({
108
-            qrcodeParams: res
109
-          })
110
-          this.initPageData(res.id)
111
-        }).catch(err => {
112
-          Taro.showToast({
113
-            title: '没有找到项目',
114
-            icon: 'none'
115
-          })
116
-        })
117
-      } else {
118
-        console.log('有项目id,不请求扫码参数接口')
119
-        this.initPageData(id)
120
-      }
101
+      this.loadData()
102
+
103
+      // const id = this.$router.params.id
104
+
105
+      // // 没有找到 id , 再重新找一次
106
+      // if (this.$router.params.scene) {
107
+      //   getQrCodeParams(this.$router.params.scene).then(res => {
108
+      //     console.log(res, "扫码参数")
109
+      //     this.setState({
110
+      //       qrcodeParams: res
111
+      //     })
112
+      //     this.initPageData(res.id)
113
+      //   }).catch(err => {
114
+      //     Taro.showToast({
115
+      //       title: '没有找到项目',
116
+      //       icon: 'none'
117
+      //     })
118
+      //   })
119
+      // } else {
120
+      //   console.log('有项目id,不请求扫码参数接口')
121
+      //   this.initPageData(id)
122
+      // }
121 123
     })
122 124
   }
123 125
   componentDidShow() {
124
-    const id = this.$router.params.id
125
-    if (id) {
126
-       console.log('12321312321321')
127
-      this.loadDetail()
128
-    }
126
+    console.log('3366633', this.$router.params)
127
+
128
+      const fromCard = !!wx.getStorageSync('from-card')
129
+
130
+      if (fromCard) {
131
+        this.loadData()
132
+      }
129 133
   }
130 134
 
131 135
   componentWillUnmount() {
@@ -151,6 +155,31 @@ export default class Index extends Component {
151 155
     }
152 156
   }
153 157
 
158
+  loadData() {
159
+    const id = this.$router.params.id
160
+
161
+    // 没有找到 id , 再重新找一次
162
+    if (this.$router.params.scene) {
163
+      getQrCodeParams(this.$router.params.scene).then(res => {
164
+        console.log(res, "扫码参数")
165
+        this.setState({
166
+          qrcodeParams: res
167
+        })
168
+        this.initPageData(res.id)
169
+      }).catch(err => {
170
+        Taro.showToast({
171
+          title: '没有找到项目',
172
+          icon: 'none'
173
+        })
174
+      })
175
+    } else {
176
+      console.log('有项目id,不请求扫码参数接口')
177
+      this.initPageData(id)
178
+    }
179
+
180
+    wx.removeStorageSync('from-card')
181
+  }
182
+
154 183
   currentPageAndParams() {
155 184
     const {
156 185
       projectDetail: { buildingId },