main.html 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>登录</title>
  8. <script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  9. </head>
  10. <body>
  11. <div id="app">重定向...</div>
  12. <script>
  13. const redirectPath = getQueryString('redirectPath')
  14. if (redirectPath === "back") {
  15. wx.miniProgram.navigateBack();
  16. } else if (redirectPath === '/pages/mine/index') {
  17. wx.miniProgram.switchTab({
  18. url: "/pages/mine/index",
  19. });
  20. } else {
  21. wx.miniProgram.reLaunch({
  22. url: "/pages/home/index"
  23. });
  24. }
  25. function getQueryString(name, url) {
  26. let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
  27. let r = (url || window.location.search).substr(1).match(reg)
  28. if (r != null) {
  29. return decodeURIComponent(r[2])
  30. }
  31. return null
  32. }
  33. </script>
  34. </body>
  35. </html>