import { scenicInfo } from '../../../services';
Component({
  mixins: [],
  data: {
    senicInfos: {},
    scenicId: ''
  },
  props: {},

  didMount() {
    // 组件获取当前页面的参数信息
    const query = getCurrentPages().pop().options || {};
    this.setData({
      scenicId: query.recordId || ''
    }, () => this.getSenicInfo());
  },

  didUpdate() {},

  didUnmount() {},

  methods: {
    // 查询数据接口
    async getSenicInfo() {
      const {
        scenicId
      } = this.data;
      const data = {
        scenicId
      };
      const [err, result] = await scenicInfo(data);

      if (result) {
        this.setData({
          senicInfos: result || {}
        });
      }

      if (err) {
        return my.showToast({
          type: 'fail',
          content: err.msg
        });
      }
    }

  }
});