sitePage.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import * as API from '@/apis/index.js'
  2. import Carmap from '@/components/Carmap.vue'
  3. export default {
  4. data() {
  5. return {
  6. mapopen:false,
  7. isReady:false,
  8. id:'',
  9. longitude: '',
  10. latitude: '',
  11. nearbyStationInfo:{
  12. nearbyShiftDTOList:[]
  13. }
  14. }
  15. },
  16. components: {
  17. Carmap
  18. },
  19. onLoad(op){
  20. this.longitude=op.longitude;
  21. this.latitude=op.latitude;
  22. this.id=op.id;
  23. },
  24. methods: {
  25. mapdown(){
  26. var obj={
  27. longitude:this.longitude,
  28. latitude:this.latitude,
  29. }
  30. var obj2={
  31. longitude:this.nearbyStationInfo.longitude,
  32. latitude:this.nearbyStationInfo.latitude,
  33. }
  34. this.$refs.amap.setPerson(obj);
  35. this.$refs.amap.setSite(obj2);
  36. },
  37. gotoLine(item,downid){
  38. uni.navigateTo({
  39. url:'/pages/route/index?id='+item.routeId+"&upid="+item.startStationId+"&downid="+downid
  40. })
  41. },
  42. mapopenBtn(){
  43. this.mapopen=!this.mapopen;
  44. if(this.mapopen){
  45. this.$refs.amap.setMyStyle("width: 100%; height: 340px;")
  46. }else{
  47. this.$refs.amap.setMyStyle("width: 100%; height: 140px;")
  48. }
  49. },
  50. gotoLine(item,downid){
  51. uni.navigateTo({
  52. url:'/pages/route/index?id='+item.routeId+"&upid="+item.startStationId+"&downid="+downid
  53. })
  54. },
  55. getNearbyStationInfo() {
  56. var obj={
  57. longitude:this.longitude,
  58. latitude:this.latitude,
  59. id:this.id,
  60. }
  61. this.$refs.common.showLoading();
  62. API.nearbyStationInfo(obj).then((res) => {
  63. this.nearbyStationInfo=res.data;
  64. this.$refs.common.showLoading(false);
  65. }).catch(error => {
  66. this.$refs.common.showLoading(false,error);
  67. })
  68. },
  69. },onReady(){
  70. this.getNearbyStationInfo();
  71. this.isReady=true;
  72. this.$refs.amap.init();
  73. },onShow(){
  74. if(this.isReady){
  75. this.getNearbyStationInfo();
  76. }
  77. },
  78. }