C端小程序
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

824 rader
21 KiB

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