system.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. const common_vendor = require("../common/vendor.js");
  3. const services_ams = require("../services/ams.js");
  4. const getNavTop = () => {
  5. let windowWidth = common_vendor.wx$1.getSystemInfoSync().windowWidth;
  6. const statusBarHeight = common_vendor.wx$1.getSystemInfoSync().statusBarHeight;
  7. const menuButton = common_vendor.wx$1.getMenuButtonBoundingClientRect();
  8. (menuButton.height + (menuButton.top - statusBarHeight) * 2) * (750 / windowWidth);
  9. const navTop = statusBarHeight * (750 / windowWidth);
  10. return navTop;
  11. };
  12. const getActivityData = () => {
  13. const appid = common_vendor.index.getStorageSync("appid");
  14. let isAuth = false;
  15. services_ams.getActivity(appid).then((res) => {
  16. const data = res.data[0] || {};
  17. common_vendor.index.setStorageSync("activityData", JSON.stringify(data));
  18. }).catch((err) => {
  19. console.log(err);
  20. });
  21. return isAuth;
  22. };
  23. const getMobile = (code) => {
  24. services_ams.getPhoneNumberInfo(code).then((res) => {
  25. common_vendor.index.setStorageSync("phone", res.data);
  26. });
  27. };
  28. const isGetPhone = () => {
  29. const data = JSON.parse(common_vendor.index.getStorageSync("activityData")) || {};
  30. const authCheck = (data == null ? void 0 : data.authCheck.split(",")) || [];
  31. const isCheck = authCheck.includes("1");
  32. const isPhone = common_vendor.index.getStorageSync("phone") ? true : false;
  33. return isCheck && isPhone;
  34. };
  35. exports.getActivityData = getActivityData;
  36. exports.getMobile = getMobile;
  37. exports.getNavTop = getNavTop;
  38. exports.isGetPhone = isGetPhone;