index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <button size="mini" @click="toCommon('pages/login/index')">登录页面</button>
  6. <button size="mini" @click="toCommon('pages/home/index')">首页</button>
  7. <button size="mini" @click="toCommon('pages/store/index')">微店</button>
  8. <button size="mini" @click="toCommon('pages/week/index')">周边</button>
  9. <button size="mini" @click="toCommon('pages/market/index')">购物车</button>
  10. <button size="mini" @click="toCommon('pages/my/index')">我的1</button>
  11. </view>
  12. <view class="two">
  13. </view>
  14. </view>
  15. </mobile-frame>
  16. </template>
  17. <script>
  18. export default {
  19. components: {},
  20. data() {
  21. return {
  22. };
  23. },
  24. onLoad: function() {},
  25. onShow: function() {
  26. const that = this;
  27. // 监听用户是否登录
  28. that.watchLogin();
  29. },
  30. methods: {
  31. // 公共跳转
  32. toCommon(e) {
  33. uni.navigateTo({
  34. url: `/${e}`
  35. });
  36. },
  37. watchLogin() {
  38. uni.getSystemInfo({
  39. success: async function(res) {
  40. uni.setStorage({
  41. key: 'system',
  42. data: res,
  43. success: function() {
  44. uni.redirectTo({
  45. url: `/pages/home/index`
  46. })
  47. }
  48. });
  49. }
  50. });
  51. },
  52. }
  53. }
  54. </script>
  55. <style lang="scss">
  56. .main {
  57. .one {
  58. text-align: center;
  59. button {
  60. margin: 2vw;
  61. }
  62. }
  63. }
  64. </style>