index-page

  1. <style lang="less">
  2. .index-nood-modal {
  3. width: 100vw;
  4. height: 100vh;
  5. position: fixed;
  6. left: 0;
  7. top: 0;
  8. background: rgba(0, 0, 0, 0.7);
  9. z-index: 99999999999;
  10. .step1 {
  11. position: relative;
  12. width: 100%;
  13. height: 100%;
  14. .long-click {
  15. position: absolute;
  16. right: 53rpx;
  17. top: 21rpx;
  18. width: 532rpx;
  19. height: 488rpx;
  20. }
  21. .next {
  22. position: absolute;
  23. left: 0;
  24. right: 0;
  25. margin: 0 auto;
  26. bottom: 180rpx;
  27. width: 280rpx;
  28. height: 105rpx;
  29. }
  30. }
  31. .step2 {
  32. position: relative;
  33. width: 100%;
  34. height: 100%;
  35. .switch {
  36. position: absolute;
  37. width: 726rpx;
  38. height: 756rpx;
  39. left: 12rpx;
  40. right: 12rpx;
  41. top: 0;
  42. margin: 0 auto;
  43. }
  44. .known {
  45. position: absolute;
  46. left: 0;
  47. right: 0;
  48. margin: 0 auto;
  49. bottom: 180rpx;
  50. width: 280rpx;
  51. height: 105rpx;
  52. }
  53. }
  54. }
  55. #indexPage .wx-swiper-dot {
  56. margin-bottom: 20rpx;
  57. width: 12rpx;
  58. height: 12rpx;
  59. opacity: 0.2;
  60. background: #ffffff;
  61. }
  62. #indexPage .wx-swiper-dot-active {
  63. opacity: 1;
  64. background: #ffffff;
  65. }
  66. #indexPage::-webkit-scrollbar {
  67. display: none;
  68. height: 0;
  69. width: 0;
  70. color: transparent;
  71. }
  72. #indexPage {
  73. height: 100vh;
  74. .over::-webkit-scrollbar {
  75. display: none;
  76. height: 0;
  77. width: 0;
  78. color: transparent;
  79. }
  80. .ip-head {
  81. position: relative;
  82. z-index: 999;
  83. top: 0;
  84. }
  85. .head {
  86. position: absolute;
  87. left: 0;
  88. top: 0;
  89. right: 0;
  90. padding: 42rpx;
  91. z-index: 9999;
  92. transition: all 0.5s linear;
  93. .search {
  94. height: 72rpx;
  95. line-height: 72rpx;
  96. position: relative;
  97. background: rgb(250, 250, 250);
  98. border-radius: 36rpx;
  99. .search-icon {
  100. position: absolute;
  101. top: 50%;
  102. left: 38rpx;
  103. width: 44rpx;
  104. height: 44rpx;
  105. transform: translateY(-50%);
  106. }
  107. input {
  108. height: 100%;
  109. padding-left: 94rpx;
  110. font-size: 28rpx;
  111. color: rgb(178, 178, 178);
  112. }
  113. }
  114. }
  115. .swipe {
  116. .item {
  117. height: 100%;
  118. image {
  119. width: 100%;
  120. height: 100%;
  121. }
  122. }
  123. }
  124. }
  125. .i-mango {
  126. width: 240rpx;
  127. height: 260rpx;
  128. margin: 0 auto;
  129. margin-top: 160rpx;
  130. margin-bottom: 160rpx;
  131. image {
  132. width: 100%;
  133. height: 100%;
  134. }
  135. }
  136. .topWord {
  137. width: 100%;
  138. height: 227rpx;
  139. margin-left: 36rpx;
  140. margin-bottom: -66rpx;
  141. position: relative;
  142. .tpArrow {
  143. width: 58rpx;
  144. height: 58rpx;
  145. position: absolute;
  146. right: 76rpx;
  147. bottom: 93rpx;
  148. display: none;
  149. image {
  150. width: 100%;
  151. height: 100%;
  152. }
  153. }
  154. view {
  155. width: 100%;
  156. }
  157. .topBox {
  158. height: 136rpx;
  159. view {
  160. width: 72rpx;
  161. height: 72rpx;
  162. background-color: white;
  163. margin-top: -7rpx;
  164. }
  165. .newProductCn {
  166. height: 72rpx;
  167. font-size: 36rpx;
  168. width: 267rpx;
  169. background-color: white;
  170. }
  171. }
  172. .bottomBox {
  173. .newProductEn {
  174. font-size: 18rpx;
  175. line-height: 22rpx;
  176. color: #c2c2c2;
  177. letter-spacing: 15rpx;
  178. background-color: white;
  179. height: 18rpx;
  180. line-height: 18rpx;
  181. width: 620rpx;
  182. overflow: hidden;
  183. }
  184. view {
  185. width: 72rpx;
  186. height: 72rpx;
  187. background-color: white;
  188. }
  189. }
  190. }
  191. .scroll-tab-bar {
  192. width: 100%;
  193. height: 120rpx;
  194. line-height: 120rpx;
  195. white-space: nowrap;
  196. padding: 0rpx 41rpx;
  197. background-color: #ffffff;
  198. box-sizing: border-box;
  199. position: sticky;
  200. position: -webkit-sticky;
  201. z-index: 99;
  202. top: 0;
  203. .cpb-bar-item {
  204. display: inline-block;
  205. line-height: 120rpx;
  206. height: 120rpx;
  207. padding: 0rpx 36rpx;
  208. font-size: 30rpx;
  209. color: #171717;
  210. letter-spacing: 3.44rpx;
  211. background-color: #ffffff;
  212. overflow: hidden;
  213. }
  214. .currentCategoryStyle {
  215. font-family: PingFangSC-Semibold;
  216. font-size: 42rpx;
  217. color: #353535;
  218. letter-spacing: 4.5rpx;
  219. font-weight: 700;
  220. }
  221. .categoryPoint {
  222. width: 3px;
  223. height: 15.9rpx;
  224. background-color: #ff8080;
  225. transform: rotate(-135deg);
  226. display: inline-block;
  227. position: relative;
  228. top: -4rpx;
  229. }
  230. .category-point-left {
  231. left: -12rpx;
  232. }
  233. .category-point-right {
  234. right: -12rpx;
  235. }
  236. }
  237. .cpb-products {
  238. width: 100%;
  239. // 开启3d加速
  240. transform: translate3d(0, 0, 0);
  241. .odd-bgc {
  242. background-color: #f4f4f4;
  243. }
  244. .even-bgc {
  245. background-color: #dcebf2;
  246. }
  247. .cpb-line {
  248. width: 100%;
  249. height: 86rpx;
  250. display: flex;
  251. flex-direction: row-reverse;
  252. align-items: center;
  253. .cpb-right-line {
  254. width: 387rpx;
  255. border-bottom: 1rpx solid #eeeeee;
  256. margin-right: 42rpx;
  257. }
  258. }
  259. .cpb-line:nth-last-child(1) {
  260. display: none;
  261. }
  262. .cpb-category-name {
  263. height: 122rpx; // 减去描述之后的高度, 标题距离顶部和底部都是21px
  264. .cpb-category-name-top {
  265. height: 45rpx;
  266. margin-top: 42rpx;
  267. position: relative;
  268. .tt {
  269. width: 20rpx;
  270. height: 20rpx;
  271. position: absolute;
  272. top: -140rpx;
  273. left: 0rpx;
  274. }
  275. .cpb-category-name-top-line {
  276. border: none;
  277. width: 168rpx;
  278. border-bottom: 1rpx solid #b2b2b2;
  279. }
  280. .cpb-category-name-top-text {
  281. font-size: 32rpx;
  282. letter-spacing: 3rpx;
  283. line-height: 45rpx;
  284. padding: 0rpx 24rpx;
  285. background-color: #ffffff;
  286. color: #353535;
  287. font-weight: 700;
  288. }
  289. }
  290. .cpb-category-name-bottom {
  291. font-size: 18rpx;
  292. letter-spacing: 2rpx;
  293. line-height: 25rpx;
  294. text-align: center;
  295. background-color: #ffffff;
  296. color: #b2b2b2;
  297. margin-top: 12rpx;
  298. }
  299. }
  300. .cpb-product {
  301. padding-left: 42rpx;
  302. .cpb-left-img {
  303. width: 240rpx;
  304. height: 240rpx;
  305. margin-right: 36rpx;
  306. position: relative;
  307. border-radius: 18rpx;
  308. overflow: hidden;
  309. image {
  310. width: 100%;
  311. height: 100%;
  312. }
  313. .idForScroll {
  314. position: absolute;
  315. top: -200rpx;
  316. left: 0rpx;
  317. width: 10rpx;
  318. height: 1rpx;
  319. background-color: rgba(0, 0, 0, 0);
  320. }
  321. }
  322. .cpb-right-text {
  323. width: 382rpx;
  324. justify-content: space-between;
  325. .cpb-title {
  326. overflow: hidden;
  327. display: -webkit-box;
  328. -webkit-line-clamp: 1;
  329. -webkit-box-orient: vertical;
  330. white-space: normal;
  331. word-wrap: break-word;
  332. font-size: 30rpx;
  333. letter-spacing: 3.4rpx;
  334. color: #353535;
  335. line-height: 42rpx;
  336. }
  337. .cpb-des {
  338. overflow: hidden;
  339. display: -webkit-box;
  340. -webkit-line-clamp: 1;
  341. -webkit-box-orient: vertical;
  342. white-space: normal;
  343. word-wrap: break-word;
  344. font-size: 22rpx;
  345. letter-spacing: 3rpx;
  346. color: rgba(155, 155, 155, 0.87);
  347. line-height: 30rpx;
  348. margin-top: 18rpx;
  349. }
  350. .pro-activity {
  351. background: #ff5b21;
  352. border-radius: 6rpx;
  353. padding: 11rpx 12rpx;
  354. height: 36rpx;
  355. font-size: 20rpx;
  356. line-height: 1;
  357. color: #ffffff;
  358. letter-spacing: 1rpx;
  359. box-sizing: border-box;
  360. text-align: center;
  361. margin-top: 30rpx;
  362. font-weight: bold;
  363. }
  364. .pro-new-upload {
  365. background: #78e6b2;
  366. border-radius: 6rpx;
  367. padding: 11rpx 12rpx;
  368. height: 36rpx;
  369. font-size: 20rpx;
  370. line-height: 1;
  371. color: #fff;
  372. letter-spacing: 1rpx;
  373. box-sizing: border-box;
  374. text-align: center;
  375. margin-right: 24rpx;
  376. margin-top: 30rpx;
  377. font-weight: bold;
  378. }
  379. .activityLabel {
  380. background-color: #ff8375;
  381. border-radius: 6rpx;
  382. font-family: PingFangTC-Regular;
  383. font-size: 18rpx;
  384. color: #ffffff;
  385. letter-spacing: 1px;
  386. display: inline-block;
  387. padding: 5rpx 12rpx;
  388. margin-top: 18rpx;
  389. line-height: 25rpx;
  390. }
  391. .cpb-bottom {
  392. align-items: center;
  393. justify-content: flex-start;
  394. width: 100%;
  395. overflow: hidden;
  396. margin-bottom: 10rpx;
  397. .cpb-after-account {
  398. font-size: 22rpx;
  399. height: 36rpx;
  400. width: 60rpx;
  401. box-sizing: border-box;
  402. border: 2rpx solid #ff5b21;
  403. color: #ff5b21;
  404. display: flex;
  405. flex-direction: row;
  406. justify-content: center;
  407. align-items: center;
  408. letter-spacing: 0;
  409. }
  410. .cpb-now-price {
  411. font-size: 36rpx;
  412. line-height: 36rpx;
  413. color: #ff675a;
  414. margin-right: 10rpx;
  415. align-self: center;
  416. .cpb-now-price-rmb {
  417. font-size: 36rpx;
  418. line-height: 36rpx;
  419. color: #ff5b21;
  420. letter-spacing: 0;
  421. margin-right: 6rpx;
  422. }
  423. .cpb-now-price-num {
  424. font-size: 36rpx;
  425. line-height: 36rpx;
  426. color: #ff5b21;
  427. letter-spacing: 0;
  428. }
  429. .cpb-now-price-param {
  430. font-size: 22rpx;
  431. color: #ff5b21;
  432. letter-spacing: 1.69rpx;
  433. margin-left: 10rpx;
  434. }
  435. }
  436. .cpb-old-price {
  437. font-size: 24rpx;
  438. color: #bbbbbb;
  439. letter-spacing: 1rpx;
  440. text-decoration: line-through;
  441. line-height: 24rpx;
  442. align-self: center;
  443. }
  444. }
  445. }
  446. }
  447. }
  448. .new-coupon-container {
  449. z-index: 99999;
  450. position: fixed;
  451. top: 0;
  452. bottom: 0;
  453. left: 0;
  454. right: 0;
  455. background: rgba(0, 0, 0, 0.75);
  456. align-items: center;
  457. .coupon-fail {
  458. margin-top: 492rpx;
  459. font-size: 32rpx;
  460. color: #ffffff;
  461. letter-spacing: 3rpx;
  462. text-align: center;
  463. line-height: 50rpx;
  464. }
  465. .coupon-item {
  466. margin-top: 415rpx;
  467. height: 250rpx;
  468. width: 590rpx;
  469. background: url(https://image.velo.top/image/product/1525333541120.jpg)
  470. no-repeat;
  471. background-size: 100% 100%;
  472. padding: 42rpx 88rpx 42rpx 182rpx;
  473. box-sizing: border-box;
  474. .coupon-item-content {
  475. align-items: center;
  476. width: 320rpx;
  477. color: #353535;
  478. .coupon-content-left {
  479. .coupon-icon {
  480. font-size: 36rpx;
  481. letter-spacing: 2rpx;
  482. }
  483. .conpon-price {
  484. font-size: 72rpx;
  485. letter-spacing: 0;
  486. }
  487. }
  488. .coupon-content-right {
  489. margin-left: 18rpx;
  490. .coupon-name {
  491. font-family: PingFang-SC-Medium;
  492. font-size: 28rpx;
  493. font-weight: bold;
  494. }
  495. .coupon-date {
  496. white-space: nowrap;
  497. font-family: PingFangSC-Regular;
  498. font-size: 22rpx;
  499. letter-spacing: 0;
  500. }
  501. }
  502. }
  503. .coupon-btn {
  504. line-height: 0;
  505. width: 320rpx;
  506. height: 52rpx;
  507. border-radius: 26rpx;
  508. background: #ff7e5a;
  509. font-size: 24rpx;
  510. color: #ffffff;
  511. letter-spacing: 2.4rpx;
  512. }
  513. }
  514. }
  515. </style>
  516. <template>
  517. <view>
  518. <!-- 新人优惠券 -->
  519. <newerCoupon :isShow.sync="isShowNewerCoupon"></newerCoupon>
  520. <!-- 固定在顶部的标题, 需要商品有滚动效果时启用该代码 -->
  521. <view class="index-nood-modal" wx:if="{{noodStatus===1 || noodStatus===2}}">
  522. <view class="step1" wx:if="{{noodStatus===1}}">
  523. <image class="long-click" src="../asserts/img/long-click.png"></image>
  524. <image class="next" @tap="nextNoodGuide" src="../asserts/img/next.png"></image>
  525. </view>
  526. <view class="step2" wx:if="{{noodStatus===2}}">
  527. <view class="switch-applet-box">
  528. <image class="switch" src="../asserts/img/switch-applet.png"></image>
  529. </view>
  530. <image class="known" @tap="knowNoodGuide" src="../asserts/img/know.png"></image>
  531. </view>
  532. </view>
  533. <scroll-view scroll-y="true" id="indexPage" enable-back-to-top='{{true}}' @scroll="mainScroll" scroll-into-view="scrollId{{pageScrollTo}}">
  534. <!-- 新年物流通知 -->
  535. <newYearNotice wx:if='{{showMailTip}}'></newYearNotice>
  536. <view class='over'>
  537. <view class="ip-head">
  538. <view class="head flex-h flex-cc">
  539. <view class="search flex-1" @tap="toSearch">
  540. <image class="search-icon" src="../asserts/img/search.png"></image>
  541. <input placeholder="{{searchKeyWord?searchKeyWord:'搜索商品'}}" disabled="true" />
  542. </view>
  543. </view>
  544. <view class="swipe">
  545. <swiper style="height:660rpx" indicator-dots="{{indicatorDots}}"
  546. autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="true">
  547. <block wx:for="{{bannerData.imgUri}}" wx:key='{{index}}'>
  548. <swiper-item class="item" id="{{index}}" @tap.stop='bannerPush' >
  549. <image src="{{item}}" class="slide-image" width="355" height="150"/>
  550. </swiper-item>
  551. </block>
  552. </swiper>
  553. </view>
  554. </view>
  555. <!-- 固定吸顶的tab list -->
  556. <scroll-view class="scroll-tab-bar" scroll-x="true" scroll-into-view="categoryTitleTop{{currentTitleIndex}}" scroll-with-animation="true">
  557. <repeat for="{{categArr}}" key="index">
  558. <view id="categoryTitleTop{{index}}" style="{{index==0?'padding-left:20rpx;':''}}" class="cpb-bar-item {{currentTitleIndex==index?'currentCategoryStyle':''}}" @tap.stop="showCurrentCategoryProducts" data-sourceid="{{item.sourceId}}" data-category="{{index}}" >
  559. <view class="categoryPoint category-point-left" wx:if="{{currentTitleIndex===index}}"></view>
  560. {{item.title}}
  561. <view class="categoryPoint category-point-right" wx:if="{{currentTitleIndex===index}}"></view>
  562. </view>
  563. </repeat>
  564. </scroll-view>
  565. <!-- 商品列表 -->
  566. <view class="cpb-products flex-v">
  567. <repeat for="{{productArrs}}" key="idx" index="idx" item="item">
  568. <view class="cpb-category-name" wx:if="{{item.title}}">
  569. <view class="cpb-category-name-top flex-h flex-cc">
  570. <view class="cpb-category-name-top-line"></view>
  571. <view class="cpb-category-name-top-text">{{item.title}}</view>
  572. <view class="cpb-category-name-top-line"></view>
  573. <view class="tt" style="{{idx == 0 ? 'top:0rpx;':''}}"></view>
  574. </view>
  575. </view>
  576. <view class="cpb-product flex-h" style="" @tap.stop="gotoProductDetail" data-productid="{{item.productId}}" data-index="{{(idx+1)%2}}" >
  577. <view class="cpb-left-img flex-h flex-cc {{ (idx+1)%2?'pro-even-bk':'pro-odd-bk'}}">
  578. <image @load="bindloadImage" src="{{item.productUri}}"></image>
  579. <view class="idForScroll" id="scrollId{{item.sourceIndex}}" style="{{idx?'':'top:-240rpx;'}}"></view>
  580. </view>
  581. <view class="cpb-right-text flex-v">
  582. <view>
  583. <view class="cpb-title" style='-webkit-line-clamp: {{item.actName||item.newProduct?1:2}}'> {{item.productName}} </view>
  584. <view class="cpb-des">{{item.shortDescription}}</view>
  585. <view class="flex-h">
  586. <view class="{{android6?'pro-new-upload':'flex-h flex-cc pro-new-upload-flex'}}" wx:if="{{item.newProduct}}">上新</view>
  587. <view class="{{android6?'pro-activity':'flex-h flex-cc pro-active'}}" wx:if='{{item.actName}}'>{{item.actName?item.actName:''}}</view>
  588. </view>
  589. </view>
  590. <view class="cpb-bottom flex-h flex-cc">
  591. <!-- <view class="cpb-after-account">券后</view> -->
  592. <view class="cpb-now-price flex-h flex-cc">
  593. <view class="cpb-now-price-rmb">¥</view>
  594. <view class="cpb-now-price-num">{{item.priceAfterDiscount/100}}</view>
  595. <view class="cpb-now-price-param" wx:if="{{item.params}}"> / {{item.params}}</view>
  596. </view>
  597. <view class="cpb-old-price" hidden='{{item.price==item.priceAfterDiscount}}'>¥{{(item.price/100)}}</view>
  598. </view>
  599. </view>
  600. </view>
  601. <view class="cpb-line" wx:if="{{item.isCategoryLastProduct!='yes'}}" >
  602. <view class="cpb-right-line"></view>
  603. </view>
  604. </repeat>
  605. </view>
  606. <!-- 新品推荐 -->
  607. <repeat for="{{ newProductMoreGoodsData }}" key="index" index="index" item="item">
  608. <newProduct wx:if="{{item.floorType == 'new_launch'}}" :allInfo="item" ></newProduct>
  609. </repeat>
  610. <!-- footer -->
  611. <view class="i-mango" style="{{addImangoMargin?'margin-top:100rpx;':''}}">
  612. <image src="../asserts/img/end_wanwei.png"></image>
  613. </view>
  614. </view>
  615. <custoast/>
  616. </scroll-view>
  617. <!-- new 优惠券组件 -->
  618. <view class="new-coupon-container flex-v" wx:if='{{detail.isPopup}}' catchtouchmove>
  619. <view class="coupon-item flex-v flex-bc" wx:if='{{detail.allowAccept}}'>
  620. <view class="coupon-item-content flex-h" >
  621. <view class="coupon-content-left flex-h flex-cc">
  622. <view class="coupon-icon"></view>
  623. <view class="conpon-price">{{(detail.couponInfo.discount||0)/100}}</view>
  624. </view>
  625. <view class="coupon-content-right">
  626. <view class="coupon-name">{{detail.couponInfo.couponName}}</view>
  627. <view class="coupon-date">{{detail.couponInfo.validTime}}</view>
  628. </view>
  629. </view>
  630. <view class='coupon-btn flex-h flex-cc' @tap='receiveCoupon'><view>立即领取</view></view>
  631. </view>
  632. <view class='coupon-fail flex-v flex-cc' hidden='{{detail.allowAccept}}' wx:if='{{detail.recieveResult===0}}'>
  633. <view>领券成功</view>
  634. <view>请通过购买链接下单~</view>
  635. </view>
  636. <view class='coupon-fail flex-v flex-cc' hidden='{{detail.allowAccept}}' wx:if='{{detail.recieveResult===1||detail.recieveResult===3}}'>
  637. <view>抱歉,你来晚啦~</view>
  638. <view>券已领完,下次要早点哦~</view>
  639. </view>
  640. <view class='coupon-fail flex-v flex-cc' hidden='{{detail.allowAccept}}' wx:if='{{detail.recieveResult===2}}'>
  641. <view>抱歉,您的领券数量已达上限</view>
  642. </view>
  643. </view>
  644. </view>
  645. </template>
  646. <script>
  647. import wepy from 'wepy'
  648. import toast from '../components/toast'
  649. import moreGoodsProd from '../components/more-goods-prod'
  650. import newProduct from '../components/new-product'
  651. import tabBar from '../components/tab-bar'
  652. import NewYearNotice from '../components/new-year-notice'
  653. import newerCoupon from '../components/newer-coupon'
  654. import { checkUpdateApplet } from '../utils/util.js'
  655. var event = require('../utils/event.js')
  656. import {
  657. getIndexFrame,
  658. getFloorProductList,
  659. shareProduct,
  660. getNotice,
  661. pageRecord,
  662. wanweiIndexProductListV2,
  663. linkBindFromMP,
  664. pushRegisterDot,
  665. getCouponConfig,
  666. receiveCoupon
  667. // generateShareId
  668. } from '../service/api'
  669. export default class Index extends wepy.page {
  670. config = {
  671. navigationBarTitleText: '大叔家Ocandy'
  672. }
  673. components = {
  674. newProduct: newProduct,
  675. moreGoodsProd: moreGoodsProd,
  676. custoast: toast,
  677. tabBar: tabBar,
  678. newYearNotice: NewYearNotice,
  679. newerCoupon: newerCoupon
  680. }
  681. data = {
  682. indicatorDots: true,
  683. autoplay: true,
  684. interval: 3000,
  685. duration: 300,
  686. bannerData: {},
  687. bannerTarget: null,
  688. bannerTargetTypeArr: null,
  689. bannerTargetTitle: null,
  690. addShopCarProductId: '',
  691. indexFrame: [],
  692. newProductMoreGoodsData: [],
  693. pageScrollTo: '',
  694. addImangoMargin: false,
  695. noodStatus: 0,
  696. showMailTip: false,
  697. // 是否显示新手的优惠券
  698. isShowNewerCoupon: false,
  699. // 主页和搜索页输入框里的推荐搜索文字
  700. searchKeyWord: '',
  701. noRepeat: false,
  702. pageLoadTime: {},
  703. categoryAllData: [],
  704. categArr: [],
  705. productArrs: [],
  706. currentTitleIndex: 0,
  707. noReapClick: false,
  708. iosFixed: false,
  709. isIOS: false,
  710. scrollTopArr: [],
  711. current: -1,
  712. tabHeight: 70,
  713. isTabClick: false,
  714. detail: null
  715. }
  716. methods = {
  717. gotoProductDetail(e) {
  718. if (this.$parent.globalData.preventMoreTap(e)) {
  719. return
  720. }
  721. var type = e.currentTarget.dataset.index
  722. var productId = e.currentTarget.dataset.productid
  723. wx.navigateTo({
  724. url: `/pages/product-detail-page?type=${type}&productId=${productId}`,
  725. complete: () => {
  726. this.$emit('clearTimeOut')
  727. }
  728. })
  729. },
  730. bindloadImage() {
  731. if (!this.noRepeat) {
  732. this.noRepeat = true
  733. // 第一张图片加载完毕去获取dom的高度数组
  734. this.getScrollArray()
  735. this.pageLoadTime.imgTime = new Date().getTime()
  736. pageRecord({
  737. path: 'pages/index-page',
  738. readyTime: this.pageLoadTime.startTime,
  739. loadTime: this.pageLoadTime.imgTime
  740. }).then(res => {})
  741. console.log(
  742. 'index-page=>bindloadImage=>总耗时',
  743. this.pageLoadTime.imgTime - this.pageLoadTime.startTime
  744. )
  745. setTimeout(() => {
  746. this.noRepeat = true
  747. this.$apply()
  748. }, 3000)
  749. }
  750. },
  751. showCurrentCategoryProducts(e) {
  752. // 如果是点击tabbar 则禁止滚动事件触发,1s后解开
  753. this.isTabClick = true
  754. setTimeout(() => {
  755. this.isTabClick = false
  756. this.$apply()
  757. }, 1000)
  758. if (this.noReapClick === false) {
  759. this.noReapClick = true
  760. setTimeout(() => {
  761. this.noReapClick = false
  762. this.$apply()
  763. }, 500)
  764. this.pageScrollTo = e.currentTarget.dataset.sourceid + '0'
  765. setTimeout(() => {
  766. this.pageScrollTo = ''
  767. this.$apply()
  768. }, 1000)
  769. // title
  770. this.currentTitleIndex = e.currentTarget.dataset.category
  771. this.$apply()
  772. }
  773. },
  774. knowNoodGuide() {
  775. this.noodStatus = 3
  776. wx.showTabBar()
  777. },
  778. nextNoodGuide() {
  779. wepy.setStorageSync('indexNood', 1)
  780. this.noodStatus = 2
  781. },
  782. mainScroll(e) {
  783. if (this.isTabClick) {
  784. return
  785. }
  786. this.getCategoryNameTop()
  787. },
  788. toSearch(e) {
  789. if (this.$parent.globalData.preventMoreTap(e)) {
  790. return
  791. }
  792. wx.navigateTo({
  793. url: '/subPackage/search-page'
  794. })
  795. },
  796. bannerPush(e) {
  797. if (this.$parent.globalData.preventMoreTap(e)) {
  798. return
  799. }
  800. let target = this.bannerTarget[e.currentTarget.id]
  801. let targetType = this.bannerTargetTypeArr[e.currentTarget.id]
  802. let shareTitle = this.bannerTargetTitle[e.currentTarget.id]
  803. if (targetType === '0') {
  804. // 0不跳转
  805. console.log('index-page=>bannerPush=>不跳转')
  806. } else if (targetType === '1') {
  807. // 1跳转活动
  808. wx.navigateTo({
  809. url: `/pages/newer-coupon-page?shareTitle=${shareTitle}`
  810. })
  811. } else if (targetType === '2') {
  812. // 2跳转h5
  813. wx.navigateTo({
  814. url: `/pages/activity-page?url=${target}&shareTitle=${shareTitle}`
  815. })
  816. } else if (targetType === '3') {
  817. // 3跳转商品详情
  818. wx.navigateTo({
  819. url: `/pages/product-detail-page?productId=${target}`
  820. })
  821. }
  822. },
  823. receiveCoupon() {
  824. receiveCoupon({ couponConfigId: this.detail.couponConfigId }).then(
  825. res => {
  826. console.log('product-detial=>receiveCoupon=>领取优惠券', res)
  827. if (res && res.data) {
  828. return
  829. }
  830. if (res.allowWatch) {
  831. wx.showTabBar()
  832. this.detail.isPopup = false
  833. this.toast({ title: res.msg, time: 1000 })
  834. } else {
  835. this.detail.recieveResult = res.recieveResult
  836. this.detail.allowAccept = 0
  837. }
  838. this.$apply()
  839. }
  840. )
  841. }
  842. }
  843. onShareAppMessage(res) {
  844. var _this = this
  845. var productId = res.target ? res.target.dataset.productid : ''
  846. var shareId = res.target ? res.target.dataset.shareid : ''
  847. var type = res.target ? res.target.dataset.type : ''
  848. var floorIndex = res.target ? res.target.dataset.floorindex : ''
  849. var index = res.target ? res.target.dataset.index : ''
  850. var bindRelationshareId = this.$parent.globalData.bindRelationshareId
  851. console.log(
  852. 'index-page =>onShareAppMessge =>bindRelationshareId',
  853. bindRelationshareId
  854. )
  855. var path =
  856. res.from !== 'menu'
  857. ? `/pages/index-page?productId=${productId}&isShare=1&type=${type}&shareId=${shareId}`
  858. : `/pages/index-page?bindRelationshareId=${bindRelationshareId}`
  859. return {
  860. title: res.target ? res.target.dataset.title : '好吃的,在大叔家Ocandy',
  861. path: path,
  862. imageUrl: res.target ? res.target.dataset.imgurl : '',
  863. success: function(_) {
  864. // 转发成功
  865. if (res.from !== 'menu') {
  866. shareProduct({ productId: productId }).then(res => {
  867. _this.newProductMoreGoodsData[floorIndex].products[index].shareNum++
  868. _this.$apply()
  869. })
  870. } else {
  871. // 更换shareId方法
  872. _this.$parent.changeRelationShareId()
  873. }
  874. }
  875. }
  876. }
  877. toast(obj) {
  878. return new Promise((resolve, reject) => {
  879. this.$invoke('custoast', 'showToast', obj).then(res => {
  880. resolve(res)
  881. })
  882. })
  883. }
  884. events = {
  885. emitCategoryAllData(categoryAllData) {
  886. this.$broadcast('broadcastCategoryAllData', categoryAllData)
  887. },
  888. 'index-emit': (...args) => {
  889. let $event = args[args.length - 1]
  890. console.log(
  891. `index-page=>emitCategoryAllData=> ${this.$name} receive ${
  892. $event.name
  893. } from ${$event.source.$name}`
  894. )
  895. },
  896. openShopCar: arg => {
  897. this.addShopCarProductId = arg
  898. this.$invoke('attrbox', 'setAnimation', {
  899. productId: this.addShopCarProductId,
  900. from: 'index'
  901. })
  902. this.$apply()
  903. }
  904. }
  905. getIndexData() {
  906. this.newProductMoreGoodsData = []
  907. getIndexFrame({}).then(res => {
  908. this.indexFrame = res
  909. if (res[res.length - 1].floorType === 'recommend') {
  910. this.addImangoMargin = true
  911. }
  912. // 获取初始数据, 将先后顺序放到新数组
  913. res.forEach((item, index) => {
  914. var idx = this.newProductMoreGoodsData.length
  915. // 新品发布
  916. if (item.sourceId && item.floorType === 'new_launch') {
  917. this.newProductMoreGoodsData[idx] = {}
  918. this.newProductMoreGoodsData[idx].floorType = item.floorType // 楼层信息
  919. this.newProductMoreGoodsData[idx].sourceData = item // 原始数据, 用于渲染'新品发布'
  920. setTimeout(() => {
  921. getFloorProductList({ sourceId: item.sourceId }).then(res => {
  922. this.newProductMoreGoodsData[idx].products = res // 商品数据
  923. this.$apply()
  924. })
  925. }, 2000)
  926. // 更多优选
  927. } else if (item.sourceId && item.floorType === 'recommend') {
  928. this.newProductMoreGoodsData[idx] = {}
  929. this.newProductMoreGoodsData[idx].floorType = item.floorType // 楼层信息
  930. this.newProductMoreGoodsData[idx].sourceData = item // 原始数据, 用于渲染'更多优选'
  931. setTimeout(() => {
  932. getFloorProductList({ sourceId: item.sourceId }).then(res => {
  933. this.newProductMoreGoodsData[idx].products = res // 商品数据
  934. this.$apply()
  935. })
  936. }, 2000)
  937. // banner数据
  938. } else if (item.floorType === 'banner') {
  939. this.bannerData = item
  940. this.bannerData.imgUri = item.imgUri.split(',')
  941. this.bannerTarget = item.target.split(',')
  942. this.bannerTargetTypeArr = item.targetType.split(',')
  943. this.bannerTargetTitle = item.title.split(',')
  944. console.log(
  945. 'index-page=>getIndexData=>this.bannerTargetTitle',
  946. this.bannerTargetTitle
  947. )
  948. }
  949. })
  950. this.$apply()
  951. })
  952. }
  953. indexNood() {
  954. const indexNood = wepy.getStorageSync('indexNood')
  955. if (indexNood === 0) {
  956. this.noodStatus = 1
  957. wx.hideTabBar()
  958. }
  959. }
  960. onReady() {
  961. this.pageLoadTime.domTime =
  962. new Date().getTime() - this.pageLoadTime.startTime
  963. }
  964. getScrollArray() {
  965. var query = wx.createSelectorQuery()
  966. query
  967. .selectAll('.cpb-category-name')
  968. .boundingClientRect(res => {
  969. res.forEach(element => {
  970. this.scrollTopArr.push(element.top - this.tabHeight)
  971. })
  972. })
  973. .exec()
  974. wx.hideLoading()
  975. }
  976. findPlace(code, arr) {
  977. let array = arr.slice(0)
  978. var codeMin = Math.min.apply(null, array)
  979. var codeIndex = 0
  980. if (code <= codeMin) {
  981. codeIndex = 0
  982. } else {
  983. array.push(code)
  984. array.sort(function(x, y) {
  985. return x - y
  986. })
  987. codeIndex = array.indexOf(code) - 1
  988. }
  989. return codeIndex
  990. }
  991. getCategoryNameTop() {
  992. wx
  993. .createSelectorQuery()
  994. .select('#indexPage')
  995. .fields({ scrollOffset: true }, res => {
  996. this.current = this.findPlace(res.scrollTop, this.scrollTopArr)
  997. if (this.current !== this.currentTitleIndex) {
  998. this.currentTitleIndex = this.current
  999. this.$apply()
  1000. }
  1001. })
  1002. .exec()
  1003. }
  1004. async initData() {
  1005. this.categoryAllData = await wanweiIndexProductListV2({})
  1006. if (!this.categoryAllData.length) {
  1007. return
  1008. }
  1009. this.categoryAllData.forEach((item, index) => {
  1010. if (item.productList.length) {
  1011. item.productList[item.productList.length - 1].isCategoryLastProduct =
  1012. 'yes'
  1013. }
  1014. let title = item.title
  1015. let description = item.description
  1016. let flag = true
  1017. // 如果某个分类的商品个数为0则不往下执行
  1018. if (!item.productList.length) {
  1019. return
  1020. }
  1021. // 记录此分类的商品数量
  1022. item.productsLength = item.productList.length
  1023. item.productList.forEach((itm, idx) => {
  1024. if (typeof item === 'object') {
  1025. if (flag) {
  1026. itm.title = title
  1027. itm.description = description
  1028. // 将此分类的商品数量挂载到此分类的第一个商品上
  1029. itm.productsLength = item.productsLength
  1030. flag = false
  1031. this.productArrs.push(itm)
  1032. } else {
  1033. this.productArrs.push(itm)
  1034. }
  1035. }
  1036. })
  1037. // 获取分类的数据
  1038. this.categArr.push({
  1039. title: item.title,
  1040. sourceId: item.sourceId,
  1041. productsLength: item.productList[0].productsLength
  1042. })
  1043. })
  1044. this.categoryScrollTo = this.categArr[0].sourceId
  1045. this.$apply()
  1046. }
  1047. GZHToGroupDetail(opts) {
  1048. if (opts.openRecordId) {
  1049. wx.navigateTo({
  1050. url: `/pages/group/group-detail-page?openRecordId=${opts.openRecordId}`
  1051. })
  1052. } else if (opts.toPage === 'couponPage') {
  1053. wx.navigateTo({
  1054. url: `/pages/coupon-page`
  1055. })
  1056. } else {
  1057. if (opts.toPage) {
  1058. wx.navigateTo({
  1059. url: opts.toPage
  1060. })
  1061. }
  1062. }
  1063. }
  1064. noticeCardCoupon() {
  1065. event.emit('readyToGetGlobalData', 1)
  1066. }
  1067. async onLoad(opt) {
  1068. wx.hideShareMenu()
  1069. wx.showLoading({
  1070. title: '加载中...'
  1071. })
  1072. console.log('index-page =>onload =>opt', opt)
  1073. // 获取设备信息
  1074. const deviceInfo = wx.getSystemInfoSync()
  1075. if (deviceInfo.platform === 'ios') {
  1076. this.isIOS = true
  1077. } else {
  1078. this.isIOS = false
  1079. }
  1080. this.$parent.globalData.isAndroid = deviceInfo.platform === 'android'
  1081. // 初始化图片打点时间
  1082. this.pageLoadTime.startTime = new Date().getTime()
  1083. await this.$parent.userLogin()
  1084. // 首页领取优惠券
  1085. if (opt.scene) {
  1086. this.getCoupon(opt.scene)
  1087. }
  1088. // 运营打点
  1089. this.yyDot(opt)
  1090. // 从首页或活动分享menu分享进来,绑定关系
  1091. this.judgeRelation(opt)
  1092. // 通知卡片, 获取优惠券信息
  1093. this.noticeCardCoupon()
  1094. // 公众号跳转到拼团详情
  1095. this.GZHToGroupDetail(opt)
  1096. // 输入框的搜索关键字
  1097. this.searchKeyWord = this.$parent.globalData.searchKeyWord
  1098. // 获取分类信息
  1099. this.initData()
  1100. this.getNoticeList()
  1101. // 获取主页信息
  1102. this.getIndexData()
  1103. this.$apply()
  1104. // 判断推手身份,展示推手新手引导
  1105. if (this.$parent.globalData.isPush === 1) {
  1106. this.indexNood()
  1107. }
  1108. // 判断不是推手且(此处不确定)
  1109. console.log(
  1110. 'index-page=>onload=>opt.recommend',
  1111. opt.recommend,
  1112. this.$parent.globalData.isPush
  1113. )
  1114. if (opt.recommend && this.$parent.globalData.isPush === 0) {
  1115. wx.navigateTo({
  1116. url: `/pages/product-detail-page?type=${opt.type}&productId=${
  1117. opt.productId
  1118. }&shareId=${opt.shareId}`
  1119. })
  1120. }
  1121. await this.$broadcast('onLoadFuc')
  1122. // 如果为1则弹框, 领券
  1123. this.isShowNewerCoupon = this.$parent.globalData.newWxCoupon
  1124. this.$apply()
  1125. }
  1126. // 扫码首页领取优惠券
  1127. getCoupon(couponConfigId) {
  1128. getCouponConfig({ couponConfigId: couponConfigId }).then(res => {
  1129. this.detail = res
  1130. wx.hideTabBar()
  1131. console.log('index-page=>getCoupon=>获取优惠券', res)
  1132. })
  1133. }
  1134. // 运营来源打点
  1135. yyDot(opts) {
  1136. if (opts.yysource) {
  1137. pushRegisterDot({
  1138. yysource: opts.yysource,
  1139. velo: 'ww',
  1140. accId: this.$parent.globalData.accId || ''
  1141. }).then(res => {
  1142. console.log('index-page=>yyDot=>res', res)
  1143. })
  1144. }
  1145. }
  1146. onShow() {
  1147. checkUpdateApplet()
  1148. }
  1149. getNoticeList() {
  1150. getNotice({}).then(res => {
  1151. console.log('index-page=>getNoticeList=>获取notice', res)
  1152. this.noticeList = res || []
  1153. if (res && res.length > 0) {
  1154. this.showMailTip = true
  1155. this.$parent.globalData.addBannerHeight = 72
  1156. } else {
  1157. this.showMailTip = false
  1158. this.$parent.globalData.addBannerHeight = 0
  1159. }
  1160. this.$apply()
  1161. })
  1162. }
  1163. /**
  1164. * 请求绑定关系的接口,绑定上级关系
  1165. */
  1166. bindRelation(opt) {
  1167. linkBindFromMP({ fromId: opt.bindRelationshareId }).then(
  1168. res => {
  1169. console.log(
  1170. 'index-page =>onload =>linkBindFromMP绑定成功',
  1171. opt.bindRelationshareId,
  1172. res
  1173. )
  1174. },
  1175. err => {
  1176. console.log('index-page =>onload =>linkBindFromMP绑定失败=>err', err)
  1177. }
  1178. )
  1179. }
  1180. /**
  1181. * 判断是否需要绑定从首页和活动页右上角分享出来的页面
  1182. */
  1183. async judgeRelation(opt) {
  1184. // 请求shareId
  1185. await this.$parent.getIndexShareId().then(res => {
  1186. console.log('index-page =>judgeRelation =>获取shareId成功')
  1187. wx.showShareMenu()
  1188. })
  1189. // 判断是否需要绑定关系
  1190. if (opt.bindRelationshareId && this.$parent.globalData.isPush !== 1) {
  1191. this.bindRelation(opt)
  1192. }
  1193. // 判断是否需要跳转到活动页
  1194. if (opt.pagePath) {
  1195. var url = opt.actUrl
  1196. ? `${opt.pagePath}?shareTitle=${opt.shareTitle}&url=${opt.actUrl}`
  1197. : `${opt.pagePath}?shareTitle=${opt.shareTitle}`
  1198. wx.navigateTo({
  1199. url: url
  1200. })
  1201. }
  1202. }
  1203. }
  1204. </script>

home-page-old

<style lang="less">
.homePage {
.tabbar {
height: 80rpx;
width: 100%;
align-items: center;
.bar-item {
height: 100%;
.content {
height: 100%;
position: relative;
.title {
font-size: 30rpx;
line-height: 50rpx;
letter-spacing: 1rpx;
color: #333333;
}
.select-bar {
color: #ff8080;
}
.border-line {
position: absolute;
width: 100%;
height: 5rpx;
background: #ff8080;
left: 0;
bottom: 0;
}
}
}
}
.banner {
height: 400rpx;
width: 100%;
position: relative;
.search-box {
width: 691rpx;
height: 80rpx;
position: absolute;
left: 30rpx;
top: 20rpx;
background: #fff;
border-radius: 40rpx;
align-items: center;
font-size: 28rpx;
color: #cccccc;
z-index: 99;
.icon {
height: 24rpx;
width: 24rpx;
margin-left: 25rpx;
margin-right: 21rpx;
}
}
.swiper {
width: 100%;
height: 100%;
.swiper-item {
width: 100%;
height: 100%;
image {
width: 100%;
height: 100%;
}
}
}
}
.discount {
width: 690rpx;
height: 140rpx;
background: #000;
margin: 40rpx 0;
}
.tag-bar {
margin-top: 30rpx;
width: 100%;
justify-content: flex-start;
.item {
min-width: 25%;
max-width: 25%;
margin-bottom: 20rpx;
.icon {
height: 90rpx;
width: 90rpx;
min-width: 90rpx;
margin-bottom: 20rpx;
}
.tag-name {
font-size: 24rpx;
color: #666666;
}
}
}
.activity {
margin-top: 30rpx;
width: 100%;
.act-title {
height: 140rpx;
width: 100%;
.act-name {
padding: 0 38rpx;
height: 60rpx;
border: 2rpx solid #ff8080;
border-radius: 30rpx;
font-size: 32rpx;
color: #333333;
background: #fff5f1;
}
}
.act-title-1 {
height: 400rpx;
width: 100%;
.act-name {
padding: 0 38rpx;
height: 60rpx;
border: 2rpx solid #ff8080;
border-radius: 30rpx;
font-size: 32rpx;
color: #333333;
background: #fff5f1;
}
}
.goods-top {
width: 100%;
}
.goods-item {
margin-top: 40rpx;
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
.goods-img {
height: 200rpx;
width: 200rpx;
border-radius: 20rpx;
}
.goods-right {
margin-left: 20rpx;
height: 200rpx;
.goods-name {
font-size: 28rpx;
color: #333333;
overflow: hidden;
margin-bottom: 15rpx;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
white-space: normal;
display: -webkit-box;
text-overflow: ellipsis;
word-wrap: break-word;
}
.goods-desc {
font-size: 24rpx;
color: #999999;
overflow: hidden;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
white-space: normal;
display: -webkit-box;
text-overflow: ellipsis;
word-wrap: break-word;
}
.goods-price {
width: 100%;
font-size: 36rpx;
color: #ff8080;
align-items: flex-end;
line-height: 40rpx;
.fail-price {
line-height: 40rpx;
font-size: 24rpx;
color: #999;
margin-left: 33rpx;
text-decoration: line-through;
}
}
}
}
.act-goods {
margin-top: 40rpx;
height: 280rpx;
width: 100%;
white-space: nowrap;
.act-item {
margin-right: 54rpx;
display: inline-block;
height: 240rpx;
width: 636rpx;
background: #f7f7f7;
padding: 0 30rpx;
box-sizing: border-box;
.act-item-container {
align-items: center;
height: 100%;
width: 100%;
} .goods-img {
height: 200rpx;
width: 200rpx;
border-radius: 20rpx;
}
.goods-right {
margin-left: 20rpx;
height: 200rpx;
.goods-name {
font-size: 26rpx;
color: #666666;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
white-space: normal;
display: -webkit-box;
text-overflow: ellipsis;
word-wrap: break-word;
}
.goods-desc {
margin-bottom: 25rpx;
font-size: 24rpx;
color: #666666;
overflow: hidden;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
white-space: normal;
display: -webkit-box;
text-overflow: ellipsis;
word-wrap: break-word;
}
.goods-price {
width: 100%;
font-size: 36rpx;
color: #ff8080;
align-items: flex-end;
line-height: 40rpx;
.fail-price {
line-height: 40rpx;
font-size: 24rpx;
color: #999;
margin-left: 10rpx;
text-decoration: line-through;
}
}
}
}
}
}
.adv-title {
width: 100%;
height: 360rpx;
}
.adv-list {
margin-top: 40rpx;
// margin-bottom: 70rpx;
width: 100%;
white-space: nowrap;
.adv-item-container {
display: inline-block;
margin-left: 30rpx;
.adv-item {
align-items: center;
margin-bottom: 20rpx;
.adv-img {
width: 200rpx;
height: 200rpx;
border-radius: 20rpx;
background: #f5f5f5;
margin-bottom: 20rpx;
}
.adv-name {
width: 200rpx;
height: 60rpx;
overflow: hidden;
line-height: 30rpx;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
white-space: normal;
display: -webkit-box;
text-overflow: ellipsis;
word-wrap: break-word;
font-size: 26rpx;
color: #333333;
text-align: center;
margin-bottom: 20rpx;
}
.adv-price {
font-size: 28rpx;
color: #ff8080;
text-align: center;
}
}
}
}
}
</style>
<template>
<view class='container homePage'> <view class="tabbar flex-h">
<view class="bar-item flex-v flex-1 flex-cc" wx:for='{{tagBar}}' wx:key='index' @tap='tagChange' id='{{index}}'>
<view class="content flex-v flex-cc">
<view class="title {{currentIndex==index ? 'select-bar':''}}">{{item.title}}</view>
<view class="border-line" wx:if='{{currentIndex==index}}'></view>
</view>
</view>
</view> <view class="banner">
<view class="search-box flex-h" @tap='toSearch'>
<image class="icon"></image>
<view class="search-content">搜索商品</view>
<!-- 大家都在搜:水光针 -->
</view>
<!--轮播图-->
<swiper class='swiper' autoplay interval='5000' circular>
<swiper-item wx:for='{{banner}}' wx:key='index' class='swiper-item'>
<image src='{{item.imgUri}}' @tap='bannerTap' id='{{item.target}}'></image>
</swiper-item>
</swiper>
</view> <!-- 优惠券 -->
<view class="discount" wx:if='{{false}}'></view> <!-- tag -->
<view class="tag-bar flex-h flex-wrap">
<view class="item flex-v flex-cc flex-1" wx:for='{{tabBar}}' wx:key='index' @tap='tagTap' id='{{index}}'>
<image class="icon" src='{{item.icon}}'></image>
<view class="tag-name">{{item.tagName}}</view>
</view>
</view> <block wx:for='{{floorList}}' wx:key='index'>
<view class="activity flex-v flex-cc" wx:if='{{item.type==0}}'>
<image class="act-title flex-cc flex-h" src='{{item.icon}}' @tap='tagTap' id='{{index}}' data-type='banner'>
<!-- <view class="act-name flex-cc flex-h">限时购</view> -->
</image> <view class="goods-item flex-h" wx:for='{{item.products}}' wx:key='index' wx:for-item='pItem' @tap='toGoodsDetail' id='{{pItem.productId}}'>
<image class="goods-img" src="{{pItem.imgUri}}"></image>
<view class="goods-right flex-1 flex-v flex-bc">
<view class="goods-top">
<view class="goods-name">{{pItem.productName}}</view>
<view class="goods-desc">{{pItem.shortDescription}}</view>
</view>
<view class="goods-price flex-h">
<view class="real-price">¥{{pItem.SELL_PRICE/100 || 0}}</view>
<view class="fail-price">¥{{pItem.underlinePrice/100 || 0}}</view>
</view>
</view>
</view> <!-- <scroll-view class="act-goods" scroll-x=‘{{true}}’>
<view class="act-item" wx:for='{{[0,0,0,0,0]}}'>
<view class="act-item-container flex-h">
<image class="goods-img"></image>
<view class="goods-right flex-1 flex-v flex-bc">
<view class="goods-top">
<view class="goods-desc">两盒大套装</view>
<view class="goods-name">私人定制美眼打造 超靓玻尿酸 极致美白享受 不一样的体验</view>
</view>
<view class="goods-price flex-h">
<view class="real-price">¥999</view>
<view class="fail-price">¥999</view>
</view>
</view>
</view>
</view>
</scroll-view> -->
</view> <block wx:if='{{item.type==1}}' >
<image src='{{item.icon}}' class="adv-title" style='margin-top:30rpx;' @tap='tagTap' id='{{index}}' data-type='banner'></image>
<view class="adv-list flex-h flex-wrap">
<view class="adv-item-container" wx:for='{{item.products}}' wx:key='index' wx:for-item='pItem'>
<view class="adv-item flex-v" @tap='toGoodsDetail' id='{{pItem.productId}}'>
<image class="adv-img" src='{{pItem.imgUri}}'></image>
<view class="adv-name">{{pItem.productName}}</view>
<view class="adv-price">¥ {{pItem.SELL_PRICE/100||0}}</view>
</view>
</view>
</view>
</block> <view class="activity flex-v flex-cc" wx:if='{{item.type==2}}' style='margin-bottom:50rpx'>
<image class="act-title-1 flex-cc flex-h" src='{{item.icon}}' @tap='tagTap' id='{{index}}' data-type='banner'>
<!-- <view class="act-name flex-cc flex-h">限时购</view> -->
</image> <view class="goods-item flex-h" wx:for='{{item.products}}' wx:key='index' wx:for-item='pItem' @tap='toGroupGoodsDetail' id='{{pItem.groupId}}' data-opid='{{pItem.groupOpenRecordId}}'>
<image class="goods-img" src='{{pItem.imgUri}}'></image>
<view class="goods-right flex-1 flex-v flex-bc">
<view class="goods-top">
<view class="goods-name">{{pItem.productName}}</view>
<view class="goods-desc">{{pItem.shortDescription}}</view>
</view>
<view class="goods-price flex-h">
<view class="real-price">¥{{pItem.SELL_PRICE/100||0}}</view>
<view class="fail-price">¥{{pItem.underlinePrice/100||0}}</view>
</view>
</view>
</view>
</view> </block>
<authBox></authBox>
</view>
</template> <script>
import wepy from 'wepy'
import toast from '../components/toast'
import authBox from '../components/auth-box'
import { indexData, indexBannerAndTag } from '../service/api.js'
var event = require('../utils/event.js')
export default class Home extends wepy.page {
config = {
navigationBarTitleText: '大叔家Ocandy'
} components = {
custoast: toast,
authBox: authBox
} data = {
banner: [],
tabBar: [],
// recommendList: [],
floorList: [],
currentIndex: 0
} methods = {
bannerTap(e) {
if (e.currentTarget.id) {
wx.navigateTo({ url: e.currentTarget.id })
}
},
toSearch() {
wx.navigateTo({
url: '/subPackage/search-page?autoFocus=true'
})
},
tagChange(e) {
this.currentIndex = e.currentTarget.id
this.$apply()
},
toGoodsDetail(e) {
wx.navigateTo({
url: '/pages/product-detail-page?productId=' + e.currentTarget.id
})
},
toGroupGoodsDetail(e) {
wx.navigateTo({
url:
'/pages/group/group-product-page?groupId=' +
e.currentTarget.id +
'&openRecordId=' +
e.currentTarget.dataset.opid
})
},
tagTap(e) {
let index = e.currentTarget.id
if (e.currentTarget.dataset.type == 'banner') {
wx.navigateTo({
url: this.floorList[index].redictTarget
? this.floorList[index].redictTarget
: `/subPackage/search-page?tagId=${this.floorList[index].id}`
})
} else {
wx.navigateTo({
url: this.tabBar[index].redictTarget
? this.tabBar[index].redictTarget
: `/subPackage/search-page?tagId=${this.tabBar[index].id}`
})
}
console.log('index==:>', this.tabBar[index].redictTarget)
// this.tabBar[index].redictTarget &&
// wx.navigateTo({
// url: this.tabBar[index].redictTarget
// ? this.tabBar[index].redictTarget
// : `/subPackage/search-page?tagId=${this.tabBar[index].id}`
// })
}
} onShareAppMessage(res) {
return {
title: '大叔家Ocandy'
}
} toast(obj) {
return new Promise((resolve, reject) => {
this.$invoke('custoast', 'showToast', obj).then(res => {
resolve(res)
})
})
} // _indexBannerAndTag() {
// indexBannerAndTag({}).then(res => {
// console.log('banner+tag==>', res)
// this.banner = res.banner
// this.tagBar = res.tagBar
// this.$apply()
// })
// } _indexData() {
indexData({}).then(res => {
// this.recommendList = res.recommendList
this.floorList = res.tagList
this.banner = res.banners
this.tabBar = res.tabBar
this.$apply()
console.log('indexData==>', res)
})
} events = {} // onReady() {} async onLoad(opt) {
// wx.hideShareMenu()
wx.showLoading({
title: '加载中...'
})
let isLogin = await this.$parent.userLogin()
console.log('进入首页,当前登录状态===>', isLogin)
wx.hideLoading()
// 调起授权框 登陆&授权成功走请求
if (!isLogin) {
console.log('---------', !isLogin)
this.$invoke('authBox', 'showAuthBox')
event.on('getAuthSuc', this, () => this.onLoad())
} else {
// this._indexBannerAndTag()
this._indexData()
}
}
}
</script>

