|
@@ -99,6 +99,8 @@ export default {
|
99
|
99
|
noFlag: false // 暂无更多数据显示
|
100
|
100
|
},
|
101
|
101
|
reserveBookId: '',
|
|
102
|
+ latitude: '',
|
|
103
|
+ longitude: '',
|
102
|
104
|
}
|
103
|
105
|
},
|
104
|
106
|
computed: {
|
|
@@ -172,45 +174,31 @@ export default {
|
172
|
174
|
thu_image: `https://spaceofcheng.oss-cn-beijing.aliyuncs.com/indexlogo.jpg?x-oss-process=style/wxicon`
|
173
|
175
|
}).then(() => {
|
174
|
176
|
})
|
175
|
|
- if(this.bookcaseid === '') {
|
176
|
|
- wx.getLocation({
|
177
|
|
- type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
178
|
|
- success: function (res) {
|
179
|
|
- let latitude1 = res.latitude // 纬度,浮点数,范围为90 ~ -90
|
180
|
|
- let longitude1 = res.longitude // 经度,浮点数,范围为180 ~ -180。
|
|
177
|
+ if(!this.bookcaseid) {
|
|
178
|
+ setTimeout(() => {
|
|
179
|
+ if(that.latitude == '' || that.longitude == '') {
|
|
180
|
+ that.currentCaseId = ((that.CaseList || [])[0] || {}).CaseId
|
|
181
|
+ } else {
|
181
|
182
|
for (let i = 0; i < that.CaseList.length; i++) {
|
182
|
183
|
let result = that.CaseList[i].Coordinate.split(",")
|
183
|
184
|
let latitude2 = parseFloat(result[0])
|
184
|
185
|
let longitude2 = parseFloat(result[1])
|
185
|
|
- if (that.toolClass.getGreatCircleDistance(latitude1, longitude1, latitude2, longitude2) < 500) {
|
|
186
|
+ if (that.toolClass.getGreatCircleDistance(that.latitude, that.longitude, latitude2, longitude2) < 500) {
|
186
|
187
|
that.currentCaseId = that.CaseList[i].CaseId
|
187
|
|
- that.caseId = that.currentCaseId
|
188
|
|
- that.setBookCase(that.caseid)
|
189
|
|
- that.currentCaseName = that.CaseList[i].CaseName
|
190
|
188
|
}
|
191
|
189
|
}
|
192
|
|
- if (!that.currentCaseId || !that.currentCaseName) {
|
193
|
|
- that.currentCaseId = ((that.CaseList || [])[0] || {}).CaseId
|
194
|
|
- that.caseId = that.currentCaseId
|
195
|
|
- that.setBookCase(that.caseid)
|
196
|
|
- that.currentCaseName = ((that.CaseList || [])[0] || {}).CaseName
|
197
|
|
- }
|
198
|
|
- that.init()
|
199
|
|
- },
|
200
|
|
- cancel: function () {
|
201
|
|
- that.currentCaseId = ((that.CaseList || [])[0] || {}).CaseId
|
202
|
|
- that.caseId = that.currentCaseId
|
203
|
|
- that.setBookCase(that.caseid)
|
204
|
|
- that.currentCaseName = ((that.CaseList || [])[0] || {}).CaseName
|
205
|
|
- that.init()
|
206
|
|
- },
|
207
|
|
- fail: function () {
|
208
|
|
- that.currentCaseId = ((that.CaseList || [])[0] || {}).CaseId
|
209
|
|
- that.caseId = that.currentCaseId
|
210
|
|
- that.setBookCase(that.caseid)
|
211
|
|
- that.currentCaseName = ((that.CaseList || [])[0] || {}).CaseName
|
212
|
|
- that.init()
|
213
|
190
|
}
|
|
191
|
+ that.caseId = that.currentCaseId
|
|
192
|
+ that.setBookCase(that.caseId)
|
|
193
|
+ that.currentCaseName = ((that.CaseList || [])[0] || {}).CaseName
|
|
194
|
+ that.init()
|
|
195
|
+ }, 500)
|
|
196
|
+ wx.getLocation({
|
|
197
|
+ type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
|
198
|
+ success: function (res) {
|
|
199
|
+ that.latitude = res.latitude // 纬度,浮点数,范围为90 ~ -90
|
|
200
|
+ that.longitude = res.longitude // 经度,浮点数,范围为180 ~ -180。
|
|
201
|
+ },
|
214
|
202
|
})
|
215
|
203
|
} else {
|
216
|
204
|
this.currentCaseId = this.bookcaseid
|