| | |
| | | // pages/bookServices/examination/questionList/index.js |
| | | const innerAudioContext = wx.createInnerAudioContext({ |
| | | useWebAudioImplement: false |
| | | }) |
| | | Component({ |
| | | /** |
| | | * 组件的属性列表 |
| | |
| | | }, |
| | | sliderValue: { |
| | | type: Number, |
| | | }, |
| | | noData: { |
| | | type: Boolean, |
| | | } |
| | | }, |
| | | observers: { |
| | | 'questionList': function (newValue) { |
| | | console.log(newValue); |
| | | observers: {}, |
| | | detached() { |
| | | if (innerAudioContext) { |
| | | innerAudioContext.stop(); |
| | | innerAudioContext.destroy(); |
| | | } |
| | | }, |
| | | created() { |
| | | // console.log('组件传参', this.properties); |
| | | |
| | | }, |
| | | /** |
| | | * 组件的初始数据 |
| | |
| | | duration: 500, |
| | | interval: 5000, |
| | | paginationPosition: 'bottom-right', |
| | | navigation: { type: 'fraction' }, |
| | | navigation: { |
| | | type: 'fraction' |
| | | }, |
| | | showIndex: 0, |
| | | isPlay: false |
| | | }, |
| | | |
| | | /** |
| | | * 组件的方法列表 |
| | | */ |
| | | methods: { |
| | | audioPlay(e) { |
| | | const src = e.currentTarget.dataset.src |
| | | innerAudioContext.src = src |
| | | if (!this.data.isPlay) { |
| | | innerAudioContext.play() |
| | | } else { |
| | | innerAudioContext.pause() |
| | | } |
| | | this.setData({ |
| | | isPlay: !this.data.isPlay |
| | | }) |
| | | }, |
| | | // 切换题目 |
| | | changeSwiper(e) { |
| | | this.setData({ |
| | |
| | | }) |
| | | var myEventDetail = { |
| | | index: e.detail.current |
| | | } // detail对象,提供给事件监听函数 |
| | | } |
| | | var myEventOption = { |
| | | bubbles: true, |
| | | composed: true, |
| | | } // 触发事件的选项 |
| | | } |
| | | this.triggerEvent('changeSwiper', myEventDetail, myEventOption) |
| | | }, |
| | | // 单选 富文本框输入 触发 |
| | |
| | | } // 触发事件的选项 |
| | | this.triggerEvent('onChangeInput', myEventDetail, myEventOption) |
| | | }, |
| | | // 我的错题,收藏查看解析按钮 |
| | | viewParsing() { |
| | | var myEventDetail = {} |
| | | var myEventOption = { |
| | | bubbles: true, |
| | | composed: true, |
| | | } |
| | | this.triggerEvent('viewParsing', myEventDetail, myEventOption) |
| | | } |
| | | } |
| | | }) |
| | | }) |