index.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. //index.js
  2. //获取应用实例
  3. // 获取授权登录
  4. import {
  5. getOpenidSessionKey
  6. } from '../../utils/httpUtil';
  7. // 不用获取授权登录
  8. import {
  9. getOpenidNoLogin
  10. } from '../../utils/httpUtilNoLogin';
  11. import {
  12. formatDate
  13. } from '../../utils/util';
  14. const app = getApp()
  15. import {
  16. hotInit
  17. } from '../../component/hot/hot';
  18. import {
  19. groupInit
  20. } from '../../component/group/group';
  21. import {
  22. myInit
  23. } from '../../component/my/my';
  24. import httpRequestApi from '../../utils/APIClient';
  25. import httputil from '../../utils/httpUtil';
  26. import {
  27. GetQueryString
  28. } from '../../utils/util';
  29. Page({
  30. data: {
  31. tab: [{
  32. name: '推荐',
  33. templates: 'recommend',
  34. },
  35. {
  36. name: '关注',
  37. templates: 'follow',
  38. },
  39. {
  40. name: '资源',
  41. templates: 'courses',
  42. },
  43. {
  44. name: '我的',
  45. templates: 'my',
  46. }
  47. ],
  48. winH: 568,
  49. myIndex: 0,
  50. followData: [],
  51. recommendPageNo: 1,
  52. recommendPageSize: 6,
  53. recommendTotalNo: 1,
  54. myData: {},
  55. templates: '',
  56. title: 'index中的title',
  57. jurisdictionFlag: true,
  58. hotInput: '12345',
  59. mineSettingInfo: '528',
  60. hide: true,
  61. isIOS: app.globalData.isIOS,
  62. ifHaveMore: true,
  63. indexSignDialog: false,
  64. indexMissionDialog: false,
  65. unfinishedCount: 0,
  66. videoList: [],
  67. nextMargin: '400rpx', // 视频下边距
  68. commentShow: false,
  69. commentList: [],
  70. commentNum: 0,
  71. followPageNo: 1,
  72. followPageSize: 6,
  73. coursePageNo: 1,
  74. coursesData: [],
  75. },
  76. jurisdiction: function () {
  77. //隐藏弹框
  78. this.setData({
  79. hide: !this.data.hide
  80. })
  81. //登录页信息
  82. this.updateData(0)
  83. },
  84. //tab点击
  85. switcher: function ({
  86. currentTarget
  87. }) {
  88. if (currentTarget.dataset.index === this.data.myIndex) return;
  89. this.updateData(currentTarget.dataset.index);
  90. },
  91. // 根据index 更新template
  92. updateData: function (index) {
  93. let myIndex = index;
  94. this.setData({
  95. myIndex,
  96. });
  97. // 获取推荐列表
  98. if (myIndex == 0) {
  99. this.setData({
  100. videoList: [],
  101. isSwiper: true
  102. }, () => {
  103. this.getHotRecommend(this.uid);
  104. })
  105. return;
  106. }
  107. /* 关注和我的需要登陆后查看 */
  108. if (!this.data.isLogin) {
  109. wx.navigateTo({
  110. url: `../../pages/login/login?index=${myIndex}`
  111. });
  112. return;
  113. }
  114. console.log('继续')
  115. // 刷新关注列表
  116. if (myIndex == 1) {
  117. this.setData({
  118. videoList: [],
  119. isSwiper: true,
  120. followPageNo: 1
  121. }, () => {
  122. this.getFollowData()
  123. })
  124. return;
  125. }
  126. // 刷新资源
  127. if (myIndex == 2) {
  128. this.setData({
  129. videoList: [],
  130. coursesData: [],
  131. templates: 'courses',
  132. coursePageNo: 1
  133. }, () => {
  134. this.getCoursesList();
  135. })
  136. return;
  137. }
  138. // 刷新我的
  139. if (myIndex == 3) {
  140. this.setData({
  141. videoList: [],
  142. templates: 'my',
  143. isSwiper: false
  144. }, () => {
  145. myInit(this);
  146. })
  147. return;
  148. }
  149. },
  150. showPage: function () {
  151. let options = this.data.options;
  152. if (options && options.index) {
  153. this.updateData(options.index)
  154. } else {
  155. this.updateData(0)
  156. }
  157. setTimeout(() => {
  158. if (wx.getStorageSync('uid')) {
  159. httpRequestApi.userLoginRecord().success(res => {
  160. if (res.data.data && res.data.data.length !== 0) {
  161. // 有数据弹签到
  162. if (this.data.unfinishedCount > 0) {
  163. this.setData({
  164. indexSignDialog: true
  165. })
  166. }
  167. } else {
  168. // 没数据弹任务
  169. let oldDay = wx.getStorageSync('oldDay');
  170. let newDate = new Date();
  171. let day = newDate.getDate() < 10 ? '0' + newDate.getDate() : newDate.getDate()
  172. let timeStep = (newDate.getMonth() + 1).toString() + day
  173. if (oldDay) {
  174. let temp = parseInt(timeStep) - parseInt(oldDay)
  175. if (temp > 0) {
  176. wx.setStorageSync('oldDay', timeStep);
  177. this.setData({
  178. indexMissionDialog: true
  179. })
  180. }
  181. } else {
  182. wx.setStorageSync('oldDay', timeStep);
  183. this.setData({
  184. indexMissionDialog: true
  185. })
  186. }
  187. }
  188. })
  189. }
  190. }, 2800)
  191. },
  192. onLoad: function (options) {
  193. getOpenidNoLogin((res) => {
  194. console.log('getOpenidNoLogin', res)
  195. if (!res.data.data.grade) {
  196. this.setData({
  197. isGradeShow: true,
  198. options
  199. })
  200. }
  201. // 登录或注册完成 展示页面
  202. }, (error) => {
  203. console.log('获取失败', error)
  204. });
  205. if (options.scene) {
  206. this.setData({
  207. workId: options.scene
  208. })
  209. }
  210. this.uid = wx.getStorageSync('uid');
  211. let grade = wx.getStorageSync('grade');
  212. // if (!this.uid || !grade) {
  213. // this.setData({
  214. // isGradeShow: true,
  215. // options
  216. // })
  217. // console.log('没有uid 也不是游客,需要去授权')
  218. // return;
  219. // }
  220. this.showPage();
  221. wx.getSystemInfo({
  222. success: (res) => {
  223. console.log('系统', res)
  224. let winH = res.windowHeight * res.pixelRatio;
  225. let minusNumber = (winH * 920) / 1206;
  226. let nextMargin = parseInt(winH - minusNumber);
  227. app.globalData.nextMargin = nextMargin;
  228. this.setData({
  229. winH: winH,
  230. devicePixelRatio: res.pixelRatio,
  231. nextMargin: nextMargin + 'rpx'
  232. });
  233. }
  234. });
  235. },
  236. onShow: function () {
  237. console.log('this.data.workId', this.data.workId)
  238. if (this.data.workId) {
  239. // 需要在推荐第一个上插入一条分享或者刚朗读完数据
  240. let id = this.data.workId;
  241. this.setData({
  242. workId: null,
  243. myIndex: 0,
  244. videoList: [],
  245. isSwiper: true,
  246. recommendTotalNo: 1
  247. })
  248. httpRequestApi.getClassDetail(id).success(res => {
  249. console.log('有一条数据', res)
  250. let tempList = [];
  251. tempList.push(res.data.data);
  252. this.setData({
  253. videoList: [],
  254. isSwiper: true,
  255. recommendTotalNo: 1
  256. }, () => {
  257. this.formatWorksList(tempList, true);
  258. this.getHotRecommend()
  259. })
  260. // this.showPage()
  261. })
  262. }
  263. if (this.data.myIndex === 3) {
  264. this.getUserWorksInfo(1)
  265. }
  266. wx.setNavigationBarTitle({
  267. title: '小学语文朗读配音'
  268. })
  269. console.log('页面返回页面返回', this.data.fromLoginIndex)
  270. if (this.data.fromLoginIndex) {
  271. console.log('页面返回页面返回', this.data.fromLoginIndex)
  272. let index = this.data.fromLoginIndex;
  273. this.setData({
  274. fromLoginIndex: null
  275. }, () => {
  276. this.updateData(0)
  277. })
  278. }
  279. const userInfo = wx.getStorageSync('user')
  280. if (userInfo.wechatName) {
  281. this.setData({
  282. isLogin: true
  283. })
  284. } else {
  285. this.setData({
  286. isLogin: false
  287. })
  288. }
  289. },
  290. onHide: function () {
  291. const str = 'hotData.inputFocus'
  292. this.setData({
  293. [str]: false
  294. });
  295. },
  296. /* 两个接口维护同一个数组,手动的结束后添加算法的 */
  297. // 推荐页信息 获取消息和手动推荐内容
  298. // 获取热门作品 算法出来的
  299. getHotRecommend: function () {
  300. let grade = wx.getStorageSync('grade')
  301. let pageNo = this.data.recommendPageNo;
  302. let pageSize = this.data.recommendPageSize;
  303. httpRequestApi.getHotRecommendSecond(grade, pageNo, pageSize).success(res => {
  304. console.log(res)
  305. const recommendRes = res.data.data.list;
  306. if (recommendRes.length === 0) return;
  307. // const recommendWorks = [];
  308. this.formatWorksList(recommendRes);
  309. })
  310. },
  311. // 组装list
  312. formatWorksList(list, notSet) {
  313. list.forEach(item => {
  314. const temp = {};
  315. temp.title = item.userRead.title;
  316. temp.summary = item.userRead.summary;
  317. temp.img = item.userRead.iconImg;
  318. temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
  319. temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
  320. temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
  321. temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
  322. temp.time = formatDate(item.userRead.gmtCreated, 3);
  323. temp.avatar = item.user.avatar;
  324. temp.profession = item.user.profession;
  325. temp.uid = item.user.uid;
  326. temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
  327. temp.id = item.userRead.id;
  328. temp.type = item.userRead.type;
  329. temp.nickName = item.user.wechatName;
  330. temp.isLike = item.isLike;
  331. temp.isFavorite = item.isFavorites;
  332. this.data.videoList.push(temp);
  333. });
  334. if (!notSet) {
  335. this.setData({
  336. videoList: this.data.videoList
  337. })
  338. }
  339. },
  340. // 获取用户信息
  341. getUserWorksInfo: function (flag) {
  342. if (flag) {
  343. httpRequestApi.getUserWorksInfo().success(res => {
  344. const userInfo = this.formatGrade(res.data.data.user);
  345. const str = 'myData.userInfo.nickName';
  346. const avatarStr = 'myData.userInfo.avatar';
  347. const gradeTextStr = 'myData.userInfo.gradeText';
  348. this.setData({
  349. [str]: userInfo.nickName,
  350. [avatarStr]: userInfo.avatar,
  351. [gradeTextStr]: userInfo.gradeText
  352. })
  353. })
  354. return;
  355. }
  356. httpRequestApi.getUserWorksInfo().success(res => {
  357. this.data.myData.user = res.data.data;
  358. httpRequestApi.userIntoPage('pages/index/index', '首页我的').success((res) => {})
  359. if (res.data.data.myRead) {
  360. res.data.data.myRead.gmtCreated = formatDate(this.data.myData.user.myRead.gmtCreated, 4)
  361. }
  362. res.data.data.user = this.formatGrade(res.data.data.user);
  363. this.setData({
  364. myData: res.data.data,
  365. ['myData.userInfo']: res.data.data.user
  366. }, () => {
  367. this.getMyRead()
  368. });
  369. }).fail(error => {
  370. console.log(error)
  371. })
  372. },
  373. formatGrade(userInfo) {
  374. switch (userInfo.grade) {
  375. case 'PRESCHOOL':
  376. userInfo.gradeText = '学前班'
  377. break;
  378. case 'PRIMARY_FIRST_GRADE':
  379. userInfo.gradeText = '小学一年级'
  380. break;
  381. case 'PRIMARY_SECOND_GRADE':
  382. userInfo.gradeText = '小学二年级'
  383. break;
  384. case 'PRIMARY_THREE_GRADE':
  385. userInfo.gradeText = '小学三年级'
  386. break;
  387. }
  388. return userInfo;
  389. },
  390. videoChange: function (e) {
  391. console.log('到了底部到了底部', e.detail.index)
  392. console.log('到了底部到了底部', e.detail._last)
  393. console.log('到了底部到了底部', e.detail.nextQueue)
  394. if (e.detail.nextQueue.length === 1) {
  395. if (this.data.myIndex === 1) {
  396. this.setData({
  397. followPageNo: this.data.followPageNo + 1
  398. }, () => {
  399. this.getFollowData()
  400. })
  401. }
  402. }
  403. },
  404. // 触底加载
  405. onReachBottom: function () {
  406. console.log('到了底部到了底部', this.data.myIndex)
  407. if (this.data.myIndex === 2) {
  408. this.setData({
  409. coursePageNo: this.data.coursePageNo + 1
  410. }, () => {
  411. this.getCoursesList()
  412. })
  413. }
  414. if (this.data.myIndex === 0) {
  415. this.setData({
  416. recommendPageNo: this.data.recommendPageNo + 1
  417. }, () => {
  418. this.getHotRecommend()
  419. })
  420. }
  421. // // 当前在推荐页面 加载推荐
  422. // if (this.data.myIndex === 1) {
  423. // console.log(this.data.recommendPageNo)
  424. // console.log(this.data.recommendTotalNo)
  425. // this.setData({
  426. // recommendPageNo: this.data.recommendPageNo + 1
  427. // })
  428. // if (this.data.recommendPageNo <= this.data.recommendTotalNo) {
  429. // this.getHotRecommendSecond(this.uid, this.data.recommendPageNo, 3);
  430. // } else {
  431. // console.log('没有更多')
  432. // }
  433. // }
  434. },
  435. onPullDownRefresh: function () {
  436. //当前在团购页下拉加载
  437. if (this.data.myIndex === 0) {
  438. // groupInit(this);
  439. }
  440. wx.showNavigationBarLoading() //在标题栏中显示加载
  441. //模拟加载
  442. setTimeout(function () {
  443. wx.hideNavigationBarLoading() //完成停止加载
  444. wx.stopPullDownRefresh() //停止下拉刷新
  445. }, 1500);
  446. },
  447. goToMessage: function () {
  448. wx.navigateTo({
  449. url: `../../pages/social/insideMessage/insideMessage`
  450. });
  451. const str = 'hotData.unReadMessageNum';
  452. this.setData({
  453. [str]: 0
  454. })
  455. },
  456. toMyCollage: function (e) {
  457. if (app.globalData.isIOS) {
  458. wx.navigateTo({
  459. url: `../../pages/groupPage/my-group/my-group?title=我的助力`
  460. });
  461. } else {
  462. wx.navigateTo({
  463. url: `../../pages/groupPage/my-group/my-group?title=我的拼团`
  464. });
  465. }
  466. },
  467. toMyCourse: function () {
  468. wx.navigateTo({
  469. url: `../../pages/user/mycourse/mycourse?title=我的课程`
  470. });
  471. },
  472. goToFlower: function () {
  473. wx.navigateTo({
  474. url: `../../pages/social/littleFlower/littleFlower`
  475. });
  476. },
  477. signInBtn: function (e) {
  478. this.setData({
  479. indexSignDialog: false
  480. })
  481. console.log(e.detail.formId)
  482. httpRequestApi.postFormId(e.detail.formId).success(res => {
  483. console.log(res)
  484. })
  485. this.goToFlower();
  486. },
  487. missionBtn: function () {
  488. this.setData({
  489. indexMissionDialog: false
  490. })
  491. this.goToFlower();
  492. },
  493. getUserAuth: function () {
  494. httpRequestApi.getUserAuth().success(res => {
  495. console.log(res)
  496. const str = 'myData.isVIP'
  497. if (res.data.data) {
  498. this.setData({
  499. [str]: true
  500. })
  501. } else {
  502. this.setData({
  503. [str]: false
  504. })
  505. }
  506. })
  507. },
  508. delHideMyWork: function () {
  509. this.getMyRead()
  510. },
  511. // 获取我的朗读
  512. getMyRead: function () {
  513. httpRequestApi.myRead().success(res => {
  514. console.log(123123, res)
  515. console.log('mydata', this.data.myData)
  516. const myList = res.data.data;
  517. if (myList.length === 0) return;
  518. // const recommendWorks = [];
  519. const myWorks = [];
  520. myList.forEach(item => {
  521. const temp = {};
  522. temp.title = item.title;
  523. temp.summary = item.summary;
  524. temp.img = item.iconImg;
  525. temp.plays = item.playAmount;
  526. temp.likes = item.likeAmount;
  527. temp.commentAmount = item.commentAmount;
  528. temp.classId = item.exampleId ? item.exampleId : 1605097720036046;
  529. temp.time = formatDate(item.gmtCreated, 3);
  530. temp.avatar = this.data.myData.userInfo.avatar;
  531. temp.uid = this.uid;
  532. temp.url = item.videoPath;
  533. temp.id = item.id;
  534. temp.showMyBtn = true;
  535. temp.nickName = this.data.myData.userInfo.wechatName;
  536. temp.status = item.status
  537. myWorks.push(temp);
  538. });
  539. console.log('myWorks', myWorks)
  540. this.setData({
  541. videoList: myWorks
  542. })
  543. })
  544. },
  545. // 评论区点击
  546. commentTap: function (e) {
  547. console.log('点击评论区', e)
  548. if (e.target.dataset.type === 'blank') {
  549. this.setData({
  550. commentShow: false
  551. })
  552. }
  553. },
  554. touchMove: function (e) {
  555. return
  556. },
  557. // 打开评论
  558. openComment: function (e) {
  559. //
  560. console.log('id', e.detail.activeId)
  561. this.setData({
  562. commentShow: !this.data.commentShow,
  563. commentId: e.detail.activeId,
  564. // commentList: []
  565. });
  566. // this.getReply(e.detail.activeId);
  567. },
  568. // 获取评论信息
  569. getReply: function (columnId) {
  570. // let columnId = this.data.id;
  571. console.log(123123123, columnId)
  572. // let pageNo = this.data.pageNo;
  573. // let pageSize = this.data.pageSize;
  574. httpRequestApi.getReply(this.uid, columnId, 1, 10).success((res) => {
  575. console.log('reply', res)
  576. const commentList = res.data.data.list;
  577. const commentNum = res.data.data.totalSize;
  578. console.log('评论数量', commentNum)
  579. commentList.forEach((item) => {
  580. const temp = {};
  581. temp.nickName = item.user.wechatName;
  582. temp.avatar = item.user.avatar;
  583. temp.uid = item.user.uid;
  584. temp.text = item.detailDesc;
  585. temp.id = item.id;
  586. temp.replyCount = item.replyCount;
  587. temp.time = formatDate(item.gmtCreated, 3);
  588. temp.likes = item.postsAttributeInfo.favors || 0;
  589. temp.isLike = item.isLike;
  590. temp.replyList = item.replyVOList;
  591. this.data.commentList.push(temp);
  592. });
  593. this.setData({
  594. commentList: this.data.commentList,
  595. commentNum: commentNum
  596. })
  597. });
  598. },
  599. // 发布回复
  600. sendReply: function (e) {
  601. console.log('triger', e.detail.content);
  602. let data = {
  603. columnId: this.data.commentId,
  604. colunmNames: 'what',
  605. detailDesc: e.detail.content,
  606. // productId: this.data.productId
  607. }
  608. httpRequestApi.postReply(this.uid, data).success(res => {
  609. console.log(res)
  610. this.setData({
  611. pageNo: 1,
  612. commentList: []
  613. }, () => {
  614. this.getReply(this.data.commentId);
  615. })
  616. });
  617. },
  618. gradeTap: function () {
  619. // console.log("组件回调,返回上一页");
  620. this.setData({
  621. isGradeShow: true
  622. })
  623. },
  624. // 修改年级
  625. changeGrade: function (e) {
  626. const grade = e.target.dataset.code;
  627. wx.setStorageSync('grade', grade)
  628. this.setData({
  629. isGradeShow: false,
  630. })
  631. getOpenidNoLogin((res) => {
  632. console.log('getOpenidNoLogin', res)
  633. // 登录或注册完成 展示页面
  634. this.showPage()
  635. }, (error) => {
  636. console.log('获取失败')
  637. wx.setStorageSync('userSourseType', 'normal')
  638. this.setData({
  639. hide: !this.data.hide
  640. })
  641. }, grade);
  642. },
  643. getFollowData: function () {
  644. httpRequestApi.getFollowWorks(this.data.followPageNo, this.data.followPageSize).success(res => {
  645. if (res.data.data.totalSize === 0) {
  646. this.setData({
  647. videoList: []
  648. })
  649. console.log('没有关注人或关注的人没有发过作品')
  650. return
  651. }
  652. console.log('关注列表', res)
  653. const followData = res.data.data.list;
  654. // const videoList = [];
  655. this.formatWorksList(followData);
  656. });
  657. },
  658. // 点击用户头像区域
  659. headTapHandler: function (e) {
  660. console.log('点击头像', e)
  661. let tapId = e.detail.activeId;
  662. // 点击头像既关注 测试
  663. httpRequestApi.followUser(this.uid, tapId).success(res => {
  664. console.log(res)
  665. })
  666. },
  667. getCoursesList: function () {
  668. const grade = wx.getStorageSync('grade');
  669. const data = {
  670. pageNo: this.data.coursePageNo,
  671. pageSize: 6,
  672. grade,
  673. type: 'EXAMPLE'
  674. };
  675. console.log('资源', data)
  676. httpRequestApi.getClassRead(data).success(res => {
  677. console.log('资源', this.data.coursesData)
  678. this.setData({
  679. coursesData: this.data.coursesData.concat(res.data.data.list)
  680. }, () => {
  681. console.log(this.data.coursesData)
  682. })
  683. })
  684. },
  685. goToReading: function (e) {
  686. console.log('去朗读', e)
  687. const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
  688. wx.navigateTo({
  689. url: `../../pages/reading/reading?id=${id}`
  690. });
  691. },
  692. courseCollectTap: function collectClass(e) {
  693. console.log('收藏按钮', e);
  694. const data = {
  695. targetCode: e.target.dataset.id ? e.target.dataset.id : e.currentTarget.dataset.id,
  696. favoritesType: e.target.dataset.type ? e.target.dataset.type : e.currentTarget.dataset.type
  697. }
  698. const index = e.target.dataset.index ? e.target.dataset.index : e.currentTarget.dataset.index;
  699. let str = `coursesData[${index}].isFavorites`
  700. httpRequestApi.collectClass(data).success((res) => {
  701. console.log('this.data.coursesData[index]', this.data.coursesData[index])
  702. this.setData({
  703. [str]: !this.data.coursesData[index].isFavorites
  704. })
  705. });
  706. },
  707. coursesOpenShare: function coursesOpenShare(e){
  708. const obj = e.currentTarget.dataset
  709. console.log('分享', obj)
  710. console.log('分享', e)
  711. if (1) {
  712. this.shareDialog = this.selectComponent("#share-dialog");
  713. const data = {
  714. avatar: obj.avatar,
  715. author: obj.author,
  716. iconImg: obj.iconImg,
  717. title: obj.title,
  718. path: `pages/index/index`,
  719. scene: obj.id,
  720. productId: 1
  721. // tip: this.data.tip,
  722. }
  723. // console.log(data)
  724. this.setData({
  725. noScroll: 'noScroll'
  726. })
  727. this.shareDialog.share(data);
  728. }
  729. }
  730. })