index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. // #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
  61. let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  62. this.topHeight = menuButtonInfo.top + 10
  63. this.height = menuButtonInfo.height
  64. // #endif
  65. this.$refs.adWindow.getAd()
  66. },
  67. onPageScroll(e) {
  68. this.topLeft = e.scrollTop
  69. },
  70. methods: {
  71. tabChange(index, id) {
  72. this.activeTab = index
  73. this.categoryid = id
  74. },
  75. // 查询产品
  76. searchPro(key, type) {
  77. uni.navigateTo({
  78. url: `/pages_category_page1/search/index/index`
  79. })
  80. }
  81. }
  82. };
  83. </script>
  84. <style lang="scss" scoped>
  85. .header {
  86. .toLive{
  87. height: 40px;
  88. color: #FFF;
  89. background-color: #333;
  90. }
  91. .topBox {
  92. display: flex;
  93. align-items: center;
  94. justify-content: space-between;
  95. width: 100%;
  96. }
  97. .logo {
  98. width: 280rpx;
  99. height: 42rpx;
  100. margin-top: -40rpx;
  101. // margin-left: 30rpx;
  102. }
  103. .search-btn {
  104. height: 66rpx;
  105. background: rgba(255, 255, 255, 1);
  106. border-radius: 33rpx;
  107. display: flex;
  108. flex-direction: row;
  109. align-items: center;
  110. margin-right: 30rpx;
  111. .search-icon {
  112. width: 60rpx;
  113. height: 60rpx;
  114. // margin-left: 33rpx;
  115. }
  116. .search-word {
  117. font-size: 26rpx;
  118. font-weight: 400;
  119. color: rgba(153, 153, 153, 1);
  120. margin-left: 10rpx;
  121. }
  122. }
  123. .tabs-nav-warp {
  124. margin-top: 20rpx;
  125. padding: 0 30rpx;
  126. }
  127. .tabs-nav {
  128. .ul {
  129. display: flex;
  130. .li {
  131. flex: 1 0 auto;
  132. margin-left: 36rpx;
  133. font-size: 30rpx;
  134. color: #999999;
  135. position: relative;
  136. padding-bottom: 18rpx;
  137. &:first-child {
  138. margin-left: 0;
  139. }
  140. &.on {
  141. &:after {
  142. content: '';
  143. width: 100%;
  144. height: 4rpx;
  145. background: #C5AA7B;
  146. position: absolute;
  147. left: 0;
  148. bottom: 0;
  149. }
  150. font-weight:bold;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. .weiXinBox {
  157. width: 100%;
  158. position: fixed;
  159. background: #FFFFFF;
  160. z-index: 99;
  161. }
  162. .wxBtnBg {
  163. padding: 0 20rpx;
  164. .weiXinBoxBtn {
  165. display: flex;
  166. align-items: center;
  167. padding: 10rpx 0 10rpx 15rpx;
  168. width: 100%;
  169. background: #F3F4F5;
  170. opacity: 1;
  171. .search-icon {
  172. width: 50rpx;
  173. height: 50rpx;
  174. margin-right: 20rpx;
  175. }
  176. text {
  177. color: #999999;
  178. }
  179. }
  180. }
  181. .terminal1 {
  182. .header {
  183. .topBox {
  184. // justify-content: left;
  185. .search-btn {
  186. .search-icon {
  187. margin-left: 0rpx;
  188. }
  189. }
  190. }
  191. }
  192. }
  193. .topTitle {
  194. display: flex;
  195. justify-content: center;
  196. align-items: center;
  197. height: 100rpx;
  198. width: 100%;
  199. .topText {
  200. text-align: center;
  201. color: #000000;
  202. font-size: 38rpx;
  203. font-weight: bold;
  204. }
  205. }
  206. .terminal2 {}
  207. .terminal3 {}
  208. // 触底样式
  209. .reachBottom{
  210. margin-top: 30rpx;
  211. display: flex;
  212. flex-direction: column;
  213. align-items: center;
  214. .reach-icon{
  215. width: 150rpx;
  216. height: 150rpx;
  217. }
  218. .reach-text{
  219. margin: 20rpx 0;
  220. color: #CCCCCC;
  221. }
  222. }
  223. </style>