|
@@ -1,42 +1,81 @@
|
1
|
|
-import "@tarojs/async-await";
|
2
|
|
-import Taro, { Component } from "@tarojs/taro";
|
3
|
|
-import "./app.scss";
|
|
1
|
+
|
|
2
|
+首页
|
|
3
|
+探索
|
|
4
|
+帮助
|
|
5
|
+注册
|
|
6
|
+登录
|
|
7
|
+ zhiyuxing / miniapp-v3
|
|
8
|
+关注
|
|
9
|
+4
|
|
10
|
+
|
|
11
|
+点赞
|
|
12
|
+0
|
|
13
|
+
|
|
14
|
+派生
|
|
15
|
+0
|
|
16
|
+代码
|
|
17
|
+工单
|
|
18
|
+0
|
|
19
|
+合并请求
|
|
20
|
+0
|
|
21
|
+版本发布
|
|
22
|
+14
|
|
23
|
+百科
|
|
24
|
+动态
|
|
25
|
+ 1328 提交
|
|
26
|
+ 12 分支
|
|
27
|
+ 目录树: 11fa8c510d
|
|
28
|
+miniapp-v3/src/app.js
|
|
29
|
+app.js 10KB
|
|
30
|
+文件历史
|
|
31
|
+原始文件
|
|
32
|
+
|
|
33
|
+import '@tarojs/async-await'
|
|
34
|
+import Taro, { Component } from '@tarojs/taro'
|
|
35
|
+import './app.scss'
|
4
|
36
|
import "@/styles/icon.scss";
|
5
|
37
|
import "@/components/wxParse/wxParse.scss";
|
6
|
|
-import Index from "./pages/auth/index";
|
7
|
|
-import { Provider } from "@tarojs/redux";
|
8
|
|
-import { parseQueryString } from "@/utils/tools";
|
9
|
|
-import { trackUserSource } from "@/utils/track";
|
10
|
|
-import { getCardDetail } from "@/services/card";
|
|
38
|
+import Index from './pages/auth/index'
|
|
39
|
+import { Provider } from '@tarojs/redux'
|
|
40
|
+import { parseQueryString } from '@/utils/tools'
|
|
41
|
+import { trackUserSource } from '@/utils/track'
|
|
42
|
+import { getCardDetail } from '@/services/card'
|
11
|
43
|
|
12
|
44
|
import {
|
13
|
45
|
getCodeScene,
|
14
|
46
|
savePoint,
|
15
|
47
|
queryCityList,
|
16
|
|
- getPreloadData
|
17
|
|
-} from "@/services/common";
|
|
48
|
+ getPreloadData,
|
|
49
|
+} from '@/services/common'
|
18
|
50
|
|
19
|
|
-import { queryUserInfo } from "@/services/user";
|
|
51
|
+import {
|
|
52
|
+ queryUserInfo
|
|
53
|
+} from '@/services/user'
|
20
|
54
|
|
21
|
|
-import { CITY_LIST } from "@/constants/city";
|
22
|
|
-import { ASSIGN_UNREADNUM, INCREASE_UNREADNUM } from "@/constants/user";
|
23
|
|
-import { UPDATE_PRELOAD, SYNC_SYSTEMINFO } from "@/constants/common";
|
24
|
|
-import ready from "@/utils/ready";
|
25
|
|
-import login from "@/utils/login";
|
26
|
|
-import store from "./store";
|
27
|
|
-import socket from "@/utils/im";
|
|
55
|
+import {
|
|
56
|
+ CITY_LIST
|
|
57
|
+} from '@/constants/city'
|
|
58
|
+import {
|
|
59
|
+ ASSIGN_UNREADNUM,
|
|
60
|
+ INCREASE_UNREADNUM
|
|
61
|
+} from '@/constants/user'
|
|
62
|
+import { UPDATE_PRELOAD, SYNC_SYSTEMINFO } from '@/constants/common'
|
|
63
|
+import ready from '@/utils/ready'
|
|
64
|
+import login from '@/utils/login'
|
|
65
|
+import store from './store'
|
|
66
|
+import socket from '@/utils/im'
|
28
|
67
|
|
29
|
68
|
// const store = configStore()
|
30
|
69
|
|
31
|
70
|
// for dev
|
32
|
|
-global.store = store;
|
|
71
|
+global.store = store
|
33
|
72
|
|
34
|
73
|
class App extends Component {
|
35
|
74
|
config = {
|
36
|
|
- debug: process.env.NODE_ENV === "development",
|
|
75
|
+ debug: process.env.NODE_ENV === 'development',
|
37
|
76
|
permission: {
|
38
|
77
|
"scope.userLocation": {
|
39
|
|
- desc: "你的位置信息将用于显示当前区域信息"
|
|
78
|
+ "desc": "你的位置信息将用于显示当前区域信息"
|
40
|
79
|
}
|
41
|
80
|
},
|
42
|
81
|
navigateToMiniProgramAppIdList: [
|
|
@@ -45,7 +84,7 @@ class App extends Component {
|
45
|
84
|
"wx74767bf0b684f7d3",
|
46
|
85
|
"wx6fa58869f7b65e7f",
|
47
|
86
|
"wxc4f812079fc9ff0d",
|
48
|
|
- "wx60d176f873ca2d67"
|
|
87
|
+ "wx60d176f873ca2d67",
|
49
|
88
|
],
|
50
|
89
|
// eslint-disable-next-line no-undef
|
51
|
90
|
pages: preval`
|
|
@@ -58,82 +97,82 @@ class App extends Component {
|
58
|
97
|
module.exports = getPages().subPackages
|
59
|
98
|
`,
|
60
|
99
|
window: {
|
61
|
|
- backgroundTextStyle: "light",
|
62
|
|
- navigationBarBackgroundColor: "#BB9C79",
|
63
|
|
- navigationBarTitleText: "",
|
64
|
|
- navigationBarTextStyle: "white"
|
|
100
|
+ backgroundTextStyle: 'light',
|
|
101
|
+ navigationBarBackgroundColor: '#BB9C79',
|
|
102
|
+ navigationBarTitleText: '',
|
|
103
|
+ navigationBarTextStyle: 'white',
|
65
|
104
|
// navigationStyle:'custom'
|
66
|
105
|
},
|
67
|
106
|
tabBar: {
|
68
|
|
- color: "#666",
|
69
|
|
- selectedColor: "#BB9C79",
|
|
107
|
+ color: '#666',
|
|
108
|
+ selectedColor: '#BB9C79',
|
70
|
109
|
|
71
|
110
|
list: [
|
72
|
111
|
{
|
73
|
112
|
pagePath: "pages/project/index",
|
74
|
113
|
text: "首页",
|
75
|
|
- iconPath: "./assets/tabbar/index1.png",
|
76
|
|
- selectedIconPath: "./assets/tabbar/index2.png"
|
|
114
|
+ iconPath: './assets/tabbar/index1.png',
|
|
115
|
+ selectedIconPath: './assets/tabbar/index2.png',
|
77
|
116
|
},
|
78
|
117
|
{
|
79
|
118
|
pagePath: "pages/shop/index",
|
80
|
119
|
text: "赚好礼",
|
81
|
|
- iconPath: "./assets/tabbar/shop1.png",
|
82
|
|
- selectedIconPath: "./assets/tabbar/shop2.png"
|
|
120
|
+ iconPath: './assets/tabbar/shop1.png',
|
|
121
|
+ selectedIconPath: './assets/tabbar/shop2.png',
|
83
|
122
|
},
|
84
|
123
|
{
|
85
|
124
|
pagePath: "pages/activity/activity",
|
86
|
125
|
text: "活动资讯",
|
87
|
|
- iconPath: "./assets/tabbar/activity1.png",
|
88
|
|
- selectedIconPath: "./assets/tabbar/activity2.png"
|
|
126
|
+ iconPath: './assets/tabbar/activity1.png',
|
|
127
|
+ selectedIconPath: './assets/tabbar/activity2.png',
|
89
|
128
|
},
|
90
|
129
|
{
|
91
|
130
|
pagePath: "pages/person/index",
|
92
|
131
|
text: "我的地盘",
|
93
|
|
- iconPath: "./assets/tabbar/mine1.png",
|
94
|
|
- selectedIconPath: "./assets/tabbar/mine2.png"
|
|
132
|
+ iconPath: './assets/tabbar/mine1.png',
|
|
133
|
+ selectedIconPath: './assets/tabbar/mine2.png',
|
95
|
134
|
}
|
96
|
135
|
]
|
97
|
136
|
},
|
98
|
|
- restartStrategy: "homePageAndLatestPage"
|
99
|
|
- };
|
|
137
|
+ }
|
100
|
138
|
|
101
|
139
|
// 更新埋点时长
|
102
|
140
|
updateTrack;
|
103
|
141
|
|
104
|
142
|
componentDidHide() {
|
105
|
143
|
if (this.updateTrack) {
|
106
|
|
- this.updateTrack();
|
107
|
|
- this.updateTrack = undefined;
|
|
144
|
+ this.updateTrack()
|
|
145
|
+ this.updateTrack = undefined
|
108
|
146
|
}
|
109
|
147
|
|
110
|
148
|
// ready.close()
|
111
|
|
- socket.closeSocket();
|
|
149
|
+ socket.closeSocket()
|
112
|
150
|
}
|
113
|
151
|
|
114
|
152
|
componentDidShow() {
|
115
|
|
- const updateManager = wx.getUpdateManager();
|
116
|
|
- updateManager.onCheckForUpdate(function(res) {
|
|
153
|
+
|
|
154
|
+ const updateManager = wx.getUpdateManager()
|
|
155
|
+ updateManager.onCheckForUpdate(function (res) {
|
117
|
156
|
// 请求完新版本信息的回调
|
118
|
|
- console.info("新版本是否更新:", res.hasUpdate);
|
119
|
|
- });
|
|
157
|
+ console.info('新版本是否更新:', res.hasUpdate)
|
|
158
|
+ })
|
120
|
159
|
|
121
|
|
- updateManager.onUpdateReady(function() {
|
|
160
|
+ updateManager.onUpdateReady(function () {
|
122
|
161
|
wx.showModal({
|
123
|
|
- title: "更新提示",
|
124
|
|
- content: "新版本已经准备好,是否重启应用?",
|
|
162
|
+ title: '更新提示',
|
|
163
|
+ content: '新版本已经准备好,是否重启应用?',
|
125
|
164
|
success(res) {
|
126
|
165
|
if (res.confirm) {
|
127
|
166
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
128
|
|
- updateManager.applyUpdate();
|
|
167
|
+ updateManager.applyUpdate()
|
129
|
168
|
}
|
130
|
169
|
}
|
131
|
|
- });
|
132
|
|
- });
|
|
170
|
+ })
|
|
171
|
+ })
|
133
|
172
|
|
134
|
|
- socket.reconnect();
|
|
173
|
+ socket.reconnect()
|
135
|
174
|
|
136
|
|
- this.initData();
|
|
175
|
+ this.initData()
|
137
|
176
|
}
|
138
|
177
|
|
139
|
178
|
componentDidMount() {
|
|
@@ -142,17 +181,17 @@ class App extends Component {
|
142
|
181
|
|
143
|
182
|
componentWillMount() {
|
144
|
183
|
// 预加载数据
|
145
|
|
- this.wxPreloadData();
|
|
184
|
+ this.wxPreloadData()
|
146
|
185
|
|
147
|
186
|
// 获取系统信息
|
148
|
187
|
wx.getSystemInfo({
|
149
|
|
- success: res => {
|
|
188
|
+ success: (res) => {
|
150
|
189
|
store.dispatch({
|
151
|
190
|
type: SYNC_SYSTEMINFO,
|
152
|
|
- payload: res
|
153
|
|
- });
|
|
191
|
+ payload: res,
|
|
192
|
+ })
|
154
|
193
|
}
|
155
|
|
- });
|
|
194
|
+ })
|
156
|
195
|
|
157
|
196
|
// console.info('app componentWillMount', params)
|
158
|
197
|
// this.initData()
|
|
@@ -160,8 +199,8 @@ class App extends Component {
|
160
|
199
|
|
161
|
200
|
componentWillUnmount() {
|
162
|
201
|
if (this.updateTrack) {
|
163
|
|
- this.updateTrack();
|
164
|
|
- this.updateTrack = undefined;
|
|
202
|
+ this.updateTrack()
|
|
203
|
+ this.updateTrack = undefined
|
165
|
204
|
}
|
166
|
205
|
// this.initData()
|
167
|
206
|
}
|
|
@@ -179,124 +218,112 @@ class App extends Component {
|
179
|
218
|
// })
|
180
|
219
|
// wx.setBackgroundFetchToken()
|
181
|
220
|
wx.getBackgroundFetchData({
|
182
|
|
- fetchType: "pre",
|
183
|
|
- success: res => {
|
184
|
|
- console.log("[preload]: ", res);
|
|
221
|
+ fetchType: 'pre',
|
|
222
|
+ success: (res) => {
|
|
223
|
+ console.log('[preload]: ', res)
|
185
|
224
|
// store.dispatch({
|
186
|
225
|
// type: UPDATE_PRELOAD,
|
187
|
226
|
// payload: res.fetchedData,
|
188
|
227
|
// })
|
189
|
228
|
}
|
190
|
|
- });
|
|
229
|
+ })
|
191
|
230
|
}
|
192
|
231
|
|
193
|
|
- _mounted = false;
|
|
232
|
+ _mounted = false
|
194
|
233
|
|
195
|
234
|
initData() {
|
196
|
|
- console.info("router1", this.$router);
|
197
|
|
- console.info("ready status1", ready);
|
198
|
|
- // 清空全局置业顾问Id
|
199
|
|
- Taro.removeStorageSync("consultantId");
|
200
|
|
-
|
|
235
|
+ console.info('router1', this.$router)
|
|
236
|
+ console.info('ready status1', ready)
|
|
237
|
+ const enterOptions = wx.getEnterOptionsSync()
|
|
238
|
+ console.log(enterOptions, "enterOptionsenterOptionsenterOptionsenterOptionsenterOptions")
|
|
239
|
+
|
|
240
|
+ if (Object.keys(enterOptions.query).indexOf('recommender') > -1) {
|
|
241
|
+ Taro.setStorageSync('recommender', enterOptions.query.recommender)
|
|
242
|
+ Taro.setStorageSync('consultantId', enterOptions.query.consultant)
|
|
243
|
+ }
|
201
|
244
|
// 获取城市列表
|
202
|
245
|
// queryCityList().then(payload => {
|
203
|
246
|
// store.dispatch({ type: CITY_LIST, payload })
|
204
|
247
|
// })
|
205
|
248
|
|
206
|
|
- this.getLocation().then(loc => {
|
|
249
|
+ this.getLocation().then((loc) => {
|
207
|
250
|
// 获取router参数
|
208
|
251
|
this.getRouterParams().then(router => {
|
209
|
|
- Taro.setStorageSync("router", router);
|
210
|
|
- console.info("router2:", router);
|
211
|
|
- console.info("-----------");
|
212
|
|
- const { query: payload } = router;
|
|
252
|
+ Taro.setStorageSync('router', router)
|
|
253
|
+ console.info('router2:', JSON.stringify(router))
|
|
254
|
+ console.info('-----------')
|
|
255
|
+ const { query: payload } = router
|
213
|
256
|
|
214
|
|
- payload.path = router.path;
|
215
|
|
- payload.scene = router.scene;
|
|
257
|
+ payload.path = router.path
|
|
258
|
+ payload.scene = router.scene
|
216
|
259
|
|
217
|
260
|
if (loc) {
|
218
|
|
- payload.lon = loc.lon;
|
219
|
|
- payload.lat = loc.lat;
|
|
261
|
+ payload.lon = loc.lon
|
|
262
|
+ payload.lat = loc.lat
|
220
|
263
|
}
|
221
|
264
|
|
222
|
265
|
// login
|
223
|
266
|
login(payload, res => {
|
224
|
267
|
// 清空本地缓存
|
225
|
268
|
if (!this._mounted) {
|
226
|
|
- Taro.removeStorageSync("activityPageIndex");
|
227
|
|
- Taro.removeStorageSync("newsPageIndex");
|
228
|
|
- Taro.removeStorageSync("buildingPageIndex");
|
229
|
|
- Taro.removeStorageSync("followPageIndex");
|
230
|
|
- Taro.removeStorageSync("clinchPageIndex");
|
|
269
|
+
|
|
270
|
+ Taro.removeStorageSync('activityPageIndex')
|
|
271
|
+ Taro.removeStorageSync('newsPageIndex')
|
|
272
|
+ Taro.removeStorageSync('buildingPageIndex')
|
|
273
|
+ Taro.removeStorageSync('followPageIndex')
|
|
274
|
+ Taro.removeStorageSync('clinchPageIndex')
|
231
|
275
|
// Taro.removeStorageSync('extendContent')
|
232
|
|
- Taro.setStorageSync("extendContent", []);
|
|
276
|
+ Taro.setStorageSync('extendContent', [])
|
|
277
|
+ // Taro.setStorageSync('recommender', payload.recommender)
|
|
278
|
+ // Taro.setStorageSync('consultantId', payload.consultant)
|
233
|
279
|
// 获取分享人
|
234
|
|
- this._mounted = true;
|
|
280
|
+ this._mounted = true
|
235
|
281
|
}
|
|
282
|
+ console.log(payload, "payloadpayloadpayloadpayloadpayloadpayloadpayload啦啦啦啦啦")
|
|
283
|
+
|
236
|
284
|
|
237
|
|
- console.log(
|
238
|
|
- payload,
|
239
|
|
- "payloadpayloadpayloadpayloadpayloadpayloadpayload啦啦啦啦啦"
|
240
|
|
- );
|
241
|
|
- Taro.setStorageSync("recommender", payload.recommender);
|
242
|
|
- Taro.setStorageSync("consultantId", payload.consultant);
|
243
|
285
|
|
244
|
286
|
// 获取未读消息
|
245
|
|
- const {
|
246
|
|
- person: { personId }
|
247
|
|
- } = res;
|
|
287
|
+ const { person: { personId } } = res
|
248
|
288
|
|
249
|
289
|
queryUserInfo(personId).then(info => {
|
250
|
|
- const { unReadNum } = info;
|
|
290
|
+ const { unReadNum } = info
|
251
|
291
|
store.dispatch({ type: ASSIGN_UNREADNUM, payload: { unReadNum } });
|
252
|
292
|
socket.createSocket({ id: personId });
|
253
|
293
|
socket.onMessage(data => {
|
254
|
|
- store.dispatch({ type: INCREASE_UNREADNUM });
|
255
|
|
- });
|
256
|
|
- });
|
|
294
|
+ store.dispatch({ type: INCREASE_UNREADNUM })
|
|
295
|
+ })
|
|
296
|
+ })
|
257
|
297
|
// 埋点
|
258
|
298
|
// const t = setTimeout(() => {
|
259
|
|
- trackUserSource(this.$router.params).then(
|
260
|
|
- res => (this.updateTrack = res)
|
261
|
|
- );
|
|
299
|
+ trackUserSource(this.$router.params).then(res => this.updateTrack = res)
|
262
|
300
|
|
263
|
301
|
// }, 1000)
|
264
|
|
- });
|
265
|
|
- });
|
266
|
|
- });
|
|
302
|
+ })
|
|
303
|
+ })
|
|
304
|
+ })
|
267
|
305
|
}
|
268
|
306
|
|
|
307
|
+
|
269
|
308
|
getRouterParams() {
|
270
|
309
|
return new Promise(resolve => {
|
271
|
|
- console.log("------getRouterParams------>", this.$router);
|
272
|
|
- const router = this.$router.params;
|
|
310
|
+ console.log('------getRouterParams------>', this.$router)
|
|
311
|
+ const router = this.$router.params
|
273
|
312
|
const originQuery = { ...router.query };
|
274
|
|
- let {
|
275
|
|
- query: { scene: paramsId, consultant },
|
276
|
|
- scene
|
277
|
|
- } = router;
|
|
313
|
+ let { query: { scene: paramsId, consultant }, scene } = router
|
278
|
314
|
|
279
|
315
|
// query 里面如果跟同级场景一样, 说明是小程序原生场景值
|
280
|
316
|
if (paramsId === scene) {
|
281
|
|
- paramsId = undefined;
|
|
317
|
+ paramsId = undefined
|
282
|
318
|
}
|
283
|
319
|
|
284
|
320
|
if (paramsId) {
|
285
|
321
|
// 扫码进入
|
286
|
322
|
getCodeScene(paramsId).then(res => {
|
287
|
|
- let params = JSON.parse(res).scene;
|
288
|
|
- console.log(
|
289
|
|
- params,
|
290
|
|
- "paramsparamsparamsparamsparamsparamsparamsparamsparamsparams"
|
291
|
|
- );
|
|
323
|
+ let params = JSON.parse(res).scene
|
|
324
|
+ console.log(params, "paramsparamsparamsparamsparamsparamsparamsparamsparamsparams")
|
292
|
325
|
|
293
|
|
- let {
|
294
|
|
- from: _from,
|
295
|
|
- recommender: _recommender,
|
296
|
|
- consultant,
|
297
|
|
- id,
|
298
|
|
- ...left
|
299
|
|
- } = parseQueryString(params) || {};
|
|
326
|
+ let { from: _from, recommender: _recommender, consultant, id, ...left } = parseQueryString(params) || {}
|
300
|
327
|
|
301
|
328
|
router.query = Object.assign(router.query, {
|
302
|
329
|
originQuery,
|
|
@@ -307,54 +334,55 @@ class App extends Component {
|
307
|
334
|
consultant,
|
308
|
335
|
params,
|
309
|
336
|
targetId: id,
|
310
|
|
- ...left
|
311
|
|
- });
|
312
|
|
-
|
313
|
|
- resolve(router);
|
314
|
|
- });
|
|
337
|
+ ...left,
|
|
338
|
+ })
|
|
339
|
+ Taro.setStorageSync('recommender', router.query.recommender)
|
|
340
|
+ Taro.setStorageSync('consultantId', router.query.consultant)
|
|
341
|
+ resolve(router)
|
|
342
|
+ })
|
315
|
343
|
} else {
|
|
344
|
+
|
316
|
345
|
router.query = Object.assign(router.query, {
|
317
|
346
|
originQuery,
|
318
|
|
- paramsId: router.query.id || "",
|
319
|
|
- from: router.query.from || "search",
|
320
|
|
- recommender: router.query.recommender || "",
|
321
|
|
- targetId: router.query.id || "",
|
322
|
|
- consultant: router.query.consultant || ""
|
323
|
|
- });
|
324
|
|
-
|
325
|
|
- resolve(router);
|
|
347
|
+ paramsId: router.query.id || '',
|
|
348
|
+ from: router.query.from || 'search',
|
|
349
|
+ recommender: router.query.recommender || '',
|
|
350
|
+ targetId: router.query.id || '',
|
|
351
|
+ consultant: router.query.consultant || '',
|
|
352
|
+ })
|
|
353
|
+
|
|
354
|
+ resolve(router)
|
326
|
355
|
}
|
327
|
|
- });
|
|
356
|
+
|
|
357
|
+ })
|
328
|
358
|
}
|
329
|
359
|
|
330
|
360
|
getLocation() {
|
331
|
|
- return new Promise(resolve => {
|
332
|
|
- Taro.getLocation()
|
333
|
|
- .then(location => {
|
334
|
|
- Taro.setStorageSync("lat", location.latitude);
|
335
|
|
- Taro.setStorageSync("lon", location.longitude);
|
336
|
|
-
|
337
|
|
- resolve({ lon: location.longitude, lat: location.latitude });
|
338
|
|
- })
|
339
|
|
- .catch(err => {
|
340
|
|
- if (err.errMsg === "getLocation:fail auth deny") {
|
341
|
|
- Taro.showModal({
|
342
|
|
- content: "请同意授权您的定位功能",
|
343
|
|
- showCancel: false,
|
344
|
|
- duration: 3000
|
345
|
|
- });
|
346
|
|
- } else {
|
347
|
|
- Taro.showToast({
|
348
|
|
- title: `定位失败, 请手动选择城市: ${err.errMsg}`,
|
349
|
|
- icon: "none",
|
350
|
|
- duration: 3000
|
351
|
|
- });
|
352
|
|
- }
|
|
361
|
+ return new Promise((resolve) => {
|
|
362
|
+ Taro.getLocation().then(location => {
|
|
363
|
+ Taro.setStorageSync('lat', location.latitude)
|
|
364
|
+ Taro.setStorageSync('lon', location.longitude)
|
|
365
|
+
|
|
366
|
+ resolve({ lon: location.longitude, lat: location.latitude })
|
|
367
|
+ }).catch(err => {
|
|
368
|
+ if (err.errMsg === 'getLocation:fail auth deny') {
|
|
369
|
+ Taro.showModal({
|
|
370
|
+ content: '请同意授权您的定位功能',
|
|
371
|
+ showCancel: false,
|
|
372
|
+ duration: 3000,
|
|
373
|
+ })
|
|
374
|
+ } else {
|
|
375
|
+ Taro.showToast({
|
|
376
|
+ title: `定位失败, 请手动选择城市: ${err.errMsg}`,
|
|
377
|
+ icon: 'none',
|
|
378
|
+ duration: 3000,
|
|
379
|
+ })
|
|
380
|
+ }
|
353
|
381
|
|
354
|
|
- console.error(err);
|
355
|
|
- resolve();
|
356
|
|
- });
|
357
|
|
- });
|
|
382
|
+ console.error(err)
|
|
383
|
+ resolve()
|
|
384
|
+ })
|
|
385
|
+ })
|
358
|
386
|
}
|
359
|
387
|
|
360
|
388
|
// 在 App 类中的 render() 函数没有实际作用
|
|
@@ -364,8 +392,8 @@ class App extends Component {
|
364
|
392
|
<Provider store={store}>
|
365
|
393
|
<Index />
|
366
|
394
|
</Provider>
|
367
|
|
- );
|
|
395
|
+ )
|
368
|
396
|
}
|
369
|
397
|
}
|
370
|
398
|
|
371
|
|
-Taro.render(<App />, document.getElementById("app"));
|
|
399
|
+Taro.render(<App />, document.getElementById('app'))
|