index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <div>
  3. <!-- #ifdef MP-WEIXIN -->
  4. <view class="header weiXinBox"
  5. :style="{'padding-top': topHeight + 'px'}">
  6. <view class="topBox"
  7. :style="{'height': height + 'px'}">
  8. <image class="logo"
  9. src="https://ceres.zkthink.com/static/assets/img/logo.png"
  10. mode="widthFix"></image>
  11. </view>
  12. </view>
  13. <view class="wxBtnBg"
  14. :style="{'padding-top': (topHeight + height + 10) + 'px'}">
  15. <view class="weiXinBoxBtn"
  16. @click="searchPro">
  17. <image class="search-icon"
  18. src="https://ceres.zkthink.com/static/images/searchImg.png"
  19. mode="widthFix">
  20. </image>
  21. <text>请输入您想要的宝贝</text>
  22. </view>
  23. </view>
  24. <!-- #endif -->
  25. <!-- #ifdef H5 || APP-PLUS -->
  26. <view class="header">
  27. <view class="topBox topWap">
  28. <image class="logo"
  29. src="https://ceres.zkthink.com/static/assets/img/logo.png"
  30. mode="widthFix"></image>
  31. <view class="search-btn"
  32. @click="searchPro">
  33. <image class="search-icon"
  34. src="https://ceres.zkthink.com/static/img/search.png"
  35. mode="widthFix">
  36. </image>
  37. </view>
  38. </view>
  39. </view>
  40. <!-- #endif -->
  41. <category-list @tabChange='tabChange'></category-list>
  42. <canvas-page ref="canvasPage"
  43. v-if="activeTab==0"
  44. :terminal="terminal"
  45. :typeId="1"></canvas-page>
  46. <category-show ref="categoryShow"
  47. v-else
  48. :categoryid="categoryid"></category-show>
  49. <ad-window ref="adWindow"
  50. :triggerCondition="1"></ad-window>
  51. <view class="reachBottom"
  52. v-if="topLeft > 400">
  53. <image class="reach-icon"
  54. src="https://ceres.zkthink.com/static/img/reachBottom.png"
  55. mode="widthFix">
  56. </image>
  57. <text class="reach-text">这里到底了哦~~</text>
  58. </view>
  59. <tui-modal :show="privacyShow"
  60. :custom="true"
  61. :fadein="true">
  62. <view class="Put-box1">
  63. <view class="text-align fs34 fs-bold">
  64. 协议与隐私政策
  65. </view>
  66. <p class="mar-top-20">欢迎来到cereshop!我们根据最新的法律、法规、监管政策要求,更新了cereshop隐私政策。</p>
  67. <view class="flex-display flex-sp-between">
  68. <view class="btn submit"
  69. @click="privacyShow = false">
  70. 同意
  71. </view>
  72. </view>
  73. </view>
  74. </tui-modal>
  75. </div>
  76. </template>
  77. <script>
  78. import tuiModal from "@/components/modal/modal";
  79. import AdWindow from "@/components/adWindow";
  80. const API = require('../../../config/api')
  81. import CategoryList from "@/components/basics/categoryList.vue"
  82. import CategoryShow from "@/components/basics/categoryShow.vue"
  83. import canvasPage from '@/components/canvasShow/canvasShowPage.vue'
  84. export default {
  85. components: {
  86. AdWindow,
  87. CategoryList,
  88. CategoryShow,
  89. canvasPage,
  90. tuiModal
  91. },
  92. data() {
  93. return {
  94. terminal: API.terminal,
  95. activeTab: 0,
  96. categoryid: 0,
  97. topHeight: 0,
  98. height: 0,
  99. topLeft: 0,
  100. privacyShow: false
  101. }
  102. },
  103. onReachBottom() {
  104. this.HandleLoadMoreProduct()
  105. },
  106. onLoad() {
  107. if (!uni.getStorageSync('storage_key')) {
  108. // #ifdef APP-PLUS
  109. this.privacyShow = true
  110. // #endif
  111. }
  112. this.$nextTick(() => {
  113. this.$refs.adWindow.getAd()
  114. })
  115. },
  116. onShow() {
  117. // #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
  118. let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  119. this.topHeight = menuButtonInfo.top + 10
  120. this.height = menuButtonInfo.height
  121. // #endif
  122. },
  123. onPageScroll(e) {
  124. this.topLeft = e.scrollTop
  125. },
  126. methods: {
  127. /**
  128. * 请求非首页的子组件的下一页
  129. * */
  130. HandleLoadMoreProduct(){
  131. if (this.activeTab != 0) {
  132. let pitchOnPage = this.$refs.categoryShow
  133. if (pitchOnPage.total !== 0 && pitchOnPage.productList.length < pitchOnPage.total) {
  134. pitchOnPage.page++
  135. pitchOnPage.getData()
  136. }
  137. }
  138. },
  139. /**
  140. * 清空非首页的子组件商品数据
  141. * 回滚请求参数到起始页
  142. * */
  143. HandleCleanActiveTabProduct(){
  144. if(this.$refs.categoryShow){
  145. let pitchOnPage = this.$refs.categoryShow
  146. pitchOnPage.total = 0
  147. pitchOnPage.page=1
  148. pitchOnPage.productList=[]
  149. }
  150. },
  151. tabChange(index, id) {
  152. this.HandleCleanActiveTabProduct()
  153. this.activeTab = index
  154. this.categoryid = id
  155. },
  156. // 查询产品
  157. searchPro(key, type) {
  158. uni.navigateTo({
  159. url: `/pages_category_page1/search/index/index`
  160. })
  161. }
  162. }
  163. };
  164. </script>
  165. <style lang="scss"
  166. scoped>
  167. .header {
  168. .toLive {
  169. height: 40px;
  170. color: #FFF;
  171. background-color: #333;
  172. }
  173. .topBox {
  174. display: flex;
  175. align-items: center;
  176. justify-content: space-between;
  177. width: 100%;
  178. }
  179. .logo {
  180. width: 280rpx;
  181. height: 42rpx;
  182. margin-top: -40rpx;
  183. // margin-left: 30rpx;
  184. }
  185. .search-btn {
  186. height: 66rpx;
  187. background: rgba(255, 255, 255, 1);
  188. border-radius: 33rpx;
  189. display: flex;
  190. flex-direction: row;
  191. align-items: center;
  192. margin-right: 30rpx;
  193. .search-icon {
  194. width: 60rpx;
  195. height: 60rpx;
  196. // margin-left: 33rpx;
  197. }
  198. .search-word {
  199. font-size: 26rpx;
  200. font-weight: 400;
  201. color: rgba(153, 153, 153, 1);
  202. margin-left: 10rpx;
  203. }
  204. }
  205. .tabs-nav-warp {
  206. margin-top: 20rpx;
  207. padding: 0 30rpx;
  208. }
  209. .tabs-nav {
  210. .ul {
  211. display: flex;
  212. .li {
  213. flex: 1 0 auto;
  214. margin-left: 36rpx;
  215. font-size: 30rpx;
  216. color: #999999;
  217. position: relative;
  218. padding-bottom: 18rpx;
  219. &:first-child {
  220. margin-left: 0;
  221. }
  222. &.on {
  223. &:after {
  224. content: '';
  225. width: 100%;
  226. height: 4rpx;
  227. background: #C5AA7B;
  228. position: absolute;
  229. left: 0;
  230. bottom: 0;
  231. }
  232. font-weight: bold;
  233. }
  234. }
  235. }
  236. }
  237. }
  238. .weiXinBox {
  239. width: 100%;
  240. position: fixed;
  241. background: #FFFFFF;
  242. z-index: 99;
  243. }
  244. .wxBtnBg {
  245. padding: 0 20rpx;
  246. .weiXinBoxBtn {
  247. display: flex;
  248. align-items: center;
  249. padding: 10rpx 0 10rpx 15rpx;
  250. width: 100%;
  251. background: #F3F4F5;
  252. opacity: 1;
  253. .search-icon {
  254. width: 50rpx;
  255. height: 50rpx;
  256. margin-right: 20rpx;
  257. }
  258. text {
  259. color: #999999;
  260. }
  261. }
  262. }
  263. .terminal1 {
  264. .header {
  265. .topBox {
  266. // justify-content: left;
  267. .search-btn {
  268. .search-icon {
  269. margin-left: 0rpx;
  270. }
  271. }
  272. }
  273. }
  274. }
  275. .topTitle {
  276. display: flex;
  277. justify-content: center;
  278. align-items: center;
  279. height: 100rpx;
  280. width: 100%;
  281. .topText {
  282. text-align: center;
  283. color: #000000;
  284. font-size: 38rpx;
  285. font-weight: bold;
  286. }
  287. }
  288. .topWap {
  289. padding-top: 60rpx;
  290. .logo {
  291. margin-top: 0 !important;
  292. }
  293. }
  294. .terminal2 {
  295. }
  296. .terminal3 {
  297. }
  298. // 触底样式
  299. .reachBottom {
  300. margin-top: 30rpx;
  301. display: flex;
  302. flex-direction: column;
  303. align-items: center;
  304. .reach-icon {
  305. width: 150rpx;
  306. height: 150rpx;
  307. }
  308. .reach-text {
  309. margin: 20rpx 0;
  310. color: #CCCCCC;
  311. }
  312. }
  313. .Put-box1 {
  314. .btn {
  315. text-align: center;
  316. margin-top: 40rpx;
  317. border: 1px solid #333333;
  318. height: 80upx;
  319. line-height: 80upx;
  320. width: 100%;
  321. color: #333333;
  322. }
  323. .submit {
  324. background-color: #333333;
  325. color: #FFEBC4;
  326. }
  327. }
  328. </style>