home-page

<style lang="less">
.box {
position: relative;
.images-box {
width: 100%;
height: 400rpx;
}
.sign {
position: absolute;
bottom: 32rpx;
right: 30rpx;
width: 100rpx;
height: 46rpx;
font-size: 26rpx;
text-align: center;
background: rgba(0, 0, 0, .4);
border-radius: 20rpx;
line-height: 46rpx;
color: #ffffff;
}
}
.group-person {
align-items: center;
background-color: #F5F5F5;
height: 100rpx;
text-align: center;
.list-person {
color: #666666;
line-height: 100rpx;
font-size: small;
margin-left: 30rpx;
}
.avatar-list {
margin-left: 280rpx;
.avatar {
width: 60rpx;
height: 60rpx;
line-height: 100rpx;
border-radius: 50%;
margin-right: -15rpx;
}
}
}
.clear{
clear: both;
overflow: hidden;
}
navigator{
display:inline;
}
.list{
margin-top: 20rpx;
.list_item{
margin-top:10px;
margin-bottom: 30rpx;
padding: 30rpx;
height:100px;
/*border-bottom:1px solid #E8E8E8;*/
.img{
float:left;
image{
width: 210rpx;
height: 210rpx;
border-radius: 10rpx;
}
}
}
}
.list .list_item .info{
width: 69%;
float: right;
height: 110px;
position: relative;
}
.list .list_item .info .title{
color:#333;
margin-left: 22rpx;
font-size: 30rpx;
}
.list .list_item .info .flex-h .group-price{
color: #8d8d8d;
margin-left: 22rpx;
margin-top: 30rpx;
margin-bottom: 58rpx;
font-size: 26rpx;
}
.list .list_item .info .flex-h .price{
color: #ff5050;
margin-top: 30rpx;
margin-bottom: 58rpx;
font-size: 22rpx;
}
.list .list_item .info .flex-h .rel-price{
color: #afafaf;
margin-left: 24rpx;
margin-bottom: 58rpx;
margin-top: 30rpx;
font-size: 20rpx;
}
.list .list_item .info .flex-h .num{
position: absolute;
right: 20rpx;
bottom: 15rpx;
color: #afafaf;
font-size: 22rpx;
}
.line {
background-color: #f5f5f5;
height: 10rpx;
} .scroll-view-x {
height: 400rpx;
white-space:nowrap;
display:flex;
padding-top:10rpx;
}
.scroll-view-x .pic {
width: 260rpx;
height: 260rpx;
margin-left: 15rpx;
}
.slider {
height: 452rpx;
overflow-x: auto;
white-space: nowrap;
}
.slider::-webkit-scrollbar {
display: none; /*不展示横向滚动条*/
}
.slide_son{
margin-left: 30rpx;
width: 260rpx;
display: inline-block;
}
.slide_son image{
width: 260rpx;
height: 260rpx;
display: block;
border-radius: 10rpx;
}
.slider_title {
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
white-space:normal;
word-break: break-all;
word-wrap : break-word;
width: 208rpx;
margin-top: 30rpx;
margin-bottom: 30rpx;
font-size: 26rpx;
}
.slide_price{
color: #FF4D4D;
font-size: 28rpx;
line-height: 28rpx;
height: 28rpx;
}
.slider_sale{
color: #666666;
font-size: 26rpx;
line-height: 28rpx;
height: 28rpx;
margin-right: 10rpx;
}
.slider-v {
float: left;
margin-left: 0%;
width: 50%;
margin-top: 35rpx;
/*margin-bottom: 44rpx;*/
height: 512rpx;
.slide_son{
display: inline-block;
width: 335rpx;
margin: 20rpx;
}
}
.slider-v .slide_son image{
width: 320rpx;
height: 320rpx;
display: block;
}
.slider-v .slide_son .slider_title {
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
white-space:normal;
word-break: break-all;
word-wrap : break-word;
width: 328rpx;
margin-top: 30rpx;
margin-bottom: 30rpx;
font-size: 26rpx;
}
.slider-v .slide_son .slider_sale {
color: #afafaf;
font-size: 13px;
line-height: 30px;
height: 30px;
margin-right: 5px;
margin-left: 10rpx;
}
.slider-v .slide_son .slider_btn {
color: white;
text-align: center;
width: 190rpx;
height: 40rpx;
margin-top: 20rpx;
line-height: 40rpx;
border-radius: 5rpx;
background-color: #FF4D4D;
display: block;
font-size: 24rpx;
}
.list .list_item .info .flex-h .group-persons {
position:absolute;
left:20rpx;
bottom:10rpx;
color:white;
text-align:center;
width:110rpx;
height:36rpx;
line-height:40rpx;
border-top-left-radius: 10rpx;
border-bottom-left-radius: 10rpx;
background: linear-gradient(to left,#FFB2B2,#FF4D4D);
display:block;
font-size:24rpx;
border: 1rpx solid #ff4d4d;
border-right:none;
}
.list .list_item .info .flex-h .group-persons-price {
position: absolute;
right: 180rpx;
bottom: 10rpx;
color: #ff4d4d;
border: 1rpx solid #ff4d4d;
border-left:none;
text-align: center;
width: 165rpx;
height: 36rpx;
line-height: 40rpx;
border-top-right-radius: 10rpx;
border-bottom-right-radius: 10rpx;
display: block;
font-size: 24rpx;
}
.newgroup {
margin-bottom: 40rpx;
width: 100%;
height: 70rpx;
line-height: 70rpx;
text-align: center;
position: relative;
margin-top: 100rpx;
}
.newproduct {
height: 100rpx;
margin-top: 70rpx;
margin-bottom: 40rpx;
width: 100%;
line-height: 70rpx;
text-align: center;
position: relative;
margin-top: 100rpx;
}
.hotproduct {
margin-top: 100rpx;
margin-bottom: 40rpx;
width: 100%;
height: 70rpx;
line-height: 70rpx;
text-align: center;
position: relative;
}
.newgroup .right image {
position: absolute;
height: 16rpx;
width: 294rpx;
float: left;
left: 0rpx;
}
.newproduct .right image {
position: absolute;
height: 16rpx;
width: 294rpx;
float: left;
left: 0rpx;
}
.hotproduct .right image {
position: absolute;
height: 16rpx;
width: 294rpx;
float: left;
left: 0rpx;
}
.newgroup .title{
width: 120rpx;
height: 50rpx;
position: absolute;
top: -30rpx;
margin-left: 317rpx;
font-size: 30rpx;
color: #333333;
}
.newproduct .title{
width: 120rpx;
height: 50rpx;
text-align: center;
position: absolute;
top: -30rpx;
margin-left: 317rpx;
font-size: 30rpx;
color: #333333;
}
.hotproduct .title{
width: 120rpx;
height: 50rpx;
position: absolute;
top: -30rpx;
margin-left: 317rpx;
font-size: 30rpx;
color: #333333;
}
.newgroup .left image {
position: absolute;
height: 16rpx;
width: 294rpx;
float: right;
right: 0rpx;
}
.newproduct .left image {
position: absolute;
height: 16rpx;
width: 294rpx;
float: right;
right: 0rpx;
}
.hotproduct .left image {
position: absolute;
height: 16rpx;
width: 294rpx;
float: right;
right: 0rpx;
}
.newgroup .us-title {
font-size: 18rpx;
margin-top: 20rpx;
color: #333333;
}
.newproduct .us-title {
font-size: 18rpx;
margin-top: 20rpx;
color: #333333;
}
.hotproduct .us-title {
font-size: 18rpx;
margin-top: 20rpx;
color: #333333;
} .wrap{
margin-top: 30rpx;
height: 300rpx;
display: flex;
justify-content: space-around;
image {
width: 150rpx;
height: 230rpx;
}
}
</style> <template>
<view class="box">
<swiper class="images-box" autoplay interval='5000' circular duration='500' @change="swiperChange">
<block wx:for="{{banners}}" wx:key='index'>
<swiper-item>
<image src="{{item.imgUri}}" style="width:100%; height:400rpx;" @tap='bannerTap' id='{{item.target}}'/>
</swiper-item>
</block>
</swiper>
<view class="sign" >{{currentIndex}}/{{banners.length}}</view>
</view> <block wx:if="{{canGetCoupon}}">
<view class="wrap">
<image src="../pages/images/10@2x.png"></image>
<image src="../pages/images/20@2x.png"></image>
<image src="../pages/images/50@2x.png"></image>
<image src="../pages/images/all@2x.png" @tap="getCoupon"></image>
</view>
</block> <block wx:for='{{floorList}}' wx:key='list'>
<view wx:if='{{item.type==0}}'>
<!--新品拼团 GROUP PURCHASE-->
<view class="newgroup flex-v">
<view class="flex-h">
<view class="left"><image src="data:images/right.png"></image></view>
<sapn class="title">{{item.tagName}}</sapn>
<view class="right"><image src="data:images/left.png"></image></view>
</view>
<view class="us-title">{{item.remarks}}</view>
</view>
<!--新品拼团列表-->
<view>
<image src="{{item.icon}}" style="width: 100%; height: 360rpx;" @tap='toGroupListPage' id='{{item.redictTarget}}' data-type='banner'/>
</view>
<view class="group-person flex-h">
<view class="list-person">
已有900人拼团
</view>
<view class="avatar-list">
<image class="avatar" src="data:images/1.png"></image>
<image class="avatar" src="data:images/2.png"></image>
<image class="avatar" src="data:images/3.png"></image>
<image class="avatar" src="data:images/4.png"></image>
<image class="avatar" src="data:images/5.png"></image>
</view>
</view> <!--团购详情页-->
<view class="list">
<block wx:for='{{item.products}}' wx:key='list' wx:for-index='index' >
<view class="list_item" @tap='toGroupGoodsDetail' id='{{item.groupId}}' data-opid='{{item.groupOpenRecordId}}'>
<navigator url="details?id={{item.goods_id}}">
<view class="img">
<image src="{{item.imgUri}}" mode="scaleToFill"/>
</view>
<view class="info">
<view class="title">{{item.productName}}</view>
<view class="flex-h" style="height: 26rpx; line-height: 26rpx;">
<view class="group-price">拼团价:</view>
<view class="price">¥{{item.SELL_PRICE/100}}</view>
<view class="rel-price">¥<span style="text-decoration: line-through;">{{item.underlinePrice/100}}</span></view>
</view>
<view class="flex-h" style="margin-top: 20rpx;">
<view class="group-persons">{{item.num}}人团</view>
<view class="group-persons-price" >拼团省{{item.currentPrice/100}}元</view>
<view class="num">已拼{{item.productNum}}件</view>
</view>
</view>
</navigator>
<view class="clear"></view>
</view>
</block>
<view wx:if="{{index !== item.products.length-1}}" class="line"></view>
</view>
</view> <block wx:if='{{item.type==1}}'>
<!--新品预售 NEW COMMODITY-->
<view class="newproduct flex-v">
<view class="flex-h">
<view class="left"><image src="data:images/right.png"></image></view>
<sapn class="title">{{item.tagName}}</sapn>
<view class="right"><image src="data:images/left.png"></image></view>
</view>
<view class="us-title">{{item.remarks}}</view>
</view>
<!--新品预售列表-->
<view style="margin-bottom: 30rpx; margin-top: -20rpx; height: 400rpx; background-color: white;">
<image style="width: 100%; height: 360rpx;" src='{{item.icon}}' @tap='tagnewTap' id='{{item.redictTarget}}' data-type='banner'/>
</view>
<view class="slider" wx:for="{{item.products}}" wx:key='index' wx:for-item='item' @tap='toappointGoodsDetail' id='{{item.appointId}}'>
<view class="slide_son">
<image src="{{item.imgUri}}"/>
<view class="slider_title">{{item.productName}}</view>
<view class="flex-h" style="height: 26rpx; line-height: 26rpx;">
<view class="slider_sale">定金:</view>
<view class="slide_price">{{item.appointPrice/100}}抵{{item.currentPrice/100}}</view>
<view class="slider_sale">元</view>
</view>
</view>
</view>
</block> <view wx:if='{{item.type==3}}'>
<!--爆品推荐-->
<view class="hotproduct flex-v">
<view class="flex-h">
<view class="left"><image src="data:images/right.png"></image></view>
<sapn class="title">{{item.tagName}}</sapn>
<view class="right"><image src="data:images/left.png"></image></view>
</view>
<view class="us-title">{{item.remarks}}</view>
</view>
<!--爆品推荐列表-->
<view @tap='tagTap' id='{{item.redictTarget}}' data-type='banner'>
<image src="{{item.icon}}" style="width: 100%; height: 360rpx;"/>
</view>
<view wx:for="{{item.products}}" @tap='toGoodsDetail' id='{{item.productId}}'>
<view class="slider-v" style="margin-bottom: 100rpx;">
<view class="slide_son" style="float: left; width: 40%; margin-left: 5%;">
<image src="{{item.imgUri}}"/>
<view class="slider_title">{{item.productName}}</view>
<span class="slide_price">¥{{item.currentPrice/100}}</span>
<span class="slider_sale">¥<span style="text-decoration: line-through;">{{item.underlinePrice/100}}</span></span>
<!--<span class="slider_btn">领券享7折优惠</span>-->
</view>
</view>
</view>
</view>
</block>
<foot></foot>
<authBox></authBox>
</template>
<script>
import wepy from 'wepy'
import toast from '../components/toast'
import authBox from '../components/auth-box'
import Foot from '../components/foot'
import { indexData, getCoupon } from '../service/api.js'
var event = require('../utils/event.js')
export default class Home extends wepy.page {navigationBarTitleText
config = {
navigationBarTitleText: '大叔家Ocandy'
} components = {
custoast: toast,
foot: Foot,
authBox: authBox
} data = {
tabBar: [],
// recommendList: [],
floorList: [],
banners: [],
currentIndex: 1,
canGetCoupon: false
} methods = {
getCoupon: function (e) {
this._getCoupon()
},
swiperChange: function (e) {
this.currentIndex = e.detail.current + 1
},
bannerTap(e) {
if (e.currentTarget.id) {
wx.navigateTo({
url: e.currentTarget.id
})
}
},
toSearch() {
wx.navigateTo({
url: '/subPackage/search-page?autoFocus=true'
})
},
tagChange(e) {
this.currentIndex = e.currentTarget.id
this.$apply()
},
// 爆品详情
toGoodsDetail(e) {
wx.navigateTo({
url: '/pages/product-detail-page?productId=' + e.currentTarget.id
})
},
// 新品拼团列表
toGroupListPage(e) {
if (e.currentTarget.id) {
wx.navigateTo({
url: e.currentTarget.id
})
}
},
// 新品拼团产品详情
toGroupGoodsDetail(e) {
wx.navigateTo({
url:
'/pages/group/group-product-page?groupId=' +
e.currentTarget.id +
'&openRecordId=' +
e.currentTarget.dataset.opid
})
},
// 预售列表
tagnewTap(e) {
if (e.currentTarget.id) {
wx.navigateTo({
url: e.currentTarget.id
})
}
},
// 新品预售详情
toappointGoodsDetail(e) {
wx.navigateTo({
url: '/pages/appoint/appoint-product-page?appointId=' + e.currentTarget.id
})
},
// 爆品列表
tagTap(e) {
if (e.currentTarget.id) {
wx.navigateTo({
url: e.currentTarget.id
})
}
}
} onShareAppMessage(res) {
return {
title: '大叔家Ocandy'
}
} toast(obj) {
return new Promise((resolve, reject) => {
this.$invoke('custoast', 'showToast', obj).then(res => {
resolve(res)
})
})
} // _indexBannerAndTag() {
// indexBannerAndTag({}).then(res => {
// console.log('banner+tag==>', res)
// this.banner = res.banner
// this.tagBar = res.tagBar
// this.$apply()
// })
// } _indexData() {
indexData({}).then(res => {
this.floorList = res.tagList
this.banners = res.banners
this.$apply()
console.log('indexData-page-new==>', res)
})
} _getCoupon() {
getCoupon({}).then(res => {
console.log('indexData-getCoupon==>', res)
})
wx.showToast({
title: '获取成功',
icon: 'success',
duration: 1000,
mask: true
})
}
events = {} // onReady() {} async onLoad(opt) {
// wx.hideShareMenu()
wx.showLoading({
title: '加载中...'
})
let isLogin = await this.$parent.userLogin()
console.log('进入首页,当前登录状态===>', isLogin)
wx.hideLoading()
// 调起授权框 登陆&授权成功走请求
if (!isLogin) {
console.log('---------', !isLogin)
this.$invoke('authBox', 'showAuthBox')
event.on('getAuthSuc', this, () => this.onLoad())
} else {
// this._indexBannerAndTag()
this._indexData()
this.canGetCoupon = this.$parent.globalData.canGetCoupon
console.log('进入首页,当前登录状态===>获取优惠券===>', this.canGetCoupon)
this.$apply()
}
}
}
</script>

