index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view class="home">
  3. <view class="homeCon" :class="!homeActive ? 'on' : ''">
  4. <view class="wrapper">
  5. <text class="iconfont iconsousuo2" @tap="navTo('/pages/index/search/search')"></text>
  6. </view>
  7. <view class="wrapper">
  8. <text class="iconfont iconshouhoukefu" @tap="navTo('/pages/service/service','tab')"></text>
  9. </view>
  10. <view class="wrapper">
  11. <!-- <text class="iconfont iconshouye" ></text> -->
  12. <image src="../../static/A01.png" mode="" @tap="navTo('/pages/index/index','tab')" style="width: 40upx;height: 40upx;"></image>
  13. </view>
  14. </view>
  15. <view class="menu" :class="'bg-' + themeColor.name" @tap.stop="open">
  16. <text class="iconfont iconkuaijiecaidan"></text>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. name: 'Home',
  23. data() {
  24. return {
  25. homeActive: true
  26. };
  27. },
  28. methods: {
  29. // 切换语言
  30. switchLanguage() {
  31. if (this._i18n.locale === 'zh') {
  32. this._i18n.locale = 'uyghur';
  33. this.currentLanguage = '切换语言';
  34. } else if (this._i18n.locale === 'uyghur') {
  35. this._i18n.locale = 'zh';
  36. this.currentLanguage = 'تىل ئالماشتۇرۇش';
  37. }
  38. this.$mStore.commit('setLocale', this._i18n.locale);
  39. uni.setNavigationBarTitle({ title: this._i18n.t('menu.my') });
  40. uni.setTabBarItem({ index: 0, text: this._i18n.t('menu.index') });
  41. uni.setTabBarItem({ index: 1, text: this._i18n.t('menu.category') });
  42. uni.setTabBarItem({ index: 2, text: this._i18n.t('menu.notify') });
  43. uni.setTabBarItem({ index: 3, text: this._i18n.t('menu.cart') });
  44. uni.setTabBarItem({ index: 4, text: this._i18n.t('menu.my') });
  45. this.homeActive = true;
  46. },
  47. open() {
  48. this.homeActive = !this.homeActive;
  49. },
  50. navTo(route, type) {
  51. this.homeActive = true;
  52. if (type === 'tab') {
  53. this.$mRouter.switchTab({ route });
  54. } else {
  55. this.$mRouter.push({ route });
  56. }
  57. }
  58. }
  59. };
  60. </script>
  61. <style scoped lang="scss">
  62. .home {
  63. position: fixed;
  64. color: white;
  65. right: 40upx;
  66. bottom: 240upx;
  67. /* #ifdef H5 */
  68. margin-bottom: env(safe-area-inset-bottom);
  69. /* #endif */
  70. text-align: center;
  71. z-index: 33;
  72. .homeCon {
  73. overflow: hidden;
  74. width: 0.86rem;
  75. border-radius: 0.5rem;
  76. transition: all 0.3s ease-in-out 0s;
  77. opacity: 0;
  78. transform: scale(0);
  79. height: 0;
  80. .wrapper {
  81. width: 72upx;
  82. height: 72upx;
  83. border-radius: 50%;
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. background-color: rgba(0,0,0,.5);
  88. margin-bottom: $spacing-base;
  89. .iconfont {
  90. font-size: 45upx;
  91. opacity: 1;
  92. color: $color-white;
  93. z-index: 92;
  94. }
  95. }
  96. }
  97. .on {
  98. opacity: 1;
  99. transform: scale(1);
  100. height: 280upx;
  101. width: 72upx;
  102. margin-bottom: 20upx;
  103. }
  104. .menu {
  105. width: 72upx;
  106. height: 72upx;
  107. border-radius: 50%;
  108. display: flex;
  109. justify-content: center;
  110. align-items: center;
  111. .iconfont {
  112. font-size: 45upx;
  113. opacity: 1;
  114. color: $color-white;
  115. z-index: 92;
  116. }
  117. }
  118. }
  119. </style>