reading.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. import httpRequestApi from '../../utils/APIClient';
  2. const aiengine = require('../../utils/ChivoxAiEngine')
  3. const sha1 = require('../../utils/sha1');
  4. import {
  5. formatDate
  6. } from '../../utils/util';
  7. Page({
  8. data: {
  9. title: '',
  10. id: '',
  11. img: '',
  12. fullScreenBtn: false,
  13. playBtn: true,
  14. gesture: true,
  15. muted: false,
  16. gesture: false,
  17. centerBtn: true,
  18. recordFlag: 0,
  19. recordSource: '',
  20. videoCtr: 'recordingVideoEnd',
  21. btnFlag: false,
  22. btnImgFlag: false,
  23. microphonePng: '../../static/index/microphone.png',
  24. recordingGif: '../../static/index/readingNow.gif',
  25. videoUrl: '',
  26. readingText: '',
  27. videoList: [],
  28. pageNo: 1,
  29. totalSize: 0,
  30. nextMargin: getApp().globalData.nextMargin,
  31. lowerThresHold: 100,
  32. isVideoListShow: true,
  33. overall: '', // 评测总分
  34. integrity: '', //完成度
  35. tone: '', //语调声调
  36. fluency: '', //流利度
  37. accuracy: '', // 正确分,发音分
  38. star: [0, 0, 0, 0, 0],
  39. ifTextShow: true,
  40. ifScoreDialogShow: false,
  41. ifScoreShow: false,
  42. statusbarobj: {
  43. isshowbtn: false, //是否显示按钮
  44. title: "小学语文朗读配音", //标题
  45. },
  46. },
  47. onLoad: function (option) {
  48. console.log(option);
  49. this.videoCtx = null;
  50. const uid = wx.getStorageSync('uid')
  51. this.getClassInfo(option.id);
  52. // this.getMicAuth()
  53. },
  54. getClassInfo: function (id) {
  55. httpRequestApi.getClassDetail(id).success(res => {
  56. console.log('课程信息', res)
  57. let reg = /\\n/g
  58. this.setData({
  59. title: res.data.data.userRead.title,
  60. videoUrl: res.data.data.userRead.videoPath,
  61. originVideo: res.data.data.userRead.originVideo,
  62. img: res.data.data.userRead.iconImg,
  63. id: res.data.data.userRead.id,
  64. readingText: res.data.data.userRead.lessonText,
  65. grade: res.data.data.userRead.grade,
  66. exampleId: res.data.data.userRead.exampleId,
  67. summary: res.data.data.userRead.summary,
  68. coverImg: res.data.data.userRead.coverImg,
  69. })
  70. this.getReadInfo(id)
  71. httpRequestApi.userIntoPage('pages/reading/reading', '朗读页面').success((res) => {
  72. })
  73. })
  74. },
  75. onHide: function () {
  76. console.log('onhide')
  77. if (this.data.btnImgFlag) {
  78. this.recorderManager.stop();
  79. }
  80. if (this.innerAudioContext) {
  81. this.innerAudioContext.stop();
  82. }
  83. // this.ss.destroyEngine();
  84. this.setData({
  85. recordFlag: 0
  86. })
  87. },
  88. onUnload: function () {
  89. console.log('onUnload')
  90. if (this.data.btnImgFlag) {
  91. this.recorderManager.stop();
  92. }
  93. if (this.innerAudioContext) {
  94. this.innerAudioContext.stop();
  95. }
  96. },
  97. onShow: function () {
  98. this.videoCtx = wx.createVideoContext('myVideo', this);
  99. let data = requirePlugin("myPlugin");
  100. const obj = {
  101. appid: 'a415',
  102. userid: wx.getStorageSync('uid'),
  103. getEvalMessage: (res) => {
  104. this.getRecordScore(res)
  105. // console.log('评测结果',res)
  106. },
  107. recorderCallback: (type, data) => {
  108. // 录音测评监控回调
  109. this.ssRecorderCallback(type, data)
  110. }
  111. }
  112. // this.ss = new data.ssEngine(obj);
  113. this.recorderManager = wx.getRecorderManager();
  114. this.recorderManager.onStop((res) => {
  115. // wx.showToast({
  116. // title: 'onStop',
  117. // icon: 'fail',
  118. // duration: 500
  119. // })
  120. this.videoCtx.seek(0);
  121. this.videoCtx.stop();
  122. console.log('recorder stop', res)
  123. const recordFile = res.tempFilePath;
  124. this.setData({
  125. recordFlag: 0,
  126. recordSource: recordFile,
  127. btnFlag: true,
  128. btnImgFlag: false
  129. })
  130. this.wsEngine.stop({
  131. success: () => {
  132. console.log('====== wsEngine stop success ======');
  133. wx.showLoading({
  134. title: '作品评测中',
  135. mask: true
  136. })
  137. // TODO: add your code here
  138. },
  139. fail: (res) => {
  140. console.log("====== wsEngine stop fail ======");
  141. console.log(JSON.stringify(res)); //请关注res.errId, res.error
  142. // TODO: add your code here
  143. },
  144. complete: () => {
  145. // TODO: add your code here
  146. // clearInterval(recordTimeInterval);
  147. console.log("====== wsEngine stop complete ======");
  148. }
  149. });
  150. })
  151. this.recorderManager.onStart(() => {
  152. // this.saveVideo();
  153. this.setData({
  154. btnImgFlag: true,
  155. btnFlag: false
  156. })
  157. console.log('recorder start')
  158. });
  159. //监听已录制完指定帧大小的文件事件。如果设置了 frameSize,则会回调此事件。
  160. this.recorderManager.onFrameRecorded((res) => {
  161. const {
  162. frameBuffer
  163. } = res
  164. console.log('frameBuffer.byteLength', frameBuffer.byteLength)
  165. //TODO 调用feed接口传递音频片给驰声评测引擎
  166. this.wsEngine.feed({
  167. data: frameBuffer, // frameBuffer为微信录音机回调的音频数据
  168. success: () => {
  169. // feed 成功
  170. console.log('feed success.')
  171. },
  172. fail: (res) => {
  173. // feed 失败, 请关注res.errId, res.error
  174. console.log('feed fail:', JSON.stringify(res))
  175. },
  176. complete: () => {
  177. // feed 完成
  178. }
  179. });
  180. });
  181. },
  182. ssRecorderCallback: function (type, data) {
  183. console.log('录音测评监控回调', type)
  184. console.log('录音测评监控回调', data)
  185. /* 录音开始 */
  186. if (type === 'onStart') {
  187. this.setData({
  188. btnImgFlag: true,
  189. btnFlag: false
  190. })
  191. console.log('recorder start')
  192. }
  193. if (type === 'onStop') {
  194. this.videoCtx.stop();
  195. this.setData({
  196. recordFlag: 0,
  197. recordSource: data.tempFilePath,
  198. btnFlag: true,
  199. btnImgFlag: false
  200. })
  201. console.log('recorder start')
  202. }
  203. },
  204. // 录音中视频播放结束 (控制录音同时结束)
  205. recordingVideoEnd: function () {
  206. console.log(this.data.videoCtr)
  207. console.log('recordingVideoEnd');
  208. //
  209. if (this.data.recordFlag === 0) {
  210. // this.recordStop();
  211. this.playingVideoEnd();
  212. return;
  213. }
  214. // 录音结束
  215. if (this.data.recordFlag === 1) {
  216. this.recordStop();
  217. }
  218. },
  219. // 播放中视频播放结束 (控制录音同时结束)
  220. playingVideoEnd: function () {
  221. console.log('playingVideoEnd')
  222. // this.ss.stopPlay();
  223. },
  224. /***
  225. * recordFlag:
  226. * 0 初始状态
  227. * 1 录音中
  228. * 2 录音结束
  229. ***/
  230. audioRecord: function () {
  231. console.log('111111111111111recordFlag', this.data.recordFlag)
  232. if (this.recorderManager) {
  233. this.recorderManager.stop();
  234. }
  235. if (this.innerAudioContext) {
  236. this.innerAudioContext.stop();
  237. }
  238. if (this.data.recordFlag === 0) {
  239. this.wsEngine = aiengine.createWsEngine({});
  240. this.wsEngine.onResult(res => {
  241. wx.hideLoading();
  242. this.getRecordScore(res)
  243. })
  244. this.wsEngine.onErrorResult(res => {
  245. wx.hideLoading();
  246. console.log('驰声createWsEngine失败', res);
  247. })
  248. this.videoComplete();
  249. // this.getMicAuth()
  250. return;
  251. }
  252. // 录音结束后
  253. if (this.data.recordFlag === 1) {
  254. wx.showLoading({
  255. title: '作品转码中',
  256. mask: true
  257. })
  258. this.recordStop();
  259. }
  260. },
  261. // 录音开始
  262. /**
  263. * duration: 时长 最长10分钟
  264. sampleRate: 44100, 采样率
  265. numberOfChannels: 1, 录音通道
  266. encodeBitRate: 192000, 码率
  267. format: 'mp3', 格式
  268. frameSize: 50 制定帧大小
  269. */
  270. recordStart: function () {
  271. console.log('录音开始');
  272. const options = {
  273. duration: 600000,
  274. sampleRate: 44100,
  275. numberOfChannels: 1,
  276. encodeBitRate: 192000,
  277. format: 'mp3',
  278. frameSize: 50
  279. }
  280. this.recorderManager.start(options);
  281. // this.ss.startRecord({
  282. // coreType: 'cn.sent.score', //测评题型
  283. // evalTime: 300000, //测评的录音时间,时间到自动停止测评
  284. // refText: this.data.readingText, //测评文本
  285. // warrantId: 'c11163aa6c834a028da4a4b30955be96', //鉴权id
  286. // })
  287. // 驰声测评
  288. let timeStamp = new Date().getTime()
  289. let sig = sha1(`16075689600000da${timeStamp}caa8e60da6042731c230fe431ac9c7fd`)
  290. console.log('加密串', sig)
  291. // return
  292. let app = {
  293. applicationId: '16075689600000da',
  294. sig, //签名字符串 通过签名算法alg(appkey + timestamp + secretKey)生成
  295. alg: 'sha1',
  296. timestamp: timeStamp + '',
  297. userId: wx.getStorageSync('uid')
  298. }
  299. console.log('app数据', app)
  300. let lessonText = this.data.readingText;
  301. console.log('课文课文课文', lessonText)
  302. this.wsEngine.start({
  303. app,
  304. request: {
  305. coreType: "cn.pred.raw",
  306. refText: lessonText,
  307. rank: 100,
  308. attachAudioUrl: 1,
  309. result: {
  310. details: {
  311. gop_adjust: 1
  312. }
  313. }
  314. },
  315. audio: {
  316. audioType: "mp3",
  317. channel: 1,
  318. sampleBytes: 2,
  319. sampleRate: 16000
  320. },
  321. success: (res) => {
  322. // 调用成功
  323. console.log('驰声start成功', res)
  324. },
  325. fail: (res) => {
  326. // start失败,请关注res.errId, res.error
  327. console.log('驰声start失败', res)
  328. }
  329. })
  330. },
  331. getMicAuth() {
  332. let _this = this;
  333. wx.getSetting({
  334. success(res) {
  335. if (res.authSetting['scope.record']) {
  336. _this.videoComplete();
  337. } else {
  338. _this.getMicSetAuth();
  339. return;
  340. }
  341. }
  342. })
  343. },
  344. getMicSetAuth() {
  345. let _this = this;
  346. wx.authorize({
  347. scope: 'scope.record',
  348. success() {
  349. // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
  350. _this.audioRecord();
  351. },
  352. fail() {
  353. wx.showModal({
  354. title: '录音前请打开麦克风权限',
  355. content: '',
  356. confirmText: '我知道了',
  357. showCancel: false,
  358. success(res) {
  359. // console.log('用户点击确定')
  360. wx.openSetting({
  361. success(res) {
  362. console.log('跳转到设置页', res.authSetting)
  363. // res.authSetting = {
  364. // "scope.userInfo": true,
  365. // "scope.userLocation": true
  366. // }
  367. }
  368. })
  369. }
  370. })
  371. }
  372. })
  373. },
  374. // 录音结束
  375. recordStop: function () {
  376. this.setData({
  377. muted: false
  378. })
  379. // this.ss.stopRecord();
  380. console.log('录音结束')
  381. this.recorderManager.stop();
  382. wx.hideLoading()
  383. },
  384. // 获取测评结果
  385. getRecordScore(res) {
  386. console.log('测评结果', JSON.stringify(res))
  387. const result = res.result;
  388. const overall = result.overall; // 总分
  389. const integrity = result.integrity; //完成度
  390. const tone = result.tone; // 语调声调
  391. // const accuracy = result.accuracy; // 准确度 发音分
  392. const accuracy = result.overall; // 准确度 发音分
  393. const fluency = result.fluency.overall; //流利度
  394. let starArray = [];
  395. let myOverall = integrity * 0.5 + accuracy * 0.5 + fluency * 0.1 + tone * 0.1;
  396. // let score = overall / 20;
  397. let score = myOverall / 20;
  398. if (score <= 0) {
  399. starArray = [0, 0, 0, 0, 0]
  400. } else {
  401. for (let i = 1; i < 5; i += 0.9) {
  402. if (i < score) {
  403. starArray.push(1);
  404. } else {
  405. starArray.push(0)
  406. }
  407. }
  408. }
  409. this.setData({
  410. overall,
  411. integrity,
  412. tone,
  413. accuracy,
  414. fluency,
  415. ifScoreDialogShow: true,
  416. star: starArray
  417. })
  418. },
  419. closeScoreDialog() {
  420. this.setData({
  421. ifScoreDialogShow: false,
  422. ifScoreShow: true,
  423. ifTextShow: false
  424. })
  425. },
  426. // 播放录音
  427. audioPlay: function () {
  428. /* 用了先声智能以后录音播放由先声只能接管 */
  429. if (this.innerAudioContext) {
  430. this.innerAudioContext.stop();
  431. this.videoCtx.stop();
  432. }
  433. this.innerAudioContext = wx.createInnerAudioContext();
  434. this.innerAudioContext.src = this.data.recordSource; // 这里可以是录音的临时路径
  435. this.setData({
  436. videoUrl: this.data.videoUrl,
  437. muted: true
  438. })
  439. console.log(this.innerAudioContext.src);
  440. this.videoCtx.play();
  441. this.innerAudioContext.play();
  442. /* if (this.data.audioPath) {
  443. if (this.data.audioPlaying) {
  444. // this.ss.stopPlay();
  445. }
  446. // this.ss.startPlay(this.data.audioPath);
  447. this.videoCtx.stop();
  448. this.videoCtx.play();
  449. } else {
  450. const recordSource = this.data.recordSource
  451. wx.uploadFile({
  452. url: 'https://reader-api.ai160.com/file/upload',
  453. filePath: recordSource,
  454. name: '朗读录音',
  455. header: {
  456. uid: wx.getStorageSync('uid')
  457. },
  458. success: (res) => {
  459. const formateRes = JSON.parse(res.data);
  460. let audioPath = formateRes.data;
  461. this.setData({
  462. audioPath,
  463. audioPlaying: true
  464. })
  465. // this.ss.startPlay(audioPath);
  466. // this.videoCtx.seek(0);
  467. this.videoCtx.stop();
  468. console.log('播放器归0')
  469. this.videoCtx.play();
  470. console.log('播放器播放')
  471. }
  472. })
  473. } */
  474. },
  475. videoComplete: function () {
  476. this.setData({
  477. recordFlag: 1,
  478. videoUrl: this.data.originVideo,
  479. centerBtn: false,
  480. playBtn: false,
  481. isVideoListShow: false,
  482. muted: false,
  483. ifTextShow: true,
  484. ifScoreShow: false
  485. }, () => {
  486. console.log('播放视频播放视频播放视频')
  487. this.videoCtx.play();
  488. this.recordStart();
  489. })
  490. },
  491. // 上传
  492. upload: function () {
  493. if (this.videoCtx) {
  494. this.videoCtx.stop();
  495. }
  496. if (this.data.audioPlaying) {
  497. // this.ss.stopPlay();
  498. this.setData({
  499. audioPlaying: false
  500. })
  501. }
  502. wx.showLoading({
  503. title: '作品上传中',
  504. mask: true
  505. })
  506. const recordSource = this.data.recordSource;
  507. wx.uploadFile({
  508. url: 'https://reader-api.ai160.com/file/upload',
  509. // url: 'https://reader-test.efunbox.cn/file/upload',
  510. filePath: recordSource,
  511. name: '朗读录音',
  512. header: {
  513. uid: wx.getStorageSync('uid')
  514. },
  515. success: (res) => {
  516. const formateRes = JSON.parse(res.data);
  517. let audioPath = formateRes.data;
  518. console.log('音频上传成功')
  519. this.shareWorks(audioPath);
  520. }
  521. })
  522. },
  523. shareWorks: function (audio) {
  524. const data = {
  525. "lessonId": this.data.id,
  526. "originVideo": this.data.videoUrl,
  527. "audioPath": audio,
  528. "title": this.data.title,
  529. "iconImg": this.data.img,
  530. "summary": this.data.summary,
  531. "productId": this.data.productId,
  532. "grade": this.data.grade,
  533. "exampleId": this.data.exampleId,
  534. "coverImg": this.data.coverImg
  535. };
  536. httpRequestApi.postWork(data).success(res => {
  537. wx.hideLoading({
  538. success: () => {
  539. wx.showToast({
  540. title: '作品已上传正在审核中',
  541. icon: 'none',
  542. duration: 1000,
  543. success: () => {
  544. console.log('上传成功', res);
  545. const _data = this.data;
  546. const scoreData = {
  547. "userReadId": res.data.data.id,
  548. "complete": _data.integrity,
  549. "accuracy": _data.accuracy,
  550. "speed": _data.fluency,
  551. "intonation": _data.tone,
  552. "score": _data.overall
  553. }
  554. // 上传评分
  555. httpRequestApi.postWorksScore(scoreData).success(res => {
  556. console.log(res)
  557. });
  558. const pages = getCurrentPages();
  559. const prevPage = pages[pages.length - 2];
  560. prevPage.setData({
  561. // workId: res.data.data.id, // 有id就塞到第一位
  562. fromReading: true
  563. }, () => {
  564. wx.navigateBack({
  565. delta: 1
  566. })
  567. })
  568. }
  569. })
  570. }
  571. });
  572. }).fail(res => {
  573. wx.hideLoading({
  574. success: () => {
  575. wx.showToast({
  576. title: '上传超时',
  577. icon: 'fail',
  578. duration: 1000
  579. })
  580. }
  581. });
  582. })
  583. },
  584. // 获取本课朗读内容
  585. getReadInfo: function (id, pageNo, pageSize) {
  586. // const uid = wx.getStorageSync('uid');
  587. const data = {
  588. exampleId: this.data.id || id,
  589. pageNo: this.data.pageNo,
  590. pageSize: 3,
  591. type: 'READ'
  592. };
  593. httpRequestApi.getClassRead(data).success(res => {
  594. const readInfo = res.data.data.list;
  595. console.log(res)
  596. readInfo.forEach(item => {
  597. const temp = {};
  598. temp.title = item.userRead ? item.userRead.title : '';
  599. temp.img = item.userRead.iconImg;
  600. temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
  601. temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
  602. temp.classId = item.userRead.exampleId;
  603. temp.time = formatDate(item.userRead.gmtCreated, 3);
  604. temp.avatar = item.user ? item.user.avatar : '';
  605. temp.uid = item.user ? item.user.uid : '';
  606. temp.url = item.userRead.videoPath;
  607. // temp.avatar = item.user.avatar;
  608. temp.nickName = item.user ? item.user.wechatName : '';
  609. temp.id = item.userRead.id;
  610. temp.noReading = true;
  611. temp.isFans = item.isFans ? true : item.user.uid === this.uid ? true : false;
  612. temp.coverImg = item.userRead.coverImg;
  613. temp.videoShow = false;
  614. temp.grade = item.userRead.grade;
  615. temp.type = item.userRead.type;
  616. // recommendWorks.push(temp);
  617. // that.data.hotData.hotWorks.push(temp);
  618. this.data.videoList.push(temp);
  619. });
  620. this.setData({
  621. videoList: this.data.videoList,
  622. totalSize: res.data.data.totalSize
  623. })
  624. });
  625. },
  626. // 评论区点击
  627. commentTap: function (e) {
  628. console.log('点击评论区', e)
  629. if (e.target.dataset.type === 'blank') {
  630. this.setData({
  631. commentShow: false
  632. })
  633. }
  634. },
  635. scrollToLower: function (e) {
  636. console.log('滑动到底部', e)
  637. this.setData({
  638. pageNo: this.data.pageNo + 1
  639. }, () => {
  640. this.getReadInfo()
  641. })
  642. },
  643. scrollToUpper: function (e) {
  644. console.log('滑动到顶部', e)
  645. },
  646. // 打开评论
  647. openComment: function (e) {
  648. console.log('id', e.detail.activeId)
  649. this.setData({
  650. commentShow: !this.data.commentShow,
  651. commentId: e.detail.activeId,
  652. });
  653. },
  654. goToReading: function (e) {
  655. this.setData({
  656. pageNo: 1,
  657. videoList: []
  658. })
  659. const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
  660. this.getClassInfo(id)
  661. },
  662. onShareAppMessage: function (res) {
  663. console.log('点击分享按钮', res)
  664. console.log('点击分享按钮', this.data.shareTitle)
  665. console.log('点击分享按钮', this.data.shareId)
  666. console.log('点击分享按钮', this.data.shareImg)
  667. if (res.from === 'button') {
  668. return {
  669. title: '请欣赏我的课文朗读作品,点赞+评论。',
  670. path: `/pages/index/index?readId=${this.data.shareId}`,
  671. imageUrl: '../../static/index/share_icon.png'
  672. }
  673. } else {
  674. return {
  675. title: '课文朗读,从未如此有趣。',
  676. path: '/pages/index/index',
  677. }
  678. }
  679. },
  680. touchMove: function () {
  681. return
  682. },
  683. openShare: function (e) {
  684. console.log('用户点击分享按钮', e)
  685. this.setData({
  686. shareTitle: e.detail.currentTarget.dataset.title,
  687. shareId: e.detail.currentTarget.dataset.id,
  688. shareImg: e.detail.currentTarget.dataset.img
  689. })
  690. },
  691. onPlay: function (e) {
  692. // 下边视频列表onplay
  693. console.log('视频播放视频播放')
  694. if (this.videoCtx) {
  695. this.videoCtx.stop();
  696. } else {
  697. this.videoCtx = wx.createVideoContext('myVideo', this);
  698. this.videoCtx.stop();
  699. }
  700. },
  701. collectTap: function (e) {
  702. console.log('点击收藏', e)
  703. const index = e.detail.index;
  704. let str = `videoList[${index}].isFavorite`
  705. this.setData({
  706. [str]: e.detail.isCollect
  707. })
  708. },
  709. likeTap: function (e) {
  710. console.log('点赞', e)
  711. const index = e.detail.index;
  712. let likeStr = `videoList[${index}].isLike`;
  713. let likeNumStr = `videoList[${index}].likes`;
  714. this.setData({
  715. [likeStr]: true,
  716. [likeNumStr]: this.data.videoList[index].likes + 1
  717. })
  718. },
  719. })