index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <!-- #ifdef APP-PLUS -->
  3. <view
  4. class="animated dialog_nav"
  5. :style="{ top: navH + 65 + 'rpx', marginTop: sysHeight }"
  6. :class="[goodList ? 'dialogIndex' : '', currentPage ? '' : '']"
  7. v-show="currentPage"
  8. >
  9. <!-- #endif -->
  10. <!-- #ifndef APP-PLUS -->
  11. <view
  12. class="animated dialog_nav"
  13. :style="{ top: navH + 15 + 'rpx' }"
  14. :class="[
  15. goodList ? 'dialogIndex' : '',
  16. goodsShow ? 'dialogGoods' : '',
  17. currentPage ? '' : '',
  18. ]"
  19. v-show="currentPage"
  20. >
  21. <!-- #endif -->
  22. <view
  23. class="dialog_nav_item"
  24. :class="item.after"
  25. v-for="(item, index) in selectNavList"
  26. :key="index"
  27. @click="linkPage(item.url)"
  28. >
  29. <text class="iconfont" :class="item.icon"></text>
  30. <text class="pl-20">{{ item.name }}</text>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. name: "homeIdex",
  38. props: {
  39. navH: {
  40. type: String | Number,
  41. default: "",
  42. },
  43. returnShow: {
  44. type: Boolean,
  45. default: true,
  46. },
  47. goodList: {
  48. type: Boolean,
  49. default: false,
  50. },
  51. currentPage: {
  52. type: Boolean,
  53. default: false,
  54. },
  55. goodsShow: {
  56. type: Boolean,
  57. default: false,
  58. },
  59. sysHeight: {
  60. type: String | Number,
  61. default: "",
  62. },
  63. },
  64. data: function () {
  65. return {
  66. selectNavList: [
  67. {
  68. name: this.$t(`首页`),
  69. icon: "icon-shouye8",
  70. url: "/pages/index/index",
  71. after: "dialog_after",
  72. },
  73. {
  74. name: this.$t(`搜索`),
  75. icon: "icon-sousuo6",
  76. url: "/pages/goods/goods_search/index",
  77. after: "dialog_after",
  78. },
  79. {
  80. name: this.$t(`购物车`),
  81. icon: "icon-gouwuche7",
  82. url: "/pages/order_addcart/order_addcart",
  83. after: "dialog_after",
  84. },
  85. {
  86. name: this.$t(`我的收藏`),
  87. icon: "icon-shoucang3",
  88. url: "/pages/users/user_goods_collection/index",
  89. after: "dialog_after",
  90. },
  91. {
  92. name: this.$t(`个人中心`),
  93. icon: "icon-gerenzhongxin1",
  94. url: "/pages/user/index",
  95. },
  96. ],
  97. };
  98. },
  99. methods: {
  100. linkPage(url) {
  101. if (
  102. [
  103. "/pages/goods_cate/goods_cate",
  104. "/pages/order_addcart/order_addcart",
  105. "/pages/user/index",
  106. "/pages/index/index",
  107. ].indexOf(url) == -1
  108. ) {
  109. uni.navigateTo({
  110. url: url,
  111. });
  112. } else {
  113. uni.switchTab({
  114. url: url,
  115. });
  116. }
  117. },
  118. },
  119. created() {},
  120. beforeDestroy() {},
  121. };
  122. </script>
  123. <style scoped lang="scss">
  124. .dialog_nav {
  125. position: absolute;
  126. /* #ifdef MP */
  127. left: 14rpx;
  128. /* #endif */
  129. /* #ifndef MP */
  130. right: -20rpx;
  131. /* #endif */
  132. width: 240rpx;
  133. background: #ffffff;
  134. box-shadow: 0px 0px 16rpx rgba(0, 0, 0, 0.08);
  135. z-index: 310;
  136. border-radius: 14rpx;
  137. &::before {
  138. content: "";
  139. width: 0;
  140. height: 0;
  141. border-left: 15rpx solid transparent;
  142. border-right: 15rpx solid transparent;
  143. border-bottom: 30rpx solid #fff;
  144. position: absolute;
  145. top: -30rpx;
  146. /* #ifdef APP-PLUS || H5 */
  147. right: 32rpx;
  148. /* #endif */
  149. /* #ifdef MP */
  150. left: 80rpx;
  151. /* #endif */
  152. border-bottom-color: #f2f2f2;
  153. }
  154. &::after {
  155. content: "";
  156. width: 0;
  157. height: 0;
  158. border-left: 15rpx solid transparent;
  159. border-right: 15rpx solid transparent;
  160. border-bottom: 30rpx solid #fff;
  161. position: absolute;
  162. top: -20rpx;
  163. /* #ifdef APP-PLUS || H5 */
  164. right: 32rpx;
  165. /* #endif */
  166. /* #ifdef MP */
  167. left: 80rpx;
  168. /* #endif */
  169. }
  170. &.dialogIndex {
  171. left: 14rpx;
  172. &::before {
  173. left: -160rpx !important;
  174. }
  175. }
  176. &.dialogGoods {
  177. &::before {
  178. left: -170rpx;
  179. }
  180. }
  181. }
  182. .dialog_nav_item {
  183. width: 100%;
  184. height: 84rpx;
  185. line-height: 84rpx;
  186. padding: 0 20rpx 0;
  187. box-sizing: border-box;
  188. border-bottom: #eee;
  189. font-size: 28rpx;
  190. color: #333;
  191. position: relative;
  192. display: flex;
  193. .iconfont {
  194. font-size: 32rpx;
  195. margin-right: 26rpx;
  196. }
  197. }
  198. .dialog_after {
  199. ::after {
  200. content: "";
  201. position: absolute;
  202. width: 90px;
  203. height: 1px;
  204. background-color: #eeeeee;
  205. bottom: 0;
  206. right: 0;
  207. }
  208. }
  209. </style>