index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view style="touch-action: none;">
  3. <view class="home" style="position:fixed;" :style="{ top: top + 'px', bottom: bottom }" id="right-nav" @touchmove.stop.prevent="setTouchMove">
  4. <view class="homeCon bg-color-red" :class="homeActive === true ? 'on' : ''" v-if="homeActive">
  5. <navigator hover-class='none' url='/pages/index/index' open-type='switchTab' class='iconfont icon-shouye-xianxing'></navigator>
  6. <navigator hover-class='none' url='/pages/order_addcart/order_addcart' open-type='switchTab' class='iconfont icon-caigou-xianxing'></navigator>
  7. <navigator hover-class='none' url='/pages/user/index' open-type='switchTab' class='iconfont icon-yonghu1'></navigator>
  8. </view>
  9. <view @click="open" class="pictrueBox">
  10. <view class="pictrue">
  11. <image :src="
  12. homeActive === true
  13. ? '/static/images/close.gif'
  14. : '/static/images/open.gif'
  15. "
  16. class="image" />
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import {
  24. mapGetters
  25. } from "vuex";
  26. export default {
  27. name: "Home",
  28. props: {},
  29. data: function() {
  30. return {
  31. top: "",
  32. bottom: ""
  33. };
  34. },
  35. computed: mapGetters(["homeActive"]),
  36. methods: {
  37. setTouchMove(e) {
  38. var that = this;
  39. if (e.touches[0].clientY < 545 && e.touches[0].clientY > 66) {
  40. that.top = e.touches[0].clientY
  41. that.bottom = "auto";
  42. // that.setData({
  43. // top: e.touches[0].clientY
  44. // })
  45. }
  46. },
  47. open: function() {
  48. this.homeActive ?
  49. this.$store.commit("CLOSE_HOME") :
  50. this.$store.commit("OPEN_HOME");
  51. }
  52. },
  53. created() {
  54. this.bottom = "50px";
  55. }
  56. };
  57. </script>
  58. <style scoped>
  59. .pictrueBox {
  60. width: 130rpx;
  61. height: 120rpx;
  62. }
  63. /*返回主页按钮*/
  64. .home {
  65. position: fixed;
  66. color: white;
  67. text-align: center;
  68. z-index: 9999;
  69. right: 15rpx;
  70. display: flex;
  71. }
  72. .home .homeCon {
  73. border-radius: 50rpx;
  74. opacity: 0;
  75. height: 0;
  76. color: #e93323;
  77. width: 0;
  78. }
  79. .home .homeCon.on {
  80. opacity: 1;
  81. animation: bounceInRight 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000);
  82. width: 300rpx;
  83. height: 86rpx;
  84. margin-bottom: 20rpx;
  85. display: flex;
  86. justify-content: center;
  87. align-items: center;
  88. background: #f44939 !important;
  89. }
  90. .home .homeCon .iconfont {
  91. font-size: 48rpx;
  92. color: #fff;
  93. display: inline-block;
  94. margin: 0 auto;
  95. }
  96. .home .pictrue {
  97. width: 86rpx;
  98. height: 86rpx;
  99. border-radius: 50%;
  100. margin: 0 auto;
  101. }
  102. .home .pictrue .image {
  103. width: 100%;
  104. height: 100%;
  105. border-radius: 50%;
  106. transform: rotate(90deg);
  107. ms-transform: rotate(90deg);
  108. moz-transform: rotate(90deg);
  109. webkit-transform: rotate(90deg);
  110. o-transform: rotate(90deg);
  111. }
  112. </style>