litian
2024-03-15 3f1ea0a8e4bb02bf7544df8660b15cfa69d6b84a
pages/bookServices/examination/questionList/index.js
@@ -1,14 +1,4 @@
// pages/bookServices/examination/questionList/index.js
const imageCdn = 'https://tdesign.gtimg.com/mobile/demos';
const swiperList = [
  `${imageCdn}/swiper1.png`,
  `${imageCdn}/swiper2.png`,
  `${imageCdn}/swiper1.png`,
  `${imageCdn}/swiper2.png`,
  `${imageCdn}/swiper1.png`,
];
Component({
  /**
   * 组件的属性列表
@@ -17,28 +7,85 @@
    questionList: {
      type: Array,
      value: []
    },
    submitStatus: {
      type: Boolean,
      value: false
    },
    currentIndex: {
      type: Number,
      value: 1
    }
  },
  created() {
    console.log('组件传参', this.properties);
    // console.log('组件传参', this.properties);
  },
  /**
   * 组件的初始数据
   */
  data: {
    inputstyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx;',
    placeholderstyle: "font-size:28rpx",
    current: 2,
    autoplay: true,
    duration: 500,
    interval: 5000,
    paginationPosition: 'bottom-right',
    swiperList,
    navigation: { type: 'fraction' },
    showIndex: 0,
  },
  /**
   * 组件的方法列表
   */
  methods: {
    // 切换题目
    changeSwiper(e) {
      console.log(e);
      this.setData({
        showIndex: e.detail.current
      })
      var myEventDetail = {
        index: e.detail.current
      } // detail对象,提供给事件监听函数
      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)
    },
  }
})