爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
3.9 KiB

  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const pages_mixins_pullRefreshMixin = require("../mixins/pullRefreshMixin.js");
  4. const _sfc_main = {
  5. mixins: [pages_mixins_pullRefreshMixin.pullRefreshMixin],
  6. data() {
  7. return {
  8. staffList: [
  9. { name: "冯启彬", role: "质检员" },
  10. { name: "周琪", role: "质检员" },
  11. { name: "王凡玄", role: "质检员" },
  12. { name: "李世海", role: "质检员" },
  13. { name: "李娅", role: "质检员" },
  14. { name: "郑婷雅", role: "质检员" },
  15. { name: "冯思钰", role: "质检员" }
  16. ],
  17. statusBarHeight: 0,
  18. navBarRealHeight: 0,
  19. refreshing: false
  20. };
  21. },
  22. computed: {
  23. navbarStyle() {
  24. return `padding-top: ${this.statusBarHeight}px;`;
  25. }
  26. },
  27. onLoad() {
  28. common_vendor.index.getSystemInfo({
  29. success: (res) => {
  30. this.statusBarHeight = res.statusBarHeight || 20;
  31. }
  32. });
  33. this.$nextTick(() => {
  34. common_vendor.index.createSelectorQuery().select(".navbar").boundingClientRect((rect) => {
  35. if (rect) {
  36. this.navBarRealHeight = rect.height;
  37. }
  38. }).exec();
  39. });
  40. this.fetchStaffList();
  41. common_vendor.index.$on("refreshStaffList", this.fetchStaffList);
  42. },
  43. onUnload() {
  44. common_vendor.index.$off("refreshStaffList", this.fetchStaffList);
  45. },
  46. methods: {
  47. goBack() {
  48. common_vendor.index.navigateBack();
  49. },
  50. goStaffDetail(staff) {
  51. common_vendor.index.navigateTo({
  52. url: "/pages/manager/staff-detail",
  53. success: (res) => {
  54. res.eventChannel.emit("staffDetail", staff);
  55. }
  56. });
  57. },
  58. refreshData() {
  59. },
  60. async onRefresh() {
  61. await this.refreshData && this.refreshData();
  62. },
  63. async fetchStaffList() {
  64. try {
  65. const res = await this.$api("getMyTeamList", { pageSize: 1e3, current: 1 });
  66. if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
  67. this.staffList = res.result.records.filter((user) => user.role == 1 || user.role == 0 || user.role == 2).map((user) => ({
  68. id: user.id,
  69. name: user.nickName || "-",
  70. role: user.role == 1 ? "质检员" : user.role == 2 ? "管理员" : "用户"
  71. }));
  72. }
  73. } catch (e) {
  74. common_vendor.index.showToast({ title: "获取员工列表失败", icon: "none" });
  75. }
  76. }
  77. },
  78. onPullDownRefresh() {
  79. this.refreshing = true;
  80. Promise.resolve(this.fetchStaffList()).finally(() => {
  81. this.refreshing = false;
  82. common_vendor.index.stopPullDownRefresh();
  83. });
  84. }
  85. };
  86. if (!Array) {
  87. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  88. _easycom_uni_icons2();
  89. }
  90. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  91. if (!Math) {
  92. _easycom_uni_icons();
  93. }
  94. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  95. return common_vendor.e({
  96. a: $data.refreshing
  97. }, $data.refreshing ? {
  98. b: common_vendor.p({
  99. type: "loading",
  100. size: "22",
  101. color: "#ffb400"
  102. })
  103. } : {}, {
  104. c: common_vendor.p({
  105. type: "back",
  106. size: "24",
  107. color: "#222"
  108. }),
  109. d: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
  110. e: common_vendor.s($options.navbarStyle),
  111. f: common_vendor.f($data.staffList, (staff, idx, i0) => {
  112. return {
  113. a: common_vendor.t(staff.name),
  114. b: common_vendor.t(staff.role),
  115. c: idx,
  116. d: common_vendor.o(($event) => $options.goStaffDetail(staff), idx)
  117. };
  118. }),
  119. g: $data.navBarRealHeight + "px"
  120. });
  121. }
  122. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9b5c981c"]]);
  123. wx.createPage(MiniProgramPage);
  124. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/manager/staff.js.map