"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_api = require("../../utils/api.js");
const utils_des = require("../../utils/des.js");
if (!Math) {
  (headerInput + listView)();
}
const headerInput = () => "../../components/headerInput.js";
const listView = () => "../../components/listView.js";
const _sfc_main = {
  __name: "grade",
  setup(__props) {
    const list = common_vendor.ref([]);
    const gradeName = common_vendor.ref("");
    const className = common_vendor.ref("");
    const appType = common_vendor.ref("");
    common_vendor.onLoad((options) => {
      appType.value = options.type || "";
      getData();
    });
    const changeInputValue = (value) => {
      if (value.trim()) {
        let temList = [];
        list.value.forEach((ele) => {
          if (ele.name.indexOf(value.trim()) != -1) {
            temList.push(ele);
          }
        });
        list.value = temList;
      } else {
        getData();
      }
    };
    const getData = async () => {
      const res = await utils_api.myRequest({
        url: "/wanzai/api/wechat/queryPhoneBook",
        data: {
          id: common_vendor.index.getStorageSync("userInfo").id
        }
      });
      const result = JSON.parse(utils_des.decryptDes(res.data));
      result.forEach((ele) => {
        let temlist;
        ele.classBookList.forEach((item, index, arr) => {
          if (item.bookUserList.length) {
            list.value = item.bookUserList;
            className.value = arr[index].className;
            temlist = arr;
          }
        });
        if (ele.classBookList == temlist) {
          gradeName.value = ele.gradeName;
        }
      });
      common_vendor.index.setNavigationBarTitle({
        title: gradeName.value + className.value
      });
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.o(changeInputValue),
        b: common_vendor.t(gradeName.value),
        c: common_vendor.t(className.value),
        d: common_vendor.p({
          list: list.value,
          appType: appType.value
        })
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7d1a7ab2"], ["__file", "E:/workSpace/WanZai_School_app/pages/grade/grade.vue"]]);
wx.createPage(MiniProgramPage);
