index.vue 2.8 KB

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