dialog.js 1.08 KB
import { jumpByUrl } from '../../libs/urlRoute';
import { postFormId } from '../../libs/formIdCollectRequest.js';

import {
  logEvent,
  YB_MAIN_POP_UP_C,
} from '../../libs/analytics.js'

Component({
  options: {
    multipleSlots: true
  },

  properties: {
    src: {
      type: String,
      value: ""
    },
    url: {
      type: String,
      value: ""
    }
  },

  data: {
    isShow: false,
  },

  methods: {
    hideDialog(){
      this.setData({
        isShow: false,
      });
    },
    showDialog(){
      this.setData({
        isShow: true,
      });
    },
    jumpByRule(){
      let that = this;
      if (that.properties.url == null){
        return;
      }
      
      let params = {
        TO_PATH: that.properties.url
      };
      logEvent(YB_MAIN_POP_UP_C, params);
    
      jumpByUrl(that.properties.url,'home');
      that.hideDialog();
    },
    //formId上报
    formSubmit(e) {
      // console.log('----formSubmit---', e);
      let formId = e.detail.formId;
      postFormId(formId,'1');
    }
  }
})