system.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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, path) => {
  24. services_ams.getPhoneNumberInfo(code).then((res) => {
  25. common_vendor.index.showToast({
  26. title: res.msg,
  27. icon: "success"
  28. });
  29. common_vendor.index.setStorageSync("phone", res.data);
  30. common_vendor.index.navigateTo({
  31. url: path
  32. });
  33. });
  34. };
  35. const isGetPhone = () => {
  36. const data = JSON.parse(common_vendor.index.getStorageSync("activityData")) || {};
  37. const authCheck = (data == null ? void 0 : data.authCheck.split(",")) || [];
  38. const isCheck = authCheck.includes("1");
  39. const isPhone = !!common_vendor.index.getStorageSync("phone");
  40. return isCheck && isPhone;
  41. };
  42. exports.getActivityData = getActivityData;
  43. exports.getMobile = getMobile;
  44. exports.getNavTop = getNavTop;
  45. exports.isGetPhone = isGetPhone;