|
@@ -81,7 +81,8 @@ const { mapActions: mapAppActions } = createNamespacedHelpers('app')
|
81
|
81
|
const { mapState: mapBookState, mapActions: mapBookActions } = createNamespacedHelpers('book')
|
82
|
82
|
import { Toast } from '../../../../../node_modules/vant';
|
83
|
83
|
import wxsdk from '../../../../util/share'
|
84
|
|
-const wx = require('weixin-js-sdk')
|
|
84
|
+import wx from 'weixin-jsapi'
|
|
85
|
+// const wx = require('weixin-js-sdk')
|
85
|
86
|
export default {
|
86
|
87
|
name: '',
|
87
|
88
|
data () {
|
|
@@ -170,23 +171,23 @@ export default {
|
170
|
171
|
let hasSol = false
|
171
|
172
|
const startDt = (new Date).getTime()
|
172
|
173
|
|
173
|
|
- const t = window.setInterval(() => {
|
174
|
|
- const nw = (new Date).getTime()
|
|
174
|
+ // const t = window.setInterval(() => {
|
|
175
|
+ // const nw = (new Date).getTime()
|
175
|
176
|
|
176
|
|
- if (hasSol) {
|
177
|
|
- window.clearInterval(t)
|
178
|
|
- return
|
179
|
|
- }
|
|
177
|
+ // if (hasSol) {
|
|
178
|
+ // window.clearInterval(t)
|
|
179
|
+ // return
|
|
180
|
+ // }
|
180
|
181
|
|
181
|
|
- // 500 毫秒还未定位则直接取消定位
|
182
|
|
- if ((nw - startDt) >= 500) {
|
183
|
|
- hasSol = true
|
184
|
|
- window.clearInterval(t)
|
|
182
|
+ // // 500 毫秒还未定位则直接取消定位
|
|
183
|
+ // if ((nw - startDt) >= 500) {
|
|
184
|
+ // hasSol = true
|
|
185
|
+ // window.clearInterval(t)
|
185
|
186
|
|
186
|
|
- this.setDefaultCase(((this.CaseList || [])[0] || {}).CaseId)
|
187
|
|
- reject('定位超时 ...')
|
188
|
|
- }
|
189
|
|
- }, 100)
|
|
187
|
+ // this.setDefaultCase(((this.CaseList || [])[0] || {}).CaseId)
|
|
188
|
+ // reject('定位超时 ...')
|
|
189
|
+ // }
|
|
190
|
+ // }, 100)
|
190
|
191
|
|
191
|
192
|
wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
|
192
|
193
|
title: '城的空间',
|
|
@@ -194,6 +195,7 @@ export default {
|
194
|
195
|
link: `${window.location.origin}${window.location.pathname}#/mainPage/indexPage`,
|
195
|
196
|
thu_image: `https://spaceofcheng.oss-cn-beijing.aliyuncs.com/indexlogo.jpg?x-oss-process=style/wxicon`
|
196
|
197
|
}).then(() => {
|
|
198
|
+ console.log(wx.getLocation)
|
197
|
199
|
if (hasSol) return
|
198
|
200
|
hasSol = true
|
199
|
201
|
const that = this
|
|
@@ -213,7 +215,8 @@ export default {
|
213
|
215
|
that.longitude = res.longitude // 经度,浮点数,范围为180 ~ -180。
|
214
|
216
|
console.log('获取到位置 ->', that.latitude, that.longitude)
|
215
|
217
|
},
|
216
|
|
- complete: function () {
|
|
218
|
+ complete: function (res) {
|
|
219
|
+ console.log(res)
|
217
|
220
|
console.log('获取位置后, 不管成功与否', that.latitude, that.longitude)
|
218
|
221
|
|
219
|
222
|
if(that.latitude && that.longitude ) {
|