123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- "use strict";
- const common_vendor = require("../common/vendor.js");
- const services_ams = require("../services/ams.js");
- const getNavTop = () => {
- let windowWidth = common_vendor.wx$1.getSystemInfoSync().windowWidth;
- const statusBarHeight = common_vendor.wx$1.getSystemInfoSync().statusBarHeight;
- const menuButton = common_vendor.wx$1.getMenuButtonBoundingClientRect();
- (menuButton.height + (menuButton.top - statusBarHeight) * 2) * (750 / windowWidth);
- const navTop = statusBarHeight * (750 / windowWidth);
- return navTop;
- };
- const SYSTEM_INFO = common_vendor.index.getWindowInfo();
- const getStatusBarHeight = () => SYSTEM_INFO.statusBarHeight;
- const getNavBarPaddingTop = () => {
- if (common_vendor.index.getMenuButtonBoundingClientRect) {
- let { top, height } = common_vendor.index.getMenuButtonBoundingClientRect();
- return height + (top - getStatusBarHeight());
- } else {
- return 0;
- }
- };
- const getActivityData = () => {
- const appid = common_vendor.index.getStorageSync("appid");
- let isAuth = false;
- services_ams.getActivity(appid).then((res) => {
- const data = res.data[0] || {};
- common_vendor.index.setStorageSync("activityData", JSON.stringify(data));
- }).catch((err) => {
- console.log(err);
- });
- return isAuth;
- };
- const getMobile = async (code, path) => {
- const res = await services_ams.getPhoneNumberInfo(code);
- try {
- common_vendor.index.showToast({
- title: res.msg,
- icon: "success"
- });
- common_vendor.index.setStorageSync("phone", res.data);
- if (path) {
- common_vendor.index.navigateTo({
- url: path
- });
- }
- return res.data;
- } catch (err) {
- common_vendor.index.showToast({
- title: err.msg,
- icon: "none"
- });
- }
- };
- const isGetPhone = () => {
- const data = JSON.parse(common_vendor.index.getStorageSync("activityData")) || {};
- const authCheck = (data == null ? void 0 : data.authCheck.split(",")) || [];
- const isCheck = authCheck.includes("1");
- const isPhone = !!common_vendor.index.getStorageSync("phone");
- return isCheck && isPhone;
- };
- exports.getActivityData = getActivityData;
- exports.getMobile = getMobile;
- exports.getNavBarPaddingTop = getNavBarPaddingTop;
- exports.getNavTop = getNavTop;
- exports.getStatusBarHeight = getStatusBarHeight;
- exports.isGetPhone = isGetPhone;
|