works.js 25 KB

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