index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. // const key = '5WLBZ-H6RWU-NQVVO-BQG7I-XEHFK-PAFSF'; //使用在腾讯位置服务申请的key
  52. // const referer = 'test'; //调用插件的app的名称
  53. // const location = JSON.stringify({
  54. // latitude: 39.89631551,
  55. // longitude: 116.323459711
  56. // });
  57. // const category = '';
  58. // console.log('1');
  59. // uni.navigateTo({
  60. // url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&location=' + location + '&category=' + category
  61. // });
  62. },
  63. }
  64. }
  65. </script>
  66. <style lang="scss">
  67. .main {
  68. .one {
  69. text-align: center;
  70. button {
  71. margin: 2vw;
  72. }
  73. }
  74. }
  75. </style>