index.vue 5.0 KB

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