index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. }
  99. .home .homeCon .iconfont {
  100. font-size: 48rpx;
  101. color: #fff;
  102. display: inline-block;
  103. margin: 0 auto;
  104. }
  105. .home .pictrue {
  106. width: 86rpx;
  107. height: 86rpx;
  108. border-radius: 50%;
  109. margin: 0 auto;
  110. background-color: var(--view-theme);
  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>