works.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804
  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. 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. let pageNo = this.data.pageNo;
  524. let pageSize = this.data.pageSize;
  525. httpRequestApi.getReply(this.uid, columnId, pageNo, pageSize).success((res) => {
  526. const replyList = res.data.data.list;
  527. // const replyTemp = [];
  528. replyList.forEach((item) => {
  529. const temp = {};
  530. temp.nickName = item.user.wechatName;
  531. temp.avatar = item.user.avatar;
  532. temp.profession = item.user.profession;
  533. temp.uid = item.user.uid;
  534. // temp.text = decodeURI(item.detailDesc);
  535. temp.text = item.detailDesc;
  536. temp.id = item.id;
  537. temp.replyCount = item.replyCount;
  538. temp.time = formatDate(item.gmtCreated, 3);
  539. temp.likes = item.postsAttributeInfo.favors || 0;
  540. temp.isLike = item.isLike;
  541. if (item.isRisky === 'NORMAL') {
  542. this.data.replyList.push(temp);
  543. }
  544. });
  545. this.setData({
  546. replyList: this.data.replyList,
  547. total: this.data.replyList.length,
  548. totalPage: res.data.data.totalNo
  549. })
  550. });
  551. },
  552. // 打开回复详情页
  553. goToDetail: function (e) {
  554. let id = e.currentTarget.dataset.id;
  555. // let count = e.currentTarget.dataset.count;
  556. wx.navigateTo({
  557. url: `../../social/replyDetail/replyDetail?id=${id}&productId=${this.data.productId}`
  558. })
  559. },
  560. // 绑定输入框内容
  561. inputValue: function (e) {
  562. this.setData({
  563. inputValue: e.detail.value
  564. });
  565. },
  566. // 发布回复
  567. sendHandler: function () {
  568. console.log(this.data.productId)
  569. if (this.data.inputValue !== '') {
  570. // let uid = wx.getStorageSync('uid');
  571. let data = {
  572. "columnId": this.data.id,
  573. colunmNames: 'what',
  574. // "detailDesc": encodeURI(this.data.inputValue)
  575. "detailDesc": this.data.inputValue,
  576. productId: this.data.productId
  577. }
  578. httpRequestApi.postReply(this.uid, data).success(res => {
  579. console.log(res)
  580. this.setData({
  581. inputValue: '',
  582. pageNo: 1,
  583. replyList: [],
  584. flowerNum: res.data.count
  585. })
  586. this.getReply();
  587. if (res.data.count > 0) {
  588. this.flowerAnimationHandler();
  589. }
  590. });
  591. // 评论成功后刷新数据
  592. }
  593. },
  594. flowerAnimationHandler: function () {
  595. this.flowerBox = this.selectComponent("#flower-box");
  596. this.flowerBox.comeOut();
  597. },
  598. // 触底加载
  599. onReachBottom: function () {
  600. // 当前在推荐页面 加载推荐
  601. if (this.data.pageNo <= this.data.totalPage) {
  602. this.setData({
  603. pageNo: this.data.pageNo + 1
  604. }, () => {
  605. this.getReply();
  606. })
  607. }
  608. },
  609. // 设置点击时的id
  610. setSBId: function (e) {
  611. this.setData({
  612. replySBId: e.currentTarget.dataset.id,
  613. replyModal: true,
  614. replyIndex: e.currentTarget.dataset.index
  615. })
  616. },
  617. // 回复某个评论
  618. replySB: function () {
  619. const data = {
  620. postsId: this.data.replySBId,
  621. content: this.data.inputSBValue,
  622. productId: this.data.productId
  623. }
  624. httpRequestApi.postReplyComment(this.uid, data).success(res => {
  625. const replyWho = this.data.replyList[this.data.replyIndex];
  626. const indexStr = `replyList[${this.data.replyIndex}]`;
  627. replyWho.replyCount++;
  628. this.setData({
  629. replyModal: false,
  630. [indexStr]: replyWho
  631. })
  632. });
  633. },
  634. // 获取回复楼中楼的内容
  635. inputSBValue: function (e) {
  636. this.setData({
  637. inputSBValue: e.detail.value
  638. });
  639. },
  640. // 选择金额
  641. setMoney: function (e) {
  642. this.setData({
  643. howMuch: e.currentTarget.dataset.money
  644. })
  645. },
  646. reward: function () {
  647. if (this.data.isIOS) {
  648. return
  649. };
  650. this.setData({
  651. ifReward: true
  652. })
  653. },
  654. quitReward: function () {
  655. this.setData({
  656. ifReward: false
  657. })
  658. },
  659. // 奖励
  660. rewardMoney: function () {
  661. const data = {
  662. targetUid: this.data.authorUid,
  663. amount: this.data.howMuch
  664. }
  665. // let uid = wx.getStorageSync('uid');
  666. httpRequestApi.rewardMoney(this.uid, data).success(res => {
  667. if (res.data.message) {
  668. wx.showModal({
  669. title: '提示',
  670. content: res.data.message,
  671. success(res) {
  672. if (res.confirm) {
  673. console.log('用户点击确定')
  674. } else if (res.cancel) {
  675. console.log('用户点击取消')
  676. }
  677. }
  678. })
  679. return false;
  680. }
  681. this.payMoney(res.data.data);
  682. })
  683. },
  684. //支付
  685. payMoney: function (orderInfo) {
  686. if (this.data.haveTapMoney) {
  687. return false
  688. }
  689. this.setData({
  690. haveTapMoney: true
  691. })
  692. wx.requestPayment({
  693. 'appId': orderInfo.appId,
  694. 'timeStamp': orderInfo.timeStamp,
  695. 'nonceStr': orderInfo.nonceStr,
  696. 'package': orderInfo.package,
  697. 'signType': orderInfo.signType,
  698. 'paySign': orderInfo.sign,
  699. 'success': res => {
  700. this.setData({
  701. modalType: 'image',
  702. isModalShow: true,
  703. modalCloseShow: false,
  704. modalBtnText: '确定',
  705. haveTapMoney: false,
  706. ifReward: false
  707. })
  708. // wx.showModal({
  709. // title: '提示',
  710. // content: '支付成功',
  711. // success(res) {
  712. // if (res.confirm) {
  713. // this.setData({
  714. // ifReward: false
  715. // })
  716. // } else if (res.cancel) {
  717. // this.setData({
  718. // ifReward: false
  719. // })
  720. // }
  721. // }
  722. // })
  723. },
  724. 'fail': res => {
  725. this.setData({
  726. haveTapMoney: false,
  727. })
  728. console.log('支付失败', res)
  729. }
  730. })
  731. },
  732. // 回到首页
  733. goBackHome: function () {
  734. wx.redirectTo({
  735. url: '../../index/index'
  736. })
  737. },
  738. modalConfirmHandler: function () {
  739. this.setData({
  740. isModalShow: false
  741. })
  742. if(this.data.isIOS){
  743. // wx.navigateTo({
  744. // url: `../../vipPage/vipCode/vipCode`
  745. // })
  746. wx.navigateTo({
  747. url: `../../vipPage/wechat/wechat`
  748. })
  749. }else{
  750. wx.navigateTo({
  751. url: `../../vipPage/vip/vip`
  752. })
  753. }
  754. },
  755. modalCloseHandler: function () {
  756. this.setData({
  757. isModalShow: false
  758. })
  759. },
  760. jurisdiction: function () {
  761. //隐藏弹框
  762. this.setData({
  763. hide: !this.data.hide
  764. })
  765. //登录页信息
  766. // this.onLoad(this.data.onLoadOption);
  767. this.goToReading();
  768. },
  769. goToClass: function () {
  770. if (!this.data.isIOS && this.videoCtx) {
  771. this.innerAudioContext.stop();
  772. this.innerAudioContext.destroy();
  773. this.videoCtx.stop();
  774. this.setData({
  775. videoLoad: false
  776. })
  777. }
  778. setTimeout(() => {
  779. wx.navigateTo({
  780. url: `../../main/class/class?id=${this.data.classId}`
  781. })
  782. }, 100)
  783. }
  784. })