reading.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  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 score = overall / 20;
  396. if (score <= 0) {
  397. starArray = [0, 0, 0, 0, 0]
  398. } else {
  399. for (let i = 1; i < 5; i += 0.9) {
  400. if (i < score) {
  401. starArray.push(1);
  402. } else {
  403. starArray.push(0)
  404. }
  405. }
  406. }
  407. this.setData({
  408. overall,
  409. integrity,
  410. tone,
  411. accuracy,
  412. fluency,
  413. ifScoreDialogShow: true,
  414. star: starArray
  415. })
  416. },
  417. closeScoreDialog() {
  418. this.setData({
  419. ifScoreDialogShow: false,
  420. ifScoreShow: true,
  421. ifTextShow: false
  422. })
  423. },
  424. // 播放录音
  425. audioPlay: function () {
  426. /* 用了先声智能以后录音播放由先声只能接管 */
  427. if (this.innerAudioContext) {
  428. this.innerAudioContext.stop();
  429. this.videoCtx.stop();
  430. }
  431. this.innerAudioContext = wx.createInnerAudioContext();
  432. this.innerAudioContext.src = this.data.recordSource; // 这里可以是录音的临时路径
  433. this.setData({
  434. videoUrl: this.data.videoUrl,
  435. muted: true
  436. })
  437. console.log(this.innerAudioContext.src);
  438. this.videoCtx.play();
  439. this.innerAudioContext.play();
  440. /* if (this.data.audioPath) {
  441. if (this.data.audioPlaying) {
  442. // this.ss.stopPlay();
  443. }
  444. // this.ss.startPlay(this.data.audioPath);
  445. this.videoCtx.stop();
  446. this.videoCtx.play();
  447. } else {
  448. const recordSource = this.data.recordSource
  449. wx.uploadFile({
  450. url: 'https://reader-api.ai160.com/file/upload',
  451. filePath: recordSource,
  452. name: '朗读录音',
  453. header: {
  454. uid: wx.getStorageSync('uid')
  455. },
  456. success: (res) => {
  457. const formateRes = JSON.parse(res.data);
  458. let audioPath = formateRes.data;
  459. this.setData({
  460. audioPath,
  461. audioPlaying: true
  462. })
  463. // this.ss.startPlay(audioPath);
  464. // this.videoCtx.seek(0);
  465. this.videoCtx.stop();
  466. console.log('播放器归0')
  467. this.videoCtx.play();
  468. console.log('播放器播放')
  469. }
  470. })
  471. } */
  472. },
  473. videoComplete: function () {
  474. this.setData({
  475. recordFlag: 1,
  476. videoUrl: this.data.originVideo,
  477. centerBtn: false,
  478. playBtn: false,
  479. isVideoListShow: false,
  480. muted: false,
  481. ifTextShow: true,
  482. ifScoreShow: false
  483. }, () => {
  484. console.log('播放视频播放视频播放视频')
  485. this.videoCtx.play();
  486. this.recordStart();
  487. })
  488. },
  489. // 上传
  490. upload: function () {
  491. if (this.videoCtx) {
  492. this.videoCtx.stop();
  493. }
  494. if (this.data.audioPlaying) {
  495. // this.ss.stopPlay();
  496. this.setData({
  497. audioPlaying: false
  498. })
  499. }
  500. wx.showLoading({
  501. title: '作品上传中',
  502. mask: true
  503. })
  504. const recordSource = this.data.recordSource;
  505. wx.uploadFile({
  506. url: 'https://reader-api.ai160.com/file/upload',
  507. // url: 'https://reader-test.efunbox.cn/file/upload',
  508. filePath: recordSource,
  509. name: '朗读录音',
  510. header: {
  511. uid: wx.getStorageSync('uid')
  512. },
  513. success: (res) => {
  514. const formateRes = JSON.parse(res.data);
  515. let audioPath = formateRes.data;
  516. console.log('音频上传成功')
  517. this.shareWorks(audioPath);
  518. }
  519. })
  520. },
  521. shareWorks: function (audio) {
  522. const data = {
  523. "lessonId": this.data.id,
  524. "originVideo": this.data.videoUrl,
  525. "audioPath": audio,
  526. "title": this.data.title,
  527. "iconImg": this.data.img,
  528. "summary": this.data.summary,
  529. "productId": this.data.productId,
  530. "grade": this.data.grade,
  531. "exampleId": this.data.exampleId,
  532. "coverImg": this.data.coverImg
  533. };
  534. httpRequestApi.postWork(data).success(res => {
  535. wx.hideLoading({
  536. success: () => {
  537. wx.showToast({
  538. title: '作品已上传正在审核中',
  539. icon: 'none',
  540. duration: 1000,
  541. success: () => {
  542. console.log('上传成功', res);
  543. const _data = this.data;
  544. const scoreData = {
  545. "userReadId": res.data.data.id,
  546. "complete": _data.integrity,
  547. "accuracy": _data.accuracy,
  548. "speed": _data.fluency,
  549. "intonation": _data.tone,
  550. "score": _data.overall
  551. }
  552. // 上传评分
  553. httpRequestApi.postWorksScore(scoreData).success(res => {
  554. console.log(res)
  555. });
  556. const pages = getCurrentPages();
  557. const prevPage = pages[pages.length - 2];
  558. prevPage.setData({
  559. // workId: res.data.data.id, // 有id就塞到第一位
  560. fromReading: true
  561. }, () => {
  562. wx.navigateBack({
  563. delta: 1
  564. })
  565. })
  566. }
  567. })
  568. }
  569. });
  570. }).fail(res => {
  571. wx.hideLoading({
  572. success: () => {
  573. wx.showToast({
  574. title: '上传超时',
  575. icon: 'fail',
  576. duration: 1000
  577. })
  578. }
  579. });
  580. })
  581. },
  582. // 获取本课朗读内容
  583. getReadInfo: function (id, pageNo, pageSize) {
  584. // const uid = wx.getStorageSync('uid');
  585. const data = {
  586. exampleId: this.data.id || id,
  587. pageNo: this.data.pageNo,
  588. pageSize: 3,
  589. type: 'READ'
  590. };
  591. httpRequestApi.getClassRead(data).success(res => {
  592. const readInfo = res.data.data.list;
  593. console.log(res)
  594. readInfo.forEach(item => {
  595. const temp = {};
  596. temp.title = item.userRead ? item.userRead.title : '';
  597. temp.img = item.userRead.iconImg;
  598. temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
  599. temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
  600. temp.classId = item.userRead.exampleId;
  601. temp.time = formatDate(item.userRead.gmtCreated, 3);
  602. temp.avatar = item.user ? item.user.avatar : '';
  603. temp.uid = item.user ? item.user.uid : '';
  604. temp.url = item.userRead.videoPath;
  605. // temp.avatar = item.user.avatar;
  606. temp.nickName = item.user ? item.user.wechatName : '';
  607. temp.id = item.userRead.id;
  608. temp.noReading = true;
  609. temp.isFans = item.isFans ? true : item.user.uid === this.uid ? true : false;
  610. temp.coverImg = item.userRead.coverImg;
  611. temp.videoShow = false;
  612. temp.grade = item.userRead.grade;
  613. temp.type = item.userRead.type;
  614. // recommendWorks.push(temp);
  615. // that.data.hotData.hotWorks.push(temp);
  616. this.data.videoList.push(temp);
  617. });
  618. this.setData({
  619. videoList: this.data.videoList,
  620. totalSize: res.data.data.totalSize
  621. })
  622. });
  623. },
  624. // 评论区点击
  625. commentTap: function (e) {
  626. console.log('点击评论区', e)
  627. if (e.target.dataset.type === 'blank') {
  628. this.setData({
  629. commentShow: false
  630. })
  631. }
  632. },
  633. scrollToLower: function (e) {
  634. console.log('滑动到底部', e)
  635. this.setData({
  636. pageNo: this.data.pageNo + 1
  637. }, () => {
  638. this.getReadInfo()
  639. })
  640. },
  641. scrollToUpper: function (e) {
  642. console.log('滑动到顶部', e)
  643. },
  644. // 打开评论
  645. openComment: function (e) {
  646. console.log('id', e.detail.activeId)
  647. this.setData({
  648. commentShow: !this.data.commentShow,
  649. commentId: e.detail.activeId,
  650. });
  651. },
  652. goToReading: function (e) {
  653. this.setData({
  654. pageNo: 1,
  655. videoList: []
  656. })
  657. const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
  658. this.getClassInfo(id)
  659. },
  660. onShareAppMessage: function (res) {
  661. console.log('点击分享按钮', res)
  662. console.log('点击分享按钮', this.data.shareTitle)
  663. console.log('点击分享按钮', this.data.shareId)
  664. console.log('点击分享按钮', this.data.shareImg)
  665. if (res.from === 'button') {
  666. return {
  667. title: '请欣赏我的课文朗读作品,点赞+评论。',
  668. path: `/pages/index/index?readId=${this.data.shareId}`,
  669. imageUrl: '../../static/index/share_icon.png'
  670. }
  671. } else {
  672. return {
  673. title: '课文朗读,从未如此有趣。',
  674. path: '/pages/index/index',
  675. }
  676. }
  677. },
  678. touchMove: function () {
  679. return
  680. },
  681. openShare: function (e) {
  682. console.log('用户点击分享按钮', e)
  683. this.setData({
  684. shareTitle: e.detail.currentTarget.dataset.title,
  685. shareId: e.detail.currentTarget.dataset.id,
  686. shareImg: e.detail.currentTarget.dataset.img
  687. })
  688. },
  689. onPlay: function (e) {
  690. // 下边视频列表onplay
  691. console.log('视频播放视频播放')
  692. if (this.videoCtx) {
  693. this.videoCtx.stop();
  694. } else {
  695. this.videoCtx = wx.createVideoContext('myVideo', this);
  696. this.videoCtx.stop();
  697. }
  698. },
  699. collectTap: function (e) {
  700. console.log('点击收藏', e)
  701. const index = e.detail.index;
  702. let str = `videoList[${index}].isFavorite`
  703. this.setData({
  704. [str]: e.detail.isCollect
  705. })
  706. },
  707. likeTap: function (e) {
  708. console.log('点赞', e)
  709. const index = e.detail.index;
  710. let likeStr = `videoList[${index}].isLike`;
  711. let likeNumStr = `videoList[${index}].likes`;
  712. this.setData({
  713. [likeStr]: true,
  714. [likeNumStr]: this.data.videoList[index].likes + 1
  715. })
  716. },
  717. })