请点赞!因为你的鼓励是我写作的最大动力!

吹逼交流群:711613774

wepy代码知识点的更多相关文章

  1. MySQL复习值代码知识点(1)

    MySQL复习值代码知识点 一. 创建数据库 create database 数据库名: 二. 删除数据库 drop database 数据库名: 三. 选择相应的数据库 use 数据库名: 四. 创 ...

  2. 八、wepy代码规范

    变量与方法尽量使用驼峰式命名,并且注意避免使用$开头. 以$开头的标识符为WePY框架的内建属性和方法,可在JavaScript脚本中以this.的方式直接使用,具体请参考API文档. 小程序入口.页 ...

  3. MySQL复习值代码知识点(2)

    目录 总汇表 order by使用举例 group by使用举例 limit举例 group by 与order by 联合使用 having的使用 SQL运行结果查询 总汇表 order by 排序 ...

  4. 微信小程序之:wepy(二)

    一大堆实例:人家的博客园 代码规范: 1.尽量使用驼峰命名,避免使用$开头,框架内建属性都已$开头,可以使用this直接调用. 2.入口文件.页面.组件后缀都为.wpy. 3.使用ES6语法开发. 4 ...

  5. Python代码用在这些地方,其实1行就够了!

    摘要:都说 Python 简单快捷,那本篇博客就为大家带来一些实用的 Python 技巧,而且仅需要 1 行代码,就可以解决一些小问题. 本文分享自华为云社区<你猜 1 行Python代码能干什 ...

  6. 从 Wepy 到 UniApp 变形记

    作者:vivo 互联网前端团队-Wan Anwen.Hu Feng.Feng Wei.Xie Tao 进入互联网"下半场",靠"人海战术"的研发模式已经不再具备 ...

  7. golang-web框架revel一个表单提交的总结

    这里要介绍好是revel框架的表单post提交的列子,主要是用于入门学习,和一些知识点的讲解: 首先: 来了解一个问题那就是重复提交表单,做过form表单提交的同学都知道,如果表单提交后不做处理,那么 ...

  8. 【转】COM技术内幕(笔记)

    COM技术内幕(笔记) COM--到底是什么?--COM标准的要点介绍,它被设计用来解决什么问题?基本元素的定义--COM术语以及这些术语的含义.使用和处理COM对象--如何创建.使用和销毁COM对象 ...

  9. PYTHON第二天

    PYTHON之路 4.注释 Python开发规范:每一行不能超过80个字符 # : 代表注释当行 ‘’’  上下两行  ,  三个英文字符的引号,代表注释某一段代码 ‘’’ 知识点用户输入: PYth ...

