增加新模块
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
const color = {
|
||||
primary: "#3c9cff",
|
||||
info: "#909399",
|
||||
default: "#909399",
|
||||
warning: "#f9ae3d",
|
||||
error: "#f56c6c",
|
||||
success: "#5ac725",
|
||||
mainColor: "#303133",
|
||||
contentColor: "#606266",
|
||||
tipsColor: "#909399",
|
||||
lightColor: "#c0c4cc",
|
||||
borderColor: "#e4e7ed"
|
||||
};
|
||||
exports.color = color;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/config/color.js.map
|
||||
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const version = "3";
|
||||
{
|
||||
common_vendor.index.__f__("log", "at uni_modules/uview-plus/libs/config/config.js:5", `
|
||||
%c uview-plus V${version} %c https://ijry.github.io/uview-plus/
|
||||
|
||||
`, "color: #ffffff; background: #3c9cff; padding:5px 0;", "color: #3c9cff;background: #ffffff; padding:5px 0;");
|
||||
}
|
||||
const config = {
|
||||
v: version,
|
||||
version,
|
||||
// 主题名称
|
||||
type: [
|
||||
"primary",
|
||||
"success",
|
||||
"info",
|
||||
"error",
|
||||
"warning"
|
||||
],
|
||||
// 颜色部分,本来可以通过scss的:export导出供js使用,但是奈何nvue不支持
|
||||
color: {
|
||||
"u-primary": "#2979ff",
|
||||
"u-warning": "#ff9900",
|
||||
"u-success": "#19be6b",
|
||||
"u-error": "#fa3534",
|
||||
"u-info": "#909399",
|
||||
"u-main-color": "#303133",
|
||||
"u-content-color": "#606266",
|
||||
"u-tips-color": "#909399",
|
||||
"u-light-color": "#c0c4cc",
|
||||
"up-primary": "#2979ff",
|
||||
"up-warning": "#ff9900",
|
||||
"up-success": "#19be6b",
|
||||
"up-error": "#fa3534",
|
||||
"up-info": "#909399",
|
||||
"up-main-color": "#303133",
|
||||
"up-content-color": "#606266",
|
||||
"up-tips-color": "#909399",
|
||||
"up-light-color": "#c0c4cc"
|
||||
},
|
||||
// 默认单位,可以通过配置为rpx,那么在用于传入组件大小参数为数值时,就默认为rpx
|
||||
unit: "px",
|
||||
// 拦截器
|
||||
interceptor: {
|
||||
navbarLeftClick: null
|
||||
}
|
||||
};
|
||||
exports.config = config;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/config/config.js.map
|
||||
@@ -0,0 +1,182 @@
|
||||
"use strict";
|
||||
require("./config.js");
|
||||
const uni_modules_uviewPlus_components_uActionSheet_actionSheet = require("../../components/u-action-sheet/actionSheet.js");
|
||||
const uni_modules_uviewPlus_components_uAlbum_album = require("../../components/u-album/album.js");
|
||||
const uni_modules_uviewPlus_components_uAlert_alert = require("../../components/u-alert/alert.js");
|
||||
const uni_modules_uviewPlus_components_uAvatar_avatar = require("../../components/u-avatar/avatar.js");
|
||||
const uni_modules_uviewPlus_components_uAvatarGroup_avatarGroup = require("../../components/u-avatar-group/avatarGroup.js");
|
||||
const uni_modules_uviewPlus_components_uBackTop_backtop = require("../../components/u-back-top/backtop.js");
|
||||
const uni_modules_uviewPlus_components_uBadge_badge = require("../../components/u-badge/badge.js");
|
||||
const uni_modules_uviewPlus_components_uButton_button = require("../../components/u-button/button.js");
|
||||
const uni_modules_uviewPlus_components_uCalendar_calendar = require("../../components/u-calendar/calendar.js");
|
||||
const uni_modules_uviewPlus_components_uCarKeyboard_carKeyboard = require("../../components/u-car-keyboard/carKeyboard.js");
|
||||
const uni_modules_uviewPlus_components_uCell_cell = require("../../components/u-cell/cell.js");
|
||||
const uni_modules_uviewPlus_components_uCellGroup_cellGroup = require("../../components/u-cell-group/cellGroup.js");
|
||||
const uni_modules_uviewPlus_components_uCheckbox_checkbox = require("../../components/u-checkbox/checkbox.js");
|
||||
const uni_modules_uviewPlus_components_uCheckboxGroup_checkboxGroup = require("../../components/u-checkbox-group/checkboxGroup.js");
|
||||
const uni_modules_uviewPlus_components_uCircleProgress_circleProgress = require("../../components/u-circle-progress/circleProgress.js");
|
||||
const uni_modules_uviewPlus_components_uCode_code = require("../../components/u-code/code.js");
|
||||
const uni_modules_uviewPlus_components_uCodeInput_codeInput = require("../../components/u-code-input/codeInput.js");
|
||||
const uni_modules_uviewPlus_components_uCol_col = require("../../components/u-col/col.js");
|
||||
const uni_modules_uviewPlus_components_uCollapse_collapse = require("../../components/u-collapse/collapse.js");
|
||||
const uni_modules_uviewPlus_components_uCollapseItem_collapseItem = require("../../components/u-collapse-item/collapseItem.js");
|
||||
const uni_modules_uviewPlus_components_uColumnNotice_columnNotice = require("../../components/u-column-notice/columnNotice.js");
|
||||
const uni_modules_uviewPlus_components_uCountDown_countDown = require("../../components/u-count-down/countDown.js");
|
||||
const uni_modules_uviewPlus_components_uCountTo_countTo = require("../../components/u-count-to/countTo.js");
|
||||
const uni_modules_uviewPlus_components_uDatetimePicker_datetimePicker = require("../../components/u-datetime-picker/datetimePicker.js");
|
||||
const uni_modules_uviewPlus_components_uDivider_divider = require("../../components/u-divider/divider.js");
|
||||
const uni_modules_uviewPlus_components_uEmpty_empty = require("../../components/u-empty/empty.js");
|
||||
const uni_modules_uviewPlus_components_uForm_form = require("../../components/u-form/form.js");
|
||||
const uni_modules_uviewPlus_components_uFormItem_formItem = require("../../components/u-form-item/formItem.js");
|
||||
const uni_modules_uviewPlus_components_uGap_gap = require("../../components/u-gap/gap.js");
|
||||
const uni_modules_uviewPlus_components_uGrid_grid = require("../../components/u-grid/grid.js");
|
||||
const uni_modules_uviewPlus_components_uGridItem_gridItem = require("../../components/u-grid-item/gridItem.js");
|
||||
const uni_modules_uviewPlus_components_uIcon_icon = require("../../components/u-icon/icon.js");
|
||||
const uni_modules_uviewPlus_components_uImage_image = require("../../components/u-image/image.js");
|
||||
const uni_modules_uviewPlus_components_uIndexAnchor_indexAnchor = require("../../components/u-index-anchor/indexAnchor.js");
|
||||
const uni_modules_uviewPlus_components_uIndexList_indexList = require("../../components/u-index-list/indexList.js");
|
||||
const uni_modules_uviewPlus_components_uInput_input = require("../../components/u-input/input.js");
|
||||
const uni_modules_uviewPlus_components_uKeyboard_keyboard = require("../../components/u-keyboard/keyboard.js");
|
||||
const uni_modules_uviewPlus_components_uLine_line = require("../../components/u-line/line.js");
|
||||
const uni_modules_uviewPlus_components_uLineProgress_lineProgress = require("../../components/u-line-progress/lineProgress.js");
|
||||
const uni_modules_uviewPlus_components_uLink_link = require("../../components/u-link/link.js");
|
||||
const uni_modules_uviewPlus_components_uList_list = require("../../components/u-list/list.js");
|
||||
const uni_modules_uviewPlus_components_uListItem_listItem = require("../../components/u-list-item/listItem.js");
|
||||
const uni_modules_uviewPlus_components_uLoadingIcon_loadingIcon = require("../../components/u-loading-icon/loadingIcon.js");
|
||||
const uni_modules_uviewPlus_components_uLoadingPage_loadingPage = require("../../components/u-loading-page/loadingPage.js");
|
||||
const uni_modules_uviewPlus_components_uLoadmore_loadmore = require("../../components/u-loadmore/loadmore.js");
|
||||
const uni_modules_uviewPlus_components_uModal_modal = require("../../components/u-modal/modal.js");
|
||||
const uni_modules_uviewPlus_components_uNavbar_navbar = require("../../components/u-navbar/navbar.js");
|
||||
const uni_modules_uviewPlus_components_uNoNetwork_noNetwork = require("../../components/u-no-network/noNetwork.js");
|
||||
const uni_modules_uviewPlus_components_uNoticeBar_noticeBar = require("../../components/u-notice-bar/noticeBar.js");
|
||||
const uni_modules_uviewPlus_components_uNotify_notify = require("../../components/u-notify/notify.js");
|
||||
const uni_modules_uviewPlus_components_uNumberBox_numberBox = require("../../components/u-number-box/numberBox.js");
|
||||
const uni_modules_uviewPlus_components_uNumberKeyboard_numberKeyboard = require("../../components/u-number-keyboard/numberKeyboard.js");
|
||||
const uni_modules_uviewPlus_components_uOverlay_overlay = require("../../components/u-overlay/overlay.js");
|
||||
const uni_modules_uviewPlus_components_uParse_parse = require("../../components/u-parse/parse.js");
|
||||
const uni_modules_uviewPlus_components_uPicker_picker = require("../../components/u-picker/picker.js");
|
||||
const uni_modules_uviewPlus_components_uPopup_popup = require("../../components/u-popup/popup.js");
|
||||
const uni_modules_uviewPlus_components_uRadio_radio = require("../../components/u-radio/radio.js");
|
||||
const uni_modules_uviewPlus_components_uRadioGroup_radioGroup = require("../../components/u-radio-group/radioGroup.js");
|
||||
const uni_modules_uviewPlus_components_uRate_rate = require("../../components/u-rate/rate.js");
|
||||
const uni_modules_uviewPlus_components_uReadMore_readMore = require("../../components/u-read-more/readMore.js");
|
||||
const uni_modules_uviewPlus_components_uRow_row = require("../../components/u-row/row.js");
|
||||
const uni_modules_uviewPlus_components_uRowNotice_rowNotice = require("../../components/u-row-notice/rowNotice.js");
|
||||
const uni_modules_uviewPlus_components_uScrollList_scrollList = require("../../components/u-scroll-list/scrollList.js");
|
||||
const uni_modules_uviewPlus_components_uSearch_search = require("../../components/u-search/search.js");
|
||||
const uni_modules_uviewPlus_components_uSection_section = require("../../components/u-section/section.js");
|
||||
const uni_modules_uviewPlus_components_uSkeleton_skeleton = require("../../components/u-skeleton/skeleton.js");
|
||||
const uni_modules_uviewPlus_components_uSlider_slider = require("../../components/u-slider/slider.js");
|
||||
const uni_modules_uviewPlus_components_uStatusBar_statusBar = require("../../components/u-status-bar/statusBar.js");
|
||||
const uni_modules_uviewPlus_components_uSteps_steps = require("../../components/u-steps/steps.js");
|
||||
const uni_modules_uviewPlus_components_uStepsItem_stepsItem = require("../../components/u-steps-item/stepsItem.js");
|
||||
const uni_modules_uviewPlus_components_uSticky_sticky = require("../../components/u-sticky/sticky.js");
|
||||
const uni_modules_uviewPlus_components_uSubsection_subsection = require("../../components/u-subsection/subsection.js");
|
||||
const uni_modules_uviewPlus_components_uSwipeAction_swipeAction = require("../../components/u-swipe-action/swipeAction.js");
|
||||
const uni_modules_uviewPlus_components_uSwipeActionItem_swipeActionItem = require("../../components/u-swipe-action-item/swipeActionItem.js");
|
||||
const uni_modules_uviewPlus_components_uSwiper_swiper = require("../../components/u-swiper/swiper.js");
|
||||
const uni_modules_uviewPlus_components_uSwiperIndicator_swipterIndicator = require("../../components/u-swiper-indicator/swipterIndicator.js");
|
||||
const uni_modules_uviewPlus_components_uSwitch_switch = require("../../components/u-switch/switch.js");
|
||||
const uni_modules_uviewPlus_components_uTabbar_tabbar = require("../../components/u-tabbar/tabbar.js");
|
||||
const uni_modules_uviewPlus_components_uTabbarItem_tabbarItem = require("../../components/u-tabbar-item/tabbarItem.js");
|
||||
const uni_modules_uviewPlus_components_uTabs_tabs = require("../../components/u-tabs/tabs.js");
|
||||
const uni_modules_uviewPlus_components_uTag_tag = require("../../components/u-tag/tag.js");
|
||||
const uni_modules_uviewPlus_components_uText_text = require("../../components/u-text/text.js");
|
||||
const uni_modules_uviewPlus_components_uTextarea_textarea = require("../../components/u-textarea/textarea.js");
|
||||
const uni_modules_uviewPlus_components_uToast_toast = require("../../components/u-toast/toast.js");
|
||||
const uni_modules_uviewPlus_components_uToolbar_toolbar = require("../../components/u-toolbar/toolbar.js");
|
||||
const uni_modules_uviewPlus_components_uTooltip_tooltip = require("../../components/u-tooltip/tooltip.js");
|
||||
const uni_modules_uviewPlus_components_uTransition_transition = require("../../components/u-transition/transition.js");
|
||||
const uni_modules_uviewPlus_components_uUpload_upload = require("../../components/u-upload/upload.js");
|
||||
const defProps = {
|
||||
...uni_modules_uviewPlus_components_uActionSheet_actionSheet.ActionSheet,
|
||||
...uni_modules_uviewPlus_components_uAlbum_album.Album,
|
||||
...uni_modules_uviewPlus_components_uAlert_alert.Alert,
|
||||
...uni_modules_uviewPlus_components_uAvatar_avatar.Avatar,
|
||||
...uni_modules_uviewPlus_components_uAvatarGroup_avatarGroup.AvatarGroup,
|
||||
...uni_modules_uviewPlus_components_uBackTop_backtop.Backtop,
|
||||
...uni_modules_uviewPlus_components_uBadge_badge.Badge,
|
||||
...uni_modules_uviewPlus_components_uButton_button.Button,
|
||||
...uni_modules_uviewPlus_components_uCalendar_calendar.Calendar,
|
||||
...uni_modules_uviewPlus_components_uCarKeyboard_carKeyboard.CarKeyboard,
|
||||
...uni_modules_uviewPlus_components_uCell_cell.Cell,
|
||||
...uni_modules_uviewPlus_components_uCellGroup_cellGroup.CellGroup,
|
||||
...uni_modules_uviewPlus_components_uCheckbox_checkbox.Checkbox,
|
||||
...uni_modules_uviewPlus_components_uCheckboxGroup_checkboxGroup.CheckboxGroup,
|
||||
...uni_modules_uviewPlus_components_uCircleProgress_circleProgress.CircleProgress,
|
||||
...uni_modules_uviewPlus_components_uCode_code.Code,
|
||||
...uni_modules_uviewPlus_components_uCodeInput_codeInput.CodeInput,
|
||||
...uni_modules_uviewPlus_components_uCol_col.Col,
|
||||
...uni_modules_uviewPlus_components_uCollapse_collapse.Collapse,
|
||||
...uni_modules_uviewPlus_components_uCollapseItem_collapseItem.CollapseItem,
|
||||
...uni_modules_uviewPlus_components_uColumnNotice_columnNotice.ColumnNotice,
|
||||
...uni_modules_uviewPlus_components_uCountDown_countDown.CountDown,
|
||||
...uni_modules_uviewPlus_components_uCountTo_countTo.CountTo,
|
||||
...uni_modules_uviewPlus_components_uDatetimePicker_datetimePicker.DatetimePicker,
|
||||
...uni_modules_uviewPlus_components_uDivider_divider.Divider,
|
||||
...uni_modules_uviewPlus_components_uEmpty_empty.Empty,
|
||||
...uni_modules_uviewPlus_components_uForm_form.Form,
|
||||
...uni_modules_uviewPlus_components_uFormItem_formItem.GormItem,
|
||||
...uni_modules_uviewPlus_components_uGap_gap.Gap,
|
||||
...uni_modules_uviewPlus_components_uGrid_grid.Grid,
|
||||
...uni_modules_uviewPlus_components_uGridItem_gridItem.GridItem,
|
||||
...uni_modules_uviewPlus_components_uIcon_icon.Icon,
|
||||
...uni_modules_uviewPlus_components_uImage_image.Image,
|
||||
...uni_modules_uviewPlus_components_uIndexAnchor_indexAnchor.IndexAnchor,
|
||||
...uni_modules_uviewPlus_components_uIndexList_indexList.IndexList,
|
||||
...uni_modules_uviewPlus_components_uInput_input.Input,
|
||||
...uni_modules_uviewPlus_components_uKeyboard_keyboard.Keyboard,
|
||||
...uni_modules_uviewPlus_components_uLine_line.Line,
|
||||
...uni_modules_uviewPlus_components_uLineProgress_lineProgress.LineProgress,
|
||||
...uni_modules_uviewPlus_components_uLink_link.Link,
|
||||
...uni_modules_uviewPlus_components_uList_list.List,
|
||||
...uni_modules_uviewPlus_components_uListItem_listItem.ListItem,
|
||||
...uni_modules_uviewPlus_components_uLoadingIcon_loadingIcon.LoadingIcon,
|
||||
...uni_modules_uviewPlus_components_uLoadingPage_loadingPage.LoadingPage,
|
||||
...uni_modules_uviewPlus_components_uLoadmore_loadmore.Loadmore,
|
||||
...uni_modules_uviewPlus_components_uModal_modal.Modal,
|
||||
...uni_modules_uviewPlus_components_uNavbar_navbar.Navbar,
|
||||
...uni_modules_uviewPlus_components_uNoNetwork_noNetwork.NoNetwork,
|
||||
...uni_modules_uviewPlus_components_uNoticeBar_noticeBar.NoticeBar,
|
||||
...uni_modules_uviewPlus_components_uNotify_notify.Notify,
|
||||
...uni_modules_uviewPlus_components_uNumberBox_numberBox.NumberBox,
|
||||
...uni_modules_uviewPlus_components_uNumberKeyboard_numberKeyboard.NumberKeyboard,
|
||||
...uni_modules_uviewPlus_components_uOverlay_overlay.Overlay,
|
||||
...uni_modules_uviewPlus_components_uParse_parse.Parse,
|
||||
...uni_modules_uviewPlus_components_uPicker_picker.Picker,
|
||||
...uni_modules_uviewPlus_components_uPopup_popup.Popup,
|
||||
...uni_modules_uviewPlus_components_uRadio_radio.Radio,
|
||||
...uni_modules_uviewPlus_components_uRadioGroup_radioGroup.RadioGroup,
|
||||
...uni_modules_uviewPlus_components_uRate_rate.Rate,
|
||||
...uni_modules_uviewPlus_components_uReadMore_readMore.ReadMore,
|
||||
...uni_modules_uviewPlus_components_uRow_row.Row,
|
||||
...uni_modules_uviewPlus_components_uRowNotice_rowNotice.RowNotice,
|
||||
...uni_modules_uviewPlus_components_uScrollList_scrollList.ScrollList,
|
||||
...uni_modules_uviewPlus_components_uSearch_search.Search,
|
||||
...uni_modules_uviewPlus_components_uSection_section.Section,
|
||||
...uni_modules_uviewPlus_components_uSkeleton_skeleton.Skeleton,
|
||||
...uni_modules_uviewPlus_components_uSlider_slider.Slider,
|
||||
...uni_modules_uviewPlus_components_uStatusBar_statusBar.StatusBar,
|
||||
...uni_modules_uviewPlus_components_uSteps_steps.Steps,
|
||||
...uni_modules_uviewPlus_components_uStepsItem_stepsItem.StepsItem,
|
||||
...uni_modules_uviewPlus_components_uSticky_sticky.Sticky,
|
||||
...uni_modules_uviewPlus_components_uSubsection_subsection.Subsection,
|
||||
...uni_modules_uviewPlus_components_uSwipeAction_swipeAction.SwipeAction,
|
||||
...uni_modules_uviewPlus_components_uSwipeActionItem_swipeActionItem.SwipeActionItem,
|
||||
...uni_modules_uviewPlus_components_uSwiper_swiper.Swiper,
|
||||
...uni_modules_uviewPlus_components_uSwiperIndicator_swipterIndicator.SwipterIndicator,
|
||||
...uni_modules_uviewPlus_components_uSwitch_switch.Switch,
|
||||
...uni_modules_uviewPlus_components_uTabbar_tabbar.Tabbar,
|
||||
...uni_modules_uviewPlus_components_uTabbarItem_tabbarItem.TabbarItem,
|
||||
...uni_modules_uviewPlus_components_uTabs_tabs.Tabs,
|
||||
...uni_modules_uviewPlus_components_uTag_tag.Tag,
|
||||
...uni_modules_uviewPlus_components_uText_text.Text,
|
||||
...uni_modules_uviewPlus_components_uTextarea_textarea.Textarea,
|
||||
...uni_modules_uviewPlus_components_uToast_toast.Toast,
|
||||
...uni_modules_uviewPlus_components_uToolbar_toolbar.Toolbar,
|
||||
...uni_modules_uviewPlus_components_uTooltip_tooltip.Tooltip,
|
||||
...uni_modules_uviewPlus_components_uTransition_transition.Transition,
|
||||
...uni_modules_uviewPlus_components_uUpload_upload.Upload
|
||||
};
|
||||
exports.defProps = defProps;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/config/props.js.map
|
||||
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
const zIndex = {
|
||||
toast: 10090,
|
||||
noNetwork: 10080,
|
||||
// popup包含popup,actionsheet,keyboard,picker的值
|
||||
popup: 10075,
|
||||
mask: 10070,
|
||||
navbar: 980,
|
||||
topTips: 975,
|
||||
sticky: 970,
|
||||
indexListSticky: 965
|
||||
};
|
||||
exports.zIndex = zIndex;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/config/zIndex.js.map
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
function colorGradient(startColor = "rgb(0, 0, 0)", endColor = "rgb(255, 255, 255)", step = 10) {
|
||||
const startRGB = hexToRgb(startColor, false);
|
||||
const startR = startRGB[0];
|
||||
const startG = startRGB[1];
|
||||
const startB = startRGB[2];
|
||||
const endRGB = hexToRgb(endColor, false);
|
||||
const endR = endRGB[0];
|
||||
const endG = endRGB[1];
|
||||
const endB = endRGB[2];
|
||||
const sR = (endR - startR) / step;
|
||||
const sG = (endG - startG) / step;
|
||||
const sB = (endB - startB) / step;
|
||||
const colorArr = [];
|
||||
for (let i = 0; i < step; i++) {
|
||||
let hex = rgbToHex(`rgb(${Math.round(sR * i + startR)},${Math.round(sG * i + startG)},${Math.round(sB * i + startB)})`);
|
||||
if (i === 0)
|
||||
hex = rgbToHex(startColor);
|
||||
if (i === step - 1)
|
||||
hex = rgbToHex(endColor);
|
||||
colorArr.push(hex);
|
||||
}
|
||||
return colorArr;
|
||||
}
|
||||
function hexToRgb(sColor, str = true) {
|
||||
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
||||
sColor = String(sColor).toLowerCase();
|
||||
if (sColor && reg.test(sColor)) {
|
||||
if (sColor.length === 4) {
|
||||
let sColorNew = "#";
|
||||
for (let i = 1; i < 4; i += 1) {
|
||||
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
|
||||
}
|
||||
sColor = sColorNew;
|
||||
}
|
||||
const sColorChange = [];
|
||||
for (let i = 1; i < 7; i += 2) {
|
||||
sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`));
|
||||
}
|
||||
if (!str) {
|
||||
return sColorChange;
|
||||
}
|
||||
return `rgb(${sColorChange[0]},${sColorChange[1]},${sColorChange[2]})`;
|
||||
}
|
||||
if (/^(rgb|RGB)/.test(sColor)) {
|
||||
const arr = sColor.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
|
||||
return arr.map((val) => Number(val));
|
||||
}
|
||||
return sColor;
|
||||
}
|
||||
function rgbToHex(rgb) {
|
||||
const _this = rgb;
|
||||
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
||||
if (/^(rgb|RGB)/.test(_this)) {
|
||||
const aColor = _this.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
|
||||
let strHex = "#";
|
||||
for (let i = 0; i < aColor.length; i++) {
|
||||
let hex = Number(aColor[i]).toString(16);
|
||||
hex = String(hex).length == 1 ? `${0}${hex}` : hex;
|
||||
if (hex === "0") {
|
||||
hex += hex;
|
||||
}
|
||||
strHex += hex;
|
||||
}
|
||||
if (strHex.length !== 7) {
|
||||
strHex = _this;
|
||||
}
|
||||
return strHex;
|
||||
}
|
||||
if (reg.test(_this)) {
|
||||
const aNum = _this.replace(/#/, "").split("");
|
||||
if (aNum.length === 6) {
|
||||
return _this;
|
||||
}
|
||||
if (aNum.length === 3) {
|
||||
let numHex = "#";
|
||||
for (let i = 0; i < aNum.length; i += 1) {
|
||||
numHex += aNum[i] + aNum[i];
|
||||
}
|
||||
return numHex;
|
||||
}
|
||||
} else {
|
||||
return _this;
|
||||
}
|
||||
}
|
||||
function colorToRgba(color, alpha) {
|
||||
color = rgbToHex(color);
|
||||
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
||||
let sColor = String(color).toLowerCase();
|
||||
if (sColor && reg.test(sColor)) {
|
||||
if (sColor.length === 4) {
|
||||
let sColorNew = "#";
|
||||
for (let i = 1; i < 4; i += 1) {
|
||||
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
|
||||
}
|
||||
sColor = sColorNew;
|
||||
}
|
||||
const sColorChange = [];
|
||||
for (let i = 1; i < 7; i += 2) {
|
||||
sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`));
|
||||
}
|
||||
return `rgba(${sColorChange.join(",")},${alpha})`;
|
||||
}
|
||||
return sColor;
|
||||
}
|
||||
const colorGradient$1 = {
|
||||
colorGradient,
|
||||
hexToRgb,
|
||||
rgbToHex,
|
||||
colorToRgba
|
||||
};
|
||||
exports.colorGradient = colorGradient$1;
|
||||
exports.colorGradient$1 = colorGradient;
|
||||
exports.hexToRgb = hexToRgb;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/function/colorGradient.js.map
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
let timeout = null;
|
||||
function debounce(func, wait = 500, immediate = false) {
|
||||
if (timeout !== null)
|
||||
clearTimeout(timeout);
|
||||
if (immediate) {
|
||||
const callNow = !timeout;
|
||||
timeout = setTimeout(() => {
|
||||
timeout = null;
|
||||
}, wait);
|
||||
if (callNow)
|
||||
typeof func === "function" && func();
|
||||
} else {
|
||||
timeout = setTimeout(() => {
|
||||
typeof func === "function" && func();
|
||||
}, wait);
|
||||
}
|
||||
}
|
||||
exports.debounce = debounce;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/function/debounce.js.map
|
||||
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
function strip(num, precision = 15) {
|
||||
return +parseFloat(Number(num).toPrecision(precision));
|
||||
}
|
||||
function digitLength(num) {
|
||||
const eSplit = num.toString().split(/[eE]/);
|
||||
const len = (eSplit[0].split(".")[1] || "").length - +(eSplit[1] || 0);
|
||||
return len > 0 ? len : 0;
|
||||
}
|
||||
function float2Fixed(num) {
|
||||
if (num.toString().indexOf("e") === -1) {
|
||||
return Number(num.toString().replace(".", ""));
|
||||
}
|
||||
const dLen = digitLength(num);
|
||||
return dLen > 0 ? strip(Number(num) * Math.pow(10, dLen)) : Number(num);
|
||||
}
|
||||
function checkBoundary(num) {
|
||||
{
|
||||
if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
|
||||
common_vendor.index.__f__("warn", "at uni_modules/uview-plus/libs/function/digit.js:45", `${num} 超出了精度限制,结果可能不正确`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function iteratorOperation(arr, operation) {
|
||||
const [num1, num2, ...others] = arr;
|
||||
let res = operation(num1, num2);
|
||||
others.forEach((num) => {
|
||||
res = operation(res, num);
|
||||
});
|
||||
return res;
|
||||
}
|
||||
function times(...nums) {
|
||||
if (nums.length > 2) {
|
||||
return iteratorOperation(nums, times);
|
||||
}
|
||||
const [num1, num2] = nums;
|
||||
const num1Changed = float2Fixed(num1);
|
||||
const num2Changed = float2Fixed(num2);
|
||||
const baseNum = digitLength(num1) + digitLength(num2);
|
||||
const leftValue = num1Changed * num2Changed;
|
||||
checkBoundary(leftValue);
|
||||
return leftValue / Math.pow(10, baseNum);
|
||||
}
|
||||
function divide(...nums) {
|
||||
if (nums.length > 2) {
|
||||
return iteratorOperation(nums, divide);
|
||||
}
|
||||
const [num1, num2] = nums;
|
||||
const num1Changed = float2Fixed(num1);
|
||||
const num2Changed = float2Fixed(num2);
|
||||
checkBoundary(num1Changed);
|
||||
checkBoundary(num2Changed);
|
||||
return times(num1Changed / num2Changed, strip(Math.pow(10, digitLength(num2) - digitLength(num1))));
|
||||
}
|
||||
function round(num, ratio) {
|
||||
const base = Math.pow(10, ratio);
|
||||
let result = divide(Math.round(Math.abs(times(num, base))), base);
|
||||
if (num < 0 && result !== 0) {
|
||||
result = times(result, -1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.round = round;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/function/digit.js.map
|
||||
@@ -0,0 +1,523 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uviewPlus_libs_function_test = require("./test.js");
|
||||
const uni_modules_uviewPlus_libs_function_digit = require("./digit.js");
|
||||
const uni_modules_uviewPlus_libs_config_config = require("../config/config.js");
|
||||
function range(min = 0, max = 0, value = 0) {
|
||||
return Math.max(min, Math.min(max, Number(value)));
|
||||
}
|
||||
function getPx(value, unit = false) {
|
||||
if (uni_modules_uviewPlus_libs_function_test.number(value)) {
|
||||
return unit ? `${value}px` : Number(value);
|
||||
}
|
||||
if (/(rpx|upx)$/.test(value)) {
|
||||
return unit ? `${common_vendor.index.upx2px(parseInt(value))}px` : Number(common_vendor.index.upx2px(parseInt(value)));
|
||||
}
|
||||
return unit ? `${parseInt(value)}px` : parseInt(value);
|
||||
}
|
||||
function sleep(value = 30) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, value);
|
||||
});
|
||||
}
|
||||
function os() {
|
||||
return common_vendor.index.getDeviceInfo().platform.toLowerCase();
|
||||
}
|
||||
function sys() {
|
||||
return common_vendor.index.getSystemInfoSync();
|
||||
}
|
||||
function getWindowInfo() {
|
||||
let ret = {};
|
||||
ret = common_vendor.index.getWindowInfo();
|
||||
return ret;
|
||||
}
|
||||
function random(min, max) {
|
||||
if (min >= 0 && max > 0 && max >= min) {
|
||||
const gab = max - min + 1;
|
||||
return Math.floor(Math.random() * gab + min);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
function guid(len = 32, firstU = true, radix = null) {
|
||||
const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
|
||||
const uuid = [];
|
||||
radix = radix || chars.length;
|
||||
if (len) {
|
||||
for (let i = 0; i < len; i++)
|
||||
uuid[i] = chars[0 | Math.random() * radix];
|
||||
} else {
|
||||
let r;
|
||||
uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
|
||||
uuid[14] = "4";
|
||||
for (let i = 0; i < 36; i++) {
|
||||
if (!uuid[i]) {
|
||||
r = 0 | Math.random() * 16;
|
||||
uuid[i] = chars[i == 19 ? r & 3 | 8 : r];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (firstU) {
|
||||
uuid.shift();
|
||||
return `u${uuid.join("")}`;
|
||||
}
|
||||
return uuid.join("");
|
||||
}
|
||||
function $parent(name = void 0) {
|
||||
let parent = this.$parent;
|
||||
while (parent) {
|
||||
name = name.replace(/up-([a-zA-Z0-9-_]+)/g, "u-$1");
|
||||
if (parent.$options && parent.$options.name !== name) {
|
||||
parent = parent.$parent;
|
||||
} else {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function addStyle(customStyle, target = "object") {
|
||||
if (uni_modules_uviewPlus_libs_function_test.empty(customStyle) || typeof customStyle === "object" && target === "object" || target === "string" && typeof customStyle === "string") {
|
||||
return customStyle;
|
||||
}
|
||||
if (target === "object") {
|
||||
customStyle = trim(customStyle);
|
||||
const styleArray = customStyle.split(";");
|
||||
const style = {};
|
||||
for (let i = 0; i < styleArray.length; i++) {
|
||||
if (styleArray[i]) {
|
||||
const item = styleArray[i].split(":");
|
||||
style[trim(item[0])] = trim(item[1]);
|
||||
}
|
||||
}
|
||||
return style;
|
||||
}
|
||||
let string = "";
|
||||
if (typeof customStyle === "object") {
|
||||
customStyle.forEach((val, i) => {
|
||||
const key = i.replace(/([A-Z])/g, "-$1").toLowerCase();
|
||||
string += `${key}:${val};`;
|
||||
});
|
||||
}
|
||||
return trim(string);
|
||||
}
|
||||
function addUnit(value = "auto", unit = "") {
|
||||
if (!unit) {
|
||||
unit = uni_modules_uviewPlus_libs_config_config.config.unit || "px";
|
||||
}
|
||||
if (unit == "rpx" && uni_modules_uviewPlus_libs_function_test.number(String(value))) {
|
||||
value = value * 2;
|
||||
}
|
||||
value = String(value);
|
||||
return uni_modules_uviewPlus_libs_function_test.number(value) ? `${value}${unit}` : value;
|
||||
}
|
||||
function deepClone(obj) {
|
||||
if ([null, void 0, NaN, false].includes(obj))
|
||||
return obj;
|
||||
if (typeof obj !== "object" && typeof obj !== "function") {
|
||||
return obj;
|
||||
}
|
||||
const o = uni_modules_uviewPlus_libs_function_test.array(obj) ? [] : {};
|
||||
for (const i in obj) {
|
||||
if (obj.hasOwnProperty(i)) {
|
||||
o[i] = typeof obj[i] === "object" ? deepClone(obj[i]) : obj[i];
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
function deepMerge(targetOrigin = {}, source = {}) {
|
||||
let target = deepClone(targetOrigin);
|
||||
if (typeof target !== "object" || typeof source !== "object")
|
||||
return false;
|
||||
for (const prop in source) {
|
||||
if (!source.hasOwnProperty(prop))
|
||||
continue;
|
||||
if (prop in target) {
|
||||
if (source[prop] == null) {
|
||||
target[prop] = source[prop];
|
||||
} else if (typeof target[prop] !== "object") {
|
||||
target[prop] = source[prop];
|
||||
} else if (typeof source[prop] !== "object") {
|
||||
target[prop] = source[prop];
|
||||
} else if (target[prop].concat && source[prop].concat) {
|
||||
target[prop] = target[prop].concat(source[prop]);
|
||||
} else {
|
||||
target[prop] = deepMerge(target[prop], source[prop]);
|
||||
}
|
||||
} else {
|
||||
target[prop] = source[prop];
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function shallowMerge(target, source = {}) {
|
||||
if (typeof target !== "object" || typeof source !== "object")
|
||||
return false;
|
||||
for (const prop in source) {
|
||||
if (!source.hasOwnProperty(prop))
|
||||
continue;
|
||||
if (prop in target) {
|
||||
if (source[prop] == null) {
|
||||
target[prop] = source[prop];
|
||||
} else if (typeof target[prop] !== "object") {
|
||||
target[prop] = source[prop];
|
||||
} else if (typeof source[prop] !== "object") {
|
||||
target[prop] = source[prop];
|
||||
} else if (target[prop].concat && source[prop].concat) {
|
||||
target[prop] = target[prop].concat(source[prop]);
|
||||
} else {
|
||||
target[prop] = shallowMerge(target[prop], source[prop]);
|
||||
}
|
||||
} else {
|
||||
target[prop] = source[prop];
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function error(err) {
|
||||
{
|
||||
common_vendor.index.__f__("error", "at uni_modules/uview-plus/libs/function/index.js:304", `uView提示:${err}`);
|
||||
}
|
||||
}
|
||||
function randomArray(array = []) {
|
||||
return array.sort(() => Math.random() - 0.5);
|
||||
}
|
||||
if (!String.prototype.padStart) {
|
||||
String.prototype.padStart = function(maxLength, fillString = " ") {
|
||||
if (Object.prototype.toString.call(fillString) !== "[object String]") {
|
||||
throw new TypeError(
|
||||
"fillString must be String"
|
||||
);
|
||||
}
|
||||
const str = this;
|
||||
if (str.length >= maxLength)
|
||||
return String(str);
|
||||
const fillLength = maxLength - str.length;
|
||||
let times = Math.ceil(fillLength / fillString.length);
|
||||
while (times >>= 1) {
|
||||
fillString += fillString;
|
||||
if (times === 1) {
|
||||
fillString += fillString;
|
||||
}
|
||||
}
|
||||
return fillString.slice(0, fillLength) + str;
|
||||
};
|
||||
}
|
||||
function timeFormat(dateTime = null, formatStr = "yyyy-mm-dd") {
|
||||
let date;
|
||||
if (!dateTime) {
|
||||
date = /* @__PURE__ */ new Date();
|
||||
} else if (/^\d{10}$/.test(dateTime.toString().trim())) {
|
||||
date = new Date(dateTime * 1e3);
|
||||
} else if (typeof dateTime === "string" && /^\d+$/.test(dateTime.trim())) {
|
||||
date = new Date(Number(dateTime));
|
||||
} else {
|
||||
date = new Date(
|
||||
typeof dateTime === "string" ? dateTime.replace(/-/g, "/") : dateTime
|
||||
);
|
||||
}
|
||||
const timeSource = {
|
||||
"y": date.getFullYear().toString(),
|
||||
// 年
|
||||
"m": (date.getMonth() + 1).toString().padStart(2, "0"),
|
||||
// 月
|
||||
"d": date.getDate().toString().padStart(2, "0"),
|
||||
// 日
|
||||
"h": date.getHours().toString().padStart(2, "0"),
|
||||
// 时
|
||||
"M": date.getMinutes().toString().padStart(2, "0"),
|
||||
// 分
|
||||
"s": date.getSeconds().toString().padStart(2, "0")
|
||||
// 秒
|
||||
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
||||
};
|
||||
for (const key in timeSource) {
|
||||
const [ret] = new RegExp(`${key}+`).exec(formatStr) || [];
|
||||
if (ret) {
|
||||
const beginIndex = key === "y" && ret.length === 2 ? 2 : 0;
|
||||
formatStr = formatStr.replace(ret, timeSource[key].slice(beginIndex));
|
||||
}
|
||||
}
|
||||
return formatStr;
|
||||
}
|
||||
function timeFrom(timestamp = null, format = "yyyy-mm-dd") {
|
||||
if (timestamp == null)
|
||||
timestamp = Number(/* @__PURE__ */ new Date());
|
||||
timestamp = parseInt(timestamp);
|
||||
if (timestamp.toString().length == 10)
|
||||
timestamp *= 1e3;
|
||||
let timer = (/* @__PURE__ */ new Date()).getTime() - timestamp;
|
||||
timer = parseInt(timer / 1e3);
|
||||
let tips = "";
|
||||
switch (true) {
|
||||
case timer < 300:
|
||||
tips = "刚刚";
|
||||
break;
|
||||
case (timer >= 300 && timer < 3600):
|
||||
tips = `${parseInt(timer / 60)}分钟前`;
|
||||
break;
|
||||
case (timer >= 3600 && timer < 86400):
|
||||
tips = `${parseInt(timer / 3600)}小时前`;
|
||||
break;
|
||||
case (timer >= 86400 && timer < 2592e3):
|
||||
tips = `${parseInt(timer / 86400)}天前`;
|
||||
break;
|
||||
default:
|
||||
if (format === false) {
|
||||
if (timer >= 2592e3 && timer < 365 * 86400) {
|
||||
tips = `${parseInt(timer / (86400 * 30))}个月前`;
|
||||
} else {
|
||||
tips = `${parseInt(timer / (86400 * 365))}年前`;
|
||||
}
|
||||
} else {
|
||||
tips = timeFormat(timestamp, format);
|
||||
}
|
||||
}
|
||||
return tips;
|
||||
}
|
||||
function trim(str, pos = "both") {
|
||||
str = String(str);
|
||||
if (pos == "both") {
|
||||
return str.replace(/^\s+|\s+$/g, "");
|
||||
}
|
||||
if (pos == "left") {
|
||||
return str.replace(/^\s*/, "");
|
||||
}
|
||||
if (pos == "right") {
|
||||
return str.replace(/(\s*$)/g, "");
|
||||
}
|
||||
if (pos == "all") {
|
||||
return str.replace(/\s+/g, "");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
function queryParams(data = {}, isPrefix = true, arrayFormat = "brackets") {
|
||||
const prefix = isPrefix ? "?" : "";
|
||||
const _result = [];
|
||||
if (["indices", "brackets", "repeat", "comma"].indexOf(arrayFormat) == -1)
|
||||
arrayFormat = "brackets";
|
||||
for (const key in data) {
|
||||
const value = data[key];
|
||||
if (["", void 0, null].indexOf(value) >= 0) {
|
||||
continue;
|
||||
}
|
||||
if (value.constructor === Array) {
|
||||
switch (arrayFormat) {
|
||||
case "indices":
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
_result.push(`${key}[${i}]=${value[i]}`);
|
||||
}
|
||||
break;
|
||||
case "brackets":
|
||||
value.forEach((_value) => {
|
||||
_result.push(`${key}[]=${_value}`);
|
||||
});
|
||||
break;
|
||||
case "repeat":
|
||||
value.forEach((_value) => {
|
||||
_result.push(`${key}=${_value}`);
|
||||
});
|
||||
break;
|
||||
case "comma":
|
||||
let commaStr = "";
|
||||
value.forEach((_value) => {
|
||||
commaStr += (commaStr ? "," : "") + _value;
|
||||
});
|
||||
_result.push(`${key}=${commaStr}`);
|
||||
break;
|
||||
default:
|
||||
value.forEach((_value) => {
|
||||
_result.push(`${key}[]=${_value}`);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
_result.push(`${key}=${value}`);
|
||||
}
|
||||
}
|
||||
return _result.length ? prefix + _result.join("&") : "";
|
||||
}
|
||||
function toast(title, duration = 2e3) {
|
||||
common_vendor.index.showToast({
|
||||
title: String(title),
|
||||
icon: "none",
|
||||
duration
|
||||
});
|
||||
}
|
||||
function type2icon(type = "success", fill = false) {
|
||||
if (["primary", "info", "error", "warning", "success"].indexOf(type) == -1)
|
||||
type = "success";
|
||||
let iconName = "";
|
||||
switch (type) {
|
||||
case "primary":
|
||||
iconName = "info-circle";
|
||||
break;
|
||||
case "info":
|
||||
iconName = "info-circle";
|
||||
break;
|
||||
case "error":
|
||||
iconName = "close-circle";
|
||||
break;
|
||||
case "warning":
|
||||
iconName = "error-circle";
|
||||
break;
|
||||
case "success":
|
||||
iconName = "checkmark-circle";
|
||||
break;
|
||||
default:
|
||||
iconName = "checkmark-circle";
|
||||
}
|
||||
if (fill)
|
||||
iconName += "-fill";
|
||||
return iconName;
|
||||
}
|
||||
function priceFormat(number, decimals = 0, decimalPoint = ".", thousandsSeparator = ",") {
|
||||
number = `${number}`.replace(/[^0-9+-Ee.]/g, "");
|
||||
const n = !isFinite(+number) ? 0 : +number;
|
||||
const prec = !isFinite(+decimals) ? 0 : Math.abs(decimals);
|
||||
const sep = typeof thousandsSeparator === "undefined" ? "," : thousandsSeparator;
|
||||
const dec = typeof decimalPoint === "undefined" ? "." : decimalPoint;
|
||||
let s = "";
|
||||
s = (prec ? uni_modules_uviewPlus_libs_function_digit.round(n, prec) + "" : `${Math.round(n)}`).split(".");
|
||||
const re = /(-?\d+)(\d{3})/;
|
||||
while (re.test(s[0])) {
|
||||
s[0] = s[0].replace(re, `$1${sep}$2`);
|
||||
}
|
||||
if ((s[1] || "").length < prec) {
|
||||
s[1] = s[1] || "";
|
||||
s[1] += new Array(prec - s[1].length + 1).join("0");
|
||||
}
|
||||
return s.join(dec);
|
||||
}
|
||||
function getDuration(value, unit = true) {
|
||||
const valueNum = parseInt(value);
|
||||
if (unit) {
|
||||
if (/s$/.test(value))
|
||||
return value;
|
||||
return value > 30 ? `${value}ms` : `${value}s`;
|
||||
}
|
||||
if (/ms$/.test(value))
|
||||
return valueNum;
|
||||
if (/s$/.test(value))
|
||||
return valueNum > 30 ? valueNum : valueNum * 1e3;
|
||||
return valueNum;
|
||||
}
|
||||
function padZero(value) {
|
||||
return `00${value}`.slice(-2);
|
||||
}
|
||||
function formValidate(instance, event) {
|
||||
const formItem = $parent.call(instance, "u-form-item");
|
||||
const form = $parent.call(instance, "u-form");
|
||||
if (formItem && form) {
|
||||
form.validateField(formItem.prop, () => {
|
||||
}, event);
|
||||
}
|
||||
}
|
||||
function getProperty(obj, key) {
|
||||
if (typeof obj !== "object" || null == obj) {
|
||||
return "";
|
||||
}
|
||||
if (typeof key !== "string" || key === "") {
|
||||
return "";
|
||||
}
|
||||
if (key.indexOf(".") !== -1) {
|
||||
const keys = key.split(".");
|
||||
let firstObj = obj[keys[0]] || {};
|
||||
for (let i = 1; i < keys.length; i++) {
|
||||
if (firstObj) {
|
||||
firstObj = firstObj[keys[i]];
|
||||
}
|
||||
}
|
||||
return firstObj;
|
||||
}
|
||||
return obj[key];
|
||||
}
|
||||
function setProperty(obj, key, value) {
|
||||
if (typeof obj !== "object" || null == obj) {
|
||||
return;
|
||||
}
|
||||
const inFn = function(_obj, keys, v) {
|
||||
if (keys.length === 1) {
|
||||
_obj[keys[0]] = v;
|
||||
return;
|
||||
}
|
||||
while (keys.length > 1) {
|
||||
const k = keys[0];
|
||||
if (!_obj[k] || typeof _obj[k] !== "object") {
|
||||
_obj[k] = {};
|
||||
}
|
||||
keys.shift();
|
||||
inFn(_obj[k], keys, v);
|
||||
}
|
||||
};
|
||||
if (typeof key !== "string" || key === "")
|
||||
;
|
||||
else if (key.indexOf(".") !== -1) {
|
||||
const keys = key.split(".");
|
||||
inFn(obj, keys, value);
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
}
|
||||
function page() {
|
||||
const pages2 = getCurrentPages();
|
||||
return `/${pages2[pages2.length - 1].route || ""}`;
|
||||
}
|
||||
function pages() {
|
||||
const pages2 = getCurrentPages();
|
||||
return pages2;
|
||||
}
|
||||
function getValueByPath(obj, path) {
|
||||
const pathArr = path.split(".");
|
||||
return pathArr.reduce((acc, curr) => {
|
||||
return acc && acc[curr] !== void 0 ? acc[curr] : void 0;
|
||||
}, obj);
|
||||
}
|
||||
const index = {
|
||||
range,
|
||||
getPx,
|
||||
sleep,
|
||||
os,
|
||||
sys,
|
||||
getWindowInfo,
|
||||
random,
|
||||
guid,
|
||||
$parent,
|
||||
addStyle,
|
||||
addUnit,
|
||||
deepClone,
|
||||
deepMerge,
|
||||
shallowMerge,
|
||||
error,
|
||||
randomArray,
|
||||
timeFormat,
|
||||
timeFrom,
|
||||
trim,
|
||||
queryParams,
|
||||
toast,
|
||||
type2icon,
|
||||
priceFormat,
|
||||
getDuration,
|
||||
padZero,
|
||||
formValidate,
|
||||
getProperty,
|
||||
setProperty,
|
||||
page,
|
||||
pages,
|
||||
getValueByPath
|
||||
// setConfig
|
||||
};
|
||||
exports.$parent = $parent;
|
||||
exports.addStyle = addStyle;
|
||||
exports.addUnit = addUnit;
|
||||
exports.deepClone = deepClone;
|
||||
exports.deepMerge = deepMerge;
|
||||
exports.error = error;
|
||||
exports.formValidate = formValidate;
|
||||
exports.getWindowInfo = getWindowInfo;
|
||||
exports.index = index;
|
||||
exports.os = os;
|
||||
exports.page = page;
|
||||
exports.queryParams = queryParams;
|
||||
exports.sleep = sleep;
|
||||
exports.type2icon = type2icon;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/function/index.js.map
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
let platform = "none";
|
||||
platform = "vue3";
|
||||
platform = "mp";
|
||||
platform = "weixin";
|
||||
const platform$1 = platform;
|
||||
exports.platform = platform$1;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/function/platform.js.map
|
||||
@@ -0,0 +1,199 @@
|
||||
"use strict";
|
||||
function email(value) {
|
||||
return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value);
|
||||
}
|
||||
function mobile(value) {
|
||||
return /^1[23456789]\d{9}$/.test(value);
|
||||
}
|
||||
function url(value) {
|
||||
return /^((https|http|ftp|rtsp|mms):\/\/)(([0-9a-zA-Z_!~*'().&=+$%-]+: )?[0-9a-zA-Z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z].[a-zA-Z]{2,6})(:[0-9]{1,4})?((\/?)|(\/[0-9a-zA-Z_!~*'().;?:@&=+$,%#-]+)+\/?)$/.test(value);
|
||||
}
|
||||
function date(value) {
|
||||
if (!value)
|
||||
return false;
|
||||
if (typeof value === "number") {
|
||||
if (value.toString().length !== 10 && value.toString().length !== 13) {
|
||||
return false;
|
||||
}
|
||||
return !isNaN(new Date(value).getTime());
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
const numV = Number(value);
|
||||
if (!isNaN(numV)) {
|
||||
if (numV.toString().length === 10 || numV.toString().length === 13) {
|
||||
return !isNaN(new Date(numV).getTime());
|
||||
}
|
||||
}
|
||||
if (value.length < 10 || value.length > 19) {
|
||||
return false;
|
||||
}
|
||||
const dateRegex = /^\d{4}[-\/]\d{2}[-\/]\d{2}( \d{1,2}:\d{2}(:\d{2})?)?$/;
|
||||
if (!dateRegex.test(value)) {
|
||||
return false;
|
||||
}
|
||||
const dateValue = new Date(value);
|
||||
return !isNaN(dateValue.getTime());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function dateISO(value) {
|
||||
return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);
|
||||
}
|
||||
function number(value) {
|
||||
return /^[\+-]?(\d+\.?\d*|\.\d+|\d\.\d+e\+\d+)$/.test(value);
|
||||
}
|
||||
function string(value) {
|
||||
return typeof value === "string";
|
||||
}
|
||||
function digits(value) {
|
||||
return /^\d+$/.test(value);
|
||||
}
|
||||
function idCard(value) {
|
||||
return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(
|
||||
value
|
||||
);
|
||||
}
|
||||
function carNo(value) {
|
||||
const xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
|
||||
const creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
|
||||
if (value.length === 7) {
|
||||
return creg.test(value);
|
||||
}
|
||||
if (value.length === 8) {
|
||||
return xreg.test(value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function amount(value) {
|
||||
return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value);
|
||||
}
|
||||
function chinese(value) {
|
||||
const reg = /^[\u4e00-\u9fa5]+$/gi;
|
||||
return reg.test(value);
|
||||
}
|
||||
function letter(value) {
|
||||
return /^[a-zA-Z]*$/.test(value);
|
||||
}
|
||||
function enOrNum(value) {
|
||||
const reg = /^[0-9a-zA-Z]*$/g;
|
||||
return reg.test(value);
|
||||
}
|
||||
function contains(value, param) {
|
||||
return value.indexOf(param) >= 0;
|
||||
}
|
||||
function range(value, param) {
|
||||
return value >= param[0] && value <= param[1];
|
||||
}
|
||||
function rangeLength(value, param) {
|
||||
return value.length >= param[0] && value.length <= param[1];
|
||||
}
|
||||
function landline(value) {
|
||||
const reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/;
|
||||
return reg.test(value);
|
||||
}
|
||||
function empty(value) {
|
||||
switch (typeof value) {
|
||||
case "undefined":
|
||||
return true;
|
||||
case "string":
|
||||
if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, "").length == 0)
|
||||
return true;
|
||||
break;
|
||||
case "boolean":
|
||||
if (!value)
|
||||
return true;
|
||||
break;
|
||||
case "number":
|
||||
if (value === 0 || isNaN(value))
|
||||
return true;
|
||||
break;
|
||||
case "object":
|
||||
if (value === null || value.length === 0)
|
||||
return true;
|
||||
for (const i in value) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function jsonString(value) {
|
||||
if (typeof value === "string") {
|
||||
try {
|
||||
const obj = JSON.parse(value);
|
||||
if (typeof obj === "object" && obj) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function array(value) {
|
||||
if (typeof Array.isArray === "function") {
|
||||
return Array.isArray(value);
|
||||
}
|
||||
return Object.prototype.toString.call(value) === "[object Array]";
|
||||
}
|
||||
function object(value) {
|
||||
return Object.prototype.toString.call(value) === "[object Object]";
|
||||
}
|
||||
function code(value, len = 6) {
|
||||
return new RegExp(`^\\d{${len}}$`).test(value);
|
||||
}
|
||||
function func(value) {
|
||||
return typeof value === "function";
|
||||
}
|
||||
function promise(value) {
|
||||
return object(value) && func(value.then) && func(value.catch);
|
||||
}
|
||||
function image(value) {
|
||||
const newValue = value.split("?")[0];
|
||||
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
||||
return IMAGE_REGEXP.test(newValue);
|
||||
}
|
||||
function video(value) {
|
||||
const VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|m3u8)/i;
|
||||
return VIDEO_REGEXP.test(value);
|
||||
}
|
||||
function regExp(o) {
|
||||
return o && Object.prototype.toString.call(o) === "[object RegExp]";
|
||||
}
|
||||
const test = {
|
||||
email,
|
||||
mobile,
|
||||
url,
|
||||
date,
|
||||
dateISO,
|
||||
number,
|
||||
digits,
|
||||
idCard,
|
||||
carNo,
|
||||
amount,
|
||||
chinese,
|
||||
letter,
|
||||
enOrNum,
|
||||
contains,
|
||||
range,
|
||||
rangeLength,
|
||||
empty,
|
||||
isEmpty: empty,
|
||||
jsonString,
|
||||
landline,
|
||||
object,
|
||||
array,
|
||||
code,
|
||||
func,
|
||||
promise,
|
||||
video,
|
||||
image,
|
||||
regExp,
|
||||
string
|
||||
};
|
||||
exports.array = array;
|
||||
exports.empty = empty;
|
||||
exports.number = number;
|
||||
exports.test = test;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/function/test.js.map
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
let flag;
|
||||
function throttle(func, wait = 500, immediate = true) {
|
||||
if (immediate) {
|
||||
if (!flag) {
|
||||
flag = true;
|
||||
typeof func === "function" && func();
|
||||
setTimeout(() => {
|
||||
flag = false;
|
||||
}, wait);
|
||||
}
|
||||
} else if (!flag) {
|
||||
flag = true;
|
||||
setTimeout(() => {
|
||||
flag = false;
|
||||
typeof func === "function" && func();
|
||||
}, wait);
|
||||
}
|
||||
}
|
||||
exports.throttle = throttle;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/function/throttle.js.map
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../../common/vendor.js");
|
||||
const uni_modules_uviewPlus_libs_luchRequest_helpers_buildURL = require("../helpers/buildURL.js");
|
||||
const uni_modules_uviewPlus_libs_luchRequest_core_buildFullPath = require("../core/buildFullPath.js");
|
||||
const uni_modules_uviewPlus_libs_luchRequest_core_settle = require("../core/settle.js");
|
||||
const uni_modules_uviewPlus_libs_luchRequest_utils = require("../utils.js");
|
||||
const mergeKeys = (keys, config2) => {
|
||||
const config = {};
|
||||
keys.forEach((prop) => {
|
||||
if (!uni_modules_uviewPlus_libs_luchRequest_utils.isUndefined(config2[prop])) {
|
||||
config[prop] = config2[prop];
|
||||
}
|
||||
});
|
||||
return config;
|
||||
};
|
||||
const adapter = (config) => new Promise((resolve, reject) => {
|
||||
const fullPath = uni_modules_uviewPlus_libs_luchRequest_helpers_buildURL.buildURL(uni_modules_uviewPlus_libs_luchRequest_core_buildFullPath.buildFullPath(config.baseURL, config.url), config.params);
|
||||
const _config = {
|
||||
url: fullPath,
|
||||
header: config.header,
|
||||
complete: (response) => {
|
||||
config.fullPath = fullPath;
|
||||
response.config = config;
|
||||
try {
|
||||
if (typeof response.data === "string") {
|
||||
response.data = JSON.parse(response.data);
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
uni_modules_uviewPlus_libs_luchRequest_core_settle.settle(resolve, reject, response);
|
||||
}
|
||||
};
|
||||
let requestTask;
|
||||
if (config.method === "UPLOAD") {
|
||||
delete _config.header["content-type"];
|
||||
delete _config.header["Content-Type"];
|
||||
const otherConfig = {
|
||||
filePath: config.filePath,
|
||||
name: config.name
|
||||
};
|
||||
const optionalKeys = [
|
||||
"formData"
|
||||
];
|
||||
requestTask = common_vendor.index.uploadFile({ ..._config, ...otherConfig, ...mergeKeys(optionalKeys, config) });
|
||||
} else if (config.method === "DOWNLOAD") {
|
||||
requestTask = common_vendor.index.downloadFile(_config);
|
||||
} else {
|
||||
const optionalKeys = [
|
||||
"data",
|
||||
"method",
|
||||
"timeout",
|
||||
"dataType",
|
||||
"responseType"
|
||||
];
|
||||
requestTask = common_vendor.index.request({ ..._config, ...mergeKeys(optionalKeys, config) });
|
||||
}
|
||||
if (config.getTask) {
|
||||
config.getTask(requestTask, config);
|
||||
}
|
||||
});
|
||||
exports.adapter = adapter;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/adapters/index.js.map
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
function InterceptorManager() {
|
||||
this.handlers = [];
|
||||
}
|
||||
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
||||
this.handlers.push({
|
||||
fulfilled,
|
||||
rejected
|
||||
});
|
||||
return this.handlers.length - 1;
|
||||
};
|
||||
InterceptorManager.prototype.eject = function eject(id) {
|
||||
if (this.handlers[id]) {
|
||||
this.handlers[id] = null;
|
||||
}
|
||||
};
|
||||
InterceptorManager.prototype.forEach = function forEach(fn) {
|
||||
this.handlers.forEach((h) => {
|
||||
if (h !== null) {
|
||||
fn(h);
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.InterceptorManager = InterceptorManager;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/core/InterceptorManager.js.map
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../../common/vendor.js");
|
||||
const uni_modules_uviewPlus_libs_luchRequest_core_dispatchRequest = require("./dispatchRequest.js");
|
||||
const uni_modules_uviewPlus_libs_luchRequest_core_InterceptorManager = require("./InterceptorManager.js");
|
||||
const uni_modules_uviewPlus_libs_luchRequest_core_mergeConfig = require("./mergeConfig.js");
|
||||
const uni_modules_uviewPlus_libs_luchRequest_core_defaults = require("./defaults.js");
|
||||
const uni_modules_uviewPlus_libs_luchRequest_utils = require("../utils.js");
|
||||
const uni_modules_uviewPlus_libs_luchRequest_utils_clone = require("../utils/clone.js");
|
||||
class Request {
|
||||
/**
|
||||
* @param {Object} arg - 全局配置
|
||||
* @param {String} arg.baseURL - 全局根路径
|
||||
* @param {Object} arg.header - 全局header
|
||||
* @param {String} arg.method = [GET|POST|PUT|DELETE|CONNECT|HEAD|OPTIONS|TRACE] - 全局默认请求方式
|
||||
* @param {String} arg.dataType = [json] - 全局默认的dataType
|
||||
* @param {String} arg.responseType = [text|arraybuffer] - 全局默认的responseType。支付宝小程序不支持
|
||||
* @param {Object} arg.custom - 全局默认的自定义参数
|
||||
* @param {Number} arg.timeout - 全局默认的超时时间,单位 ms。默认60000。H5(HBuilderX 2.9.9+)、APP(HBuilderX 2.9.9+)、微信小程序(2.10.0)、支付宝小程序
|
||||
* @param {Boolean} arg.sslVerify - 全局默认的是否验证 ssl 证书。默认true.仅App安卓端支持(HBuilderX 2.3.3+)
|
||||
* @param {Boolean} arg.withCredentials - 全局默认的跨域请求时是否携带凭证(cookies)。默认false。仅H5支持(HBuilderX 2.6.15+)
|
||||
* @param {Boolean} arg.firstIpv4 - 全DNS解析时优先使用ipv4。默认false。仅 App-Android 支持 (HBuilderX 2.8.0+)
|
||||
* @param {Function(statusCode):Boolean} arg.validateStatus - 全局默认的自定义验证器。默认statusCode >= 200 && statusCode < 300
|
||||
*/
|
||||
constructor(arg = {}) {
|
||||
if (!uni_modules_uviewPlus_libs_luchRequest_utils.isPlainObject(arg)) {
|
||||
arg = {};
|
||||
common_vendor.index.__f__("warn", "at uni_modules/uview-plus/libs/luch-request/core/Request.js:39", "设置全局参数必须接收一个Object");
|
||||
}
|
||||
this.config = uni_modules_uviewPlus_libs_luchRequest_utils_clone.clone({ ...uni_modules_uviewPlus_libs_luchRequest_core_defaults.defaults, ...arg });
|
||||
this.interceptors = {
|
||||
request: new uni_modules_uviewPlus_libs_luchRequest_core_InterceptorManager.InterceptorManager(),
|
||||
response: new uni_modules_uviewPlus_libs_luchRequest_core_InterceptorManager.InterceptorManager()
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @Function
|
||||
* @param {Request~setConfigCallback} f - 设置全局默认配置
|
||||
*/
|
||||
setConfig(f) {
|
||||
this.config = f(this.config);
|
||||
}
|
||||
middleware(config) {
|
||||
config = uni_modules_uviewPlus_libs_luchRequest_core_mergeConfig.mergeConfig(this.config, config);
|
||||
const chain = [uni_modules_uviewPlus_libs_luchRequest_core_dispatchRequest.dispatchRequest, void 0];
|
||||
let promise = Promise.resolve(config);
|
||||
this.interceptors.request.forEach((interceptor) => {
|
||||
chain.unshift(interceptor.fulfilled, interceptor.rejected);
|
||||
});
|
||||
this.interceptors.response.forEach((interceptor) => {
|
||||
chain.push(interceptor.fulfilled, interceptor.rejected);
|
||||
});
|
||||
while (chain.length) {
|
||||
promise = promise.then(chain.shift(), chain.shift());
|
||||
}
|
||||
return promise;
|
||||
}
|
||||
/**
|
||||
* @Function
|
||||
* @param {Object} config - 请求配置项
|
||||
* @prop {String} options.url - 请求路径
|
||||
* @prop {Object} options.data - 请求参数
|
||||
* @prop {Object} [options.responseType = config.responseType] [text|arraybuffer] - 响应的数据类型
|
||||
* @prop {Object} [options.dataType = config.dataType] - 如果设为 json,会尝试对返回的数据做一次 JSON.parse
|
||||
* @prop {Object} [options.header = config.header] - 请求header
|
||||
* @prop {Object} [options.method = config.method] - 请求方法
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
request(config = {}) {
|
||||
return this.middleware(config);
|
||||
}
|
||||
get(url, options = {}) {
|
||||
return this.middleware({
|
||||
url,
|
||||
method: "GET",
|
||||
...options
|
||||
});
|
||||
}
|
||||
post(url, data, options = {}) {
|
||||
return this.middleware({
|
||||
url,
|
||||
data,
|
||||
method: "POST",
|
||||
...options
|
||||
});
|
||||
}
|
||||
put(url, data, options = {}) {
|
||||
return this.middleware({
|
||||
url,
|
||||
data,
|
||||
method: "PUT",
|
||||
...options
|
||||
});
|
||||
}
|
||||
delete(url, data, options = {}) {
|
||||
return this.middleware({
|
||||
url,
|
||||
data,
|
||||
method: "DELETE",
|
||||
...options
|
||||
});
|
||||
}
|
||||
connect(url, data, options = {}) {
|
||||
return this.middleware({
|
||||
url,
|
||||
data,
|
||||
method: "CONNECT",
|
||||
...options
|
||||
});
|
||||
}
|
||||
head(url, data, options = {}) {
|
||||
return this.middleware({
|
||||
url,
|
||||
data,
|
||||
method: "HEAD",
|
||||
...options
|
||||
});
|
||||
}
|
||||
options(url, data, options = {}) {
|
||||
return this.middleware({
|
||||
url,
|
||||
data,
|
||||
method: "OPTIONS",
|
||||
...options
|
||||
});
|
||||
}
|
||||
trace(url, data, options = {}) {
|
||||
return this.middleware({
|
||||
url,
|
||||
data,
|
||||
method: "TRACE",
|
||||
...options
|
||||
});
|
||||
}
|
||||
upload(url, config = {}) {
|
||||
config.url = url;
|
||||
config.method = "UPLOAD";
|
||||
return this.middleware(config);
|
||||
}
|
||||
download(url, config = {}) {
|
||||
config.url = url;
|
||||
config.method = "DOWNLOAD";
|
||||
return this.middleware(config);
|
||||
}
|
||||
}
|
||||
exports.Request = Request;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/core/Request.js.map
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_luchRequest_helpers_isAbsoluteURL = require("../helpers/isAbsoluteURL.js");
|
||||
const uni_modules_uviewPlus_libs_luchRequest_helpers_combineURLs = require("../helpers/combineURLs.js");
|
||||
function buildFullPath(baseURL, requestedURL) {
|
||||
if (baseURL && !uni_modules_uviewPlus_libs_luchRequest_helpers_isAbsoluteURL.isAbsoluteURL(requestedURL)) {
|
||||
return uni_modules_uviewPlus_libs_luchRequest_helpers_combineURLs.combineURLs(baseURL, requestedURL);
|
||||
}
|
||||
return requestedURL;
|
||||
}
|
||||
exports.buildFullPath = buildFullPath;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/core/buildFullPath.js.map
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
const defaults = {
|
||||
baseURL: "",
|
||||
header: {},
|
||||
method: "GET",
|
||||
dataType: "json",
|
||||
responseType: "text",
|
||||
custom: {},
|
||||
timeout: 6e4,
|
||||
validateStatus: function validateStatus(status) {
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
};
|
||||
exports.defaults = defaults;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/core/defaults.js.map
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_luchRequest_adapters_index = require("../adapters/index.js");
|
||||
const dispatchRequest = (config) => uni_modules_uviewPlus_libs_luchRequest_adapters_index.adapter(config);
|
||||
exports.dispatchRequest = dispatchRequest;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/core/dispatchRequest.js.map
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_luchRequest_utils = require("../utils.js");
|
||||
const mergeKeys = (keys, globalsConfig, config2) => {
|
||||
const config = {};
|
||||
keys.forEach((prop) => {
|
||||
if (!uni_modules_uviewPlus_libs_luchRequest_utils.isUndefined(config2[prop])) {
|
||||
config[prop] = config2[prop];
|
||||
} else if (!uni_modules_uviewPlus_libs_luchRequest_utils.isUndefined(globalsConfig[prop])) {
|
||||
config[prop] = globalsConfig[prop];
|
||||
}
|
||||
});
|
||||
return config;
|
||||
};
|
||||
const mergeConfig = (globalsConfig, config2 = {}) => {
|
||||
const method = config2.method || globalsConfig.method || "GET";
|
||||
let config = {
|
||||
baseURL: globalsConfig.baseURL || "",
|
||||
method,
|
||||
url: config2.url || "",
|
||||
params: config2.params || {},
|
||||
custom: { ...globalsConfig.custom || {}, ...config2.custom || {} },
|
||||
header: uni_modules_uviewPlus_libs_luchRequest_utils.deepMerge(globalsConfig.header || {}, config2.header || {})
|
||||
};
|
||||
const defaultToConfig2Keys = ["getTask", "validateStatus"];
|
||||
config = { ...config, ...mergeKeys(defaultToConfig2Keys, globalsConfig, config2) };
|
||||
if (method === "DOWNLOAD")
|
||||
;
|
||||
else if (method === "UPLOAD") {
|
||||
delete config.header["content-type"];
|
||||
delete config.header["Content-Type"];
|
||||
const uploadKeys = [
|
||||
"filePath",
|
||||
"name",
|
||||
"formData"
|
||||
];
|
||||
uploadKeys.forEach((prop) => {
|
||||
if (!uni_modules_uviewPlus_libs_luchRequest_utils.isUndefined(config2[prop])) {
|
||||
config[prop] = config2[prop];
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const defaultsKeys = [
|
||||
"data",
|
||||
"timeout",
|
||||
"dataType",
|
||||
"responseType"
|
||||
];
|
||||
config = { ...config, ...mergeKeys(defaultsKeys, globalsConfig, config2) };
|
||||
}
|
||||
return config;
|
||||
};
|
||||
exports.mergeConfig = mergeConfig;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/core/mergeConfig.js.map
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
function settle(resolve, reject, response) {
|
||||
const { validateStatus } = response.config;
|
||||
const status = response.statusCode;
|
||||
if (status && (!validateStatus || validateStatus(status))) {
|
||||
resolve(response);
|
||||
} else {
|
||||
reject(response);
|
||||
}
|
||||
}
|
||||
exports.settle = settle;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/core/settle.js.map
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_luchRequest_utils = require("../utils.js");
|
||||
function encode(val) {
|
||||
return encodeURIComponent(val).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
||||
}
|
||||
function buildURL(url, params) {
|
||||
if (!params) {
|
||||
return url;
|
||||
}
|
||||
let serializedParams;
|
||||
if (uni_modules_uviewPlus_libs_luchRequest_utils.isURLSearchParams(params)) {
|
||||
serializedParams = params.toString();
|
||||
} else {
|
||||
const parts = [];
|
||||
uni_modules_uviewPlus_libs_luchRequest_utils.forEach(params, (val, key) => {
|
||||
if (val === null || typeof val === "undefined") {
|
||||
return;
|
||||
}
|
||||
if (uni_modules_uviewPlus_libs_luchRequest_utils.isArray(val)) {
|
||||
key = `${key}[]`;
|
||||
} else {
|
||||
val = [val];
|
||||
}
|
||||
uni_modules_uviewPlus_libs_luchRequest_utils.forEach(val, (v) => {
|
||||
if (uni_modules_uviewPlus_libs_luchRequest_utils.isDate(v)) {
|
||||
v = v.toISOString();
|
||||
} else if (uni_modules_uviewPlus_libs_luchRequest_utils.isObject(v)) {
|
||||
v = JSON.stringify(v);
|
||||
}
|
||||
parts.push(`${encode(key)}=${encode(v)}`);
|
||||
});
|
||||
});
|
||||
serializedParams = parts.join("&");
|
||||
}
|
||||
if (serializedParams) {
|
||||
const hashmarkIndex = url.indexOf("#");
|
||||
if (hashmarkIndex !== -1) {
|
||||
url = url.slice(0, hashmarkIndex);
|
||||
}
|
||||
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
exports.buildURL = buildURL;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/helpers/buildURL.js.map
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
function combineURLs(baseURL, relativeURL) {
|
||||
return relativeURL ? `${baseURL.replace(/\/+$/, "")}/${relativeURL.replace(/^\/+/, "")}` : baseURL;
|
||||
}
|
||||
exports.combineURLs = combineURLs;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/helpers/combineURLs.js.map
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
function isAbsoluteURL(url) {
|
||||
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
||||
}
|
||||
exports.isAbsoluteURL = isAbsoluteURL;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/helpers/isAbsoluteURL.js.map
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_luchRequest_core_Request = require("./core/Request.js");
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/index.js.map
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
const { toString } = Object.prototype;
|
||||
function isArray(val) {
|
||||
return toString.call(val) === "[object Array]";
|
||||
}
|
||||
function isObject(val) {
|
||||
return val !== null && typeof val === "object";
|
||||
}
|
||||
function isDate(val) {
|
||||
return toString.call(val) === "[object Date]";
|
||||
}
|
||||
function isURLSearchParams(val) {
|
||||
return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams;
|
||||
}
|
||||
function forEach(obj, fn) {
|
||||
if (obj === null || typeof obj === "undefined") {
|
||||
return;
|
||||
}
|
||||
if (typeof obj !== "object") {
|
||||
obj = [obj];
|
||||
}
|
||||
if (isArray(obj)) {
|
||||
for (let i = 0, l = obj.length; i < l; i++) {
|
||||
fn.call(null, obj[i], i, obj);
|
||||
}
|
||||
} else {
|
||||
for (const key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
fn.call(null, obj[key], key, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function isPlainObject(obj) {
|
||||
return Object.prototype.toString.call(obj) === "[object Object]";
|
||||
}
|
||||
function deepMerge() {
|
||||
const result = {};
|
||||
function assignValue(val, key) {
|
||||
if (typeof result[key] === "object" && typeof val === "object") {
|
||||
result[key] = deepMerge(result[key], val);
|
||||
} else if (typeof val === "object") {
|
||||
result[key] = deepMerge({}, val);
|
||||
} else {
|
||||
result[key] = val;
|
||||
}
|
||||
}
|
||||
for (let i = 0, l = arguments.length; i < l; i++) {
|
||||
forEach(arguments[i], assignValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function isUndefined(val) {
|
||||
return typeof val === "undefined";
|
||||
}
|
||||
exports.deepMerge = deepMerge;
|
||||
exports.forEach = forEach;
|
||||
exports.isArray = isArray;
|
||||
exports.isDate = isDate;
|
||||
exports.isObject = isObject;
|
||||
exports.isPlainObject = isPlainObject;
|
||||
exports.isURLSearchParams = isURLSearchParams;
|
||||
exports.isUndefined = isUndefined;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/utils.js.map
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
"use strict";
|
||||
var clone = function() {
|
||||
function _instanceof(obj, type) {
|
||||
return type != null && obj instanceof type;
|
||||
}
|
||||
var nativeMap;
|
||||
try {
|
||||
nativeMap = Map;
|
||||
} catch (_) {
|
||||
nativeMap = function() {
|
||||
};
|
||||
}
|
||||
var nativeSet;
|
||||
try {
|
||||
nativeSet = Set;
|
||||
} catch (_) {
|
||||
nativeSet = function() {
|
||||
};
|
||||
}
|
||||
var nativePromise;
|
||||
try {
|
||||
nativePromise = Promise;
|
||||
} catch (_) {
|
||||
nativePromise = function() {
|
||||
};
|
||||
}
|
||||
function clone2(parent, circular, depth, prototype, includeNonEnumerable) {
|
||||
if (typeof circular === "object") {
|
||||
depth = circular.depth;
|
||||
prototype = circular.prototype;
|
||||
includeNonEnumerable = circular.includeNonEnumerable;
|
||||
circular = circular.circular;
|
||||
}
|
||||
var allParents = [];
|
||||
var allChildren = [];
|
||||
var useBuffer = typeof Buffer != "undefined";
|
||||
if (typeof circular == "undefined")
|
||||
circular = true;
|
||||
if (typeof depth == "undefined")
|
||||
depth = Infinity;
|
||||
function _clone(parent2, depth2) {
|
||||
if (parent2 === null)
|
||||
return null;
|
||||
if (depth2 === 0)
|
||||
return parent2;
|
||||
var child;
|
||||
var proto;
|
||||
if (typeof parent2 != "object") {
|
||||
return parent2;
|
||||
}
|
||||
if (_instanceof(parent2, nativeMap)) {
|
||||
child = new nativeMap();
|
||||
} else if (_instanceof(parent2, nativeSet)) {
|
||||
child = new nativeSet();
|
||||
} else if (_instanceof(parent2, nativePromise)) {
|
||||
child = new nativePromise(function(resolve, reject) {
|
||||
parent2.then(function(value) {
|
||||
resolve(_clone(value, depth2 - 1));
|
||||
}, function(err) {
|
||||
reject(_clone(err, depth2 - 1));
|
||||
});
|
||||
});
|
||||
} else if (clone2.__isArray(parent2)) {
|
||||
child = [];
|
||||
} else if (clone2.__isRegExp(parent2)) {
|
||||
child = new RegExp(parent2.source, __getRegExpFlags(parent2));
|
||||
if (parent2.lastIndex)
|
||||
child.lastIndex = parent2.lastIndex;
|
||||
} else if (clone2.__isDate(parent2)) {
|
||||
child = new Date(parent2.getTime());
|
||||
} else if (useBuffer && Buffer.isBuffer(parent2)) {
|
||||
if (Buffer.from) {
|
||||
child = Buffer.from(parent2);
|
||||
} else {
|
||||
child = new Buffer(parent2.length);
|
||||
parent2.copy(child);
|
||||
}
|
||||
return child;
|
||||
} else if (_instanceof(parent2, Error)) {
|
||||
child = Object.create(parent2);
|
||||
} else {
|
||||
if (typeof prototype == "undefined") {
|
||||
proto = Object.getPrototypeOf(parent2);
|
||||
child = Object.create(proto);
|
||||
} else {
|
||||
child = Object.create(prototype);
|
||||
proto = prototype;
|
||||
}
|
||||
}
|
||||
if (circular) {
|
||||
var index = allParents.indexOf(parent2);
|
||||
if (index != -1) {
|
||||
return allChildren[index];
|
||||
}
|
||||
allParents.push(parent2);
|
||||
allChildren.push(child);
|
||||
}
|
||||
if (_instanceof(parent2, nativeMap)) {
|
||||
parent2.forEach(function(value, key) {
|
||||
var keyChild = _clone(key, depth2 - 1);
|
||||
var valueChild = _clone(value, depth2 - 1);
|
||||
child.set(keyChild, valueChild);
|
||||
});
|
||||
}
|
||||
if (_instanceof(parent2, nativeSet)) {
|
||||
parent2.forEach(function(value) {
|
||||
var entryChild = _clone(value, depth2 - 1);
|
||||
child.add(entryChild);
|
||||
});
|
||||
}
|
||||
for (var i in parent2) {
|
||||
var attrs = Object.getOwnPropertyDescriptor(parent2, i);
|
||||
if (attrs) {
|
||||
child[i] = _clone(parent2[i], depth2 - 1);
|
||||
}
|
||||
try {
|
||||
var objProperty = Object.getOwnPropertyDescriptor(parent2, i);
|
||||
if (objProperty.set === "undefined") {
|
||||
continue;
|
||||
}
|
||||
child[i] = _clone(parent2[i], depth2 - 1);
|
||||
} catch (e) {
|
||||
if (e instanceof TypeError) {
|
||||
continue;
|
||||
} else if (e instanceof ReferenceError) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
var symbols = Object.getOwnPropertySymbols(parent2);
|
||||
for (var i = 0; i < symbols.length; i++) {
|
||||
var symbol = symbols[i];
|
||||
var descriptor = Object.getOwnPropertyDescriptor(parent2, symbol);
|
||||
if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
|
||||
continue;
|
||||
}
|
||||
child[symbol] = _clone(parent2[symbol], depth2 - 1);
|
||||
Object.defineProperty(child, symbol, descriptor);
|
||||
}
|
||||
}
|
||||
if (includeNonEnumerable) {
|
||||
var allPropertyNames = Object.getOwnPropertyNames(parent2);
|
||||
for (var i = 0; i < allPropertyNames.length; i++) {
|
||||
var propertyName = allPropertyNames[i];
|
||||
var descriptor = Object.getOwnPropertyDescriptor(parent2, propertyName);
|
||||
if (descriptor && descriptor.enumerable) {
|
||||
continue;
|
||||
}
|
||||
child[propertyName] = _clone(parent2[propertyName], depth2 - 1);
|
||||
Object.defineProperty(child, propertyName, descriptor);
|
||||
}
|
||||
}
|
||||
return child;
|
||||
}
|
||||
return _clone(parent, depth);
|
||||
}
|
||||
clone2.clonePrototype = function clonePrototype(parent) {
|
||||
if (parent === null)
|
||||
return null;
|
||||
var c = function() {
|
||||
};
|
||||
c.prototype = parent;
|
||||
return new c();
|
||||
};
|
||||
function __objToStr(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
}
|
||||
clone2.__objToStr = __objToStr;
|
||||
function __isDate(o) {
|
||||
return typeof o === "object" && __objToStr(o) === "[object Date]";
|
||||
}
|
||||
clone2.__isDate = __isDate;
|
||||
function __isArray(o) {
|
||||
return typeof o === "object" && __objToStr(o) === "[object Array]";
|
||||
}
|
||||
clone2.__isArray = __isArray;
|
||||
function __isRegExp(o) {
|
||||
return typeof o === "object" && __objToStr(o) === "[object RegExp]";
|
||||
}
|
||||
clone2.__isRegExp = __isRegExp;
|
||||
function __getRegExpFlags(re) {
|
||||
var flags = "";
|
||||
if (re.global)
|
||||
flags += "g";
|
||||
if (re.ignoreCase)
|
||||
flags += "i";
|
||||
if (re.multiline)
|
||||
flags += "m";
|
||||
return flags;
|
||||
}
|
||||
clone2.__getRegExpFlags = __getRegExpFlags;
|
||||
return clone2;
|
||||
}();
|
||||
exports.clone = clone;
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/luch-request/utils/clone.js.map
|
||||
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_vue = require("../vue.js");
|
||||
const buttonMixin = uni_modules_uviewPlus_libs_vue.defineMixin({
|
||||
props: {
|
||||
lang: String,
|
||||
sessionFrom: String,
|
||||
sendMessageTitle: String,
|
||||
sendMessagePath: String,
|
||||
sendMessageImg: String,
|
||||
showMessageCard: Boolean,
|
||||
appParameter: String,
|
||||
formType: String,
|
||||
openType: String
|
||||
}
|
||||
});
|
||||
exports.buttonMixin = buttonMixin;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/mixin/button.js.map
|
||||
@@ -0,0 +1,140 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uviewPlus_libs_vue = require("../vue.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../function/index.js");
|
||||
const uni_modules_uviewPlus_libs_function_test = require("../function/test.js");
|
||||
const uni_modules_uviewPlus_libs_util_route = require("../util/route.js");
|
||||
const mixin = uni_modules_uviewPlus_libs_vue.defineMixin({
|
||||
// 定义每个组件都可能需要用到的外部样式以及类名
|
||||
props: {
|
||||
// 每个组件都有的父组件传递的样式,可以为字符串或者对象形式
|
||||
customStyle: {
|
||||
type: [Object, String],
|
||||
default: () => ({})
|
||||
},
|
||||
customClass: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
// 跳转的页面路径
|
||||
url: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
// 页面跳转的类型
|
||||
linkType: {
|
||||
type: String,
|
||||
default: "navigateTo"
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
onLoad() {
|
||||
this.$u.getRect = this.$uGetRect;
|
||||
},
|
||||
created() {
|
||||
this.$u.getRect = this.$uGetRect;
|
||||
},
|
||||
computed: {
|
||||
// 在2.x版本中,将会把$u挂载到uni对象下,导致在模板中无法使用uni.$u.xxx形式
|
||||
// 所以这里通过computed计算属性将其附加到this.$u上,就可以在模板或者js中使用uni.$u.xxx
|
||||
// 只在nvue环境通过此方式引入完整的$u,其他平台会出现性能问题,非nvue则按需引入(主要原因是props过大)
|
||||
$u() {
|
||||
return uni_modules_uviewPlus_libs_function_index.deepMerge(common_vendor.index.$u, {
|
||||
props: void 0,
|
||||
http: void 0,
|
||||
mixin: void 0
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生成bem规则类名
|
||||
* 由于微信小程序,H5,nvue之间绑定class的差异,无法通过:class="[bem()]"的形式进行同用
|
||||
* 故采用如下折中做法,最后返回的是数组(一般平台)或字符串(支付宝和字节跳动平台),类似['a', 'b', 'c']或'a b c'的形式
|
||||
* @param {String} name 组件名称
|
||||
* @param {Array} fixed 一直会存在的类名
|
||||
* @param {Array} change 会根据变量值为true或者false而出现或者隐藏的类名
|
||||
* @returns {Array|string}
|
||||
*/
|
||||
bem() {
|
||||
return function(name, fixed, change) {
|
||||
const prefix = `u-${name}--`;
|
||||
const classes = {};
|
||||
if (fixed) {
|
||||
fixed.map((item) => {
|
||||
classes[prefix + this[item]] = true;
|
||||
});
|
||||
}
|
||||
if (change) {
|
||||
change.map((item) => {
|
||||
this[item] ? classes[prefix + item] = this[item] : delete classes[prefix + item];
|
||||
});
|
||||
}
|
||||
return Object.keys(classes);
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 跳转某一个页面
|
||||
openPage(urlKey = "url") {
|
||||
const url = this[urlKey];
|
||||
if (url) {
|
||||
uni_modules_uviewPlus_libs_util_route.route({ type: this.linkType, url });
|
||||
}
|
||||
},
|
||||
navTo(url = "", linkType = "navigateTo") {
|
||||
uni_modules_uviewPlus_libs_util_route.route({ type: this.linkType, url });
|
||||
},
|
||||
// 查询节点信息
|
||||
// 目前此方法在支付宝小程序中无法获取组件跟接点的尺寸,为支付宝的bug(2020-07-21)
|
||||
// 解决办法为在组件根部再套一个没有任何作用的view元素
|
||||
$uGetRect(selector, all) {
|
||||
return new Promise((resolve) => {
|
||||
common_vendor.index.createSelectorQuery().in(this)[all ? "selectAll" : "select"](selector).boundingClientRect((rect) => {
|
||||
if (all && Array.isArray(rect) && rect.length) {
|
||||
resolve(rect);
|
||||
}
|
||||
if (!all && rect) {
|
||||
resolve(rect);
|
||||
}
|
||||
}).exec();
|
||||
});
|
||||
},
|
||||
getParentData(parentName = "") {
|
||||
if (!this.parent)
|
||||
this.parent = {};
|
||||
this.parent = uni_modules_uviewPlus_libs_function_index.$parent.call(this, parentName);
|
||||
if (this.parent.children) {
|
||||
this.parent.children.indexOf(this) === -1 && this.parent.children.push(this);
|
||||
}
|
||||
if (this.parent && this.parentData) {
|
||||
Object.keys(this.parentData).map((key) => {
|
||||
this.parentData[key] = this.parent[key];
|
||||
});
|
||||
}
|
||||
},
|
||||
// 阻止事件冒泡
|
||||
preventEvent(e) {
|
||||
e && typeof e.stopPropagation === "function" && e.stopPropagation();
|
||||
},
|
||||
// 空操作
|
||||
noop(e) {
|
||||
this.preventEvent(e);
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
common_vendor.index.$emit("uOnReachBottom");
|
||||
},
|
||||
beforeUnmount() {
|
||||
if (this.parent && uni_modules_uviewPlus_libs_function_test.test.array(this.parent.children)) {
|
||||
const childrenList = this.parent.children;
|
||||
childrenList.map((child, index) => {
|
||||
if (child === this) {
|
||||
childrenList.splice(index, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
exports.mixin = mixin;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/mixin/mixin.js.map
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_vue = require("../vue.js");
|
||||
const mpMixin = uni_modules_uviewPlus_libs_vue.defineMixin({
|
||||
// 将自定义节点设置成虚拟的,更加接近Vue组件的表现,能更好的使用flex属性
|
||||
options: {
|
||||
virtualHost: true
|
||||
}
|
||||
});
|
||||
exports.mpMixin = mpMixin;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/mixin/mpMixin.js.map
|
||||
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_vue = require("../vue.js");
|
||||
const openType = uni_modules_uviewPlus_libs_vue.defineMixin({
|
||||
props: {
|
||||
openType: String
|
||||
},
|
||||
methods: {
|
||||
onGetUserInfo(event) {
|
||||
this.$emit("getuserinfo", event.detail);
|
||||
},
|
||||
onContact(event) {
|
||||
this.$emit("contact", event.detail);
|
||||
},
|
||||
onGetPhoneNumber(event) {
|
||||
this.$emit("getphonenumber", event.detail);
|
||||
},
|
||||
onError(event) {
|
||||
this.$emit("error", event.detail);
|
||||
},
|
||||
onLaunchApp(event) {
|
||||
this.$emit("launchapp", event.detail);
|
||||
},
|
||||
onOpenSetting(event) {
|
||||
this.$emit("opensetting", event.detail);
|
||||
}
|
||||
}
|
||||
});
|
||||
exports.openType = openType;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/mixin/openType.js.map
|
||||
@@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../function/index.js");
|
||||
class Router {
|
||||
constructor() {
|
||||
this.config = {
|
||||
type: "navigateTo",
|
||||
url: "",
|
||||
delta: 1,
|
||||
// navigateBack页面后退时,回退的层数
|
||||
params: {},
|
||||
// 传递的参数
|
||||
animationType: "pop-in",
|
||||
// 窗口动画,只在APP有效
|
||||
animationDuration: 300,
|
||||
// 窗口动画持续时间,单位毫秒,只在APP有效
|
||||
intercept: false
|
||||
// 是否需要拦截
|
||||
};
|
||||
this.route = this.route.bind(this);
|
||||
}
|
||||
// 判断url前面是否有"/",如果没有则加上,否则无法跳转
|
||||
addRootPath(url) {
|
||||
return url[0] === "/" ? url : `/${url}`;
|
||||
}
|
||||
// 整合路由参数
|
||||
mixinParam(url, params) {
|
||||
url = url && this.addRootPath(url);
|
||||
let query = "";
|
||||
if (/.*\/.*\?.*=.*/.test(url)) {
|
||||
query = uni_modules_uviewPlus_libs_function_index.queryParams(params, false);
|
||||
return url += `&${query}`;
|
||||
}
|
||||
query = uni_modules_uviewPlus_libs_function_index.queryParams(params);
|
||||
return url += query;
|
||||
}
|
||||
// 对外的方法名称
|
||||
async route(options = {}, params = {}) {
|
||||
let mergeConfig = {};
|
||||
if (typeof options === "string") {
|
||||
mergeConfig.url = this.mixinParam(options, params);
|
||||
mergeConfig.type = "navigateTo";
|
||||
} else {
|
||||
mergeConfig = uni_modules_uviewPlus_libs_function_index.deepMerge(this.config, options);
|
||||
mergeConfig.url = this.mixinParam(options.url, options.params);
|
||||
}
|
||||
if (mergeConfig.url === uni_modules_uviewPlus_libs_function_index.page())
|
||||
return;
|
||||
if (params.intercept) {
|
||||
this.config.intercept = params.intercept;
|
||||
}
|
||||
mergeConfig.params = params;
|
||||
mergeConfig = uni_modules_uviewPlus_libs_function_index.deepMerge(this.config, mergeConfig);
|
||||
if (typeof common_vendor.index.$u.routeIntercept === "function") {
|
||||
const isNext = await new Promise((resolve, reject) => {
|
||||
common_vendor.index.$u.routeIntercept(mergeConfig, resolve);
|
||||
});
|
||||
isNext && this.openPage(mergeConfig);
|
||||
} else {
|
||||
this.openPage(mergeConfig);
|
||||
}
|
||||
}
|
||||
// 执行路由跳转
|
||||
openPage(config) {
|
||||
const {
|
||||
url,
|
||||
type,
|
||||
delta,
|
||||
animationType,
|
||||
animationDuration
|
||||
} = config;
|
||||
if (config.type == "navigateTo" || config.type == "to") {
|
||||
common_vendor.index.navigateTo({
|
||||
url,
|
||||
animationType,
|
||||
animationDuration
|
||||
});
|
||||
}
|
||||
if (config.type == "redirectTo" || config.type == "redirect") {
|
||||
common_vendor.index.redirectTo({
|
||||
url
|
||||
});
|
||||
}
|
||||
if (config.type == "switchTab" || config.type == "tab") {
|
||||
common_vendor.index.switchTab({
|
||||
url
|
||||
});
|
||||
}
|
||||
if (config.type == "reLaunch" || config.type == "launch") {
|
||||
common_vendor.index.reLaunch({
|
||||
url
|
||||
});
|
||||
}
|
||||
if (config.type == "navigateBack" || config.type == "back") {
|
||||
common_vendor.index.navigateBack({
|
||||
delta
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
const route = new Router().route;
|
||||
exports.route = route;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/util/route.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
const defineMixin = (options) => {
|
||||
return options;
|
||||
};
|
||||
exports.defineMixin = defineMixin;
|
||||
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/libs/vue.js.map
|
||||
Reference in New Issue
Block a user