works.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  1. import httpRequestApi from '../../../utils/APIClient';
  2. import {
  3. formatDate
  4. } from '../../../utils/util';
  5. import {
  6. getOpenidNoLogin
  7. } from '../../../utils/httpUtilNoLogin';
  8. import {
  9. getOpenidSessionKey
  10. } from '../../../utils/httpUtil';
  11. const app = getApp()
  12. Page({
  13. data: {
  14. fullScreenBtn: false,
  15. playBtn: true,
  16. gesture: false,
  17. author: '',
  18. videoSrc: '',
  19. total: '',
  20. authorAvatar: '',
  21. user: [],
  22. inputValue: '',
  23. inputSBValue: '',
  24. replyList: [],
  25. howMuch: '200',
  26. moneySelect: 'moneySelect',
  27. moneyNormal: 'moneyNormal',
  28. ifReward: false,
  29. id: '',
  30. path: '',
  31. replyModal: false,
  32. totalRead: 0,
  33. pageNo: 1,
  34. pageSize: 3,
  35. goBackHome: false,
  36. isIOS: app.globalData.isIOS,
  37. alertFlag: false,
  38. modalType: "text",
  39. noScroll: '',
  40. modalText: app.globalData.isIOS ? [{
  41. text: '由于相关规范,ios功能暂不可用',
  42. type: 'bigOrange'
  43. },
  44. {
  45. text: '联系客服解锁哦',
  46. type: 'normal'
  47. }
  48. ] : [{
  49. text: '快去开通VIP',
  50. type: 'bigOrange'
  51. },
  52. {
  53. text: '享受更多权益吧',
  54. type: 'normal'
  55. }
  56. ],
  57. modalBtnText: '解锁课程',
  58. isModalShow: false,
  59. modalCloseShow: true,
  60. hide: true,
  61. addComeOut: '',
  62. flowerNum: '6',
  63. readIsRisky: ''
  64. // shareFlag: false
  65. },
  66. showAlert: function () {
  67. this.setData({
  68. alertFlag: !this.data.alertFlag
  69. })
  70. },
  71. onLoad: function (option) {
  72. console.log(option)
  73. console.log(option.flowerCount)
  74. console.log(option.flowerCount === 0)
  75. if (option.flowerCount) {
  76. this.setData({
  77. fromReading: true
  78. })
  79. this.flowerAnimationHandler();
  80. // setTimeout(() => {
  81. // this.openShare();
  82. // }, 300)
  83. if (option.flowerCount > 0) {
  84. this.setData({
  85. flowerNum: option.flowerCount
  86. })
  87. }
  88. }
  89. // getOpenidNoLogin
  90. getOpenidNoLogin((res) => {
  91. let id = option.id ? option.id : option.scene.replace('QR', '')
  92. if (option.scene || option.shareCard) {
  93. this.setData({
  94. goBackHome: true
  95. })
  96. }
  97. // wx.setNavigationBarTitle({
  98. // title: option.title //页面标题为路由参数
  99. // })
  100. this.uid = wx.getStorageSync('uid');
  101. let stackSize = 1;
  102. if (option.stackSize) {
  103. stackSize = option.stackSize;
  104. }
  105. this.setData({
  106. // title: option.title,
  107. id,
  108. myUid: this.uid,
  109. stackSize
  110. }, () => {
  111. this.getWorks(this.uid, id);
  112. })
  113. }, (error) => {
  114. wx.setStorageSync('userSourseType', 'reading')
  115. // this.setData({
  116. // hide: !this.data.hide,
  117. // onLoadOption: option
  118. // })
  119. return;
  120. });
  121. },
  122. onHide: function () {
  123. // this.data.stackSize >= 2
  124. console.log('=================================hide')
  125. if (this.innerAudioContext) {
  126. console.log('音频应该被暂停')
  127. this.innerAudioContext.pause();
  128. this.innerAudioContext.volume = 0;
  129. }
  130. // this.videoCtx = null
  131. },
  132. onUnload: function () {
  133. console.log('-------------------页面雨鞋')
  134. if (this.videoPlayTime) {
  135. const data = {
  136. "title": this.data.title,
  137. "lessonId": this.data.classId,
  138. "productId": this.data.productId,
  139. "playStopTime": Math.ceil(this.videoPlayTime),
  140. "userReadId": this.data.userReadId,
  141. "type": 'READ',
  142. }
  143. httpRequestApi.playLogReport(data).success(res => {
  144. console.log(res)
  145. })
  146. if (this.innerAudioContext) {
  147. console.log('音频应该被暂停')
  148. this.innerAudioContext.pause();
  149. this.innerAudioContext.volume = 0;
  150. }
  151. }
  152. if (this.innerAudioContext) {
  153. this.innerAudioContext.destroy();
  154. }
  155. this.videoCtx = null
  156. // let videoCtx = wx.createVideoContext('worksVideo', this);
  157. // videoCtx.stop();
  158. },
  159. getWorks: function (uid, id) {
  160. httpRequestApi.getWorksDetail(uid, id, this.data.goBackHome ? 'READ_SHARE' : '').success((res) => {
  161. const others = res.data.data.otherRead;
  162. const author = res.data.data.user;
  163. const works = res.data.data.userRead;
  164. console.log(11111111,author)
  165. console.log(22222222,others)
  166. wx.setNavigationBarTitle({
  167. title: works.title //页面标题为路由参数
  168. })
  169. const othersTemp = [];
  170. others.forEach((item) => {
  171. if(!item) return
  172. const temp = {};
  173. temp.uid = item.userRead.id;
  174. temp.title = item.userRead.title;
  175. temp.image = item.user.avatar;
  176. temp.nickName = item.user.wechatName;
  177. othersTemp.push(temp);
  178. });
  179. this.setData({
  180. user: othersTemp,
  181. totalRead: res.data.data.totalRead,
  182. author: author.wechatName,
  183. authorAvatar: author.avatar,
  184. authorProfession: author.profession,
  185. authorUid: author.uid,
  186. audioSrc: works.audioPath,
  187. iconImg: works.iconImg,
  188. classId: works.lessonId,
  189. isLike: res.data.data.isLike,
  190. isFans: res.data.data.isFans,
  191. videoSrc: works.originVideo,
  192. title: works.title,
  193. userReadId: works.id
  194. })
  195. httpRequestApi.checkLesson(works.lessonId).success(res => {
  196. const productId = res.data.data[0];
  197. this.setData({
  198. productId: productId
  199. })
  200. });
  201. if (this.data.fromReading) {
  202. setTimeout(() => {
  203. this.openShare()
  204. })
  205. }
  206. if (works.isRisky === 'DEL') {
  207. this.setData({
  208. readIsRisky: 'DEL'
  209. });
  210. return false;
  211. }
  212. // 设置音频路径
  213. this.innerAudioContext = wx.createInnerAudioContext();
  214. this.innerAudioContext.onPause((res) => {
  215. // 播放音频失败的回调
  216. console.log('音频暂停')
  217. })
  218. this.innerAudioContext.src = this.data.audioSrc; // 这里可以是录音的临时路径
  219. });
  220. },
  221. onShow() {
  222. console.log('------------------------------------------------')
  223. if (this.data.myUid) {
  224. this.setData({
  225. replyList: [],
  226. pageNo: 1,
  227. pageSize: 8
  228. }, () => {
  229. this.getReply();
  230. })
  231. }
  232. },
  233. videoPlayHandler: function () {
  234. if (this.data.readIsRisky === 'DEL') {
  235. wx.showModal({
  236. title: '提示',
  237. content: '作品还在审核中,请稍后收听(一分钟内)。',
  238. confirmText: '我知道了',
  239. showCancel: false,
  240. success(res) {
  241. console.log('用户点击确定')
  242. }
  243. })
  244. return false;
  245. }
  246. this.setData({
  247. videoLoad: true
  248. }, () => {
  249. this.videoCtx = wx.createVideoContext('worksVideo', this);
  250. this.videoCtx.play();
  251. })
  252. },
  253. likeWorks: function (e) {
  254. // + 1 + 1的动画
  255. this.setData({
  256. addComeOut: 'add-one-come-out'
  257. // isLike: true
  258. })
  259. setTimeout(() => {
  260. if (this.data.addComeOut) {
  261. this.setData({
  262. addComeOut: ''
  263. })
  264. }
  265. }, 1100)
  266. // 恭喜获得x朵小红花
  267. if (this.data.isLike) {
  268. // wx.showToast({
  269. // title: '不要重复点赞哦',
  270. // icon: 'fail',
  271. // duration: 1000
  272. // })
  273. return;
  274. }
  275. httpRequestApi.likeWorks(this.uid, this.data.id).success(res => {
  276. this.setData({
  277. isLike: true,
  278. flowerNum: res.data.count
  279. }, () => {
  280. if (res.data.count > 0) {
  281. this.flowerAnimationHandler();
  282. }
  283. });
  284. })
  285. },
  286. // 弹出分享框
  287. openShare: function (e) {
  288. console.log(this.data.authorAvatar)
  289. console.log(this.data.author)
  290. console.log(this.data.iconImg)
  291. console.log(this.data.title)
  292. console.log(this.data.id)
  293. if (this.data.authorAvatar && this.data.author && this.data.iconImg && this.data.title && this.data.id) {
  294. this.shareDialog = this.selectComponent("#share-dialog");
  295. const data = {
  296. avatar: this.data.authorAvatar,
  297. author: this.data.author,
  298. iconImg: this.data.iconImg,
  299. title: this.data.title,
  300. path: `pages/social/works/works`,
  301. scene: this.data.id,
  302. productId: this.data.productId
  303. // tip: this.data.tip,
  304. }
  305. // console.log(data)
  306. this.setData({
  307. noScroll: 'noScroll'
  308. })
  309. this.shareDialog.share(data);
  310. }
  311. },
  312. // 分享框关闭
  313. shareDialogClose: function (e) {
  314. this.setData({
  315. noScroll: ''
  316. })
  317. },
  318. videoPlay: function (event) {
  319. console.log(11111, this.videoPlayTime)
  320. if (this.data.readIsRisky === 'DEL') {
  321. wx.showModal({
  322. title: '提示',
  323. content: '作品还在审核中,请稍后收听(一分钟内)。',
  324. confirmText: '我知道了',
  325. showCancel: false,
  326. success(res) {
  327. console.log('用户点击确定')
  328. }
  329. })
  330. return false;
  331. }
  332. if (this.innerAudioContext) {
  333. this.innerAudioContext.volume = 1;
  334. if (this.videoPlayTime) {
  335. this.innerAudioContext.seek(this.videoPlayTime);
  336. }
  337. }
  338. console.log('============', this.data.goBackHome)
  339. // 视频开始 先结束 再开始
  340. // this.innerAudioContext.play();
  341. // this.innerAudioContext.pause();
  342. // wx.showToast({
  343. // title: '加载中',
  344. // icon: 'loading',
  345. // duration: 600
  346. // })
  347. // setTimeout(() => {
  348. this.innerAudioContext.play();
  349. // }, 800)
  350. // httpRequestApi.playWorks(this.uid, this.data.id).success(() => {
  351. // console.log('容个错')
  352. // });
  353. },
  354. // 视频播放完毕销毁录音
  355. videoEnd: function (e) {
  356. console.log(e)
  357. this.innerAudioContext.stop();
  358. },
  359. videoPause: function (event) {
  360. console.log('视频暂停')
  361. console.log('暂停', event)
  362. this.innerAudioContext.pause();
  363. this.innerAudioContext.volume = 0;
  364. },
  365. videoWaiting: function () {
  366. console.log('视频缓冲')
  367. this.innerAudioContext.pause();
  368. },
  369. videoProgress: function (e) {
  370. if (e.detail.buffered <= 10) {
  371. this.innerAudioContext.pause();
  372. } else {
  373. this.innerAudioContext.play();
  374. }
  375. },
  376. videoTimeupdate: function (e) {
  377. this.videoPlayTime = e.detail.currentTime
  378. // if (e.detail.currentTime - this.innerAudioContext.currentTime >= 1) {
  379. // this.innerAudioContext.seek(e.detail.currentTime - 0.1);
  380. // }
  381. },
  382. goToReading: function () {
  383. // this.setData({
  384. // isModalShow: true
  385. // })
  386. // return
  387. const classId = this.data.classId;
  388. if (this.innerAudioContext && this.videoCtx) {
  389. this.videoCtx.pause();
  390. this.innerAudioContext.pause();
  391. this.innerAudioContext.volume = 0;
  392. console.log('关闭音频')
  393. }
  394. getOpenidSessionKey((res) => {
  395. httpRequestApi.getUserAuth().success(res => {
  396. if (res.data.data) {
  397. wx.authorize({
  398. scope: 'scope.record',
  399. success() {
  400. // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
  401. console.log('成功')
  402. wx.navigateTo({
  403. url: `../../main/reading/reading?id=${classId}`
  404. })
  405. },
  406. fail() {
  407. wx.showModal({
  408. title: '录音前请打开麦克风权限',
  409. content: '点击右上角浮点...,选择:设置-麦克风,点击/打开。',
  410. confirmText: '我知道了',
  411. showCancel: false,
  412. success(res) {
  413. console.log('用户点击确定')
  414. }
  415. })
  416. }
  417. })
  418. } else {
  419. console.log('chulaiba')
  420. this.setData({
  421. modalType: this.data.isIOS ? 'iosCode' : 'androidVIP',
  422. isModalShow: true
  423. })
  424. }
  425. })
  426. }, (error) => {
  427. this.setData({
  428. hide: !this.data.hide
  429. })
  430. return;
  431. });
  432. },
  433. onShareAppMessage: function () {
  434. console.log(this.data.productId);
  435. const data = {
  436. shareTypeEnum: 'LINK',
  437. shareContentEnum: 'READ',
  438. productId: this.data.productId
  439. }
  440. httpRequestApi.shareRecord(data).success((res) => {
  441. console.log(res)
  442. })
  443. return {
  444. title: '一样的课文,不一样的味道!我的配音表演已开始,求各位大咖围观、点评!',
  445. path: `pages/social/works/works?id=${this.data.id}&title=${this.data.title}&shareCard=true`,
  446. imageUrl: `https://efunbox.lingjiao.cn/reader/resource/share/read_${this.data.productId}.jpg`,
  447. }
  448. },
  449. follow: function () {
  450. let followUid = this.data.authorUid;
  451. if (this.data.isFans) {
  452. httpRequestApi.cancerFollow(this.uid, followUid).success((res) => {
  453. this.setData({
  454. isFans: false
  455. })
  456. wx.showToast({
  457. title: '取消关注',
  458. icon: 'success',
  459. duration: 1000
  460. })
  461. });
  462. } else {
  463. httpRequestApi.followUser(this.uid, followUid).success((res) => {
  464. this.setData({
  465. isFans: true
  466. })
  467. wx.showToast({
  468. title: '关注啦',
  469. icon: 'success',
  470. duration: 1000
  471. })
  472. });
  473. }
  474. },
  475. // 点赞评论
  476. likeCommend: function (e) {
  477. console.log(e);
  478. // let uid = wx.getStorageSync('uid');
  479. let followUid = e.currentTarget.dataset.id;
  480. let index = e.currentTarget.dataset.index;
  481. httpRequestApi.likeCommend(this.uid, followUid).success(res => {
  482. console.log(res);
  483. const str = `replyList[${index}].likes`;
  484. const strImg = `replyList[${index}].isLike`;
  485. this.setData({
  486. [str]: res.data.data.favors,
  487. [strImg]: true
  488. })
  489. });
  490. },
  491. // 去用户主页
  492. goToUsers: function (e) {
  493. let uid = e.currentTarget.dataset.uid;
  494. wx.navigateTo({
  495. url: `../../user/myworks/myworks?uid=${uid}`
  496. });
  497. },
  498. // 去其他用户的作品页
  499. goToOthers: function (e) {
  500. this.data.stackSize++;
  501. console.log(this.data.stackSize)
  502. if (this.data.stackSize >= 3) {
  503. console.log('跳转', this.data.stackSize)
  504. wx.redirectTo({
  505. url: `../../social/works/works?id=${e.currentTarget.dataset.uid}&title=${e.currentTarget.dataset.title}&stackSize=${this.data.stackSize}`
  506. })
  507. } else {
  508. console.log('下一个页面', this.data.stackSize)
  509. wx.navigateTo({
  510. url: `../../social/works/works?id=${e.currentTarget.dataset.uid}&title=${e.currentTarget.dataset.title}&stackSize=${this.data.stackSize}`
  511. })
  512. }
  513. },
  514. // 查询回复
  515. getReply: function () {
  516. // let uid = wx.getStorageSync('uid');
  517. let columnId = this.data.id;
  518. let pageNo = this.data.pageNo;
  519. let pageSize = this.data.pageSize;
  520. httpRequestApi.getReply(this.uid, columnId, pageNo, pageSize).success((res) => {
  521. const replyList = res.data.data.list;
  522. // const replyTemp = [];
  523. replyList.forEach((item) => {
  524. const temp = {};
  525. temp.nickName = item.user.wechatName;
  526. temp.avatar = item.user.avatar;
  527. temp.profession = item.user.profession;
  528. temp.uid = item.user.uid;
  529. // temp.text = decodeURI(item.detailDesc);
  530. temp.text = item.detailDesc;
  531. temp.id = item.id;
  532. temp.replyCount = item.replyCount;
  533. temp.time = formatDate(item.gmtCreated, 3);
  534. temp.likes = item.postsAttributeInfo.favors || 0;
  535. temp.isLike = item.isLike;
  536. if (item.isRisky === 'NORMAL') {
  537. this.data.replyList.push(temp);
  538. }
  539. });
  540. this.setData({
  541. replyList: this.data.replyList,
  542. total: this.data.replyList.length,
  543. totalPage: res.data.data.totalNo
  544. })
  545. });
  546. },
  547. // 打开回复详情页
  548. goToDetail: function (e) {
  549. let id = e.currentTarget.dataset.id;
  550. // let count = e.currentTarget.dataset.count;
  551. wx.navigateTo({
  552. url: `../../social/replyDetail/replyDetail?id=${id}&productId=${this.data.productId}`
  553. })
  554. },
  555. // 绑定输入框内容
  556. inputValue: function (e) {
  557. this.setData({
  558. inputValue: e.detail.value
  559. });
  560. },
  561. // 发布回复
  562. sendHandler: function () {
  563. console.log(this.data.productId)
  564. if (this.data.inputValue !== '') {
  565. // let uid = wx.getStorageSync('uid');
  566. let data = {
  567. "columnId": this.data.id,
  568. colunmNames: 'what',
  569. // "detailDesc": encodeURI(this.data.inputValue)
  570. "detailDesc": this.data.inputValue,
  571. productId: this.data.productId
  572. }
  573. httpRequestApi.postReply(this.uid, data).success(res => {
  574. console.log(res)
  575. this.setData({
  576. inputValue: '',
  577. pageNo: 1,
  578. replyList: [],
  579. flowerNum: res.data.count
  580. })
  581. this.getReply();
  582. if (res.data.count > 0) {
  583. this.flowerAnimationHandler();
  584. }
  585. });
  586. // 评论成功后刷新数据
  587. }
  588. },
  589. flowerAnimationHandler: function () {
  590. this.flowerBox = this.selectComponent("#flower-box");
  591. this.flowerBox.comeOut();
  592. },
  593. // 触底加载
  594. onReachBottom: function () {
  595. // 当前在推荐页面 加载推荐
  596. if (this.data.pageNo <= this.data.totalPage) {
  597. this.setData({
  598. pageNo: this.data.pageNo + 1
  599. }, () => {
  600. this.getReply();
  601. })
  602. }
  603. },
  604. // 设置点击时的id
  605. setSBId: function (e) {
  606. this.setData({
  607. replySBId: e.currentTarget.dataset.id,
  608. replyModal: true,
  609. replyIndex: e.currentTarget.dataset.index
  610. })
  611. },
  612. // 回复某个评论
  613. replySB: function () {
  614. const data = {
  615. postsId: this.data.replySBId,
  616. content: this.data.inputSBValue,
  617. productId: this.data.productId
  618. }
  619. httpRequestApi.postReplyComment(this.uid, data).success(res => {
  620. const replyWho = this.data.replyList[this.data.replyIndex];
  621. const indexStr = `replyList[${this.data.replyIndex}]`;
  622. replyWho.replyCount++;
  623. this.setData({
  624. replyModal: false,
  625. [indexStr]: replyWho
  626. })
  627. });
  628. },
  629. // 获取回复楼中楼的内容
  630. inputSBValue: function (e) {
  631. this.setData({
  632. inputSBValue: e.detail.value
  633. });
  634. },
  635. // 选择金额
  636. setMoney: function (e) {
  637. this.setData({
  638. howMuch: e.currentTarget.dataset.money
  639. })
  640. },
  641. reward: function () {
  642. if (this.data.isIOS) {
  643. return
  644. };
  645. this.setData({
  646. ifReward: true
  647. })
  648. },
  649. quitReward: function () {
  650. this.setData({
  651. ifReward: false
  652. })
  653. },
  654. // 奖励
  655. rewardMoney: function () {
  656. const data = {
  657. targetUid: this.data.authorUid,
  658. amount: this.data.howMuch
  659. }
  660. // let uid = wx.getStorageSync('uid');
  661. httpRequestApi.rewardMoney(this.uid, data).success(res => {
  662. if (res.data.message) {
  663. wx.showModal({
  664. title: '提示',
  665. content: res.data.message,
  666. success(res) {
  667. if (res.confirm) {
  668. console.log('用户点击确定')
  669. } else if (res.cancel) {
  670. console.log('用户点击取消')
  671. }
  672. }
  673. })
  674. return false;
  675. }
  676. this.payMoney(res.data.data);
  677. })
  678. },
  679. //支付
  680. payMoney: function (orderInfo) {
  681. if (this.data.haveTapMoney) {
  682. return false
  683. }
  684. this.setData({
  685. haveTapMoney: true
  686. })
  687. wx.requestPayment({
  688. 'appId': orderInfo.appId,
  689. 'timeStamp': orderInfo.timeStamp,
  690. 'nonceStr': orderInfo.nonceStr,
  691. 'package': orderInfo.package,
  692. 'signType': orderInfo.signType,
  693. 'paySign': orderInfo.sign,
  694. 'success': res => {
  695. this.setData({
  696. modalType: 'image',
  697. isModalShow: true,
  698. modalCloseShow: false,
  699. modalBtnText: '确定',
  700. haveTapMoney: false,
  701. ifReward: false
  702. })
  703. // wx.showModal({
  704. // title: '提示',
  705. // content: '支付成功',
  706. // success(res) {
  707. // if (res.confirm) {
  708. // this.setData({
  709. // ifReward: false
  710. // })
  711. // } else if (res.cancel) {
  712. // this.setData({
  713. // ifReward: false
  714. // })
  715. // }
  716. // }
  717. // })
  718. },
  719. 'fail': res => {
  720. this.setData({
  721. haveTapMoney: false,
  722. })
  723. console.log('支付失败', res)
  724. }
  725. })
  726. },
  727. // 回到首页
  728. goBackHome: function () {
  729. wx.redirectTo({
  730. url: '../../index/index'
  731. })
  732. },
  733. modalConfirmHandler: function () {
  734. this.setData({
  735. isModalShow: false
  736. })
  737. if(this.data.isIOS){
  738. wx.navigateTo({
  739. url: `../../vipPage/vipCode/vipCode`
  740. })
  741. }else{
  742. wx.navigateTo({
  743. url: `../../vipPage/vip/vip`
  744. })
  745. }
  746. },
  747. modalCloseHandler: function () {
  748. this.setData({
  749. isModalShow: false
  750. })
  751. },
  752. jurisdiction: function () {
  753. //隐藏弹框
  754. this.setData({
  755. hide: !this.data.hide
  756. })
  757. //登录页信息
  758. // this.onLoad(this.data.onLoadOption);
  759. this.goToReading();
  760. },
  761. goToClass: function () {
  762. if (!this.data.isIOS && this.videoCtx) {
  763. this.innerAudioContext.stop();
  764. this.innerAudioContext.destroy();
  765. this.videoCtx.stop();
  766. this.setData({
  767. videoLoad: false
  768. })
  769. }
  770. setTimeout(() => {
  771. wx.navigateTo({
  772. url: `../../main/class/class?id=${this.data.classId}`
  773. })
  774. }, 100)
  775. }
  776. })