mycenter.js 3.45 KB
"use strict";
const common_vendor = require("../../common/vendor.js");
require("../../common/api.js");
const common_match = require("../../common/match.js");
require("../../common/login.js");
require("../../common/request.js");
require("../../config.js");
if (!Array) {
  const _easycom_uni_list_item2 = common_vendor.resolveComponent("uni-list-item");
  const _easycom_uni_list2 = common_vendor.resolveComponent("uni-list");
  (_easycom_uni_list_item2 + _easycom_uni_list2)();
}
const _easycom_uni_list_item = () => "../../uni_modules/uni-list/components/uni-list-item/uni-list-item.js";
const _easycom_uni_list = () => "../../uni_modules/uni-list/components/uni-list/uni-list.js";
if (!Math) {
  (_easycom_uni_list_item + _easycom_uni_list)();
}
const _sfc_main = {
  __name: "mycenter",
  setup(__props) {
    common_vendor.ref("/static/v1.png");
    common_vendor.ref({});
    common_vendor.ref({});
    const user = common_vendor.ref({});
    common_vendor.ref("");
    const avatarUrl = common_vendor.ref("");
    common_vendor.ref("");
    common_vendor.ref("");
    common_vendor.ref(null);
    common_vendor.ref(false);
    common_vendor.ref(true);
    const app = getApp();
    common_vendor.ref(false);
    common_vendor.onShow(() => {
      if (app.globalData.isLogin) {
        init();
      } else {
        app.firstLoadCallback = () => {
          init();
        };
      }
    });
    function init() {
      const currUser = common_vendor.index.getStorageSync("currUser");
      user.value = currUser;
      avatarUrl.value = user.value.avatar;
    }
    function onChooseavatar(e) {
      common_match.uploadFile(e).then((data) => {
        avatarUrl.value = data.data;
        common_match.updateAvatar({ avatarUrl: avatarUrl.value }).then((res) => {
          common_vendor.index.showToast({
            title: "头像保存成功",
            icon: "none",
            duration: 2e3
          });
          common_vendor.index.setStorageSync("currUser", res.data);
        });
      });
    }
    function goBills() {
      let path = "/pages_hotel/hotel/myBills";
      common_vendor.index.navigateTo({
        url: path
      });
    }
    function goMyInvoiceBill() {
      let path = "/pages_hotel/hotel/myInvoice";
      common_vendor.index.navigateTo({
        url: path
      });
    }
    function goAboutUs() {
      let path = "/pages_hotel/hotel/aboutUs";
      common_vendor.index.navigateTo({
        url: path
      });
    }
    return (_ctx, _cache) => {
      return {
        a: avatarUrl.value,
        b: common_vendor.o(onChooseavatar),
        c: common_vendor.t(user.value.nickName),
        d: common_vendor.o(goBills),
        e: common_vendor.p({
          border: false,
          title: "我的订单",
          showArrow: true,
          clickable: "true"
        }),
        f: common_vendor.o(goMyInvoiceBill),
        g: common_vendor.p({
          border: false,
          title: "我的发票",
          showArrow: true,
          clickable: "true"
        }),
        h: common_vendor.o(goAboutUs),
        i: common_vendor.p({
          border: false,
          title: "关于赛事助手",
          showArrow: true,
          clickable: "true"
        }),
        j: common_vendor.p({
          border: false
        })
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-fa9c8f88"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages_hotel/hotel/mycenter.vue"]]);
wx.createPage(MiniProgramPage);