闫增涛
2024-04-15 e90c18770dfccded106c395c05dbc88d8fd99040
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// pages/bookServices/examination/questionList/index.js
const innerAudioContext = wx.createInnerAudioContext({
  useWebAudioImplement: false
})
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    questionList: {
      type: Array,
      value: []
    },
    submitStatus: {
      type: Boolean,
      value: false
    },
    currentIndex: {
      type: Number,
      value: 1
    },
    isNight: {
      type: Boolean,
      value: false
    },
    answerType: {
      type: String,
      value: ''
    },
    sliderValue: {
      type: Number,
    },
    noData: {
      type: Boolean,
    }
  },
  observers: {},
  ready() {
    innerAudioContext.stop();
    innerAudioContext.destroy();
  },
  /**
   * 组件的初始数据
   */
  data: {
    inputstyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx;',
    shortAnswer: 'font-size: 28rpx',
    placeholderstyle: "font-size:28rpx",
    current: 2,
    autoplay: true,
    duration: 500,
    interval: 5000,
    paginationPosition: 'bottom-right',
    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({
        showIndex: e.detail.current
      })
      var myEventDetail = {
        index: e.detail.current
      }
      var myEventOption = {
        bubbles: true,
        composed: true,
      }
      this.triggerEvent('changeSwiper', myEventDetail, myEventOption)
    },
    // 单选  富文本框输入  触发
    onChangeRadio(e) {
      var myEventDetail = {
        value: e
      } // detail对象,提供给事件监听函数
      var myEventOption = {
        bubbles: true,
        composed: true,
      } // 触发事件的选项
      this.triggerEvent('onChangeRadio', myEventDetail, myEventOption)
    },
    // 多选触发
    onChangeCheck(e) {
      var myEventDetail = {
        value: e
      } // detail对象,提供给事件监听函数
      var myEventOption = {
        bubbles: true,
        composed: true,
      } // 触发事件的选项
      this.triggerEvent('onChangeRadio', myEventDetail, myEventOption)
    },
    // 输入框触发
    onChangeInput(e) {
      var myEventDetail = {
        value: e
      } // detail对象,提供给事件监听函数
      var myEventOption = {
        bubbles: true,
        composed: true,
      } // 触发事件的选项
      this.triggerEvent('onChangeInput', myEventDetail, myEventOption)
    },
    // 我的错题,收藏查看解析按钮
    viewParsing() {
      var myEventDetail = {}
      var myEventOption = {
        bubbles: true,
        composed: true,
      }
      this.triggerEvent('viewParsing', myEventDetail, myEventOption)
    }
  }
})