C端小程序
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

826 рядки
21 KiB

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