index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 ? domain+'/static/images/navbtn_open.gif' : domain+'/static/images/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~2024 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. }
  48. },
  49. open: function() {
  50. this.homeActive ? this.$store.commit("CLOSE_HOME") : this.$store.commit("OPEN_HOME");
  51. }
  52. },
  53. created() {
  54. this.bottom = "50px";
  55. }
  56. };
  57. </script>
  58. <style scoped>
  59. .pictrueBox {
  60. width: 130rpx;
  61. height: 120rpx;
  62. }
  63. /*返回主页按钮*/
  64. .home {
  65. position: fixed;
  66. color: white;
  67. text-align: center;
  68. z-index: 9999;
  69. right: 15rpx;
  70. display: flex;
  71. }
  72. .home .homeCon {
  73. border-radius: 50rpx;
  74. opacity: 0;
  75. height: 0;
  76. color: #e93323;
  77. width: 0;
  78. }
  79. .home .homeCon.on {
  80. opacity: 1;
  81. animation: bounceInRight 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000);
  82. width: 300rpx;
  83. height: 86rpx;
  84. margin-bottom: 20rpx;
  85. display: flex;
  86. justify-content: center;
  87. align-items: center;
  88. background: var(--view-theme);
  89. }
  90. .home .homeCon .iconfont {
  91. font-size: 48rpx;
  92. color: #fff;
  93. display: inline-block;
  94. margin: 0 auto;
  95. }
  96. .home .pictrue {
  97. width: 86rpx;
  98. height: 86rpx;
  99. border-radius: 50%;
  100. margin: 0 auto;
  101. background-color: var(--view-theme);
  102. box-shadow: 0 5rpx 12rpx rgba(0, 0, 0, 0.5);
  103. }
  104. .home .pictrue .image {
  105. width: 100%;
  106. height: 100%;
  107. }
  108. .pictruea{
  109. width: 100%;
  110. height: 100%;
  111. display: block;
  112. object-fit: cover;
  113. vertical-align: middle;
  114. }
  115. </style>