index.vue 1.4 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. <!-- <button @click="toChange">地址选择</button> -->
  14. </view>
  15. </view>
  16. </mobile-frame>
  17. </template>
  18. <script>
  19. export default {
  20. components: {},
  21. data() {
  22. return {
  23. };
  24. },
  25. onLoad: function() {},
  26. onShow: function() {
  27. const that = this;
  28. // 监听用户是否登录
  29. that.watchLogin();
  30. },
  31. methods: {
  32. // 公共跳转
  33. toCommon(e) {
  34. uni.navigateTo({
  35. url: `/${e}`
  36. });
  37. },
  38. watchLogin() {
  39. uni.getSystemInfo({
  40. success: async function(res) {
  41. uni.setStorage({
  42. key: 'system',
  43. data: res,
  44. success: function() {
  45. uni.redirectTo({
  46. url: `/pages/home/index`
  47. })
  48. }
  49. });
  50. }
  51. });
  52. },
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. .main {
  58. .one {
  59. text-align: center;
  60. button {
  61. margin: 2vw;
  62. }
  63. }
  64. }
  65. </style>