index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. ? imgHost + '/statics/images/close.gif'
  20. : imgHost + '/statics/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. import {HTTP_REQUEST_URL} from '@/config/app';
  34. export default {
  35. name: "Home",
  36. props: {},
  37. mixins:[colors],
  38. data: function() {
  39. return {
  40. top: "545",
  41. imgHost:HTTP_REQUEST_URL
  42. };
  43. },
  44. computed: mapGetters(["homeActive"]),
  45. methods: {
  46. setTouchMove(e) {
  47. var that = this;
  48. if (e.touches[0].clientY < 545 && e.touches[0].clientY > 66) {
  49. that.top = e.touches[0].clientY
  50. // that.setData({
  51. // top: e.touches[0].clientY
  52. // })
  53. }
  54. },
  55. open: function() {
  56. this.homeActive ?
  57. this.$store.commit("CLOSE_HOME") :
  58. this.$store.commit("OPEN_HOME");
  59. }
  60. },
  61. created() {},
  62. beforeDestroy() {
  63. this.$store.commit("CLOSE_HOME")
  64. }
  65. };
  66. </script>
  67. <style scoped>
  68. .pictrueBox {
  69. width: 130rpx;
  70. height: 120rpx;
  71. }
  72. /*返回主页按钮*/
  73. .home {
  74. position: fixed;
  75. color: white;
  76. text-align: center;
  77. z-index: 999;
  78. right: 15rpx;
  79. display: flex;
  80. }
  81. .home .homeCon {
  82. border-radius: 50rpx;
  83. opacity: 0;
  84. height: 0;
  85. color: var(--view-theme);
  86. width: 0;
  87. }
  88. .home .homeCon.on {
  89. opacity: 1;
  90. animation: bounceInRight 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000);
  91. width: 300rpx;
  92. height: 86rpx;
  93. margin-bottom: 20rpx;
  94. display: flex;
  95. justify-content: center;
  96. align-items: center;
  97. background: var(--view-theme) !important;
  98. opacity: 0.8;
  99. backdrop-filter: blur(10px);
  100. }
  101. .home .homeCon .iconfont {
  102. font-size: 48rpx;
  103. color: #fff;
  104. display: inline-block;
  105. margin: 0 auto;
  106. }
  107. .home .pictrue {
  108. width: 86rpx;
  109. height: 86rpx;
  110. border-radius: 50%;
  111. margin: 0 auto;
  112. background-color: var(--view-theme);
  113. }
  114. .home .pictrue .image {
  115. width: 100%;
  116. height: 100%;
  117. border-radius: 50%;
  118. transform: rotate(90deg);
  119. ms-transform: rotate(90deg);
  120. moz-transform: rotate(90deg);
  121. webkit-transform: rotate(90deg);
  122. o-transform: rotate(90deg);
  123. }
  124. </style>