index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div>
  3. <!-- #ifdef MP-WEIXIN -->
  4. <view class="header weiXinBox" :style="{'padding-top': topHeight + 'px'}">
  5. <view class="topBox" :style="{'height': height + 'px'}">
  6. <image class="logo" src="@/static/assets/img/logo.png" mode="widthFix"></image>
  7. </view>
  8. </view>
  9. <view class="wxBtnBg" :style="{'padding-top': (topHeight + height + 10) + 'px'}">
  10. <view class="weiXinBoxBtn" @click="searchPro">
  11. <image class="search-icon" src="@/static/images/searchImg.png" mode="widthFix"></image>
  12. <text>请输入您想要的宝贝</text>
  13. </view>
  14. </view>
  15. <!-- #endif -->
  16. <!-- #ifdef H5 || APP-PLUS -->
  17. <view class="header">
  18. <view class="topBox">
  19. <image class="logo" src="@/static/assets/img/logo.png" mode="widthFix"></image>
  20. <view class="search-btn" @click="searchPro">
  21. <image class="search-icon" src="@/static/img/search.png" mode="widthFix"></image>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- #endif -->
  26. <category-list @tabChange='tabChange'></category-list>
  27. <canvas-page v-if="activeTab==0" :terminal="terminal" :typeId="1"></canvas-page>
  28. <category-show v-else :categoryid="categoryid"></category-show>
  29. <ad-window ref="adWindow" :triggerCondition="1"></ad-window>
  30. <view class="reachBottom" v-if="topLeft > 400">
  31. <image class="reach-icon" src="@/static/img/reachBottom.png" mode="widthFix"></image>
  32. <text class="reach-text">这里到底了哦~~</text>
  33. </view>
  34. </div>
  35. </template>
  36. <script>
  37. import AdWindow from "@/components/adWindow";
  38. const API = require('../../../config/api')
  39. import CategoryList from "@/components/basics/categoryList.vue"
  40. import CategoryShow from "@/components/basics/categoryShow.vue"
  41. import canvasPage from '@/components/canvasShow/canvasShowPage.vue'
  42. export default {
  43. components: {
  44. AdWindow,
  45. CategoryList,
  46. CategoryShow,
  47. canvasPage,
  48. },
  49. data() {
  50. return {
  51. terminal: API.terminal,
  52. activeTab: 0,
  53. categoryid: 0,
  54. topHeight: 0,
  55. height: 0,
  56. topLeft: 0
  57. }
  58. },
  59. onShow() {
  60. let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  61. this.topHeight = menuButtonInfo.top + 10
  62. this.height = menuButtonInfo.height
  63. this.$refs.adWindow.getAd()
  64. },
  65. onPageScroll(e) {
  66. this.topLeft = e.scrollTop
  67. },
  68. methods: {
  69. tabChange(index, id) {
  70. this.activeTab = index
  71. this.categoryid = id
  72. },
  73. // 查询产品
  74. searchPro(key, type) {
  75. uni.navigateTo({
  76. url: `/pages_category_page1/search/index/index`
  77. })
  78. }
  79. }
  80. };
  81. </script>
  82. <style lang="scss" scoped>
  83. .header {
  84. .toLive{
  85. height: 40px;
  86. color: #FFF;
  87. background-color: #333;
  88. }
  89. .topBox {
  90. display: flex;
  91. align-items: center;
  92. justify-content: space-between;
  93. width: 100%;
  94. }
  95. .logo {
  96. width: 280rpx;
  97. height: 42rpx;
  98. margin-top: -40rpx;
  99. // margin-left: 30rpx;
  100. }
  101. .search-btn {
  102. height: 66rpx;
  103. background: rgba(255, 255, 255, 1);
  104. border-radius: 33rpx;
  105. display: flex;
  106. flex-direction: row;
  107. align-items: center;
  108. margin-right: 30rpx;
  109. .search-icon {
  110. width: 60rpx;
  111. height: 60rpx;
  112. // margin-left: 33rpx;
  113. }
  114. .search-word {
  115. font-size: 26rpx;
  116. font-weight: 400;
  117. color: rgba(153, 153, 153, 1);
  118. margin-left: 10rpx;
  119. }
  120. }
  121. .tabs-nav-warp {
  122. margin-top: 20rpx;
  123. padding: 0 30rpx;
  124. }
  125. .tabs-nav {
  126. .ul {
  127. display: flex;
  128. .li {
  129. flex: 1 0 auto;
  130. margin-left: 36rpx;
  131. font-size: 30rpx;
  132. color: #999999;
  133. position: relative;
  134. padding-bottom: 18rpx;
  135. &:first-child {
  136. margin-left: 0;
  137. }
  138. &.on {
  139. &:after {
  140. content: '';
  141. width: 100%;
  142. height: 4rpx;
  143. background: #C5AA7B;
  144. position: absolute;
  145. left: 0;
  146. bottom: 0;
  147. }
  148. font-weight:bold;
  149. }
  150. }
  151. }
  152. }
  153. }
  154. .weiXinBox {
  155. width: 100%;
  156. position: fixed;
  157. background: #FFFFFF;
  158. z-index: 99;
  159. }
  160. .wxBtnBg {
  161. padding: 0 20rpx;
  162. .weiXinBoxBtn {
  163. display: flex;
  164. align-items: center;
  165. padding: 10rpx 0 10rpx 15rpx;
  166. width: 100%;
  167. background: #F3F4F5;
  168. opacity: 1;
  169. .search-icon {
  170. width: 50rpx;
  171. height: 50rpx;
  172. margin-right: 20rpx;
  173. }
  174. text {
  175. color: #999999;
  176. }
  177. }
  178. }
  179. .terminal1 {
  180. .header {
  181. .topBox {
  182. // justify-content: left;
  183. .search-btn {
  184. .search-icon {
  185. margin-left: 0rpx;
  186. }
  187. }
  188. }
  189. }
  190. }
  191. .topTitle {
  192. display: flex;
  193. justify-content: center;
  194. align-items: center;
  195. height: 100rpx;
  196. width: 100%;
  197. .topText {
  198. text-align: center;
  199. color: #000000;
  200. font-size: 38rpx;
  201. font-weight: bold;
  202. }
  203. }
  204. .terminal2 {}
  205. .terminal3 {}
  206. // 触底样式
  207. .reachBottom{
  208. margin-top: 30rpx;
  209. display: flex;
  210. flex-direction: column;
  211. align-items: center;
  212. .reach-icon{
  213. width: 150rpx;
  214. height: 150rpx;
  215. }
  216. .reach-text{
  217. margin: 20rpx 0;
  218. color: #CCCCCC;
  219. }
  220. }
  221. </style>