C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

871 regels
22 KiB

  1. const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
  2. let ifStoreApp = extConfig.attr.ifStoreApp;
  3. const navigationBarHeight = (getApp().statusBarHeight + 60) + 'rpx'
  4. const Http = require("../utils/HttpBasics");
  5. const imgurl = require("../utils/imgurl");
  6. const config = require("../config/config");
  7. const QR = require("../utils/memberqrcode.js");
  8. const util = require("../utils/util");
  9. const bgColor = require("../utils/bgColor.js")
  10. let app = getApp();
  11. Page({
  12. data: {
  13. typeLsit:{},
  14. showLocationIf: true,
  15. ifStoreApp: ifStoreApp,
  16. navigationBarTitle: '首页',
  17. navigationBarHeight,
  18. chengzhangBox: bgColor.colorFirst.main.chengzhangBox,
  19. activeColor: bgColor.colorFirst.main.activeColor,
  20. qg: bgColor.colorFirst.main.qg,
  21. newUrl: "",
  22. cover: "",
  23. kanjia: imgurl.kanjia.url,
  24. pintuan: imgurl.pintuan.url,
  25. xiaofeika: imgurl.xiaofeika.url,
  26. xingyun: imgurl.xingyun.url,
  27. jfshangcheng: imgurl.jfshangcheng.url,
  28. toutiao: imgurl.toutiao.url,
  29. more: imgurl.more.url,
  30. giftHr: imgurl.giftHr.url,
  31. giftHr: imgurl.giftHr.url,
  32. next: imgurl.next.url,
  33. usergift: imgurl.usergift.url,
  34. guanbi1: imgurl.guanbi1.url,
  35. icon0001: imgurl.icon0001.url,
  36. icon0002: imgurl.icon0002.url,
  37. icon0003: imgurl.icon0003.url,
  38. icon0004: imgurl.icon0004.url,
  39. icon0005: imgurl.icon0005.url,
  40. icon0006: imgurl.icon0006.url,
  41. icon0007: imgurl.icon0007.url,
  42. icon0008: imgurl.icon0008.url,
  43. barcode: imgurl.barcode.url,
  44. leftarrows: imgurl.leftarrows.url,
  45. newcard: imgurl.newcard.url,
  46. newseckill: imgurl.newseckill.url,
  47. newbargain: imgurl.newbargain.url,
  48. newgroup: imgurl.newgroup.url,
  49. product: imgurl.product.url,
  50. barginicon: imgurl.barginicon.url,
  51. pintuan: imgurl.pintuan.url,
  52. live: imgurl.live.url,
  53. duihuan: imgurl.duihuan.url,
  54. market: app.globalData.market,
  55. list: [],
  56. xslist: [],
  57. loading: true,
  58. fistLogin: null,
  59. alphaData: null,
  60. alphaData1: null,
  61. swiperCurrent: 0,
  62. title: null,
  63. weappShareTitle: '', //分享标题
  64. weappShareCoverImg: '', //分享图片
  65. desc: null,
  66. scrollTop: 0,
  67. showGame: false,
  68. showTopic: false,
  69. showQg: false,
  70. gamedata: {},
  71. couponId: '', //游戏返回时传回的字段
  72. played: false, //从游戏页面跳回首页返回true
  73. havePlayEd: app.globalData.havePlayEd,
  74. havePlayEd1: app.globalData.havePlayEd1,
  75. staticGamedata: {},
  76. showIf: false,
  77. showPages: false,
  78. display: 'none',
  79. display1: 'none',
  80. optionsData: null,
  81. page: 1, // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载
  82. openId: '',
  83. showGg: false,
  84. ggdata: {},
  85. liveFlag: 0, //直播按钮显隐标志位
  86. squareName: "", //当前广场
  87. isShowSqare: false,
  88. },
  89. //获取当前广场名
  90. //跳转到其他广场列表
  91. goSquareList() {
  92. wx.navigateTo({
  93. url: '/pages/location/location',
  94. })
  95. },
  96. goLive() {
  97. wx.navigateTo({
  98. url: '/pages2/live/livelist/index',
  99. })
  100. },
  101. alphaClick1: function(even) {
  102. var animation = wx.createAnimation({})
  103. animation.opacity(0).step({
  104. duration: 2000
  105. })
  106. this.setData({
  107. alphaData: animation.export()
  108. })
  109. },
  110. alphaClick: function(even) {
  111. var animation = wx.createAnimation({})
  112. animation.opacity(0).step({
  113. duration: 2000
  114. })
  115. this.setData({
  116. alphaData1: animation.export()
  117. })
  118. },
  119. // 我的卡包
  120. mycard: function() {
  121. wx.navigateTo({
  122. url: '/pages/cardorder/index/index',
  123. })
  124. },
  125. //我的券包
  126. mycoupon: function() {
  127. wx.navigateTo({
  128. url: '/pages/couponorder/index/index',
  129. })
  130. },
  131. gotoSpellGroup: function() {
  132. wx.navigateTo({
  133. url: '/pages/spellGroup/spellGroup',
  134. })
  135. },
  136. qrcode: function() {
  137. var that = this;
  138. let memberId = that.data.memberId;
  139. if (memberId) {
  140. wx.navigateTo({
  141. url: '/pages/specialcourtesy/specialcourtesy'
  142. })
  143. }
  144. },
  145. //跳往限时秒杀
  146. gotoRushBuy: function() {
  147. wx.navigateTo({
  148. url: '/pages/rushToBuy/index',
  149. })
  150. },
  151. swiperChange: function(e) {
  152. this.setData({
  153. swiperCurrent: e.detail.current
  154. });
  155. },
  156. gotogame: function() {
  157. let that = this;
  158. if (!that.data.showIf) {
  159. wx.showToast({
  160. title: '暂无游戏频道',
  161. icon: "none",
  162. duration: 3000
  163. })
  164. } else {
  165. Http.get({
  166. url: config.api.checkPhoneStatus,
  167. data: {}
  168. })
  169. .then(res => {
  170. var data = {
  171. couponChannelId: "" + that.data.couponChannelId,
  172. couponId: "" + that.data.couponId
  173. };
  174. if (that.data.couponChannelId == null) {
  175. var data = {
  176. couponId: "" + that.data.couponId
  177. };
  178. }
  179. wx.redirectTo({
  180. url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
  181. })
  182. })
  183. .catch(err => {
  184. if (err.code == 11005) {
  185. // 用户手机未授权
  186. /**
  187. * 将值传到用户手机号授权的页面
  188. *
  189. */
  190. wx.redirectTo({
  191. url: "/pages/getphoneInfo/index?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
  192. });
  193. } else if (err.code == 11006) {
  194. // 用户手机已加密
  195. wx.redirectTo({
  196. url: "/pages/phoneinput/phoneinput?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
  197. });
  198. } else {
  199. wx.showToast({
  200. title: err.message,
  201. icon: 'none',
  202. duration: 2000,
  203. mask: false
  204. });
  205. }
  206. })
  207. }
  208. },
  209. mySpecial: function() {
  210. console.log("special");
  211. wx.navigateTo({
  212. url: '/pages/specialcourtesy/specialcourtesy',
  213. })
  214. },
  215. //是否属于集团
  216. ifShowSqare() {
  217. if (wx.getStorageSync("squareList")) {
  218. this.setData({
  219. isShowSqare: true
  220. })
  221. } else {
  222. this.setData({
  223. isShowSqare: false
  224. })
  225. }
  226. },
  227. /**
  228. * 获取全局样式
  229. */
  230. getType() {
  231. Http.get({
  232. url: config.api.setType,
  233. data:{}
  234. }).then(res=>{
  235. const{code ,data}=res
  236. if(code==200){
  237. this.setData({
  238. typeLsit: data
  239. })
  240. }
  241. console.log(this.data.typeLsit,"???")
  242. })
  243. },
  244. /**
  245. * 生命周期函数--监听页面初次渲染完成
  246. */
  247. onLoad: function(options) {
  248. this.getType()
  249. this.getLocation();
  250. let that = this;
  251. let optionss;
  252. let openId = wx.getStorageSync('openId')
  253. if (openId) {
  254. that.setData({
  255. openId: openId
  256. })
  257. }
  258. if (wx.getStorageSync('options')) {
  259. optionss = JSON.parse(wx.getStorageSync('options'));
  260. }
  261. if (options.played == "true") {
  262. that.setData({
  263. played: true
  264. })
  265. }
  266. if (optionss && optionss.couponChannelId || optionss && optionss.orderId) {
  267. that.setData({
  268. optionsData: optionss
  269. })
  270. that.getWeapNote(optionss.couponChannelId, optionss.orderId);
  271. } else {
  272. that.getWeapNote()
  273. }
  274. //获取条形码
  275. // util.barcode("barcode", optionss.quancode, 510, 100);
  276. // console.log(Http.headers.token, "?")
  277. },
  278. /**
  279. * 获得经纬度
  280. */
  281. getLocation() {
  282. let that = this;
  283. wx.getLocation({
  284. type: "wgs84",
  285. success: function(res) {
  286. console.log(res, 9999)
  287. if (res && res.longitude && res.latitude) {
  288. Http.post({
  289. url: config.api.updateLBS,
  290. data: {
  291. latitude: res.latitude,
  292. longitude: res.longitude
  293. }
  294. }).then(res => {
  295. console.log(res, 9999)
  296. })
  297. }
  298. },
  299. fail: error => {
  300. console.log(error);
  301. }
  302. })
  303. },
  304. onUnload() {
  305. // wx.removeStorageSync('squareList')
  306. },
  307. onShow: function() {
  308. this.ifShowSqare();
  309. if (wx.getStorageSync("squareList")) {
  310. var temp = wx.getStorageSync("squareList").filter(item => item.tenantId == wx.getStorageSync("selectedMall"))[0].name
  311. this.setData({
  312. squareName: temp
  313. })
  314. }
  315. if (typeof this.getTabBar === 'function' &&
  316. this.getTabBar()) {
  317. this.getTabBar().setData({
  318. selected: 0
  319. })
  320. }
  321. let that = this;
  322. that.setData({
  323. havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd : false,
  324. havePlayEd1: app.globalData.havePlayEd1 ? app.globalData.havePlayEd1 : false
  325. })
  326. /**
  327. * couponNum 是否有普通的优惠券购买
  328. * couponNum2 是否有新买的消费卡
  329. */
  330. let num = wx.getStorageSync('couponNum');
  331. let num1 = wx.getStorageSync('couponNum2');
  332. if (num == 'couponNum' || num1 == 'couponNum2') {
  333. wx.showTabBarRedDot({
  334. index: 3
  335. })
  336. } else {
  337. wx.hideTabBarRedDot({
  338. index: 3
  339. })
  340. }
  341. if (app.globalData.score) {
  342. that.setData({
  343. fistLogin: app.globalData.score
  344. })
  345. }
  346. // 如果有游戏
  347. setTimeout(function() {
  348. that.alphaClick();
  349. }, 8000)
  350. // 如果有广告
  351. setTimeout(function() {
  352. // debugger
  353. that.alphaClick1();
  354. }, 8000)
  355. },
  356. getmemberId: function(token) {
  357. let that = this;
  358. Http.get({
  359. url: config.api.getScore,
  360. data: {
  361. token: token
  362. }
  363. }).then(res => {
  364. that.setData({
  365. levelName: res.data.levelName,
  366. upgradePercent: res.data.upgradePercent,
  367. upgradeScore: res.data.upgradeScore,
  368. memberId: res.data.id,
  369. })
  370. })
  371. .catch(err => {
  372. wx.showModal({
  373. title: '提示',
  374. content: err.message,
  375. showCancel: false
  376. })
  377. })
  378. },
  379. gotoChengzhangzhi: function() {
  380. wx.navigateTo({
  381. url: '/pages/czdetail/czdetail',
  382. })
  383. },
  384. gotoBargain: function() {
  385. wx.navigateTo({
  386. url: '/pages/bargain/bargain',
  387. })
  388. },
  389. gotoSpellGroup: function() {
  390. wx.navigateTo({
  391. url: '/pages/spellGroup/spellGroup',
  392. })
  393. },
  394. gotoCard: function() {
  395. wx.navigateTo({
  396. url: '/pages/discountCardList/discountCardList',
  397. })
  398. },
  399. // gotoGame: function () {
  400. // wx.navigateTo({
  401. // url: '/pages/game/index',
  402. // })
  403. // },
  404. gotoJfsc: function() {
  405. wx.navigateTo({
  406. url: '/pages/integralmall/index',
  407. })
  408. },
  409. /**
  410. *
  411. * @param {code,page}
  412. * 子组件向父组件传值
  413. */
  414. onGetCode: function(e) {
  415. this.setData({
  416. code: e.detail.val,
  417. page: e.detail.pageNum,
  418. });
  419. console.log(e.detail.val)
  420. console.log(e.detail.pageNum)
  421. },
  422. getWeapNote: function(couponChannelId, couponId, orderId) {
  423. var that = this;
  424. if (app.globalData.token) {
  425. // 登录
  426. console.log(app.globalData.token)
  427. that.getmemberId(app.globalData.token);
  428. that.getBannerlist();
  429. that.topicShow();
  430. that.getxsList();
  431. that.getMallInfo(app.globalData.token);
  432. if (app.couponChannelListCallback) {
  433. app.couponChannelListCallback(app.globalData.token);
  434. }
  435. if (app.couponListCallback) {
  436. app.couponListCallback(app.globalData.token);
  437. }
  438. if (app.businessListCallback) {
  439. app.businessListCallback(app.globalData.token);
  440. }
  441. Http.get({
  442. url: config.api.getWeapNote,
  443. data: {
  444. appId: config.weapp.AppId,
  445. }
  446. })
  447. .then(res => {
  448. console.log(33333333333)
  449. console.log(app.globalData.token)
  450. console.log(res)
  451. console.log(33333333333)
  452. // that.getGameOne(app.globalData.token)
  453. that.getStaticGame(app.globalData.token)
  454. that.getGg(app.globalData.token)
  455. let weapNote = JSON.parse(res.data.weapNote);
  456. that.setData({
  457. desc: weapNote.firstpage.desc,
  458. title: weapNote.firstpage.title
  459. })
  460. })
  461. .catch(err => {
  462. // that.getGameOne(app.globalData.token)
  463. that.getStaticGame(app.globalData.token)
  464. that.getGg(app.globalData.token)
  465. wx.showModal({
  466. title: "提示",
  467. content: err.errMsg,
  468. showCancel: false
  469. });
  470. });
  471. } else {
  472. app.tokenCallback = token => {
  473. // 登录
  474. console.log(app.globalData.token)
  475. that.getmemberId(app.globalData.token);
  476. that.getBannerlist();
  477. that.topicShow();
  478. that.getxsList();
  479. that.getMallInfo(app.globalData.token);
  480. if (app.couponChannelListCallback) {
  481. app.couponChannelListCallback(app.globalData.token);
  482. }
  483. if (app.couponListCallback) {
  484. app.couponListCallback(app.globalData.token);
  485. }
  486. if (app.businessListCallback) {
  487. app.businessListCallback(app.globalData.token);
  488. }
  489. Http.get({
  490. url: config.api.getWeapNote,
  491. data: {
  492. appId: config.weapp.AppId,
  493. }
  494. })
  495. .then(res => {
  496. console.log(33333333333)
  497. console.log(app.globalData.token)
  498. console.log(res)
  499. console.log(33333333333)
  500. // that.getGameOne(app.globalData.token)
  501. that.getStaticGame(app.globalData.token)
  502. that.getGg(app.globalData.token)
  503. let weapNote = JSON.parse(res.data.weapNote);
  504. that.setData({
  505. desc: weapNote.firstpage.desc,
  506. title: weapNote.firstpage.title
  507. })
  508. })
  509. .catch(err => {
  510. // that.getGameOne(app.globalData.token)
  511. that.getStaticGame(app.globalData.token)
  512. that.getGg(app.globalData.token)
  513. wx.showModal({
  514. title: "提示",
  515. content: err.errMsg,
  516. showCancel: false
  517. });
  518. });
  519. }
  520. }
  521. },
  522. getStaticGame(token) {
  523. let _this = this;
  524. Http.get({
  525. url: config.api.getGame,
  526. data: {
  527. triggleAction: 2, // 固定入口
  528. token: token
  529. }
  530. }).then(res => {
  531. if (res.data.id) {
  532. _this.setData({
  533. showIf: true,
  534. newUrl: res.data.imgUrl
  535. })
  536. } else {
  537. _this.setData({
  538. showIf: false
  539. })
  540. }
  541. _this.setData({
  542. staticGamedata: res.data
  543. })
  544. })
  545. .catch(err => {
  546. _this.setData({
  547. showIf: false
  548. })
  549. console.log(err)
  550. })
  551. },
  552. getGameOne: function(token) {
  553. let _this = this;
  554. Http.get({
  555. url: config.api.getGame,
  556. data: {
  557. triggleAction: 1, // 登录触发
  558. token: token
  559. }
  560. }).then(res => {
  561. if (res.data.id) {
  562. _this.setData({
  563. showGame: true,
  564. })
  565. } else {
  566. _this.setData({
  567. showGame: false
  568. })
  569. }
  570. _this.setData({
  571. gamedata: res.data
  572. })
  573. })
  574. .catch(err => {
  575. _this.setData({
  576. showGame: false
  577. })
  578. this.alphaClick();
  579. })
  580. },
  581. /**
  582. * mallinfo
  583. */
  584. getMallInfo: function(token) {
  585. let that = this;
  586. Http.get({
  587. url: config.api.getMallInfo,
  588. data: {
  589. token: token,
  590. }
  591. }).then(res => {
  592. that.setData({
  593. liveFlag: res.data.liveSupport,
  594. weappShareTitle: res.data.weappShareTitle ? res.data.weappShareTitle : null,
  595. weappShareCoverImg: res.data.weappShareCoverImg ? res.data.weappShareCoverImg : null,
  596. });
  597. console.log(that.data.liveFlag, "||||")
  598. })
  599. .catch(err => {
  600. // 不需要错误提示
  601. });
  602. },
  603. //获取限时抢购列表
  604. getxsList() {
  605. let that = this;
  606. Http.get({
  607. url: config.api.couponChannelList,
  608. data: {
  609. pageNum: 1,
  610. pageSize: 3,
  611. targetAd: 2
  612. }
  613. }).then(res => {
  614. if (res && res.data.total > 0) {
  615. that.setData({
  616. xslist: res.data.list,
  617. showQg: true
  618. });
  619. } else {
  620. that.setData({
  621. showQg: false
  622. })
  623. }
  624. })
  625. .catch(err => {
  626. console.log(err)
  627. wx.showToast({
  628. title: err.errMsg,
  629. icon: 'none',
  630. duration: 2000,
  631. mask: false
  632. });
  633. })
  634. },
  635. /**
  636. * banner
  637. */
  638. getBannerlist: function() {
  639. let that = this;
  640. Http.get({
  641. url: config.api.bannerlist,
  642. data: {
  643. pageNum: 1,
  644. pageSize: 7
  645. }
  646. }).then(res => {
  647. that.getmemberId(app.globalData.token);
  648. // that.checkUserCarStatus();
  649. that.setData({
  650. list: res.data.list
  651. });
  652. })
  653. .catch(err => {
  654. that.getmemberId(app.globalData.token);
  655. // that.checkUserCarStatus();
  656. });
  657. },
  658. // 专题显示
  659. topicShow: function() {
  660. let that = this;
  661. Http.get({
  662. url: config.api.topicShow,
  663. data: {
  664. token: app.globalData.token
  665. }
  666. }).then(res => {
  667. if (res && res.data) {
  668. that.setData({
  669. name: res.data.name,
  670. cover: res.data.cover,
  671. id: res.data.id,
  672. showTopic: true
  673. })
  674. } else {
  675. that.setData({
  676. showTopic: false
  677. })
  678. }
  679. })
  680. .catch(err => {
  681. console.log(err);
  682. })
  683. },
  684. gotoTopic() {
  685. wx.navigateTo({
  686. url: `/pages/topicDetail/index?id=${this.data.id}`
  687. })
  688. },
  689. /**
  690. * 检查用户是否有车
  691. */
  692. // checkUserCarStatus: function() {
  693. // var that = this;
  694. // Http.get({
  695. // url: config.api.userCarCount,
  696. // data: {}
  697. // }).then(res => {
  698. // if (res.data > 0) {
  699. // // 用户名下有车
  700. // app.globalData.phone = res.data.phone;
  701. // app.globalData.supportCar = true;
  702. // // 共同登录
  703. // that.userCarLogin();
  704. // }
  705. // });
  706. // },
  707. /**
  708. * car共同登录
  709. */
  710. // userCarLogin: function() {
  711. // var that = this;
  712. // if (!app.globalData.carLogin) {
  713. // // 共同登录
  714. // Http.post({
  715. // url: config.api.carInit,
  716. // data: {
  717. // phone: app.globalData.phone
  718. // }
  719. // }).then(res => {
  720. // app.globalData.carLogin = true;
  721. // app.globalData.parkVendor = res.data.vendor;
  722. // if (res.data.token != "undefined") {
  723. // app.globalData.etcpToken = res.data.token;
  724. // }
  725. // });
  726. // }
  727. // },
  728. /**
  729. * 获取用户信息
  730. */
  731. // getUserInfo: function() {
  732. // // 获取用户信息
  733. // wx.getSetting({
  734. // success: res => {
  735. // if (res.authSetting["scope.userInfo"]) {
  736. // // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
  737. // wx.getUserInfo({
  738. // success: res => {
  739. // // 可以将 res 发送给后台解码出 unionId
  740. // }
  741. // });
  742. // }
  743. // }
  744. // });
  745. // },
  746. gotoBargain: function() {
  747. wx.navigateTo({
  748. url: '/pages/bargain/bargain'
  749. })
  750. },
  751. //限时抢购的详情页面
  752. gotodetail: function(e) {
  753. wx.navigateTo({
  754. url: `/pages/coupon/detail/index?couponChannelId=${
  755. e.currentTarget.dataset.couponchannelid
  756. }&couponId=${e.currentTarget.dataset.couponid}`
  757. });
  758. },
  759. //浮层广告
  760. getGg: function(token) {
  761. let that = this
  762. Http.get({
  763. url: config.api.getGg,
  764. data: {
  765. token: token,
  766. appId: config.weapp.AppId,
  767. openId: that.data.openId
  768. }
  769. }).then(res => {
  770. console.log(res)
  771. if (res.data.id) {
  772. that.setData({
  773. showGg: true,
  774. })
  775. console.log(that.data.showGg, 1111111111111)
  776. } else {
  777. that.setData({
  778. showGg: false
  779. })
  780. that.getGameOne(app.globalData.token)
  781. console.log(that.data.showGg, 222222222222222222)
  782. }
  783. that.setData({
  784. ggdata: res.data
  785. })
  786. })
  787. .catch(err => {
  788. this.setData({
  789. showGg: false
  790. })
  791. that.getGameOne(app.globalData.token)
  792. that.alphaClick1();
  793. })
  794. },
  795. /**
  796. * 刷新
  797. */
  798. onPullDownRefresh: function(e) {
  799. let that = this;
  800. that.getWeapNote();
  801. that.setData({
  802. page: 1
  803. })
  804. if (this.data.optionsData != null && (this.data.optionsData.couponChannelId || this.data.optionsData.orderId)) {
  805. this.getWeapNote(this.data.optionsData.couponChannelId, this.data.optionsData.orderId);
  806. } else {
  807. this.getWeapNote()
  808. }
  809. if (that.data.code == 0 || that.data.code == undefined) {
  810. that.selectComponent("#lists").getList(0, 1, "refresh");
  811. wx.stopPullDownRefresh();
  812. } else {
  813. that.selectComponent("#lists").getList(that.data.code, 1, "refresh");
  814. wx.stopPullDownRefresh();
  815. };
  816. // 砍价下拉刷新
  817. // that.selectComponent("#bargain").getList();
  818. // that.selectComponent("#spellGroup").getList();
  819. // that.selectComponent("#rushtobyCard").getList();
  820. wx.stopPullDownRefresh();
  821. //爆款专区下拉刷新
  822. that.selectComponent("#hot").getList();
  823. that.getxsList();
  824. that.topicShow();
  825. },
  826. //加载更多
  827. onReachBottom: function() {
  828. let that = this;
  829. that.data.page++;
  830. that.setData({
  831. page: that.data.page
  832. });
  833. console.log("加载更多页数" + that.data.page);
  834. console.log("加载更多key" + that.data.code);
  835. //父组件获得子组件的方法
  836. //如果code == 0
  837. if (that.data.code == 0 || that.data.code == undefined) {
  838. that.selectComponent("#lists").getList(0, that.data.page);
  839. } else {
  840. that.selectComponent("#lists").getList(that.data.code, that.data.page);
  841. }
  842. },
  843. // 用户点击右上角分享
  844. onShareAppMessage: function() {
  845. return {
  846. title: this.data.weappShareTitle,
  847. imageUrl: this.data.weappShareCoverImg,
  848. // desc: this.data.desc,
  849. success: function(res) {
  850. wx.showToast({
  851. title: "分享成功",
  852. duration: 1000,
  853. icon: "success"
  854. });
  855. }
  856. };
  857. }
  858. });