index.vue 2.7 KB

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