"use strict";
const common_vendor = require("../../../common/vendor.js");
const common_js_net_projectApi = require("../../../common/js/net/projectApi.js");
const _sfc_main = {
  data() {
    return {
      msgType: "info",
      msgTxt: "",
      content: "",
      title: "",
      id: "",
      isNeedToken: false
    };
  },
  onLoad(options) {
    this.id = options.id;
    this.isNeedToken = options.needToken;
    common_vendor.index.setNavigationBarColor({
      frontColor: "#000000",
      // 必写项，字体颜色仅支持#ffffff和#000000
      backgroundColor: "#F0F0F0",
      // 传递的颜色值，仅支持十六进制颜色
      animation: {
        // 可选项
        duration: 500,
        timingFunc: "easeIn"
      }
    });
    common_vendor.index.__f__("log", "at pages/common/rule/rule.vue:35", this.isNeedToken);
    if (this.isNeedToken) {
      this.getDealByToken();
    } else {
      this.getDeal();
    }
  },
  methods: {
    //获取协议内容
    getDeal() {
      var _self = this;
      common_vendor.index.showLoading({
        title: "加载中..."
      });
      common_js_net_projectApi.ProApi.doGetRuleDate(_self.id).then((res) => {
        common_vendor.index.hideLoading();
        if (res && res.content && res.content != "") {
          common_vendor.index.setNavigationBarTitle({
            title: res.title
          });
          _self.title = res.title;
          _self.content = res.content;
        } else {
          _self.msgType = "error";
          _self.msgTxt = "很遗憾，当前服务器返回的数据有误，辛苦您过会儿再尝试。";
          _self.$refs.msg.open();
          setTimeout(() => {
            common_vendor.index.navigateBack();
          }, 1500);
        }
      }).catch((err) => {
        common_vendor.index.hideLoading();
        common_vendor.index.__f__("log", "at pages/common/rule/rule.vue:69", err);
        _self.msgType = "error";
        _self.msgTxt = "很遗憾，当前服务器返回的数据有误，辛苦您过会儿再尝试。";
        _self.$refs.msg.open();
        setTimeout(() => {
          common_vendor.index.navigateBack();
        }, 1500);
      });
    },
    // 根据token获取
    getDealByToken() {
      var _self = this;
      common_vendor.index.showLoading({
        title: "加载中..."
      });
      common_js_net_projectApi.ProApi.doGetDealDetail(_self.id).then((res) => {
        common_vendor.index.hideLoading();
        if (res && res.content && res.content != "") {
          common_vendor.index.setNavigationBarTitle({
            title: res.title
          });
          _self.title = res.title;
          _self.content = res.content;
        } else {
          _self.msgType = "error";
          _self.msgTxt = "很遗憾，当前服务器返回的数据有误，辛苦您过会儿再尝试。";
          _self.$refs.msg.open();
          setTimeout(() => {
            common_vendor.index.navigateBack();
          }, 1500);
        }
      }).catch((err) => {
        common_vendor.index.hideLoading();
        common_vendor.index.__f__("log", "at pages/common/rule/rule.vue:104", err);
        _self.msgType = "error";
        _self.msgTxt = "很遗憾，当前服务器返回的数据有误，辛苦您过会儿再尝试。";
        _self.$refs.msg.open();
        setTimeout(() => {
          common_vendor.index.navigateBack();
        }, 1500);
      });
    }
  }
};
if (!Array) {
  const _easycom_uni_popup_message2 = common_vendor.resolveComponent("uni-popup-message");
  const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
  (_easycom_uni_popup_message2 + _easycom_uni_popup2)();
}
const _easycom_uni_popup_message = () => "../../../uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.js";
const _easycom_uni_popup = () => "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
if (!Math) {
  (_easycom_uni_popup_message + _easycom_uni_popup)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return {
    a: common_vendor.t($data.title),
    b: $data.content,
    c: common_vendor.p({
      type: $data.msgType,
      message: $data.msgTxt,
      duration: 2e3
    }),
    d: common_vendor.sr("msg", "75bcae24-0"),
    e: common_vendor.p({
      type: "message"
    })
  };
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
swan.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-baidu/pages/common/rule/rule.js.map
