"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
  const _easycom_u_avatar2 = common_vendor.resolveComponent("u-avatar");
  _easycom_u_avatar2();
}
const _easycom_u_avatar = () => "../../node-modules/uview-plus/components/u-avatar/u-avatar.js";
if (!Math) {
  _easycom_u_avatar();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    var _a, _b, _c;
    (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
    (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
    (_c = common_vendor.getCurrentInstance()) == null ? void 0 : _c.appContext.config.globalProperties.$apifile;
    common_vendor.computed(() => {
      return common_vendor.index.getStorageSync("openid");
    });
    const config = common_vendor.ref({ logoUrl: "" });
    const form = common_vendor.ref({ icon: "", city: "", sex: "", nickname: "", phone: "" });
    const sexList = common_vendor.ref([]);
    common_vendor.onLoad(async () => {
      await searchOther();
      await searchConfig();
      await search();
      common_vendor.index.$on("setCity", function(city) {
        form.value.city = city;
      });
    });
    const searchOther = async () => {
    };
    const searchConfig = async () => {
      config.value = common_vendor.index.getStorageSync("config");
    };
    const search = async () => {
    };
    const sexChange = (e) => {
      const data = sexList.value[e.detail.value];
      if (data)
        form.value.sex = data.dictLabel;
    };
    const Preview = () => {
      common_vendor.index.chooseImage({
        count: 1,
        sizeType: ["original", "compressed"],
        sourceType: ["album", "camera"],
        success: async function(res) {
          let tempFile = JSON.parse(JSON.stringify(res.tempFilePaths));
          console.log(tempFile);
        }
      });
    };
    const formSubmit = async (e) => {
      let data = e.detail.value;
      data.icon = form.value.icon;
      data = delEmptyQueryNodes(data);
      console.log(data);
    };
    const delEmptyQueryNodes = (obj = {}) => {
      Object.keys(obj).forEach((key) => {
        let value = obj[key];
        value && typeof value === "object" && delEmptyQueryNodes(value);
        (value === "" || value === null || value === void 0 || value.length === 0 || Object.keys(value).length === 0) && delete obj[key];
      });
      return obj;
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: form.value.id,
        b: form.value.icon
      }, form.value.icon ? {
        c: form.value.icon,
        d: common_vendor.o(Preview)
      } : {
        e: common_vendor.p({
          text: "车",
          fontSize: "20",
          randomBgColor: true,
          colorIndex: 0
        })
      }, {
        f: form.value.name,
        g: form.value.nickname,
        h: common_vendor.t(form.value.sex || "请选择性别"),
        i: common_vendor.o(sexChange),
        j: _ctx.index,
        k: sexList.value,
        l: form.value.phone,
        m: common_vendor.o(formSubmit)
      });
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bf1a7b85"], ["__file", "D:/project/赋强公证/notarization_applet/pagesMy/basic/index.vue"]]);
wx.createPage(MiniProgramPage);
