index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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. onShareTimeline: function() {
  129. return {
  130. title: this.miniHomeRemark,
  131. imageUrl: this.miniHomeImg,
  132. path: 'pages/tabbar/index/index',
  133. }
  134. },
  135. // 分享好友
  136. onShareAppMessage: function() {
  137. return {
  138. title: this.miniHomeRemark,
  139. imageUrl: this.miniHomeImg,
  140. path: 'pages/tabbar/index/index',
  141. }
  142. },
  143. /**
  144. * 请求非首页的子组件的下一页
  145. * */
  146. HandleLoadMoreProduct(){
  147. if (this.activeTab != 0) {
  148. let pitchOnPage = this.$refs.categoryShow
  149. if (pitchOnPage.total !== 0 && pitchOnPage.productList.length < pitchOnPage.total) {
  150. pitchOnPage.page++
  151. pitchOnPage.getData()
  152. }
  153. }
  154. },
  155. /**
  156. * 清空非首页的子组件商品数据
  157. * 回滚请求参数到起始页
  158. * */
  159. HandleCleanActiveTabProduct(){
  160. if(this.$refs.categoryShow){
  161. let pitchOnPage = this.$refs.categoryShow
  162. pitchOnPage.total = 0
  163. pitchOnPage.page=1
  164. pitchOnPage.productList=[]
  165. }
  166. },
  167. tabChange(index, id) {
  168. this.HandleCleanActiveTabProduct()
  169. this.activeTab = index
  170. this.categoryid = id
  171. },
  172. // 查询产品
  173. searchPro(key, type) {
  174. uni.navigateTo({
  175. url: `/pages_category_page1/search/index/index`
  176. })
  177. }
  178. }
  179. };
  180. </script>
  181. <style lang="scss"
  182. scoped>
  183. .header {
  184. .toLive {
  185. height: 40px;
  186. color: #FFF;
  187. background-color: #333;
  188. }
  189. .topBox {
  190. display: flex;
  191. align-items: center;
  192. justify-content: space-between;
  193. width: 100%;
  194. }
  195. .logo {
  196. width: 280rpx;
  197. height: 42rpx;
  198. margin-top: -40rpx;
  199. // margin-left: 30rpx;
  200. }
  201. .search-btn {
  202. height: 66rpx;
  203. background: rgba(255, 255, 255, 1);
  204. border-radius: 33rpx;
  205. display: flex;
  206. flex-direction: row;
  207. align-items: center;
  208. margin-right: 30rpx;
  209. .search-icon {
  210. width: 60rpx;
  211. height: 60rpx;
  212. // margin-left: 33rpx;
  213. }
  214. .search-word {
  215. font-size: 26rpx;
  216. font-weight: 400;
  217. color: rgba(153, 153, 153, 1);
  218. margin-left: 10rpx;
  219. }
  220. }
  221. .tabs-nav-warp {
  222. margin-top: 20rpx;
  223. padding: 0 30rpx;
  224. }
  225. .tabs-nav {
  226. .ul {
  227. display: flex;
  228. .li {
  229. flex: 1 0 auto;
  230. margin-left: 36rpx;
  231. font-size: 30rpx;
  232. color: #999999;
  233. position: relative;
  234. padding-bottom: 18rpx;
  235. &:first-child {
  236. margin-left: 0;
  237. }
  238. &.on {
  239. &:after {
  240. content: '';
  241. width: 100%;
  242. height: 4rpx;
  243. background: #C5AA7B;
  244. position: absolute;
  245. left: 0;
  246. bottom: 0;
  247. }
  248. font-weight: bold;
  249. }
  250. }
  251. }
  252. }
  253. }
  254. .weiXinBox {
  255. width: 100%;
  256. position: fixed;
  257. background: #FFFFFF;
  258. z-index: 99;
  259. }
  260. .wxBtnBg {
  261. padding: 0 20rpx;
  262. .weiXinBoxBtn {
  263. display: flex;
  264. align-items: center;
  265. padding: 10rpx 0 10rpx 15rpx;
  266. width: 100%;
  267. background: #F3F4F5;
  268. opacity: 1;
  269. .search-icon {
  270. width: 50rpx;
  271. height: 50rpx;
  272. margin-right: 20rpx;
  273. }
  274. text {
  275. color: #999999;
  276. }
  277. }
  278. }
  279. .terminal1 {
  280. .header {
  281. .topBox {
  282. // justify-content: left;
  283. .search-btn {
  284. .search-icon {
  285. margin-left: 0rpx;
  286. }
  287. }
  288. }
  289. }
  290. }
  291. .topTitle {
  292. display: flex;
  293. justify-content: center;
  294. align-items: center;
  295. height: 100rpx;
  296. width: 100%;
  297. .topText {
  298. text-align: center;
  299. color: #000000;
  300. font-size: 38rpx;
  301. font-weight: bold;
  302. }
  303. }
  304. .topWap {
  305. padding-top: 60rpx;
  306. .logo {
  307. margin-top: 0 !important;
  308. }
  309. }
  310. .terminal2 {
  311. }
  312. .terminal3 {
  313. }
  314. // 触底样式
  315. .reachBottom {
  316. margin-top: 30rpx;
  317. display: flex;
  318. flex-direction: column;
  319. align-items: center;
  320. .reach-icon {
  321. width: 150rpx;
  322. height: 150rpx;
  323. }
  324. .reach-text {
  325. margin: 20rpx 0;
  326. color: #CCCCCC;
  327. }
  328. }
  329. .Put-box1 {
  330. .btn {
  331. text-align: center;
  332. margin-top: 40rpx;
  333. border: 1px solid #333333;
  334. height: 80upx;
  335. line-height: 80upx;
  336. width: 100%;
  337. color: #333333;
  338. }
  339. .submit {
  340. background-color: #333333;
  341. color: #FFEBC4;
  342. }
  343. }
  344. </style>