Преглед изворни кода

fix bug: change socket connect time

张延森 пре 5 година
родитељ
комит
740d55d6d9
4 измењених фајлова са 32 додато и 29 уклоњено
  1. 1
    1
      project.config.json
  2. 28
    25
      src/app.js
  3. 2
    2
      src/pages/project/detail/Around/index.js
  4. 1
    1
      src/utils/request.js

+ 1
- 1
project.config.json Прегледај датотеку

@@ -2,7 +2,7 @@
2 2
 	"miniprogramRoot": "dist/",
3 3
 	"projectname": "mini-chengjiao",
4 4
 	"description": "知与行联调",
5
-	"appid": "wxd9ee3a9480a4e544",
5
+	"appid": "wxda1f84b79b3edeb3",
6 6
 	"setting": {
7 7
 		"urlCheck": false,
8 8
 		"es6": false,

+ 28
- 25
src/app.js Прегледај датотеку

@@ -150,6 +150,34 @@ class App extends Component {
150 150
   }
151 151
 
152 152
   componentDidShow() {
153
+    const updateManager = wx.getUpdateManager()
154
+    updateManager.onCheckForUpdate(function (res) {
155
+      // 请求完新版本信息的回调
156
+      console.info('新版本是否更新:', res.hasUpdate)
157
+    })
158
+
159
+    updateManager.onUpdateReady(function () {
160
+      wx.showModal({
161
+        title: '更新提示',
162
+        content: '新版本已经准备好,是否重启应用?',
163
+        success(res) {
164
+          if (res.confirm) {
165
+            // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
166
+            updateManager.applyUpdate()
167
+          }
168
+        }
169
+      })
170
+    })
171
+  }
172
+  componentDidMount() {
173
+    console.info('app componentDidMount')
174
+  }
175
+  componentWillMount(params) {
176
+    // console.info('app componentWillMount', params)
177
+    this.initData()
178
+  }
179
+
180
+  initData () {
153 181
     console.info('app componentDidShow')
154 182
     console.info('router1', this.$router.params)
155 183
     console.info('ready status1', ready)
@@ -190,31 +218,6 @@ class App extends Component {
190 218
         })
191 219
       })
192 220
     })
193
-
194
-    const updateManager = wx.getUpdateManager()
195
-    updateManager.onCheckForUpdate(function (res) {
196
-      // 请求完新版本信息的回调
197
-      console.info('新版本是否更新:', res.hasUpdate)
198
-    })
199
-
200
-    updateManager.onUpdateReady(function () {
201
-      wx.showModal({
202
-        title: '更新提示',
203
-        content: '新版本已经准备好,是否重启应用?',
204
-        success(res) {
205
-          if (res.confirm) {
206
-            // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
207
-            updateManager.applyUpdate()
208
-          }
209
-        }
210
-      })
211
-    })
212
-  }
213
-  componentDidMount() {
214
-    console.info('app componentDidMount')
215
-  }
216
-  componentWillMount(params) {
217
-    console.info('app componentWillMount', params)
218 221
   }
219 222
 
220 223
   getRouterParams() {

+ 2
- 2
src/pages/project/detail/Around/index.js Прегледај датотеку

@@ -15,7 +15,7 @@ export default function Around(props) {
15 15
   // 展示内容数组
16 16
   const dataList = poiDatas.map((item) => {
17 17
     const key = item.key
18
-    const manualData = (detail[`building${key}`] === '' ? [] : detail[`building${key}`].split(','))
18
+    const manualData = (detail[`building${key}`] === '' ? [] : (detail[`building${key}`] || '').split(','))
19 19
     
20 20
     return {
21 21
       ...item,
@@ -28,7 +28,7 @@ export default function Around(props) {
28 28
   const markersList = dataList.map((item) => {
29 29
     const mapJson = JSON.parse(item.data) 
30 30
     return (mapJson || []).map((it) => {
31
-      const [longitude, latitude] = it.location.split(',')
31
+      const [longitude, latitude] = (it.location || '').split(',')
32 32
 
33 33
       return {
34 34
         id: it.id,

+ 1
- 1
src/utils/request.js Прегледај датотеку

@@ -94,7 +94,7 @@ export const fetch = async (options) => {
94 94
       icon: 'none'
95 95
     })
96 96
 
97
-    throw new Error(errMessage)
97
+    throw new Error(err)
98 98
   })
99 99
 }
100 100