mytrain.js 1.86 KB
"use strict";
const common_vendor = require("../../common/vendor.js");
const myCenter_center_api = require("../center_api.js");
require("../../common/request.js");
require("../../common/login.js");
require("../../config.js");
require("../../common/aes.js");
if (!Array) {
  const _easycom_uni_segmented_control2 = common_vendor.resolveComponent("uni-segmented-control");
  _easycom_uni_segmented_control2();
}
const _easycom_uni_segmented_control = () => "../../uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js";
if (!Math) {
  _easycom_uni_segmented_control();
}
const _sfc_main = {
  __name: "mytrain",
  setup(__props) {
    const app = getApp();
    const items = common_vendor.ref([
      "培训",
      "订单"
    ]);
    const current = common_vendor.ref(0);
    const list = common_vendor.ref([]);
    common_vendor.onShow(() => {
      if (app.globalData.isLogin) {
        init();
      } else {
        app.firstLoadCallback = () => {
          init();
        };
      }
    });
    function init() {
      myCenter_center_api.getMyTrain().then((res) => {
        list.value = res.rows;
      });
    }
    function onClickItem(e) {
      console.log(e);
      if (e.currentIndex == 1) {
        common_vendor.index.navigateTo({
          url: `/myCenter/mytrain/myBill`
        });
      }
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.o(onClickItem),
        b: common_vendor.p({
          current: current.value,
          styleType: "text",
          values: items.value,
          activeColor: "#AD181F"
        }),
        c: list.value.length == 0
      }, list.value.length == 0 ? {} : {});
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/yangyang/ztx_wx_minapp/myCenter/mytrain/mytrain.vue"]]);
wx.createPage(MiniProgramPage);