随机推荐

  1. Spring Cloud Alibaba学习笔记(11) - RocketMQ事务消息

    在Spring中,我们要实现事务,一般通过@Transactional注解实现.这在引入RocketMQ之前没有问题,但是在引入了RocketMQ之后,如果消息发送之后的业务逻辑处理发生了异常的话,这 ...

  2. LeetCode每日一练(1-3)

    题目导航 1. 两数之和 2. 两数相加 3. 无重复字符的最长子串 1. 两数之和 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的 ...

  3. Gitlab Runner实现CI/CD自动化部署asp.net core应用

    环境说明 一台git服务器(192.168.169.7),安装gitlab,docker. 一台web服务器(192.168.169.6),安装git,gitlab runner,docker,dot ...

  4. Visual Studio中找不到.Net Core SDK

    在win 7 64位上安装了.Net Core 2.1 x86 SDK后,又卸载重新安装了.Net Core 3/2 x64 SDK.结果在VS中新建项目时没有.Net Core 3.1 SDK. 在 ...

  5. pfSense QoS IDS

    pfSense QoS IDS 来源 https://blanboom.org/2018/pfsense-setup/ 之前我使用的无线路由器是 RT1900ac,其内置了 QoS 和 IDS/IPS ...

  6. UI5-技术篇-Hybrid App-1-Barcode扫描

    参考资料: https://www.w3cschool.cn/cordova/cordova_overview.html https://blogs.sap.com/2017/01/03/sapui5 ...

  7. Python 使用gevent下载图片案例

    import urllib.request import gevent from gevent import monkey monkey.patch_all() def downloader(img_ ...

  8. 使用SAP Cloud Platform Leonardo机器学习提取图片的特征向量

    选中一个需要进行测试的Leonardo机器学习服务,点击Configure Environments: 因为我不想使用sandbox环境,所以我选择了eu10这个region: 维护clientid和 ...

  9. 如何使用.gitignore文件删除掉已经提交的文件

      如何使用.gitignore文件删除掉已经提交的文件 2018.06.06 22:13:38字数 96阅读 116 如果你的文件已经提交,而此时你才发现忘了添加.gitignore文件,不用担心, ...

  10. dockerfile创建镜像1

    vim Dockerfile FROM alpine:latest MAINTAINER brady CMD echo "hello world" 进行构建 docker buil ...