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.

825 line
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.setStorageSync('firstEnter', false)
  254. wx.hideLoading();
  255. // wx.showModal({
  256. // title: '提示',
  257. // content: '切换成功!',
  258. // })
  259. wx.reLaunch({
  260. url: '/index/index',
  261. })
  262. })
  263. .catch(err => {
  264. wx.showModal({
  265. title: '提示',
  266. content: err.message,
  267. showCancel: false,
  268. success: function (res) {
  269. // 重启首页
  270. if (res.confirm) {
  271. wx.reLaunch({
  272. url: '/pages/index/index',
  273. })
  274. }
  275. }
  276. })
  277. this.alphaClick();
  278. })
  279. },
  280. /**
  281. * 获得经纬度
  282. */
  283. getLocation() {
  284. let that = this;
  285. wx.getLocation({
  286. type: "wgs84",
  287. success: function (res) {
  288. console.log(res, wx.getStorageSync('tenantData'), 9999)
  289. let minNum = 0;
  290. let minIndex = 0;
  291. JSON.parse(wx.getStorageSync('tenantData')).map((item, index) => {
  292. let lang = that.GetDistance(res.latitude,item.latitude,res.longitude,item.longitude)
  293. minIndex = (index == 0 || lang < minNum) ? index : minIndex;
  294. minNum = (index == 0 || lang < minNum) ? lang : minNum;
  295. })
  296. if (JSON.parse(wx.getStorageSync('tenantData')).length>0&&JSON.parse(wx.getStorageSync('tenantData'))[minIndex].tenantId != wx.getStorageSync('tenantId') && wx.getStorageSync('firstEnter')){
  297. wx.showModal({
  298. title: '提示',
  299. content: '系统检测到您离' + JSON.parse(wx.getStorageSync('tenantData'))[minIndex].name + '较近,要切换至' + JSON.parse(wx.getStorageSync('tenantData'))[minIndex].name+'吗?',
  300. success: function (res) {
  301. // 重启首页
  302. if (res.confirm) {
  303. wx.showLoading({
  304. title: '切换中...',
  305. })
  306. that.checkoutGroup(JSON.parse(wx.getStorageSync('tenantData'))[minIndex].tenantId, JSON.parse(wx.getStorageSync('tenantData'))[minIndex].parentTenantId)
  307. }else{
  308. wx.setStorageSync('firstEnter', false)
  309. }
  310. }
  311. })
  312. }
  313. if (res && res.longitude && res.latitude) {
  314. Http.post({
  315. url: config.api.updateLBS,
  316. data: {
  317. latitude: res.latitude,
  318. longitude: res.longitude
  319. }
  320. }).then(res => {
  321. console.log(res,9999)
  322. })
  323. }
  324. },
  325. fail: error => {
  326. console.log(error);
  327. }
  328. })
  329. },
  330. onShow: function() {
  331. if (typeof this.getTabBar === 'function' &&
  332. this.getTabBar()) {
  333. this.getTabBar().setData({
  334. selected: 0
  335. })
  336. }
  337. let that = this;
  338. that.setData({
  339. havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd : false,
  340. havePlayEd1:app.globalData.havePlayEd1?app.globalData.havePlayEd1 : false
  341. })
  342. /**
  343. * couponNum 是否有普通的优惠券购买
  344. * couponNum2 是否有新买的消费卡
  345. */
  346. let num = wx.getStorageSync('couponNum');
  347. let num1 = wx.getStorageSync('couponNum2');
  348. if (num == 'couponNum' || num1 == 'couponNum2') {
  349. wx.showTabBarRedDot({
  350. index: 3
  351. })
  352. } else {
  353. wx.hideTabBarRedDot({
  354. index: 3
  355. })
  356. }
  357. if (app.globalData.score) {
  358. that.setData({
  359. fistLogin: app.globalData.score
  360. })
  361. }
  362. // 如果有游戏
  363. setTimeout(function() {
  364. that.alphaClick();
  365. }, 8000)
  366. // 如果有广告
  367. setTimeout(function () {
  368. // debugger
  369. that.alphaClick1();
  370. }, 8000)
  371. },
  372. getmemberId: function(token) {
  373. let that = this;
  374. Http.get({
  375. url: config.api.getScore,
  376. data: {
  377. token: token
  378. }
  379. }).then(res => {
  380. that.setData({
  381. levelName: res.data.levelName,
  382. upgradePercent: res.data.upgradePercent,
  383. upgradeScore: res.data.upgradeScore,
  384. memberId: res.data.id,
  385. })
  386. })
  387. .catch(err => {
  388. wx.showModal({
  389. title: '提示',
  390. content: err.message,
  391. showCancel: false
  392. })
  393. })
  394. },
  395. gotoChengzhangzhi: function() {
  396. wx.navigateTo({
  397. url: '/pages/czdetail/czdetail',
  398. })
  399. },
  400. gotoBargain: function () {
  401. wx.navigateTo({
  402. url: '/pages/bargain/bargain',
  403. })
  404. },
  405. gotoSpellGroup: function () {
  406. wx.navigateTo({
  407. url: '/pages/spellGroup/spellGroup',
  408. })
  409. },
  410. gotoCard: function () {
  411. wx.navigateTo({
  412. url: '/pages/discountCardList/discountCardList',
  413. })
  414. },
  415. // gotoGame: function () {
  416. // wx.navigateTo({
  417. // url: '/pages/game/index',
  418. // })
  419. // },
  420. gotoJfsc: function () {
  421. wx.navigateTo({
  422. url: '/pages/integralmall/index',
  423. })
  424. },
  425. /**
  426. *
  427. * @param {code,page}
  428. * 子组件向父组件传值
  429. */
  430. onGetCode: function(e) {
  431. this.setData({
  432. code: e.detail.val,
  433. page: e.detail.pageNum,
  434. });
  435. console.log(e.detail.val)
  436. console.log(e.detail.pageNum)
  437. },
  438. getWeapNote: function(couponChannelId, couponId, orderId) {
  439. var that = this;
  440. // 登录
  441. that.getmemberId(app.globalData.token);
  442. that.getBannerlist();
  443. that.topicShow();
  444. that.getxsList();
  445. that.getMallInfo(app.globalData.token);
  446. if (app.couponChannelListCallback) {
  447. app.couponChannelListCallback(app.globalData.token);
  448. }
  449. if (app.couponListCallback) {
  450. app.couponListCallback(app.globalData.token);
  451. }
  452. if (app.businessListCallback) {
  453. app.businessListCallback(app.globalData.token);
  454. }
  455. Http.get({
  456. url: config.api.getWeapNote,
  457. data: {
  458. appId: config.weapp.AppId,
  459. }
  460. })
  461. .then(res => {
  462. console.log(res)
  463. // that.getGameOne(app.globalData.token)
  464. that.getStaticGame(app.globalData.token)
  465. that.getGg(app.globalData.token)
  466. let weapNote = JSON.parse(res.data.weapNote);
  467. that.setData({
  468. desc: weapNote.firstpage.desc,
  469. title: weapNote.firstpage.title
  470. })
  471. })
  472. .catch(err => {
  473. // that.getGameOne(app.globalData.token)
  474. that.getStaticGame(app.globalData.token)
  475. that.getGg(app.globalData.token)
  476. wx.showModal({
  477. title: "提示",
  478. content: err.errMsg,
  479. showCancel: false
  480. });
  481. });
  482. },
  483. getStaticGame(token) {
  484. let _this = this;
  485. Http.get({
  486. url: config.api.getGame,
  487. data: {
  488. triggleAction: 2, // 固定入口
  489. token: token
  490. }
  491. }).then(res => {
  492. if (res.data.id) {
  493. _this.setData({
  494. showIf: true,
  495. newUrl: res.data.imgUrl
  496. })
  497. } else {
  498. _this.setData({
  499. showIf: false
  500. })
  501. }
  502. _this.setData({
  503. staticGamedata: res.data
  504. })
  505. })
  506. .catch(err => {
  507. _this.setData({
  508. showIf: false
  509. })
  510. console.log(err)
  511. })
  512. },
  513. getGameOne: function(token) {
  514. let _this = this;
  515. Http.get({
  516. url: config.api.getGame,
  517. data: {
  518. triggleAction: 1, // 登录触发
  519. token: token
  520. }
  521. }).then(res => {
  522. if (res.data.id) {
  523. _this.setData({
  524. showGame: true,
  525. })
  526. } else {
  527. _this.setData({
  528. showGame: false
  529. })
  530. }
  531. _this.setData({
  532. gamedata: res.data
  533. })
  534. })
  535. .catch(err => {
  536. _this.setData({
  537. showGame: false
  538. })
  539. this.alphaClick();
  540. })
  541. },
  542. /**
  543. * mallinfo
  544. */
  545. getMallInfo: function(token) {
  546. let that = this;
  547. Http.get({
  548. url: config.api.getMallInfo,
  549. data: {
  550. token: token,
  551. }
  552. }).then(res => {
  553. that.setData({
  554. weappShareTitle: res.data.weappShareTitle ? res.data.weappShareTitle : null,
  555. weappShareCoverImg: res.data.weappShareCoverImg ? res.data.weappShareCoverImg : null,
  556. });
  557. })
  558. .catch(err => {
  559. // 不需要错误提示
  560. });
  561. },
  562. //获取限时抢购列表
  563. getxsList(){
  564. let that = this;
  565. Http.get({
  566. url: config.api.couponChannelList,
  567. data: {
  568. pageNum: 1,
  569. pageSize: 3,
  570. targetAd: 2
  571. }
  572. }).then(res => {
  573. if (res && res.data.total>0) {
  574. that.setData({
  575. xslist: res.data.list,
  576. showQg:true
  577. });
  578. }else{
  579. that.setData({
  580. showQg:false
  581. })
  582. }
  583. })
  584. .catch(err => {
  585. console.log(err)
  586. wx.showToast({
  587. title: err.errMsg,
  588. icon: 'none',
  589. duration: 2000,
  590. mask: false
  591. });
  592. })
  593. },
  594. /**
  595. * banner
  596. */
  597. getBannerlist: function() {
  598. let that = this;
  599. Http.get({
  600. url: config.api.bannerlist,
  601. data: {
  602. pageNum: 1,
  603. pageSize: 7
  604. }
  605. }).then(res => {
  606. that.getmemberId(app.globalData.token);
  607. // that.checkUserCarStatus();
  608. that.setData({
  609. list: res.data.list
  610. });
  611. })
  612. .catch(err => {
  613. that.getmemberId(app.globalData.token);
  614. // that.checkUserCarStatus();
  615. });
  616. },
  617. // 专题显示
  618. topicShow: function() {
  619. let that = this;
  620. Http.get({
  621. url: config.api.topicShow,
  622. data: {
  623. token: app.globalData.token
  624. }
  625. }).then(res => {
  626. if (res && res.data) {
  627. that.setData({
  628. name: res.data.name,
  629. cover: res.data.cover,
  630. id: res.data.id,
  631. showTopic: true
  632. })
  633. } else {
  634. that.setData({
  635. showTopic: false
  636. })
  637. }
  638. })
  639. .catch(err => {
  640. console.log(err);
  641. })
  642. },
  643. gotoTopic() {
  644. wx.navigateTo({
  645. url: `/pages/topicDetail/index?id=${this.data.id}`
  646. })
  647. },
  648. /**
  649. * 检查用户是否有车
  650. */
  651. // checkUserCarStatus: function() {
  652. // var that = this;
  653. // Http.get({
  654. // url: config.api.userCarCount,
  655. // data: {}
  656. // }).then(res => {
  657. // if (res.data > 0) {
  658. // // 用户名下有车
  659. // app.globalData.phone = res.data.phone;
  660. // app.globalData.supportCar = true;
  661. // // 共同登录
  662. // that.userCarLogin();
  663. // }
  664. // });
  665. // },
  666. /**
  667. * car共同登录
  668. */
  669. // userCarLogin: function() {
  670. // var that = this;
  671. // if (!app.globalData.carLogin) {
  672. // // 共同登录
  673. // Http.post({
  674. // url: config.api.carInit,
  675. // data: {
  676. // phone: app.globalData.phone
  677. // }
  678. // }).then(res => {
  679. // app.globalData.carLogin = true;
  680. // app.globalData.parkVendor = res.data.vendor;
  681. // if (res.data.token != "undefined") {
  682. // app.globalData.etcpToken = res.data.token;
  683. // }
  684. // });
  685. // }
  686. // },
  687. /**
  688. * 获取用户信息
  689. */
  690. // getUserInfo: function() {
  691. // // 获取用户信息
  692. // wx.getSetting({
  693. // success: res => {
  694. // if (res.authSetting["scope.userInfo"]) {
  695. // // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
  696. // wx.getUserInfo({
  697. // success: res => {
  698. // // 可以将 res 发送给后台解码出 unionId
  699. // }
  700. // });
  701. // }
  702. // }
  703. // });
  704. // },
  705. gotoBargain: function() {
  706. wx.navigateTo({
  707. url: '/pages/bargain/bargain'
  708. })
  709. },
  710. //限时抢购的详情页面
  711. gotodetail: function (e) {
  712. wx.navigateTo({
  713. url: `/pages/coupon/detail/index?couponChannelId=${
  714. e.currentTarget.dataset.couponchannelid
  715. }&couponId=${e.currentTarget.dataset.couponid}`
  716. });
  717. },
  718. //浮层广告
  719. getGg: function (token) {
  720. let that = this
  721. Http.get({
  722. url: config.api.getGg,
  723. data: {
  724. token: token,
  725. appId: config.weapp.AppId,
  726. openId: that.data.openId
  727. }
  728. }).then(res => {
  729. console.log(res)
  730. if (res.data.id) {
  731. that.setData({
  732. showGg: true,
  733. })
  734. console.log(that.data.showGg,1111111111111)
  735. } else {
  736. that.setData({
  737. showGg: false
  738. })
  739. that.getGameOne(app.globalData.token)
  740. console.log(that.data.showGg,222222222222222222)
  741. }
  742. that.setData({
  743. ggdata: res.data
  744. })
  745. })
  746. .catch(err => {
  747. this.setData({
  748. showGg: false
  749. })
  750. that.getGameOne(app.globalData.token)
  751. that.alphaClick1();
  752. })
  753. },
  754. /**
  755. * 刷新
  756. */
  757. onPullDownRefresh: function(e) {
  758. let that = this;
  759. that.getWeapNote();
  760. that.setData({
  761. page: 1
  762. })
  763. if (this.data.optionsData != null && (this.data.optionsData.couponChannelId || this.data.optionsData.orderId)) {
  764. this.getWeapNote(this.data.optionsData.couponChannelId, this.data.optionsData.orderId);
  765. } else {
  766. this.getWeapNote()
  767. }
  768. if (that.data.code == 0 || that.data.code == undefined) {
  769. that.selectComponent("#lists").getList(0, 1, "refresh");
  770. wx.stopPullDownRefresh();
  771. } else {
  772. that.selectComponent("#lists").getList(that.data.code, 1, "refresh");
  773. wx.stopPullDownRefresh();
  774. };
  775. // 砍价下拉刷新
  776. // that.selectComponent("#bargain").getList();
  777. // that.selectComponent("#spellGroup").getList();
  778. // that.selectComponent("#rushtobyCard").getList();
  779. wx.stopPullDownRefresh();
  780. //爆款专区下拉刷新
  781. that.selectComponent("#hot").getList();
  782. that.getxsList();
  783. that.topicShow();
  784. },
  785. //加载更多
  786. onReachBottom: function() {
  787. let that = this;
  788. that.data.page++;
  789. that.setData({
  790. page: that.data.page
  791. });
  792. console.log("加载更多页数" + that.data.page);
  793. console.log("加载更多key" + that.data.code);
  794. //父组件获得子组件的方法
  795. //如果code == 0
  796. if (that.data.code == 0 || that.data.code == undefined) {
  797. that.selectComponent("#lists").getList(0, that.data.page);
  798. } else {
  799. that.selectComponent("#lists").getList(that.data.code, that.data.page);
  800. }
  801. },
  802. // 用户点击右上角分享
  803. onShareAppMessage: function() {
  804. return {
  805. title: this.data.weappShareTitle,
  806. path: `/pages/index/index` + (wx.getStorageSync('tenantId') ? '?tenantId=' + wx.getStorageSync('tenantId') : ''),
  807. imageUrl: this.data.weappShareCoverImg,
  808. // desc: this.data.desc,
  809. success: function(res) {
  810. wx.showToast({
  811. title: "分享成功",
  812. duration: 1000,
  813. icon: "success"
  814. });
  815. }
  816. };
  817. }
  818. });