index.js 1.11 KB
// tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js
import { CLOSE_ICON_URL } from '../../utils/imageBase.js'
Component({
  externalClasses: ["custom-class"],
  options: {
    styleIsolation: 'apply-shared',
  },
  /**
   * 组件的属性列表
   */
  properties: {
    tipsProps: {
      type: Object
    },
    tipsText: String,
    beforeClick: String
  },

  /**
   * 组件的初始数据
   */
  data: {
    IMG_URL: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/',
    defaultCloseIconUrl: CLOSE_ICON_URL
  },

  /**
   * 组件的方法列表
   */
  methods: {
    async tapCallback(e) {
      let {
        beforeClick
      } = this.data
      if (beforeClick && await wx.$globalDataFunction[beforeClick]()) return
      let tipsProps = this.properties
      let {
        type
      } = e.target.dataset
      let thisPage = wx.$router.getPageInstance()
      if (type == 1) {
        tipsProps.showTips = false
        this.setData({
          tipsProps: false
        })
        this.triggerEvent('closeTips')
      } else {
        thisPage.tipsEvent()
      }
    },
  }
})