index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view style="touch-action: none;" :style="viewColor">
  3. <view class="home" style="position:fixed;" :style="{ top: top + 'px', bottom: bottom }" id="right-nav" @touchmove.stop.prevent="setTouchMove">
  4. <view class="homeCon" :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="homeActive === true ? 'http://ygs.hqgjsmc.com/baseimg/navbtn_open.gif' : 'http://ygs.hqgjsmc.com/baseimg/navbtn_close.gif'"
  12. class="image pictruea" />
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. // +----------------------------------------------------------------------
  20. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  21. // +----------------------------------------------------------------------
  22. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  23. // +----------------------------------------------------------------------
  24. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  25. // +----------------------------------------------------------------------
  26. // | Author: CRMEB Team <admin@crmeb.com>
  27. // +----------------------------------------------------------------------
  28. import { mapGetters } from "vuex";
  29. import { HTTP_REQUEST_URL } from '@/config/app';
  30. export default {
  31. name: "Home",
  32. props: {},
  33. data: function() {
  34. return {
  35. domain: HTTP_REQUEST_URL,
  36. top: "",
  37. bottom: ""
  38. };
  39. },
  40. computed: mapGetters(["homeActive","viewColor","keyColor"]),
  41. methods: {
  42. setTouchMove(e) {
  43. var that = this;
  44. if (e.touches[0].clientY < 545 && e.touches[0].clientY > 66) {
  45. that.top = e.touches[0].clientY
  46. that.bottom = "auto";
  47. // that.setData({
  48. // top: e.touches[0].clientY
  49. // })
  50. }
  51. },
  52. open: function() {
  53. this.homeActive ?
  54. this.$store.commit("CLOSE_HOME") :
  55. this.$store.commit("OPEN_HOME");
  56. }
  57. },
  58. created() {
  59. this.bottom = "50px";
  60. }
  61. };
  62. </script>
  63. <style scoped>
  64. .pictrueBox {
  65. width: 130rpx;
  66. height: 120rpx;
  67. }
  68. /*返回主页按钮*/
  69. .home {
  70. position: fixed;
  71. color: white;
  72. text-align: center;
  73. z-index: 9999;
  74. right: 15rpx;
  75. display: flex;
  76. }
  77. .home .homeCon {
  78. border-radius: 50rpx;
  79. opacity: 0;
  80. height: 0;
  81. color: #e93323;
  82. width: 0;
  83. }
  84. .home .homeCon.on {
  85. opacity: 1;
  86. animation: bounceInRight 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000);
  87. width: 300rpx;
  88. height: 86rpx;
  89. margin-bottom: 20rpx;
  90. display: flex;
  91. justify-content: center;
  92. align-items: center;
  93. background: var(--view-theme);
  94. }
  95. .home .homeCon .iconfont {
  96. font-size: 48rpx;
  97. color: #fff;
  98. display: inline-block;
  99. margin: 0 auto;
  100. }
  101. .home .pictrue {
  102. width: 86rpx;
  103. height: 86rpx;
  104. border-radius: 50%;
  105. margin: 0 auto;
  106. background-color: var(--view-theme);
  107. box-shadow: 0 5rpx 12rpx rgba(0, 0, 0, 0.5);
  108. }
  109. .home .pictrue .image {
  110. width: 100%;
  111. height: 100%;
  112. }
  113. .pictruea{
  114. width: 100%;
  115. height: 100%;
  116. display: block;
  117. object-fit: cover;
  118. vertical-align: middle;
  119. }
  120. </style>