index.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <view>
  3. </view>
  4. </template>
  5. <script>
  6. export default {
  7. data() {
  8. return {
  9. getstationCode:null,
  10. }
  11. },
  12. mounted() {
  13. this.getPamars()
  14. },
  15. onLoad(options) {
  16. if(options.stationCode){
  17. this.getstationCode=options.stationCode
  18. }
  19. if((decodeURIComponent(options.q)).split("=")[1]){
  20. this.getstationCode = (decodeURIComponent(options.q)).split("=")[1]
  21. }
  22. },
  23. methods: {
  24. getPamars(){
  25. if(this.$storage.getJson("token")){
  26. this.$http.getStationExchange({
  27. stationCode: this.getstationCode
  28. }).then(res => {
  29. if (res.code === 0 && res.data) {
  30. uni.redirectTo({
  31. url: '/pages/powerExchange/index?stationCode=' +this.getstationCode + '&exchangeNo=' + res.data
  32. })
  33. } else {
  34. uni.navigateTo({
  35. url: '/pages/public/404?error=' + res.msg
  36. })
  37. }
  38. })
  39. }else{
  40. uni.navigateTo({
  41. url: '/pages/public/login?topage='+this.getstationCode,
  42. });
  43. }
  44. }
  45. }
  46. }
  47. </script>
  48. <style>
  49. </style>