works.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  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. // setTimeout(() => {
  80. // this.openShare();
  81. // }, 300)
  82. if (option.flowerCount > 0) {
  83. this.setData({
  84. flowerNum: option.flowerCount
  85. })
  86. }
  87. }
  88. // getOpenidNoLogin
  89. getOpenidNoLogin((res) => {
  90. let id = option.id ? option.id : option.scene.replace('QR', '')
  91. if (option.scene || option.shareCard) {
  92. this.setData({
  93. goBackHome: true
  94. })
  95. }
  96. // wx.setNavigationBarTitle({
  97. // title: option.title //页面标题为路由参数
  98. // })
  99. this.uid = wx.getStorageSync('uid');
  100. let stackSize = 1;
  101. if (option.stackSize) {
  102. stackSize = option.stackSize;
  103. }
  104. console.log(2222222222222222)
  105. this.setData({
  106. // title: option.title,
  107. id: id,
  108. myUid: this.uid,
  109. stackSize
  110. }, () => {
  111. console.log(this.data.id)
  112. this.getWorks(this.uid, id);
  113. // this.getReply();
  114. })
  115. }, (error) => {
  116. wx.setStorageSync('userSourseType', 'reading')
  117. // this.setData({
  118. // hide: !this.data.hide,
  119. // onLoadOption: option
  120. // })
  121. return;
  122. });
  123. },
  124. onHide: function() {
  125. // this.data.stackSize >= 2
  126. console.log('=================================hide')
  127. if (this.innerAudioContext) {
  128. console.log('音频应该被暂停')
  129. this.innerAudioContext.pause();
  130. this.innerAudioContext.volume = 0;
  131. }
  132. // this.videoCtx = null
  133. },
  134. onUnload: function() {
  135. console.log('-------------------页面雨鞋')
  136. if (this.videoPlayTime) {
  137. const data = {
  138. "title": this.data.title,
  139. "lessonId": this.data.classId,
  140. "productId": this.data.productId,
  141. "playStopTime": Math.ceil(this.videoPlayTime),
  142. "userReadId": this.data.userReadId,
  143. "type": 'READ',
  144. }
  145. httpRequestApi.playLogReport(data).success(res => {
  146. console.log(res)
  147. })
  148. if (this.innerAudioContext) {
  149. console.log('音频应该被暂停')
  150. this.innerAudioContext.pause();
  151. this.innerAudioContext.volume = 0;
  152. }
  153. }
  154. if (this.innerAudioContext) {
  155. this.innerAudioContext.destroy();
  156. }
  157. this.videoCtx = null
  158. // let videoCtx = wx.createVideoContext('worksVideo', this);
  159. // videoCtx.stop();
  160. },
  161. getWorks: function(uid, id) {
  162. httpRequestApi.getWorksDetail(uid, id, this.data.goBackHome ? 'READ_SHARE' : '').success((res) => {
  163. const others = res.data.data.otherRead;
  164. const author = res.data.data.user;
  165. const works = res.data.data.userRead;
  166. console.log(11111111, author)
  167. console.log(22222222, others)
  168. wx.setNavigationBarTitle({
  169. title: works.title //页面标题为路由参数
  170. })
  171. const othersTemp = [];
  172. others.forEach((item) => {
  173. if (!item) return
  174. const temp = {};
  175. temp.uid = item.userRead.id;
  176. temp.title = item.userRead.title;
  177. temp.image = item.user.avatar;
  178. temp.nickName = item.user.nickName;
  179. othersTemp.push(temp);
  180. });
  181. this.setData({
  182. user: othersTemp,
  183. totalRead: res.data.data.totalRead,
  184. author: author.nickName,
  185. authorAvatar: author.avatar,
  186. authorProfession: author.profession,
  187. authorUid: author.uid,
  188. audioSrc: works.audioPath,
  189. iconImg: works.iconImg,
  190. classId: works.lessonId,
  191. isLike: res.data.data.isLike,
  192. isFans: res.data.data.isFans,
  193. videoSrc: works.originVideo,
  194. title: works.title,
  195. userReadId: works.id
  196. })
  197. httpRequestApi.checkLesson(works.lessonId).success(res => {
  198. const productId = res.data.data[0];
  199. this.setData({
  200. productId: productId
  201. })
  202. });
  203. if (this.data.fromReading) {
  204. setTimeout(() => {
  205. this.openShare()
  206. })
  207. }
  208. if (works.isRisky === 'DEL') {
  209. this.setData({
  210. readIsRisky: 'DEL'
  211. });
  212. return false;
  213. }
  214. // 设置音频路径
  215. this.innerAudioContext = wx.createInnerAudioContext();
  216. this.innerAudioContext.onPause((res) => {
  217. // 播放音频失败的回调
  218. console.log('音频暂停')
  219. })
  220. this.innerAudioContext.src = this.data.audioSrc; // 这里可以是录音的临时路径
  221. });
  222. },
  223. onShow() {
  224. this.timeOut = setInterval(() => {
  225. if (this.data.id) {
  226. clearInterval(this.timeOut)
  227. this.setData({
  228. replyList: [],
  229. pageNo: 1,
  230. pageSize: 8
  231. }, () => {
  232. this.getReply();
  233. })
  234. }
  235. }, 200)
  236. },
  237. videoPlayHandler: function() {
  238. if (this.data.readIsRisky === 'DEL') {
  239. wx.showModal({
  240. title: '提示',
  241. content: '作品还在审核中,请稍后收听(一分钟内)。',
  242. confirmText: '我知道了',
  243. showCancel: false,
  244. success(res) {
  245. console.log('用户点击确定')
  246. }
  247. })
  248. return false;
  249. }
  250. this.setData({
  251. videoLoad: true
  252. }, () => {
  253. this.videoCtx = wx.createVideoContext('worksVideo', this);
  254. this.videoCtx.play();
  255. })
  256. },
  257. likeWorks: function(e) {
  258. // + 1 + 1的动画
  259. this.setData({
  260. addComeOut: 'add-one-come-out'
  261. // isLike: true
  262. })
  263. setTimeout(() => {
  264. if (this.data.addComeOut) {
  265. this.setData({
  266. addComeOut: ''
  267. })
  268. }
  269. }, 1100)
  270. // 恭喜获得x朵小红花
  271. if (this.data.isLike) {
  272. // wx.showToast({
  273. // title: '不要重复点赞哦',
  274. // icon: 'fail',
  275. // duration: 1000
  276. // })
  277. return;
  278. }
  279. httpRequestApi.likeWorks(this.uid, this.data.id).success(res => {
  280. this.setData({
  281. isLike: true,
  282. flowerNum: res.data.count
  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: `../../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. if (this.data.isIOS) {
  420. wx.navigateTo({
  421. url: `../../vipPage/wechat/wechat`
  422. })
  423. } else {
  424. this.setData({
  425. modalType: 'androidVIP',
  426. isModalShow: true
  427. })
  428. }
  429. }
  430. })
  431. }, (error) => {
  432. this.setData({
  433. hide: !this.data.hide
  434. })
  435. return;
  436. });
  437. },
  438. onShareAppMessage: function() {
  439. console.log(this.data.productId);
  440. const data = {
  441. shareTypeEnum: 'LINK',
  442. shareContentEnum: 'READ',
  443. productId: this.data.productId
  444. }
  445. httpRequestApi.shareRecord(data).success((res) => {
  446. console.log(res)
  447. })
  448. return {
  449. title: '一样的课文,不一样的味道!我的配音表演已开始,求各位大咖围观、点评!',
  450. path: `pages/social/works/works?id=${this.data.id}&title=${this.data.title}&shareCard=true`,
  451. imageUrl: `https://efunbox.lingjiao.cn/reader/resource/share/read_${this.data.productId}.jpg`,
  452. }
  453. },
  454. follow: function() {
  455. let followUid = this.data.authorUid;
  456. if (this.data.isFans) {
  457. httpRequestApi.cancerFollow(this.uid, followUid).success((res) => {
  458. this.setData({
  459. isFans: false
  460. })
  461. wx.showToast({
  462. title: '取消关注',
  463. icon: 'success',
  464. duration: 1000
  465. })
  466. });
  467. } else {
  468. httpRequestApi.followUser(this.uid, followUid).success((res) => {
  469. this.setData({
  470. isFans: true
  471. })
  472. wx.showToast({
  473. title: '关注啦',
  474. icon: 'success',
  475. duration: 1000
  476. })
  477. });
  478. }
  479. },
  480. // 点赞评论
  481. likeCommend: function(e) {
  482. console.log(e);
  483. // let uid = wx.getStorageSync('uid');
  484. let followUid = e.currentTarget.dataset.id;
  485. let index = e.currentTarget.dataset.index;
  486. httpRequestApi.likeCommend(this.uid, followUid).success(res => {
  487. console.log(res);
  488. const str = `replyList[${index}].likes`;
  489. const strImg = `replyList[${index}].isLike`;
  490. this.setData({
  491. [str]: res.data.data.favors,
  492. [strImg]: true
  493. })
  494. });
  495. },
  496. // 去用户主页
  497. goToUsers: function(e) {
  498. let uid = e.currentTarget.dataset.uid;
  499. wx.navigateTo({
  500. url: `../../user/myworks/myworks?uid=${uid}`
  501. });
  502. },
  503. // 去其他用户的作品页
  504. goToOthers: function(e) {
  505. this.data.stackSize++;
  506. console.log(this.data.stackSize)
  507. if (this.data.stackSize >= 3) {
  508. console.log('跳转', this.data.stackSize)
  509. wx.redirectTo({
  510. url: `../../social/works/works?id=${e.currentTarget.dataset.uid}&title=${e.currentTarget.dataset.title}&stackSize=${this.data.stackSize}`
  511. })
  512. } else {
  513. console.log('下一个页面', this.data.stackSize)
  514. wx.navigateTo({
  515. url: `../../social/works/works?id=${e.currentTarget.dataset.uid}&title=${e.currentTarget.dataset.title}&stackSize=${this.data.stackSize}`
  516. })
  517. }
  518. },
  519. // 查询回复
  520. getReply: function() {
  521. // let uid = wx.getStorageSync('uid');
  522. let columnId = this.data.id;
  523. console.log(123123123, columnId)
  524. let pageNo = this.data.pageNo;
  525. let pageSize = this.data.pageSize;
  526. httpRequestApi.getReply(this.uid, columnId, pageNo, pageSize).success((res) => {
  527. const replyList = res.data.data.list;
  528. // const replyTemp = [];
  529. replyList.forEach((item) => {
  530. const temp = {};
  531. temp.nickName = item.user.nickName;
  532. temp.avatar = item.user.avatar;
  533. temp.profession = item.user.profession;
  534. temp.uid = item.user.uid;
  535. // temp.text = decodeURI(item.detailDesc);
  536. temp.text = item.detailDesc;
  537. temp.id = item.id;
  538. temp.replyCount = item.replyCount;
  539. temp.time = formatDate(item.gmtCreated, 3);
  540. temp.likes = item.postsAttributeInfo.favors || 0;
  541. temp.isLike = item.isLike;
  542. if (item.isRisky === 'NORMAL') {
  543. this.data.replyList.push(temp);
  544. }
  545. });
  546. this.setData({
  547. replyList: this.data.replyList,
  548. total: this.data.replyList.length,
  549. totalPage: res.data.data.totalNo
  550. })
  551. });
  552. },
  553. // 打开回复详情页
  554. goToDetail: function(e) {
  555. let id = e.currentTarget.dataset.id;
  556. // let count = e.currentTarget.dataset.count;
  557. wx.navigateTo({
  558. url: `../../social/replyDetail/replyDetail?id=${id}&productId=${this.data.productId}`
  559. })
  560. },
  561. // 绑定输入框内容
  562. inputValue: function(e) {
  563. this.setData({
  564. inputValue: e.detail.value
  565. });
  566. },
  567. // 发布回复
  568. sendHandler: function() {
  569. console.log(this.data.productId)
  570. if (this.data.inputValue !== '') {
  571. // let uid = wx.getStorageSync('uid');
  572. let data = {
  573. "columnId": this.data.id,
  574. colunmNames: 'what',
  575. // "detailDesc": encodeURI(this.data.inputValue)
  576. "detailDesc": this.data.inputValue,
  577. productId: this.data.productId
  578. }
  579. httpRequestApi.postReply(this.uid, data).success(res => {
  580. console.log(res)
  581. this.setData({
  582. inputValue: '',
  583. pageNo: 1,
  584. replyList: [],
  585. flowerNum: res.data.count
  586. })
  587. this.getReply();
  588. });
  589. // 评论成功后刷新数据
  590. }
  591. },
  592. // 触底加载
  593. onReachBottom: function() {
  594. // 当前在推荐页面 加载推荐
  595. if (this.data.pageNo <= this.data.totalPage) {
  596. this.setData({
  597. pageNo: this.data.pageNo + 1
  598. }, () => {
  599. this.getReply();
  600. })
  601. }
  602. },
  603. // 设置点击时的id
  604. setSBId: function(e) {
  605. this.setData({
  606. replySBId: e.currentTarget.dataset.id,
  607. replyModal: true,
  608. replyIndex: e.currentTarget.dataset.index
  609. })
  610. },
  611. // 回复某个评论
  612. replySB: function() {
  613. const data = {
  614. postsId: this.data.replySBId,
  615. content: this.data.inputSBValue,
  616. productId: this.data.productId
  617. }
  618. httpRequestApi.postReplyComment(this.uid, data).success(res => {
  619. const replyWho = this.data.replyList[this.data.replyIndex];
  620. const indexStr = `replyList[${this.data.replyIndex}]`;
  621. replyWho.replyCount++;
  622. this.setData({
  623. replyModal: false,
  624. [indexStr]: replyWho
  625. })
  626. });
  627. },
  628. // 获取回复楼中楼的内容
  629. inputSBValue: function(e) {
  630. this.setData({
  631. inputSBValue: e.detail.value
  632. });
  633. },
  634. // 选择金额
  635. setMoney: function(e) {
  636. this.setData({
  637. howMuch: e.currentTarget.dataset.money
  638. })
  639. },
  640. reward: function() {
  641. if (this.data.isIOS) {
  642. return
  643. };
  644. this.setData({
  645. ifReward: true
  646. })
  647. },
  648. quitReward: function() {
  649. this.setData({
  650. ifReward: false
  651. })
  652. },
  653. // 奖励
  654. rewardMoney: function() {
  655. const data = {
  656. targetUid: this.data.authorUid,
  657. amount: this.data.howMuch
  658. }
  659. // let uid = wx.getStorageSync('uid');
  660. httpRequestApi.rewardMoney(this.uid, data).success(res => {
  661. if (res.data.message) {
  662. wx.showModal({
  663. title: '提示',
  664. content: res.data.message,
  665. success(res) {
  666. if (res.confirm) {
  667. console.log('用户点击确定')
  668. } else if (res.cancel) {
  669. console.log('用户点击取消')
  670. }
  671. }
  672. })
  673. return false;
  674. }
  675. this.payMoney(res.data.data);
  676. })
  677. },
  678. //支付
  679. payMoney: function(orderInfo) {
  680. if (this.data.haveTapMoney) {
  681. return false
  682. }
  683. this.setData({
  684. haveTapMoney: true
  685. })
  686. wx.requestPayment({
  687. 'appId': orderInfo.appId,
  688. 'timeStamp': orderInfo.timeStamp,
  689. 'nonceStr': orderInfo.nonceStr,
  690. 'package': orderInfo.package,
  691. 'signType': orderInfo.signType,
  692. 'paySign': orderInfo.sign,
  693. 'success': res => {
  694. this.setData({
  695. modalType: 'image',
  696. isModalShow: true,
  697. modalCloseShow: false,
  698. modalBtnText: '确定',
  699. haveTapMoney: false,
  700. ifReward: false
  701. })
  702. // wx.showModal({
  703. // title: '提示',
  704. // content: '支付成功',
  705. // success(res) {
  706. // if (res.confirm) {
  707. // this.setData({
  708. // ifReward: false
  709. // })
  710. // } else if (res.cancel) {
  711. // this.setData({
  712. // ifReward: false
  713. // })
  714. // }
  715. // }
  716. // })
  717. },
  718. 'fail': res => {
  719. this.setData({
  720. haveTapMoney: false,
  721. })
  722. console.log('支付失败', res)
  723. }
  724. })
  725. },
  726. // 回到首页
  727. goBackHome: function() {
  728. wx.redirectTo({
  729. url: '../../index/index'
  730. })
  731. },
  732. modalConfirmHandler: function() {
  733. this.setData({
  734. isModalShow: false
  735. })
  736. if (this.data.isIOS) {
  737. // wx.navigateTo({
  738. // url: `../../vipPage/vipCode/vipCode`
  739. // })
  740. wx.navigateTo({
  741. url: `../../vipPage/wechat/wechat`
  742. })
  743. } else {
  744. wx.navigateTo({
  745. url: `../../vipPage/vip/vip`
  746. })
  747. }
  748. },
  749. modalCloseHandler: function() {
  750. this.setData({
  751. isModalShow: false
  752. })
  753. },
  754. jurisdiction: function() {
  755. //隐藏弹框
  756. this.setData({
  757. hide: !this.data.hide
  758. })
  759. //登录页信息
  760. // this.onLoad(this.data.onLoadOption);
  761. this.goToReading();
  762. },
  763. goToClass: function() {
  764. if (!this.data.isIOS && this.videoCtx) {
  765. this.innerAudioContext.stop();
  766. this.innerAudioContext.destroy();
  767. this.videoCtx.stop();
  768. this.setData({
  769. videoLoad: false
  770. })
  771. }
  772. setTimeout(() => {
  773. wx.navigateTo({
  774. url: `../../main/class/class?id=${this.data.classId}`
  775. })
  776. }, 100)
  777. }
  778. })