"use strict";
const common_vendor = require("../../common/vendor.js");
require("../../common/libraries/request.js");
require("../../common/store/useWatermarkStore.js");
const common_store_useWeAppAuthStore = require("../../common/store/useWeAppAuthStore.js");
require("../../common/store/useWorkStore.js");
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
const pages_me_model = require("./model.js");
const gen_Apis = require("../../gen/Apis.js");
const common_libraries_userUserLogin = require("../../common/libraries/userUserLogin.js");
const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
const previewPdf = () => {
  common_vendor.index.showLoading({
    title: "加载中...",
    mask: true
  });
  common_vendor.index.downloadFile({
    url: "https://pay-test-1369486729.cos.ap-guangzhou.myqcloud.com/uploads/cs-test/01K44N5AP6T246WQWHNB2ERQ9M.pdf",
    success: function(e) {
      const filePath = e.tempFilePath;
      common_vendor.index.hideLoading();
      common_vendor.index.openDocument({
        filePath,
        showMenu: true
      });
    }
  });
};
const method = {
  init() {
    var _a;
    pages_me_model.useModel.userData.value = ((_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.user) || void 0;
  },
  getCountGridHouse() {
    common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Grid.Grids.CountGridHouse, {}).then((res) => {
      pages_me_model.useModel.gridHouseData.value = res.data;
      console.log(res);
    });
  },
  handleJinGang(e) {
    var _a;
    if (e == null ? void 0 : e.url) {
      common_vendor.index.navigateTo({
        url: !((_a = common_libraries_userUserLogin.getUser) == null ? void 0 : _a.getLoginStatus()) ? "/pages/login" : (e == null ? void 0 : e.url) || ""
      });
      return;
    }
    if ((e == null ? void 0 : e.icon) === "Permission") {
      common_vendor.index.openSetting();
    }
    if ((e == null ? void 0 : e.icon) === "Feedback") {
      previewPdf();
    }
    console.log(e, "e");
  }
};
exports.method = method;
