index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.setData({
  42. // top: e.touches[0].clientY
  43. // })
  44. }
  45. },
  46. open: function() {
  47. this.homeActive ?
  48. this.$store.commit("CLOSE_HOME") :
  49. this.$store.commit("OPEN_HOME");
  50. }
  51. },
  52. created() {
  53. this.bottom = "50px";
  54. }
  55. };
  56. </script>
  57. <style scoped>
  58. .pictrueBox {
  59. width: 130rpx;
  60. height: 120rpx;
  61. }
  62. /*返回主页按钮*/
  63. .home {
  64. position: fixed;
  65. color: white;
  66. text-align: center;
  67. z-index: 9999;
  68. right: 15rpx;
  69. display: flex;
  70. }
  71. .home .homeCon {
  72. border-radius: 50rpx;
  73. opacity: 0;
  74. height: 0;
  75. color: #e93323;
  76. width: 0;
  77. }
  78. .home .homeCon.on {
  79. opacity: 1;
  80. animation: bounceInRight 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000);
  81. width: 300rpx;
  82. height: 86rpx;
  83. margin-bottom: 20rpx;
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. background: #f44939 !important;
  88. }
  89. .home .homeCon .iconfont {
  90. font-size: 48rpx;
  91. color: #fff;
  92. display: inline-block;
  93. margin: 0 auto;
  94. }
  95. .home .pictrue {
  96. width: 86rpx;
  97. height: 86rpx;
  98. border-radius: 50%;
  99. margin: 0 auto;
  100. }
  101. .home .pictrue .image {
  102. width: 100%;
  103. height: 100%;
  104. border-radius: 50%;
  105. transform: rotate(90deg);
  106. ms-transform: rotate(90deg);
  107. moz-transform: rotate(90deg);
  108. webkit-transform: rotate(90deg);
  109. o-transform: rotate(90deg);
  110. }
  111. </style>