Commit 7317eda6568a83b529595bbe9140f597c0d8b5ba

Authored by 徐烜
1 parent 47041650

电子站牌项目

1、修改bsth-line-chart-scrollList-page.js的initDataOfApi方法,当获取的线路路由数据为空时判定要重复获取线路路由数据
front-end/h5/src/components/core/plugins/bsth/bsth-line-chart-scrollList-page.js
@@ -174,26 +174,30 @@ export default { @@ -174,26 +174,30 @@ export default {
174 for (let obj of routeArray) { 174 for (let obj of routeArray) {
175 lineRouteDataOfApiArray.push(new LineRouteDataOfApi(obj)) 175 lineRouteDataOfApiArray.push(new LineRouteDataOfApi(obj))
176 } 176 }
177 - this.scrollListInnerData.initRouteData(lineRouteDataOfApiArray)  
178 - this.innerDataSet = this.scrollListInnerData.scrollDataItemList  
179 -  
180 - this.initLoadingText = '初始化线路gps...'  
181 - jsonp(this.gpsDataOfApiUrl).then((gpsArray) => {  
182 - const lineGpsDataOfApiArray = []  
183 - for (let obj of gpsArray) {  
184 - lineGpsDataOfApiArray.push(new LineGpsDataOfApi(obj))  
185 - }  
186 - this.scrollListInnerData.refreshGps(lineGpsDataOfApiArray)  
187 - }).catch((err2) => {  
188 - console.log(err2)  
189 - this.$message.error(` 获取gps数据失败,状态:${err2.status},错误:${err2.statusText}`, 1)  
190 - })  
191 - // 发送bindData事件,父组件绑定该事件  
192 - this.$emit('bindData', this.innerDataSet)  
193 - this.initLoading = false  
194 - // 启动滚动分页,gps刷新  
195 - this.scrollTimer.count++  
196 - this.gpsTimer.count++ 177 + if (lineRouteDataOfApiArray.length === 0) {
  178 + this.initLoadingText = `线路路由数据为空,等待${this.gps_data_refresh_seconds}秒后重新获取,请稍后...`
  179 + this.gpsTimer.count++
  180 + } else {
  181 + this.scrollListInnerData.initRouteData(lineRouteDataOfApiArray)
  182 + this.innerDataSet = this.scrollListInnerData.scrollDataItemList
  183 + this.initLoadingText = '初始化线路gps...'
  184 + jsonp(this.gpsDataOfApiUrl).then((gpsArray) => {
  185 + const lineGpsDataOfApiArray = []
  186 + for (let obj of gpsArray) {
  187 + lineGpsDataOfApiArray.push(new LineGpsDataOfApi(obj))
  188 + }
  189 + this.scrollListInnerData.refreshGps(lineGpsDataOfApiArray)
  190 + }).catch((err2) => {
  191 + console.log(err2)
  192 + this.$message.error(` 获取gps数据失败,状态:${err2.status},错误:${err2.statusText}`, 1)
  193 + })
  194 + // 发送bindData事件,父组件绑定该事件
  195 + this.$emit('bindData', this.innerDataSet)
  196 + this.initLoading = false
  197 + // 启动滚动分页,gps刷新
  198 + this.scrollTimer.count++
  199 + this.gpsTimer.count++
  200 + }
197 }).catch((err) => { 201 }).catch((err) => {
198 console.log(err) 202 console.log(err)
199 this.$message.error(` 获取路由数据失败,状态:${err.status},错误:${err.statusText}`, 1) 203 this.$message.error(` 获取路由数据失败,状态:${err.status},错误:${err.statusText}`, 1)