mplogin.vue 658 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <view>
  3. </view>
  4. </template>
  5. <script>
  6. export default {
  7. data() {
  8. return {
  9. };
  10. },
  11. onLoad(options) {
  12. uni.setStorageSync('token', options.token);
  13. uni.setStorageSync('user_id', options.user_id);
  14. // 获取登录前页面
  15. let url = '/' + uni.getStorageSync('currentPage');
  16. let pageOptions = uni.getStorageSync('currentPageOptions');
  17. if(Object.keys(pageOptions).length > 0){
  18. url += '?';
  19. for(let i in pageOptions){
  20. url += i + '=' + pageOptions[i] + '&';
  21. }
  22. url = url.substring(0, url.length - 1);
  23. }
  24. // 执行回调函数
  25. this.gotoPage(url, 'reLaunch');
  26. },
  27. }
  28. </script>
  29. <style>
  30. </style>